diff --git a/cloud.mithraic.sanctum.metainfo.xml b/cloud.mithraic.sanctum.metainfo.xml index fb63fc7..c15c2e0 100644 --- a/cloud.mithraic.sanctum.metainfo.xml +++ b/cloud.mithraic.sanctum.metainfo.xml @@ -27,9 +27,9 @@ pointing - + - Fixed VC sounds and tightened game presence to catalog entries plus user allowlists. + Fixed a main-process bootstrap race and improved VC sounds / game presence behavior. diff --git a/package.json b/package.json index 9d3d4ce..d119a88 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "sanctum", "productName": "Sanctum", - "version": "1.0.6", - "aviaVersion": "1.0.6", + "version": "1.0.7", + "aviaVersion": "1.0.7", "main": ".vite/build/main.js", "repository": "https://git.mithraic.cloud/ad3laid3/sanctum", "scripts": { diff --git a/src/main.ts b/src/main.ts index 2af85e9..1c7338e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -46,8 +46,12 @@ const acquiredLock = app.requestSingleInstanceLock(); const loadInject = () => { if (!mainWindow) return; - mainWindow.webContents.on("dom-ready", async () => { + const wc = mainWindow.webContents; + wc.removeAllListeners("dom-ready"); + wc.once("dom-ready", async () => { try { + if (mainWindow.isDestroyed() || wc.isDestroyed()) return; + const builtInLocalPlugins = [ { id: "sanctum-vcsounds", @@ -58,13 +62,15 @@ const loadInject = () => { }, ]; - await mainWindow.webContents.executeJavaScript( + await wc.executeJavaScript( `window.__SANCTUM_BUILTIN_LOCAL_PLUGINS__ = ${JSON.stringify( builtInLocalPlugins, )};`, true, ); + if (mainWindow.isDestroyed() || wc.isDestroyed()) return; + const plugins: string[] = [ "inject.js", "LocalPlugins.js", @@ -84,9 +90,10 @@ const loadInject = () => { ]; for (const plugin of plugins) { + if (mainWindow.isDestroyed() || wc.isDestroyed()) return; const pluginPath: string = path.join(__dirname, plugin); const pluginCode: string = fs.readFileSync(pluginPath, "utf8"); - await mainWindow.webContents.executeJavaScript(pluginCode, true); + await wc.executeJavaScript(pluginCode, true); } } catch { /* empty */
Fixed VC sounds and tightened game presence to catalog entries plus user allowlists.
Fixed a main-process bootstrap race and improved VC sounds / game presence behavior.