feat(player): a bookmark reopens every player as it was, once

The Plex player names the playlist it plays through (v=player:<id>:playlist:<pid>), so a bookmark
rebuilds the queue from the playlist's own order while the item is still in it.

Found in the browser and fixed:
- after a reload the shell's player opened a second one over Home and the feed: it read the catalog
  row the page had fetched (a disabled query still reads the shared cache); it now waits for ready.
- every reload under an open overlay left a dead history step: the first overlay to open takes over
  the entry the document was loaded on.
- the feed's address was implicit, the same as the start-page landing, so a reloaded or bookmarked
  feed opened as Home: the feed now names itself (page=feed) like every page.
- a linked file or video that is gone was said, but stayed in the address and was said again on
  every reload: its keys are taken off.

The overlay address is written in one place (the entry is named once it is current), and the player
keys only the codec reads are no longer exported.
This commit is contained in:
2026-10-27 07:33:55 +01:00
parent fa893c73a3
commit 3d26ca0efa
23 changed files with 343 additions and 53 deletions
+21
View File
@@ -161,3 +161,24 @@ describe("module URL keys", () => {
for (const key of ["pl", "page", "rjob", "link"]) expect(seen).toContain(key);
});
});
// A page that opens the player an address names itself (as its queue) says so in its definition, and
// the shell's player stands back over it: one that did not would get the shell's too — two players.
describe("the player an address names", () => {
const opensIt = (page: Page) =>
sources(join(SRC, "modules", page)).some((f) =>
readFileSync(f, "utf8").includes("useOpenLinkedPlayer("),
);
it.each([...REGISTERED_PAGES])("is opened by %s exactly when it says it plays videos", (page) => {
expect(!!moduleDef(page).playsVideos).toBe(opensIt(page));
});
it("is left to the shell on every other page", () => {
const app = readFileSync(join(SRC, "shell", "App.tsx"), "utf8");
expect(app).toContain(
"<LinkedPlayer hosted={!!channelView || !!moduleDef(page).playsVideos} />",
);
expect(REGISTERED_PAGES.filter(opensIt).sort()).toEqual(["feed", "home", "playlists"]);
});
});