(db *datastore, cfg *config.Config)
| 23 | } |
| 24 | |
| 25 | func nodeInfoConfig(db *datastore, cfg *config.Config) *nodeinfo.Config { |
| 26 | name := cfg.App.SiteName |
| 27 | desc := cfg.App.SiteDesc |
| 28 | if desc == "" { |
| 29 | desc = "Minimal, federated blogging platform." |
| 30 | } |
| 31 | if cfg.App.SingleUser { |
| 32 | // Fetch blog information, instead |
| 33 | coll, err := db.GetCollectionByID(1) |
| 34 | if err == nil { |
| 35 | desc = coll.Description |
| 36 | } |
| 37 | } |
| 38 | return &nodeinfo.Config{ |
| 39 | BaseURL: cfg.App.Host, |
| 40 | InfoURL: "/api/nodeinfo", |
| 41 | |
| 42 | Metadata: nodeinfo.Metadata{ |
| 43 | NodeName: name, |
| 44 | NodeDescription: desc, |
| 45 | Private: cfg.App.Private, |
| 46 | Software: nodeinfo.SoftwareMeta{ |
| 47 | HomePage: softwareURL, |
| 48 | GitHub: "https://github.com/writefreely/writefreely", |
| 49 | Follow: "https://writing.exchange/@writefreely", |
| 50 | }, |
| 51 | MaxBlogs: cfg.App.MaxBlogs, |
| 52 | PublicReader: cfg.App.LocalTimeline, |
| 53 | Invites: cfg.App.UserInvites != "", |
| 54 | }, |
| 55 | Protocols: []nodeinfo.NodeProtocol{ |
| 56 | nodeinfo.ProtocolActivityPub, |
| 57 | }, |
| 58 | Services: nodeinfo.Services{ |
| 59 | Inbound: []nodeinfo.NodeService{}, |
| 60 | Outbound: []nodeinfo.NodeService{ |
| 61 | nodeinfo.ServiceRSS, |
| 62 | }, |
| 63 | }, |
| 64 | Software: nodeinfo.SoftwareInfo{ |
| 65 | Name: strings.ToLower(serverSoftware), |
| 66 | Version: softwareVer, |
| 67 | }, |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | func (r nodeInfoResolver) IsOpenRegistration() (bool, error) { |
| 72 | return r.cfg.App.OpenRegistration, nil |
no test coverage detected