Rename cavage singing func, add import for server
All checks were successful
/ docker (push) Successful in 4m1s
All checks were successful
/ docker (push) Successful in 4m1s
This commit is contained in:
parent
5e13817563
commit
08f6de0bd7
39 changed files with 2035 additions and 364 deletions
60
web/shared/Nodeinfo.go
Normal file
60
web/shared/Nodeinfo.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
package webshared
|
||||
|
||||
import (
|
||||
"git.mstar.dev/mstar/goutils/sliceutils"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
)
|
||||
|
||||
type NodeInfoLink struct {
|
||||
Rel string
|
||||
Href string
|
||||
}
|
||||
|
||||
type NodeInfoOverview struct {
|
||||
Links []NodeInfoLink
|
||||
}
|
||||
|
||||
type NodeInfo2Software struct {
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
Homepage *string `json:"homepage,omitempty"`
|
||||
Repository *string `json:"repository,omitempty"`
|
||||
}
|
||||
|
||||
type NodeInfo2UsageUsers struct {
|
||||
Total uint `json:"total"`
|
||||
ActiveHalfYear *uint `json:"active_half_year"`
|
||||
ActiveMonth *uint `json:"active_month"`
|
||||
}
|
||||
|
||||
type NodeInfo2Usage struct {
|
||||
Users NodeInfo2UsageUsers `json:"users"`
|
||||
LocalPosts uint `json:"local_posts"`
|
||||
LocalComments uint `json:"local_comments"`
|
||||
}
|
||||
|
||||
type NodeInfo2 struct {
|
||||
Version string `json:"version"`
|
||||
Software NodeInfo2Software `json:"software"`
|
||||
Protocols []string `json:"protocols"`
|
||||
Services map[string][]string `json:"services"`
|
||||
OpenRegistrations bool `json:"open_registrations"`
|
||||
Usage NodeInfo2Usage `json:"usage"`
|
||||
Metadata map[string]any `json:"metadata"`
|
||||
}
|
||||
|
||||
func MapNodeServerTypeToModelType(nodeType string) models.ServerSoftwareType {
|
||||
if sliceutils.Contains([]string{"mastodon"}, nodeType) {
|
||||
return models.ServerSoftwareMastodon
|
||||
} else if sliceutils.Contains([]string{"sharkey", "misskey", "iceshrimp", "firefish"}, nodeType) {
|
||||
return models.ServerSoftwareMisskey
|
||||
} else if sliceutils.Contains([]string{"linstrom"}, nodeType) {
|
||||
return models.ServerSoftwareLinstrom
|
||||
} else if sliceutils.Contains([]string{"akkoma"}, nodeType) {
|
||||
return models.ServerSoftwarePlemora
|
||||
} else if sliceutils.Contains([]string{"wafrn"}, nodeType) {
|
||||
return models.ServerSoftwareWafrn
|
||||
}
|
||||
return models.ServerSoftwareUnknown
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue