Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix: 合并配置页处理进度与在线更新入口

longmeidao1c2df43cb040
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index ed68f8c29..b7037ffc0 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -4,8 +4,8 @@
## 界面、媒体与复核的既定判据
-- 统一处理、NFO 兼容见 `docs/REUSE.md`;[Banner](https://vercel.com/geist/banner) 2026-09-06 实测与 hash 见 `vercel-geist-library-banner.md`。
-- 凭据焦点圈外扩 3px,折叠正文左右留 4px;输入框允许收缩,验收所有裁切祖先。
+- NFO 见 `docs/REUSE.md`;[Banner](https://vercel.com/geist/banner) 取证见 `vercel-geist-library-banner.md`。
+- 凭据焦点外扩 3px,正文左右留 4px;输入框可收缩,验收所有裁切祖先。
页面密度、控件、提示与响应式的实现门槛见 `.claude/skills/peach-web-ui/SKILL.md`,这里只留代码看不出来的判据。
diff --git a/frontend/test/configuration.test.tsx b/frontend/test/configuration.test.tsx
index 0c23e795e..93b38ab0d 100644
--- a/frontend/test/configuration.test.tsx
+++ b/frontend/test/configuration.test.tsx
@@ -82,9 +82,9 @@ describe('配置页取数', () => {
expect(el.querySelector('[role="progressbar"]')?.getAttribute('aria-valuenow')).toBe('100');
expect(modal).toHaveBeenCalledTimes(1);
expect(modal.mock.calls[0]?.[0]).toMatchObject({title:'更新已准备好',confirmLabel:'立即重启',cancelLabel:'稍后'});
- expect(fetch).not.toHaveBeenCalled();
+ expect(fetch.mock.calls.filter(([url]) => url.startsWith('/api/configuration/update'))).toHaveLength(0);
await modal.mock.calls[0]?.[0].onConfirm?.();
- expect(fetch.mock.calls[0]?.[0]).toBe('/api/configuration/update-restart');
+ expect(fetch.mock.calls.some(([url]) => url === '/api/configuration/update-restart')).toBe(true);
});
it('版本字段组显式查询测试版,失败后可重试且保留焦点', async () => {
const initial = {current_version:'0.9.0',latest_version:null,channel:'测试版',installation:'独立测试包',state:'unchecked',message:'尚未检查',release_url:'https://github.com/longmeidao/peach/releases'};
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index f004c3ba3..a5754fcc9 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -1,18 +1,18 @@
-import { MEDIA_SOURCE_ICONS as e, emptyStateHtml as t, fieldsetTitle as n, loadingDotsHtml as r, noteHtml as i, progressHtml as a, selectFieldHtml as o, selectOptionIconHtml as s, setActionBusy as c, wireSelectField as l } from "/js/ui-components.js";
-import { LOC as u, fmtDur as d, fmtSize as f } from "/js/core.js";
+import { MEDIA_SOURCE_ICONS as e, confirmModal as t, emptyStateHtml as n, fieldsetTitle as r, loadingDotsHtml as i, noteHtml as a, progressHtml as o, selectFieldHtml as s, selectOptionIconHtml as c, setActionBusy as l, wireSelectField as u } from "/js/ui-components.js";
+import { LOC as d, fmtDur as f, fmtSize as p } from "/js/core.js";
//#region node_modules/preact/dist/preact.module.js
-var p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O = {}, k = [], ee = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, te = Array.isArray;
-function A(e, t) {
+var m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k = {}, A = [], ee = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, j = Array.isArray;
+function M(e, t) {
for (var n in t) e[n] = t[n];
return e;
}
-function j(e) {
+function te(e) {
e && e.parentNode && e.parentNode.removeChild(e);
}
function ne(e, t, n) {
var r, i, a, o = {};
for (a in t) a == "key" ? r = t[a] : a == "ref" ? i = t[a] : o[a] = t[a];
- if (arguments.length > 2 && (o.children = arguments.length > 3 ? p.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (a in e.defaultProps) o[a] === void 0 && (o[a] = e.defaultProps[a]);
+ if (arguments.length > 2 && (o.children = arguments.length > 3 ? m.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (a in e.defaultProps) o[a] === void 0 && (o[a] = e.defaultProps[a]);
return re(e, o, r, i, null);
}
function re(e, t, n, r, i) {
@@ -27,27 +27,27 @@ function re(e, t, n, r, i) {
__e: null,
__c: null,
constructor: void 0,
- __v: i ?? ++h,
+ __v: i ?? ++g,
__i: -1,
__u: 0
};
- return i == null && m.vnode != null && m.vnode(a), a;
+ return i == null && h.vnode != null && h.vnode(a), a;
}
-function M(e) {
+function N(e) {
return e.children;
}
-function N(e, t) {
+function P(e, t) {
this.props = e, this.context = t;
}
-function P(e, t) {
- if (t == null) return e.__ ? P(e.__, e.__i + 1) : null;
+function F(e, t) {
+ if (t == null) return e.__ ? F(e.__, e.__i + 1) : null;
for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
- return typeof e.type == "function" ? P(e) : null;
+ return typeof e.type == "function" ? F(e) : null;
}
function ie(e) {
if (e.__P && e.__d) {
- var t = e.__v, n = t.__e, r = [], i = [], a = A({}, t);
- a.__v = t.__v + 1, m.vnode && m.vnode(a), he(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? P(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, _e(r, a, i), t.__e = t.__ = null, a.__e != n && ae(a);
+ var t = e.__v, n = t.__e, r = [], i = [], a = M({}, t);
+ a.__v = t.__v + 1, h.vnode && h.vnode(a), he(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? F(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, _e(r, a, i), t.__e = t.__ = null, a.__e != n && ae(a);
}
}
function ae(e) {
@@ -56,24 +56,24 @@ function ae(e) {
}), ae(e);
}
function oe(e) {
- (!e.__d && (e.__d = !0) && _.push(e) && !se.__r++ || v != m.debounceRendering) && ((v = m.debounceRendering) || y)(se);
+ (!e.__d && (e.__d = !0) && v.push(e) && !se.__r++ || y != h.debounceRendering) && ((y = h.debounceRendering) || b)(se);
}
function se() {
try {
- for (var e, t = 1; _.length;) _.length > t && _.sort(b), e = _.shift(), t = _.length, ie(e);
+ for (var e, t = 1; v.length;) v.length > t && v.sort(x), e = v.shift(), t = v.length, ie(e);
} finally {
- _.length = se.__r = 0;
+ v.length = se.__r = 0;
}
}
function ce(e, t, n, r, i, a, o, s, c, l, u) {
- var d, f, p, m, h, g, _ = r && r.__k || k, v = t.length;
- for (c = le(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || O, p.__i = d, g = he(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && be(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = ue(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
+ var d, f, p, m, h, g, _ = r && r.__k || A, v = t.length;
+ for (c = le(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || k, p.__i = d, g = he(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && be(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = ue(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
return n.__e = h, c;
}
function le(e, t, n, r, i) {
var a, o, s, c, l, u = n.length, d = u, f = 0;
- for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = re(null, o, null, null, null) : te(o) ? o = e.__k[a] = re(M, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = re(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = de(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = P(s)), xe(s, s));
+ for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = re(null, o, null, null, null) : j(o) ? o = e.__k[a] = re(N, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = re(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = de(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = F(s)), xe(s, s));
return r;
}
function ue(e, t, n) {
@@ -82,7 +82,7 @@ function ue(e, t, n) {
for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = ue(r[i], t, n));
return t;
}
- e.__e != t && (t && e.type && !t.parentNode && (t = P(e)), t = n.insertBefore(e.__e, t || null));
+ e.__e != t && (t && e.type && !t.parentNode && (t = F(e)), t = n.insertBefore(e.__e, t || null));
do
t &&= t.nextSibling;
while (t != null && t.nodeType == 8);
@@ -107,7 +107,7 @@ function pe(e, t, n, r, i) {
if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || fe(e.style, t, "");
if (n) for (t in n) r && n[t] == r[t] || fe(e.style, t, n[t]);
}
- } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(w, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[C] = r[C] : (n[C] = T, e.addEventListener(t, a ? D : E, a)) : e.removeEventListener(t, a ? D : E, a);
+ } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(T, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[w] = r[w] : (n[w] = E, e.addEventListener(t, a ? O : D, a)) : e.removeEventListener(t, a ? O : D, a);
else {
if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
@@ -121,85 +121,85 @@ function me(e) {
return function(t) {
if (this.l) {
var n = this.l[t.type + e];
- if (t[S] == null) t[S] = T++;
- else if (t[S] < n[C]) return;
- return n(m.event ? m.event(t) : t);
+ if (t[C] == null) t[C] = E++;
+ else if (t[C] < n[w]) return;
+ return n(h.event ? h.event(t) : t);
}
};
}
function he(e, t, n, r, i, a, o, s, c, l) {
- var u, d, f, p, h, g, _, v, y, b, x, S, C, w, T, E, D = t.type;
+ var u, d, f, p, m, g, _, v, y, b, x, S, C, w, T, E, D = t.type;
if (t.constructor !== void 0) return null;
- 128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (u = m.__b) && u(t);
+ 128 & n.__u && (c = !!(32 & n.__u), a = [s = t.__e = n.__e]), (u = h.__b) && u(t);
n: if (typeof D == "function") {
d = o.length;
try {
- if (y = t.props, b = D.prototype && D.prototype.render, x = (u = D.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? v = (f = t.__c = n.__c).__ = f.__E : (b ? t.__c = f = new D(y, S) : (t.__c = f = new N(y, S), f.constructor = D, f.render = Se), x && x.sub(f), f.state || (f.state = {}), f.__n = r, p = f.__d = !0, f.__h = [], f._sb = []), b && f.__s == null && (f.__s = f.state), b && D.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = A({}, f.__s)), A(f.__s, D.getDerivedStateFromProps(y, f.__s))), h = f.props, g = f.state, f.__v = t, p) b && D.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), b && f.componentDidMount != null && f.__h.push(f.componentDidMount);
+ if (y = t.props, b = D.prototype && D.prototype.render, x = (u = D.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? v = (f = t.__c = n.__c).__ = f.__E : (b ? t.__c = f = new D(y, S) : (t.__c = f = new P(y, S), f.constructor = D, f.render = Se), x && x.sub(f), f.state || (f.state = {}), f.__n = r, p = f.__d = !0, f.__h = [], f._sb = []), b && f.__s == null && (f.__s = f.state), b && D.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = M({}, f.__s)), M(f.__s, D.getDerivedStateFromProps(y, f.__s))), m = f.props, g = f.state, f.__v = t, p) b && D.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), b && f.componentDidMount != null && f.__h.push(f.componentDidMount);
else {
- if (b && D.getDerivedStateFromProps == null && y !== h && f.componentWillReceiveProps != null && f.componentWillReceiveProps(y, S), t.__v == n.__v || !f.__e && f.shouldComponentUpdate != null && !1 === f.shouldComponentUpdate(y, f.__s, S)) {
+ if (b && D.getDerivedStateFromProps == null && y !== m && f.componentWillReceiveProps != null && f.componentWillReceiveProps(y, S), t.__v == n.__v || !f.__e && f.shouldComponentUpdate != null && !1 === f.shouldComponentUpdate(y, f.__s, S)) {
t.__v != n.__v && (f.props = y, f.state = f.__s, f.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
e && (e.__ = t);
- }), k.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && o.push(f), s = P(n);
+ }), A.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && o.push(f), s = F(n);
break n;
}
f.componentWillUpdate != null && f.componentWillUpdate(y, f.__s, S), b && f.componentDidUpdate != null && f.__h.push(function() {
- f.componentDidUpdate(h, g, _);
+ f.componentDidUpdate(m, g, _);
});
}
- if (f.context = S, f.props = y, f.__P = e, f.__e = !1, C = m.__r, w = 0, b) f.state = f.__s, f.__d = !1, C && C(t), u = f.render(f.props, f.state, f.context), k.push.apply(f.__h, f._sb), f._sb = [];
+ if (f.context = S, f.props = y, f.__P = e, f.__e = !1, C = h.__r, w = 0, b) f.state = f.__s, f.__d = !1, C && C(t), u = f.render(f.props, f.state, f.context), A.push.apply(f.__h, f._sb), f._sb = [];
else do
f.__d = !1, C && C(t), u = f.render(f.props, f.state, f.context), f.state = f.__s;
while (f.__d && ++w < 25);
- f.state = f.__s, f.getChildContext != null && (r = A(A({}, r), f.getChildContext())), b && !p && f.getSnapshotBeforeUpdate != null && (_ = f.getSnapshotBeforeUpdate(h, g)), T = u != null && u.type === M && u.key == null ? ve(u.props.children) : u, s = ce(e, te(T) ? T : [T], t, n, r, i, a, o, s, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && o.push(f), v && (f.__E = f.__ = null);
+ f.state = f.__s, f.getChildContext != null && (r = M(M({}, r), f.getChildContext())), b && !p && f.getSnapshotBeforeUpdate != null && (_ = f.getSnapshotBeforeUpdate(m, g)), T = u != null && u.type === N && u.key == null ? ve(u.props.children) : u, s = ce(e, j(T) ? T : [T], t, n, r, i, a, o, s, c, l), f.base = t.__e, t.__u &= -161, f.__h.length && o.push(f), v && (f.__E = f.__ = null);
} catch (e) {
if (o.length = d, t.__v = null, c || a != null) {
if (e.then) {
for (t.__u |= c ? 160 : 128; s && s.nodeType == 8 && s.nextSibling;) s = s.nextSibling;
a != null && (a[a.indexOf(s)] = null), t.__e = s;
- } else if (a != null) for (E = a.length; E--;) j(a[E]);
+ } else if (a != null) for (E = a.length; E--;) te(a[E]);
} else t.__e = n.__e;
- t.__k ??= n.__k || [], e.then || ge(t), m.__e(e, t, n);
+ t.__k ??= n.__k || [], e.then || ge(t), h.__e(e, t, n);
}
} else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : s = t.__e = ye(n.__e, t, n, r, i, a, o, c, l);
- return (u = m.diffed) && u(t), 128 & t.__u ? void 0 : s;
+ return (u = h.diffed) && u(t), 128 & t.__u ? void 0 : s;
}
function ge(e) {
e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(ge));
}
function _e(e, t, n) {
for (var r = 0; r < n.length; r++) be(n[r], n[++r], n[++r]);
- m.__c && m.__c(t, e), e.some(function(t) {
+ h.__c && h.__c(t, e), e.some(function(t) {
try {
e = t.__h, t.__h = [], e.some(function(e) {
e.call(t);
});
} catch (e) {
- m.__e(e, t.__v);
+ h.__e(e, t.__v);
}
});
}
function ve(e) {
- return typeof e != "object" || !e || e.__b > 0 ? e : te(e) ? e.map(ve) : e.constructor === void 0 ? A({}, e) : null;
+ return typeof e != "object" || !e || e.__b > 0 ? e : j(e) ? e.map(ve) : e.constructor === void 0 ? M({}, e) : null;
}
function ye(e, t, n, r, i, a, o, s, c) {
- var l, u, d, f, h, g, _, v = n.props || O, y = t.props, b = t.type;
+ var l, u, d, f, p, g, _, v = n.props || k, y = t.props, b = t.type;
if (b == "svg" ? i = "http://www.w3.org/2000/svg" : b == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", a != null) {
- for (l = 0; l < a.length; l++) if ((h = a[l]) && "setAttribute" in h == !!b && (b ? h.localName == b : h.nodeType == 3)) {
- e = h, a[l] = null;
+ for (l = 0; l < a.length; l++) if ((p = a[l]) && "setAttribute" in p == !!b && (b ? p.localName == b : p.nodeType == 3)) {
+ e = p, a[l] = null;
break;
}
}
if (e == null) {
if (b == null) return document.createTextNode(y);
- e = document.createElementNS(i, b, y.is && y), s &&= (m.__m && m.__m(t, a), !1), a = null;
+ e = document.createElementNS(i, b, y.is && y), s &&= (h.__m && h.__m(t, a), !1), a = null;
}
if (b == null) v === y || s && e.data == y || (e.data = y);
else {
- if (a = b == "textarea" && y.defaultValue != null ? null : a && p.call(e.childNodes), !s && a != null) for (v = {}, l = 0; l < e.attributes.length; l++) v[(h = e.attributes[l]).name] = h.value;
- for (l in v) h = v[l], l == "dangerouslySetInnerHTML" ? d = h : l == "children" || l in y || l == "value" && "defaultValue" in y || l == "checked" && "defaultChecked" in y || pe(e, l, null, h, i);
- for (l in y) h = y[l], l == "children" ? f = h : l == "dangerouslySetInnerHTML" ? u = h : l == "value" ? g = h : l == "checked" ? _ = h : s && typeof h != "function" || v[l] === h || pe(e, l, h, v[l], i);
+ if (a = b == "textarea" && y.defaultValue != null ? null : a && m.call(e.childNodes), !s && a != null) for (v = {}, l = 0; l < e.attributes.length; l++) v[(p = e.attributes[l]).name] = p.value;
+ for (l in v) p = v[l], l == "dangerouslySetInnerHTML" ? d = p : l == "children" || l in y || l == "value" && "defaultValue" in y || l == "checked" && "defaultChecked" in y || pe(e, l, null, p, i);
+ for (l in y) p = y[l], l == "children" ? f = p : l == "dangerouslySetInnerHTML" ? u = p : l == "value" ? g = p : l == "checked" ? _ = p : s && typeof p != "function" || v[l] === p || pe(e, l, p, v[l], i);
if (u) s || d && (u.__html == d.__html || u.__html == e.innerHTML) || (e.innerHTML = u.__html), t.__k = [];
- else if (d && (e.innerHTML = ""), ce(t.type == "template" ? e.content : e, te(f) ? f : [f], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && P(n, 0), s, c), a != null) for (l = a.length; l--;) j(a[l]);
+ else if (d && (e.innerHTML = ""), ce(t.type == "template" ? e.content : e, j(f) ? f : [f], t, n, r, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, a, o, a ? a[0] : n.__k && F(n, 0), s, c), a != null) for (l = a.length; l--;) te(a[l]);
s && b != "textarea" || (l = "value", b == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[l] || b == "progress" && !g || b == "option" && g != v[l]) && pe(e, l, g, v[l], i), l = "checked", _ != null && _ != e[l] && pe(e, l, _, v[l], i));
}
return e;
@@ -211,46 +211,46 @@ function be(e, t, n) {
r && e.__u(), r && t == null || (e.__u = e(t));
} else e.current = t;
} catch (e) {
- m.__e(e, n);
+ h.__e(e, n);
}
}
function xe(e, t, n) {
var r, i;
- if (m.unmount && m.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || be(r, null, t)), (r = e.__c) != null) {
+ if (h.unmount && h.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || be(r, null, t)), (r = e.__c) != null) {
if (r.componentWillUnmount) try {
r.componentWillUnmount();
} catch (e) {
- m.__e(e, t);
+ h.__e(e, t);
}
r.base = r.__P = r.__n = null;
}
if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && xe(r[i], t, n || typeof e.type != "function");
- n || j(e.__e), e.__c = e.__ = e.__e = void 0;
+ n || te(e.__e), e.__c = e.__ = e.__e = void 0;
}
function Se(e, t, n) {
return this.constructor(e, n);
}
function Ce(e, t, n) {
var r, i, a, o;
- t == document && (t = document.documentElement), m.__ && m.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], he(t, e = (!r && n || t).__k = ne(M, null, [e]), i || O, O, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? p.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), _e(a, e, o), e.props.children = null;
+ t == document && (t = document.documentElement), h.__ && h.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, a = [], o = [], he(t, e = (!r && n || t).__k = ne(N, null, [e]), i || k, k, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? m.call(t.childNodes) : null, a, !r && n ? n : i ? i.__e : t.firstChild, r, o), _e(a, e, o), e.props.children = null;
}
-p = k.slice, m = { __e: function(e, t, n, r) {
+m = A.slice, h = { __e: function(e, t, n, r) {
for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(e)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, r || {}), o = i.__d), o) return i.__E = i;
} catch (t) {
e = t;
}
throw e;
-} }, h = 0, g = function(e) {
+} }, g = 0, _ = function(e) {
return e != null && e.constructor === void 0;
-}, N.prototype.setState = function(e, t) {
- var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = A({}, this.state);
- typeof e == "function" && (e = e(A({}, n), this.props)), e && A(n, e), e != null && this.__v && (t && this._sb.push(t), oe(this));
-}, N.prototype.forceUpdate = function(e) {
+}, P.prototype.setState = function(e, t) {
+ var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = M({}, this.state);
+ typeof e == "function" && (e = e(M({}, n), this.props)), e && M(n, e), e != null && this.__v && (t && this._sb.push(t), oe(this));
+}, P.prototype.forceUpdate = function(e) {
this.__v && (this.__e = !0, e && this.__h.push(e), oe(this));
-}, N.prototype.render = M, _ = [], y = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, b = function(e, t) {
+}, P.prototype.render = N, v = [], b = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, x = function(e, t) {
return e.__v.__b - t.__v.__b;
-}, se.__r = 0, x = Math.random().toString(8), S = "__d" + x, C = "__a" + x, w = /(PointerCapture)$|Capture$/i, T = 0, E = me(!1), D = me(!0);
+}, se.__r = 0, S = Math.random().toString(8), C = "__d" + S, w = "__a" + S, T = /(PointerCapture)$|Capture$/i, E = 0, D = me(!1), O = me(!0);
//#endregion
//#region src/api.ts
var we = class extends Error {
@@ -271,8 +271,8 @@ var we = class extends Error {
if (typeof n == "string" && n) return n;
}
return "";
-}, F = (e) => e instanceof Error ? e.message : String(e);
-async function I(e, t) {
+}, I = (e) => e instanceof Error ? e.message : String(e);
+async function L(e, t) {
let n = await fetch(e, {
headers: { Accept: "application/json" },
credentials: "same-origin",
@@ -284,7 +284,7 @@ async function I(e, t) {
if (!n.ok) throw new we(Te(r) || `请求失败(${n.status})`, n.status);
return r;
}
-async function L(e, t, n = "POST", r) {
+async function R(e, t, n = "POST", r) {
let i = await fetch(e, {
method: n,
...r ? { signal: r } : {},
@@ -303,24 +303,24 @@ async function L(e, t, n = "POST", r) {
}
//#endregion
//#region node_modules/preact/hooks/dist/hooks.module.js
-var R, z, Ee, De, Oe = 0, ke = [], B = m, Ae = B.__b, je = B.__r, Me = B.diffed, Ne = B.__c, Pe = B.unmount, Fe = B.__;
+var z, B, Ee, De, Oe = 0, ke = [], V = h, Ae = V.__b, je = V.__r, Me = V.diffed, Ne = V.__c, Pe = V.unmount, Fe = V.__;
function Ie(e, t) {
- B.__h && B.__h(z, e, Oe || t), Oe = 0;
- var n = z.__H || (z.__H = {
+ V.__h && V.__h(B, e, Oe || t), Oe = 0;
+ var n = B.__H || (B.__H = {
__: [],
__h: []
});
return e >= n.__.length && n.__.push({}), n.__[e];
}
-function V(e) {
- return Oe = 1, Le(Ke, e);
+function H(e) {
+ return Oe = 1, Le(Ge, e);
}
function Le(e, t, n) {
- var r = Ie(R++, 2);
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Ke(void 0, t), function(e) {
+ var r = Ie(z++, 2);
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Ge(void 0, t), function(e) {
var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
- }], r.__c = z, !z.__f)) {
+ }], r.__c = B, !B.__f)) {
var i = function(e, t, n) {
if (!r.__c.__H) return !0;
var i = !1, o = r.__c.props !== e;
@@ -336,112 +336,112 @@ function Le(e, t, n) {
}
return !i || o;
};
- z.__f = !0;
- var a = z.shouldComponentUpdate, o = z.componentWillUpdate;
- z.componentWillUpdate = function(e, t, n) {
+ B.__f = !0;
+ var a = B.shouldComponentUpdate, o = B.componentWillUpdate;
+ B.componentWillUpdate = function(e, t, n) {
if (this.__e) {
var r = a;
a = void 0, i(e, t, n), a = r;
}
o && o.call(this, e, t, n);
- }, z.shouldComponentUpdate = i;
+ }, B.shouldComponentUpdate = i;
}
return r.__N || r.__;
}
-function Re(e, t) {
- var n = Ie(R++, 3);
- !B.__s && Ge(n.__H, t) && (n.__ = e, n.u = t, z.__H.__h.push(n));
+function U(e, t) {
+ var n = Ie(z++, 3);
+ !V.__s && We(n.__H, t) && (n.__ = e, n.u = t, B.__H.__h.push(n));
}
-function H(e, t) {
- var n = Ie(R++, 4);
- !B.__s && Ge(n.__H, t) && (n.__ = e, n.u = t, z.__h.push(n));
+function W(e, t) {
+ var n = Ie(z++, 4);
+ !V.__s && We(n.__H, t) && (n.__ = e, n.u = t, B.__h.push(n));
}
-function U(e) {
- return Oe = 5, ze(function() {
+function G(e) {
+ return Oe = 5, Re(function() {
return { current: e };
}, []);
}
-function ze(e, t) {
- var n = Ie(R++, 7);
- return Ge(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
+function Re(e, t) {
+ var n = Ie(z++, 7);
+ return We(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
}
-function Be() {
+function ze() {
for (var e; e = ke.shift();) {
var t = e.__H;
if (e.__P && t) try {
- t.__h.some(Ue), t.__h.some(We), t.__h = [];
+ t.__h.some(He), t.__h.some(Ue), t.__h = [];
} catch (n) {
- t.__h = [], B.__e(n, e.__v);
+ t.__h = [], V.__e(n, e.__v);
}
}
}
-B.__b = function(e) {
- z = null, Ae && Ae(e);
-}, B.__ = function(e, t) {
+V.__b = function(e) {
+ B = null, Ae && Ae(e);
+}, V.__ = function(e, t) {
e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Fe && Fe(e, t);
-}, B.__r = function(e) {
- je && je(e), R = 0;
- var t = (z = e.__c).__H;
- t && (Ee === z ? (t.__h = [], z.__h = [], t.__.some(function(e) {
+}, V.__r = function(e) {
+ je && je(e), z = 0;
+ var t = (B = e.__c).__H;
+ t && (Ee === B ? (t.__h = [], B.__h = [], t.__.some(function(e) {
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
- })) : (t.__h.some(Ue), t.__h.some(We), t.__h = [], R = 0)), Ee = z;
-}, B.diffed = function(e) {
+ })) : (t.__h.some(He), t.__h.some(Ue), t.__h = [], z = 0)), Ee = B;
+}, V.diffed = function(e) {
Me && Me(e);
var t = e.__c;
- t && t.__H && (t.__H.__h.length && (ke.push(t) !== 1 && De === B.requestAnimationFrame || ((De = B.requestAnimationFrame) || He)(Be)), t.__H.__.some(function(e) {
+ t && t.__H && (t.__H.__h.length && (ke.push(t) !== 1 && De === V.requestAnimationFrame || ((De = V.requestAnimationFrame) || Ve)(ze)), t.__H.__.some(function(e) {
e.u &&= (e.__H = e.u, void 0);
- })), Ee = z = null;
-}, B.__c = function(e, t) {
+ })), Ee = B = null;
+}, V.__c = function(e, t) {
t.some(function(e) {
try {
- e.__h.some(Ue), e.__h = e.__h.filter(function(e) {
- return !e.__ || We(e);
+ e.__h.some(He), e.__h = e.__h.filter(function(e) {
+ return !e.__ || Ue(e);
});
} catch (n) {
t.some(function(e) {
e.__h &&= [];
- }), t = [], B.__e(n, e.__v);
+ }), t = [], V.__e(n, e.__v);
}
}), Ne && Ne(e, t);
-}, B.unmount = function(e) {
+}, V.unmount = function(e) {
Pe && Pe(e);
var t, n = e.__c;
n && n.__H && (n.__H.__.some(function(e) {
try {
- Ue(e);
+ He(e);
} catch (e) {
t = e;
}
- }), n.__H = void 0, t && B.__e(t, n.__v));
+ }), n.__H = void 0, t && V.__e(t, n.__v));
};
-var Ve = typeof requestAnimationFrame == "function";
-function He(e) {
+var Be = typeof requestAnimationFrame == "function";
+function Ve(e) {
var t, n = function() {
- clearTimeout(r), Ve && cancelAnimationFrame(t), setTimeout(e);
+ clearTimeout(r), Be && cancelAnimationFrame(t), setTimeout(e);
}, r = setTimeout(n, 35);
- Ve && (t = requestAnimationFrame(n));
+ Be && (t = requestAnimationFrame(n));
}
-function Ue(e) {
- var t = z, n = e.__c;
- typeof n == "function" && (e.__c = void 0, n()), z = t;
+function He(e) {
+ var t = B, n = e.__c;
+ typeof n == "function" && (e.__c = void 0, n()), B = t;
}
-function We(e) {
- var t = z;
- e.__c = e.__(), z = t;
+function Ue(e) {
+ var t = B;
+ e.__c = e.__(), B = t;
}
-function Ge(e, t) {
+function We(e, t) {
return !e || e.length !== t.length || t.some(function(t, n) {
return t !== e[n];
});
}
-function Ke(e, t) {
+function Ge(e, t) {
return typeof t == "function" ? t(e) : t;
}
//#endregion
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
-var qe = 0;
+var Ke = 0;
Array.isArray;
-function W(e, t, n, r, i, a) {
+function K(e, t, n, r, i, a) {
t ||= {};
var o, s, c = t;
if ("ref" in c) for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
@@ -456,26 +456,26 @@ function W(e, t, n, r, i, a) {
__e: null,
__c: null,
constructor: void 0,
- __v: --qe,
+ __v: --Ke,
__i: -1,
__u: 0,
__source: i,
__self: a
};
if (typeof e == "function" && (o = e.defaultProps)) for (s in o) c[s] === void 0 && (c[s] = o[s]);
- return m.vnode && m.vnode(l), l;
+ return h.vnode && h.vnode(l), l;
}
//#endregion
//#region src/islands/access-settings.tsx
-function Je({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1 }) {
- return /* @__PURE__ */ W("div", {
+function qe({ id: e, label: t, value: n, onInput: r, error: i, help: a, current: o = !1 }) {
+ return /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ W("label", {
+ /* @__PURE__ */ K("label", {
for: e,
children: t
}),
- /* @__PURE__ */ W("input", {
+ /* @__PURE__ */ K("input", {
id: e,
class: "geist-input",
type: "password",
@@ -487,7 +487,7 @@ function Je({ id: e, label: t, value: n, onInput: r, error: i, help: a, current:
"aria-invalid": !!i,
"aria-describedby": i || a ? `${e}-hint` : void 0
}),
- i || a ? /* @__PURE__ */ W("p", {
+ i || a ? /* @__PURE__ */ K("p", {
id: `${e}-hint`,
class: i ? "configbad" : "confighelp",
role: i ? "alert" : void 0,
@@ -496,50 +496,50 @@ function Je({ id: e, label: t, value: n, onInput: r, error: i, help: a, current:
]
});
}
-function Ye({ initial: e, receipt: t }) {
- let [r, i] = V(e), [a, o] = V(""), [s, l] = V(""), [u, d] = V(""), [f, p] = V(!1), [m, h] = V(""), [g, _] = V({}), v = U(null), y = U(!1), b = U(null);
- return /* @__PURE__ */ W("form", {
+function Je({ initial: e, receipt: t }) {
+ let [n, i] = H(e), [a, o] = H(""), [s, c] = H(""), [u, d] = H(""), [f, p] = H(!1), [m, h] = H(""), [g, _] = H({}), v = G(null), y = G(!1), b = G(null);
+ return /* @__PURE__ */ K("form", {
class: "configfieldset",
onSubmit: async (e) => {
if (e.preventDefault(), y.current) return;
h("");
- let n = {};
- if (r.mode === "password" && !a && (n.current_password = "请输入当前访问密码"), f || ((s.length < 8 || s.length > 256) && (n.password = "访问密码需为 8–256 个字符"), s !== u && (n.confirmation = "两次输入的密码不一致")), _(n), Object.keys(n).length) {
+ let r = {};
+ if (n.mode === "password" && !a && (r.current_password = "请输入当前访问密码"), f || ((s.length < 8 || s.length > 256) && (r.password = "访问密码需为 8–256 个字符"), s !== u && (r.confirmation = "两次输入的密码不一致")), _(r), Object.keys(r).length) {
requestAnimationFrame(() => v.current?.querySelector("[aria-invalid=\"true\"]")?.focus());
return;
}
- y.current = !0, c(b.current, !0);
+ y.current = !0, l(b.current, !0);
try {
- let e = await L("/api/configuration/access", {
- revision: r.revision,
+ let e = await R("/api/configuration/access", {
+ revision: n.revision,
action: f ? "disable" : "set",
confirm_disable: f,
current_password: a,
password: f ? "" : s,
confirmation: f ? "" : u
});
- i(e), o(""), l(""), d(""), p(!1), _({}), t(e.mode === "open" ? "已关闭访问密码" : "已保存访问密码");
+ i(e), o(""), c(""), d(""), p(!1), _({}), t(e.mode === "open" ? "已关闭访问密码" : "已保存访问密码");
} catch (e) {
let t = e instanceof we ? e.body : null, n = t?.errors || t?.detail?.errors;
- n ? _(n) : h(F(e));
+ n ? _(n) : h(I(e));
} finally {
- y.current = !1, c(b.current, !1);
+ y.current = !1, l(b.current, !1);
}
},
"aria-labelledby": "accessTitle",
noValidate: !0,
ref: v,
- children: [/* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ K("div", {
class: "configfieldset-heading",
- children: [/* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: n("accessTitle", "访问密码") } }), /* @__PURE__ */ W("p", {
+ children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: r("accessTitle", "访问密码") } }), /* @__PURE__ */ K("p", {
class: "confighelp",
- children: r.mode === "open" ? "未设置密码,能连接到 Peach 的设备可直接访问。" : r.mode === "legacy" ? "当前使用系统生成的访问口令。你可以设置自己的密码,或关闭登录要求。" : r.mode === "locked" ? "访问设置无法读取,请在本机检查配置文件。" : "已设置密码。新设备需要登录,保持登录时间在登录页选择。"
+ children: n.mode === "open" ? "未设置密码,能连接到 Peach 的设备可直接访问。" : n.mode === "legacy" ? "当前使用系统生成的访问口令。你可以设置自己的密码,或关闭登录要求。" : n.mode === "locked" ? "访问设置无法读取,请在本机检查配置文件。" : "已设置密码。新设备需要登录,保持登录时间在登录页选择。"
})]
}),
- r.mode === "password" ? /* @__PURE__ */ W(Je, {
+ n.mode === "password" ? /* @__PURE__ */ K(qe, {
id: "access-current",
label: "当前访问密码",
value: a,
@@ -547,46 +547,46 @@ function Ye({ initial: e, receipt: t }) {
error: g.current_password,
current: !0
}) : null,
- !f && r.mode !== "locked" ? /* @__PURE__ */ W(M, { children: [/* @__PURE__ */ W(Je, {
+ !f && n.mode !== "locked" ? /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K(qe, {
id: "access-password",
- label: r.mode === "password" ? "新访问密码" : "设置访问密码",
+ label: n.mode === "password" ? "新访问密码" : "设置访问密码",
value: s,
- onInput: l,
+ onInput: c,
error: g.password,
help: "至少 8 个字符。保存后其他设备需要重新登录。"
- }), /* @__PURE__ */ W(Je, {
+ }), /* @__PURE__ */ K(qe, {
id: "access-confirm",
label: "确认访问密码",
value: u,
onInput: d,
error: g.confirmation
})] }) : null,
- r.mode === "password" || r.mode === "legacy" ? /* @__PURE__ */ W("label", {
+ n.mode === "password" || n.mode === "legacy" ? /* @__PURE__ */ K("label", {
class: "configcheck",
- children: [/* @__PURE__ */ W("span", {
+ children: [/* @__PURE__ */ K("span", {
class: "pcheck",
- children: [/* @__PURE__ */ W("input", {
+ children: [/* @__PURE__ */ K("input", {
type: "checkbox",
checked: f,
onChange: (e) => p(e.currentTarget.checked)
- }), /* @__PURE__ */ W("span", {
+ }), /* @__PURE__ */ K("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ W("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ W("use", { href: "#i-check" })
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ W("span", { children: "关闭访问密码,允许能连接到 Peach 的设备直接访问" })]
+ }), /* @__PURE__ */ K("span", { children: "关闭访问密码,允许能连接到 Peach 的设备直接访问" })]
}) : null,
- m ? /* @__PURE__ */ W("p", {
+ m ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: m
}) : null
]
- }), r.mode === "locked" ? null : /* @__PURE__ */ W("div", {
+ }), n.mode === "locked" ? null : /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
- children: [/* @__PURE__ */ W("p", { children: "保存后立即生效。" }), /* @__PURE__ */ W("button", {
+ children: [/* @__PURE__ */ K("p", { children: "保存后立即生效。" }), /* @__PURE__ */ K("button", {
class: "geist-button primary",
type: "submit",
ref: b,
@@ -597,7 +597,7 @@ function Ye({ initial: e, receipt: t }) {
}
//#endregion
//#region src/jobs.ts
-async function Xe(e) {
+async function Ye(e) {
let t = e.pause || ((e) => new Promise((t) => setTimeout(t, e))), n = 0;
for (; e.active();) {
let r;
@@ -612,11 +612,11 @@ async function Xe(e) {
await t(2e3);
}
}
-function Ze(e) {
+function Xe(e) {
let t = document.createElement("div");
e.host.hidden = !0, t.dataset.followJob = "", t.setAttribute("aria-live", "polite"), e.host.prepend(t);
let n = e.storageKey || "peach-follow-job", r = sessionStorage.getItem(n) || void 0, i = !1;
- Xe({
+ Ye({
read: e.read,
active: () => !i && e.active() && t.isConnected,
keepWatching: e.watchIdle !== !1,
@@ -642,65 +642,65 @@ function Ze(e) {
}
//#endregion
//#region src/islands/library-processing.tsx
-var Qe = (e, t) => I("/api/library-processing", t);
-function $e({ data: e, error: t, toast: o, onComplete: s, mode: l, monitor: u }) {
- let [d, f] = V(e || { status: "idle" }), [p, m] = V(t), [h, g] = V(!1), [_, v] = V(!1), y = U(new AbortController()), b = U(0), x = U(d.status), S = U(null), C = h || d.status === "running";
- H(() => c(S.current, C), [C]);
+var Ze = (e, t) => L("/api/library-processing", t);
+function Qe({ data: e, error: t, toast: n, onComplete: s, mode: c, monitor: u }) {
+ let [d, f] = H(e || { status: "idle" }), [p, m] = H(t), [h, g] = H(!1), [_, v] = H(!1), y = G(new AbortController()), b = G(0), x = G(d.status), S = G(null), C = h || d.status === "running";
+ W(() => l(S.current, C), [C]);
async function w() {
let e = ++b.current;
- await Xe({
- read: (e) => I("/api/library-processing", e),
+ await Ye({
+ read: (e) => L("/api/library-processing", e),
active: () => !y.current.signal.aborted && b.current === e,
- keepWatching: l === "notice" || !!u,
+ keepWatching: c === "notice" || !!u,
render: (e) => {
- f(e), m(""), e.status === "complete" && x.current === "running" && l !== "notice" && (v(!0), o("已完成扫描与资料采集")), x.current === "running" && (e.status === "complete" || e.status === "failed") && s?.(), x.current = e.status;
+ f(e), m(""), e.status === "complete" && x.current === "running" && c !== "notice" && (v(!0), n("已完成扫描与资料采集")), x.current === "running" && (e.status === "complete" || e.status === "failed") && s?.(), x.current = e.status;
},
disconnected: () => m("连接中断,正在重新读取处理进度")
});
}
- Re(() => ((d.status === "running" || l === "notice" || u) && w(), () => y.current.abort()), []);
+ U(() => ((d.status === "running" || c === "notice" || u) && w(), () => y.current.abort()), []);
async function T() {
if (!C) {
g(!0), m(""), v(!1);
try {
- let e = await L("/api/library-processing", {}, "POST", y.current.signal);
+ let e = await R("/api/library-processing", {}, "POST", y.current.signal);
if (y.current.signal.aborted) return;
x.current = e.status, f(e), g(!1), await w();
} catch (e) {
- y.current.signal.aborted || (m(F(e)), g(!1));
+ y.current.signal.aborted || (m(I(e)), g(!1));
}
}
}
- return l === "notice" ? !p && d.status !== "running" && d.status !== "failed" ? null : /* @__PURE__ */ W("div", {
+ return c === "notice" ? !p && d.status !== "running" && d.status !== "failed" ? null : /* @__PURE__ */ K("div", {
class: "library-processing-banner",
role: "status",
- children: [/* @__PURE__ */ W("span", { children: p || (d.status === "failed" ? "扫描与资料采集未完成" : `${d.stage || "正在整理馆藏"}${d.total ? ` · ${d.checked || 0} / ${d.total}` : ""}`) }), /* @__PURE__ */ W("a", {
+ children: [/* @__PURE__ */ K("span", { children: p || (d.status === "failed" ? "扫描与资料采集未完成" : `${d.stage || "正在整理馆藏"}${d.total ? ` · ${d.checked || 0} / ${d.total}` : ""}`) }), /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/configuration#libraryProcessing",
children: p || d.status === "failed" ? "查看并处理" : "查看进度"
})]
- }) : /* @__PURE__ */ W(M, { children: [/* @__PURE__ */ W("div", {
+ }) : /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content library-processing",
children: [
- /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: n("cleanupScrapingTitle", "扫描与采集") } }),
- /* @__PURE__ */ W("p", { children: "扫描媒体文件夹,导入已有资料,采集缺失信息。" }),
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: r("cleanupScrapingTitle", "扫描与采集") } }),
+ /* @__PURE__ */ K("p", { children: "扫描媒体文件夹,导入已有资料,采集缺失信息。" }),
+ /* @__PURE__ */ K("div", {
"aria-live": "polite",
children: [
- d.status === "running" && /* @__PURE__ */ W(M, { children: [/* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: r(`${d.stage || "正在处理"}${d.total ? ` · ${d.checked || 0} / ${d.total}` : ""}`) } }), !!d.total && /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: a(`已处理 ${d.checked || 0} / ${d.total} 个视频`, d.checked || 0, d.total) } })] }),
- (p || d.status === "failed") && /* @__PURE__ */ W("div", {
+ d.status === "running" && /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: i(`${d.stage || "正在处理"}${d.total ? ` · ${d.checked || 0} / ${d.total}` : ""}`) } }), !!d.total && /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: o(`已处理 ${d.checked || 0} / ${d.total} 个视频`, d.checked || 0, d.total) } })] }),
+ (p || d.status === "failed") && /* @__PURE__ */ K("div", {
role: "alert",
- dangerouslySetInnerHTML: { __html: i(p || d.error || "处理未完成,请重试", { variant: "error" }) }
+ dangerouslySetInnerHTML: { __html: a(p || d.error || "处理未完成,请重试", { variant: "error" }) }
}),
- d.status === "failed" && !!d.issues?.length && /* @__PURE__ */ W("ul", { children: d.issues.slice(0, 20).map((e) => /* @__PURE__ */ W("li", { children: [
- e.asset_id ? /* @__PURE__ */ W("a", {
+ d.status === "failed" && !!d.issues?.length && /* @__PURE__ */ K("ul", { children: d.issues.slice(0, 20).map((e) => /* @__PURE__ */ K("li", { children: [
+ e.asset_id ? /* @__PURE__ */ K("a", {
href: `/item/${e.asset_id}`,
children: "查看视频"
}) : null,
e.asset_id ? ":" : "",
e.message
] })) }),
- _ && /* @__PURE__ */ W("p", { children: [
+ _ && /* @__PURE__ */ K("p", { children: [
"已扫描 ",
d.scanned || 0,
" 个文件,识别 ",
@@ -712,21 +712,21 @@ function $e({ data: e, error: t, toast: o, onComplete: s, mode: l, monitor: u })
]
})
]
- }), /* @__PURE__ */ W("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ W("a", {
+ /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/scraping",
children: "采集来源"
}),
- !!d.candidates && /* @__PURE__ */ W("a", {
+ !!d.candidates && /* @__PURE__ */ K("a", {
class: "geist-button",
href: "/review",
children: "复核资料"
}),
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ K("button", {
ref: S,
type: "button",
class: "geist-button primary",
@@ -737,36 +737,196 @@ function $e({ data: e, error: t, toast: o, onComplete: s, mode: l, monitor: u })
})] });
}
//#endregion
+//#region src/islands/release-updates.tsx
+var $e = /* @__PURE__ */ new Set([
+ "downloading",
+ "verifying",
+ "extracting",
+ "preparing",
+ "restarting",
+ "installing"
+]);
+function et({ initial: e, initialJob: n }) {
+ let [i, a] = H(e), [s, c] = H(n || {
+ state: "idle",
+ progress: 0
+ }), [u, d] = H(""), f = G(null), p = G(!0), m = G(!1), h = G(null);
+ U(() => {
+ l(h.current, $e.has(s.state));
+ }, [s.state]), U(() => () => {
+ p.current = !1, f.current?.abort();
+ }, []);
+ let g = async () => {
+ let e = await R("/api/configuration/update-restart", {});
+ p.current && c(e);
+ };
+ U(() => {
+ s.state !== "ready" || m.current || (m.current = !0, t({
+ title: "更新已准备好",
+ body: `Peach ${s.version || ""} 将在重启后安装。`,
+ confirmLabel: "立即重启",
+ cancelLabel: "稍后",
+ onConfirm: g
+ }));
+ }, [s.state]), U(() => {
+ if (!$e.has(s.state)) return;
+ let e = new AbortController(), t, n = 0, r = async () => {
+ try {
+ let t = await L("/api/configuration/update-status", e.signal);
+ e.signal.aborted || (c(t), n = 0, t.state === "complete" && a((e) => ({
+ ...e,
+ current_version: t.version || e.current_version,
+ state: "current",
+ message: "已是最新测试版。"
+ })));
+ } catch {
+ ++n >= 120 && !e.signal.aborted && d("尚未连接到 Peach,请检查托盘后刷新页面。");
+ }
+ !e.signal.aborted && n < 120 && (t = setTimeout(r, 1e3));
+ };
+ return t = setTimeout(r, 1e3), () => {
+ e.abort(), clearTimeout(t);
+ };
+ }, [s.state]);
+ let _ = async (e) => {
+ if (f.current || $e.has(s.state)) return;
+ let t = new AbortController();
+ f.current = t, m.current = !1, d(""), l(e, !0);
+ try {
+ let e = await R("/api/configuration/update", {}, "POST", t.signal);
+ t.signal.aborted || c(e);
+ } catch (e) {
+ t.signal.aborted || d(I(e));
+ } finally {
+ f.current = null, l(e, !1);
+ }
+ }, v = async (t) => {
+ if (f.current) return;
+ let n = new AbortController();
+ f.current = n, l(t, !0), d("");
+ try {
+ let e = await L("/api/configuration/updates", n.signal);
+ n.signal.aborted || a(e);
+ } catch (t) {
+ n.signal.aborted || (a({
+ ...e,
+ state: "error"
+ }), d(I(t)));
+ } finally {
+ f.current = null, l(t, !1);
+ }
+ };
+ return /* @__PURE__ */ K("section", {
+ class: "configfieldset",
+ "data-geist-fieldset": !0,
+ "aria-labelledby": "configUpdatesTitle",
+ children: [/* @__PURE__ */ K("div", {
+ class: "geist-fieldset-content",
+ children: [
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: r("configUpdatesTitle", "检查更新") } }),
+ /* @__PURE__ */ K("dl", {
+ class: "configfacts",
+ children: [
+ /* @__PURE__ */ K("dt", { children: "当前版本" }),
+ /* @__PURE__ */ K("dd", { children: i.current_version }),
+ /* @__PURE__ */ K("dt", { children: "安装方式" }),
+ /* @__PURE__ */ K("dd", { children: i.installation }),
+ /* @__PURE__ */ K("dt", { children: "更新通道" }),
+ /* @__PURE__ */ K("dd", { children: i.channel }),
+ /* @__PURE__ */ K("dt", { children: "最新版本" }),
+ /* @__PURE__ */ K("dd", { children: i.latest_version || (i.state === "unchecked" ? "尚未检查" : "未取得") })
+ ]
+ }),
+ /* @__PURE__ */ K("p", {
+ class: u || i.state === "error" ? "configbad" : "confighelp",
+ role: u || i.state === "error" ? "alert" : "status",
+ children: u || i.message
+ }),
+ s.state === "idle" ? null : /* @__PURE__ */ K("div", {
+ "aria-live": "polite",
+ children: [/* @__PURE__ */ K("p", {
+ class: s.state === "error" ? "configbad" : "confighelp",
+ children: s.message
+ }), s.state === "error" ? null : /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: o(s.state === "downloading" ? "下载进度" : "安装进度", s.state === "downloading" ? s.downloaded || 0 : s.progress, s.state === "downloading" ? s.total || 1 : 100) } }), /* @__PURE__ */ K("p", {
+ class: "confighelp",
+ children: s.state === "downloading" && s.total ? `${((s.downloaded || 0) / 1048576).toFixed(1)} / ${(s.total / 1048576).toFixed(1)} MB` : `${s.progress}%`
+ })] })]
+ })
+ ]
+ }), /* @__PURE__ */ K("div", {
+ class: "geist-fieldset-footer",
+ "data-geist-fieldset-footer": !0,
+ children: [
+ /* @__PURE__ */ K("a", {
+ class: "geist-button",
+ href: i.release_url,
+ target: "_blank",
+ rel: "noreferrer",
+ children: "查看发布页"
+ }),
+ s.state === "ready" ? /* @__PURE__ */ K("button", {
+ type: "button",
+ class: "geist-button primary",
+ onClick: () => {
+ t({
+ title: "更新已准备好",
+ body: `Peach ${s.version || ""} 将在重启后安装。`,
+ confirmLabel: "立即重启",
+ cancelLabel: "稍后",
+ onConfirm: g
+ });
+ },
+ children: "重启安装"
+ }) : null,
+ i.state === "available" && i.installation === "独立测试包" && s.state !== "ready" ? /* @__PURE__ */ K("button", {
+ ref: h,
+ type: "button",
+ class: "geist-button primary",
+ onClick: (e) => _(e.currentTarget),
+ children: "下载并安装"
+ }) : null,
+ /* @__PURE__ */ K("button", {
+ type: "button",
+ class: "geist-button",
+ disabled: $e.has(s.state),
+ onClick: (e) => v(e.currentTarget),
+ children: "检查更新"
+ })
+ ]
+ })]
+ });
+}
+//#endregion
//#region src/islands/configuration.tsx
-var et = "/api/configuration", tt = "/api/pick-folder", nt = 8e3, rt = (e, t) => Promise.all([I(et, t), I("/api/library-processing", t).catch((e) => ({
+var tt = "/api/configuration", nt = "/api/pick-folder", rt = 8e3, it = (e, t) => Promise.all([L(tt, t), L("/api/library-processing", t).catch((e) => ({
status: "failed",
- error: F(e)
+ error: I(e)
}))]).then(([e, t]) => ({
...e,
processing: t
-})), G = ({ html: e, class: t }) => /* @__PURE__ */ W("div", {
+})), q = ({ html: e, class: t }) => /* @__PURE__ */ K("div", {
class: t,
dangerouslySetInnerHTML: { __html: e }
-}), it = (e) => !(e instanceof we) || e.status !== 400 ? null : e.body?.errors ?? null;
-function at({ facts: e }) {
- return /* @__PURE__ */ W("section", {
+}), at = (e) => !(e instanceof we) || e.status !== 400 ? null : e.body?.errors ?? null;
+function ot({ facts: e }) {
+ return /* @__PURE__ */ K("section", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configFactsTitle",
- children: /* @__PURE__ */ W("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
- children: [/* @__PURE__ */ W(G, { html: n("configFactsTitle", "运行信息") }), /* @__PURE__ */ W("dl", {
+ children: [/* @__PURE__ */ K(q, { html: r("configFactsTitle", "运行信息") }), /* @__PURE__ */ K("dl", {
class: "configfacts",
- children: e.map((e) => /* @__PURE__ */ W(M, { children: [/* @__PURE__ */ W("dt", { children: e.term }), /* @__PURE__ */ W("dd", { children: [e.value, e.download_url ? /* @__PURE__ */ W("span", {
+ children: e.map((e) => /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("dt", { children: e.term }), /* @__PURE__ */ K("dd", { children: [e.value, e.download_url ? /* @__PURE__ */ K("span", {
class: "confighelp",
- children: [" ", /* @__PURE__ */ W("a", {
+ children: [" ", /* @__PURE__ */ K("a", {
href: e.download_url,
target: "_blank",
rel: "noreferrer",
- children: [e.download_label, /* @__PURE__ */ W("svg", {
+ children: [e.download_label, /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ W("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})]
})]
}) : null] })] }))
@@ -774,57 +934,57 @@ function at({ facts: e }) {
})
});
}
-function ot({ data: t }) {
- let [r, i] = V(t.media_sources), [a, o] = V(""), l = U(null);
- Re(() => () => l.current?.abort(), []);
+function st({ data: t }) {
+ let [n, i] = H(t.media_sources), [a, o] = H(""), s = G(null);
+ U(() => () => s.current?.abort(), []);
let u = async (e) => {
- if (l.current) return;
+ if (s.current) return;
let t = new AbortController();
- l.current = t, c(e, !0), o("");
+ s.current = t, l(e, !0), o("");
try {
- let e = await I(et, t.signal);
+ let e = await L(tt, t.signal);
t.signal.aborted || i(e.media_sources);
} catch (e) {
- t.signal.aborted || o(F(e));
+ t.signal.aborted || o(I(e));
} finally {
- l.current = null, c(e, !1);
+ s.current = null, l(e, !1);
}
};
- return r ? /* @__PURE__ */ W("section", {
+ return n ? /* @__PURE__ */ K("section", {
class: "configfieldset",
"aria-labelledby": "configMountsTitle",
- children: [/* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ W(G, { html: n("configMountsTitle", "挂载状态") }),
- /* @__PURE__ */ W("dl", {
+ /* @__PURE__ */ K(q, { html: r("configMountsTitle", "挂载状态") }),
+ /* @__PURE__ */ K("dl", {
class: "configfacts",
- children: r.map((t) => /* @__PURE__ */ W(M, { children: [/* @__PURE__ */ W("dt", { children: [/* @__PURE__ */ W("span", {
+ children: n.map((t) => /* @__PURE__ */ K(N, { children: [/* @__PURE__ */ K("dt", { children: [/* @__PURE__ */ K("span", {
"aria-hidden": "true",
- dangerouslySetInnerHTML: { __html: s(e[t.location]) }
+ dangerouslySetInnerHTML: { __html: c(e[t.location]) }
}), {
local: "本地磁盘",
115: "CloudDrive · 115",
pikpak: "CloudDrive · PikPak"
- }[t.location] || t.location] }), /* @__PURE__ */ W("dd", { children: [
+ }[t.location] || t.location] }), /* @__PURE__ */ K("dd", { children: [
t.path || "未配置挂载点",
" ",
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ K("span", {
class: `configstatus ${t.online === !0 ? "online" : t.online === !1 ? "offline" : "unknown"}`,
children: t.online === !0 ? "在线" : t.online === !1 ? "离线" : "未检测"
})
] })] }))
}),
- a ? /* @__PURE__ */ W("p", {
+ a ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: a
}) : null
]
- }), /* @__PURE__ */ W("div", {
+ }), /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: /* @__PURE__ */ W("button", {
+ children: /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button",
onClick: (e) => u(e.currentTarget),
@@ -833,11 +993,11 @@ function ot({ data: t }) {
})]
}) : null;
}
-function st({ value: t, label: n, onChange: r }) {
- let i = U(null), a = U(null), s = U(r);
- return s.current = r, H(() => {
+function ct({ value: t, label: n, onChange: r }) {
+ let i = G(null), a = G(null), o = G(r);
+ return o.current = r, W(() => {
let r = i.current;
- r.innerHTML = o([
+ r.innerHTML = s([
["local", "本地磁盘"],
["115", "CloudDrive · 115"],
["pikpak", "CloudDrive · PikPak"]
@@ -846,88 +1006,88 @@ function st({ value: t, label: n, onChange: r }) {
n,
e[t]
]), t, { label: n });
- let c = l(r.firstElementChild);
+ let c = u(r.firstElementChild);
a.current = c;
- let u = () => s.current(c.value);
- return c.addEventListener("change", u), () => {
- a.current = null, c.disabled = !0, c.removeEventListener("change", u), r.replaceChildren();
+ let l = () => o.current(c.value);
+ return c.addEventListener("change", l), () => {
+ a.current = null, c.disabled = !0, c.removeEventListener("change", l), r.replaceChildren();
};
- }, [n]), H(() => {
+ }, [n]), W(() => {
a.current && (a.current.value = t);
- }, [t]), /* @__PURE__ */ W("div", {
+ }, [t]), /* @__PURE__ */ K("div", {
ref: i,
class: "configsourcecontrol"
});
}
-function ct({ data: e, receipt: t }) {
- let r = e.media_sources?.filter((e) => [
+function lt({ data: e, receipt: t }) {
+ let n = e.media_sources?.filter((e) => [
"local",
"115",
"pikpak"
- ].includes(e.location)), [a, o] = V(r?.length ? r.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [s, l] = V(r?.map((e) => e.location) ?? []), [u, d] = V(r?.map((e) => e.root) ?? []), [f, p] = V(String(e.port)), [m, h] = V(!1), [g, _] = V([]), [v, y] = V(""), [b, x] = V(""), [S, C] = V(null), [w, T] = V(null), E = U(!1), D = U(e.revision), O = U([]), k = U(null);
- H(() => {
+ ].includes(e.location)), [i, o] = H(n?.length ? n.map((e) => e.path) : e.media_dirs.length ? e.media_dirs : [""]), [s, c] = H(n?.map((e) => e.location) ?? []), [u, d] = H(n?.map((e) => e.root) ?? []), [f, p] = H(String(e.port)), [m, h] = H(!1), [g, _] = H([]), [v, y] = H(""), [b, x] = H(""), [S, C] = H(null), [w, T] = H(null), E = G(!1), D = G(e.revision), O = G([]), k = G(null);
+ W(() => {
w !== null && (O.current[w]?.focus(), T(null));
- }, [w]), Re(() => {
+ }, [w]), U(() => {
if (!S) return;
- let e = setTimeout(() => location.assign(S.url), nt);
+ let e = setTimeout(() => location.assign(S.url), rt);
return () => clearTimeout(e);
}, [S]);
- let ee = (e, t) => {
+ let A = (e, t) => {
o((n) => n.map((n, r) => r === e ? t : n));
- }, te = () => {
- T(a.length), o((e) => [...e, ""]);
- }, A = (e) => {
- l((t) => t.filter((t, n) => n !== e)), d((t) => t.filter((t, n) => n !== e)), o((t) => t.filter((t, n) => n !== e)), _((t) => t.filter((t, n) => n !== e));
- }, j = (e, t) => {
+ }, ee = () => {
+ T(i.length), o((e) => [...e, ""]);
+ }, j = (e) => {
+ c((t) => t.filter((t, n) => n !== e)), d((t) => t.filter((t, n) => n !== e)), o((t) => t.filter((t, n) => n !== e)), _((t) => t.filter((t, n) => n !== e));
+ }, M = (e, t) => {
_((n) => {
let r = [...n];
for (; r.length <= e;) r.push("");
return r[e] = t, r;
});
- }, ne = async (e, t) => {
+ }, te = async (e, t) => {
if (t.getAttribute("aria-busy") !== "true") {
- c(t, !0);
+ l(t, !0);
try {
- let { path: t } = await L(tt, { initial: a[e] ?? "" });
- t && (ee(e, t), j(e, ""));
+ let { path: t } = await R(nt, { initial: i[e] ?? "" });
+ t && (A(e, t), M(e, ""));
} catch (t) {
- j(e, F(t));
+ M(e, I(t));
} finally {
- c(t, !1);
+ l(t, !1);
}
}
};
- return S ? /* @__PURE__ */ W("div", {
+ return S ? /* @__PURE__ */ K("div", {
class: "configsaved",
role: "status",
- children: /* @__PURE__ */ W("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-note geist-note-success",
role: "note",
- children: [/* @__PURE__ */ W("svg", {
+ children: [/* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ W("use", { href: "#i-check" })
- }), /* @__PURE__ */ W("p", { children: /* @__PURE__ */ W("span", { children: [
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
+ }), /* @__PURE__ */ K("p", { children: /* @__PURE__ */ K("span", { children: [
"配置已保存,Peach 正在重新启动。稍后自动跳转,或点击",
- /* @__PURE__ */ W("a", {
+ /* @__PURE__ */ K("a", {
href: S.url,
children: "进入馆藏"
}),
"。"
] }) })]
})
- }) : /* @__PURE__ */ W("form", {
+ }) : /* @__PURE__ */ K("form", {
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "configTitle",
onSubmit: async (n) => {
if (n.preventDefault(), !E.current) {
- E.current = !0, c(k.current, !0), x("");
+ E.current = !0, l(k.current, !0), x("");
try {
- let n = await L(et, {
+ let n = await R(tt, {
revision: D.current,
- media_dirs: a,
- ...e.media_sources ? { media_sources: a.map((e, t) => ({
+ media_dirs: i,
+ ...e.media_sources ? { media_sources: i.map((e, t) => ({
path: e,
location: s[t] || "local",
root: u[t] || ""
@@ -937,83 +1097,83 @@ function ct({ data: e, receipt: t }) {
});
D.current = n.revision, _([]), y(""), t("已保存配置"), C(n);
} catch (e) {
- let t = it(e);
- t ? (_(t.media_dirs ?? []), y(t.port ?? "")) : (_([]), y(""), x(F(e)));
+ let t = at(e);
+ t ? (_(t.media_dirs ?? []), y(t.port ?? "")) : (_([]), y(""), x(I(e)));
} finally {
- E.current = !1, c(k.current, !1);
+ E.current = !1, l(k.current, !1);
}
}
},
noValidate: !0,
- children: [/* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content",
children: [
- /* @__PURE__ */ W(G, { html: n("configTitle", "这台电脑") }),
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ K(q, { html: r("configTitle", "这台电脑") }),
+ /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ K("span", {
class: "configlabel",
id: "configDirsLabel",
children: "媒体文件夹"
}),
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ K("div", {
class: "configdirs",
role: "group",
"aria-labelledby": "configDirsLabel",
- children: a.map((t, n) => /* @__PURE__ */ W("div", {
+ children: i.map((t, n) => /* @__PURE__ */ K("div", {
class: "configdir",
children: [
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ K("span", {
class: "configpathlabel",
children: ["本机文件夹 ", n + 1]
}),
- /* @__PURE__ */ W("input", {
+ /* @__PURE__ */ K("input", {
class: "geist-input",
type: "text",
value: t,
"aria-label": `媒体文件夹 ${n + 1}`,
"aria-invalid": g[n] ? "true" : void 0,
- onInput: (e) => ee(n, e.currentTarget.value),
+ onInput: (e) => A(n, e.currentTarget.value),
ref: (e) => {
O.current[n] = e;
}
}),
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configpick",
"aria-label": "选择文件夹",
- onClick: (e) => ne(n, e.currentTarget),
- children: /* @__PURE__ */ W("svg", {
+ onClick: (e) => te(n, e.currentTarget),
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ W("use", { href: "#i-folder-search" })
+ children: /* @__PURE__ */ K("use", { href: "#i-folder-search" })
})
}),
- a.length > 1 ? /* @__PURE__ */ W("button", {
+ i.length > 1 ? /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configrm",
"aria-label": "移除这个文件夹",
- onClick: () => A(n),
- children: /* @__PURE__ */ W("svg", {
+ onClick: () => j(n),
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
"aria-hidden": "true",
- children: /* @__PURE__ */ W("use", { href: "#i-x" })
+ children: /* @__PURE__ */ K("use", { href: "#i-x" })
})
}) : null,
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ K("div", {
class: "configsource",
- children: [/* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "configsourcelabel",
- children: ["媒体来源", /* @__PURE__ */ W(st, {
+ children: ["媒体来源", /* @__PURE__ */ K(ct, {
label: `媒体来源 ${n + 1}`,
value: s[n] || "local",
onChange: (e) => {
let t = [...s];
- t[n] = e, l(t);
+ t[n] = e, c(t);
}
})]
- }), e.windows === !1 ? /* @__PURE__ */ W("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ W("input", {
+ }), e.windows === !1 ? /* @__PURE__ */ K("label", { children: ["Windows 中的对应路径", /* @__PURE__ */ K("input", {
class: "geist-input",
"aria-label": `Windows 中的对应路径 ${n + 1}`,
value: u[n] || "",
@@ -1024,7 +1184,7 @@ function ct({ data: e, receipt: t }) {
}
})] }) : null]
}),
- g[n] ? /* @__PURE__ */ W("p", {
+ g[n] ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: g[n]
@@ -1032,61 +1192,61 @@ function ct({ data: e, receipt: t }) {
]
}, n))
}),
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ K("button", {
type: "button",
class: "geist-button configadd",
- onClick: te,
+ onClick: ee,
children: "添加文件夹"
}),
- s.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ W("p", {
+ s.some((e) => e === "115" || e === "pikpak") ? /* @__PURE__ */ K("p", {
class: "confighelp",
- children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ W("a", {
+ children: ["先在 CloudDrive 登录网盘并完成挂载。", /* @__PURE__ */ K("a", {
href: "https://www.clouddrive2.com/help.html",
target: "_blank",
rel: "noreferrer",
- children: ["挂载帮助", /* @__PURE__ */ W("svg", {
+ children: ["挂载帮助", /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ W("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})]
})]
}) : null,
- s.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ W("p", {
+ s.some((e) => e === "115" || e === "pikpak") ? e.mount_dependencies?.filter((e) => !e.available).map((e) => /* @__PURE__ */ K("p", {
class: "confighelp",
children: [
"未检测到 ",
e.name,
"。",
- /* @__PURE__ */ W("a", {
+ /* @__PURE__ */ K("a", {
href: e.download_url,
target: "_blank",
rel: "noreferrer",
children: [
"下载 ",
e.name,
- /* @__PURE__ */ W("svg", {
+ /* @__PURE__ */ K("svg", {
"aria-hidden": "true",
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ W("use", { href: "#i-external-link" })
+ children: /* @__PURE__ */ K("use", { href: "#i-external-link" })
})
]
})
]
})) : null,
- e.windows === !1 ? /* @__PURE__ */ W("p", {
+ e.windows === !1 ? /* @__PURE__ */ K("p", {
class: "confighelp",
children: "本机文件夹是这台电脑读取媒体的位置。Windows 中的对应路径用于匹配馆藏中已有的路径,例如 B:\\ 对应本机挂载文件夹。"
}) : null
]
}),
- e.port_editable === !1 ? null : /* @__PURE__ */ W("div", {
+ e.port_editable === !1 ? null : /* @__PURE__ */ K("div", {
class: "configfield",
children: [
- /* @__PURE__ */ W("label", {
+ /* @__PURE__ */ K("label", {
for: "configPort",
children: "本机访问端口"
}),
- /* @__PURE__ */ W("input", {
+ /* @__PURE__ */ K("input", {
id: "configPort",
class: "geist-input",
type: "text",
@@ -1095,43 +1255,43 @@ function ct({ data: e, receipt: t }) {
"aria-invalid": v ? "true" : void 0,
onInput: (e) => p(e.currentTarget.value)
}),
- v ? /* @__PURE__ */ W("p", {
+ v ? /* @__PURE__ */ K("p", {
class: "configbad",
role: "alert",
children: v
}) : null,
- /* @__PURE__ */ W("p", {
+ /* @__PURE__ */ K("p", {
class: "confighelp",
children: "浏览器地址里冒号后面的数字,一般不用改。"
})
]
}),
- /* @__PURE__ */ W("label", {
+ /* @__PURE__ */ K("label", {
class: "configcheck",
- children: [/* @__PURE__ */ W("span", {
+ children: [/* @__PURE__ */ K("span", {
class: "pcheck",
- children: [/* @__PURE__ */ W("input", {
+ children: [/* @__PURE__ */ K("input", {
type: "checkbox",
checked: m,
onChange: (e) => h(e.currentTarget.checked)
- }), /* @__PURE__ */ W("span", {
+ }), /* @__PURE__ */ K("span", {
"aria-hidden": "true",
- children: /* @__PURE__ */ W("svg", {
+ children: /* @__PURE__ */ K("svg", {
viewBox: "0 0 24 24",
- children: /* @__PURE__ */ W("use", { href: "#i-check" })
+ children: /* @__PURE__ */ K("use", { href: "#i-check" })
})
})]
- }), /* @__PURE__ */ W("span", { children: "保存后扫描并补全资料" })]
+ }), /* @__PURE__ */ K("span", { children: "保存后扫描并补全资料" })]
}),
- b ? /* @__PURE__ */ W(G, { html: i(b, {
+ b ? /* @__PURE__ */ K(q, { html: a(b, {
variant: "error",
label: "没有保存"
}) }) : null
]
- }), /* @__PURE__ */ W("div", {
+ }), /* @__PURE__ */ K("div", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
- children: [/* @__PURE__ */ W("p", { children: e.port_editable === !1 ? "保存后 Peach 会重新载入配置。" : "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ W("button", {
+ children: [/* @__PURE__ */ K("p", { children: e.port_editable === !1 ? "保存后 Peach 会重新载入配置。" : "保存后 Peach 会重新启动,端口改了就用新地址打开。" }), /* @__PURE__ */ K("button", {
type: "submit",
class: "geist-button primary",
ref: k,
@@ -1140,63 +1300,67 @@ function ct({ data: e, receipt: t }) {
})]
});
}
-function lt({ receipt: e, data: t, error: n }) {
- return n || !t ? /* @__PURE__ */ W(G, {
+function ut({ receipt: e, data: t, error: n }) {
+ return n || !t ? /* @__PURE__ */ K(q, {
class: "configpage",
- html: i(n || "没有读到配置", {
+ html: a(n || "没有读到配置", {
variant: "error",
label: "打不开配置"
})
- }) : /* @__PURE__ */ W("div", {
+ }) : /* @__PURE__ */ K("div", {
class: "configpage",
children: [
- t.editable ? /* @__PURE__ */ W(ct, {
+ t.editable ? /* @__PURE__ */ K(lt, {
data: t,
receipt: e
- }) : /* @__PURE__ */ W(G, { html: i(t.notice, {
+ }) : /* @__PURE__ */ K(q, { html: a(t.notice, {
variant: "secondary",
label: "只读"
}) }),
- t.access ? /* @__PURE__ */ W(Ye, {
+ t.access ? /* @__PURE__ */ K(Je, {
initial: t.access,
receipt: e
}) : null,
- /* @__PURE__ */ W("section", {
+ /* @__PURE__ */ K("section", {
id: "libraryProcessing",
class: "configfieldset",
"data-geist-fieldset": !0,
"aria-labelledby": "cleanupScrapingTitle",
- children: /* @__PURE__ */ W($e, {
+ children: /* @__PURE__ */ K(Qe, {
data: t.processing || { status: "idle" },
error: "",
toast: e,
monitor: !0
})
}),
- /* @__PURE__ */ W(at, { facts: t.facts }),
- /* @__PURE__ */ W(ot, { data: t })
+ t.updates ? /* @__PURE__ */ K(et, {
+ initial: t.updates,
+ initialJob: t.update_job
+ }) : null,
+ /* @__PURE__ */ K(ot, { facts: t.facts }),
+ /* @__PURE__ */ K(st, { data: t })
]
});
}
//#endregion
//#region node_modules/@preact/signals-core/dist/signals-core.module.js
-var ut = Symbol.for("preact-signals");
-function dt() {
+var dt = Symbol.for("preact-signals");
+function ft() {
if (Y > 1) Y--;
else {
var e, t = !1;
for ((function() {
- var e = _t;
- for (_t = void 0; e !== void 0;) {
+ var e = bt;
+ for (bt = void 0; e !== void 0;) {
var t = e.S;
if (t.v === e.v) for (var n = t.t; n !== void 0; n = n.x) n.i === e.i && (n.i = t.i);
e = e.o;
}
- })(); J !== void 0;) {
- var n = J;
- for (J = void 0, mt++; n !== void 0;) {
+ })(); gt !== void 0;) {
+ var n = gt;
+ for (gt = void 0, _t++; n !== void 0;) {
var r = n.u;
- if (n.u = void 0, n.f &= -3, !(8 & n.f) && xt(n)) try {
+ if (n.u = void 0, n.f &= -3, !(8 & n.f) && wt(n)) try {
n.c();
} catch (n) {
t ||= (e = n, !0);
@@ -1204,53 +1368,53 @@ function dt() {
n = r;
}
}
- if (mt = 0, Y--, t) throw e;
+ if (_t = 0, Y--, t) throw e;
}
}
-function ft(e) {
+function pt(e) {
if (Y > 0) return e();
- gt = ++ht, Y++;
+ yt = ++vt, Y++;
try {
return e();
} finally {
- dt();
+ ft();
}
}
-var K, q = void 0;
-function pt(e) {
- var t = q, n = K;
- q = void 0, K = void 0;
+var mt, J = void 0;
+function ht(e) {
+ var t = J, n = mt;
+ J = void 0, mt = void 0;
try {
return e();
} finally {
- q = t, K = n;
+ J = t, mt = n;
}
}
-var J = void 0, Y = 0, mt = 0, ht = 0, gt = 0, _t = void 0, vt = 0;
-function yt(e) {
- if (q !== void 0) {
+var gt = void 0, Y = 0, _t = 0, vt = 0, yt = 0, bt = void 0, xt = 0;
+function St(e) {
+ if (J !== void 0) {
var t = e.n;
- if (t === void 0 || t.t !== q) return t = {
+ if (t === void 0 || t.t !== J) return t = {
i: 0,
S: e,
- p: q.s,
+ p: J.s,
n: void 0,
- t: q,
+ t: J,
e: void 0,
x: void 0,
r: t
- }, q.s !== void 0 && (q.s.n = t), q.s = t, e.n = t, 32 & q.f && e.S(t), t;
- if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = q.s, t.n = void 0, q.s.n = t, q.s = t), t;
+ }, J.s !== void 0 && (J.s.n = t), J.s = t, e.n = t, 32 & J.f && e.S(t), t;
+ if (t.i === -1) return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = J.s, t.n = void 0, J.s.n = t, J.s = t), t;
}
}
function X(e, t) {
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
}
-X.prototype.brand = ut, X.prototype.h = function() {
+X.prototype.brand = dt, X.prototype.h = function() {
return !0;
}, X.prototype.S = function(e) {
var t = this, n = this.t;
- n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? pt(function() {
+ n !== e && e.e === void 0 && (e.x = n, this.t = e, n === void 0 ? ht(function() {
var e;
(e = t.W) == null || e.call(t);
}) : n.e = e);
@@ -1258,16 +1422,16 @@ X.prototype.brand = ut, X.prototype.h = function() {
var t = this;
if (this.t !== void 0) {
var n = e.e, r = e.x;
- n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && pt(function() {
+ n !== void 0 && (n.x = r, e.e = void 0), r !== void 0 && (r.e = n, e.x = void 0), e === this.t && (this.t = r, r === void 0 && ht(function() {
var e;
(e = t.Z) == null || e.call(t);
}));
}
}, X.prototype.subscribe = function(e) {
var t = this;
- return Ot(function() {
+ return jt(function() {
var n = t.value;
- pt(function() {
+ ht(function() {
return e(n);
});
}, { name: "sub" });
@@ -1279,41 +1443,41 @@ X.prototype.brand = ut, X.prototype.h = function() {
return this.value;
}, X.prototype.peek = function() {
var e = this;
- return pt(function() {
+ return ht(function() {
return e.value;
});
}, Object.defineProperty(X.prototype, "value", {
get: function() {
- var e = yt(this);
+ var e = St(this);
return e !== void 0 && (e.i = this.i), this.v;
},
set: function(e) {
if (e !== this.v) {
- if (mt > 100) throw Error("Cycle detected");
+ if (_t > 100) throw Error("Cycle detected");
(function(e) {
- Y !== 0 && mt === 0 && e.l !== gt && (e.l = gt, _t = {
+ Y !== 0 && _t === 0 && e.l !== yt && (e.l = yt, bt = {
S: e,
v: e.v,
i: e.i,
- o: _t
+ o: bt
});
- })(this), this.v = e, this.i++, vt++, Y++;
+ })(this), this.v = e, this.i++, xt++, Y++;
try {
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
} finally {
- dt();
+ ft();
}
}
}
});
-function bt(e, t) {
+function Ct(e, t) {
return new X(e, t);
}
-function xt(e) {
+function wt(e) {
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
return !1;
}
-function St(e) {
+function Tt(e) {
for (var t = e.s; t !== void 0; t = t.n) {
var n = t.S.n;
if (n !== void 0 && (t.r = n), t.S.n = t, t.i = -1, t.n === void 0) {
@@ -1322,7 +1486,7 @@ function St(e) {
}
}
}
-function Ct(e) {
+function Et(e) {
for (var t = e.s, n = void 0; t !== void 0;) {
var r = t.p;
t.i === -1 ? (t.S.U(t), r !== void 0 && (r.n = t.n), t.n !== void 0 && (t.n.p = r)) : n = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = r;
@@ -1330,21 +1494,21 @@ function Ct(e) {
e.s = n;
}
function Z(e, t) {
- X.call(this, void 0, t), this.x = e, this.s = void 0, this.g = vt - 1, this.f = 4;
+ X.call(this, void 0, t), this.x = e, this.s = void 0, this.g = xt - 1, this.f = 4;
}
Z.prototype = new X(), Z.prototype.h = function() {
if (this.f &= -3, 1 & this.f) return !1;
- if ((36 & this.f) == 32 || (this.f &= -5, this.g === vt)) return !0;
- if (this.g = vt, this.f |= 1, this.i > 0 && !xt(this)) return this.f &= -2, !0;
- var e = q;
+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === xt)) return !0;
+ if (this.g = xt, this.f |= 1, this.i > 0 && !wt(this)) return this.f &= -2, !0;
+ var e = J;
try {
- St(this), q = this;
+ Tt(this), J = this;
var t = this.x();
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
} catch (e) {
this.v = e, this.f |= 16, this.i++;
}
- return q = e, Ct(this), this.f &= -2, !0;
+ return J = e, Et(this), this.f &= -2, !0;
}, Z.prototype.S = function(e) {
if (this.t === void 0) {
this.f |= 36;
@@ -1363,38 +1527,38 @@ Z.prototype = new X(), Z.prototype.h = function() {
}
}, Object.defineProperty(Z.prototype, "value", { get: function() {
if (1 & this.f) throw Error("Cycle detected");
- var e = yt(this);
+ var e = St(this);
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
return this.v;
} });
-function wt(e, t) {
+function Dt(e, t) {
return new Z(e, t);
}
-function Tt(e) {
+function Ot(e) {
var t = e.m;
if (e.m = void 0, typeof t == "function") {
Y++;
- var n = q;
- q = void 0;
+ var n = J;
+ J = void 0;
try {
t();
} catch (t) {
- throw e.f &= -2, e.f |= 8, Et(e), t;
+ throw e.f &= -2, e.f |= 8, kt(e), t;
} finally {
- q = n, dt();
+ J = n, ft();
}
}
}
-function Et(e) {
+function kt(e) {
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
- e.x = void 0, e.s = void 0, Tt(e);
+ e.x = void 0, e.s = void 0, Ot(e);
}
-function Dt(e) {
- if (q !== this) throw Error("Out-of-order effect");
- Ct(this), q = e, this.f &= -2, 8 & this.f && Et(this), dt();
+function At(e) {
+ if (J !== this) throw Error("Out-of-order effect");
+ Et(this), J = e, this.f &= -2, 8 & this.f && kt(this), ft();
}
function Q(e, t) {
- this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, K && K.push(this);
+ this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name, mt && mt.push(this);
}
Q.prototype.c = function() {
var e = this.S();
@@ -1407,17 +1571,17 @@ Q.prototype.c = function() {
}
}, Q.prototype.S = function() {
if (1 & this.f) throw Error("Cycle detected");
- this.f |= 1, this.f &= -9, Tt(this), St(this), Y++;
- var e = q;
- return q = this, Dt.bind(this, e);
+ this.f |= 1, this.f &= -9, Ot(this), Tt(this), Y++;
+ var e = J;
+ return J = this, At.bind(this, e);
}, Q.prototype.N = function() {
- 2 & this.f || (this.f |= 2, this.u = J, J = this);
+ 2 & this.f || (this.f |= 2, this.u = gt, gt = this);
}, Q.prototype.d = function() {
- this.f |= 8, 1 & this.f || Et(this);
+ this.f |= 8, 1 & this.f || kt(this);
}, Q.prototype.dispose = function() {
this.d();
};
-function Ot(e, t) {
+function jt(e, t) {
var n = new Q(e, t);
try {
n.c();
@@ -1429,35 +1593,35 @@ function Ot(e, t) {
}
//#endregion
//#region node_modules/@preact/signals/dist/signals.module.js
-var kt, At, jt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Mt = [];
-Ot(function() {
- kt = this.N;
+var Mt, Nt, Pt = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Ft = [];
+jt(function() {
+ Mt = this.N;
})();
function $(e, t) {
- m[e] = t.bind(null, m[e] || function() {});
+ h[e] = t.bind(null, h[e] || function() {});
}
-function Nt(e) {
- if (At) {
- var t = At;
- At = void 0, t();
+function It(e) {
+ if (Nt) {
+ var t = Nt;
+ Nt = void 0, t();
}
- At = e && e.S();
+ Nt = e && e.S();
}
-function Pt(e) {
- var t = this, n = e.data, r = It(n);
+function Lt(e) {
+ var t = this, n = e.data, r = zt(n);
r.name = "ReactiveDom", r.value = n;
- var i = ze(function() {
+ var i = Re(function() {
for (var e = t, n = t.__v; n = n.__;) if (n.__c) {
n.__c.__$f |= 4;
break;
}
- var i = wt(function() {
+ var i = Dt(function() {
var e = r.value.value;
return e === 0 ? 0 : !0 === e ? "" : e || "";
- }), a = wt(function() {
- return !Array.isArray(i.value) && !g(i.value);
- }), o = Ot(function() {
- if (this.N = zt, a.value) {
+ }), a = Dt(function() {
+ return !Array.isArray(i.value) && !_(i.value);
+ }), o = jt(function() {
+ if (this.N = Ht, a.value) {
var t = i.value;
e.__v && e.__v.__e && e.__v.__e.nodeType === 3 && (e.__v.__e.data = t);
}
@@ -1468,14 +1632,14 @@ function Pt(e) {
}, []), a = i[0], o = i[1];
return a.value ? o.peek() : o.value;
}
-Pt.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
+Lt.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
constructor: {
configurable: !0,
value: void 0
},
type: {
configurable: !0,
- value: Pt
+ value: Lt
},
props: {
configurable: !0,
@@ -1500,25 +1664,25 @@ Pt.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
}
e(t);
}), $("__r", function(e, t) {
- if (e(t), t.type !== M) {
- Nt();
+ if (e(t), t.type !== N) {
+ It();
var n, r = t.__c;
r && (r.__$f &= -2, (n = r.__$u) === void 0 && (r.__$u = n = function(e, t) {
var n;
- return Ot(function() {
+ return jt(function() {
n = this;
}, { name: t }), n.c = e, n;
}(function(e) {
return function() {
var t;
- jt && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});
+ Pt && ((t = this.y) == null || t.call(this)), e.__$f |= 1, e.setState({});
};
- }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), Nt(n);
+ }(r), typeof t.type == "function" ? t.type.displayName || t.type.name : ""))), It(n);
}
}), $("__e", function(e, t, n, r) {
- Nt(), e(t, n, r);
+ It(), e(t, n, r);
}), $("diffed", function(e, t) {
- Nt();
+ It();
var n;
if (typeof t.type == "string" && (n = t.__e)) {
var r = t.__np, i = t.props, a = n.U;
@@ -1528,19 +1692,19 @@ Pt.displayName = "ReactiveTextNode", Object.defineProperties(X.prototype, {
}
if (r) for (var c in a || (a = {}, n.U = a), r) {
var l = a[c], u = r[c];
- l === void 0 ? (l = Ft(n, c, u, i), a[c] = l) : l.o(u, i);
+ l === void 0 ? (l = Rt(n, c, u, i), a[c] = l) : l.o(u, i);
}
}
e(t);
});
-function Ft(e, t, n, r) {
- var i = t in e && e.ownerSVGElement === void 0, a = bt(n);
+function Rt(e, t, n, r) {
+ var i = t in e && e.ownerSVGElement === void 0, a = Ct(n);
return {
o: function(e, t) {
a.value = e, r = t;
},
- d: Ot(function() {
- this.N = zt;
+ d: jt(function() {
+ this.N = Ht;
var n = a.value.value;
r[t] !== n && (r[t] = n, i ? e[t] = n : n != null && (!1 !== n || t[4] === "-") ? e.setAttribute(t, n) : e.removeAttribute(t));
})
@@ -1572,7 +1736,7 @@ $("unmount", function(e, t) {
e(t);
}), $("__h", function(e, t, n, r) {
r < 3 && (t.__$f |= 2), e(t, n, r);
-}), N.prototype.shouldComponentUpdate = function(e, t) {
+}), P.prototype.shouldComponentUpdate = function(e, t) {
if (this.__R) return !0;
var n = this.__$u, r = n && n.s !== void 0;
for (var i in t) return !0;
@@ -1584,200 +1748,200 @@ $("unmount", function(e, t) {
for (var s in this.props) if (!(s in e)) return !0;
return !1;
};
-function It(e, t) {
- return ze(function() {
- return bt(e, t);
+function zt(e, t) {
+ return Re(function() {
+ return Ct(e, t);
}, []);
}
-var Lt = function(e) {
+var Bt = function(e) {
queueMicrotask(function() {
queueMicrotask(e);
});
};
-function Rt() {
- ft(function() {
- for (var e; e = Mt.shift();) kt.call(e);
+function Vt() {
+ pt(function() {
+ for (var e; e = Ft.shift();) Mt.call(e);
});
}
-function zt() {
- Mt.push(this) === 1 && (m.requestAnimationFrame || Lt)(Rt);
+function Ht() {
+ Ft.push(this) === 1 && (h.requestAnimationFrame || Bt)(Vt);
}
//#endregion
//#region src/state/quality-goals.ts
-var Bt = "/api/quality-goals?limit=200", Vt = {
+var Ut = "/api/quality-goals?limit=200", Wt = {
data: null,
error: ""
-}, Ht = bt(Vt), Ut = 0, Wt = wt(() => Ht.value);
-wt(() => Ht.value.data?.total ?? null);
-function Gt() {
- Ut += 1, Ht.value = Vt;
+}, Gt = Ct(Wt), Kt = 0, qt = Dt(() => Gt.value);
+Dt(() => Gt.value.data?.total ?? null);
+function Jt() {
+ Kt += 1, Gt.value = Wt;
}
-async function Kt(e) {
- let t = Ut += 1;
+async function Yt(e) {
+ let t = Kt += 1;
try {
- let n = await I(Bt, e);
- return t === Ut && (Ht.value = {
+ let n = await L(Ut, e);
+ return t === Kt && (Gt.value = {
data: n,
error: ""
}), n;
} catch (n) {
- throw !e?.aborted && t === Ut && (Ht.value = {
+ throw !e?.aborted && t === Kt && (Gt.value = {
data: null,
- error: F(n)
+ error: I(n)
}), n;
}
}
//#endregion
//#region src/islands/quality-goals.tsx
-var qt = (e, t) => Kt(t), Jt = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
-function Yt({ openItem: e, javTitleHtml: n, javDisplayName: r, srcBadge: a }) {
- let { data: o, error: s } = Wt.value;
- if (s) return /* @__PURE__ */ W("div", {
+var Xt = (e, t) => Yt(t), Zt = (e) => e.has_cover ? `/cover?code=${encodeURIComponent(e.code ?? "")}` : `/poster?id=${e.id}&c=4`;
+function Qt({ openItem: e, javTitleHtml: t, javDisplayName: r, srcBadge: i }) {
+ let { data: o, error: s } = qt.value;
+ if (s) return /* @__PURE__ */ K("div", {
class: "qualitylist",
- dangerouslySetInnerHTML: { __html: i(s, {
+ dangerouslySetInnerHTML: { __html: a(s, {
variant: "error",
label: "读取失败"
}) }
});
let c = o?.items ?? [];
- return c.length ? /* @__PURE__ */ W("div", {
+ return c.length ? /* @__PURE__ */ K("div", {
class: "qualitylist",
- children: c.map((t) => /* @__PURE__ */ W("article", {
+ children: c.map((n) => /* @__PURE__ */ K("article", {
class: "qualityitem",
- children: [/* @__PURE__ */ W("button", {
+ children: [/* @__PURE__ */ K("button", {
class: "qualitycover",
type: "button",
- "aria-label": `打开 ${r(t)}`,
- onClick: () => e(t.id),
- children: /* @__PURE__ */ W("img", {
- src: Jt(t),
+ "aria-label": `打开 ${r(n)}`,
+ onClick: () => e(n.id),
+ children: /* @__PURE__ */ K("img", {
+ src: Zt(n),
alt: "",
loading: "lazy",
onError: (e) => e.currentTarget.remove()
})
- }), /* @__PURE__ */ W("div", { children: [
- /* @__PURE__ */ W("h3", { children: /* @__PURE__ */ W("button", {
+ }), /* @__PURE__ */ K("div", { children: [
+ /* @__PURE__ */ K("h3", { children: /* @__PURE__ */ K("button", {
type: "button",
"data-middle-truncate": !0,
- onClick: () => e(t.id),
- dangerouslySetInnerHTML: { __html: n(t) }
+ onClick: () => e(n.id),
+ dangerouslySetInnerHTML: { __html: t(n) }
}) }),
- /* @__PURE__ */ W("p", {
+ /* @__PURE__ */ K("p", {
class: "mono",
children: [
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ K("span", {
style: "display:contents",
- dangerouslySetInnerHTML: { __html: a(t.location, t.cost) }
+ dangerouslySetInnerHTML: { __html: i(n.location, n.cost) }
}),
- /* @__PURE__ */ W("span", { children: u[t.location] ?? t.location }),
- /* @__PURE__ */ W("span", { children: d(t.duration) }),
- /* @__PURE__ */ W("span", { children: f(t.size ?? 0) })
+ /* @__PURE__ */ K("span", { children: d[n.location] ?? n.location }),
+ /* @__PURE__ */ K("span", { children: f(n.duration) }),
+ /* @__PURE__ */ K("span", { children: p(n.size ?? 0) })
]
}),
- t.reason ? /* @__PURE__ */ W("p", { children: t.reason }) : null
+ n.reason ? /* @__PURE__ */ K("p", { children: n.reason }) : null
] })]
- }, t.id))
- }) : /* @__PURE__ */ W("div", {
+ }, n.id))
+ }) : /* @__PURE__ */ K("div", {
class: "qualitylist",
- dangerouslySetInnerHTML: { __html: t("sparkles", "没有标记中的高清版目标", "现有版本都已满足条件,或还没有加入追踪。") }
+ dangerouslySetInnerHTML: { __html: n("sparkles", "没有标记中的高清版目标", "现有版本都已满足条件,或还没有加入追踪。") }
});
}
//#endregion
//#region src/islands/scraping.tsx
-var Xt = (e, t) => I("/api/scraping", t);
-function Zt({ value: e, onChange: t }) {
- let n = U(null), r = U(t);
- return r.current = t, H(() => {
+var $t = (e, t) => L("/api/scraping", t);
+function en({ value: e, onChange: t }) {
+ let n = G(null), r = G(t);
+ return r.current = t, W(() => {
let t = n.current;
- t.innerHTML = o([
+ t.innerHTML = s([
["environment", "系统代理"],
["direct", "应用直连"],
["proxy", "自定义代理"]
], e, { label: "连接方式" });
- let i = l(t.firstElementChild), a = () => r.current(i.value);
+ let i = u(t.firstElementChild), a = () => r.current(i.value);
return i.addEventListener("change", a), () => {
i.disabled = !0, i.removeEventListener("change", a), t.replaceChildren();
};
- }, []), /* @__PURE__ */ W("div", {
+ }, []), /* @__PURE__ */ K("div", {
ref: n,
class: "scraping-network"
});
}
-function Qt({ source: e, toast: t }) {
- let [r, a] = V(e), [o, s] = V(e.network), [l, u] = V(""), [d, f] = V(""), [p, m] = V(""), [h, g] = V("paste"), [_, v] = V(""), [y, b] = V(!1), [x, S] = V(""), [C, w] = V([]), T = U(null), E = U(null);
- H(() => {
- E.current?.querySelectorAll("footer button").forEach((e) => c(e, y));
+function tn({ source: e, toast: t }) {
+ let [n, i] = H(e), [o, s] = H(e.network), [c, u] = H(""), [d, f] = H(""), [p, m] = H(""), [h, g] = H("paste"), [_, v] = H(""), [y, b] = H(!1), [x, S] = H(""), [C, w] = H([]), T = G(null), E = G(null);
+ W(() => {
+ E.current?.querySelectorAll("footer button").forEach((e) => l(e, y));
}, [y]);
- let D = U(new AbortController());
- Re(() => () => D.current.abort(), []);
+ let D = G(new AbortController());
+ U(() => () => D.current.abort(), []);
async function O(n) {
if (!y) {
b(!0), S(""), w([]);
try {
if (n === "check") {
- let t = await L("/api/scraping/check", { source: e.source }, "POST", D.current.signal);
+ let t = await R("/api/scraping/check", { source: e.source }, "POST", D.current.signal);
D.current.signal.aborted || w(t.results);
} else {
- let r = await L("/api/scraping/settings", {
+ let r = await R("/api/scraping/settings", {
source: e.source,
network: o,
- proxy: l,
+ proxy: c,
cookie: d,
cookies_text: p,
revoke: n === "revoke"
}, "POST", D.current.signal);
- D.current.signal.aborted || (a(r.saved), u(""), f(""), m(""), v(""), T.current && (T.current.value = ""), t(n === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));
+ D.current.signal.aborted || (i(r.saved), u(""), f(""), m(""), v(""), T.current && (T.current.value = ""), t(n === "revoke" ? "Cookie 已撤销" : "来源设置已保存"));
}
} catch (e) {
- D.current.signal.aborted || S(F(e));
+ D.current.signal.aborted || S(I(e));
} finally {
D.current.signal.aborted || b(!1);
}
}
}
- return /* @__PURE__ */ W("section", {
+ return /* @__PURE__ */ K("section", {
class: "scraping-source",
- children: /* @__PURE__ */ W("form", {
+ children: /* @__PURE__ */ K("form", {
ref: E,
class: "cleanupfieldset",
"data-geist-fieldset": !0,
onSubmit: (e) => {
e.preventDefault(), O("save");
},
- children: [/* @__PURE__ */ W("div", {
+ children: [/* @__PURE__ */ K("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: n(`scraping-${e.source}`, e.label) } }),
- /* @__PURE__ */ W("a", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: r(`scraping-${e.source}`, e.label) } }),
+ /* @__PURE__ */ K("a", {
class: "scraping-url",
href: e.login,
target: "_blank",
rel: "noopener noreferrer",
children: e.login
}),
- /* @__PURE__ */ W("div", {
+ /* @__PURE__ */ K("div", {
class: "scraping-label",
- children: ["连接方式", /* @__PURE__ */ W(Zt, {
+ children: ["连接方式", /* @__PURE__ */ K(en, {
value: o,
onChange: s
})]
}),
- o === "proxy" && /* @__PURE__ */ W("label", { children: ["代理地址", /* @__PURE__ */ W("input", {
+ o === "proxy" && /* @__PURE__ */ K("label", { children: ["代理地址", /* @__PURE__ */ K("input", {
class: "geist-input",
type: "password",
autoComplete: "off",
- value: l,
- placeholder: r.proxy_saved ? "已保存,留空保留" : "http://127.0.0.1:7890",
+ value: c,
+ placeholder: n.proxy_saved ? "已保存,留空保留" : "http://127.0.0.1:7890",
disabled: y,
onInput: (e) => u(e.currentTarget.value)
})] }),
- e.accepts_cookie && /* @__PURE__ */ W(M, { children: [
- /* @__PURE__ */ W("p", { children: r.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
- /* @__PURE__ */ W("div", {
+ e.accepts_cookie && /* @__PURE__ */ K(N, { children: [
+ /* @__PURE__ */ K("p", { children: n.cookie_saved ? "Cookie 已保存,登录是否有效请在抓取时确认。" : "需要登录时,任选一种方式提供 Cookie。" }),
+ /* @__PURE__ */ K("div", {
class: "insightswitch scraping-cookie-method",
role: "radiogroup",
"aria-label": "提供 Cookie 的方式(二选一)",
- children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ W("label", { children: [/* @__PURE__ */ W("input", {
+ children: [["paste", "粘贴 Cookie"], ["file", "导入文件"]].map(([t, n]) => /* @__PURE__ */ K("label", { children: [/* @__PURE__ */ K("input", {
type: "radio",
name: `cookie-method-${e.source}`,
value: t,
@@ -1785,29 +1949,29 @@ function Qt({ source: e, toast: t }) {
onChange: () => {
g(t), f(""), m(""), v("");
}
- }), /* @__PURE__ */ W("span", { children: n })] }, t))
+ }), /* @__PURE__ */ K("span", { children: n })] }, t))
}),
- h === "paste" ? /* @__PURE__ */ W("label", { children: ["Cookie", /* @__PURE__ */ W("input", {
+ h === "paste" ? /* @__PURE__ */ K("label", { children: ["Cookie", /* @__PURE__ */ K("input", {
class: "geist-input",
type: "password",
autoComplete: "off",
value: d,
disabled: y,
onInput: (e) => f(e.currentTarget.value)
- })] }) : /* @__PURE__ */ W("label", {
+ })] }) : /* @__PURE__ */ K("label", {
class: "scraping-file",
- children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ W("span", {
+ children: ["Netscape Cookie 文件(.txt)", /* @__PURE__ */ K("span", {
class: "scraping-file-control",
children: [
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ K("span", {
class: "geist-button",
children: "选择文件"
}),
- /* @__PURE__ */ W("span", {
+ /* @__PURE__ */ K("span", {
class: "scraping-file-name",
children: _ || "未选择文件"
}),
- /* @__PURE__ */ W("input", {
+ /* @__PURE__ */ K("input", {
ref: T,
type: "file",
accept: ".txt",
@@ -1837,31 +2001,31 @@ function Qt({ source: e, toast: t }) {
})]
})
] }),
- x && /* @__PURE__ */ W("div", {
+ x && /* @__PURE__ */ K("div", {
role: "alert",
- dangerouslySetInnerHTML: { __html: i(x, { variant: "error" }) }
+ dangerouslySetInnerHTML: { __html: a(x, { variant: "error" }) }
}),
- C.map((t) => /* @__PURE__ */ W("div", {
+ C.map((t) => /* @__PURE__ */ K("div", {
role: "status",
- dangerouslySetInnerHTML: { __html: i(`${e.label}${t.label === "来源页面" ? "" : " 高清图片"}:${t.ok ? "可连接" : "不能连接"}` + (t.width ? ` · ${t.width} × ${t.height}` : "") + (t.message ? `。${t.message}` : ""), { variant: t.ok ? "success" : "error" }) }
+ dangerouslySetInnerHTML: { __html: a(`${e.label}${t.label === "来源页面" ? "" : " 高清图片"}:${t.ok ? "可连接" : "不能连接"}` + (t.width ? ` · ${t.width} × ${t.height}` : "") + (t.message ? `。${t.message}` : ""), { variant: t.ok ? "success" : "error" }) }
}, t.label))
]
- }), /* @__PURE__ */ W("footer", {
+ }), /* @__PURE__ */ K("footer", {
class: "geist-fieldset-footer",
"data-geist-fieldset-footer": !0,
children: [
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ K("button", {
class: "geist-button primary",
type: "submit",
children: "保存"
}),
- /* @__PURE__ */ W("button", {
+ /* @__PURE__ */ K("button", {
class: "geist-button",
type: "button",
onClick: () => void O("check"),
children: "检查连接"
}),
- e.accepts_cookie && r.cookie_saved && /* @__PURE__ */ W("button", {
+ e.accepts_cookie && n.cookie_saved && /* @__PURE__ */ K("button", {
class: "geist-button",
type: "button",
onClick: () => void O("revoke"),
@@ -1872,88 +2036,88 @@ function Qt({ source: e, toast: t }) {
})
});
}
-function $t({ data: e, error: t, toast: r }) {
- let [a, o] = V(""), [s, l] = V(!1), [u, d] = V(""), f = U(null);
- H(() => c(f.current, s), [s]);
- let p = U(new AbortController()), m = U(0);
+function nn({ data: e, error: t, toast: n }) {
+ let [i, o] = H(""), [s, c] = H(!1), [u, d] = H(""), f = G(null);
+ W(() => l(f.current, s), [s]);
+ let p = G(new AbortController()), m = G(0);
async function h(e = !1) {
let t = ++m.current;
- await Xe({
- read: (e) => I("/api/scraping/cover", e),
+ await Ye({
+ read: (e) => L("/api/scraping/cover", e),
active: () => !p.current.signal.aborted && t === m.current,
render: (t) => {
- l(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && d(t.error || "采集未取得"), t.status === "complete" && !e && r(t.result || "封面采集完成");
+ c(t.status === "running"), t.status === "running" && (e = !1), t.status === "failed" && !e && d(t.error || "采集未取得"), t.status === "complete" && !e && n(t.result || "封面采集完成");
},
disconnected: () => d("连接中断,正在重新读取后台进度")
});
}
- Re(() => (h(!0), () => p.current.abort()), []);
+ U(() => (h(!0), () => p.current.abort()), []);
async function g() {
if (!s) {
- m.current++, l(!0), d("");
+ m.current++, c(!0), d("");
try {
- await L("/api/scraping/cover", { code: a }, "POST", p.current.signal), await h();
+ await R("/api/scraping/cover", { code: i }, "POST", p.current.signal), await h();
} catch (e) {
- p.current.signal.aborted || (l(!1), d(F(e)));
+ p.current.signal.aborted || (c(!1), d(I(e)));
}
}
}
- return t ? /* @__PURE__ */ W("div", {
+ return t ? /* @__PURE__ */ K("div", {
role: "alert",
- dangerouslySetInnerHTML: { __html: i(t, { variant: "error" }) }
- }) : /* @__PURE__ */ W("div", {
+ dangerouslySetInnerHTML: { __html: a(t, { variant: "error" }) }
+ }) : /* @__PURE__ */ K("div", {
class: "scraping-page",
children: [
- /* @__PURE__ */ W("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
- /* @__PURE__ */ W("section", {
+ /* @__PURE__ */ K("p", { children: "高清图片可能需要代理才能下载,请先检查连接。" }),
+ /* @__PURE__ */ K("section", {
class: "cleanupfieldset scraping-source",
"data-geist-fieldset": !0,
- children: /* @__PURE__ */ W("div", {
+ children: /* @__PURE__ */ K("div", {
class: "geist-fieldset-content scraping-fields",
children: [
- /* @__PURE__ */ W("div", { dangerouslySetInnerHTML: { __html: n("scraping-cover", "高清封面") } }),
- /* @__PURE__ */ W("form", {
+ /* @__PURE__ */ K("div", { dangerouslySetInnerHTML: { __html: r("scraping-cover", "高清封面") } }),
+ /* @__PURE__ */ K("form", {
class: "scraping-cover-form",
onSubmit: (e) => {
e.preventDefault(), g();
},
- children: [/* @__PURE__ */ W("input", {
+ children: [/* @__PURE__ */ K("input", {
class: "geist-input",
"aria-label": "馆藏番号",
required: !0,
- value: a,
+ value: i,
disabled: s,
placeholder: "输入馆藏番号,如 ABW-232",
onInput: (e) => o(e.currentTarget.value)
- }), /* @__PURE__ */ W("button", {
+ }), /* @__PURE__ */ K("button", {
ref: f,
class: "geist-button primary",
type: "submit",
children: "抓取封面"
})]
}),
- u && /* @__PURE__ */ W("div", {
+ u && /* @__PURE__ */ K("div", {
role: "alert",
- dangerouslySetInnerHTML: { __html: i(u, { variant: "error" }) }
+ dangerouslySetInnerHTML: { __html: a(u, { variant: "error" }) }
})
]
})
}),
- e?.sources.map((e) => /* @__PURE__ */ W(Qt, {
+ e?.sources.map((e) => /* @__PURE__ */ K(tn, {
source: e,
- toast: r
+ toast: n
}, e.source))
]
});
}
//#endregion
//#region src/state/index.ts
-var en = { "quality-goals": {
- refresh: Kt,
- reset: Gt
-} }, tn = () => Object.keys(en);
-async function nn(e) {
- let t = en[e];
+var rn = { "quality-goals": {
+ refresh: Yt,
+ reset: Jt
+} }, an = () => Object.keys(rn);
+async function on(e) {
+ let t = rn[e];
if (!t) throw Error(`未登记的共享 store:${String(e)}`);
try {
return await t.refresh(), !0;
@@ -1963,10 +2127,10 @@ async function nn(e) {
}
//#endregion
//#region src/native-image.ts
-function rn(e, t, n, r) {
+function sn(e, t, n, r) {
return e > 0 && t > 0 && e === n && t === r;
}
-function an(e, t, n, r, i = 1) {
+function cn(e, t, n, r, i = 1) {
let a = Number.isFinite(i) && i > 0 ? i : 1;
e /= a, t /= a;
let o = [
@@ -1983,7 +2147,7 @@ function an(e, t, n, r, i = 1) {
}
//#endregion
//#region src/entity-skeleton.ts
-function on(e, t) {
+function ln(e, t) {
return `<section data-skeleton="entity/${e}" role="status" aria-label="正在读取资料">
<span class="sr-only">正在读取资料</span><div aria-hidden="true">
<div class="entityhero"><div class="entityportrait ${e === "studio" || e === "agency" ? "square " : ""}skeleton"></div>
@@ -1995,7 +2159,7 @@ function on(e, t) {
}
//#endregion
//#region src/catalog-onboarding.ts
-var sn = [
+var un = [
"loc",
"creator",
"performer",
@@ -2012,7 +2176,7 @@ var sn = [
"jav",
"thumb"
];
-function cn() {
+function dn() {
let e = (e) => [
,
,
@@ -2023,9 +2187,9 @@ function cn() {
tags: "<span class=\"catalog-placeholder placeholder-tags\" aria-hidden=\"true\">" + e("<span class=\"pill\">&nbsp;</span>") + "</span>"
};
}
-async function ln(e, t) {
+async function fn(e, t) {
let n = new URLSearchParams();
- for (let t of sn) e[t] && n.set(t, e[t]);
+ for (let t of un) e[t] && n.set(t, e[t]);
let [r, i] = await Promise.all([t("/api/facets?" + n), t("/api/items?" + n + "&limit=5")]), a = [...new Set([
...r.creators || [],
...r.tagperformers || [],
@@ -2036,9 +2200,9 @@ async function ln(e, t) {
return r.set("q", e), r.set("limit", "1"), (await t("/api/items?" + r)).total > 0 ? e : "";
}))).filter(Boolean);
}
-function un({ kind: e = "catalog", filtered: n = !1, jav: r = !1, configurable: i = !1, online: a = !1 } = {}) {
+function pn({ kind: e = "catalog", filtered: t = !1, jav: r = !1, configurable: i = !1, online: a = !1 } = {}) {
let o = i ? "<a class=\"geist-button primary\" href=\"/configuration\">添加内容</a>" : "", s = "<a class=\"geist-button\" href=\"/follow-manage\">添加来源</a>";
- return n || r ? t("search", r ? "还没有符合条件的 JAV 作品" : "没有符合条件的内容", r ? "已扫描但尚未补充发行资料的视频可在全部内容中查看。" : "清除筛选或搜索条件后查看全部内容。", { actions: "<a class=\"geist-button primary\" href=\"/?loc=&thumb=0\">查看全部内容</a>" }) : e === "catalog" ? t("play", "还没有视频", "添加媒体文件夹或关注来源,开始建立你的馆藏。", { actions: o + s }) : t(e === "tags" ? "tags" : "user-round", "还没有" + ({
+ return t || r ? n("search", r ? "还没有符合条件的 JAV 作品" : "没有符合条件的内容", r ? "已扫描但尚未补充发行资料的视频可在全部内容中查看。" : "清除筛选或搜索条件后查看全部内容。", { actions: "<a class=\"geist-button primary\" href=\"/?loc=&thumb=0\">查看全部内容</a>" }) : e === "catalog" ? n("play", "还没有视频", "添加媒体文件夹或关注来源,开始建立你的馆藏。", { actions: o + s }) : n(e === "tags" ? "tags" : "user-round", "还没有" + ({
tags: "标签",
performers: "艺人",
creators: "创作者",
@@ -2049,7 +2213,7 @@ function un({ kind: e = "catalog", filtered: n = !1, jav: r = !1, configurable:
}
//#endregion
//#region src/sidebar.ts
-function dn(e) {
+function mn(e) {
return [
"/",
"/unseen",
@@ -2059,23 +2223,23 @@ function dn(e) {
"/junk-files"
].includes(e) || /^\/(item|mix|parts|editions)\//.test(e) || /^\/playlists\/\d+\/\d+$/.test(e) || /^\/(performers|studios|creators|series|agencies)\/.+/.test(e);
}
-function fn(e, t) {
+function hn(e, t) {
return e.dataset.surface === t && e.querySelector(".dnav") ? !1 : (e.dataset.surface = t, e.replaceChildren(), !0);
}
-function pn(e) {
+function gn(e) {
let t = /* @__PURE__ */ new Map();
for (let n of e) for (let e of new Set(n.tags || [])) t.set(e, (t.get(e) || 0) + 1);
return [...t].sort((e, t) => t[1] - e[1]).slice(0, 30);
}
//#endregion
//#region src/management.ts
-function mn(e) {
+function _n(e) {
return e.filter((e) => ["115", "pikpak"].includes(e.location) && (e.roots === void 0 || e.roots.length > 0)).map((e) => e.location);
}
-function hn(e, t) {
+function vn(e, t) {
return t.filter((t) => e.some((e) => e.location === t));
}
-function gn() {
+function yn() {
return `<div class="cleanuppage" data-skeleton="cleanup" aria-busy="true" aria-label="正在读取数据管理状态">
<div class="cleanupgrid">${[
[
@@ -2121,7 +2285,7 @@ function gn() {
<footer class="geist-fieldset-footer" data-geist-fieldset-footer><button type="button"${r === 3 ? " class=\"danger\"" : ""} disabled>${r === 3 ? "<svg aria-hidden=\"true\"><use href=\"#i-trash\"></use></svg><span>" + t + "</span>" : t}</button></footer>
</section>`).join("")}</div></div>`;
}
-function _n(e, t = !1, n = !1) {
+function bn(e, t = !1, n = !1) {
if (t || n) return "";
let r = "<svg aria-hidden=\"true\"><use href=\"#i-external-link\"></use></svg>";
return `<details class="taste-history-guide"${e ? " open" : ""}>
@@ -2135,69 +2299,69 @@ function _n(e, t = !1, n = !1) {
<button type="button" class="geist-button taste-guide-skip">跳过</button>
</div></details>`;
}
-var vn = "peach-taste-guide-dismissed";
-function yn(e, t) {
+var xn = "peach-taste-guide-dismissed";
+function Sn(e, t) {
let n = e.querySelector(".taste-history-guide");
n?.querySelector(".taste-guide-skip")?.addEventListener("click", () => {
- t.setItem(vn, "1"), n.remove();
+ t.setItem(xn, "1"), n.remove();
});
}
//#endregion
//#region src/jav-artwork.ts
-function bn(e) {
+function Cn(e) {
return [
"small",
"sleeve",
"preview"
].includes(String(e)) ? "small" : "big";
}
-function xn(e) {
+function wn(e) {
return {
- javLayout: bn(e.javLayout),
- javImage: Sn(e.javLayout === "preview" ? "thumbnail" : e.javImage)
+ javLayout: Cn(e.javLayout),
+ javImage: Tn(e.javLayout === "preview" ? "thumbnail" : e.javImage)
};
}
-function Sn(e) {
+function Tn(e) {
return e === "thumbnail" ? "thumbnail" : "cover";
}
-function Cn(e, t) {
- return e.is_jav && e.code && e.has_cover && (Sn(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";
+function En(e, t) {
+ return e.is_jav && e.code && e.has_cover && (Tn(t) === "cover" || !e.has_thumb) ? "cover" : e.has_thumb ? "thumbnail" : "";
}
-function wn(e, t) {
+function Dn(e, t) {
e.querySelectorAll("img[data-jav-image]").forEach((e) => {
- let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (Sn(t) === "cover" || !r)), a = i ? n : r;
+ let n = e.dataset.javCover || "", r = e.dataset.javThumb || "", i = !!(n && (Tn(t) === "cover" || !r)), a = i ? n : r;
e.classList.toggle("cover", i), e.classList.toggle("whole", i && e.dataset.javImageLayout !== "big"), e.classList.toggle("front", i && e.dataset.javImageLayout === "big"), e.removeAttribute("style"), a && e.getAttribute("src") !== a && (e.src = a);
});
}
//#endregion
//#region src/islands.ts
-var Tn = {
+var On = {
"library-processing": {
- load: Qe,
- component: $e
+ load: Ze,
+ component: Qe
},
scraping: {
- load: Xt,
- component: $t
+ load: $t,
+ component: nn
},
"quality-goals": {
- load: qt,
- component: Yt
+ load: Xt,
+ component: Qt
},
configuration: {
- load: rt,
- component: lt
+ load: it,
+ component: ut
}
-}, En = () => Object.keys(Tn), Dn = /* @__PURE__ */ new Map();
-async function On(e, t, n, r = {}) {
- let i = Tn[e];
+}, kn = () => Object.keys(On), An = /* @__PURE__ */ new Map();
+async function jn(e, t, n, r = {}) {
+ let i = On[e];
if (!i) throw Error(`未注册的 island:${String(e)}`);
- kn(t);
+ Mn(t);
let a = {
controller: new AbortController(),
painted: !1
};
- Dn.set(t, a);
+ An.set(t, a);
let o;
try {
o = {
@@ -2208,12 +2372,12 @@ async function On(e, t, n, r = {}) {
if (a.controller.signal.aborted) return;
o = {
data: null,
- error: F(e)
+ error: I(e)
};
}
- if (Dn.get(t) !== a) return;
+ if (An.get(t) !== a) return;
if (r.isCurrent && !r.isCurrent()) {
- Dn.delete(t);
+ An.delete(t);
return;
}
t.textContent = "", a.painted = !0;
@@ -2223,9 +2387,9 @@ async function On(e, t, n, r = {}) {
};
Ce(ne(i.component, s), t);
}
-function kn(e) {
- let t = Dn.get(e);
- t && (t.controller.abort(), Dn.delete(e), t.painted && Ce(null, e));
+function Mn(e) {
+ let t = An.get(e);
+ t && (t.controller.abort(), An.delete(e), t.painted && Ce(null, e));
}
//#endregion
-export { vn as TASTE_GUIDE_KEY, un as catalogEmptyHtml, ln as catalogSuggestions, gn as cleanupSkeletonHtml, mn as cloudLocations, hn as cloudPreferenceLocations, cn as emptyCatalogLayout, on as entitySkeletonHtml, Ze as followJobProgress, En as islandNames, Cn as javImageKind, rn as matchesFaceSource, On as mountIsland, an as nativeImageFit, Sn as normalizeJavImage, bn as normalizeJavLayout, xn as normalizeJavPreferences, nn as refreshStore, dn as sidebarHasCatalogContent, pn as sidebarTagCounts, tn as storeNames, wn as syncJavImages, fn as syncSidebarSurface, _n as tasteHistoryGuideHtml, kn as unmountIsland, Xe as watchJob, yn as wireTasteHistoryGuide };
+export { xn as TASTE_GUIDE_KEY, pn as catalogEmptyHtml, fn as catalogSuggestions, yn as cleanupSkeletonHtml, _n as cloudLocations, vn as cloudPreferenceLocations, dn as emptyCatalogLayout, ln as entitySkeletonHtml, Xe as followJobProgress, kn as islandNames, En as javImageKind, sn as matchesFaceSource, jn as mountIsland, cn as nativeImageFit, Tn as normalizeJavImage, Cn as normalizeJavLayout, wn as normalizeJavPreferences, on as refreshStore, mn as sidebarHasCatalogContent, gn as sidebarTagCounts, an as storeNames, Dn as syncJavImages, hn as syncSidebarSurface, bn as tasteHistoryGuideHtml, Mn as unmountIsland, Ye as watchJob, Sn as wireTasteHistoryGuide };