mirror of
https://github.com/github-tijlxyz/khatru-pyramid.git
synced 2025-04-18 18:01:18 +00:00
favicon based on RELAY_ICON and a default.
This commit is contained in:
parent
0a3fe7f97c
commit
448e270e6b
12
main.go
12
main.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"embed"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -41,6 +42,9 @@ var (
|
||||
relay = khatru.NewRelay()
|
||||
)
|
||||
|
||||
//go:embed static/*
|
||||
var static embed.FS
|
||||
|
||||
func main() {
|
||||
err := envconfig.Process("", &s)
|
||||
if err != nil {
|
||||
@ -104,6 +108,14 @@ func main() {
|
||||
relay.Router().HandleFunc("/remove-from-whitelist", removeFromWhitelistHandler)
|
||||
relay.Router().HandleFunc("/reports", reportsViewerHandler)
|
||||
relay.Router().HandleFunc("/browse", joubleHandler)
|
||||
relay.Router().Handle("/static/", http.FileServer(http.FS(static)))
|
||||
relay.Router().HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
|
||||
if s.RelayIcon != "" {
|
||||
http.Redirect(w, r, s.RelayIcon, 302)
|
||||
} else {
|
||||
http.Redirect(w, r, "/static/icon.png", 302)
|
||||
}
|
||||
})
|
||||
relay.Router().HandleFunc("/", inviteTreeHandler)
|
||||
|
||||
log.Info().Msg("running on http://0.0.0.0:" + s.Port)
|
||||
|
BIN
static/icon.png
Normal file
BIN
static/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
x
Reference in New Issue
Block a user