aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorknotteye <knotteye@airmail.cc>2021-07-02 15:10:49 -0500
committerknotteye <knotteye@airmail.cc>2021-07-02 15:10:49 -0500
commitfab8de7187571a4f3f8a30966057d661a858b645 (patch)
treed050426e46e47c6d4e4e8951dcd5bf914e919fc8 /main.go
parentfaae38726dd804e3246514d88f93794c23a0cdb2 (diff)
add deletion of news items
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 3eb47c0..f98add9 100644
--- a/main.go
+++ b/main.go
@@ -634,6 +634,21 @@ func main() {
http.Redirect(w, r, "/", http.StatusSeeOther)
})
+
+ http.HandleFunc("/" + *Key + "/newsdelete/", func(w http.ResponseWriter, r *http.Request){
+ timestamp := r.URL.Path[13+len(*Key):]
+
+ tsint, err := strconv.Atoi(timestamp)
+
+ if(err != nil){
+ w.WriteHeader(http.StatusForbidden)
+ w.Write([]byte("404 no path"))
+ return
+ } else {
+ deleteNewsItemFromDB(db, tsint)
+ http.Redirect(w, r, "/news/", http.StatusSeeOther)
+ }
+ })
http.HandleFunc("/verify", func(w http.ResponseWriter, r *http.Request){
if(r.Method == "POST") {