diff --git a/manifest.json b/manifest.json index 940f702..bdedede 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "default_locale": "zh_CN", "name": "__MSG_extName__", - "version": "0.1.0", + "version": "0.1.1", "description": "__MSG_extDescription__", "permissions": [ "storage", diff --git a/package.json b/package.json index a8307c1..7c59686 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cloud-drive-renamer", - "version": "0.1.0", + "version": "0.1.1", "description": "批量重命名工具,支持夸克网盘(阿里云盘和百度网盘开发中)", "type": "module", "scripts": { diff --git a/src/adapters/quark/page-script.ts b/src/adapters/quark/page-script.ts index 6fbc455..2698c33 100644 --- a/src/adapters/quark/page-script.ts +++ b/src/adapters/quark/page-script.ts @@ -186,8 +186,21 @@ window.__QUARK_PAGE_SCRIPT_READY__ = { // === PRIMARY: Set DOM-based flag for cross-world communication === // This is the reliable method that works across MAIN and ISOLATED worlds -document.body.dataset.quarkPageScriptReady = 'true'; -document.body.dataset.quarkPageScriptTimestamp = flagTimestamp.toString(); +// Defensive null check: document.body may be null at document_start +if (document.body) { + // Fast path: body already exists (common case after DOMContentLoaded) + document.body.dataset.quarkPageScriptReady = 'true'; + document.body.dataset.quarkPageScriptTimestamp = flagTimestamp.toString(); +} else { + // Fallback: defer to DOMContentLoaded when body is not ready yet + // This ensures we don't lose the DOM dataset signal even at document_start + document.addEventListener('DOMContentLoaded', () => { + const deferredTimestamp = Date.now(); + document.body.dataset.quarkPageScriptReady = 'true'; + document.body.dataset.quarkPageScriptTimestamp = deferredTimestamp.toString(); + }, { once: true }); +} // Send postMessage event for real-time notification +// Note: This is sent immediately regardless of body readiness for lowest latency window.postMessage({ type: 'QUARK_PAGE_SCRIPT_READY' }, '*'); diff --git a/src/shared/version.ts b/src/shared/version.ts index d35d5c6..1afc934 100644 --- a/src/shared/version.ts +++ b/src/shared/version.ts @@ -10,19 +10,19 @@ * 1. Edit version in package.json * 2. Run: npm run sync:version (or automatically via prebuild/predev) * - * Generated at: 2025-12-17T03:32:33.289Z + * Generated at: 2025-12-17T04:47:58.196Z */ /** * Application version number (e.g., "0.1.0") */ -export const APP_VERSION = '0.1.0' as const; +export const APP_VERSION = '0.1.1' as const; /** * Application version with 'v' prefix (e.g., "v0.1.0") * Commonly used for display purposes */ -export const APP_VERSION_WITH_PREFIX = 'v0.1.0' as const; +export const APP_VERSION_WITH_PREFIX = 'v0.1.1' as const; /** * Parse version into components @@ -30,5 +30,5 @@ export const APP_VERSION_WITH_PREFIX = 'v0.1.0' as const; export const VERSION_PARTS = { major: 0, minor: 1, - patch: 0, + patch: 1, } as const;