From a26b0809ab30e974fd39532dc4569671bbac52a2 Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Thu, 4 May 2017 09:15:20 +1000 Subject: [PATCH] Add faq handler --- FAQ.html | 2 ++ main.go | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/FAQ.html b/FAQ.html index c2d2a0c8..ad61e874 100644 --- a/FAQ.html +++ b/FAQ.html @@ -88,6 +88,8 @@

How can I help?

If you have website development expertise, you can join the #nyaapantsu IRC channel on irc.rizon.net. If you have any current databases, UPLOAD THEM.

+

nyaa.pantsu.cat and sukebei.pantsu.cat do not host any files.

+ diff --git a/main.go b/main.go index bfc42419..9a996d07 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ import ( ) var dbHandle *sql.DB -var templates = template.Must(template.ParseFiles("index.html")) +var templates = template.Must(template.ParseFiles("index.html", "FAQ.html")) var debugLogger *log.Logger var trackers = "&tr=udp://zer0day.to:1337/announce&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://explodie.org:6969&tr=udp://tracker.opentrackr.org:1337&tr=udp://tracker.coppersurfer.tk:6969" @@ -173,6 +173,13 @@ func safe(s string) template.URL { return template.URL(s) } +func faqHandler(w http.ResponseWriter, r *http.Request) { + err = templates.ExecuteTemplate(w, "FAQ.html", &b) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } +} + func rootHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) page := vars["page"] @@ -231,6 +238,7 @@ func main() { router.HandleFunc("/search/{page}", searchHandler) router.HandleFunc("/api/{page}", apiHandler).Methods("GET") router.HandleFunc("/api/torrent/{id}", singleapiHandler).Methods("GET") + router.HandleFunc("/faq", faqHandler) http.Handle("/", router)