diff --git a/main.go b/main.go
index ac3868d..aaa7c1f 100644
--- a/main.go
+++ b/main.go
@@ -3,6 +3,7 @@ package main
import (
"context"
"fmt"
+ "html/template"
"log"
"net/http"
"os"
@@ -20,6 +21,7 @@ type Config struct {
RelayPubkey string
RelayDescription string
DBPath string
+ RelayURL string
}
var archivePool *nostr.SimplePool
@@ -85,6 +87,28 @@ func main() {
go refreshTrustNetwork(relay, ctx)
go archiveTrustedNotes(relay, ctx)
+ mux := relay.Router()
+ mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+ tmpl := template.Must(template.ParseFiles(os.Getenv("INDEX_PATH")))
+ data := struct {
+ RelayName string
+ RelayPubkey string
+ RelayDescription string
+ RelayURL string
+ }{
+ RelayName: config.RelayName,
+ RelayPubkey: config.RelayPubkey,
+ RelayDescription: config.RelayDescription,
+ RelayURL: config.RelayURL,
+ }
+ err := tmpl.Execute(w, data)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ }
+ })
+
+ mux.Handle("/favicon.ico", http.StripPrefix("/", http.FileServer(http.Dir("/mnt/dev/bitvora/wot-relay/templates/static"))))
+
fmt.Println("running on :3334")
http.ListenAndServe(":3334", relay)
}
@@ -100,6 +124,7 @@ func LoadConfig() Config {
RelayPubkey: getEnv("RELAY_PUBKEY"),
RelayDescription: getEnv("RELAY_DESCRIPTION"),
DBPath: getEnv("DB_PATH"),
+ RelayURL: getEnv("RELAY_URL"),
}
return config
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..c61c143
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+ {{.RelayName}}
+
+
+
+
+
+
+
+
+
+ {{.RelayName}}
+
+
+
+
+ {{.RelayDescription}}
+
+
+
+
+ {{.RelayURL}}
+
+
+
+
+
+
+
+
diff --git a/templates/static/android-chrome-192x192.png b/templates/static/android-chrome-192x192.png
new file mode 100644
index 0000000..8f148a7
Binary files /dev/null and b/templates/static/android-chrome-192x192.png differ
diff --git a/templates/static/android-chrome-256x256.png b/templates/static/android-chrome-256x256.png
new file mode 100644
index 0000000..6391f81
Binary files /dev/null and b/templates/static/android-chrome-256x256.png differ
diff --git a/templates/static/apple-touch-icon.png b/templates/static/apple-touch-icon.png
new file mode 100644
index 0000000..a14d17c
Binary files /dev/null and b/templates/static/apple-touch-icon.png differ
diff --git a/templates/static/browserconfig.xml b/templates/static/browserconfig.xml
new file mode 100644
index 0000000..b3930d0
--- /dev/null
+++ b/templates/static/browserconfig.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+ #da532c
+
+
+
diff --git a/templates/static/favicon-16x16.png b/templates/static/favicon-16x16.png
new file mode 100644
index 0000000..4d5b6ed
Binary files /dev/null and b/templates/static/favicon-16x16.png differ
diff --git a/templates/static/favicon-32x32.png b/templates/static/favicon-32x32.png
new file mode 100644
index 0000000..2f293bf
Binary files /dev/null and b/templates/static/favicon-32x32.png differ
diff --git a/templates/static/favicon.ico b/templates/static/favicon.ico
new file mode 100644
index 0000000..6da5dc0
Binary files /dev/null and b/templates/static/favicon.ico differ
diff --git a/templates/static/mstile-150x150.png b/templates/static/mstile-150x150.png
new file mode 100644
index 0000000..1abf1a2
Binary files /dev/null and b/templates/static/mstile-150x150.png differ
diff --git a/templates/static/safari-pinned-tab.svg b/templates/static/safari-pinned-tab.svg
new file mode 100644
index 0000000..4176fd1
--- /dev/null
+++ b/templates/static/safari-pinned-tab.svg
@@ -0,0 +1,15 @@
+
+
+