Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Add faq handler

Cette révision appartient à :
Eliot Whalan 2017-05-04 09:15:20 +10:00
Parent f26a20b49a
révision a26b0809ab
2 fichiers modifiés avec 11 ajouts et 1 suppressions

Voir le fichier

@ -88,6 +88,8 @@
<h1>How can I help?</h1>
<p>If you have website development expertise, you can join the #nyaapantsu IRC channel on irc.rizon.net. If you have any current databases, <b>UPLOAD THEM</b>.</p>
<h1>nyaa.pantsu.cat and sukebei.pantsu.cat do not host any files.</h1>
</div>
</nav>

10
main.go
Voir le fichier

@ -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)