home page and favico
25
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
|
||||
|
64
templates/index.html
Normal file
@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{{.RelayName}}</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");
|
||||
body {
|
||||
font-family: "Inter", sans-serif;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-900 text-white">
|
||||
<div class="flex-grow flex flex-col justify-center items-center px-4">
|
||||
<!-- Container -->
|
||||
<div class="text-center max-w-2xl">
|
||||
<!-- Heading (Relay Name) -->
|
||||
<h1 class="text-5xl md:text-6xl font-bold text-purple-400 mb-6">
|
||||
{{.RelayName}}
|
||||
</h1>
|
||||
|
||||
<!-- Relay Description -->
|
||||
<p class="text-xl md:text-2xl text-gray-300 mb-8">
|
||||
{{.RelayDescription}}
|
||||
</p>
|
||||
|
||||
<!-- Relay URL -->
|
||||
<a
|
||||
href="#"
|
||||
class="text-lg md:text-xl text-purple-300 hover:text-purple-400 underline"
|
||||
>
|
||||
{{.RelayURL}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="text-center py-6 bg-gray-800 w-full">
|
||||
<p class="text-lg text-gray-400">
|
||||
Proudly powered by
|
||||
<a
|
||||
href="https://khatru.nostr.technology/"
|
||||
target="_blank"
|
||||
class="text-purple-300 hover:text-purple-400 underline"
|
||||
>Khatru</a
|
||||
>
|
||||
|
|
||||
<a
|
||||
href="https://github.com/bitvora/wot-relay"
|
||||
target="_blank"
|
||||
class="text-purple-300 hover:text-purple-400 underline"
|
||||
>Web of Trust Relay on Github</a
|
||||
>
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
BIN
templates/static/android-chrome-192x192.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
templates/static/android-chrome-256x256.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
templates/static/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
9
templates/static/browserconfig.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
BIN
templates/static/favicon-16x16.png
Normal file
After Width: | Height: | Size: 846 B |
BIN
templates/static/favicon-32x32.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
templates/static/favicon.ico
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
templates/static/mstile-150x150.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
15
templates/static/safari-pinned-tab.svg
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="274.000000pt" height="274.000000pt" viewBox="0 0 274.000000 274.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.14, written by Peter Selinger 2001-2017
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,274.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M0 1365 l0 -1285 1370 0 1370 0 0 1285 0 1285 -1370 0 -1370 0 0
|
||||
-1285z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 603 B |