From 1d12b7c23897aade26c9954a04c59e0c9bf39759 Mon Sep 17 00:00:00 2001 From: Burrowdev Date: Wed, 21 Oct 2026 02:13:42 +0300 Subject: [PATCH] feat: theatre videos (client 1.3.2) The game page could load nothing but its own server, so the theatre's YouTube video (staff's, for the room) and a player's own video link were blocked and showed black. It may now load the YouTube and Vimeo players' hosts, and the one sound or video file link the player put in the theatre's box, which the page passes on through the login page. Requests of the Flash plugin itself stay on the game's server. Not with onBeforeSendHeaders: in Electron 11 a listener there, even one that changes nothing, stops YouTube's player. Co-Authored-By: Claude Opus 5.5 --- app/gamePreload.js | 2 ++ app/index.html | 6 +++++ app/main.js | 58 +++++++++++++++++++++++++++++++++++++++++++++- app/package.json | 2 +- app/preload.js | 2 ++ 5 files changed, 68 insertions(+), 2 deletions(-) diff --git a/app/gamePreload.js b/app/gamePreload.js index 6446ee9..cc20766 100644 --- a/app/gamePreload.js +++ b/app/gamePreload.js @@ -6,6 +6,7 @@ const sendWhitelist = new Set() .add("initialized") .add("fps") .add("openPage") + .add("ownVideo") .add("presence") .add("printImage") .add("reloadGame") @@ -15,6 +16,7 @@ const sendWhitelist = new Set() const receiveWhitelist = new Set() .add("flashVarsReady") .add("hud") + .add("ownVideoReady") .add("removed"); contextBridge.exposeInMainWorld( diff --git a/app/index.html b/app/index.html index 878befe..61aa517 100644 --- a/app/index.html +++ b/app/index.html @@ -1166,6 +1166,12 @@ // main.js opens http and https addresses only window.client.openPage(String(event.args[0])); } + else if (event.channel === "ownVideo") { + // the player's own theatre video (the game page's link box): main.js + // lets that one address load, then the page plays it. + const link = String(event.args[0] || ""); + window.client.ownVideo(link).then(() => webview.send("ownVideoReady", link)); + } else if (event.channel === "presence") { // where the player is now (the game's AJClient.presenceRoom) showPresence(String(event.args[0] || "")); diff --git a/app/main.js b/app/main.js index 5c89737..03bf8cb 100644 --- a/app/main.js +++ b/app/main.js @@ -220,6 +220,25 @@ ipcMain.handle("useServer", (event, serverUrl, gamePort, gameHost) => { // fetch from elsewhere (a picture named in a chat line once did) would hand // a stranger the player's address, or the plugin a stranger's file. const LOCAL_SCHEMES = ["file:", "devtools:", "chrome-devtools:", "chrome:", "data:", "blob:", "about:"]; + +// the theatre's video (the server's game page: the room's, played by staff, +// and the player's own from its link box): the YouTube and Vimeo players +// and what they load, measured in this Electron. a host here counts with +// every host under it. +const VIDEO_PLAYER_HOSTS = [ + "youtube-nocookie.com", "youtube.com", "ytimg.com", "ggpht.com", "googlevideo.com", + "jnn-pa.googleapis.com", "gstatic.com", "www.google.com", + "vimeo.com", "vimeocdn.com", +]; +const videoPlayerHost = host => VIDEO_PLAYER_HOSTS.some(known => host === known || host.endsWith(`.${known}`)); +// the player's own sound or video file (the game page's link box): the one +// address they typed, as the game page says it (ownVideo below), and where +// it redirects. a