Add handlers

This commit is contained in:
Jon Staab
2025-09-26 11:38:08 -07:00
parent 174e1a361f
commit 86a6eec127
8 changed files with 385 additions and 349 deletions
+17 -3
View File
@@ -15,7 +15,7 @@ type Role struct {
}
type Config struct {
Host string
Host string
Self struct {
Name string `toml:"name"`
Icon string `toml:"icon"`
@@ -25,6 +25,10 @@ type Config struct {
Description string `toml:"description"`
} `toml:"self"`
Policy struct {
StripSignatures bool `toml:"strip_signatures"`
} `toml:"policy"`
Groups struct {
Enabled bool `toml:"enabled"`
AutoJoin bool `toml:"auto_join"`
@@ -79,8 +83,8 @@ func (config *Config) GetRolesForPubkey(pubkey nostr.PubKey) []Role {
return roles
}
func (config *Config) CanManage(roles []Role) bool {
for _, role := range roles {
func (config *Config) CanManage(pubkey nostr.PubKey) bool {
for _, role := range config.GetRolesForPubkey(pubkey) {
if role.CanManage {
return true
}
@@ -88,3 +92,13 @@ func (config *Config) CanManage(roles []Role) bool {
return false
}
func (config *Config) CanInvite(pubkey nostr.PubKey) bool {
for _, role := range config.GetRolesForPubkey(pubkey) {
if role.CanInvite {
return true
}
}
return false
}