✨ Generate service dynamically
This commit is contained in:
parent
0fe6f5070e
commit
931f75500f
3 changed files with 26 additions and 24 deletions
15
app.go
15
app.go
|
|
@ -3,6 +3,7 @@ package lenore
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"codeberg.org/danjones000/lenore/config"
|
||||
"codeberg.org/danjones000/lenore/store"
|
||||
|
|
@ -11,6 +12,10 @@ import (
|
|||
boxap "github.com/go-ap/fedbox/activitypub"
|
||||
)
|
||||
|
||||
func init() {
|
||||
client.UserAgent = config.UserAgent
|
||||
}
|
||||
|
||||
type App struct {
|
||||
conf config.Config
|
||||
self vocab.Service
|
||||
|
|
@ -30,10 +35,12 @@ func NewApp(ver string, conf config.Config, db store.Store) (*App, error) {
|
|||
}
|
||||
|
||||
selfIRI := boxap.DefaultServiceIRI(conf.BaseURL)
|
||||
self, err := boxap.LoadActor(db, selfIRI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
self := boxap.Self(selfIRI)
|
||||
self.Name = vocab.DefaultNaturalLanguageValue(app.Name())
|
||||
self.AttributedTo = vocab.IRI(config.DevUrl)
|
||||
self.Summary = vocab.DefaultNaturalLanguageValue("ActivityPub-powered reader")
|
||||
self.Published = time.Now()
|
||||
self.Updated = time.Now()
|
||||
|
||||
app.self = self
|
||||
app.client = *client.New()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue