diff --git a/backend/main.go b/backend/main.go index 3c52e08..117028b 100644 --- a/backend/main.go +++ b/backend/main.go @@ -61,6 +61,17 @@ func newRouter(store *Store, cfg Config) http.Handler { mux.Handle("/bookmarks", auth) mux.Handle("/bookmarks/", auth) + // The browser UI is registered only when a password is configured, so a + // deployment that forgets WEB_PASSWORD exposes nothing rather than + // exposing an unprotected list. + if cfg.WebPassword != "" { + web, err := newWebHandler(store, cfg) + if err != nil { + log.Fatalf("web handler: %v", err) + } + web.register(mux) + } + return withCORS(cfg.AllowedOrigins, mux) } diff --git a/backend/static/filter.js b/backend/static/filter.js new file mode 100644 index 0000000..cc1ffd6 --- /dev/null +++ b/backend/static/filter.js @@ -0,0 +1,6 @@ +// Title search and tab-state handling land in Task 7. +function setActiveTab(el) { + el.parentElement.querySelectorAll("[role=tab]").forEach(function (t) { + t.classList.toggle("active", t === el); + }); +} diff --git a/backend/static/style.css b/backend/static/style.css new file mode 100644 index 0000000..ff1dbdd --- /dev/null +++ b/backend/static/style.css @@ -0,0 +1,2 @@ +/* Styling lands in Task 7. */ +:root { color-scheme: dark light; } diff --git a/backend/templates/app.html b/backend/templates/app.html new file mode 100644 index 0000000..75cacbf --- /dev/null +++ b/backend/templates/app.html @@ -0,0 +1,53 @@ +{{define "app"}} + + +
+ + + ++ Nothing here yet. Bookmarks appear once the userscript records a chapter. +
+{{end}} +{{end}} diff --git a/backend/templates/login.html b/backend/templates/login.html new file mode 100644 index 0000000..d3e9e82 --- /dev/null +++ b/backend/templates/login.html @@ -0,0 +1,24 @@ +{{define "login"}} + + + + + + +