This commit is contained in:
partisan 2024-07-05 03:08:35 +02:00
parent 8f913eca0d
commit f6576a9134
5 changed files with 237 additions and 36 deletions

24
main.go
View file

@ -122,18 +122,18 @@ func parsePageParameter(pageStr string) int {
}
func runServer() {
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
http.HandleFunc("/", handleSearch)
http.HandleFunc("/search", handleSearch)
http.HandleFunc("/img_proxy", handleImageProxy)
http.HandleFunc("/settings", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "templates/settings.html")
})
http.HandleFunc("/opensearch.xml", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/opensearchdescription+xml")
http.ServeFile(w, r, "static/opensearch.xml")
})
initializeTorrentSites()
// http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
// http.HandleFunc("/", handleSearch)
// http.HandleFunc("/search", handleSearch)
// http.HandleFunc("/img_proxy", handleImageProxy)
// http.HandleFunc("/settings", func(w http.ResponseWriter, r *http.Request) {
// http.ServeFile(w, r, "templates/settings.html")
// })
// http.HandleFunc("/opensearch.xml", func(w http.ResponseWriter, r *http.Request) {
// w.Header().Set("Content-Type", "application/opensearchdescription+xml")
// http.ServeFile(w, r, "static/opensearch.xml")
// })
// initializeTorrentSites()
http.HandleFunc("/node", handleNodeRequest) // Handle node requests