diff options
author | knotteye <knotteye@airmail.cc> | 2021-07-01 17:56:04 -0500 |
---|---|---|
committer | knotteye <knotteye@airmail.cc> | 2021-07-01 17:56:04 -0500 |
commit | 4e3848cadbb3fd89b94a7ef24838173939d198db (patch) | |
tree | 06ea5434986b2b9c00e392a7d44b93d7eae23668 /client.go | |
parent | 638a03b458b71564b1db439e6386d7dbf2a5181c (diff) |
Add a list of local boards and server news
Diffstat (limited to 'client.go')
-rw-r--r-- | client.go | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -47,6 +47,7 @@ type PageData struct { Instance Actor InstanceIndex []ObjectBase ReturnTo string + NewsItems []NewsItem } type AdminPage struct { @@ -73,8 +74,15 @@ type Removed struct { Board string } + +type NewsItem struct { + Title string + Content string + Time int +} + func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) { - t := template.Must(template.ParseFiles("./static/main.html", "./static/index.html")) + t := template.Must(template.New("").Funcs(template.FuncMap{"mod": func(i, j int) bool { return i%j == 0 }}).ParseFiles("./static/main.html", "./static/index.html")) actor := GetActorFromDB(db, Domain) @@ -90,8 +98,9 @@ func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) { data.Board.Post.Actor = actor.Id data.Board.Restricted = actor.Restricted data.InstanceIndex = GetCollectionFromReq("https://fchan.xyz/followers").Items + data.NewsItems = getNewsFromDB(db) - t.ExecuteTemplate(w, "layout", data) + t.ExecuteTemplate(w, "layout", data) } func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Collection){ |