From 1589d4df1c0107fef4663393dbb219e9c38a27ee Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 26 May 2025 20:12:51 +0800 Subject: [PATCH] no message --- electron/index.html | 2 -- public/js/loading-theme.js | 6 ++++- .../assets/js/components/MicroApps/index.vue | 17 +++++++++++--- resources/assets/js/functions/common.js | 23 +++++-------------- resources/assets/js/pages/single/apps.vue | 2 +- resources/assets/js/store/actions.js | 9 +++++++- .../assets/statics/public/js/loading-theme.js | 6 ++++- resources/views/main.blade.php | 2 -- 8 files changed, 39 insertions(+), 28 deletions(-) diff --git a/electron/index.html b/electron/index.html index 5dd03f099..e04b2cf6a 100644 --- a/electron/index.html +++ b/electron/index.html @@ -13,8 +13,6 @@ - - diff --git a/public/js/loading-theme.js b/public/js/loading-theme.js index 8c36ba96e..12de9739b 100644 --- a/public/js/loading-theme.js +++ b/public/js/loading-theme.js @@ -7,5 +7,9 @@ if (themeName === 'dark') { let style = document.createElement('style'); style.rel = 'stylesheet'; style.innerHTML = '.app-view-loading{background-color:#0D0D0D}' - document.head.appendChild(style); + if (document.head) { + document.head.appendChild(style); + } else { + document.body.appendChild(style); + } } diff --git a/resources/assets/js/components/MicroApps/index.vue b/resources/assets/js/components/MicroApps/index.vue index e932af6dc..8dc92337a 100644 --- a/resources/assets/js/components/MicroApps/index.vue +++ b/resources/assets/js/components/MicroApps/index.vue @@ -92,6 +92,13 @@ export default { directives: {TransferDom}, components: {MicroModal, UserSelect}, + props: { + windowType: { + type: String, + default: 'embed', + }, + }, + data() { return { apps: [], @@ -212,6 +219,7 @@ export default { baseUrl: $A.mainUrl(), systemInfo: window.systemInfo, + windowType: this.windowType, isEEUIApp: $A.isEEUIApp, isElectron: $A.isElectron, @@ -311,11 +319,14 @@ export default { if (!this.apps.find(item => item.name == name)) { return name } - name = `${config.id}_${await $A.getSHA256Hash(config.url, 8)}` + const additional = `${config.url}` + .replace(/^https?:\/\//, '') + .replace(/[^a-zA-Z0-9]/g, '_') + name = `${config.id}_${additional.substring(0, 8)}` if (!this.apps.find(item => item.name == name)) { return name } - return `${config.id}_${await $A.getSHA256Hash(config.url)}` + return `${config.id}_${additional}` }, /** @@ -365,7 +376,7 @@ export default { transparent: true, keep_alive: false, }; - if (windowConfig.url) { + if (windowConfig?.url) { appConfig.url = windowConfig.url; delete windowConfig.url; } diff --git a/resources/assets/js/functions/common.js b/resources/assets/js/functions/common.js index a3351c04d..112be71a9 100755 --- a/resources/assets/js/functions/common.js +++ b/resources/assets/js/functions/common.js @@ -904,7 +904,11 @@ const timezone = require("dayjs/plugin/timezone"); } else { script.src = url } - document.body.appendChild(script) + if (document.head) { + document.head.appendChild(script) + } else { + document.body.appendChild(script) + } }) }, loadScriptS(urls) { @@ -1507,22 +1511,7 @@ const timezone = require("dayjs/plugin/timezone"); }; img.src = url; }) - }, - - /** - * 获取SHA256哈希值 - * @param str - * @param length - * @returns {Promise} - */ - async getSHA256Hash(str, length = 0) { - const encoder = new TextEncoder(); - const data = encoder.encode(str); - const hashBuffer = await crypto.subtle.digest('SHA-256', data); - const hashArray = Array.from(new Uint8Array(hashBuffer)); - const hash = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); - return length > 0 ? hash.slice(0, length) : hash; - }, + } }); /** diff --git a/resources/assets/js/pages/single/apps.vue b/resources/assets/js/pages/single/apps.vue index 93dce6c14..894089bd7 100644 --- a/resources/assets/js/pages/single/apps.vue +++ b/resources/assets/js/pages/single/apps.vue @@ -1,5 +1,5 @@ - -