diff --git a/lib/http.js b/lib/http.js
index 9e0a5ae..dafb893 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -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("", panel.theatreBrowserOn() ? '' : ""), MIME[".html"]);
return;
}
diff --git a/lib/panel.js b/lib/panel.js
index 3d9ce76..6f3d346 100644
--- a/lib/panel.js
+++ b/lib/panel.js
@@ -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};
diff --git a/public/admin.html b/public/admin.html
index e24d425..bd8be34 100644
--- a/public/admin.html
+++ b/public/admin.html
@@ -1091,6 +1091,12 @@
+
+
Theatre browser (experimental)
+
+
For each player alone, on desktop client 1.3.3 or newer; nothing they see reaches the server. The client's browser is an old Chrome, so a bad site could harm a player's computer.