fs: articles and wikis.

This commit is contained in:
fiatjaf
2025-03-10 16:02:47 -03:00
parent a828ee3793
commit 3031568266
4 changed files with 341 additions and 51 deletions

View File

@@ -3,6 +3,7 @@ package nostrfs
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
@@ -12,7 +13,6 @@ import (
"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/mailru/easyjson"
"github.com/nbd-wtf/go-nostr"
"github.com/nbd-wtf/go-nostr/nip10"
"github.com/nbd-wtf/go-nostr/nip19"
@@ -74,7 +74,7 @@ func CreateEventDir(
fs.StableAttr{Mode: syscall.S_IFLNK},
), true)
eventj, _ := easyjson.Marshal(event)
eventj, _ := json.MarshalIndent(event, "", " ")
h.AddChild("event.json", h.NewPersistentInode(
ctx,
&fs.MemRegularFile{
@@ -97,7 +97,7 @@ func CreateEventDir(
Mode: 0444,
Ctime: uint64(event.CreatedAt),
Mtime: uint64(event.CreatedAt),
Size: uint64(len(event.Content)),
Size: uint64(64),
},
},
fs.StableAttr{},