diff --git a/app.js b/app.js index 4e27228..4215285 100644 --- a/app.js +++ b/app.js @@ -6183,7 +6183,12 @@ const tbCenterSeed = (type, refs) => { setNodeImage: (id, dataUrl) => { if (!/^data:/i.test(String(dataUrl || ''))) return false const t = refs.nodes.find((x) => x.id === id); if (!t) return false - try { wLog('plugin-img', 'set id=' + id + ' len=' + String(dataUrl || '').length + ' prevLocal=' + (t.data && t.data.localRef ? 'Y' : 'N')) } catch (eL) { /* ignore */ } + try { + const line = 'plugin-img set id=' + id + ' len=' + String(dataUrl || '').length + ' prevLocal=' + (t.data && t.data.localRef ? 'Y' : 'N') + const SF = window.IWBStorageFile + if (SF && typeof SF.logLine === 'function') SF.logLine(line) + wLog('plugin-img', line) + } catch (eL) { /* ignore */ } updateNode(id, origImagePatch(t.data || {}, String(dataUrl))) // v3.26.174:同步失效这张图的缩略图/URL 缓存并触发重渲染(与 saveNodeImage 同因) try { const k = wDisplayThumbKeyOf(String(dataUrl || '')); if (k) { displayThumbs.delete(k); displayThumbsSm.delete(k) } } catch (e1) { /* ignore */ } @@ -6202,7 +6207,9 @@ const tbCenterSeed = (type, refs) => { const nd = (refs.nodes || []).find((x) => x && x.id === id) || null const keys = nd && nd.data ? Object.keys(nd.data).join(',') : '' const hasLocal = nd && nd.data ? (nd.data.localRef ? 'Y' : 'N') : '?' - wLog('plugin-img', 'save id=' + id + ' ok=' + (r && r.ok) + ' err=' + String((r && r.error) || '-') + ' len=' + String(dataUrl || '').length + ' localRef=' + hasLocal + ' keys=' + keys) + const line = 'plugin-img save id=' + id + ' ok=' + (r && r.ok) + ' err=' + String((r && r.error) || '-') + ' len=' + String(dataUrl || '').length + ' localRef=' + hasLocal + ' keys=' + keys + try { const SF = window.IWBStorageFile; if (SF && typeof SF.logLine === 'function') SF.logLine(line) } catch (eB) { /* ignore */ } + wLog('plugin-img', line) } catch (eL) { /* ignore */ } try { if (r && r.ok) showToast('已覆盖原图', 'ok') diff --git a/package.json b/package.json index 768d171..27399a0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "image-workbench-web", "private": true, - "version": "3.26.177", + "version": "3.26.178", "description": "Browser-based node canvas image workbench", "scripts": { "build": "node scripts/build.js && node scripts/copy-plugins.js", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2852a2f..d6ab5e7 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2014,7 +2014,7 @@ dependencies = [ [[package]] name = "image-workbench" -version = "3.26.176" +version = "3.26.177" dependencies = [ "arboard", "base64 0.22.1", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0b74d7b..10cab5e 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "image-workbench" -version = "3.26.177" +version = "3.26.178" description = "无限画布 · 生图工作台桌面版" authors = ["malongan"] license = "" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 6ceaf63..f02974b 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "image-workbench", - "version": "3.26.177", + "version": "3.26.178", "identifier": "com.malongan.imageworkbench", "build": { "frontendDist": "../dist", diff --git a/src/storage-file.js b/src/storage-file.js index 5a059c8..6c09c15 100644 --- a/src/storage-file.js +++ b/src/storage-file.js @@ -256,7 +256,13 @@ } catch (e) { return false } }, async keys() { try { return Object.keys(assets).concat(Object.keys(small)) } catch (e) { return [] } }, - async logPut(id, entry) { return kv.put('log:' + id, JSON.stringify(entry)) }, + async logPut(id, entry) { + // v3.26.178:兼容两种调用 —— 浏览器端传 (entry),app.js 传 ({id, at, kind, msg, detail})。 + // 旧实现只认 (id, entry),桌面端把整个对象当 id ⇒ key 变 log:[object Object]、值变 undefined, + // 所有 wLog 记录互相覆盖成一条垃圾数据。 + if (id && typeof id === 'object') { entry = id; id = entry.id || ('log-' + Date.now()) } + return kv.put('log:' + id, JSON.stringify(entry)) + }, async logAll() { const out = [] for (const k of Object.keys(small)) if (k.indexOf('log:') === 0) { try { out.push(JSON.parse(small[k])) } catch (e) { /* ignore */ } }