mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 04:04:16 +02:00
UI patches: no re-injection timer for a session that closed while attaching
The attach handler set the 15 s interval after its awaits even when the socket had closed meanwhile (onclose already ran), leaking a timer per such session. Also documents the optional stateDir config key.
This commit is contained in:
1 parent
d6ddad9cfe
commit
521092d66b
1 file changed
+3
-1
@@ -7,6 +7,7 @@
|
|||||||
// "reinjectMs": 15000, // periodic re-injection
|
// "reinjectMs": 15000, // periodic re-injection
|
||||||
// "debounceMs": 3000, // delay after a burst of new JS contexts
|
// "debounceMs": 3000, // delay after a burst of new JS contexts
|
||||||
// "unpatchTimeoutMs": 2000,
|
// "unpatchTimeoutMs": 2000,
|
||||||
|
// "stateDir": "...", // optional, for manual runs (default below)
|
||||||
// "patches": [ { "name": "launcher-menu-order",
|
// "patches": [ { "name": "launcher-menu-order",
|
||||||
// "endpoint": "http://127.0.0.1:8080",
|
// "endpoint": "http://127.0.0.1:8080",
|
||||||
// "target": { "title": "SharedJSContext" }, // or titleRegex / urlRegex
|
// "target": { "title": "SharedJSContext" }, // or titleRegex / urlRegex
|
||||||
@@ -150,7 +151,8 @@ function open(endpoint, target, list) {
|
|||||||
await call('Runtime.enable');
|
await call('Runtime.enable');
|
||||||
if (stateful.size) await call('Runtime.addBinding', { name: BINDING });
|
if (stateful.size) await call('Runtime.addBinding', { name: BINDING });
|
||||||
await inject().catch((e) => console.error(`${tag} inject:`, e.message));
|
await inject().catch((e) => console.error(`${tag} inject:`, e.message));
|
||||||
timer = setInterval(() => inject().catch(() => {}), REINJECT);
|
// Closed while attaching: onclose already ran, so no timer.
|
||||||
|
if (ws.readyState === WebSocket.OPEN) timer = setInterval(() => inject().catch(() => {}), REINJECT);
|
||||||
};
|
};
|
||||||
ws.onmessage = (e) => {
|
ws.onmessage = (e) => {
|
||||||
const m = JSON.parse(e.data);
|
const m = JSON.parse(e.data);
|
||||||
|
|||||||
Reference in new issue
Block a user