diff options
Diffstat (limited to 'routes/index.go')
-rw-r--r-- | routes/index.go | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/routes/index.go b/routes/index.go index 5ff2bd4..23b3f39 100644 --- a/routes/index.go +++ b/routes/index.go @@ -21,6 +21,21 @@ func Index(ctx *fiber.Ctx) error { } var data PageData + + col, err := webfinger.GetCollectionFromReq("https://fchan.xyz/followers") + if err != nil { + return err + } + + if len(col.Items) > 0 { + data.InstanceIndex = col.Items + } + + data.NewsItems, err = db.GetNewsFromDB(3) + if err != nil { + return err + } + data.Title = "Welcome to " + actor.PreferredUsername data.PreferredUsername = actor.PreferredUsername data.Boards = db.Boards @@ -34,23 +49,14 @@ func Index(ctx *fiber.Ctx) error { //almost certainly there is a better algorithm for this but the old one was wrong //and I suck at math. This works at least. data.BoardRemainer = make([]int, 3-(len(data.Boards)%3)) + if len(data.BoardRemainer) == 3 { data.BoardRemainer = make([]int, 0) } - col, err := webfinger.GetCollectionFromReq("https://fchan.xyz/followers") - if err != nil { - return err - } - - if len(col.Items) > 0 { - data.InstanceIndex = col.Items - } - - data.NewsItems, err = db.GetNewsFromDB(3) - if err != nil { - return err - } + data.Meta.Description = data.PreferredUsername + " a federated image board based on ActivityPub. The current version of the code running on the server is still a work-in-progress product, expect a bumpy ride for the time being. Get the server code here: https://github.com/FChannel0." + data.Meta.Url = data.Board.Domain + data.Meta.Title = data.Title data.Themes = &config.Themes data.ThemeCookie = getThemeCookie(ctx) |