diff --git a/PLAN.md b/PLAN.md index 9e95e16..978d140 100644 --- a/PLAN.md +++ b/PLAN.md @@ -18,6 +18,8 @@ security test has been done beyond earlier spot fixes. `/image` (`D!fx`) bundles work like the well-known caption bots. - Phase 2b — fm commands: every fm feature gets its data from ListenBrainz and MusicBrainz (plus the cover fallbacks), with no leftover Last.fm API logic; only song links still point to the Last.fm website. +- Phase 2c — Website path: all of Dezio's website moves to `/dezio/` on the Tailscale URL; the root gets a minimal + landing page (to be improved later). - Phase 3 — Security: website and dashboard, media inputs, commands and abuse, dependency audit; fixes for what is found; tested on a local copy only. - Phase 4 — Deploy and owner check in Discord. diff --git a/Plans/03a Website path/S006a-dezio-path.md b/Plans/03a Website path/S006a-dezio-path.md new file mode 100644 index 0000000..dea4cd9 --- /dev/null +++ b/Plans/03a Website path/S006a-dezio-path.md @@ -0,0 +1,38 @@ +# S006a — Website under /dezio/, landing page at the root + +> Category 03a Website path · Model: Sonnet · Effort: medium · Depends on: — · Size: M · Human: 🧑 Discord Developer Portal (OAuth redirect, Activity URL mapping) +> Files touched: src/web/{mod,activity}.rs, src/hosted.rs, src/commands/gameboy.rs, web/**/*.{html,js,css}, docs/topgg.md, deploy/landing/index.html (new) + +## Goal +Move all of Dezio's website (site, dashboard, API, OAuth, Game Boy Activity, hosted `/f/` files) from the root of https://archlinux.tail7c4f5e.ts.net to https://archlinux.tail7c4f5e.ts.net/dezio/ (D-013). The root `/` becomes a very simple static landing page with links to `/dezio/` and `/git/`; the owner will improve it later, so keep it minimal. `/git` (Forgejo) stays as is. + +## Read +- `src/web/mod.rs` lines 1–70 (config, `DASHBOARD_URL`) and 280–320 (router) +- `src/web/activity.rs` lines 1–30 and 485–510 (routes) +- `src/hosted.rs` lines 15–35, `src/commands/gameboy.rs` lines 1–40 +- `grep -rn '"/' web` for absolute paths in pages, JS and CSS +- `docs/topgg.md` URL lines + +## Steps +- [ ] Base path: derive it from the path part of `DASHBOARD_URL` (e.g. `https://…ts.net/dezio` → `/dezio`; none → `/`). Check with `tailscale serve --help` / docs whether `--set-path /dezio` strips the prefix before proxying (it is believed to strip it). Make the router work both ways: nest all routes under the base path and also accept un-prefixed paths, OR rely on stripping — pick one, say which in DECISIONS (D-013 addition). Cookie `Path` must match the base path. +- [ ] Pages: every absolute link in `web/site`, `web/dashboard`, `web/activity` (`href="/…"`, `src="/…"`, `fetch("/api…")`, `/login`, `/assets`, `/images`, `/dashboard`, `/activity/api/…`) works under `/dezio/`. Prefer relative paths; where a page needs the base, inject it from the server once (no per-page copy-paste). OAuth `redirect_uri` stays `DASHBOARD_URL + "/callback"`. Redirects the server sends (login, logout, `slash_redirect`) carry the base path. +- [ ] Hosted links (`hosted::store`) and `/gameboy` links come from `DASHBOARD_URL`, so they follow; check nothing else hard-codes `/f/` or `/activity` at the root. +- [ ] Landing page: `deploy/landing/index.html`, one small static page (title, two links: Dezio → `/dezio/`, Source → `/git/`), plain inline CSS, no JS. Write the deploy commands into the plan's test file for S011, do not run them: copy to `/srv/landing/` on the server, `tailscale serve --bg --set-path / /srv/landing` (static files), `tailscale serve --bg --set-path /dezio http://127.0.0.1:8080`, set `DASHBOARD_URL=https://archlinux.tail7c4f5e.ts.net/dezio` in `/root/Dezio/.env` (back it up first). Keep Funnel on. +- [ ] Docs: `docs/topgg.md` website URL → `/dezio/`; the module comments in `src/web/mod.rs`, `src/web/activity.rs`, `src/commands/gameboy.rs` that name the portal setup. 🧑 list for the owner in the test file: Discord 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. +- [ ] Unit test for the base-path parsing (pure function). +- [ ] Test file `docs/tests/S006a-dezio-path.md`: local checks with `DASHBOARD_URL=http://127.0.0.1:8099/dezio --web-dev` (every page, asset, API call, login redirect, `/f/` link, activity page under the prefix; root of the local server does not serve Dezio pages), the deploy commands above, and the 🧑 portal list. +- [ ] PROGRESS entry, INDEX line, commit `S006a: …` + +## End criteria +- `cargo check` passes; the new base-path unit test passes (`cargo test base_path`). +- `grep -rnE '(href|src|action)="/[a-z]|fetch\("/' web` shows no root-absolute path left (or each one is explained in the test file). +- `deploy/landing/index.html` exists. + +## Pitfalls +- Do not change the live server or Tailscale config in this plan; deploying is S011. +- The Game Boy Activity is loaded by Discord through its URL mapping; Discord's proxy prefixes paths itself (`/.proxy/`), so check how the page builds its API URLs before changing them. +- `--web-dev` without a path in `DASHBOARD_URL` must still work at `/` (base `/`). +- Old root links (`/dashboard`, `/f/…`) will no longer reach Dezio after the move; that is accepted (owner chose the landing page). + +## Handoff (→ PROGRESS.md) +Base-path rule, the server commands for S011, and the 🧑 portal changes. diff --git a/Plans/INDEX.md b/Plans/INDEX.md index 0d2b7bb..d4770f6 100644 --- a/Plans/INDEX.md +++ b/Plans/INDEX.md @@ -19,6 +19,10 @@ Tracker: https://claude.ai/artifact/PRAT4HSkqn44d6QFDJeovp - [x] [S006 — fm logic fully on ListenBrainz and MusicBrainz](03%20fm%20commands/S006-fm-on-metabrainz.md) +## 03a Website path + +- [ ] [S006a — Website under /dezio/, landing page at the root](03a%20Website%20path/S006a-dezio-path.md) 🧑 + ## 04 Security - [ ] [S007 — Website and dashboard security](04%20Security/S007-website-security.md) diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 1a31e79..3c3f6a2 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -14,3 +14,4 @@ - D-010 — 2026-12-01 — The fm commands read ListenBrainz (free, no key) instead of the Last.fm API, which needs Pro for everything but scrobbling from 2026-12-01. Same commands and cards; links are stored separately in `data/listenbrainz.json` (`data/lastfm.json` is kept, untouched); song links still go to the Last.fm website (free, and the Listen button reads them). Lyrics song search uses Deezer (popularity-ranked, no key). The Last.fm version is the git tag `lastfm-api-backup`. — Owner request. — all fm commands. - 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.