fix(substore): refresh stale common utilities

This commit is contained in:
Orion
2026-06-03 15:50:31 +08:00
parent 354521d161
commit 30e68ff3e9
8 changed files with 50 additions and 14 deletions
+8 -2
View File
@@ -6,10 +6,13 @@
* - 不追加订阅后缀,整合订阅最后仍交给 rename.js 处理
*/
// noinspection JSUnusedGlobalSymbols
const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4';
const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5';
const hasCurrentRenameUtils = utils => Boolean(
utils && typeof utils.normalizeLeadingMojibakeFlag === 'function'
);
async function loadRenameUtils() {
if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) {
if (typeof globalThis !== 'undefined' && hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) {
return globalThis.SubStoreRenameUtils;
}
@@ -22,6 +25,9 @@ async function loadRenameUtils() {
}
new Function(String(script))();
if (!hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) {
throw new Error('Loaded common.js is missing current rename utilities');
}
return globalThis.SubStoreRenameUtils;
}