aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorknotteye <knotteye@airmail.cc>2021-07-01 20:26:49 -0500
committerknotteye <knotteye@airmail.cc>2021-07-01 20:26:49 -0500
commit168225daa21fe494bcd74ab6c90d6498ecf9f1e3 (patch)
tree65274dc8181e7c1805fb601f3674f6d357b5dc80 /main.go
parent4e3848cadbb3fd89b94a7ef24838173939d198db (diff)
Make news list links to full page news articles
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/main.go b/main.go
index 037f240..4f7f3e8 100644
--- a/main.go
+++ b/main.go
@@ -286,6 +286,21 @@ func main() {
w.WriteHeader(http.StatusForbidden)
w.Write([]byte("404 no path"))
})
+
+ http.HandleFunc("/news/", func(w http.ResponseWriter, r *http.Request){
+ timestamp := r.URL.Path[6:]
+ if timestamp[len(timestamp)-1:] == "/" {
+ timestamp = timestamp[:len(timestamp)-1]
+ }
+
+ ts, err := strconv.Atoi(timestamp)
+ if err != nil {
+ w.WriteHeader(http.StatusForbidden)
+ w.Write([]byte("404 no path"))
+ } else {
+ NewsGet(w, r, db, ts)
+ }
+ })
http.HandleFunc("/post", func(w http.ResponseWriter, r *http.Request){