mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 14:24:27 +01:00
redirect from favicon.ico to /static/...
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import "net/http"
|
|
||||||
|
|
||||||
func renderFavicon(w http.ResponseWriter, r *http.Request) {}
|
|
||||||
2
main.go
2
main.go
@@ -73,12 +73,12 @@ func main() {
|
|||||||
mux.HandleFunc("/npubs-archive/", renderArchive)
|
mux.HandleFunc("/npubs-archive/", renderArchive)
|
||||||
mux.HandleFunc("/njump/image/", renderImage)
|
mux.HandleFunc("/njump/image/", renderImage)
|
||||||
mux.HandleFunc("/njump/proxy/", proxy)
|
mux.HandleFunc("/njump/proxy/", proxy)
|
||||||
mux.HandleFunc("/favicon.ico", renderFavicon)
|
|
||||||
mux.HandleFunc("/robots.txt", renderRobots)
|
mux.HandleFunc("/robots.txt", renderRobots)
|
||||||
mux.HandleFunc("/r/", renderRelayPage)
|
mux.HandleFunc("/r/", renderRelayPage)
|
||||||
mux.HandleFunc("/random", redirectToRandom)
|
mux.HandleFunc("/random", redirectToRandom)
|
||||||
mux.HandleFunc("/e/", redirectFromESlash)
|
mux.HandleFunc("/e/", redirectFromESlash)
|
||||||
mux.HandleFunc("/p/", redirectFromPSlash)
|
mux.HandleFunc("/p/", redirectFromPSlash)
|
||||||
|
mux.HandleFunc("/favicon.ico", redirectToFavicon)
|
||||||
mux.HandleFunc("/", renderEvent)
|
mux.HandleFunc("/", renderEvent)
|
||||||
|
|
||||||
log.Print("listening at http://0.0.0.0:" + s.Port)
|
log.Print("listening at http://0.0.0.0:" + s.Port)
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import (
|
|||||||
"github.com/nbd-wtf/go-nostr/nip19"
|
"github.com/nbd-wtf/go-nostr/nip19"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func redirectToFavicon(w http.ResponseWriter, r *http.Request) {
|
||||||
|
http.Redirect(w, r, "/static/favicon/android-chrome-192x192.png", http.StatusFound)
|
||||||
|
}
|
||||||
|
|
||||||
func redirectToRandom(w http.ResponseWriter, r *http.Request) {
|
func redirectToRandom(w http.ResponseWriter, r *http.Request) {
|
||||||
// 50% of chance of picking a pubkey
|
// 50% of chance of picking a pubkey
|
||||||
if ra := rand.Intn(2); ra == 0 {
|
if ra := rand.Intn(2); ra == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user