forked from coracle/zooid
Update config
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package zooid
|
||||
|
||||
import (
|
||||
"fiatjaf.com/nostr/khatru"
|
||||
)
|
||||
|
||||
func EnableBlossom(config *Config, relay *khatru.Relay) {
|
||||
}
|
||||
+11
-3
@@ -21,15 +21,23 @@ type Config struct {
|
||||
AutoLeave bool `toml:"auto_leave"`
|
||||
} `toml:"groups"`
|
||||
|
||||
Management struct {
|
||||
Enabled bool `toml:"enabled"`
|
||||
Methods []string `toml:"methods"`
|
||||
} `toml:"management"`
|
||||
|
||||
Blossom struct {
|
||||
Enabled bool `toml:"enabled"`
|
||||
Directory string `toml:"directory"`
|
||||
} `toml:"blossom"`
|
||||
|
||||
Roles map[string]struct {
|
||||
Pubkeys []string `toml:"pubkeys"`
|
||||
Nip86Methods []string `toml:"nip86_methods"`
|
||||
CanInvite bool `toml:"can_invite"`
|
||||
} `toml:"roles"`
|
||||
|
||||
Data struct {
|
||||
Sqlite string `toml:"sqlite"`
|
||||
Media string `toml:"media"`
|
||||
Events string `toml:"events"`
|
||||
} `toml:"data"`
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package zooid
|
||||
|
||||
import (
|
||||
"fiatjaf.com/nostr/khatru"
|
||||
)
|
||||
|
||||
func EnableGroups(config *Config, relay *khatru.Relay) {
|
||||
relay.Info.SupportedNIPs = append(relay.Info.SupportedNIPs, 29)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package zooid
|
||||
|
||||
import (
|
||||
"fiatjaf.com/nostr/khatru"
|
||||
)
|
||||
|
||||
func EnableManagement(config *Config, relay *khatru.Relay) {
|
||||
}
|
||||
+29
-1
@@ -1,12 +1,40 @@
|
||||
package zooid
|
||||
|
||||
import (
|
||||
"fiatjaf.com/nostr/khatru"
|
||||
"sync"
|
||||
|
||||
"fiatjaf.com/nostr/khatru"
|
||||
)
|
||||
|
||||
func MakeRelay(hostname string, config *Config) *khatru.Relay {
|
||||
relay := khatru.NewRelay()
|
||||
relay.Info.Name = config.Name
|
||||
relay.Info.Icon = config.Icon
|
||||
relay.Info.PubKey = config.Pubkey
|
||||
relay.Info.Description = config.Description
|
||||
relay.Info.Self = nostr.GetPublicKey(config.Secret)
|
||||
relay.Info.Software = "https://github.com/coracle-social/zooid"
|
||||
relay.Info.Version = "v0.1.0"
|
||||
|
||||
relay.OnConnect = append(relay.OnConnect, khatru.RequestAuth)
|
||||
relay.RejectFilter = append(relay.RejectFilter, RejectFilter)
|
||||
relay.QueryEvents = append(relay.QueryEvents, QueryEvents)
|
||||
relay.DeleteEvent = append(relay.DeleteEvent, DeleteEvent)
|
||||
relay.RejectEvent = append(relay.RejectEvent, RejectEvent)
|
||||
relay.StoreEvent = append(relay.StoreEvent, SaveEvent)
|
||||
relay.OnEventSaved = append(relay.OnEventSaved, OnEventSaved)
|
||||
|
||||
if config.Groups.Enabled {
|
||||
EnableGroups(config, relay)
|
||||
}
|
||||
|
||||
if config.Blossom.Enabled {
|
||||
EnableBlossom(config, relay)
|
||||
}
|
||||
|
||||
if config.Management.Enabled {
|
||||
EnableManagement(config, relay)
|
||||
}
|
||||
|
||||
return relay
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user