mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 14:54:24 +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/"):]
|
code := r.URL.Path[1+len("image/"):]
|
||||||
if code == "" {
|
if code == "" {
|
||||||
fmt.Fprintf(w, "call /image/<nip19 code>")
|
fmt.Fprintf(w, "call /njump/image/<nip19 code>")
|
||||||
return
|
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()
|
With().Timestamp().Logger()
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.HandleFunc("/image/", generate)
|
http.HandleFunc("/njump/image/", generate)
|
||||||
http.HandleFunc("/proxy/", proxy)
|
http.HandleFunc("/njump/proxy/", proxy)
|
||||||
http.Handle("/static/", http.FileServer(http.FS(static)))
|
http.Handle("/njump/static/", http.StripPrefix("/njump/", http.FileServer(http.FS(static))))
|
||||||
http.HandleFunc("/", render)
|
http.HandleFunc("/", render)
|
||||||
|
|
||||||
port := os.Getenv("PORT")
|
port := os.Getenv("PORT")
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ func render(w http.ResponseWriter, r *http.Request) {
|
|||||||
textImageURL := ""
|
textImageURL := ""
|
||||||
description := ""
|
description := ""
|
||||||
if useTextImage {
|
if useTextImage {
|
||||||
textImageURL = fmt.Sprintf("https://%s/image/%s", hostname, code)
|
textImageURL = fmt.Sprintf("https://%s/njump/image/%s", hostname, code)
|
||||||
if subject != "" {
|
if subject != "" {
|
||||||
description = fmt.Sprintf("%s -- %s", subject, seenOnRelays)
|
description = fmt.Sprintf("%s -- %s", subject, seenOnRelays)
|
||||||
} else {
|
} else {
|
||||||
@@ -181,7 +181,7 @@ func render(w http.ResponseWriter, r *http.Request) {
|
|||||||
"videoType": videoType,
|
"videoType": videoType,
|
||||||
"image": image,
|
"image": image,
|
||||||
"video": video,
|
"video": video,
|
||||||
"proxy": "https://" + hostname + "/proxy?src=",
|
"proxy": "https://" + hostname + "/njump/proxy?src=",
|
||||||
"eventJSON": string(eventJSON),
|
"eventJSON": string(eventJSON),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
<!----------->
|
<!----------->
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="stylesheet" href="/static/styles.css?v=20230527" />
|
<link rel="stylesheet" href="/njump/static/styles.css?v=20230527" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
Reference in New Issue
Block a user