diff options
author | FChannel <> | 2022-04-29 10:36:43 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | 5b52d269faa2ce2014d0feba603a2122361cf4eb (patch) | |
tree | 0b66338d18add90ccd1d100ffe9bdb1eecc7319d /routes/index.go | |
parent | 3db517715bef6a53225c5c3c06e8fc5fd0bf71e3 (diff) |
general layout organization
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) |