forked from coracle/zooid
Add blossom.authenticated_read config setting
This commit is contained in:
@@ -95,6 +95,7 @@ Configures NIP 86 support.
|
|||||||
Configures blossom support.
|
Configures blossom support.
|
||||||
|
|
||||||
- `enabled` - whether blossom is enabled.
|
- `enabled` - whether blossom is enabled.
|
||||||
|
- `authenticated_read` - whether users must perform NIP 98 AUTH in order to fetch a file.
|
||||||
|
|
||||||
### `[push]`
|
### `[push]`
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ func (bl *BlossomStore) Enable(instance *Instance) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
backend.RejectGet = func(ctx context.Context, auth *nostr.Event, sha256 string, ext string) (bool, string, int) {
|
backend.RejectGet = func(ctx context.Context, auth *nostr.Event, sha256 string, ext string) (bool, string, int) {
|
||||||
|
if !bl.Config.Blossom.AuthenticatedRead {
|
||||||
|
return false, "", 200
|
||||||
|
}
|
||||||
|
|
||||||
if auth == nil || !instance.Management.IsMember(auth.PubKey) {
|
if auth == nil || !instance.Management.IsMember(auth.PubKey) {
|
||||||
return true, "unauthorized", 403
|
return true, "unauthorized", 403
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -45,7 +45,8 @@ type Config struct {
|
|||||||
} `toml:"management" json:"management"`
|
} `toml:"management" json:"management"`
|
||||||
|
|
||||||
Blossom struct {
|
Blossom struct {
|
||||||
Enabled bool `toml:"enabled" json:"enabled"`
|
Enabled bool `toml:"enabled" json:"enabled"`
|
||||||
|
AuthenticatedRead bool `toml:"authenticated_read" json:"authenticated_read"`
|
||||||
} `toml:"blossom" json:"blossom"`
|
} `toml:"blossom" json:"blossom"`
|
||||||
|
|
||||||
Livekit struct {
|
Livekit struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user