release: v3.26.88 图库落盘 P0(状态可见+一键补存)

This commit is contained in:
qiqi committed 2026-11-25 22:57:30 +08:00
1 parent ebc6ce1251
commit 7b43002f6b
13 files changed
+100 -23

No files matched your search

+31 -2
View File
@@ -116,6 +116,13 @@
var failEl = el('span', { class: 'iwb-gal-fail', text: '' })
failEl.style.display = 'none'
failEl.addEventListener('click', function () { retryAll() })
// v1.7.4:「仅缩略图」统计 —— 原图没落盘时点一下批量补存(宿主把远程字节写回 images/gallery)
var origEl = el('span', { class: 'iwb-gal-orig', text: '' })
origEl.style.display = 'none'
origEl.addEventListener('click', function () {
var names = items.filter(function (x) { return x.orig && x.orig !== 'ok' }).map(function (x) { return x.name })
if (names.length) doBackfill(names)
})
var refreshBtn = iconBtn('刷新', function (svg) {
svgPath(svg, 'M13.2 6.4A5.4 5.4 0 1 0 13.4 9.4')
svgPath(svg, 'M13.2 2.6v3.8H9.4')
@@ -157,7 +164,7 @@
// v1.4.2:刷新与设置同放右侧工具组(此前刷新在左侧信息区,空间不足时会向右溢出、压住设置图标)
var tools = el('div', { class: 'iwb-gal-tools' }, refreshBtn, folderBtn, setBtn)
var foot = el('div', { class: 'iwb-gal-foot' },
el('div', { class: 'iwb-gal-foot-left' }, countEl, pickedEl, failEl, statusEl), tools)
el('div', { class: 'iwb-gal-foot-left' }, countEl, pickedEl, failEl, origEl, statusEl), tools)
var wrap = el('div', { class: 'iwb-history-embedded' }, [head, grid, more, empty, foot, settings])
function setOpen (open) {
@@ -202,6 +209,7 @@
.then(function () { setStatus('已插入:' + it.name) })
.catch(function () { setStatus('插入失败') })
})
if (it.orig && it.orig !== 'ok') item('补存原图', function () { doBackfill([it.name]) })
item('下载', function () { doDownload([it.name]) })
item('预览大图', function () { try { ctx.gallery.preview(it.name) } catch (err) { /* ignore */ } })
item('复制文件名', function () {
@@ -271,6 +279,9 @@
clear(actions)
countEl.textContent = items.length + ' / ' + total + ' 张'
pickedEl.textContent = count() ? ('已选 ' + count()) : ''
var missing = items.filter(function (x) { return x.orig && x.orig !== 'ok' }).length
if (missing) { origEl.style.display = ''; origEl.textContent = missing + ' 张仅缩略图 · 补存'; origEl.title = '这些图的原图没有写进本地(只有 320px 缩略图)。点一下把远程原图补存到 images/gallery' }
else { origEl.style.display = 'none'; origEl.textContent = '' }
var n = count()
function btn (label, title0, fn, need, danger) {
var b = el('button', { class: 'iwb-btn iwb-btn-sm' + (danger ? ' iwb-btn-danger' : '') + (need && !n ? ' iwb-gal-off' : ''), text: label, title: need && !n ? '先选中图片' : title0 })
@@ -372,6 +383,11 @@
// 缩略图是**异步**的(ctx.gallery.thumb 返回 Promise):先占位,拿到地址再挂 img。
// v1.2.0:加载失败自动重试 2 次(图片还没落盘/临时不可读),仍失败才显示可点击重试的占位。
box.title = it.name + '(单击单选 · Shift+单击多选 · 双击放大 · 拖到画布=参考图节点)'
var origBadge = null
if (it.orig && it.orig !== 'ok') {
origBadge = el('span', { class: 'iwb-gal-origbadge', text: it.orig === 'off' ? '未备份' : '仅缩略图' })
origBadge.title = it.orig === 'off' ? '原图入库已关闭:这张只有缩略图' : '原图没有写进本地:右键可「补存原图」'
}
var holder = el('div', { class: 'iwb-history-missing', text: '加载中…' })
box.appendChild(holder)
var tries = 0
@@ -459,6 +475,8 @@
// v1.7.2:图片卡片上只留「下载」;插入仍可从顶部工具栏或右键菜单进入。
acts.appendChild(act('下载', '下载到本地', function () { doDownload([it.name]) }))
box.appendChild(acts)
// 角标最后挂:不要 z-index(插件层级闸门禁止裸值),靠 DOM 顺序盖在图片上
if (origBadge) box.appendChild(origBadge)
return box
}
@@ -468,6 +486,17 @@
clearTimeout(statusTimer)
if (text) statusTimer = setTimeout(function () { statusEl.textContent = '' }, 4000)
}
function doBackfill (names) {
if (!ctx.gallery || typeof ctx.gallery.backfill !== 'function') { setStatus('当前宿主不支持补存原图'); return }
setStatus('补存中…(' + names.length + ' 张)')
Promise.resolve(ctx.gallery.backfill(names)).then(function (r) {
var ok = (r && (r.ok || r.count)) || 0
var failed = (r && r.failed) || []
if (failed.length) setStatus('补存完成 ' + ok + ' 张,' + failed.length + ' 张失败(远程链接取不到)')
else setStatus('已补存 ' + ok + ' 张原图')
return load()
}).catch(function () { setStatus('补存失败,可稍后重试') })
}
function doDownload (names) {
setStatus('下载中…')
return Promise.resolve(ctx.gallery.download(names)).then(function (r) {
@@ -590,7 +619,7 @@
global.IWBPluginHost.register({
id: 'gallery',
name: '图库',
version: '1.7.3',
version: '1.7.4',
apiVersion: 1,
capabilities: ['panels', 'gallery'],
data: { schemaVersion: 1, maxBytes: 65536 },
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "gallery",
"name": "图库",
"version": "1.7.3",
"version": "1.7.4",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"图库"
],
"files": {
"main.js": "b497528aa9cd616b5caa28b940bd70c64c36b22ed35f3dad8a2052f31687be73",
"styles.css": "f4cc8ff0d8c1cfc7d90a2988ebfd33473986da81228187385f3483e7eff62b8b"
"main.js": "30b804a02aa15bdb54cfc6520c9ce5e0e58db08dd658ff262770cb08108383c1",
"styles.css": "14d374b5d0e1461cb1ca2b125865e9c27df7c3bd79c11caa0afc52152c7d0aef"
}
}
+12
View File
@@ -113,3 +113,15 @@
}
.iwb-gal-fail:hover { color: var(--iwb-err); opacity: .85; }
.iwb-gal-menu .iwb-ctx-title { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ---- v1.7.4:原图未落盘(仅缩略图)可见化 ---- */
.iwb-gal-orig {
font-size: 11px; color: var(--iwb-warn); cursor: pointer; white-space: nowrap;
text-decoration: underline dotted; text-underline-offset: 2px; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis;
}
.iwb-gal-orig:hover { color: var(--iwb-warn); opacity: .85; }
.iwb-gal-origbadge {
position: absolute; left: var(--iwb-space-4, 4px); top: var(--iwb-space-4, 4px);
padding: 0 var(--iwb-space-4, 4px); border-radius: var(--iwb-radius-full, 999px);
background: var(--iwb-panel); color: var(--iwb-warn); border: 1px solid var(--iwb-border);
font-size: var(--iwb-font-2xs, 10px); line-height: 1.5; pointer-events: none;
}
+3 -3
View File
@@ -33,10 +33,10 @@
"dir": "gallery",
"main": "main.js",
"style": "styles.css",
"version": "1.7.3",
"version": "1.7.4",
"files": {
"main.js": "b497528aa9cd616b5caa28b940bd70c64c36b22ed35f3dad8a2052f31687be73",
"styles.css": "f4cc8ff0d8c1cfc7d90a2988ebfd33473986da81228187385f3483e7eff62b8b"
"main.js": "30b804a02aa15bdb54cfc6520c9ce5e0e58db08dd658ff262770cb08108383c1",
"styles.css": "14d374b5d0e1461cb1ca2b125865e9c27df7c3bd79c11caa0afc52152c7d0aef"
}
},
{