diff --git a/electron/build.js b/electron/build.js index 00846b83e..ddba909eb 100644 --- a/electron/build.js +++ b/electron/build.js @@ -512,6 +512,7 @@ async function startBuild(data) { fse.copySync(path.resolve(__dirname, "../public/language"), path.resolve(electronDir, "language")) // config.js fs.writeFileSync(electronDir + "/config.js", "window.systemInfo = " + JSON.stringify(systemInfo), 'utf8'); + fs.writeFileSync(electronDir + "/dark", '', 'utf8'); fs.writeFileSync(nativeCachePath, utils.formatUrl(data.url)); fs.writeFileSync(devloadCachePath, "", 'utf8'); // index.html diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 04a16beae..564d69ec5 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -1,4 +1,4 @@ -const isElectron = !!(window && window.process && window.process.type); +const isElectron = !!(window && window.process && window.process.type && window.electron); const isEEUiApp = window && window.navigator && /eeui/i.test(window.navigator.userAgent); const isSoftware = isElectron || isEEUiApp; @@ -192,7 +192,7 @@ $A.isElectron = isElectron; $A.isSoftware = isSoftware; $A.openLog = false; if (isElectron) { - $A.Electron = electron; + $A.Electron = window.electron; $A.Platform = /macintosh|mac os x/i.test(navigator.userAgent) ? "mac" : "win"; $A.isMainElectron = /\s+MainTaskWindow\//.test(window.navigator.userAgent); $A.isSubElectron = /\s+SubTaskWindow\//.test(window.navigator.userAgent); diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index c2ba05bf4..0f2f61480 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -1106,10 +1106,9 @@ export default { * @param dispatch * @param params */ - openChildWindow({dispatch}, params) { - dispatch("userUrl", params.path).then(path => { - $A.Electron.sendMessage('openChildWindow', Object.assign(params, {path})) - }) + async openChildWindow({dispatch}, params) { + const path = await dispatch("userUrl", params.path) + $A.Electron.sendMessage('openChildWindow', Object.assign(params, {path})) }, /** @@ -1117,14 +1116,11 @@ export default { * @param dispatch * @param url */ - openWebTabWindow({dispatch}, url) { - if ($A.getDomain(url) != $A.getDomain($A.mainUrl())) { - $A.Electron.sendMessage('openWebTabWindow', {url}) - return + async openWebTabWindow({dispatch}, url) { + if ($A.getDomain(url) == $A.getDomain($A.mainUrl())) { + url = await dispatch("userUrl", url) } - dispatch("userUrl", url).then(url => { - $A.Electron.sendMessage('openWebTabWindow', {url}) - }) + $A.Electron.sendMessage('openWebTabWindow', {url}) }, /** *****************************************************************************************/