aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'client.go')
-rw-r--r--client.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/client.go b/client.go
index be79cdd..a5fb5bb 100644
--- a/client.go
+++ b/client.go
@@ -102,7 +102,7 @@ func IndexGet(w http.ResponseWriter, r *http.Request, db *sql.DB) {
data.Board.Restricted = actor.Restricted
data.BoardRemainer = make([]int, (len(data.Boards) % 3)+1)
data.InstanceIndex = GetCollectionFromReq("https://fchan.xyz/followers").Items
- data.NewsItems = getNewsFromDB(db)
+ data.NewsItems = getNewsFromDB(db, 3)
t.ExecuteTemplate(w, "layout", data)
}
@@ -138,6 +138,27 @@ func NewsGet(w http.ResponseWriter, r *http.Request, db *sql.DB, timestamp int)
t.ExecuteTemplate(w, "layout", data)
}
+func AllNewsGet(w http.ResponseWriter, r *http.Request, db *sql.DB) {
+ t := template.Must(template.New("").Funcs(template.FuncMap{"unixtoreadable": func(u int) string { return time.Unix(int64(u), 0).Format("Jan 02, 2006") }}).ParseFiles("./static/main.html", "./static/anews.html"))
+
+ actor := GetActorFromDB(db, Domain)
+
+ var data PageData
+ data.PreferredUsername = actor.PreferredUsername
+ data.Title = actor.PreferredUsername + " News"
+ data.Boards = Boards
+ data.Board.Name = ""
+ data.Key = *Key
+ data.Board.Domain = Domain
+ data.Board.ModCred, _ = GetPasswordFromSession(r)
+ data.Board.Actor = actor
+ data.Board.Post.Actor = actor.Id
+ data.Board.Restricted = actor.Restricted
+ data.NewsItems = getNewsFromDB(db, 0)
+
+ t.ExecuteTemplate(w, "layout", data)
+}
+
func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Collection){
t := template.Must(template.ParseFiles("./static/main.html", "./static/nposts.html", "./static/top.html", "./static/bottom.html", "./static/posts.html"))