/
2.0.go
88 lines (85 loc) · 2.11 KB
/
2.0.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package nodeinfo
import (
"github.com/labstack/echo/v4"
"github.com/mohemohe/becomochi/server/util"
"net/http"
)
type (
NodeInfo20 struct {
Version string `json:"version"`
SoftWare SoftWare `json:"software"`
Protocols []string `json:"protocols"`
Services Services `json:"services"`
OpenRegistrations bool `json:"openRegistrations"`
Usage Usage `json:"usage"`
MetaData MetaData `json:"metadata"`
}
SoftWare struct {
Name string `json:"name"`
Version string `json:"version"`
}
Services struct {
Inbound []string `json:"inbound"`
Outbound []string `json:"outbound"`
}
Usage struct {
Users Users `json:"users"`
}
Users struct {
}
MetaData struct {
Name string `json:"name"`
Description string `json:"description"`
Maintainer Maintainer `json:"maintainer"`
Langs []string `json:"langs"`
ToSUrl string `json:"ToSUrl"`
RepositoryUrl string `json:"repositoryUrl"`
FeedbackUrl string `json:"feedbackUrl"`
Announcements []Announcement `json:"announcements"`
}
Maintainer struct {
Name string `json:"name"`
Email string `json:"email"`
}
Announcement struct {
Text string `json:"text"`
Image string `json:"image"`
Title string `json:"title"`
}
)
func GetNodeInfo20(c echo.Context) error {
nodeInfo := NodeInfo20{
Version: "2.0",
SoftWare: SoftWare{
Name: "becomochi",
Version: util.GetFullVersion(),
},
Protocols: []string{
"activitypub",
},
Services: Services{
Inbound: []string{},
Outbound: []string{},
},
OpenRegistrations: false,
Usage: Usage{
Users: Users{},
},
MetaData: MetaData{
Name: "",
Description: "",
Maintainer: Maintainer{
Name: "mohemohe",
Email: "mohemohe@users.noreply.github.com",
},
Langs: []string{
"ja",
},
ToSUrl: "",
RepositoryUrl: "https://github.com/mohemohe/becomochi",
FeedbackUrl: "https://github.com/mohemohe/becomochi/issues/new",
Announcements: []Announcement{},
},
}
return c.JSON(http.StatusOK, nodeInfo)
}