diff --git a/main.go b/main.go
index 4177914..868bac9 100644
--- a/main.go
+++ b/main.go
@@ -15,7 +15,8 @@ import (
)
type Settings struct {
- Port string `envconfig:"PORT" default:"2999"`
+ Port string `envconfig:"PORT" default:"2999"`
+ CanonicalHost string `envconfig:"CANONICAL_HOST" default:"njump.me"`
}
//go:embed static/*
@@ -25,11 +26,9 @@ var static embed.FS
var templates embed.FS
var (
- s Settings
-
+ s Settings
tmpl *template.Template
templateMapping = make(map[string]string)
-
log = zerolog.New(os.Stderr).Output(zerolog.ConsoleWriter{Out: os.Stdout}).With().Timestamp().Logger()
)
@@ -53,7 +52,6 @@ func main() {
if err != nil {
log.Fatal().Err(err).Msg("couldn't process envconfig.")
}
-
// initialize disk cache
defer cache.initialize()()
diff --git a/render.go b/render.go
index 8d61bf2..18444a6 100644
--- a/render.go
+++ b/render.go
@@ -322,6 +322,7 @@ func render(w http.ResponseWriter, r *http.Request) {
"lastNotes": renderableLastNotes,
"parentNevent": parentNevent,
"authorRelays": authorRelays,
+ "CanonicalHost": s.CanonicalHost,
}
// if a mapping is not found fallback to raw
diff --git a/render_archive.go b/render_archive.go
index b1af551..455b4a1 100644
--- a/render_archive.go
+++ b/render_archive.go
@@ -62,6 +62,7 @@ func renderArchive(w http.ResponseWriter, r *http.Request) {
"paginationUrl": area,
"nextPage": fmt.Sprint(nextPage),
"prevPage": fmt.Sprint(prevPage),
+ "CanonicalHost": s.CanonicalHost,
}
if len(data) != 0 {
diff --git a/render_relay.go b/render_relay.go
index 777d886..816b997 100644
--- a/render_relay.go
+++ b/render_relay.go
@@ -64,12 +64,13 @@ func renderRelayPage(w http.ResponseWriter, r *http.Request) {
"clients": []ClientReference{
{Name: "Coracle", URL: "https://coracle.social/relays/" + hostname},
},
- "type": "relay",
- "info": info,
- "hostname": hostname,
- "proxy": "https://" + hostname + "/njump/proxy?src=",
- "lastNotes": renderableLastNotes,
- "modifiedAt": lastEventAt.Format("2006-01-02T15:04:05Z07:00"),
+ "type": "relay",
+ "info": info,
+ "hostname": hostname,
+ "proxy": "https://" + hostname + "/njump/proxy?src=",
+ "lastNotes": renderableLastNotes,
+ "modifiedAt": lastEventAt.Format("2006-01-02T15:04:05Z07:00"),
+ "CanonicalHost": s.CanonicalHost,
}
if len(renderableLastNotes) != 0 {
diff --git a/templates/note.html b/templates/note.html
index ff997a7..cdd9ba7 100644
--- a/templates/note.html
+++ b/templates/note.html
@@ -30,7 +30,7 @@
{{end}}
-
+
{{template "head_common.html" }}
diff --git a/templates/profile.html b/templates/profile.html
index 426a702..d4c83c3 100644
--- a/templates/profile.html
+++ b/templates/profile.html
@@ -20,7 +20,7 @@
{{end}}
-
+