jouble integrated.

This commit is contained in:
fiatjaf 2024-11-01 00:19:37 -03:00
parent c0c3940530
commit 928e801e69
3 changed files with 29 additions and 0 deletions

View File

@ -65,3 +65,30 @@ func reportsViewerHandler(w http.ResponseWriter, r *http.Request) {
})
htmlgo.Fprint(w, content, r.Context())
}
func joubleHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, `
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>pyramid</title>
<script>
window.relayGroups = [{
groupName: 'pyramid',
relayUrls: [location.href.replace('http', 'ws').replace('/browse', '')],
isActive: true,
}]
window.hideRelaySettings = true
</script>
<script type="module" crossorigin src="https://unpkg.com/jouble/dist/index.js"></script>
<link rel="stylesheet" crossorigin href="https://unpkg.com/jouble/dist/index.css">
</head>
<body>
<div id="root"></div>
<script src="https://unpkg.com/window.nostr.js/dist/window.nostr.js"></script>
</body>
</html>
`)
}

View File

@ -105,6 +105,7 @@ func main() {
relay.Router().HandleFunc("/add-to-whitelist", addToWhitelistHandler)
relay.Router().HandleFunc("/remove-from-whitelist", removeFromWhitelistHandler)
relay.Router().HandleFunc("/reports", reportsViewerHandler)
relay.Router().HandleFunc("/browse", joubleHandler)
relay.Router().HandleFunc("/", inviteTreeHandler)
log.Info().Msg("running on http://0.0.0.0:" + s.Port)

View File

@ -28,6 +28,7 @@ func baseHTML(inside HTMLComponent) HTMLComponent {
).Class("mx-auto my-6 text-center"),
Nav(
A().Text("invite tree").Href("/").Class(navItemClass).Attr("hx-boost", "true", "hx-target", "main", "hx-select", "main"),
A().Text("browse").Href("/browse").Class(navItemClass),
A().Text("reports").Href("/reports").Class(navItemClass).Attr("hx-boost", "true", "hx-target", "main", "hx-select", "main"),
A().Text("").Href("#").Class(navItemClass).
Attr("_", `