dsh-ffmpeg 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/lib/update-client.js +80 -63
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
[历史英文记录](docs/CHANGELOG.en.md)
|
|
6
6
|
|
|
7
|
+
## 0.6.3 (2026-10-27)
|
|
8
|
+
|
|
9
|
+
- 修复分批更新时的新旧更新控件混用:保留原页面、草稿与安装保护,空闲后接管旧控制器,兼容旧入口。
|
|
10
|
+
|
|
11
|
+
## 0.6.2 (2026-10-27)
|
|
12
|
+
|
|
13
|
+
- 更新控件移至原有工作台或原生插件详情页底部;更新记录与选项原地展开,移除独立更新菜单与页面。
|
|
14
|
+
- 保留原页面操作与草稿,自动安装默认关闭;安装前确认,遇到未保存修改或运行任务时暂停。
|
|
15
|
+
|
|
7
16
|
## 0.6.1 (2026-10-27)
|
|
8
17
|
|
|
9
18
|
- Keep this component's own update entry visible when installed transitively through Suite. Confirm whole-Suite update scope before opening its controls.
|
package/README.en.md
CHANGED
|
@@ -46,7 +46,7 @@ Detailed configuration, tool arguments and troubleshooting are in the [usage gui
|
|
|
46
46
|
|
|
47
47
|
## Plugin updates
|
|
48
48
|
|
|
49
|
-
Requires DSH 0.2.1-rc.3 or newer.
|
|
49
|
+
Requires DSH 0.2.1-rc.3 or newer. Update controls sit at the bottom of the existing workbench, or native plugin details for plugins without a workbench. Checks, release notes and preferences expand in place, with no separate update page or settings menu. Automatic checks are on by default; **automatic installation is off by default**. Only explicit opt-in permits compatible stable patches while idle with no unsaved changes. Preferences are independent, with per-plugin disable, deferral and ignore controls. No forced DSH restart or upgrade, and local-source installations stay unchanged. Suite components explain and operate on the whole Suite in the same footer.
|
|
50
50
|
|
|
51
51
|
Older releases need one manual update in native plugin management to acquire these controls. Publishing to npm does not replace an existing user installation.
|
|
52
52
|
|
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ dsh plugin --profile desktop add dsh-ffmpeg
|
|
|
46
46
|
|
|
47
47
|
## 插件更新
|
|
48
48
|
|
|
49
|
-
需要 DSH 0.2.1-rc.3
|
|
49
|
+
需要 DSH 0.2.1-rc.3 或更新版本。更新控件直接位于原有工作台内容末尾;没有工作台的插件,位于原生插件详情页底部。检查、更新记录和偏好在原地展开,不增加独立更新页面或设置菜单。自动检查默认开启;**自动安装默认关闭**,明确授权后才会在空闲且没有未保存修改时安装兼容的稳定补丁。开关按插件独立保存,可关闭、推迟或忽略提醒;不会强制重启 DSH、升级 DSH 本体或替换本地源码安装。Suite 组件在当前页面底部明确说明并操作 Suite 整包更新。
|
|
50
50
|
|
|
51
51
|
旧版用户先在官方插件管理中手动更新一次,之后才会获得此入口。发布到 npm 不会直接替换用户已经安装的版本。
|
|
52
52
|
|
package/lib/update-client.js
CHANGED
|
@@ -173,16 +173,33 @@ function __stardustUpdatesGuard(React, name, { dirty = false, busy = false, reta
|
|
|
173
173
|
for (const listener of pool.listeners) listener();
|
|
174
174
|
}, []);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function __StardustPluginUpdatesFooter({ React, name }) {
|
|
177
177
|
const [, render] = React.useState(0), pool = __stardustUpdatesGuards();
|
|
178
178
|
React.useEffect(() => { const fn = () => render(value => value + 1); pool.viewListeners.add(fn); return () => pool.viewListeners.delete(fn); }, []);
|
|
179
|
-
const client = [...pool.clients].find(client => client.has(name));
|
|
179
|
+
const client = [...pool.clients].find(client => typeof client.Footer === 'function' && client.has(name));
|
|
180
180
|
if (!client) return null;
|
|
181
|
-
|
|
182
|
-
return React.createElement(client.Button, { icon: 'refresh', variant: available ? undefined : 'ghost', onClick: () => client.open(name), 'data-plugin-update': name }, available ? client.t('有更新', 'Update available') : client.t('插件更新', 'Update plugin'));
|
|
181
|
+
return React.createElement(client.Footer, { name });
|
|
183
182
|
}
|
|
184
|
-
function
|
|
185
|
-
return
|
|
183
|
+
function __stardustUpdatesInlinePage(React, element, name) {
|
|
184
|
+
return React.cloneElement(element, null, element.props.children, React.createElement(__StardustPluginUpdatesFooter, { key: 'plugin-updates', React, name }));
|
|
185
|
+
}
|
|
186
|
+
function __stardustUpdatesDetailName(subject, rows) {
|
|
187
|
+
if (!subject || !['bundle', 'row'].includes(subject.kind)) return null;
|
|
188
|
+
if (subject.kind === 'row' && subject.pkg?.name === '@stardustlc/dsh-suite') {
|
|
189
|
+
const component = rows.find(row => row.bundledBy === subject.pkg.name && (subject.row?.moduleName === row.name || subject.row?.moduleName?.startsWith(row.name + '/')));
|
|
190
|
+
if (component) return component.name;
|
|
191
|
+
}
|
|
192
|
+
return rows.some(row => row.name === subject.pkg?.name) ? subject.pkg.name : null;
|
|
193
|
+
}
|
|
194
|
+
function __stardustUpdatesNativeFormState(document) {
|
|
195
|
+
let dirty = false, busy = false;
|
|
196
|
+
for (const scope of document.querySelectorAll('[data-plugin-detail],[data-plugin-row-detail]')) for (const button of scope.querySelectorAll('button')) {
|
|
197
|
+
if (!button.getClientRects().length || button.closest('.plugin-updates-footer')) continue;
|
|
198
|
+
const label = (button.getAttribute('aria-label') || button.textContent || '').trim();
|
|
199
|
+
if (/^(?:正在保存|保存中|Saving)(?:[.…\s]|$)/i.test(label) || button.getAttribute('aria-busy') === 'true') busy = true;
|
|
200
|
+
if (!button.disabled && button.getAttribute('aria-disabled') !== 'true' && /^(?:保存(?:更改|设置|配置)?|Save(?: changes| settings| configuration)?)(?:\s+(?:Ctrl|⌘|Enter|↵).*)?$/i.test(label)) dirty = true;
|
|
201
|
+
}
|
|
202
|
+
return { dirty, busy };
|
|
186
203
|
}
|
|
187
204
|
function __stardustUpdatesDisplayRows(next, known) {
|
|
188
205
|
for (const row of next.rows) known.set(row.name, row);
|
|
@@ -221,14 +238,22 @@ function __stardustUpdatesJoin(host, React, require, participant) {
|
|
|
221
238
|
if (typeof root.plugin !== 'function') return;
|
|
222
239
|
let record = pools.get(root);
|
|
223
240
|
if (!record) {
|
|
224
|
-
record = { refs: new Map(), timer: null, version: participant.version, alive: true, hold: false };
|
|
241
|
+
record = { refs: new Map(), timer: null, version: participant.version, alive: true, hold: false, uiRevision: 2 };
|
|
225
242
|
pools.set(root, record);
|
|
243
|
+
__stardustUpdatesActivate(record, pools, root, React, require);
|
|
244
|
+
} else if (record.uiRevision !== 2 && !record.migration) {
|
|
245
|
+
// The first loaded participant may still own a pre-footer client. Keep
|
|
246
|
+
// its references and draft guards, wait for any admitted install, then
|
|
247
|
+
// replace that one client fiber instead of running two window heartbeats.
|
|
226
248
|
const shared = record;
|
|
227
|
-
record.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
249
|
+
record.migration = Promise.resolve().then(async () => {
|
|
250
|
+
while (shared.alive && shared.hold) await new Promise(resolve => setTimeout(resolve, 500));
|
|
251
|
+
if (!shared.alive || !shared.refs.size) return;
|
|
252
|
+
await shared.fiber?.dispose?.();
|
|
253
|
+
if (!shared.refs.size) return;
|
|
254
|
+
shared.alive = true; shared.uiRevision = 2; pools.set(root, shared);
|
|
255
|
+
__stardustUpdatesActivate(shared, pools, root, React, require);
|
|
256
|
+
}).catch(() => { /* The original page remains usable if host disposal fails. */ });
|
|
232
257
|
}
|
|
233
258
|
clearTimeout(record.timer);
|
|
234
259
|
const ref = {}; record.refs.set(ref, participant);
|
|
@@ -242,10 +267,17 @@ function __stardustUpdatesJoin(host, React, require, participant) {
|
|
|
242
267
|
if (!record.refs.size) record.timer = setTimeout(stop, 1000);
|
|
243
268
|
});
|
|
244
269
|
}
|
|
270
|
+
function __stardustUpdatesActivate(shared, pools, root, React, require) {
|
|
271
|
+
shared.fiber = root.plugin({ name: 'stardustlc-plugin-updates-client', inject: ['slots', 'locale', 'remote', 'remote.pluginManager'], apply(ctx) {
|
|
272
|
+
const client = __stardustUpdatesClient(ctx, React, require, shared);
|
|
273
|
+
ctx.effect(() => () => { shared.alive = false; client.dispose(); if (pools.get(root) === shared) pools.delete(root); });
|
|
274
|
+
} });
|
|
275
|
+
Promise.resolve(shared.fiber).catch(() => { shared.alive = false; if (pools.get(root) === shared) pools.delete(root); });
|
|
276
|
+
}
|
|
245
277
|
function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
246
278
|
const h = React.createElement, W = createWorkbenchUI(React), route = new URL('api/stardustlc/plugin-updates', document.baseURI);
|
|
247
|
-
const { useState, useEffect } = React, id = crypto.randomUUID(), listeners = new Set(), pool = __stardustUpdatesGuards(), requests = new Set(),
|
|
248
|
-
let alive = true, registered = false, state = null, lastInteraction = Date.now(), inPoll = false,
|
|
279
|
+
const { useState, useEffect } = React, id = crypto.randomUUID(), listeners = new Set(), pool = __stardustUpdatesGuards(), requests = new Set(), notified = new Set(), knownRows = new Map();
|
|
280
|
+
let alive = true, registered = false, state = null, lastInteraction = Date.now(), inPoll = false, manualOperation = false, legacyHint = null;
|
|
249
281
|
const language = () => String(ctx.locale?.getSnapshot?.().active || '').startsWith('en') ? 'en' : 'zh';
|
|
250
282
|
const t = (zh, en) => language() === 'en' ? en : zh;
|
|
251
283
|
const preferences = name => state?.preferences.packages[name] || { checkEnabled: true, autoInstall: false, deferredUntil: 0, ignoredVersion: null };
|
|
@@ -265,12 +297,12 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
|
265
297
|
finally { clearTimeout(timeout); requests.delete(controller); }
|
|
266
298
|
}
|
|
267
299
|
function pageState(manual = manualOperation) {
|
|
268
|
-
const values = [...pool.values.values()];
|
|
269
|
-
const dialog = [...document.querySelectorAll('[role="dialog"],dialog[open]')].some(node => node.getClientRects().length && !(manual && (node.closest('.plugin-updates-
|
|
270
|
-
return { action: 'heartbeat', id, dirty: values.some(value => value.dirty), busy: values.some(value => value.busy) || dialog, idleForMs: Math.min(86400000, Math.max(0, Date.now() - lastInteraction)) };
|
|
300
|
+
const values = [...pool.values.values()], nativeForm = __stardustUpdatesNativeFormState(document);
|
|
301
|
+
const dialog = [...document.querySelectorAll('[role="dialog"],dialog[open]')].some(node => node.getClientRects().length && !(manual && (node.closest('.plugin-updates-footer') || node.querySelector('.plugin-updates-footer'))));
|
|
302
|
+
return { action: 'heartbeat', id, dirty: nativeForm.dirty || values.some(value => value.dirty), busy: nativeForm.busy || values.some(value => value.busy) || dialog, idleForMs: Math.min(86400000, Math.max(0, Date.now() - lastInteraction)) };
|
|
271
303
|
}
|
|
272
304
|
const heartbeat = () => api(pageState());
|
|
273
|
-
function interaction() { lastInteraction = Date.now(); }
|
|
305
|
+
function interaction() { lastInteraction = Date.now(); if (registered && alive) void heartbeat().catch(() => {}); }
|
|
274
306
|
const guardChanged = () => { if (registered && alive) void heartbeat().catch(() => {}); };
|
|
275
307
|
for (const event of ['pointerdown', 'keydown', 'input']) document.addEventListener(event, interaction, { capture: true, passive: true });
|
|
276
308
|
pool.listeners.add(guardChanged);
|
|
@@ -304,8 +336,14 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
|
304
336
|
function jobLabel(job) {
|
|
305
337
|
return ({ verifying: t('正在核对版本', 'Verifying release'), installing: t('正在安装', 'Installing'), cancelling: t('正在请求取消', 'Requesting cancellation'), complete: t('已更新', 'Updated'), 'restart-required': t('已安装,等待你手动重启', 'Installed; manual restart needed'), restored: t('更新未成功,已恢复原版本', 'Update failed; previous version restored'), 'restore-failed': t('恢复未成功,请检查官方插件管理', 'Recovery failed; check native plugin management'), unknown: t('结果未确认,请检查官方插件管理', 'Result unconfirmed; check native plugin management'), cancelled: t('已取消', 'Cancelled'), failed: t('更新未成功', 'Update failed') })[job.state] || job.state;
|
|
306
338
|
}
|
|
307
|
-
function
|
|
308
|
-
|
|
339
|
+
function FooterFrame({ name, label, subtitle, actions, children }) {
|
|
340
|
+
return h('section', { className: 'dshw plugin-updates-footer', 'data-plugin-update-footer': name, 'aria-label': label + t(' · 版本与更新', ' · Version and updates') },
|
|
341
|
+
h('style', null, W.styles),
|
|
342
|
+
h('style', null, '.plugin-updates-footer{box-sizing:border-box;flex-shrink:0;margin-top:28px;padding-top:18px;border-top:1px solid var(--dsw-alias-border-l3,#e5e7eb);min-width:0;max-width:100%;color:var(--dsw-alias-label-primary,#202124)}.plugin-updates-footer .updates-head{display:flex;justify-content:space-between;align-items:flex-start;flex-wrap:wrap;gap:12px}.plugin-updates-footer h2{font-size:14px;line-height:22px;margin:0;font-weight:600}.plugin-updates-footer .updates-subtitle,.plugin-updates-footer .updates-version{font:12px/1.6 ui-monospace,monospace;overflow-wrap:anywhere;margin:4px 0}.plugin-updates-footer .updates-options{margin-top:12px}.plugin-updates-footer .updates-options>summary{cursor:pointer;font-size:12px;line-height:22px;color:var(--dsw-alias-label-secondary,#657080)}.plugin-updates-footer .updates-options>summary:focus-visible{outline:2px solid var(--dsw-focus-ring-color,#6b79df);outline-offset:4px}.plugin-updates-footer .updates-settings{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:16px;padding:14px 0 0}.plugin-updates-footer .updates-note{margin:5px 0 0;font-size:12px;line-height:1.6}.plugin-updates-footer>.w-section{margin:10px 0 0;padding:0;border:0}.plugin-updates-footer .w-toolbar{margin-top:10px!important}.plugin-updates-footer .w-switch-label{max-width:100%;gap:12px;align-items:flex-start}.plugin-updates-footer .w-switch-track{flex-shrink:0}.plugin-updates-footer .updates-notes{margin-top:12px;padding:12px;border:1px solid var(--dsw-alias-border-l3,#e5e7eb);border-radius:10px}.plugin-updates-footer .updates-notes pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:240px;overflow:auto;font:12px/1.7 ui-monospace,monospace}.plugin-updates-footer .w-overlay{z-index:1002}@media(max-width:600px){.plugin-updates-footer .updates-head{gap:8px}.plugin-updates-footer .w-toolbar{gap:6px;flex-wrap:wrap}.plugin-updates-footer .w-button{max-width:100%}}'),
|
|
343
|
+
h('div', { className: 'updates-head' }, h('div', null, h('h2', null, t('版本与更新', 'Version and updates')), h('p', { className: 'updates-subtitle w-muted' }, subtitle)), actions), children);
|
|
344
|
+
}
|
|
345
|
+
function Panel({ name }) {
|
|
346
|
+
const snapshot = useSnapshot(), [error, setError] = useState(''), [working, setWorking] = useState(false), [checking, setChecking] = useState(false), [dialog, setDialog] = useState(null), [notes, setNotes] = useState(null), [notesOpen, setNotesOpen] = useState(false), [loadingNotes, setLoadingNotes] = useState(false);
|
|
309
347
|
const row = rowFor(name), original = originalRow(name), target = row?.name || name, prefs = preferences(target), job = snapshot?.job?.name === target ? snapshot.job : null;
|
|
310
348
|
async function perform(callback) { setError(''); setWorking(true); try { await callback(); await refresh(); } catch (error) { setError(error.message); await refresh().catch(() => {}); } finally { setWorking(false); } }
|
|
311
349
|
async function save(changes, consent) { await api({ action: 'preferences', name: target, revision: state.preferences.revision, changes, consent }); }
|
|
@@ -325,80 +363,59 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
|
325
363
|
});
|
|
326
364
|
}
|
|
327
365
|
async function showNotes() {
|
|
328
|
-
|
|
366
|
+
if (notesOpen) { setNotesOpen(false); return; }
|
|
367
|
+
setNotesOpen(true); setNotes(null); setLoadingNotes(true); setError('');
|
|
329
368
|
try { setNotes(await api({ action: 'notes', name: target, version: row.release.version })); } catch (error) { setError(error.message); } finally { setLoadingNotes(false); }
|
|
330
369
|
}
|
|
331
370
|
if (!snapshot || !row) return h(W.Status, null, t('此插件尚未安装或已从当前 profile 移除。', 'This plugin is not installed in the current profile.'));
|
|
332
371
|
const title = language() === 'en' ? original.labelEn : original.label;
|
|
333
|
-
|
|
334
|
-
h('p', { className: 'updates-version' }, original.name + ' · ' + original.version),
|
|
335
|
-
h(W.Status, null, t('请更新 Suite 整包,组件版本会一起同步。不会单独再安装一份组件;自动安装默认关闭。', 'Update the whole Suite to synchronize component versions. No duplicate component will be installed. Automatic installation is off by default.')),
|
|
336
|
-
h(W.Button, { icon: 'refresh', onClick: () => { activeName = original.bundledBy; notify(); } }, t('查看 Suite 更新设置', 'Open Suite update settings')));
|
|
337
|
-
if (compact) return h('div', { className: 'dshw', style: { padding: 16 } }, h('style', null, W.styles), h('div', { className: 'w-stack' }, h('h3', null, title), h('p', { className: 'w-muted' }, original.name + ' · ' + original.version), h('p', null, t('这个插件的更新设置与安装入口。自动安装默认关闭。', 'Update settings and installation for this plugin. Automatic installation is off by default.')), h(W.Button, { icon: 'refresh', onClick: () => { activeName = name; notify(); } }, row.available ? t('查看可用更新', 'Review available update') : t('检查与更新', 'Check and update'))));
|
|
338
|
-
const unconfirmed = ['unknown', 'restore-failed'].includes(snapshot.job?.state), pageBusy = pageState(true).busy || (snapshot.pages.clients || []).some(client => client.id !== id && client.busy), installLocked = working || activeJob() || unconfirmed || snapshot.updaterRestart || snapshot.preferenceError || !snapshot.activity.known || snapshot.activity.busy || snapshot.pages.dirty || pageBusy || !snapshot.pages.known;
|
|
372
|
+
const ownPage = pageState(true), unconfirmed = ['unknown', 'restore-failed'].includes(snapshot.job?.state), pageBusy = ownPage.busy || (snapshot.pages.clients || []).some(client => client.id !== id && client.busy), installLocked = working || activeJob() || unconfirmed || snapshot.updaterRestart || snapshot.preferenceError || !snapshot.activity.known || snapshot.activity.busy || snapshot.pages.dirty || ownPage.dirty || pageBusy || !snapshot.pages.known;
|
|
339
373
|
const checkingThis = checking || snapshot.checkingNames?.includes(target);
|
|
340
374
|
const status = row.sourceKind !== 'registry' ? t('本地 / 外部来源,保留原安装方式', 'Local / external source; keep original install method') : row.loadError ? t('加载异常,请先检查官方插件管理', 'Loading error; check native plugin management') : row.error ? t('检查失败,可以重试', 'Check failed; retry available') : row.release && !row.release.compatible ? t('新版本暂不兼容当前环境', 'Latest release is incompatible with this environment') : row.available ? (prefs.ignoredVersion === row.release.version ? t('已忽略提醒,仍可手动更新', 'Reminder ignored; manual update available') : t('有新版本', 'Update available')) : row.checkedAt ? t('当前已是最新稳定版', 'Latest stable version') : t('尚未检查', 'Not checked yet');
|
|
341
|
-
return h(
|
|
342
|
-
h('style', null, '.plugin-updates-page{min-height:0;padding:4px}.plugin-updates-page .updates-settings{display:grid;gap:24px;padding:20px 0}.plugin-updates-page .updates-note{margin-top:8px}.plugin-updates-page .updates-version{font:13px/1.7 ui-monospace,monospace;overflow-wrap:anywhere}.plugin-updates-page .w-overlay{z-index:1002}.plugin-updates-page .w-switch-label{max-width:100%}.plugin-updates-page .w-switch-track{flex-shrink:0}@media(max-width:700px){[data-shortcut-modal="settings"]:has(.plugin-updates-page){flex-direction:column!important;width:calc(100vw - 16px)!important;max-width:calc(100vw - 16px)!important}[data-shortcut-modal="settings"]:has(.plugin-updates-page)>nav{width:100%!important;flex-basis:auto!important;flex-shrink:0;max-height:180px;overflow:auto;border-right:0!important}[data-shortcut-modal="settings"]:has(.plugin-updates-page)>nav>div:has(>button){display:flex;flex-wrap:wrap;gap:4px}[data-shortcut-modal="settings"]:has(.plugin-updates-page)>div{min-width:0!important;width:100%!important}.plugin-updates-page .w-switch-label{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.plugin-updates-page .w-switch-label>span:first-child{min-width:0}.plugin-updates-page .w-switch-label>input{inset-inline-end:0}}'),
|
|
375
|
+
return h(FooterFrame, { name, label: title, subtitle: original.name + ' · ' + original.version, actions: h(W.Button, { icon: 'refresh', disabled: checkingThis || row.sourceKind !== 'registry', onClick: check }, checkingThis ? t('正在检查…', 'Checking…') : target === '@stardustlc/dsh-suite' ? t('检查整包更新', 'Check Suite updates') : t('检查更新', 'Check for updates')) },
|
|
343
376
|
original.bundledBy && h(W.Status, null, t('此插件随 Suite 安装。以下设置与安装作用于 Suite 整包,以保持组件版本一致。单独安装的插件可以独立更新。', 'This plugin was installed through Suite. These controls update Suite as a package so its components stay consistent. Independently installed plugins update individually.')),
|
|
344
|
-
h('section', { className: 'w-section' }, h('p', { className: 'updates-version' }, target + ' · ' + row.version, row.release?.version && row.release.version !== row.version ? ' → ' + row.release.version : ''), h('p', { className: 'w-muted updates-note' }, status), !row.enabled && h('p', { className: 'w-muted' }, t('当前已停用,更新后仍保持停用。', 'Currently disabled; it will remain disabled after updating.')), row.checkedAt && h('p', { className: 'w-muted' }, t('上次检查:', 'Last checked: ') + new Date(row.checkedAt).toLocaleString(language() === 'en' ? 'en-US' : 'zh-CN')),
|
|
345
|
-
h('div', { className: 'w-toolbar'
|
|
346
|
-
h('section', { className: 'updates-
|
|
377
|
+
h('section', { className: 'w-section' }, (original.bundledBy || row.available) && h('p', { className: 'updates-version' }, target + ' · ' + row.version, row.release?.version && row.release.version !== row.version ? ' → ' + row.release.version : ''), h('p', { className: 'w-muted updates-note' }, status), !row.enabled && h('p', { className: 'w-muted' }, t('当前已停用,更新后仍保持停用。', 'Currently disabled; it will remain disabled after updating.')), row.checkedAt && h('p', { className: 'w-muted updates-note' }, t('上次检查:', 'Last checked: ') + new Date(row.checkedAt).toLocaleString(language() === 'en' ? 'en-US' : 'zh-CN')),
|
|
378
|
+
h('div', { className: 'w-toolbar' }, row.available && row.sourceKind === 'registry' && h(W.Button, { variant: 'primary', icon: 'download', disabled: installLocked || row.loadError, onClick: () => setDialog('install') }, target === '@stardustlc/dsh-suite' ? t('更新 Suite 整包', 'Update whole Suite') : t('更新此插件', 'Update this plugin')), row.release && h(W.Button, { variant: 'ghost', onClick: showNotes, 'aria-expanded': notesOpen }, t('更新记录', 'Release notes')), row.available && h(W.Button, { variant: 'ghost', disabled: working, onClick: () => perform(() => api({ action: 'later', name: target, revision: state.preferences.revision })) }, t('明天再提醒', 'Remind me tomorrow')), row.available && prefs.ignoredVersion !== row.release.version && h(W.Button, { variant: 'ghost', disabled: working, onClick: () => perform(() => api({ action: 'ignore', name: target, revision: state.preferences.revision, version: row.release.version })) }, t('忽略此版本提醒', 'Ignore this reminder')))),
|
|
379
|
+
notesOpen && h('section', { className: 'updates-notes', 'aria-label': t('更新记录', 'Release notes') }, h('strong', null, target + ' · ' + (notes?.version || row.release?.version || '')), loadingNotes ? h('p', null, t('正在读取…', 'Loading…')) : notes?.text ? h('pre', null, notes.text) : h('p', null, t('未找到此版本的独立更新记录。', 'No separate notes were found for this version.')), notes?.url && h('a', { href: notes.url, target: '_blank', rel: 'noreferrer noopener' }, t('查看仓库更新记录', 'View repository changelog'))),
|
|
380
|
+
h('details', { className: 'updates-options' }, h('summary', null, t('更新选项', 'Update options'), ' · ', prefs.checkEnabled ? t('自动检查:开', 'Checks: on') : t('自动检查:关', 'Checks: off'), ' · ', prefs.autoInstall ? t('自动安装:开', 'Install: on') : t('自动安装:关', 'Install: off')), h('section', { className: 'updates-settings', 'aria-label': t('这个插件的更新偏好', 'Update preferences for this plugin') },
|
|
347
381
|
h('div', null, h(W.Switch, { label: t('自动检查这个插件的更新', 'Automatically check this plugin'), checked: prefs.checkEnabled, disabled: working || !!snapshot.preferenceError || row.sourceKind !== 'registry', onChange: event => perform(() => save({ checkEnabled: event.target.checked })) }), h('p', { className: 'w-muted updates-note' }, t('默认开启,每天最多一次。只影响这个插件,关闭后仍可手动检查。', 'On by default, at most once daily. This affects only this plugin; manual checks remain available.'))),
|
|
348
|
-
h('div', null, h(W.Switch, { label: t('空闲时自动安装这个插件的补丁', 'Install patches for this plugin while idle'), checked: prefs.autoInstall, disabled: working || !!snapshot.preferenceError || row.sourceKind !== 'registry', onChange: event => event.target.checked ? setDialog('automatic') : perform(() => save({ autoInstall: false })) }), h('p', { className: 'w-muted updates-note' }, t('默认关闭。明确开启后,仅空闲且没有未保存修改时安装兼容补丁。其他插件的开关不变。', 'Off by default. Explicitly enable compatible patches while idle with no unsaved changes. Other plugins’ settings stay unchanged.')))),
|
|
382
|
+
h('div', null, h(W.Switch, { label: t('空闲时自动安装这个插件的补丁', 'Install patches for this plugin while idle'), checked: prefs.autoInstall, disabled: working || !!snapshot.preferenceError || row.sourceKind !== 'registry', onChange: event => event.target.checked ? setDialog('automatic') : perform(() => save({ autoInstall: false })) }), h('p', { className: 'w-muted updates-note' }, t('默认关闭。明确开启后,仅空闲且没有未保存修改时安装兼容补丁。其他插件的开关不变。', 'Off by default. Explicitly enable compatible patches while idle with no unsaved changes. Other plugins’ settings stay unchanged.'))))),
|
|
349
383
|
error && h(W.Status, { tone: 'error' }, message(error)), snapshot.preferenceError && h(W.Status, { tone: 'error' }, message('preferences-unreadable')),
|
|
350
384
|
snapshot.pendingRestart && h(W.Status, null, snapshot.updaterRestart ? message('restart-required') : t('已有更新等待手动重启后生效。你可以继续工作,自动安装已暂停。', 'Some updates need a manual restart. Continue your work; automatic installation is paused.')),
|
|
351
385
|
prefs.autoInstall && snapshot.autoReady === false && h(W.Status, null, message('page-not-ready')),
|
|
352
386
|
snapshot.pages.clients.some(client => !client.fresh) && h(W.Status, null, h('p', null, t('有窗口已断开,无法确认是否还有未保存修改。仍在使用的窗口请先保存并刷新;已关闭的窗口可以手动重新确认。', 'A disconnected window may contain unsaved changes. Save and refresh windows still in use. If they are closed, you can confirm that manually.')), h(W.Button, { onClick: () => setDialog('windows') }, t('重新确认已关闭的窗口', 'Confirm closed windows'))),
|
|
353
|
-
snapshot.pages.dirty && h(W.Status, null, message('page-dirty')), (snapshot.activity.busy || pageBusy) && h(W.Status, null, message(snapshot.activity.busy ? 'busy' : 'page-busy')),
|
|
387
|
+
(snapshot.pages.dirty || ownPage.dirty) && h(W.Status, null, message('page-dirty')), (snapshot.activity.busy || pageBusy) && h(W.Status, null, message(snapshot.activity.busy ? 'busy' : 'page-busy')),
|
|
354
388
|
prefs.deferredUntil > Date.now() && h(W.Status, null, t('此插件已推迟提醒和自动安装 24 小时,仍可手动更新。', 'Reminders and automatic installation for this plugin are deferred for 24 hours. Manual updates remain available.')),
|
|
355
389
|
unconfirmed && h(W.Status, { tone: 'error' }, message('operation-unconfirmed')),
|
|
356
390
|
job && h('section', { className: 'w-section', 'aria-label': t('这个插件的更新进度', 'Update progress for this plugin') }, h('h3', null, jobLabel(job)), h('p', { className: 'w-muted' }, job.from + ' → ' + job.to + (job.mode === 'automatic' ? t(' · 自动补丁更新', ' · Automatic patch') : '')), (job.reason || job.outcome?.result?.error?.code) && h(W.Status, { tone: 'error' }, message(job.reason || job.outcome.result.error.code)), activeJob() && h(W.Button, { disabled: job.state === 'cancelling', onClick: () => perform(() => api({ action: 'cancel', id: job.id })) }, t('取消更新', 'Cancel update')), h('p', { className: 'w-muted updates-note' }, t('安装开始后,取消由官方包管理器处理;已落盘的写入以实际结果或恢复状态为准。', 'After installation starts, the native package manager handles cancellation. Completed writes and recovery are reported as they occur.'))),
|
|
357
|
-
dialog && h(W.Dialog, { title: dialog === 'windows' ? t('断开的窗口都已关闭?', 'Are the disconnected windows closed?') : dialog === 'automatic' ? t('允许这个插件自动安装补丁?', 'Allow automatic patches for this plugin?') :
|
|
358
|
-
target === '@stardustlc/dsh-suite' &&
|
|
391
|
+
dialog && h(W.Dialog, { title: dialog === 'windows' ? t('断开的窗口都已关闭?', 'Are the disconnected windows closed?') : dialog === 'automatic' ? t('允许这个插件自动安装补丁?', 'Allow automatic patches for this plugin?') : t('确认更新此插件', 'Confirm this plugin update'), closeLabel: t('关闭', 'Close'), onClose: () => setDialog(null) },
|
|
392
|
+
target === '@stardustlc/dsh-suite' && h('p', null, t('此处操作的是 Suite 整包,包含 18 个组件。独立安装的其他插件不受影响。', 'This action applies to the whole Suite, including its 18 components. Other independently installed plugins are unaffected.')),
|
|
359
393
|
dialog === 'windows' ? h('div', { className: 'w-stack' }, h('p', null, t('只清除超过 45 秒未回应的其他窗口记录。请先确认它们已经关闭;仍在使用的窗口请保存修改并刷新。当前或仍在回应的窗口保护会保留。', 'Only other windows silent for over 45 seconds are cleared. Confirm that they are closed; save and refresh windows still in use. Current and responsive windows remain protected.')), h('div', { className: 'w-toolbar' }, h(W.Button, { onClick: () => setDialog(null) }, t('取消', 'Cancel')), h(W.Button, { onClick: () => { setDialog(null); void perform(() => api({ ...pageState(true), action: 'reconfirm-windows', confirmation: 'other-stale-windows-are-closed' })); } }, t('已关闭,重新确认状态', 'They are closed; reconfirm')))) :
|
|
360
394
|
dialog === 'automatic' ? h('div', { className: 'w-stack' }, h('p', null, (language() === 'en' ? row.labelEn : row.label) + ' · ' + target), h('p', null, t('你正在主动启用这个插件的自动安装。只处理兼容的稳定补丁;有任务、未保存修改、未知窗口或等待重启时暂停。', 'You are explicitly enabling automatic installation for this plugin. Only compatible stable patches qualify; running tasks, unsaved changes, unknown windows or a pending restart pause it.')), h('p', null, t('不会自动重启 DSH,其他插件不会跟着开启。可随时关闭。', 'DSH will not restart automatically, and other plugins will not be enabled for automatic updates. Turn it off anytime.')), h('div', { className: 'w-toolbar' }, h(W.Button, { onClick: () => setDialog(null) }, t('保持关闭', 'Keep off')), h(W.Button, { variant: 'primary', onClick: () => { setDialog(null); void perform(() => save({ checkEnabled: true, autoInstall: true }, 'enable-idle-patch-updates')); } }, t('允许此插件自动安装补丁', 'Allow patches for this plugin')))) :
|
|
361
|
-
|
|
362
|
-
h('div', { className: 'w-stack' }, h('p', { className: 'updates-version' }, target + ': ' + row.version + ' → ' + row.release.version), h('p', null, t('通过 DSH 官方插件管理器安装。需要重启时,由你手动决定时间;停用状态会保留。', 'Install through DSH’s native plugin manager. Choose when to restart if needed; disabled status is preserved.')), h('p', { className: 'w-muted' }, t('来源:npm 官方 registry,网络不可达时回退 npmmirror。安装前再次核对版本与完整性。', 'Source: official npm registry, with npmmirror fallback if unreachable. Version and integrity are checked again before installation.')), h('div', { className: 'w-toolbar' }, h(W.Button, { onClick: () => setDialog(null) }, t('取消', 'Cancel')), h(W.Button, { variant: 'primary', onClick: install }, t('确认安装此版本', 'Install this version')))))
|
|
395
|
+
h('div', { className: 'w-stack' }, h('p', { className: 'updates-version' }, target + ': ' + row.version + ' → ' + row.release.version), h('p', null, t('通过 DSH 官方插件管理器安装。需要重启时,由你手动决定时间;停用状态会保留。', 'Install through DSH’s native plugin manager. Choose when to restart if needed; disabled status is preserved.')), h('p', { className: 'w-muted' }, t('来源:npm 官方 registry,网络不可达时回退 npmmirror。安装前再次核对版本与完整性。', 'Source: official npm registry, with npmmirror fallback if unreachable. Version and integrity are checked again before installation.')), (ownPage.dirty || snapshot.pages.dirty) && h(W.Status, null, message('page-dirty')), h('div', { className: 'w-toolbar' }, h(W.Button, { onClick: () => setDialog(null) }, t('取消', 'Cancel')), h(W.Button, { variant: 'primary', disabled: installLocked || row.loadError, onClick: install }, t('确认安装此版本', 'Install this version')))))
|
|
363
396
|
);
|
|
364
397
|
}
|
|
365
|
-
function
|
|
366
|
-
useSnapshot();
|
|
367
|
-
|
|
368
|
-
if (!row) return null;
|
|
369
|
-
const content = h('div', { className: 'dshw' }, h('style', null, W.styles), h(W.Dialog, { title: (language() === 'en' ? row.labelEn : row.label) + t(' · 更新设置', ' · Update settings'), closeLabel: t('关闭更新设置', 'Close update settings'), onClose: () => { activeName = null; notify(); } }, h(Panel, { key: activeName, name: activeName })));
|
|
370
|
-
const settings = document.querySelector('[data-shortcut-modal="settings"]');
|
|
371
|
-
// Keep the dialog inside the native settings focus boundary when its
|
|
372
|
-
// per-plugin entry was opened there. The shared fiber survives HMR.
|
|
373
|
-
return settings ? require('react-dom').createPortal(content, settings) : content;
|
|
398
|
+
function NativeFooter({ subject }) {
|
|
399
|
+
const snapshot = useSnapshot(), name = __stardustUpdatesDetailName(subject, snapshot?.rows || []);
|
|
400
|
+
return name ? h(Panel, { name }) : null;
|
|
374
401
|
}
|
|
375
402
|
function Reminder() {
|
|
376
403
|
useSnapshot();
|
|
377
404
|
const row = state?.rows.find(row => { const prefs = preferences(row.name); return row.available && !row.updating && !row.bundledBy && prefs.checkEnabled && prefs.deferredUntil <= Date.now() && prefs.ignoredVersion !== row.release.version && !notified.has(row.name + '@' + row.release.version); });
|
|
378
|
-
if (!row) return null;
|
|
405
|
+
if (!row && !legacyHint) return null;
|
|
379
406
|
let Toast; try { Toast = require('@deepseek-ai/dsh-client-ui-primitives').Toast; } catch { return null; }
|
|
380
407
|
if (!Toast) return null;
|
|
381
|
-
const key = row.name + '@' + row.release.version;
|
|
382
|
-
return h(Toast, { key, text: (language() === 'en' ? row.labelEn : row.label) + t('
|
|
408
|
+
const hint = legacyHint, key = hint ? 'legacy-' + hint : row.name + '@' + row.release.version;
|
|
409
|
+
return h(Toast, { key, text: hint ? hint + t(':请打开「插件」中的此插件详情页,在底部管理更新。', ': open its details in Plugins to manage updates at the bottom.') : (language() === 'en' ? row.labelEn : row.label) + t('有新版本,可在页面底部查看。', ' has an update. Review it at the bottom of its page.'), icon: h(W.Icon, { name: 'refresh', size: 18 }), holdMs: 7000, onDone: () => { if (hint) legacyHint = null; else notified.add(key); notify(); } });
|
|
383
410
|
}
|
|
384
411
|
function register() {
|
|
385
412
|
if (!alive) return;
|
|
386
413
|
if (!registered) {
|
|
387
414
|
registered = true; pool.clients.add(client);
|
|
388
|
-
ctx.slots.inject('
|
|
415
|
+
ctx.slots.inject('plugins.detail.section', () => ctx.slots.register({ name: 'plugins.detail.section', id: 'stardustlc.plugin-update-footer', order: 1000 }, NativeFooter));
|
|
389
416
|
ctx.slots.inject('shell.overlay', () => ctx.slots.register({ name: 'shell.overlay', id: 'stardustlc.plugin-update-reminder' }, Reminder));
|
|
390
417
|
notify();
|
|
391
418
|
}
|
|
392
|
-
for (const row of state.rows) {
|
|
393
|
-
const hasWorkbench = [...shared.refs.values()].some(participant => participant.name === row.name && participant.hasWorkbench);
|
|
394
|
-
if (hasWorkbench) { if (sections.has(row.name)) { void sections.get(row.name).dispose(); sections.delete(row.name); } continue; }
|
|
395
|
-
if (sections.has(row.name)) continue;
|
|
396
|
-
const label = () => (language() === 'en' ? row.labelEn : row.label) + t(' · 更新', ' · Updates');
|
|
397
|
-
const fiber = ctx.plugin({ name: 'plugin-update-settings-' + row.name, inject: ['slots', 'locale'], apply(section) {
|
|
398
|
-
section.slots.inject('settings.section', () => section.slots.register({ name: 'settings.section', id: row.name + '.updates', label, order: 89 }, () => h(Panel, { name: row.name })));
|
|
399
|
-
} });
|
|
400
|
-
sections.set(row.name, fiber);
|
|
401
|
-
}
|
|
402
419
|
}
|
|
403
420
|
async function poll() {
|
|
404
421
|
if (inPoll || !alive || !shared.refs.size) return;
|
|
@@ -408,7 +425,7 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
|
408
425
|
finally { inPoll = false; }
|
|
409
426
|
}
|
|
410
427
|
const timer = setInterval(() => { void poll(); }, 15000), first = setTimeout(() => { void poll(); }, 100);
|
|
411
|
-
const client = { t, Button: W.Button,
|
|
428
|
+
const client = { t, Footer: Panel, Button: W.Button, open(name) { const footer = [...document.querySelectorAll('[data-plugin-update-footer]')].find(node => node.getAttribute('data-plugin-update-footer') === name); if (footer) footer.scrollIntoView({ block: 'end', behavior: 'smooth' }); else { legacyHint = name; notify(); } }, has: name => registered && !!originalRow(name), row: rowFor, dispose() {
|
|
412
429
|
close(); alive = false; clearTimeout(first); clearInterval(timer); pool.clients.delete(client);
|
|
413
430
|
pool.listeners.delete(guardChanged); listeners.clear();
|
|
414
431
|
for (const event of ['pointerdown', 'keydown', 'input']) document.removeEventListener(event, interaction, true);
|
|
@@ -420,7 +437,7 @@ function __stardustUpdatesClient(ctx, React, require, shared) {
|
|
|
420
437
|
}
|
|
421
438
|
|
|
422
439
|
/* STARDUSTLC_UPDATE_CLIENT_BODY_START */
|
|
423
|
-
window.__ModuleLoader__.load(__stardustUpdatesWrap({id:"dsh-ffmpeg",factory:require=>({apply(){}})},{"name":"dsh-ffmpeg","version":"0.1.0","hasWorkbench":false,"packageVersion":"0.6.
|
|
440
|
+
window.__ModuleLoader__.load(__stardustUpdatesWrap({id:"dsh-ffmpeg",factory:require=>({apply(){}})},{"name":"dsh-ffmpeg","version":"0.1.0","hasWorkbench":false,"packageVersion":"0.6.3","label":"FFmpeg","labelEn":"FFmpeg","suiteComponent":true}));
|
|
424
441
|
|
|
425
442
|
/* STARDUSTLC_UPDATE_CLIENT_BODY_END */
|
|
426
443
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ffmpeg",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "用自然语言调用 FFmpeg,处理已有音视频文件。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"author": "stardustlc",
|
|
71
71
|
"packageManager": "pnpm@11.7.0",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@stardustlc/dsh-updates": "0.1.
|
|
73
|
+
"@stardustlc/dsh-updates": "0.1.3"
|
|
74
74
|
}
|
|
75
75
|
}
|