-
Notifications
You must be signed in to change notification settings - Fork 11
/
nodeinfo.go
50 lines (44 loc) · 1.08 KB
/
nodeinfo.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
package readas
import (
"github.com/writeas/go-nodeinfo"
)
type nodeInfoResolver struct{ app *app }
func nodeInfoConfig(cfg *config) *nodeinfo.Config {
name := "Read.as"
return &nodeinfo.Config{
BaseURL: cfg.Host,
InfoURL: "/api/nodeinfo",
Metadata: nodeinfo.Metadata{
NodeName: name,
NodeDescription: "ActivityPub-enabled long-form reader.",
Private: false,
Software: nodeinfo.SoftwareMeta{
HomePage: "https://read.as",
GitHub: "https://github.com/writeas/Read.as",
},
},
Protocols: []nodeinfo.NodeProtocol{
nodeinfo.ProtocolActivityPub,
},
Services: nodeinfo.Services{
Inbound: []nodeinfo.NodeService{},
Outbound: []nodeinfo.NodeService{},
},
Software: nodeinfo.SoftwareInfo{
Name: "read.as",
Version: softwareVersion,
},
}
}
func (r nodeInfoResolver) IsOpenRegistration() (bool, error) {
return false, nil
}
func (r nodeInfoResolver) Usage() (nodeinfo.Usage, error) {
users, err := r.app.getUsersCount()
return nodeinfo.Usage{
Users: nodeinfo.UsageUsers{
Total: int(users),
},
LocalPosts: 0,
}, err
}