mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 06:44:22 +01:00
serve everything under the /njump/ path to prevent conflicts with root domain website.
This commit is contained in:
2
image.go
2
image.go
@@ -11,7 +11,7 @@ func generate(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
code := r.URL.Path[1+len("image/"):]
|
||||
if code == "" {
|
||||
fmt.Fprintf(w, "call /image/<nip19 code>")
|
||||
fmt.Fprintf(w, "call /njump/image/<nip19 code>")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
6
main.go
6
main.go
@@ -11,9 +11,9 @@ var log = zerolog.New(os.Stderr).Output(zerolog.ConsoleWriter{Out: os.Stdout}).
|
||||
With().Timestamp().Logger()
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/image/", generate)
|
||||
http.HandleFunc("/proxy/", proxy)
|
||||
http.Handle("/static/", http.FileServer(http.FS(static)))
|
||||
http.HandleFunc("/njump/image/", generate)
|
||||
http.HandleFunc("/njump/proxy/", proxy)
|
||||
http.Handle("/njump/static/", http.StripPrefix("/njump/", http.FileServer(http.FS(static))))
|
||||
http.HandleFunc("/", render)
|
||||
|
||||
port := os.Getenv("PORT")
|
||||
|
||||
@@ -149,7 +149,7 @@ func render(w http.ResponseWriter, r *http.Request) {
|
||||
textImageURL := ""
|
||||
description := ""
|
||||
if useTextImage {
|
||||
textImageURL = fmt.Sprintf("https://%s/image/%s", hostname, code)
|
||||
textImageURL = fmt.Sprintf("https://%s/njump/image/%s", hostname, code)
|
||||
if subject != "" {
|
||||
description = fmt.Sprintf("%s -- %s", subject, seenOnRelays)
|
||||
} else {
|
||||
@@ -181,7 +181,7 @@ func render(w http.ResponseWriter, r *http.Request) {
|
||||
"videoType": videoType,
|
||||
"image": image,
|
||||
"video": video,
|
||||
"proxy": "https://" + hostname + "/proxy?src=",
|
||||
"proxy": "https://" + hostname + "/njump/proxy?src=",
|
||||
"eventJSON": string(eventJSON),
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
{{end}}
|
||||
<!----------->
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/static/styles.css?v=20230527" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/njump/static/styles.css?v=20230527" />
|
||||
</head>
|
||||
Reference in New Issue
Block a user