Segregate media by subdirectory

This commit is contained in:
Jon Staab
2026-02-27 11:28:36 -08:00
parent 66d6bc448f
commit d0520bbe3c
+3 -1
View File
@@ -9,6 +9,7 @@ import (
"fiatjaf.com/nostr" "fiatjaf.com/nostr"
"fiatjaf.com/nostr/eventstore" "fiatjaf.com/nostr/eventstore"
"fiatjaf.com/nostr/khatru/blossom" "fiatjaf.com/nostr/khatru/blossom"
"github.com/gosimple/slug"
"github.com/spf13/afero" "github.com/spf13/afero"
) )
@@ -18,8 +19,9 @@ type BlossomStore struct {
} }
func (bl *BlossomStore) Enable(instance *Instance) { func (bl *BlossomStore) Enable(instance *Instance) {
dir := Env("MEDIA") dir := Env("MEDIA") + "/" + slug.Make(bl.Config.Schema)
fs := afero.NewOsFs() fs := afero.NewOsFs()
fs.MkdirAll(dir, 0755)
backend := blossom.New(instance.Relay, "https://"+bl.Config.Host) backend := blossom.New(instance.Relay, "https://"+bl.Config.Host)
backend.Store = blossom.EventStoreBlobIndexWrapper{ backend.Store = blossom.EventStoreBlobIndexWrapper{