Peach: Local-first video metadata scraper and media manager.
feat(integrations): 随附用户脚本更新至 0.7.1
longmeidaoe602a06baf2d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1b9d50094..f5841da60 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -23,6 +23,7 @@ Removed / Fixed / Security。### 变更+- **采集**:随附用户脚本更新至 0.7.1。入库后整理失败时,浮卡可以直接点「重试整理」。同一浏览器里开着的多个来源页共享 Peach 任务进度,只由一个页面查询;这个页面关掉后由别的页面接手,跟踪不再一小时后停止,成功提示音只响一次。浮卡在「其他任务」下列出别的番号,每行带人物头像,点开进入该番号的五段进度页,返回键回到浮卡主页;超过 3 项或本页番号还在抓取时自动折叠。浮卡展开时按住空白处也能拖动。更新脚本并刷新来源页面后生效。- **采集**:扫描与采集的问题提示合成一块,「7 天内不再问」、完整记录和导出都放进同一个框;归档后可以撤销,刷新页面后那条「已归档」不再常驻。- **配置**:「版本统计与错误诊断」大幅减少上传量。版本统计改为每天一条日志和一条会话汇总;同一版本里同类故障在每台机器上只上传一次完整诊断,之后的发生次数合并成计数日志;坏媒体、文件锁等待、磁盘与数据库锁、来源超时和上游服务不可用等预期情况留在本机,不再上传。上传的字段范围不变。- **界面**:数据管理、任务中心、系统诊断等页面的卡片统一去掉外圈描边,深色主题下不再一半卡有框、一半没有;卡内列表的分隔线统一左边对齐文字、右边顶到卡边。diff --git a/web/integrations/jav-userscript-release.json b/web/integrations/jav-userscript-release.jsonindex b6aeaec0c..504fab992 100644--- a/web/integrations/jav-userscript-release.json+++ b/web/integrations/jav-userscript-release.json@@ -1,12 +1,12 @@{- "version": "0.6.11",+ "version": "0.7.1","repository": "https://github.com/peach-mitao/peach-userscript",- "commit": "d65179b0c7bb21ddfa6aba10d50ff4ea5f849c32",+ "commit": "a5aa2ddf4a897f2d7d0478b2a7fc044538b38aca","install_url": "/integrations/peach-jav.user.js","bridge_min_version": "0.5.1","site_schema_version": 1,"files": {- "peach-jav.user.js": "2842ddab0b0d56710a9692161944ebdfcccbc805ce56c3a7aa898c68b3ee9a86",+ "peach-jav.user.js": "954420bed6c5ee3be36435f2043572bf1133f71588dacbb4f0a24cf3d1e5a3ab","jav-sites.json": "74983ac48fb8dda583bd066f7dce7fbc01834137a8be07f5cbe779dcfb7b83db"}}diff --git a/web/integrations/peach-jav.user.js b/web/integrations/peach-jav.user.jsindex 2e3293e57..80f645259 100644--- a/web/integrations/peach-jav.user.js+++ b/web/integrations/peach-jav.user.js@@ -12,7 +12,7 @@// @updateURL https://update.sleazyfork.org/scripts/600821/Peach%20%C2%B7%20JAV%20%E5%85%A5%E5%BA%93.meta.js// @downloadURL https://update.sleazyfork.org/scripts/600821/Peach%20%C2%B7%20JAV%20%E5%85%A5%E5%BA%93.user.js// @license AGPL-3.0-or-later-// @version 0.6.11+// @version 0.7.1// @description Detect video codes on web pages, select titles, and send them to Peach for download and library import.// @description:zh-CN 识别网页中的番号,选择影片并交给 Peach 下载入库。// @description:zh-TW 識別網頁中的番號,選擇影片並交給 Peach 下載入庫。@@ -291,7 +291,7 @@const STORAGE_POSITION = 'peach.jav.position';const STORAGE_APPEARANCE = 'peach.jav.appearance';const ROOT_ID = 'peach-jav-action';- const SCRIPT_VERSION = "0.6.11";+ const SCRIPT_VERSION = "0.7.1";// 0.6.3 起默认名改为英文;发布页切换前仍返回原名。const PUBLISHED_NAMES = ['Peach Userscript', 'Peach · JAV 入库'];const PEACH_LOGO = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAYi0lEQVR42uWbabBl13XXf3s459zhDf16Urdb8+C2WlY8T4lDS4VNKEhsEniqghDj2JTiYIrgwganIHlpk2IySZEiCaaAxE4IH/oBValymShOIjV4iKxSLMnqbs2tHtTq+Y13OOfsvRYf9rn33ddqybIs4STcqtPnvnNv77vXf/3XuPc2/Nl4mYm7Nu+VP+cvy348C9grfrqA3b8fPwHOd4Xsny7BF4ADyOjBddfRstPd2cpIVhhbzWW9pQcfpH41qfXq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QYNAP0glCHSspYpZyksMbfGbXWGWqrDSPmPbnxk9Z5Xau+v6ZGZSZN46Mbuztlu++fE+I8Vzvv1KM22X+MAxCgBQwUMJV19UYYhRYTCmlhY7PbMGlTWWlS/PLiw9G/e/jx9TUduxLxK5wZf9WNzk2x45A2zb8PmC+Lcj1gs64IaECxWwNQYhgoDhX4QrWIUD24uM1hUu0b+a67lP3/P0XTmSF+iqvtTdW5QmyN0o8n+n1u2vi9494/F+vdbY+mJIqKhNrihooMoUon6TuqJa9fq/2y76rM/fHTt/pGfueMQ0bwGp0Vf04OTozJ0ZKtf3LvtzmDcx0vlA87abC1CKYJFGYbQL1QWM6u/9pFjqw8AHAR3GPTAq2Dr39OTowfBzbNht79149wbA+bDQ9W/WWusrOpv51J94adOlk9fCbg/N6+D4CabE7+ylZnPXkV38vOFV36O6c/OawHswv6NbtQC+P8vBL+Ss9Tv8QHu/wvjLwl2m7L1ZAAAAABJRU5ErkJggg==";@@ -299,6 +299,11 @@const STORAGE_INSTALLED = 'peach.jav.installed-version';const STORAGE_UPDATES = 'peach.jav.updates';const STORAGE_CHECKED = 'peach.jav.update-attempted-at';+ // 各窗口共享的任务进度:持锁窗口向 Peach 查询进行中任务,结果写入快照,其余窗口只读快照。+ const STORAGE_TASKS = 'peach.jav.tasks';+ const STORAGE_POLLER = 'peach.jav.poller';+ const STORAGE_CHIMED = 'peach.jav.chimed';+ const WINDOW_ID = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;// 更新入口直接打开 Sleazy 的安装文件,与 @downloadURL 相同,脚本管理器随即弹出更新确认。const RELEASE_INSTALL = 'https://update.sleazyfork.org/scripts/600821/Peach%20%C2%B7%20JAV%20%E5%85%A5%E5%BA%93.user.js';const RELEASE_META = 'https://update.sleazyfork.org/scripts/600821/Peach%20%C2%B7%20JAV%20%E5%85%A5%E5%BA%93.meta.js';@@ -539,6 +544,22 @@.geist-button.launcher{width:48px;height:48px;padding:6px;border-radius:50%;background:var(--ground);transform-origin:bottom right}.launcher img{display:block;width:34px;height:34px;object-fit:contain;user-select:none;-webkit-user-drag:none;pointer-events:none}.geist-button.launcher{touch-action:none;cursor:grab}.geist-button.launcher:active{cursor:grabbing}+ .geist-button.launcher[data-count]{position:relative;overflow:visible}+ .geist-button.launcher[data-count]::after{content:attr(data-count);position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;padding:0 5px;box-sizing:border-box;border-radius:9px;+ display:grid;place-items:center;background:var(--color-status-blue-background);color:var(--color-status-blue-text);font:var(--board-caption-semibold);box-shadow:0 0 0 2px var(--ground);pointer-events:none}+ .shared-tasks{display:grid;gap:8px;min-width:0}.shared-heading{display:flex;align-items:center;gap:4px;width:fit-content;margin:0;padding:0;border:0;background:transparent;+ font:var(--board-caption-semibold);color:var(--muted);cursor:pointer}.shared-heading:hover{color:var(--ink)}+ .shared-heading:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px;border-radius:4px}+ .shared-fold{width:14px;height:14px;flex:none;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s ease}+ .shared-heading[aria-expanded=false] .shared-fold{transform:rotate(-90deg)}+ .shared-list{list-style:none;margin:0;padding:0;display:grid;gap:4px;max-height:172px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}+ .shared-list li{min-width:0}.shared-row{display:flex;align-items:center;gap:8px;width:calc(100% + 16px);min-width:0;min-height:32px;margin:0 -8px;padding:4px 8px;border:0;border-radius:6px;+ background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background-color .15s ease}.shared-row:hover{background:var(--surface)}+ .shared-row:focus-visible{outline:2px solid var(--tungsten);outline-offset:-2px}+ .shared-code{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:var(--board-body-medium)}+ .shared-chevron{width:16px;height:16px;flex:none;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;color:var(--muted)}+ .task-page .bar strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}+ .panel.draggable{cursor:grab}:host([data-dragging]) .panel{cursor:grabbing;user-select:none}.body{padding:0 20px 20px;display:grid;gap:16px;min-width:0}.footer{display:flex;align-items:center;justify-content:flex-end;gap:8px;min-height:var(--fieldset-bar-h);padding:8px 16px;border-top:1px solid var(--line);background:var(--surface)}.geist-button{height:var(--control-h);padding:8px 12px;border:1px solid var(--color-border-button-default);border-radius:var(--control-radius);background:var(--color-background-primary-default);color:var(--ink);display:inline-flex;align-items:center;justify-content:center;gap:4px;font:var(--board-body-medium);white-space:nowrap;cursor:pointer;box-shadow:var(--elevation-xs);touch-action:manipulation;transition:background-color .15s ease,border-color .15s ease,color .15s ease}@@ -786,23 +807,36 @@root.style.setProperty('--panel-right', `${right}px`); root.style.setProperty('--panel-bottom', `${bottom}px`);}- function wireLauncher(root, launcher) {+ // 收成图标时拖图标;展开或折叠时按住面板空白处拖,按钮、链接与表单控件照常点击。+ const DRAG_EXEMPT = 'button,a,input,select,textarea,label,summary,[role=button],[contenteditable],.ov-y';++ function wireDrag(root, launcher, panel) {let drag = null, suppressClickUntil = 0;+ const begin = (handle, event) => {+ const box = root.getBoundingClientRect();+ drag = {handle, id:event.pointerId, x:event.clientX, y:event.clientY, width:box.width, height:box.height,+ right:document.documentElement.clientWidth-box.right, bottom:innerHeight-box.bottom, moved:false};+ handle.setPointerCapture(event.pointerId);+ };launcher.addEventListener('pointerdown', event => {if (event.button !== 0 || root.dataset.panelMode !== 'minimized') return;event.preventDefault(); launcher.focus({preventScroll:true});- const box = root.getBoundingClientRect();- drag = {id:event.pointerId, x:event.clientX, y:event.clientY, right:document.documentElement.clientWidth-box.right, bottom:innerHeight-box.bottom, moved:false};- launcher.setPointerCapture(event.pointerId);+ begin(launcher, event);+ });+ panel.classList.add('draggable');+ panel.addEventListener('pointerdown', event => {+ if (event.button !== 0 || root.dataset.panelMode === 'minimized' || event.target.closest?.(DRAG_EXEMPT)) return;+ begin(panel, event);});- launcher.addEventListener('pointermove', event => {+ const move = event => {if (!drag || event.pointerId !== drag.id) return;const x = event.clientX-drag.x, y = event.clientY-drag.y;if (!drag.moved && Math.hypot(x, y) < 4) return;+ if (!drag.moved) { root.setAttribute('data-dragging', ''); document.getSelection()?.removeAllRanges(); }drag.moved = true;- root.style.right = `${Math.max(16, Math.min(document.documentElement.clientWidth-64, drag.right-x))}px`;- root.style.bottom = `${Math.max(16, Math.min(innerHeight-64, drag.bottom-y))}px`;- });+ root.style.right = `${Math.max(16, Math.min(document.documentElement.clientWidth-drag.width-16, drag.right-x))}px`;+ root.style.bottom = `${Math.max(16, Math.min(innerHeight-drag.height-16, drag.bottom-y))}px`;+ };const finish = event => {if (!drag || event.pointerId !== drag.id) return;if (drag.moved && event.type === 'pointerup') {@@ -812,14 +846,18 @@bottom:Math.max(0, Math.min(1, (innerHeight-box.bottom-16)/Math.max(1, innerHeight-80)))}));suppressClickUntil = performance.now()+250;}- if (launcher.hasPointerCapture(event.pointerId)) launcher.releasePointerCapture(event.pointerId);+ if (drag.handle.hasPointerCapture(event.pointerId)) drag.handle.releasePointerCapture(event.pointerId);+ root.removeAttribute('data-dragging');drag = null; placeSurface(root);};- launcher.addEventListener('pointerup', finish);- launcher.addEventListener('pointercancel', finish);- launcher.addEventListener('click', event => {- if (performance.now() < suppressClickUntil) { event.preventDefault(); event.stopImmediatePropagation(); }- }, true);+ for (const handle of [launcher, panel]) {+ handle.addEventListener('pointermove', move);+ handle.addEventListener('pointerup', finish);+ handle.addEventListener('pointercancel', finish);+ handle.addEventListener('click', event => {+ if (performance.now() < suppressClickUntil) { event.preventDefault(); event.stopImmediatePropagation(); }+ }, true);+ }}function tableCheckbox(label) {@@ -1288,8 +1326,8 @@launcher.classList.add('launcher');const logo = element('img'); logo.src = PEACH_LOGO; logo.alt = ''; logo.draggable=false;launcher.replaceChildren(logo);- wireLauncher(entry.root, launcher);const panel = element('section', 'panel');+ wireDrag(entry.root, launcher, panel);const bar = element('header', 'bar');const later = control('收起', { icon: 'close' });later.addEventListener('click', () => {@@ -1300,7 +1338,7 @@bar.append(element('strong', '', 'Peach'), later);const scan = control('识别本页全部番号', { primary: true }); scan.addEventListener('click', openPageActions);const settings = control('Peach 设置'); settings.addEventListener('click', configure);- const body = element('div', 'body'); body.append(updateSection({ availableOnly: true }), scan, settings);+ const body = element('div', 'body'); body.append(updateSection({ availableOnly: true }), sharedSection(), scan, settings);launcher.addEventListener('click', () => { entryOpen = true; refreshUpdateEntry(); later.focus(); });panel.append(bar, body); entry.shadow.append(panel, launcher);updateEntry = { ...entry, launcher, panel };@@ -1526,22 +1564,28 @@}}- function applyRowStatus(item, body) {+ // 行状态、悬停说明与短标签;本页番号列表与浮卡里的其他任务共用。+ function rowState(body) {const download = body.download;- // 只在本次跟踪中由进行中走到整理完成时响;提交即返回已入库(早已加过)不响。- if (finished(body) && ['queued', 'searching', 'submitted', 'importing', 'organizing'].includes(item.row.dataset.state)) playSound('success');+ if (body.state === 'idle') return ['pending'];+ if (body.state === 'failed') return ['failed', failureText(body), {magnet:'磁力失效', cloud:'网盘问题'}[body.cause] || '失败'];+ if (body.state === 'no_match') return ['no_match', failureText(body)];+ if (body.state === 'submitted' && ['remote_done', 'landed'].includes(download?.state)) return ['importing', download.label || '入库中'];+ if (body.state === 'submitted' && download?.state === 'remote_running' && typeof download.progress === 'number' && Number.isFinite(download.progress)) {+ const percent = Math.round(Math.min(1, Math.max(0, download.progress)) * 100);+ return ['submitted', `网盘下载中 ${percent}%`, `下载中 ${percent}%`];+ }+ if (tracking(body) && body.state === 'ingested') return ['organizing', download?.postprocess_label || '整理中'];+ return [body.state, LABELS[body.state]];+ }++ function applyRowStatus(item, body) {+ // 只在本次跟踪中由进行中走到整理完成时响;提交即返回已入库(早已加过)不响。共享进度由写快照的窗口统一响。+ if (!sharedMode() && finished(body) && ['queued', 'searching', 'submitted', 'importing', 'organizing'].includes(item.row.dataset.state)) playSound('success');item.cause = body.state === 'failed' ? body.cause || '' : '';item.tracking = tracking(body);item.done = !['idle', 'failed', 'no_match'].includes(body.state);- if (body.state === 'idle') setRowState(item, 'pending');- else if (body.state === 'failed') setRowState(item, 'failed', failureText(body), {magnet:'磁力失效', cloud:'网盘问题'}[item.cause] || '失败');- else if (body.state === 'no_match') setRowState(item, 'no_match', failureText(body));- else if (body.state === 'submitted' && ['remote_done', 'landed'].includes(download?.state)) setRowState(item, 'importing', download.label || '入库中');- else if (body.state === 'submitted' && download?.state === 'remote_running' && typeof download.progress === 'number' && Number.isFinite(download.progress)) {- const percent = Math.round(Math.min(1, Math.max(0, download.progress)) * 100);- setRowState(item, 'submitted', `网盘下载中 ${percent}%`, `下载中 ${percent}%`);- } else if (item.tracking && body.state === 'ingested') setRowState(item, 'organizing', download?.postprocess_label || '整理中');- else setRowState(item, body.state, LABELS[body.state]);+ setRowState(item, ...rowState(body));}// 提交后自动查询仍在进行的行;再次提交会让上一轮跟踪退出。@@ -1553,6 +1597,8 @@for (let count = 0; Date.now() - started < POLL_LIMIT; count++) {if (!view.rows.some(item => item.tracking)) return;await pollWait(count);+ // 共享进度可用时由快照更新各行,不再逐个查询,也没有一小时上限。+ if (sharedMode()) return;for (const item of view.rows.filter(row => row.tracking)) {if (!view.root.isConnected || view.trackGeneration !== generation) return;try { applyRowStatus(item, await request(config, item.code, source, 'GET')); }@@ -1703,7 +1749,7 @@const magnets = view.rows.filter(item => item.cause === 'magnet').length;if (magnets && root.isConnected) note.textContent += `${magnets} 项磁力失效,再次加入会换一个磁力。`;view.busy=false; view.paint();- void trackRows(view);+ void sharedTick(true); void trackRows(view);};addSelected.addEventListener('click', () => { void submit(false); });addAll.addEventListener('click', () => { void submit(true); });@@ -2042,6 +2088,7 @@function present(view, mode, focus = false) {if (!alive(view)) return;+ closeTaskPage(view.panel);panelMode = mode;view.presentation?.cancel();const minimized = mode === 'minimized';@@ -2069,12 +2116,13 @@function render(view) {if (!alive(view)) return;view.summary.textContent = panelMode === 'collapsed' ? view.note.textContent : '';- const terminalSuccess = ['ingested', 'owned'].includes(view.state) && !view.tracking;+ const terminalSuccess = ['ingested', 'owned'].includes(view.state) && !view.tracking && !view.organizeFailed;view.button.disabled = view.busy || view.identity.conflict || terminalSuccess;view.button.setAttribute('aria-busy', String(view.busy));view.button.setAttribute('aria-disabled', String(view.busy || view.button.disabled));view.button.textContent = view.identity.conflict ? '番号存在冲突': !configuration() ? '配置 Peach'+ : view.organizeFailed && !view.busy ? '重试整理': terminalSuccess ? '已有该影片': view.busy ? '正在查询 Peach': view.queryOnly || ACTIVE.has(view.state) ? '查询 Peach 状态'@@ -2099,11 +2147,327 @@&& ['pending', 'queued', 'running'].includes(body.download?.postprocess_state));}+ function organizeFailed(body) {+ return body.state === 'ingested' && body.download?.postprocess_state === 'failed';+ }++ // 重试入库后失败的整理,与 Peach 任务中心的「重试整理」同一入口;旧版 Peach 没有这个接口。+ function requestRetryOrganize(config, code) {+ return new Promise((resolve, reject) => {+ try {+ GM_xmlhttpRequest({ method: 'POST', url: `${config.base}/api/jav-browser/postprocess`, anonymous: true, timeout: 60_000,+ headers: { Authorization: `Bearer ${config.token}`, Accept: 'application/json', 'Content-Type': 'application/json' },+ data: JSON.stringify({ code }),+ onload(response) {+ let detail = '';+ try { const value = JSON.parse(response.responseText).detail; if (typeof value === 'string' && value.length <= 200) detail = value; } catch { /* 非 JSON 错误按状态提示。 */ }+ if ([404, 405].includes(response.status)) { reject(new Error('Peach 尚不支持在脚本里重试整理,请在 Peach 任务中心重试或更新 Peach。')); return; }+ if (response.status === 401 || response.status === 403) { reject(new Error('令牌无效或无权限,请重新配置。')); return; }+ if (response.status !== 200) { reject(new Error(detail || '重试整理未成功,请在 Peach 任务中心查看。')); return; }+ try {+ const body = JSON.parse(response.responseText);+ if (body.ok !== true || !STATES.has(body.state) || typeof body.code !== 'string' || !samePeachCode(body.code, code)) throw new Error();+ resolve(body);+ } catch { reject(new Error('Peach 返回的状态无效,请查询状态。')); }+ },+ onerror: () => reject(new Error('无法连接 Peach,请稍后重试。')), ontimeout: () => reject(new Error('Peach 请求超时,请查询状态。')),+ onabort: () => reject(new Error('Peach 请求已中止。')),+ });+ } catch { reject(new Error('无法连接 Peach,请稍后重试。')); }+ });+ }++ async function retryOrganize(view) {+ const config = configuration();+ if (!config) { configure(); return; }+ view.busy = true; render(view);+ try {+ const body = await requestRetryOrganize(config, view.identity.code);+ if (!alive(view)) return;+ applyState(view, body);+ void sharedTick(true);+ } catch (error) {+ if (alive(view)) { view.note.textContent = error.message; view.note.hidden = false; view.note.dataset.variant = 'error'; }+ } finally {+ if (alive(view)) {+ view.busy = false; render(view);+ // 没有共享进度时由本页接着查询整理进度。+ if (!sharedMode() && view.tracking) void query(view);+ }+ }+ }+// 整个流程走完:已入库且整理不再进行,整理失败不算完成。function finished(body) {return body.state === 'ingested' && !tracking(body) && body.download?.postprocess_state !== 'failed';}+ // 跨窗口共享进度:持锁窗口查 Peach 的进行中任务列表,有任务时每 4 秒、没有时每 30 秒一次,结果写入快照;+ // 其余窗口只读快照。锁 45 秒过期;后台页的定时器会被浏览器放慢,可见窗口发现锁在后台页手里就接管。+ // Peach 没有列表接口时快照记为不可用,各窗口退回自己逐个查询。+ const SHARED_BUSY_MS = 4000, SHARED_IDLE_MS = 30_000, LEASE_MS = 45_000;+ const sharedLists = new Set();+ let sharedSnapshot = readShared(), sharedTimer, sharedFetching = false, sharedFetchedAt = 0;++ function readShared() {+ try {+ const value = JSON.parse(GM_getValue(STORAGE_TASKS, '{}'));+ return value.version === 1 && typeof value.base === 'string' && Array.isArray(value.items) ? value : null;+ } catch { return null; }+ }++ function sharedMode() {+ return sharedSnapshot?.available === true && sharedSnapshot.base === configuration()?.base;+ }++ function requestActive(config) {+ return new Promise((resolve, reject) => {+ try {+ GM_xmlhttpRequest({ method: 'GET', url: `${config.base}/api/jav-browser/active`, anonymous: true, timeout: 30_000,+ headers: { Authorization: `Bearer ${config.token}`, Accept: 'application/json' },+ onload(response) {+ if ([404, 405].includes(response.status)) { resolve(null); return; }+ try {+ if (response.status !== 200 || response.responseText.length > 2 * 1024 * 1024) throw new Error();+ const data = JSON.parse(response.responseText);+ if (data.ok !== true || !Array.isArray(data.items)) throw new Error();+ resolve(data.items.filter(body => body?.ok === true && STATES.has(body.state) && typeof body.code === 'string'+ && candidates(body.code).size === 1).slice(0, 200));+ } catch { reject(new Error('Peach 返回的任务列表无效')); }+ },+ onerror: () => reject(new Error('无法连接 Peach')), ontimeout: () => reject(new Error('Peach 请求超时')),+ onabort: () => reject(new Error('Peach 请求已中止')),+ });+ } catch { reject(new Error('无法连接 Peach')); }+ });+ }++ // 写快照的窗口在任务由进行中走到整理完成时响一次;响过的任务记入共享存储,别的窗口不再响。+ function chimeTransitions(previous, items) {+ const before = new Map(previous.map(body => [comparisonKey(body.code), body]));+ let chimed = {};+ try { chimed = JSON.parse(GM_getValue(STORAGE_CHIMED, '{}')) || {}; } catch { /* 记录损坏时从空开始。 */ }+ const now = Date.now();+ let play = false;+ for (const body of items) {+ const key = `${comparisonKey(body.code)}:${body.task_id ?? ''}`, old = before.get(comparisonKey(body.code));+ if (finished(body) && old && tracking(old) && !chimed[key]) { chimed[key] = now; play = true; }+ }+ if (!play) return;+ GM_setValue(STORAGE_CHIMED, JSON.stringify(Object.fromEntries(Object.entries(chimed).filter(([, at]) => now - at < 86_400_000))));+ playSound('success');+ }++ // force:本窗口刚提交任务,立刻刷新一次快照并接过轮询。+ async function sharedTick(force = false) {+ clearTimeout(sharedTimer);+ sharedTimer = setTimeout(() => void sharedTick(), SHARED_BUSY_MS);+ const config = configuration();+ if (!config || sharedFetching || updateDisposed || !pageInterfaceAllowed()) return;+ let lease = null;+ try { lease = JSON.parse(GM_getValue(STORAGE_POLLER, 'null')); } catch { /* 损坏的锁视为空闲。 */ }+ const now = Date.now(), visible = document.visibilityState === 'visible', mine = lease?.owner === WINDOW_ID;+ if (!force && !mine && lease && lease.until > now && (lease.visible || !visible)) return;+ GM_setValue(STORAGE_POLLER, JSON.stringify({ owner: WINDOW_ID, until: now + LEASE_MS, visible }));+ const interval = sharedSnapshot?.items.some(tracking) ? SHARED_BUSY_MS : SHARED_IDLE_MS;+ if (!force && mine && now - sharedFetchedAt < interval - 500) return;+ sharedFetching = true; sharedFetchedAt = now;+ try {+ const items = await requestActive(config);+ if (configuration()?.base !== config.base) return;+ const previous = readShared();+ if (items) chimeTransitions(previous?.base === config.base ? previous.items : [], items);+ const snapshot = { version: 1, base: config.base, at: Date.now(), available: items !== null, items: items || [] };+ GM_setValue(STORAGE_TASKS, JSON.stringify(snapshot));+ applyShared(snapshot);+ } catch { /* 连接异常保留上一份快照,下一轮再查。 */ }+ finally { sharedFetching = false; }+ }++ // 快照里有本页番号或本页番号列表里的番号时,按快照更新;提交或查询中的不打断。+ function applyShared(snapshot) {+ sharedSnapshot = snapshot;+ if (sharedMode()) {+ const items = new Map(snapshot.items.map(body => [comparisonKey(body.code), body]));+ const view = current;+ if (view && alive(view) && !view.busy && !view.identity.resolve && !view.identity.conflict) {+ const body = items.get(comparisonKey(view.identity.code)), signature = body && JSON.stringify(body);+ if (body && signature !== view.sharedSignature) { view.sharedSignature = signature; applyState(view, body); }+ }+ if (batchView?.root.isConnected) {+ let changed = false;+ for (const item of batchView.rows) {+ const body = items.get(comparisonKey(item.code));+ if (!body || !item.row.dataset.state || item.row.dataset.state === 'sending') continue;+ const signature = JSON.stringify(body);+ if (signature !== item.sharedSignature) { item.sharedSignature = signature; applyRowStatus(item, body); changed = true; }+ }+ if (changed && !batchView.busy) batchView.paint();+ }+ }+ paintShared();+ }++ function sharedSection() {+ const node = element('section', 'shared-tasks');+ node.setAttribute('aria-label', '其他 Peach 任务');+ sharedLists.add(node);+ paintSharedList(node);+ return node;+ }++ function paintShared() {+ for (const node of sharedLists) {+ if (!node.isConnected) { sharedLists.delete(node); continue; }+ paintSharedList(node); paintTaskPage(node.closest('.panel'));+ }+ const running = sharedMode() ? sharedSnapshot.items.filter(tracking).length : 0;+ for (const launcher of [current?.launcher, updateEntry?.launcher]) {+ if (!launcher) continue;+ if (running) launcher.dataset.count = running > 99 ? '99+' : String(running); else delete launcher.dataset.count;+ launcher.title = running ? `Peach 有 ${running} 项任务进行中` : '';+ }+ for (const root of surfaces) if (root.isConnected) placeSurface(root);+ }++ function chevronIcon(className, d) {+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');+ svg.setAttribute('viewBox', '0 0 24 24'); svg.setAttribute('aria-hidden', 'true'); svg.setAttribute('class', className);+ const path = document.createElementNS(svg.namespaceURI, 'path'); path.setAttribute('d', d); svg.append(path);+ return svg;+ }++ // 其他任务的人物头像按番号与状态缓存:入库后账本可能认出人物,状态变化时重新取一次。+ const sharedPeople = new Map();+ let sharedPeopleLoading = false;+ const peopleKey = body => `${comparisonKey(body.code)}:${body.state}`;++ function loadSharedPeople(items) {+ const config = configuration();+ if (!config || sharedPeopleLoading) return;+ const missing = items.filter(body => !sharedPeople.has(peopleKey(body))).slice(0, 50);+ if (!missing.length) return;+ sharedPeopleLoading = true;+ requestPeople(config, [...new Set(missing.map(body => body.code))]).then(result => {+ const keyed = new Map(Object.entries(result.items).map(([code, people]) => [comparisonKey(code), people]));+ for (const body of missing) sharedPeople.set(peopleKey(body), result.items[body.code] ?? keyed.get(comparisonKey(body.code)) ?? []);+ }).catch(() => {+ for (const body of missing) sharedPeople.set(peopleKey(body), []);+ }).finally(() => { sharedPeopleLoading = false; paintShared(); });+ }++ function sharedAvatars(body) {+ const node = element('span', 'batch-people');+ try { renderPeople(node, sharedPeople.get(peopleKey(body)) || []); } catch { node.replaceChildren(defaultPersonAvatar()); }+ return node;+ }++ // 其他任务超过 3 项,或本页番号正在抓取时,列表自动折叠;手动展开或折叠一直有效,直到自动条件变化。+ const SHARED_FOLD_LIMIT = 3;++ // 本页番号已有整体进度,这里只列其他番号:进行中的在前,最近 10 分钟结束的在后。+ // 每项一行,点开进入该番号的进度页。+ function paintSharedList(node) {+ const own = current && alive(current) && !current.identity.conflict ? comparisonKey(current.identity.code) : '';+ const items = sharedMode() ? sharedSnapshot.items.filter(body => comparisonKey(body.code) !== own) : [];+ node.hidden = !items.length;+ const focused = node.getRootNode().activeElement?.closest?.('.shared-row,.shared-heading');+ const focusKey = focused?.dataset.code || (focused ? 'heading' : '');+ if (!items.length) { node.replaceChildren(); return; }+ loadSharedPeople(items);+ const auto = items.length > SHARED_FOLD_LIMIT || Boolean(own && current && (current.tracking || current.busy));+ if (node.foldChoice && node.foldChoice.auto !== auto) node.foldChoice = null;+ const open = node.foldChoice ? node.foldChoice.open : !auto;+ const running = items.filter(tracking), ended = items.filter(body => !tracking(body));+ const heading = element('button', 'shared-heading');+ heading.type = 'button';+ heading.setAttribute('aria-expanded', String(open));+ heading.append(element('span', '', running.length ? `其他任务 · 进行中 ${running.length} 项` : '其他任务 · 最近结束'),+ chevronIcon('shared-fold', 'm6 9 6 6 6-6'));+ heading.addEventListener('click', () => { node.foldChoice = { auto, open: !open }; paintSharedList(node); placeSurface(node.getRootNode().host); });+ const list = element('ul', 'shared-list');+ list.hidden = !open;+ for (const body of [...running, ...ended].slice(0, 20)) {+ const row = element('button', 'shared-row'), status = element('span', 'chip');+ row.type = 'button'; row.dataset.code = body.code;+ row.append(sharedAvatars(body), element('span', 'shared-code', body.code), status, chevronIcon('shared-chevron', 'm9 6 6 6-6 6'));+ setRowState({ row, status }, ...rowState(body));+ row.setAttribute('aria-label', `${body.code},${status.textContent},查看进度`);+ row.addEventListener('click', () => openTaskPage(node.closest('.panel'), body.code));+ const item = element('li'); item.append(row); list.append(item);+ }+ node.replaceChildren(heading, list);+ if (focusKey === 'heading') heading.focus();+ else if (focusKey) [...list.querySelectorAll('.shared-row')].find(row => row.dataset.code === focusKey)?.focus();+ }++ // 其他任务的进度页:在同一张浮卡里替换主页,显示该番号的五段整体进度与状态说明;返回回到主页。+ function openTaskPage(panel, code) {+ if (!panel) return;+ closeTaskPage(panel);+ const page = element('section', 'task-page');+ page.setAttribute('aria-label', `${code} 的任务进度`);+ const bar = element('header', 'bar subpage-bar');+ const back = control('返回 Peach 主页', { icon: 'back' });+ const title = element('div', 'bar-title'), people = element('span', 'batch-people');+ people.append(defaultPersonAvatar());+ title.append(people, element('strong', '', code));+ bar.append(back, title);+ const body = element('div', 'body');+ const note = element('p', 'geist-note');+ note.setAttribute('role', 'status'); note.setAttribute('aria-live', 'polite'); note.setAttribute('aria-label', `${code} 的任务状态`);+ const parts = buildFlow();+ const retry = control('重试整理');+ retry.hidden = true;+ retry.addEventListener('click', async () => {+ const config = configuration();+ if (!config || retry.disabled) return;+ retry.disabled = true;+ try {+ const result = await requestRetryOrganize(config, code);+ if (panel.taskPage?.page === page) { panel.taskPage.body = result; paintTaskPage(panel); }+ void sharedTick(true);+ } catch (error) {+ if (panel.taskPage?.page === page) { note.textContent = error.message; note.dataset.variant = 'error'; }+ } finally { retry.disabled = false; }+ });+ body.append(note, parts.flow, retry);+ page.append(bar, body);+ for (const child of panel.children) if (!child.hidden) { child.hidden = true; child.dataset.taskHidden = ''; }+ panel.append(page);+ panel.taskPage = { page, code, note, people, retry, body: null, ...parts };+ back.addEventListener('click', () => closeTaskPage(panel, true));+ paintTaskPage(panel);+ back.focus();+ }++ function closeTaskPage(panel, focus = false) {+ const open = panel?.taskPage;+ if (!open) return;+ open.page.remove(); panel.taskPage = null;+ for (const child of panel.querySelectorAll(':scope > [data-task-hidden]')) { child.hidden = false; delete child.dataset.taskHidden; }+ if (focus) [...panel.querySelectorAll('.shared-row')].find(row => row.dataset.code === open.code)?.focus();+ for (const root of surfaces) if (root.isConnected) placeSurface(root);+ }++ // 番号结束超过 10 分钟后会离开快照,进度页保留最后一次看到的状态。+ function paintTaskPage(panel) {+ const open = panel?.taskPage;+ if (!open) return;+ const key = comparisonKey(open.code);+ open.body = (sharedMode() && sharedSnapshot.items.find(body => comparisonKey(body.code) === key)) || open.body;+ if (!open.body) return;+ renderFlow(open, open.body);+ if (sharedPeople.has(peopleKey(open.body))) {+ const people = sharedAvatars(open.body);+ open.people.replaceWith(people); open.people = people;+ }+ open.note.textContent = statusLabel(open.body);+ open.note.dataset.variant = statusVariant(open.body);+ open.retry.hidden = !organizeFailed(open.body);+ for (const root of surfaces) if (root.isConnected) placeSurface(root);+ }+function renderFlow(view, body) {const download = body?.download;let current = -1;@@ -2147,17 +2511,31 @@view.heading.textContent = body.code;view.loadPeople(body.code);}- // 整理期间 view.state 已是 ingested,前态按上一轮是否仍在跟踪判断。- if (finished(body) && view.tracking) playSound('success');+ // 整理期间 view.state 已是 ingested,前态按上一轮是否仍在跟踪判断。共享进度由写快照的窗口统一响。+ if (!sharedMode() && finished(body) && view.tracking) playSound('success');view.state = body.state;view.cause = body.state === 'failed' ? body.cause || '' : '';view.tracking = tracking(body);+ view.organizeFailed = organizeFailed(body);view.queryOnly = view.tracking;if (!view.queryOnly) attempts.delete(comparisonKey(view.identity.code));+ renderFlow(view, body);+ const label = statusLabel(body);+ view.statusText = label;+ view.note.textContent = label;+ // 可以加入时按钮自己说明;不能加入时按钮会变成不可用并给出原因,这行只在其他状态显示。+ view.note.hidden = body.state === 'idle' && body.stage !== 'submitting';+ view.note.dataset.variant = statusVariant(body);+ render(view);+ // 本页番号开始或结束抓取时,其他任务列表随之自动折叠或展开。+ paintShared();+ }++ // 状态说明:下载任务的具体阶段、整理状态与百分比,失败时给出原因;浮卡与其他任务的进度页共用。+ function statusLabel(body) {const download = body.download;const known = download && ['submitted', 'remote_running', 'remote_done', 'landed', 'ingested', 'failed', 'cancelled', 'stalled'].includes(download.state);let label = body.stage === 'submitting' ? '正在提交网盘' : LABELS[body.state];- renderFlow(view, body);if (known && typeof download.label === 'string') {label = download.label.slice(0, 80);if (download.state === 'ingested' && download.postprocess_state !== 'not_requested'@@ -2168,12 +2546,40 @@}}if (['failed', 'no_match'].includes(body.state) && body.stage !== 'submitting') label = failureText(body);- view.statusText = label;- view.note.textContent = label;- // 可以加入时按钮自己说明;不能加入时按钮会变成不可用并给出原因,这行只在其他状态显示。- view.note.hidden = body.state === 'idle' && body.stage !== 'submitting';- view.note.dataset.variant = body.state === 'failed' || download?.postprocess_state === 'failed' ? 'error' : 'secondary';- render(view);+ return label;+ }++ // 五段整体进度;结构与尺寸复用 Peach 生产 Progress 的 SVG 快照。+ function buildFlow() {+ const progress = document.createElementNS('http://www.w3.org/2000/svg', 'svg');+ for (const [name, value] of Object.entries({ role: 'progressbar', 'aria-label': '整体任务进度',+ 'aria-valuemin': '0', 'aria-valuemax': '5', viewBox: '0 0 100 1', preserveAspectRatio: 'none', class: 'task-progress' })) progress.setAttribute(name, value);+ const progressFill = document.createElementNS(progress.namespaceURI, 'rect');+ const progressTrack = document.createElementNS(progress.namespaceURI, 'rect');+ for (const [rect, width, style] of [[progressTrack, '100', 'track'], [progressFill, '0', 'fill']]) {+ rect.setAttribute('width', width); rect.setAttribute('height', '1'); rect.setAttribute('class', style);+ }+ progress.append(progressTrack, progressFill);+ for (const point of [20, 40, 60, 80]) {+ const stop = document.createElementNS(progress.namespaceURI, 'rect');+ stop.setAttribute('x', String(point - .4)); stop.setAttribute('width', '.4'); stop.setAttribute('height', '1'); stop.setAttribute('class', 'stop');+ progress.append(stop);+ }+ const flow = element('div', 'flow');+ flow.hidden = true;+ const stepList = element('ol', 'flow-steps');+ stepList.setAttribute('aria-label', '整体任务阶段');+ const steps = ['排队', '搜索', '下载', '入库', '整理'].map((label, index) => {+ const step = element('li', 'flow-step');+ const mark = element('span', 'flow-mark'); mark.setAttribute('aria-hidden', 'true'); mark.append(stepMark(index), stageAnimation(index));+ step.append(mark, element('span', 'flow-label', label)); stepList.append(step); return step;+ });+ flow.append(progress, stepList);+ return { flow, progress, progressFill, steps };+ }++ function statusVariant(body) {+ return body.state === 'failed' || body.download?.postprocess_state === 'failed' ? 'error' : 'secondary';}async function query(view, method = 'GET') {@@ -2198,14 +2604,18 @@method === 'POST' && view.cause === 'magnet' ? {switch:true} : {});if (!alive(view)) return;applyState(view, body);+ if (method === 'POST') void sharedTick(true);+ let shared = false;for (let count = 0; tracking(body) && Date.now() < deadline; count++) {await pollWait(count);if (!alive(view)) return;+ // 共享进度可用时由快照更新,不再逐个查询,也没有一小时上限。+ if ((shared = sharedMode())) break;body = await request(config, view.identity.code, view.identity.source, 'GET');if (!alive(view)) return;applyState(view, body);}- if (tracking(body)) view.note.textContent = `${view.statusText},可查询状态。`;+ if (tracking(body) && !shared) view.note.textContent = `${view.statusText},可查询状态。`;} catch (error) {if (alive(view)) {view.queryOnly = true;@@ -2219,7 +2629,11 @@view.note.dataset.variant = 'error';}} finally {- if (alive(view)) { view.busy = false; render(view); }+ if (alive(view)) {+ view.busy = false; render(view);+ // 查询期间到达的快照被跳过了,结束后立刻按当前快照补上,不等下一次变化。+ if (sharedMode()) applyShared(sharedSnapshot);+ }}}@@ -2279,33 +2693,9 @@note.setAttribute('role', 'status');note.setAttribute('aria-label', 'Peach 任务状态');note.setAttribute('aria-live', 'polite');- // 结构与尺寸复用 Peach 生产 Progress 的 SVG 快照。- const progress = document.createElementNS('http://www.w3.org/2000/svg', 'svg');- for (const [name, value] of Object.entries({ role: 'progressbar', 'aria-label': '整体任务进度',- 'aria-valuemin': '0', 'aria-valuemax': '5', viewBox: '0 0 100 1', preserveAspectRatio: 'none', class: 'task-progress' })) progress.setAttribute(name, value);- const progressFill = document.createElementNS(progress.namespaceURI, 'rect');- const progressTrack = document.createElementNS(progress.namespaceURI, 'rect');- for (const [rect, width, style] of [[progressTrack, '100', 'track'], [progressFill, '0', 'fill']]) {- rect.setAttribute('width', width); rect.setAttribute('height', '1'); rect.setAttribute('class', style);- }- progress.append(progressTrack, progressFill);- for (const point of [20, 40, 60, 80]) {- const stop = document.createElementNS(progress.namespaceURI, 'rect');- stop.setAttribute('x', String(point - .4)); stop.setAttribute('width', '.4'); stop.setAttribute('height', '1'); stop.setAttribute('class', 'stop');- progress.append(stop);- }- const flow = element('div', 'flow');- flow.hidden = true;- const stepList = element('ol', 'flow-steps');- stepList.setAttribute('aria-label', '整体任务阶段');- const steps = ['排队', '搜索', '下载', '入库', '整理'].map((label, index) => {- const step = element('li', 'flow-step');- const mark = element('span', 'flow-mark'); mark.setAttribute('aria-hidden', 'true'); mark.append(stepMark(index), stageAnimation(index));- step.append(mark, element('span', 'flow-label', label)); stepList.append(step); return step;- });- flow.append(progress, stepList);+ const { flow, progress, progressFill, steps } = buildFlow();const scan = control('识别本页全部番号'); scan.addEventListener('click', openPageActions);- body.append(note, flow, button, scan, updateSection({ availableOnly: true }));+ body.append(note, flow, button, scan, sharedSection(), updateSection({ availableOnly: true }));panel.append(bar, body);const launcher = control('展开 Peach 面板');launcher.classList.add('launcher');@@ -2318,12 +2708,13 @@logo.alt = '';logo.setAttribute('aria-hidden', 'true');launcher.replaceChildren(logo);- wireLauncher(root, launcher);+ wireDrag(root, launcher, panel);launcher.hidden = true;shadow.append(panel, launcher);const view = { root, panel, body, launcher, collapse, summary, button, note, flow, steps, progress, progressFill, heading: label, loadPeople: loadTitlePeople, settings: settingsButton, identity: item, url: location.href, generation, state: 'idle', busy: false, tracking: false, queryOnly: attempts.has(comparisonKey(item.code)) };current = view;refreshUpdateEntry();+ paintShared();if (subpageOpen()) {root.setAttribute('data-settings-open', '');root.inert = true;@@ -2338,6 +2729,7 @@button.addEventListener('click', () => {if (!alive(view) || view.busy || view.button.disabled) return;if (!configuration()) { configure(); return; }+ if (view.organizeFailed) { void retryOrganize(view); return; }void query(view, view.queryOnly || ACTIVE.has(view.state) ? 'GET' : 'POST');});render(view);@@ -2370,10 +2762,18 @@for (const root of surfaces) if (root.isConnected) applyAppearance(root);}));for(const key of [STORAGE_ENABLED,STORAGE_DISPLAY])updateListeners.push(GM_addValueChangeListener(key,(_key,before,after)=>{if(before!==after)applyDisplayPreference();}));+ updateListeners.push(GM_addValueChangeListener(STORAGE_TASKS, (_key, _before, _after, remote) => { if (remote) applyShared(readShared()); }));}+ void sharedTick();addEventListener('resize', () => { for (const root of surfaces) if (root.isConnected) placeSurface(root); });document.addEventListener('visibilitychange', updateVisibility);+ document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') void sharedTick(); });addEventListener('focus', refreshInstalledVersion);- addEventListener('pagehide', event => { if (!event.persisted) disposeUpdates(); });+ // 关闭时交出轮询锁,别的窗口下一轮就接手。+ addEventListener('pagehide', event => {+ if (event.persisted) return;+ disposeUpdates(); clearTimeout(sharedTimer);+ try { if (JSON.parse(GM_getValue(STORAGE_POLLER, 'null'))?.owner === WINDOW_ID) GM_setValue(STORAGE_POLLER, 'null'); } catch { /* 锁会自行过期。 */ }+ });scheduleUpdateCheck();})();