alpha
Login
or
Join now
anhgelus.world
/
small-web
Star
1
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Welcome to anhgelus's logs.
anhgelus.world
standard-site
go
markdown
indie
brutalist
small-web
atproto
Star
1
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
feat(atproto): verifications
author
Anhgelus Morhtuuzh
date
21 hours ago
(Jun 27, 2026, 7:43 PM +0200)
commit
8c694377
8c69437762614ef2843e986bc0ca662bc62e03db
parent
b19374e9
b19374e9e8a94e989f1443e12f391e41a50c2aa1
+26
-10
4 changed files
Expand all
Collapse all
Unified
Split
backend
data.go
section.go
templates
base.html
main.go
+1
backend/data.go
Reviewed
···
38
38
Quote string
39
39
Language string
40
40
section string
41
41
+
Linked string
41
42
}
42
43
43
44
func (d *data) SetData(data *data) {
+8
-4
backend/section.go
Reviewed
···
16
16
"time"
17
17
18
18
"git.anhgelus.world/anhgelus/small-web/backend/common"
19
19
+
"git.anhgelus.world/anhgelus/small-web/backend/storage"
19
20
)
20
21
21
22
var (
···
72
73
Legend string `toml:"legend"`
73
74
}
74
75
75
75
-
func (s *Section) Load(_ *Config) bool {
76
76
+
func (s *Section) Load(docs map[string]storage.PublishedDocument) bool {
76
77
dir, err := os.ReadDir(s.Folder)
77
78
logger := slog.With("folder", s.Folder)
78
79
if err != nil {
···
88
89
return false
89
90
}
90
91
logger.Info("checking directory...")
91
91
-
err = s.readDir(s.Folder, dir)
92
92
+
err = s.readDir(docs, s.Folder, dir)
92
93
if err != nil {
93
94
slog.Error("reading directory", "error", err)
94
95
return false
···
97
98
return true
98
99
}
99
100
100
100
-
func (s *Section) readDir(path string, dir []os.DirEntry) error {
101
101
+
func (s *Section) readDir(docs map[string]storage.PublishedDocument, path string, dir []os.DirEntry) error {
101
102
var wg sync.WaitGroup
102
103
var mu sync.Mutex
103
104
for _, d := range dir {
···
107
108
if err != nil {
108
109
return err
109
110
}
110
110
-
if err = s.readDir(p, dd); err != nil {
111
111
+
if err = s.readDir(docs, p, dd); err != nil {
111
112
return err
112
113
}
113
114
} else {
···
130
131
}
131
132
dd := new(SectionData)
132
133
dd.data = new(data)
134
134
+
if doc, ok := docs[path]; ok {
135
135
+
dd.Linked = doc.RecordKey.String()
136
136
+
}
133
137
134
138
wg.Add(1)
135
139
go func(p string, d os.DirEntry) {
+3
backend/templates/base.html
Reviewed
···
22
22
{{ if ne .PubDate "" }}
23
23
<meta name="article:published_time" content="{{ .PubDate }}" />
24
24
{{ end }}
25
25
+
{{ if ne .Linked "" }}
26
26
+
<link rel="site.standard.document" href="{{ .Linked }}">
27
27
+
{{ end }}
25
28
</head>
26
29
<body>
27
30
<header>
+14
-6
main.go
Reviewed
···
69
69
panic(err)
70
70
}
71
71
72
72
+
docs, err := storage.PublishedDocuments(ctx, db)
73
73
+
if err != nil {
74
74
+
panic(err)
75
75
+
}
76
76
+
72
77
for _, sec := range cfg.Sections {
73
73
-
if ok = sec.Load(cfg); !ok {
78
78
+
if ok = sec.Load(docs); !ok {
74
79
slog.Info("exiting")
75
80
os.Exit(2)
76
81
}
···
110
115
}
111
116
112
117
files := os.DirFS(cfg.PublicFolder)
113
113
-
114
114
-
docs, err := storage.PublishedDocuments(ctx, db)
115
115
-
if err != nil {
116
116
-
panic(err)
117
117
-
}
118
118
119
119
if sync {
120
120
var logo []byte
···
200
200
backend.StatsMiddleware())
201
201
202
202
r.NotFoundHandler = http.HandlerFunc(backend.NotFoundHandler)
203
203
+
204
204
+
r.Handle(ljus.NewRouteFunc(
205
205
+
"GET /.well-known/site.standard.publication",
206
206
+
func(w http.ResponseWriter, r *http.Request) {
207
207
+
w.Header().Set("Content-Type", "text/plain")
208
208
+
w.Write([]byte(
209
209
+
"at://" + cfg.ATProto.DID + "/site.standard.publication/" + cfg.ATProto.PublicationRKey.String()))
210
210
+
}).SetName("atproto-verification"))
203
211
204
212
r.Handle(ljus.NewRouteFunc("GET /{$}", backend.HomeHandler).SetName("root"))
205
213
r.Handle(ljus.NewRouteFunc(