2020-11-17 16:10:14 +00:00
|
|
|
package main
|
|
|
|
|
2021-01-21 16:59:47 +00:00
|
|
|
import (
|
|
|
|
"net/http"
|
2020-11-17 16:10:14 +00:00
|
|
|
)
|
|
|
|
|
2023-02-02 21:59:12 +00:00
|
|
|
func (a *goBlog) serveNodeInfoDiscover(w http.ResponseWriter, _ *http.Request) {
|
2023-01-24 13:30:53 +00:00
|
|
|
result := map[string]any{
|
2022-03-16 07:28:03 +00:00
|
|
|
"links": []map[string]any{
|
2021-01-21 16:59:47 +00:00
|
|
|
{
|
2021-06-10 20:09:50 +00:00
|
|
|
"href": a.getFullAddress("/nodeinfo"),
|
2021-01-21 16:59:47 +00:00
|
|
|
"rel": "http://nodeinfo.diaspora.software/ns/schema/2.1",
|
2020-11-17 16:10:14 +00:00
|
|
|
},
|
|
|
|
},
|
2022-02-25 15:29:42 +00:00
|
|
|
}
|
2023-11-11 18:13:50 +00:00
|
|
|
a.respondWithMinifiedJson(w, result)
|
2020-11-17 16:10:14 +00:00
|
|
|
}
|
|
|
|
|
2023-02-02 21:59:12 +00:00
|
|
|
func (a *goBlog) serveNodeInfo(w http.ResponseWriter, _ *http.Request) {
|
2021-06-06 12:39:42 +00:00
|
|
|
localPosts, _ := a.db.countPosts(&postsRequestConfig{
|
2022-09-23 09:05:07 +00:00
|
|
|
status: []postStatus{statusPublished},
|
|
|
|
visibility: []postVisibility{visibilityPublic},
|
2021-01-15 20:56:46 +00:00
|
|
|
})
|
2023-01-24 13:30:53 +00:00
|
|
|
result := map[string]any{
|
2021-01-21 16:59:47 +00:00
|
|
|
"version": "2.1",
|
2022-03-16 07:28:03 +00:00
|
|
|
"software": map[string]any{
|
2021-01-21 16:59:47 +00:00
|
|
|
"name": "goblog",
|
2021-06-28 20:17:18 +00:00
|
|
|
"repository": "https://go.goblog.app/app",
|
2021-01-21 16:59:47 +00:00
|
|
|
},
|
2022-03-16 07:28:03 +00:00
|
|
|
"usage": map[string]any{
|
|
|
|
"users": map[string]any{
|
2021-06-06 12:39:42 +00:00
|
|
|
"total": len(a.cfg.Blogs),
|
2021-01-21 16:59:47 +00:00
|
|
|
},
|
|
|
|
"localPosts": localPosts,
|
|
|
|
},
|
|
|
|
"protocols": []string{
|
|
|
|
"activitypub",
|
|
|
|
"micropub",
|
|
|
|
"webmention",
|
2020-11-17 16:10:14 +00:00
|
|
|
},
|
2022-03-16 07:28:03 +00:00
|
|
|
"metadata": map[string]any{},
|
2022-02-25 15:29:42 +00:00
|
|
|
}
|
2023-11-11 18:13:50 +00:00
|
|
|
a.respondWithMinifiedJson(w, result)
|
2020-11-17 16:10:14 +00:00
|
|
|
}
|