From 5799d5d049aa122a93c6061cfdbc3ce2c221bf09 Mon Sep 17 00:00:00 2001 From: tianmo Date: Fri, 30 Oct 2026 16:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=BA=A6bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpineThumbnailGenerateServer/js/i18n.js | 3 ++- SpineThumbnailGenerateServer/js/plugin.js | 2 +- SpineThumbnailGenerateServer/js/progress-window.js | 3 ++- SpineThumbnailGenerateServer/tests/progress-window.test.js | 4 ++++ release/UNIVERSAL_SpineThumbnailGenerateServer/js/i18n.js | 3 ++- release/UNIVERSAL_SpineThumbnailGenerateServer/js/plugin.js | 2 +- .../js/progress-window.js | 3 ++- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/SpineThumbnailGenerateServer/js/i18n.js b/SpineThumbnailGenerateServer/js/i18n.js index 760533e..658a867 100644 --- a/SpineThumbnailGenerateServer/js/i18n.js +++ b/SpineThumbnailGenerateServer/js/i18n.js @@ -25,7 +25,8 @@ function normalizeLocale(raw) { function requestedLocale() { try { - const fromUrl = new URLSearchParams(location.search).get('lang'); + const params = new URLSearchParams(location.search); + const fromUrl = params.get('lang') || params.get('locale'); if (fromUrl) return fromUrl; } catch (error) { /* No browser location. */ } try { diff --git a/SpineThumbnailGenerateServer/js/plugin.js b/SpineThumbnailGenerateServer/js/plugin.js index 60c1d7e..8cabda7 100644 --- a/SpineThumbnailGenerateServer/js/plugin.js +++ b/SpineThumbnailGenerateServer/js/plugin.js @@ -2,7 +2,7 @@ // 每次改动递增。Eagle 里的 service 插件是启动时加载并常驻的,改完代码必须重新加载插件 // 才会生效;状态栏会显示这个版本号,方便确认加载的到底是不是最新代码。 -const VERSION = 'v66'; +const VERSION = 'v67'; const SHOW_DEV_VERSION = true; const path = require('path'); diff --git a/SpineThumbnailGenerateServer/js/progress-window.js b/SpineThumbnailGenerateServer/js/progress-window.js index 64fdb19..94e6190 100644 --- a/SpineThumbnailGenerateServer/js/progress-window.js +++ b/SpineThumbnailGenerateServer/js/progress-window.js @@ -83,7 +83,8 @@ function createPopup() { ...manifest.main, // 必须关掉 serviceMode,否则 Eagle 会按 show:false 创建这个窗口。 serviceMode: false, - url: 'progress.html?lang=' + encodeURIComponent(i18n ? i18n.locale : 'zh_CN'), + // Eagle 会把 url 交给 pathToFileURL,查询参数必须由 Eagle 追加,否则 ? 会被编码成文件名。 + url: 'progress.html', width: WINDOW_SIZE.width, height: WINDOW_SIZE.height, show: true, diff --git a/SpineThumbnailGenerateServer/tests/progress-window.test.js b/SpineThumbnailGenerateServer/tests/progress-window.test.js index 10e4b7e..43001ed 100644 --- a/SpineThumbnailGenerateServer/tests/progress-window.test.js +++ b/SpineThumbnailGenerateServer/tests/progress-window.test.js @@ -7,8 +7,12 @@ const path = require('node:path'); const root = path.join(__dirname, '..'); const html = fs.readFileSync(path.join(root, 'progress.html'), 'utf8'); const windowSource = fs.readFileSync(path.join(root, 'js', 'progress-window.js'), 'utf8'); +const i18nSource = fs.readFileSync(path.join(root, 'js', 'i18n.js'), 'utf8'); assert.match(windowSource, /minimizable: true/); +assert.match(windowSource, /url: 'progress\.html',/); +assert.doesNotMatch(windowSource, /url: 'progress\.html\?/); +assert.match(i18nSource, /params\.get\('lang'\) \|\| params\.get\('locale'\)/); assert.match(html, /addEventListener\('beforeunload'/); assert.match(html, /function requestStop\(\)[\s\S]*writeControl\('pause'\)[\s\S]*resumeEl\.focus\(\)/); assert.match(html, /if \(allowClose \|\| finished\) return;[\s\S]*event\.returnValue = false;[\s\S]*requestStop\(\)/); diff --git a/release/UNIVERSAL_SpineThumbnailGenerateServer/js/i18n.js b/release/UNIVERSAL_SpineThumbnailGenerateServer/js/i18n.js index 760533e..658a867 100644 --- a/release/UNIVERSAL_SpineThumbnailGenerateServer/js/i18n.js +++ b/release/UNIVERSAL_SpineThumbnailGenerateServer/js/i18n.js @@ -25,7 +25,8 @@ function normalizeLocale(raw) { function requestedLocale() { try { - const fromUrl = new URLSearchParams(location.search).get('lang'); + const params = new URLSearchParams(location.search); + const fromUrl = params.get('lang') || params.get('locale'); if (fromUrl) return fromUrl; } catch (error) { /* No browser location. */ } try { diff --git a/release/UNIVERSAL_SpineThumbnailGenerateServer/js/plugin.js b/release/UNIVERSAL_SpineThumbnailGenerateServer/js/plugin.js index 4e3deaf..bcbea10 100644 --- a/release/UNIVERSAL_SpineThumbnailGenerateServer/js/plugin.js +++ b/release/UNIVERSAL_SpineThumbnailGenerateServer/js/plugin.js @@ -2,7 +2,7 @@ // 每次改动递增。Eagle 里的 service 插件是启动时加载并常驻的,改完代码必须重新加载插件 // 才会生效;状态栏会显示这个版本号,方便确认加载的到底是不是最新代码。 -const VERSION = 'v66'; +const VERSION = 'v67'; const SHOW_DEV_VERSION = false; const path = require('path'); diff --git a/release/UNIVERSAL_SpineThumbnailGenerateServer/js/progress-window.js b/release/UNIVERSAL_SpineThumbnailGenerateServer/js/progress-window.js index 64fdb19..94e6190 100644 --- a/release/UNIVERSAL_SpineThumbnailGenerateServer/js/progress-window.js +++ b/release/UNIVERSAL_SpineThumbnailGenerateServer/js/progress-window.js @@ -83,7 +83,8 @@ function createPopup() { ...manifest.main, // 必须关掉 serviceMode,否则 Eagle 会按 show:false 创建这个窗口。 serviceMode: false, - url: 'progress.html?lang=' + encodeURIComponent(i18n ? i18n.locale : 'zh_CN'), + // Eagle 会把 url 交给 pathToFileURL,查询参数必须由 Eagle 追加,否则 ? 会被编码成文件名。 + url: 'progress.html', width: WINDOW_SIZE.width, height: WINDOW_SIZE.height, show: true,