mirror of
https://github.com/github-tijlxyz/khatru-pyramid.git
synced 2025-04-19 10:21: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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -41,6 +42,9 @@ var (
|
|||||||
relay = khatru.NewRelay()
|
relay = khatru.NewRelay()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed static/*
|
||||||
|
var static embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
err := envconfig.Process("", &s)
|
err := envconfig.Process("", &s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -104,6 +108,14 @@ func main() {
|
|||||||
relay.Router().HandleFunc("/remove-from-whitelist", removeFromWhitelistHandler)
|
relay.Router().HandleFunc("/remove-from-whitelist", removeFromWhitelistHandler)
|
||||||
relay.Router().HandleFunc("/reports", reportsViewerHandler)
|
relay.Router().HandleFunc("/reports", reportsViewerHandler)
|
||||||
relay.Router().HandleFunc("/browse", joubleHandler)
|
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)
|
relay.Router().HandleFunc("/", inviteTreeHandler)
|
||||||
|
|
||||||
log.Info().Msg("running on http://0.0.0.0:" + s.Port)
|
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