diff --git a/Plans/INDEX.md b/Plans/INDEX.md index d4770f6..893188c 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -21,7 +21,7 @@ Tracker: https://claude.ai/artifact/PRAT4HSkqn44d6QFDJeovp ## 03a Website path -- [ ] [S006a — Website under /dezio/, landing page at the root](03a%20Website%20path/S006a-dezio-path.md) 🧑 +- [x] [S006a — Website under /dezio/, landing page at the root](03a%20Website%20path/S006a-dezio-path.md) 🧑 ## 04 Security diff --git a/deploy/landing/index.html b/deploy/landing/index.html new file mode 100644 index 0000000..01cc90d --- /dev/null +++ b/deploy/landing/index.html @@ -0,0 +1,19 @@ + + + + + +Astar Hub + + + +
+

Astar Hub

+

Dezio Source

+
+ + diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 3c3f6a2..c76b822 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -15,3 +15,4 @@ - D-011 — 2026-12-01 — Covers come from a chain (`src/commands/lastfm/covers.rs`): the release ID in the player's own tags (Cover Art Archive) → ListenBrainz's match → the release group → Deezer → iTunes; Deezer/iTunes results count only when artist and title match. Artist photos: Deezer → MusicBrainz/Wikimedia. Play counts match by MusicBrainz ID before names. — MusicBrainz art alone left many covers blank; owner asked for the most reliable sources with fallbacks. — fm commands. - D-012 — 2026-12-01 — All fm logic must get its data from ListenBrainz and MusicBrainz (plus the D-011 cover/photo fallbacks); leftover Last.fm API logic and Last.fm-only fields are replaced or removed. Song links to the Last.fm website stay. — Owner request after the Last.fm API change. — S006, S010. - D-013 — 2026-12-01 — All of Dezio's website (site, dashboard, API, OAuth, Game Boy Activity, hosted `/f/` files) moves to https://archlinux.tail7c4f5e.ts.net/dezio/. The root `/` serves a minimal static landing page (links to `/dezio/` and `/git/`), which the owner will improve in a later session; old root links to Dezio are not redirected. `/git` stays Forgejo. — Owner request. — S006a, S007, S011. +- D-013 addition — 2026-12-01 — Base path = path part of `DASHBOARD_URL` (`/dezio`, none → root). The router serves every route both under the base and un-prefixed, so it works whether `tailscale serve --set-path` strips the prefix or not. HTML pages carry `__BASE__` (server replaces it); dashboard JS reads ``; site pages use relative paths; the Activity derives its base from `location.pathname` (so it also works at `/` inside Discord). Cookie `Path` = base. — Avoids guessing tailscale's behaviour. — S006a, S011. diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 92e9848..4f07ddb 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -43,3 +43,8 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done, - Done: audit of every fm feature; code was already fully on ListenBrainz/MusicBrainz, no Last.fm API leftovers in src. Only fix: `docs/topgg.md` wording. Test list in `docs/tests/S006-fm.md`. - Dropped from cards: listeners, global plays, bio, tags (none were shown). Profile realname/country are skipped when empty. - Verified: grep and `cargo check` only. Not tested in Discord 🧑. No new unit test (no new logic; api.rs already has sample-JSON tests). + +## 2026-12-01 — S006a website under /dezio/ +- Done: `Cfg.base` from `DASHBOARD_URL` path (`base_path`, unit test); routes nested under base and also un-prefixed; cookie Path, redirects, login link carry base; pages use `__BASE__`/relative paths; `deploy/landing/index.html` (minimal). topgg + module comments updated. +- Not done: nothing deployed. Static copy of web/dashboard/index.html now has `__BASE__` placeholders (only the bot serves it). +- Verified: `cargo check`, `cargo test base_path`. No browser check. Server commands + 🧑 portal list in `docs/tests/S006a-dezio-path.md`. diff --git a/docs/tests/S006a-dezio-path.md b/docs/tests/S006a-dezio-path.md new file mode 100644 index 0000000..c3d3374 --- /dev/null +++ b/docs/tests/S006a-dezio-path.md @@ -0,0 +1,33 @@ +# S006a — website under /dezio/ (tests) + +## Local checks +Run: `DASHBOARD_URL=http://127.0.0.1:8099/dezio DISCORD_BOT_TOKEN=dev-placeholder target/debug/dezio --web-dev`, cookie `dezio_session=devtoken`. +1. `/dezio/` shows the site with fonts and images; `/dezio/terms`, `/dezio/privacy` load and their Home link goes to `/dezio/`. +2. `/dezio/assets/site.css`, `/dezio/images/dezio.png` return 200. +3. Site: the Dashboard button appears (fetch of `/dezio/api/me` works). +4. `/dezio/dashboard` loads styled; its scripts load from `/dezio/dashboard/static/`; settings load and save (`/dezio/api/user`). +5. Dashboard URL bar after navigating stays `/dezio/dashboard#...`; Sign out returns to `/dezio/dashboard`. +6. Signed out (no cookie): "Sign in with Discord" links to `/dezio/login`; `/dezio/login` redirects to Discord with `redirect_uri=http://127.0.0.1:8099/dezio/callback`. +7. Set-Cookie headers from login have `Path=/dezio`. +8. `/dezio/activity` redirects to `/dezio/activity/`; the page loads, `/dezio/activity/api/config` works, the 401 from web-session has `login` = `/dezio/login?next=/activity/`. +9. A hosted link from `hosted::store` is `http://127.0.0.1:8099/dezio/f//` and downloads. +10. Without a path (`DASHBOARD_URL=http://127.0.0.1:8099`) everything still works at `/`. +11. `cargo test base_path` passes. + +## Deploy commands for S011 (do not run before) +- Back up: `ssh root@192.168.1.71 cp /root/Dezio/.env /root/Dezio/.env.bak-`. +- Landing: `scp deploy/landing/index.html root@192.168.1.71:/srv/landing/index.html` (mkdir `/srv/landing` first). +- `tailscale serve --bg --set-path / /srv/landing` +- `tailscale serve --bg --set-path /dezio http://127.0.0.1:8080` (keep Funnel on; keep the `/git` mapping). +- In `/root/Dezio/.env`: `DASHBOARD_URL=https://archlinux.tail7c4f5e.ts.net/dezio`, then restart `dezio-bot`. +- Check `https://archlinux.tail7c4f5e.ts.net/`, `/dezio/`, `/git/`. The router accepts the prefix stripped or not. + +## Owner checklist 🧑 +- Developer Portal → OAuth2 → Redirects: add `https://archlinux.tail7c4f5e.ts.net/dezio/callback`. +- Activities → URL Mappings: `/` → `archlinux.tail7c4f5e.ts.net/dezio/activity`. +- top.gg website field: `https://archlinux.tail7c4f5e.ts.net/dezio/`. + +## Doubts +- Whether tailscale strips `/dezio` (both handled, not verified). +- `web/dashboard/index.html` has `__BASE__` placeholders, so opening it as a plain file shows broken links. +- Root-absolute paths left in web/: none outside `__BASE__` placeholders (grep `(href|src|action)="/[a-z]` in web/site finds none). diff --git a/docs/topgg.md b/docs/topgg.md index 5a28d89..8958f45 100644 --- a/docs/topgg.md +++ b/docs/topgg.md @@ -8,7 +8,7 @@ Copy each block into the matching field on the bot's Top.gg edit page. |---|---| | Invite URL | https://discord.com/oauth2/authorize?client_id=1387839600017412106&scope=bot%20applications.commands&permissions=8 | | Support server | https://discord.gg/UnSga5DmR7 | -| Website | https://archlinux.tail7c4f5e.ts.net | +| Website | https://archlinux.tail7c4f5e.ts.net/dezio/ | | GitHub / source | https://archlinux.tail7c4f5e.ts.net/git/astar76/Dezio | | Prefix | `D!` (every command is also a slash command) | | Library | Rust (twilight + songbird) | @@ -55,7 +55,7 @@ Chess, Connect 4, tic-tac-toe, Wordle, hangman, minesweeper, 2048, Akinator, Coo AI chat with a personality you can change per server, anime GIF actions, confessions, a phone-call system between servers, quotes you can style, emoji tools, weather, translation, wikipedia / web / image search, a calculator and a **Game Boy you can play inside Discord** (Activity). ## Links -- **Website & dashboard:** https://archlinux.tail7c4f5e.ts.net +- **Website & dashboard:** https://archlinux.tail7c4f5e.ts.net/dezio/ - **Support server:** https://discord.gg/UnSga5DmR7 - **Source code:** https://archlinux.tail7c4f5e.ts.net/git/astar76/Dezio - Privacy policy and terms are on the website. diff --git a/src/commands/gameboy.rs b/src/commands/gameboy.rs index 9f8523d..6c6cf4d 100644 --- a/src/commands/gameboy.rs +++ b/src/commands/gameboy.rs @@ -8,7 +8,7 @@ //! //! Owner setup, once, in the Developer Portal (app → Activities): //! 1. Settings → enable Activities. -//! 2. URL Mappings → prefix `/` → target `/activity`. +//! 2. URL Mappings → prefix `/` → target `/activity` (…ts.net/dezio/activity). use crate::cmd::{Command, Ctx, Origin}; use crate::state::State; use crate::ui::{button, Card}; diff --git a/src/web/activity.rs b/src/web/activity.rs index b5be20b..d5b49f4 100644 --- a/src/web/activity.rs +++ b/src/web/activity.rs @@ -1,4 +1,4 @@ -//! The Game Boy Discord Activity's web side, served by the dashboard's web server under /activity. +//! The Game Boy Discord Activity's web side, served by the dashboard's web server under /activity (below the DASHBOARD_URL path, /dezio). //! //! The emulator itself (binjgb, WebAssembly) runs in each player's Discord client, so the bot only hands out the page, //! the ROMs (once — the client keeps them in IndexedDB) and the saves. @@ -16,7 +16,7 @@ //! GET /activity/api/art/ the game's cover (public): an image next to the ROM wins, else SteamGridDB //! (STEAMGRIDDB_API_KEY), cached in data/gameboy/art //! -//! Developer Portal setup (once): Activities → Settings → enable; Activities → URL Mappings → `/` → `/activity` +//! Developer Portal setup (once): Activities → Settings → enable; Activities → URL Mappings → `/` → `/activity` (e.g. archlinux.tail7c4f5e.ts.net/dezio/activity) //! (no https://); OAuth2 → Redirects needs at least one entry (the dashboard's /callback is there already). //! DEZIO_ACTIVITY_DEV=1 adds POST /activity/api/dev-session, a test sign-in for requests from 127.0.0.1. //! Everything else under /api needs the session from /api/token (`Authorization: Bearer …`). @@ -340,8 +340,8 @@ async fn page() -> Response { ([(header::CONTENT_TYPE, "text/html; charset=utf-8"), (header::CACHE_CONTROL, "no-cache")], page_html()).into_response() } -async fn slash_redirect(uri: axum::http::Uri) -> Redirect { - Redirect::to(&format!("/activity/{}", uri.query().map(|q| format!("?{q}")).unwrap_or_default())) +async fn slash_redirect(AxState(w): AxState, uri: axum::http::Uri) -> Redirect { + Redirect::to(&format!("{}/activity/{}", w.cfg.base, uri.query().map(|q| format!("?{q}")).unwrap_or_default())) } fn dev_mode(addr: &SocketAddr) -> bool { @@ -366,7 +366,7 @@ async fn web_session(AxState(w): AxState, headers: HeaderMap) -> Respons if origin != w.cfg.origin && origin != format!("{}://{host}", if w.cfg.secure { "https" } else { "http" }) { return ApiError::new(403, "Cross-site request refused").into_response(); } - let Some(s) = w.session(&headers) else { return (StatusCode::UNAUTHORIZED, Json(json!({"error": "Sign in with Discord first", "login": "/login?next=/activity/"}))).into_response() }; + let Some(s) = w.session(&headers) else { return (StatusCode::UNAUTHORIZED, Json(json!({"error": "Sign in with Discord first", "login": format!("{}/login?next=/activity/", w.cfg.base)}))).into_response() }; Json(json!({"session": w.activity.new_session(s.user_id, &s.name), "user": {"id": s.user_id.to_string(), "name": s.name}})).into_response() } diff --git a/src/web/mod.rs b/src/web/mod.rs index dc8603d..7003f98 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -1,5 +1,7 @@ //! The web dashboard: Dezio's website plus per-user and per-server settings, served by the bot itself. //! +//! Everything below lives under the path of DASHBOARD_URL (https://archlinux.tail7c4f5e.ts.net/dezio → /dezio; D-013). +//! Un-prefixed paths work too. HTML pages get that path in place of `__BASE__`. //! / the website (web/site/: index, terms, privacy, assets/, images/) //! /dashboard the settings app (web/dashboard/), which talks to /api/… //! /login → Discord → /callback sign in with Discord (OAuth2, "identify" only) @@ -8,7 +10,7 @@ //! Settings in .env: //! DASHBOARD_CLIENT_SECRET the app's OAuth2 client secret (Developer Portal → OAuth2) — sign-in is off without it //! DASHBOARD_URL the address people open, default http://192.168.1.71:8080; -//! add DASHBOARD_URL + "/callback" under OAuth2 → Redirects in the Developer Portal +//! add DASHBOARD_URL + "/callback" (…/dezio/callback) under OAuth2 → Redirects in the Developer Portal //! DASHBOARD_HOST / _PORT where to listen (default 0.0.0.0 and the port from DASHBOARD_URL) //! //! Security: sessions are random server-side tokens in an HttpOnly, SameSite=Lax cookie; every change needs the @@ -45,6 +47,8 @@ const ACTIVITY_CSP: &str = "default-src 'self'; script-src 'self' 'wasm-unsafe-e pub struct Cfg { pub url: String, + /// Path part of `url` without a trailing slash (`/dezio`), empty when the site lives at the root. + pub base: String, pub origin: String, pub secure: bool, pub host: String, @@ -52,6 +56,12 @@ pub struct Cfg { pub client_secret: String, } +/// The path part of the public address, without a trailing slash: `https://x.ts.net/dezio/` → `/dezio`, no path → ``. +pub fn base_path(url: &str) -> String { + let path = reqwest::Url::parse(url).map(|u| u.path().trim_end_matches('/').to_string()).unwrap_or_default(); + if path.is_empty() { String::new() } else { path } +} + impl Cfg { pub fn from_env() -> Self { let url = std::env::var("DASHBOARD_URL").ok().filter(|u| !u.is_empty()).unwrap_or_else(|| "http://192.168.1.71:8080".into()).trim_end_matches('/').to_string(); @@ -60,6 +70,7 @@ impl Cfg { let origin = parsed.as_ref().map(|u| format!("{}://{}", u.scheme(), u.host_str().unwrap_or("localhost").to_string() + &u.port().map(|p| format!(":{p}")).unwrap_or_default())).unwrap_or_else(|| url.clone()); let default_port = parsed.as_ref().and_then(|u| u.port_or_known_default()).unwrap_or(8080); Self { + base: base_path(&url), origin, secure, host: std::env::var("DASHBOARD_HOST").ok().filter(|h| !h.is_empty()).unwrap_or_else(|| "0.0.0.0".into()), @@ -137,7 +148,7 @@ impl Web { } fn set_cookie(&self, resp: &mut Response, name: &str, value: &str, max_age: u64) { - let c = format!("{name}={value}; Max-Age={max_age}; Path=/; HttpOnly; SameSite=Lax{}", if self.cfg.secure { "; Secure" } else { "" }); + let c = format!("{name}={value}; Max-Age={max_age}; Path={}; HttpOnly; SameSite=Lax{}", if self.cfg.base.is_empty() { "/" } else { &self.cfg.base }, if self.cfg.secure { "; Secure" } else { "" }); if let Ok(v) = HeaderValue::from_str(&c) { resp.headers_mut().append(header::SET_COOKIE, v); } @@ -197,7 +208,7 @@ impl Web { async fn login(AxState(w): AxState, axum::extract::Query(q): axum::extract::Query>) -> Response { if !w.sign_in_ready() { - return Redirect::to("/dashboard?error=setup").into_response(); + return Redirect::to(&format!("{}/dashboard?error=setup", w.cfg.base)).into_response(); } let state = random_token(24); let params = [("client_id", w.state.app_id().to_string()), ("redirect_uri", format!("{}/callback", w.cfg.url)), ("response_type", "code".into()), ("scope", "identify".into()), ("state", state.clone()), ("prompt", "none".into())]; @@ -211,7 +222,7 @@ async fn login(AxState(w): AxState, axum::extract::Query(q): axum::extra } async fn callback(AxState(w): AxState, headers: HeaderMap, axum::extract::Query(q): axum::extract::Query>) -> Response { - let fail = |why: &str| Redirect::to(&format!("/dashboard?error={why}")).into_response(); + let fail = |why: &str| Redirect::to(&format!("{}/dashboard?error={why}", w.cfg.base)).into_response(); let (state, code) = (q.get("state").cloned().unwrap_or_default(), q.get("code").cloned().unwrap_or_default()); let expected = cookie_value(&headers, STATE_COOKIE).unwrap_or_default(); if code.is_empty() || expected.is_empty() || state != expected { @@ -238,7 +249,7 @@ async fn callback(AxState(w): AxState, headers: HeaderMap, axum::extract })); tracing::info!("Dashboard sign-in: {} ({})", me["username"], me["id"]); let after = cookie_value(&headers, NEXT_COOKIE).filter(|a| AFTER_LOGIN.contains(&a.as_str())).unwrap_or_else(|| "/dashboard".into()); - let mut resp = Redirect::to(&after).into_response(); + let mut resp = Redirect::to(&format!("{}{after}", w.cfg.base)).into_response(); w.set_cookie(&mut resp, SESSION_COOKIE, &raw, SESSION_DAYS * 86400); w.set_cookie(&mut resp, STATE_COOKIE, "", 0); w.set_cookie(&mut resp, NEXT_COOKIE, "", 0); @@ -258,8 +269,10 @@ async fn logout(AxState(w): AxState, headers: HeaderMap) -> ApiResult { // ---- headers + pages -------------------------------------------------------------------------------------------- -async fn headers_mw(request: Request, next: Next) -> Response { - let path = request.uri().path().to_string(); +async fn headers_mw(AxState(base): AxState, request: Request, next: Next) -> Response { + let full = request.uri().path().to_string(); + // Rules below match the path without the base, so they hold under /dezio/ and without it. + let path = if base.is_empty() { full } else { full.strip_prefix(base.as_str()).unwrap_or(&full).to_string() }; let mut resp = next.run(request).await; let h = resp.headers_mut(); h.insert("x-content-type-options", HeaderValue::from_static("nosniff")); @@ -286,27 +299,43 @@ async fn headers_mw(request: Request, next: Next) -> Response { pub fn router(w: Shared) -> Router { let site = paths::web(&["site"]); let app = paths::web(&["dashboard"]); - let page = |dir: &std::path::Path, name: &str| ServeFile::new(dir.join(name)); - Router::new() + let base = w.cfg.base.clone(); + // HTML pages carry `__BASE__` where a root-absolute path would go; it becomes the base path here. + let page = |dir: &std::path::Path, name: &str| { + let file = dir.join(name); + let base = base.clone(); + get(move || { + let (file, base) = (file.clone(), base.clone()); + async move { + let html = tokio::fs::read_to_string(&file).await.unwrap_or_default().replace("__BASE__", &base); + ([(header::CONTENT_TYPE, "text/html; charset=utf-8")], html).into_response() + } + }) + }; + let inner: Router = Router::new() .route("/login", get(login)) .route("/callback", get(callback)) .route("/logout", post(logout)) .merge(api::routes()) .merge(activity::routes()) - .route_service("/dashboard", page(&app, "index.html")) - .route_service("/dashboard/", page(&app, "index.html")) - .route_service("/", page(&site, "index.html")) - .route_service("/index.html", page(&site, "index.html")) - .route_service("/terms", page(&site, "terms.html")) - .route_service("/terms.html", page(&site, "terms.html")) - .route_service("/privacy", page(&site, "privacy.html")) - .route_service("/privacy.html", page(&site, "privacy.html")) + .route("/dashboard", page(&app, "index.html")) + .route("/dashboard/", page(&app, "index.html")) + .route("/", page(&site, "index.html")) + .route("/index.html", page(&site, "index.html")) + .route("/terms", page(&site, "terms.html")) + .route("/terms.html", page(&site, "terms.html")) + .route("/privacy", page(&site, "privacy.html")) + .route("/privacy.html", page(&site, "privacy.html")) .nest_service("/dashboard/static", ServeDir::new(app.join("static"))) .nest_service("/assets", ServeDir::new(site.join("assets"))) .nest_service("/images", ServeDir::new(site.join("images"))) // files too big for Discord, kept for a few hours (see hosted.rs) - .nest_service("/f", ServeDir::new(crate::hosted::dir())) - .layer(middleware::from_fn(headers_mw)) + .nest_service("/f", ServeDir::new(crate::hosted::dir())); + // Under a base path (/dezio) the routes live there. The un-prefixed paths stay too, so it works whether the + // reverse proxy (tailscale serve --set-path) strips the prefix or not. + let routes = if base.is_empty() { inner } else { Router::new().nest(&base, inner.clone()).merge(inner) }; + routes + .layer(middleware::from_fn_with_state(base, headers_mw)) .layer(axum::extract::DefaultBodyLimit::max(64 * 1024)) .with_state(w) } @@ -314,7 +343,8 @@ pub fn router(w: Shared) -> Router { /// For `--web-dev`: serve on 127.0.0.1:8099 with a signed-in test session (cookie `dezio_session=devtoken`). pub fn start_dev(state: Arc) { let url = "http://127.0.0.1:8099".to_string(); - let cfg = Cfg { origin: url.clone(), url, secure: false, host: "127.0.0.1".into(), port: 8099, client_secret: "dev".into() }; + let base = base_path(&url); + let cfg = Cfg { origin: url.clone(), base, url, secure: false, host: "127.0.0.1".into(), port: 8099, client_secret: "dev".into() }; let sessions = JsonStore::open(std::env::temp_dir().join("dezio-dev-sessions.json")); sessions.set(sha("devtoken"), json!({"user_id": 4242u64, "name": "Dev Tester", "username": "devtester", "avatar": null, "csrf": "devcsrf", "created": now(), "expires": now() + 86400})); let web = Arc::new(Web { state, cfg, sessions, activity: Arc::new(activity::Activity::new()), preview: tokio::sync::Semaphore::new(2) }); @@ -357,13 +387,23 @@ mod tests { use axum::http::{Method, Request as HttpRequest}; use tower::ServiceExt; + #[test] + fn base_path_from_dashboard_url() { + assert_eq!(base_path("https://archlinux.tail7c4f5e.ts.net/dezio"), "/dezio"); + assert_eq!(base_path("https://archlinux.tail7c4f5e.ts.net/dezio/"), "/dezio"); + assert_eq!(base_path("http://127.0.0.1:8099/a/b"), "/a/b"); + assert_eq!(base_path("http://192.168.1.71:8080"), ""); + assert_eq!(base_path("http://192.168.1.71:8080/"), ""); + assert_eq!(base_path("not a url"), ""); + } + fn web() -> Shared { let _ = rustls::crypto::ring::default_provider().install_default(); let http = Arc::new(twilight_http::Client::new("x".into())); let state = Arc::new(State::new(http, crate::cmd::Registry::new(vec![]), "x".into())); state.set_app_id(twilight_model::id::Id::new(1)); state.set_bot_id(twilight_model::id::Id::new(2)); - let cfg = Cfg { url: "http://dashboard.test".into(), origin: "http://dashboard.test".into(), secure: false, host: "127.0.0.1".into(), port: 0, client_secret: "secret".into() }; + let cfg = Cfg { url: "http://dashboard.test".into(), base: String::new(), origin: "http://dashboard.test".into(), secure: false, host: "127.0.0.1".into(), port: 0, client_secret: "secret".into() }; Arc::new(Web { state, cfg, sessions: JsonStore::open(std::env::temp_dir().join(format!("dezio-ws-{}.json", rand::random::()))), activity: Arc::new(activity::Activity::new()), preview: tokio::sync::Semaphore::new(2) }) } diff --git a/web/activity/static/app.js b/web/activity/static/app.js index f176c76..7637868 100644 --- a/web/activity/static/app.js +++ b/web/activity/static/app.js @@ -7,7 +7,8 @@ */ 'use strict'; -const BASE = location.pathname.startsWith('/activity') ? '/activity' : ''; +// Where this page is served from: /dezio/activity in a browser, / inside Discord (its URL mapping hides the prefix). +const BASE = location.pathname.replace(/\/(index\.html)?$/, ''); const $ = (s) => document.querySelector(s); const CPU_HZ = 4194304; const AUDIO_FRAMES = 4096; diff --git a/web/dashboard/index.html b/web/dashboard/index.html index fd08dfe..6a0a9db 100644 --- a/web/dashboard/index.html +++ b/web/dashboard/index.html @@ -1,14 +1,14 @@ - + Dezio dashboard - - - - + + + +