feat(theatre): an experimental web browser on the theatre screen

In a theatre, "Browser" puts a web page on the screen for that player
alone, beside "Your Video". The desktop client (1.3.3) draws it in a
sandboxed webview of its own over the game page, which tells it where,
what the game draws over it, and where to go; nothing of it goes to the
server.

- off by default: the admin panel's Debug tab turns it on for everyone
  (setting theatreBrowser). the server marks the game page with
  data-theatre-browser="on" as it sends it (lib/http.js), and the page
  shows the button only when the server allows it and the client says it
  can draw it, so older clients never see a button that does nothing.
- the boxes over the screen share one style (.aj-box), and a clicked
  button no longer keeps Chromium 87's focus ring.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
BurrowdevandClaude Opus 5.5 committed 2026-10-21 20:50:44 +03:00
1 parent 64eab1f8ad
commit 9720d309fa
4 files changed
+272 -19

No files matched your search

+3 -1
View File
@@ -1104,7 +1104,9 @@ const handle = async (req, res) => {
// not to be put in a frame of anyone's; the client shows it in a view of its own.
res.setHeader("X-Frame-Options", "DENY");
res.setHeader("Referrer-Policy", "no-referrer");
send(res, 200, await fs.promises.readFile(path.join(config.publicDir, "game.html")), MIME[".html"]);
// the admin's switch for the theatre browser (lib/panel.js), for the page to read
send(res, 200, String(await fs.promises.readFile(path.join(config.publicDir, "game.html")))
.replace("<html>", panel.theatreBrowserOn() ? '<html data-theatre-browser="on">' : "<html>"), MIME[".html"]);
return;
}
+14 -1
View File
@@ -285,6 +285,12 @@ const ROOM_GROUP_NOTES = {
adventures: "adventure maps; nothing in them moves",
};
// the theatre's browser (experimental; the server's game.html and client
// 1.3.3): off unless the admin turns it on. what players see in it never
// reaches the server; this only says whether the game offers it.
const THEATRE_BROWSER_SETTING = "theatreBrowser";
const theatreBrowserOn = () => accounts.setting(THEATRE_BROWSER_SETTING) === "on";
const debugState = () => ({
players: world.players().map(player => player.username).sort((a, b) => a.localeCompare(b)),
rooms: defpacks.roomPaths().map(roomPath => {
@@ -292,6 +298,7 @@ const debugState = () => ({
return {path: roomPath, group, note: ROOM_NOTES[roomPath] || ROOM_GROUP_NOTES[group] || ""};
}).sort((a, b) => a.path.localeCompare(b.path)),
everythingOnSale: sales.everythingOnSale(),
theatreBrowser: theatreBrowserOn(),
});
const debugAct = body => {
@@ -309,6 +316,12 @@ const debugAct = body => {
? "Sale dates are off: every item shows, for players who start the game from now on."
: "Sale dates are back on, for players who start the game from now on."};
}
if (body.action === "theatreBrowser") {
accounts.setSetting(THEATRE_BROWSER_SETTING, body.on === true ? "on" : "off");
return {ok: body.on === true
? "The theatre browser is on, for players on client 1.3.3 or newer once their game page loads again."
: "The theatre browser is off, once players' game pages load again."};
}
return {error: "Unknown debug action."};
};
@@ -1160,4 +1173,4 @@ const handle = async (req, res, url, from, web) => {
}
};
module.exports = {load, handle, signedIn, PASSWORD_SETTING};
module.exports = {load, handle, signedIn, theatreBrowserOn, PASSWORD_SETTING};