mirror of
https://github.com/burrow-dev/burrow-client.git
synced 2026-11-18 17:37:50 -05:00
The game page can put a web page on the theatre's screen for its player alone, when the server allows it (the admin panel's switch). - the page is a <webview> of its own partition (aj-browser): no preload, sandboxed, no plugins, no webviews of its own; any other partition is refused. it loads http(s) only and opens links in place; its session denies every permission and download, and its user agent names no Electron or Burrow. - placed and clipped as the game page says (where the screen is and what the game draws over it), and closed with the game. - the page asks with ipc "browser"; it is told "browserSupported" when this client can, and "browserState" for back, forward and the address. a webview made inside a webview's ipc handler crashed the window, so the message is handled a moment later. - the old "Theatre browser (experimental)" tick under Advanced is gone: the server turns it on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
43 lines
889 B
JavaScript
43 lines
889 B
JavaScript
"use strict";
|
|
|
|
const { ipcRenderer, contextBridge } = require("electron");
|
|
|
|
const sendWhitelist = new Set()
|
|
.add("initialized")
|
|
.add("fps")
|
|
.add("openPage")
|
|
.add("browser")
|
|
.add("ownVideo")
|
|
.add("presence")
|
|
.add("printImage")
|
|
.add("reloadGame")
|
|
.add("reportError")
|
|
.add("signupCompleted");
|
|
|
|
const receiveWhitelist = new Set()
|
|
.add("flashVarsReady")
|
|
.add("hud")
|
|
.add("ownVideoReady")
|
|
.add("browserSupported")
|
|
.add("browserState")
|
|
.add("removed");
|
|
|
|
contextBridge.exposeInMainWorld(
|
|
"ipc", {
|
|
sendToHost: (channel, ...args) => {
|
|
if (sendWhitelist.has(channel)) {
|
|
ipcRenderer.sendToHost(channel, ...args);
|
|
}
|
|
},
|
|
on: (channel, listener) => {
|
|
if (receiveWhitelist.has(channel)) {
|
|
ipcRenderer.on(channel, listener);
|
|
}
|
|
}
|
|
}
|
|
);
|
|
|
|
ipcRenderer.on("redirect-url", (event, url) => {
|
|
console.log("REDIRECT");
|
|
});
|