viewer: follow a camera link opened in the open page (VIEWER-FOLLOW-CAM-LINK) #2329

Open
github-bot wants to merge 1 commit from github-bot/gh-2329 into main AGit
Owner

@⁠syfyra on GitHub · 2026-11-26 13:53 UTC · original
syfyra:feat/viewer-follow-cam-link → main · +56 −2 · 2 files · 1 commits · draft

Claimed in the coordination issue as: VIEWER-FOLLOW-CAM-LINK

What and why

P copies a link to the current view (#cam=x,y,z,yaw,pitch), and the viewer reads that hash once, at startup. Opening such a link in a tab that already shows the viewer changes only the hash: the browser makes a same-document navigation, the page does not reload, and the camera stayed where it was. The same happened with Back and Forward between two links. A shared view therefore only worked in a fresh tab. The VIEWER-HUNT finding in #1608 noted this as an untested edge.

The viewer now applies the hash again on hashchange, through the same helper that applies it at startup. A hash that is not a camera link (empty, malformed, another fragment) leaves the camera where it is, as at startup. P uses history.replaceState, which fires no hashchange, so copying a link does not move the camera.

Tested

  • node --test tests/test_viewer_streaming.cjs (Node 26): a new test runs the whole viewer module with a link in the hash, checks that it places the camera, then fires hashchange with a second link (camera and look follow, pitch clamped as at startup) and with five hashes that are not camera links (nothing moves). On main the new test fails (no hashchange handler); with the change all 58 tests pass.
  • In the app's Chromium-based browser pane against viewer/serve.py (test terrain): setting the hash to a second link moves the HUD position there, #notacam leaves it, and Back twice returns to each earlier link.
  • Merges cleanly with #651, #918 and #2243, which also change viewer/index.html and this test file.
  • scripts/check_no_game_data.py on both files.

GPUs tested: n/a (viewer logic, Node harness)

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

**@⁠syfyra** on GitHub · 2026-11-26 13:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2329) `syfyra:feat/viewer-follow-cam-link` → `main` · +56 −2 · 2 files · 1 commits · draft Claimed in the coordination issue as: VIEWER-FOLLOW-CAM-LINK ### What and why `P` copies a link to the current view (`#cam=x,y,z,yaw,pitch`), and the viewer reads that hash once, at startup. Opening such a link in a tab that already shows the viewer changes only the hash: the browser makes a same-document navigation, the page does not reload, and the camera stayed where it was. The same happened with Back and Forward between two links. A shared view therefore only worked in a fresh tab. The VIEWER-HUNT finding in #1608 noted this as an untested edge. The viewer now applies the hash again on `hashchange`, through the same helper that applies it at startup. A hash that is not a camera link (empty, malformed, another fragment) leaves the camera where it is, as at startup. `P` uses `history.replaceState`, which fires no `hashchange`, so copying a link does not move the camera. ### Tested - `node --test tests/test_viewer_streaming.cjs` (Node 26): a new test runs the whole viewer module with a link in the hash, checks that it places the camera, then fires `hashchange` with a second link (camera and look follow, pitch clamped as at startup) and with five hashes that are not camera links (nothing moves). On `main` the new test fails (no `hashchange` handler); with the change all 58 tests pass. - In the app's Chromium-based browser pane against `viewer/serve.py` (test terrain): setting the hash to a second link moves the HUD position there, `#notacam` leaves it, and Back twice returns to each earlier link. - Merges cleanly with #651, #918 and #2243, which also change `viewer/index.html` and this test file. - `scripts/check_no_game_data.py` on both files. GPUs tested: n/a (viewer logic, Node harness) AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The camera hash (#cam=x,y,z,yaw,pitch) was read once at startup. A link
pasted into the address bar of a tab that already shows the viewer, or
Back/Forward between two links, changes only the hash: the page does not
reload and the camera stayed where it was. The viewer now applies the
hash again on hashchange; a hash that is not a camera link is ignored,
as at startup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:55:54 +00:00
Author
Owner

@⁠kurrutako on GitHub · 2026-11-26 14:15 UTC · original

Verified at head 0370dc2a1 (merge-base is current main 73516a290, so the branch is up to date).

  • node --test tests/test_viewer_streaming.cjs on the PR: 58 of 58 pass, 3 of 3 runs. On main: 57 of 57 pass.
  • The new test fails on main when it is run against main's viewer/index.html (handlers.get(...) is not a function: nothing listens for hashchange), and passes with the PR.
  • No feedback loop: the viewer writes the hash only with history.replaceState (viewer/index.html:252), which does not fire hashchange.
  • python -I scripts/check_no_game_data.py on both changed files: clean.

Windows 11, Node.js 24.15.0. No browser, GPU or game files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠kurrutako** on GitHub · 2026-11-26 14:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2329#issuecomment-7194519427) Verified at head `0370dc2a1` (merge-base is current `main` `73516a290`, so the branch is up to date). - `node --test tests/test_viewer_streaming.cjs` on the PR: 58 of 58 pass, 3 of 3 runs. On `main`: 57 of 57 pass. - The new test fails on `main` when it is run against `main`'s `viewer/index.html` (`handlers.get(...) is not a function`: nothing listens for `hashchange`), and passes with the PR. - No feedback loop: the viewer writes the hash only with `history.replaceState` (`viewer/index.html:252`), which does not fire `hashchange`. - `python -I scripts/check_no_game_data.py` on both changed files: clean. Windows 11, Node.js 24.15.0. No browser, GPU or game files. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠lixonik on GitHub · 2026-11-26 15:44 UTC · original · reviewed

Windows 11/Node: 58/58 viewer tests passed, including an already-open viewer accepting a valid camera hash change and ignoring an invalid one. No findings.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-26 15:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2329#pullrequestreview-6076964512) · **reviewed** Windows 11/Node: 58/58 viewer tests passed, including an already-open viewer accepting a valid camera hash change and ignoring an invalid one. No findings. AI-assisted.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2329/head:github-bot/gh-2329'
git switch 'github-bot/gh-2329'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2329'
git switch 'github-bot/gh-2329'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2329'
git switch 'github-bot/gh-2329'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2329'
git switch 'main'
git merge --squash 'github-bot/gh-2329'
git switch 'main'
git merge --ff-only 'github-bot/gh-2329'
git switch 'main'
git merge 'github-bot/gh-2329'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.