dsh-modpack-kit 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -318
- package/assets/install-stub.mjs +21 -3
- package/client.js +1065 -52
- package/docs/CODE-MAP.md +391 -0
- package/docs/DETAIL.md +106 -82
- package/index.js +163 -8
- package/lib/compat.mjs +12 -11
- package/lib/groups.mjs +25 -11
- package/lib/install.mjs +37 -5
- package/lib/manifest.mjs +3 -1
- package/lib/market-catalog.mjs +11 -5
- package/lib/modpack-catalog.mjs +355 -0
- package/lib/net.mjs +4 -3
- package/lib/pack.mjs +20 -14
- package/lib/profile.mjs +5 -2
- package/lib/store.mjs +6 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +7 -3
package/client.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* dsh-modpack —— 客户端半边:左侧栏「整合包」。
|
|
2
|
+
* dsh-modpack-kit —— 客户端半边:左侧栏「整合包」。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* 改之前先看 docs/CODE-MAP.md(功能 → 符号 → grep 示例)。
|
|
5
|
+
*
|
|
6
|
+
* 四个页签:打包(挑插件、策略三选一、检测报告)、安装 / 导入(链接/本机包、预览、落地)、
|
|
7
|
+
* 社区资源(浏览别人传的整合包,下载后交回安装页)、设置与记录(显示位置、市场、目录、历史)。
|
|
8
|
+
* 数据全部来自 /dsh-modpack-kit/api/*(同源 fetch),与 host 端共用同一份状态;这里不碰文件,也不直接发网络请求(市场 AI 搜索除外,它转发给插件市场)。
|
|
7
9
|
*
|
|
8
10
|
* 制作通告:本文件在 DeepSeek Harness(DSH)会话中由 AI 助手与作者 Vesna-Strivozha-cn 协作产出。
|
|
9
11
|
*/
|
|
@@ -35,9 +37,10 @@ window.__ModuleLoader__.load({
|
|
|
35
37
|
const LEVEL_COLOR = { high: "#ff6b6b", error: "#ff6b6b", medium: "#ffb020", warn: "#ffb020", low: "#8a8f98", info: "#8a8f98" }
|
|
36
38
|
const FORMAT_TEXT = { full: "完整版(含插件本体)", lite: "轻量版(联网取包)", hybrid: "混合包(联网取包 + 配置)" }
|
|
37
39
|
// 三种打包策略的介绍:服务端 /pack/plan 会给可用性与不可用原因,这里只做兜底展示
|
|
40
|
+
// ===== [区块] 打包策略与常量:STRATEGY_INFO =====
|
|
38
41
|
const STRATEGY_INFO = [
|
|
39
42
|
{ id: "full", title: "完整包(懒人包)", online: false, note: "插件本体一起装进包,不联网也能装。有网时按市场版本装,装完依赖是 ^版本,插件市场认成市场版;离线才退回包内副本(显示本地安装)。可以带自定义配置与数据。" },
|
|
40
|
-
{ id: "lite", title: "
|
|
43
|
+
{ id: "lite", title: "轻量包(轻量包)", online: true, note: "只记 名字@版本,体积最小。安装时必须联网从市场取包,不带自定义配置与数据,插件市场按版本认成市场版。" },
|
|
41
44
|
{ id: "hybrid", title: "混合包(轻量为主 + 必要的完整)", online: true, note: "能按版本装的就只记 名字@版本(安装时联网取包);没有确定版本、或者要带走本机改动的插件,连本体一起打进来(这部分安装时不用联网)。配置/数据/补丁片段照样带。" },
|
|
42
45
|
]
|
|
43
46
|
// 分类以插件市场为准:id 与市场目录一致,中文名由 host 从市场目录里带回来。
|
|
@@ -66,6 +69,54 @@ window.__ModuleLoader__.load({
|
|
|
66
69
|
return () => placement.subs.delete(fn)
|
|
67
70
|
}
|
|
68
71
|
|
|
72
|
+
// 「社区资源」这一栏开不开:设置里一关,标签要立刻消失,不能等重新拉状态。
|
|
73
|
+
// host 端的 /status 才是权威值,界面上先乐观一次,下次拉状态再对齐。
|
|
74
|
+
const marketVis = { value: true, subs: new Set() }
|
|
75
|
+
function readMarketVisible() { return marketVis.value !== false }
|
|
76
|
+
function setMarketVisible(on) {
|
|
77
|
+
const next = on !== false
|
|
78
|
+
const same = marketVis.value === next
|
|
79
|
+
marketVis.value = next
|
|
80
|
+
if (same) return
|
|
81
|
+
for (const fn of [...marketVis.subs]) { try { fn(next) } catch (e) { /* 一个订阅出错不该拖垮别的 */ } }
|
|
82
|
+
}
|
|
83
|
+
function subscribeMarketVisible(fn) {
|
|
84
|
+
marketVis.subs.add(fn)
|
|
85
|
+
return () => marketVis.subs.delete(fn)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 社区资源这一层切页签时会整个卸载:搜索框里的字、分类、页码、已经读到的列表、
|
|
89
|
+
// 打开着的整合包详情,都要留着——回来不该重搜一遍。存在模块里,退出程序前都在。
|
|
90
|
+
// 详情页里每个插件的介绍取自插件市场目录(dsh-plugin-catalog),按名字缓存一份,
|
|
91
|
+
// 同一个插件反复打开详情不必再问一遍。
|
|
92
|
+
const pluginDescCache = new Map()
|
|
93
|
+
function hasPluginDesc(name) {
|
|
94
|
+
return pluginDescCache.has(name)
|
|
95
|
+
}
|
|
96
|
+
function cachedPluginDesc(name) {
|
|
97
|
+
const hit = pluginDescCache.get(name)
|
|
98
|
+
return hit && hit.description ? hit.description : ""
|
|
99
|
+
}
|
|
100
|
+
const marketUi = { value: { kind: "modpack", pack: null, plugin: null } }
|
|
101
|
+
function readMarketUi() {
|
|
102
|
+
return marketUi.value || { kind: "modpack", pack: null, plugin: null }
|
|
103
|
+
}
|
|
104
|
+
function saveMarketUi(slice, next) {
|
|
105
|
+
const cur = readMarketUi()
|
|
106
|
+
marketUi.value = { ...cur, [slice]: { ...(cur[slice] || {}), ...next } }
|
|
107
|
+
}
|
|
108
|
+
function saveMarketKind(kind) {
|
|
109
|
+
marketUi.value = { ...readMarketUi(), kind: kind === "plugin" ? "plugin" : "modpack" }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// 最近一次确认过的配置:设置页来回切时会重新挂载,只读 props.status 会退回旧值
|
|
113
|
+
// (比如关掉「社区资源」再切回来,开关又亮着)。这里存一份,挂载时并上去。
|
|
114
|
+
const liveCfg = { value: null }
|
|
115
|
+
function mergeLiveConfig(next) {
|
|
116
|
+
if (!next || typeof next !== "object") return
|
|
117
|
+
liveCfg.value = { ...(liveCfg.value || {}), ...next }
|
|
118
|
+
}
|
|
119
|
+
|
|
69
120
|
// 打包结果(含下载按钮)放在模块里:切页签、关掉面板都不丢,留到退出程序为止。
|
|
70
121
|
const packStore = { value: null, subs: new Set() }
|
|
71
122
|
function readPackValue() {
|
|
@@ -188,6 +239,10 @@ window.__ModuleLoader__.load({
|
|
|
188
239
|
}
|
|
189
240
|
let data = null
|
|
190
241
|
try { data = await res.json() } catch {
|
|
242
|
+
// 宿主还跑着旧代码时,新接口会返回 404/405 且不是 JSON:把话说清楚,别只丢一句技术错误
|
|
243
|
+
if (res.status === 404 || res.status === 405) {
|
|
244
|
+
throw new Error("这个接口在当前运行的 DSH 里还没加载(HTTP " + res.status + "):重启一次 DSH 后生效")
|
|
245
|
+
}
|
|
191
246
|
throw new Error("服务端返回了非 JSON(HTTP " + res.status + ")")
|
|
192
247
|
}
|
|
193
248
|
if (!res.ok) {
|
|
@@ -201,6 +256,72 @@ window.__ModuleLoader__.load({
|
|
|
201
256
|
return data
|
|
202
257
|
}
|
|
203
258
|
|
|
259
|
+
// 插件市场的侧栏入口(/dsh-market/sidebar-entry):本条开关就是替市场把 enabled 关掉。
|
|
260
|
+
// 市场那一行是它自己的偏好,存在 profile 的 .dsh-market/state.json 里;我们只写这一个键。
|
|
261
|
+
const MARKET_SIDEBAR_ROUTE = "/dsh-market/sidebar-entry"
|
|
262
|
+
async function readMarketSidebar() {
|
|
263
|
+
try {
|
|
264
|
+
const res = await fetch(MARKET_SIDEBAR_ROUTE, { headers: { Accept: "application/json" }, credentials: "same-origin" })
|
|
265
|
+
if (!res.ok) return null
|
|
266
|
+
const data = await res.json()
|
|
267
|
+
return data && typeof data.enabled === "boolean" ? data : null
|
|
268
|
+
} catch (e) { return null }
|
|
269
|
+
}
|
|
270
|
+
async function writeMarketSidebar(enabled) {
|
|
271
|
+
const res = await fetch(MARKET_SIDEBAR_ROUTE, {
|
|
272
|
+
method: "POST",
|
|
273
|
+
headers: { "Content-Type": "application/json" },
|
|
274
|
+
credentials: "same-origin",
|
|
275
|
+
body: JSON.stringify({ enabled: enabled === true }),
|
|
276
|
+
})
|
|
277
|
+
let data = null
|
|
278
|
+
try { data = await res.json() } catch (e) { data = null }
|
|
279
|
+
if (!res.ok) {
|
|
280
|
+
const error = new Error((data && (data.error || data.message)) || ("插件市场拒绝了这次修改(HTTP " + res.status + ")"))
|
|
281
|
+
error.status = res.status
|
|
282
|
+
throw error
|
|
283
|
+
}
|
|
284
|
+
return data
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// 开机把市场的侧栏入口关一次:插件加载时拉 /status 顺带执行,不必等用户点开某一栏。
|
|
288
|
+
let marketSidebarForced = false
|
|
289
|
+
async function enforceMarketSidebarOff() {
|
|
290
|
+
if (marketSidebarForced) return
|
|
291
|
+
const current = await readMarketSidebar()
|
|
292
|
+
if (!current) return
|
|
293
|
+
if (current.enabled !== true) { marketSidebarForced = true; return }
|
|
294
|
+
try { await writeMarketSidebar(false); marketSidebarForced = true } catch (e) { marketSidebarForced = true }
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// 解除卡顿插件(dsh-unlag):装了才有按钮。只读它的 /state;按一次要带它要的头。
|
|
298
|
+
const UNLAG_STATE_ROUTE = "/dsh-unlag/state"
|
|
299
|
+
async function detectUnlag() {
|
|
300
|
+
try {
|
|
301
|
+
const res = await fetch(UNLAG_STATE_ROUTE, { headers: { Accept: "application/json" }, credentials: "same-origin" })
|
|
302
|
+
if (!res.ok) return null
|
|
303
|
+
const data = await res.json()
|
|
304
|
+
return data && typeof data.version === "string" ? data : null
|
|
305
|
+
} catch (e) { return null }
|
|
306
|
+
}
|
|
307
|
+
async function pressUnlag() {
|
|
308
|
+
const requestId = "modpack-" + Date.now().toString(36) + "-" + Math.random().toString(36).slice(2, 8)
|
|
309
|
+
const res = await fetch("/dsh-unlag/reload?requestId=" + encodeURIComponent(requestId), {
|
|
310
|
+
method: "POST",
|
|
311
|
+
headers: { "Content-Type": "application/json", "x-dsh-unlag": "1" },
|
|
312
|
+
credentials: "same-origin",
|
|
313
|
+
body: JSON.stringify({}),
|
|
314
|
+
})
|
|
315
|
+
let data = null
|
|
316
|
+
try { data = await res.json() } catch (e) { data = null }
|
|
317
|
+
if (!res.ok) {
|
|
318
|
+
const error = new Error((data && (data.status || data.message || data.error)) || ("解除卡顿拒绝了这次请求(HTTP " + res.status + ")"))
|
|
319
|
+
error.status = res.status
|
|
320
|
+
throw error
|
|
321
|
+
}
|
|
322
|
+
return data
|
|
323
|
+
}
|
|
324
|
+
|
|
204
325
|
// 宿主有没有原生的目录选择器:有就能点「浏览文件夹…」,没有就退回手填
|
|
205
326
|
let pickDirectoryHost = null
|
|
206
327
|
|
|
@@ -258,7 +379,7 @@ window.__ModuleLoader__.load({
|
|
|
258
379
|
}
|
|
259
380
|
|
|
260
381
|
function Switch(props) {
|
|
261
|
-
return h("label", { style: { display: "inline-flex", gap: "6px", alignItems: "center", fontSize: "12.5px", cursor: props.disabled ? "not-allowed" : "pointer", opacity: props.disabled ? 0.45 : 1 } },
|
|
382
|
+
return h("label", { title: props.title || undefined, style: { display: "inline-flex", gap: "6px", alignItems: "center", fontSize: "12.5px", cursor: props.disabled ? "not-allowed" : "pointer", opacity: props.disabled ? 0.45 : 1 } },
|
|
262
383
|
h("input", { type: "checkbox", checked: !!props.checked, disabled: !!props.disabled, onChange: (e) => props.onChange(e.target.checked) }),
|
|
263
384
|
props.label)
|
|
264
385
|
}
|
|
@@ -304,6 +425,7 @@ window.__ModuleLoader__.load({
|
|
|
304
425
|
|
|
305
426
|
// 一整块可以折叠的区域:标题行常驻,点标题或「展开/收起」都行。
|
|
306
427
|
// 默认收起,只有真有问题(高危 / 阻断)才默认摊开。
|
|
428
|
+
// ===== [区块] 通用折叠容器:FoldBox =====
|
|
307
429
|
function FoldBox(props) {
|
|
308
430
|
const [open, setOpen] = useState(props.defaultOpen === true)
|
|
309
431
|
const summary = Array.isArray(props.summary) ? props.summary : [props.summary]
|
|
@@ -320,6 +442,7 @@ window.__ModuleLoader__.load({
|
|
|
320
442
|
open ? props.children : (props.collapsedNote ? h("div", { style: hint }, props.collapsedNote) : null))
|
|
321
443
|
}
|
|
322
444
|
|
|
445
|
+
// ===== [区块] 安全检测报告(可折叠):ScanReport =====
|
|
323
446
|
function ScanReport(props) {
|
|
324
447
|
const scan = props.scan
|
|
325
448
|
const counts = (scan && scan.counts) || { high: 0, medium: 0, low: 0 }
|
|
@@ -363,6 +486,7 @@ window.__ModuleLoader__.load({
|
|
|
363
486
|
h("div", { style: hint }, props.footNote || "命中内容只在内存里比对,报告只保留类型、位置与掩码,原文不落盘。"))
|
|
364
487
|
}
|
|
365
488
|
|
|
489
|
+
// ===== [区块] 兼容性列表(可折叠):CompatList =====
|
|
366
490
|
function CompatList(props) {
|
|
367
491
|
const compat = props.compat
|
|
368
492
|
if (!compat) return null
|
|
@@ -411,18 +535,78 @@ window.__ModuleLoader__.load({
|
|
|
411
535
|
|
|
412
536
|
// 进度窗:可以拖,拖过的位置记在浏览器本地;没有任务时自动收起,只留一枚唤出按钮。
|
|
413
537
|
const DOCK_POS_KEY = "dsh-modpack-kit:dock-pos"
|
|
538
|
+
// localStorage 里只存相对坐标(fx/fy,0~1),换窗口大小时按比例还原一次;
|
|
539
|
+
// 界面上的位置一律用像素,并且不存任何「算出来的高度 / 要不要向上长」这类状态。
|
|
414
540
|
function readDockPos() {
|
|
415
541
|
try {
|
|
416
542
|
const raw = typeof localStorage !== "undefined" ? localStorage.getItem(DOCK_POS_KEY) : null
|
|
417
543
|
if (!raw) return null
|
|
418
544
|
const parsed = JSON.parse(raw)
|
|
419
545
|
if (!parsed || typeof parsed !== "object") return null
|
|
420
|
-
if (
|
|
421
|
-
|
|
546
|
+
if (Number.isFinite(Number(parsed.fx)) && Number.isFinite(Number(parsed.fy))) {
|
|
547
|
+
return { fx: Math.max(0, Math.min(1, Number(parsed.fx))), fy: Math.max(0, Math.min(1, Number(parsed.fy))) }
|
|
548
|
+
}
|
|
549
|
+
// 老版本存的是像素:按当前视口折算成相对坐标,迁移一次就够了
|
|
550
|
+
if (Number.isFinite(Number(parsed.x)) && Number.isFinite(Number(parsed.y))) {
|
|
551
|
+
const vp = viewportSize()
|
|
552
|
+
return { fx: Math.max(0, Math.min(1, Number(parsed.x) / vp.width)), fy: Math.max(0, Math.min(1, Number(parsed.y) / vp.height)) }
|
|
553
|
+
}
|
|
554
|
+
return null
|
|
422
555
|
} catch { return null }
|
|
423
556
|
}
|
|
424
557
|
function writeDockPos(pos) {
|
|
425
|
-
try {
|
|
558
|
+
try {
|
|
559
|
+
if (typeof localStorage === "undefined" || !pos) return
|
|
560
|
+
const vp = viewportSize()
|
|
561
|
+
localStorage.setItem(DOCK_POS_KEY, JSON.stringify({
|
|
562
|
+
fx: Math.max(0, Math.min(1, Number(pos.x) / vp.width)),
|
|
563
|
+
fy: Math.max(0, Math.min(1, Number(pos.y) / vp.height)),
|
|
564
|
+
}))
|
|
565
|
+
} catch { /* 存不了就算了,不影响本场使用 */ }
|
|
566
|
+
}
|
|
567
|
+
// 召回:把存在浏览器里的位置清掉,回到默认的右下角
|
|
568
|
+
function clearDockPos() {
|
|
569
|
+
try {
|
|
570
|
+
if (typeof localStorage !== 'undefined') localStorage.removeItem(DOCK_POS_KEY)
|
|
571
|
+
} catch { /* 清不掉也没关系,下一次拖动会覆盖 */ }
|
|
572
|
+
}
|
|
573
|
+
// DSH 顶栏 / 标签行大约占这么高:窗口别停在那上面,否则会盖住界面的按钮
|
|
574
|
+
const DOCK_TOP_INSET = 56
|
|
575
|
+
const DOCK_MARGIN = 12 // 离视口边缘至少留这么宽
|
|
576
|
+
const DOCK_MIN_LEFT = 4
|
|
577
|
+
const DOCK_W = 300 // 收起、展开同一个宽度,简单可预期
|
|
578
|
+
const DOCK_OPEN_MAX_H = 420 // 展开时最高这么多,再多就在窗里滚动
|
|
579
|
+
const DOCK_HEAD_H = 44 // 标题行的占位高度:夹边只按它算,展开多高由可用空间决定
|
|
580
|
+
const clampNum = (value, min, max) => Math.max(min, Math.min(value, max))
|
|
581
|
+
// 和布局有关的只有这一件事:把像素位置夹回可见区。
|
|
582
|
+
// 没有「自动判定向上/向下」、也没有自动算高度——拖到哪就是哪,超出才夹回来,默认落右下角。
|
|
583
|
+
function clampDockPos(pos, viewport, size) {
|
|
584
|
+
const vw = Math.max(1, Number(viewport && viewport.width) || 0)
|
|
585
|
+
const vh = Math.max(1, Number(viewport && viewport.height) || 0)
|
|
586
|
+
const w = Math.max(1, Number(size && size.w) || DOCK_W)
|
|
587
|
+
const h = Math.max(1, Number(size && size.h) || 44)
|
|
588
|
+
const x = pos && Number.isFinite(Number(pos.x)) ? Number(pos.x) : vw - w - DOCK_MARGIN
|
|
589
|
+
const y = pos && Number.isFinite(Number(pos.y)) ? Number(pos.y) : vh - h - DOCK_MARGIN
|
|
590
|
+
return {
|
|
591
|
+
x: Math.round(clampNum(x, DOCK_MIN_LEFT, Math.max(DOCK_MIN_LEFT, vw - w - DOCK_MIN_LEFT))),
|
|
592
|
+
y: Math.round(clampNum(y, DOCK_TOP_INSET, Math.max(DOCK_TOP_INSET, vh - h - DOCK_MIN_LEFT))),
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
// 存下来的相对坐标 -> 像素(窗口大小变了就按比例落回去)
|
|
596
|
+
function dockFromFractions(saved, viewport) {
|
|
597
|
+
if (!saved) return null
|
|
598
|
+
const vw = Math.max(1, Number(viewport && viewport.width) || 0)
|
|
599
|
+
const vh = Math.max(1, Number(viewport && viewport.height) || 0)
|
|
600
|
+
return { x: clampNum(Number(saved.fx) || 0, 0, 1) * vw, y: clampNum(Number(saved.fy) || 0, 0, 1) * vh }
|
|
601
|
+
}
|
|
602
|
+
// 召回:标签行那个显眼按钮通过它把进度窗叫回默认位置
|
|
603
|
+
const dockReset = { subs: new Set() }
|
|
604
|
+
function requestDockReset() {
|
|
605
|
+
for (const fn of Array.from(dockReset.subs)) { try { fn() } catch { /* 某个订阅坏了不该影响别的 */ } }
|
|
606
|
+
}
|
|
607
|
+
function subscribeDockReset(fn) {
|
|
608
|
+
dockReset.subs.add(fn)
|
|
609
|
+
return () => { dockReset.subs.delete(fn) }
|
|
426
610
|
}
|
|
427
611
|
function viewportSize() {
|
|
428
612
|
const width = typeof window !== "undefined" && Number(window.innerWidth) ? Number(window.innerWidth) : 1280
|
|
@@ -430,6 +614,7 @@ window.__ModuleLoader__.load({
|
|
|
430
614
|
return { width, height }
|
|
431
615
|
}
|
|
432
616
|
|
|
617
|
+
// ===== [区块] 悬浮进度窗(拖动 / 召回 / 终止):JobDock =====
|
|
433
618
|
function JobDock(props) {
|
|
434
619
|
const given = Array.isArray(props.jobs) ? props.jobs : []
|
|
435
620
|
// 「清空进程」之后,就算服务端还残留一条,也在界面上立刻拿掉
|
|
@@ -438,13 +623,26 @@ window.__ModuleLoader__.load({
|
|
|
438
623
|
useEffect(() => {
|
|
439
624
|
setCleared((prev) => (prev.length === 0 ? prev : prev.filter((id) => given.some((job) => job.id === id))))
|
|
440
625
|
}, [given])
|
|
441
|
-
const [pos, setPos] = useState(readDockPos())
|
|
626
|
+
const [pos, setPos] = useState(() => dockFromFractions(readDockPos(), viewportSize()))
|
|
442
627
|
const [pinned, setPinned] = useState(false) // 手动唤出:没有任务时也显示
|
|
443
628
|
const [hidden, setHidden] = useState(false) // 手动收起:连进行中的也先藏起来
|
|
444
629
|
const [open, setOpen] = useState(false)
|
|
445
630
|
const [dockMsg, setDockMsg] = useState("")
|
|
446
631
|
const dragRef = useRef(null)
|
|
447
632
|
const boxRef = useRef(null)
|
|
633
|
+
const headerRef = useRef(null)
|
|
634
|
+
const pillRef = useRef(null)
|
|
635
|
+
// 窗口大小变了要重算贴边位置,所以留一个 tick 触发重渲染
|
|
636
|
+
const [, setViewportTick] = useState(0)
|
|
637
|
+
// 标签行的「召回」把窗口叫回右下角默认位置
|
|
638
|
+
useEffect(() => subscribeDockReset(() => {
|
|
639
|
+
// 召回是「兜底入口」:任何一步出错都不能把整个面板带崩,所以逐条 try 住
|
|
640
|
+
try { clearDockPos() } catch { /* 清不掉照样能显示 */ }
|
|
641
|
+
setPos(null)
|
|
642
|
+
setOpen(false)
|
|
643
|
+
setHidden(false)
|
|
644
|
+
setPinned(true)
|
|
645
|
+
}), [])
|
|
448
646
|
const running = jobs.filter((job) => job.status === "running")
|
|
449
647
|
const visible = !hidden && (pinned || running.length > 0)
|
|
450
648
|
|
|
@@ -453,12 +651,19 @@ window.__ModuleLoader__.load({
|
|
|
453
651
|
if (running.length > 0) { setHidden(false) }
|
|
454
652
|
}, [running.length])
|
|
455
653
|
|
|
456
|
-
|
|
654
|
+
useEffect(() => {
|
|
655
|
+
if (typeof window === "undefined" || typeof window.addEventListener !== "function") return undefined
|
|
656
|
+
const onResize = () => setViewportTick((n) => n + 1)
|
|
657
|
+
window.addEventListener("resize", onResize)
|
|
658
|
+
return () => { window.removeEventListener("resize", onResize) }
|
|
659
|
+
}, [])
|
|
660
|
+
// 最小化的胶囊自己也是一个按钮,所以这一路要放行:不然 pointer 事件会被当成「按在按钮上」直接丢掉。
|
|
661
|
+
const startDrag = (event, element, allowOnButton) => {
|
|
457
662
|
if (!event || typeof event.clientX !== "number") return
|
|
458
663
|
// 按在按钮上就别当拖动:否则指针捕获会把 click 抢走,按钮点不到,
|
|
459
664
|
// 而且抬手时还会顺带把窗口展开/收起(就是「判定重叠」那个毛病)
|
|
460
|
-
if (event.target && typeof event.target.closest === "function" && event.target.closest("button")) return
|
|
461
|
-
const el = boxRef.current
|
|
665
|
+
if (!allowOnButton && event.target && typeof event.target.closest === "function" && event.target.closest("button")) return
|
|
666
|
+
const el = element || boxRef.current
|
|
462
667
|
const rect = el && el.getBoundingClientRect ? el.getBoundingClientRect() : { left: 0, top: 0, width: 0, height: 0 }
|
|
463
668
|
dragRef.current = {
|
|
464
669
|
dx: event.clientX - rect.left,
|
|
@@ -477,12 +682,13 @@ window.__ModuleLoader__.load({
|
|
|
477
682
|
const moveDrag = (event) => {
|
|
478
683
|
const drag = dragRef.current
|
|
479
684
|
if (!drag || !event || typeof event.clientX !== "number") return
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
drag.
|
|
485
|
-
|
|
685
|
+
const vp = viewportSize()
|
|
686
|
+
// 就用指针位移 + 起手时的窗口尺寸,别在拖动过程中再引用任何会被自己改掉的布局值
|
|
687
|
+
const size = { w: drag.width || DOCK_W, h: DOCK_HEAD_H }
|
|
688
|
+
const next = clampDockPos({ x: event.clientX - drag.dx, y: event.clientY - drag.dy }, vp, size)
|
|
689
|
+
if (Math.abs(next.x - drag.startX) > 3 || Math.abs(next.y - drag.startY) > 3) drag.moved = true
|
|
690
|
+
drag.last = next
|
|
691
|
+
setPos(next)
|
|
486
692
|
}
|
|
487
693
|
const endDrag = () => {
|
|
488
694
|
const drag = dragRef.current
|
|
@@ -492,12 +698,30 @@ window.__ModuleLoader__.load({
|
|
|
492
698
|
if (drag.last) writeDockPos(drag.last)
|
|
493
699
|
return
|
|
494
700
|
}
|
|
495
|
-
// 没拖动就是点了一下标题:展开 /
|
|
496
|
-
|
|
701
|
+
// 没拖动就是点了一下标题:展开 / 收起。
|
|
702
|
+
// 不预算任何尺寸与位置:点一下只是开/关,位置永远由 pos + clampDockPos 决定,不会跳。
|
|
703
|
+
setOpen(!open)
|
|
704
|
+
}
|
|
705
|
+
// 胶囊抬手:拖过就记住位置,没拖就是「打开」
|
|
706
|
+
const endPillDrag = () => {
|
|
707
|
+
const drag = dragRef.current
|
|
708
|
+
if (!drag) return
|
|
709
|
+
dragRef.current = null
|
|
710
|
+
if (drag.moved) {
|
|
711
|
+
if (drag.last) writeDockPos(drag.last)
|
|
712
|
+
return
|
|
713
|
+
}
|
|
714
|
+
setPinned(true)
|
|
715
|
+
setHidden(false)
|
|
497
716
|
}
|
|
498
717
|
|
|
499
718
|
if (!visible) {
|
|
500
|
-
const
|
|
719
|
+
const vp = viewportSize()
|
|
720
|
+
const pillW = 132
|
|
721
|
+
const pillH = 42
|
|
722
|
+
// 胶囊也用相对坐标现算:换窗口大小它跟着走
|
|
723
|
+
const pillAt = clampDockPos(pos, vp, { w: pillW, h: pillH })
|
|
724
|
+
const pillPos = { left: pillAt.x + "px", top: pillAt.y + "px" }
|
|
501
725
|
const summonStyle = {
|
|
502
726
|
position: "fixed",
|
|
503
727
|
zIndex: 70,
|
|
@@ -510,12 +734,22 @@ window.__ModuleLoader__.load({
|
|
|
510
734
|
background: "var(--dsw-alias-surface-1, rgba(24,26,31,.97))",
|
|
511
735
|
color: "var(--dsw-alias-label-primary)",
|
|
512
736
|
boxShadow: "0 6px 18px rgba(0,0,0,.28)",
|
|
513
|
-
cursor: "pointer",
|
|
737
|
+
cursor: pos ? "grab" : "pointer",
|
|
514
738
|
fontSize: "12px",
|
|
515
|
-
|
|
739
|
+
touchAction: "none",
|
|
740
|
+
userSelect: "none",
|
|
741
|
+
...pillPos,
|
|
516
742
|
}
|
|
517
743
|
const badge = running.length || jobs.length
|
|
518
|
-
return h("button", {
|
|
744
|
+
return h("button", {
|
|
745
|
+
ref: pillRef,
|
|
746
|
+
style: summonStyle,
|
|
747
|
+
title: pos ? "打开整合包进度窗(按住可以拖到别处)" : "打开整合包进度窗(按住可以拖到别处)",
|
|
748
|
+
onPointerDown: (event) => startDrag(event, pillRef.current, true),
|
|
749
|
+
onPointerMove: moveDrag,
|
|
750
|
+
onPointerUp: endPillDrag,
|
|
751
|
+
onPointerCancel: endPillDrag,
|
|
752
|
+
},
|
|
519
753
|
h("span", { style: { width: "7px", height: "7px", borderRadius: "99px", background: running.length ? "#4C7DF0" : "rgba(127,163,245,.5)" } }),
|
|
520
754
|
"进度",
|
|
521
755
|
badge ? h("span", { style: { ...hint, marginLeft: "0", fontVariantNumeric: "tabular-nums" } }, String(badge)) : null)
|
|
@@ -564,14 +798,20 @@ window.__ModuleLoader__.load({
|
|
|
564
798
|
// 只要有一条不是「在跑」或「停在风险点」,就给清空入口(状态再怪也算收尾)
|
|
565
799
|
const finished = jobs.filter((job) => job.status !== "running" && job.status !== "paused")
|
|
566
800
|
|
|
801
|
+
// 一帧算完全部布局:位置、宽度、高度、向上还是向下,全部来自当前视口 + 量出来的尺寸。
|
|
802
|
+
// 夹边永远只按「标题行 + 固定宽度」算,所以展开不会把窗口顶上去(高度自己缩,位置不动)
|
|
803
|
+
const vp = viewportSize()
|
|
804
|
+
const placed = clampDockPos(pos, vp, { w: DOCK_W, h: DOCK_HEAD_H })
|
|
805
|
+
const dockPos = { left: placed.x + "px", top: placed.y + "px" }
|
|
806
|
+
const openMaxH = Math.max(160, Math.min(DOCK_OPEN_MAX_H, vp.height - placed.y - DOCK_MARGIN))
|
|
567
807
|
return h("div", {
|
|
568
808
|
ref: boxRef,
|
|
569
809
|
style: {
|
|
570
810
|
position: "fixed",
|
|
571
811
|
zIndex: 70,
|
|
572
|
-
...
|
|
573
|
-
width:
|
|
574
|
-
maxHeight: open ? "
|
|
812
|
+
...dockPos,
|
|
813
|
+
width: DOCK_W + "px",
|
|
814
|
+
maxHeight: open ? openMaxH + "px" : "none",
|
|
575
815
|
overflow: "auto",
|
|
576
816
|
boxSizing: "border-box",
|
|
577
817
|
padding: "10px 12px",
|
|
@@ -585,6 +825,7 @@ window.__ModuleLoader__.load({
|
|
|
585
825
|
},
|
|
586
826
|
},
|
|
587
827
|
h("div", {
|
|
828
|
+
ref: headerRef,
|
|
588
829
|
style: { display: "flex", alignItems: "center", gap: "8px", cursor: "grab", userSelect: "none", touchAction: "none" },
|
|
589
830
|
title: "按住可以拖动;点一下展开或收起",
|
|
590
831
|
onPointerDown: startDrag,
|
|
@@ -657,6 +898,21 @@ window.__ModuleLoader__.load({
|
|
|
657
898
|
}
|
|
658
899
|
|
|
659
900
|
// —— 打包 ——
|
|
901
|
+
// ===== [区块] 页签一:打包:PackPanel =====
|
|
902
|
+
// 分类胶囊行:打包页与「社区资源 → 插件」共用,省得两套样式各写一遍。
|
|
903
|
+
function CategoryChips(props) {
|
|
904
|
+
const chips = props.chips || []
|
|
905
|
+
if (chips.length === 0) return null
|
|
906
|
+
return h("div", { style: { ...row, rowGap: "4px", maxHeight: "78px", overflow: "auto" } },
|
|
907
|
+
chips.map((c) => h("button", {
|
|
908
|
+
key: "chip-" + c.id,
|
|
909
|
+
type: "button",
|
|
910
|
+
style: props.value === c.id ? chipOn : chipBtn,
|
|
911
|
+
onClick: () => props.onChange(c.id),
|
|
912
|
+
title: "只看「" + c.label + "」" + (c.count ? ",市场内 " + c.count + " 个" : ""),
|
|
913
|
+
}, c.label + (c.count ? " " + c.count : ""))))
|
|
914
|
+
}
|
|
915
|
+
|
|
660
916
|
function PackPanel(props) {
|
|
661
917
|
const status = props.status
|
|
662
918
|
const jobs = Array.isArray(props.jobs) ? props.jobs : []
|
|
@@ -1016,7 +1272,7 @@ window.__ModuleLoader__.load({
|
|
|
1016
1272
|
// 停在风险点的任务:按插件分栏列出命中项,确认/删除都在这里做
|
|
1017
1273
|
const pausedRiskNodes = []
|
|
1018
1274
|
if (pausedJobs.length > 0) {
|
|
1019
|
-
pausedRiskNodes.push(h("div", { key: "title", style: { ...strong, color: "#ff6b6b" } },
|
|
1275
|
+
pausedRiskNodes.push(h("div", { key: "title", style: { ...strong, color: "#ff6b6b" } }, `打包停在风险点(${pausedJobs.length} 个任务)`))
|
|
1020
1276
|
pausedRiskNodes.push(h("div", { key: "hint", style: hint }, "下面是每个插件自己的命中项。确认后原任务从这个检测点接着跑完,不再重复检测。"))
|
|
1021
1277
|
for (const job of pausedJobs) {
|
|
1022
1278
|
const groupNodes = (job.risk.groups || []).map((group, index) => {
|
|
@@ -1160,7 +1416,7 @@ window.__ModuleLoader__.load({
|
|
|
1160
1416
|
return h("div", { style: { display: "flex", flexDirection: "column", gap: "14px" } },
|
|
1161
1417
|
h(Notice, null,
|
|
1162
1418
|
h("b", null, "打包:将所选插件封装为一个 .dshpack 文件"),
|
|
1163
|
-
"
|
|
1419
|
+
" 三种策略:完整包自带插件本体、不联网也能装;轻量包只记版本、体积最小;混合包带版本与配置片段、体积接近轻量包。完整包与混合包在安装前均不允许修改 profile 内容。",
|
|
1164
1420
|
status && status.market && status.market.installed
|
|
1165
1421
|
? h("div", { style: { ...hint, marginTop: "6px" } }, "已检测到插件市场 v" + status.market.version + ":本插件与其共用目录源与安装链路,但不依赖该插件,移除后打包与安装功能不受影响。")
|
|
1166
1422
|
: h("div", { style: { ...hint, marginTop: "6px" } }, "未检测到插件市场,功能不受影响:打包、安装与检测均在本地完成。建议先安装 dshmarket 以获得分类、搜索与「切换市场版」入口;未安装时,首次使用请点击「建立目录索引」。"),
|
|
@@ -1190,13 +1446,7 @@ window.__ModuleLoader__.load({
|
|
|
1190
1446
|
h("button", { style: btn, disabled: !!syncing, onClick: buildCatalog }, syncing || "建立目录索引(5~30 秒)"))
|
|
1191
1447
|
: null,
|
|
1192
1448
|
catalog.present && syncing ? h("div", { style: hint }, syncing) : null,
|
|
1193
|
-
catalog.present ? h(
|
|
1194
|
-
chips.map((c) => h("button", {
|
|
1195
|
-
key: c.id,
|
|
1196
|
-
style: category === c.id ? chipOn : chipBtn,
|
|
1197
|
-
onClick: () => setCategory(c.id),
|
|
1198
|
-
title: "只看「" + c.label + "」" + (c.count ? ",市场内 " + c.count + " 个" : ""),
|
|
1199
|
-
}, c.label + (c.count ? " " + c.count : "")))) : null,
|
|
1449
|
+
catalog.present ? h(CategoryChips, { chips, value: category, onChange: setCategory }) : null,
|
|
1200
1450
|
aiReady === false ? h("div", { style: hint }, "当前装的插件市场没有 AI 搜索(旧版本或未安装):这里只做关键词搜索。装新版 dshmarket 后开关会自动出现。") : null,
|
|
1201
1451
|
aiRun ? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "6px", borderColor: aiRun.error ? "#ff6b6b" : "var(--dsw-alias-border-l2)" } },
|
|
1202
1452
|
h("div", { style: row },
|
|
@@ -1278,8 +1528,8 @@ window.__ModuleLoader__.load({
|
|
|
1278
1528
|
h("input", { style: { ...input, width: "100%" }, placeholder: "一句话描述(可空)", value: options.description, onChange: (e) => setOptions({ ...options, description: e.target.value }) }),
|
|
1279
1529
|
h(Switch, { checked: options.confirmLicense, label: "我确认所选插件的许可证允许再分发,或已获得作者授权", onChange: (v) => setOptions({ ...options, confirmLicense: v }) }),
|
|
1280
1530
|
h("div", { style: row },
|
|
1281
|
-
h("button", { style: btnPrimary, disabled: picked.length === 0 || busy === "start" || Boolean(currentBlocked), onClick: doPack }, busy === "start" ? "提交中…" : (currentBlocked ? "先换个可用的策略" :
|
|
1282
|
-
started ? h("span", { style: hint }, "已开始:" + started + "
|
|
1531
|
+
h("button", { style: btnPrimary, disabled: picked.length === 0 || busy === "start" || Boolean(currentBlocked), onClick: doPack }, busy === "start" ? "提交中…" : (currentBlocked ? "先换个可用的策略" : `打包 ${picked.length} 个插件`)),
|
|
1532
|
+
started ? h("span", { style: hint }, "已开始:" + started + "(进度在悬浮窗,可以接着选别的再打一个)") : null,
|
|
1283
1533
|
status ? h("span", { style: hint }, "DSH " + (status.dshVersion || "?") + " · profile " + status.profile) : null)),
|
|
1284
1534
|
pausedRiskNodes.length ? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "10px", borderColor: "#d9534f" } }, pausedRiskNodes) : null,
|
|
1285
1535
|
error ? h(Notice, { tone: "bad" }, error) : null,
|
|
@@ -1302,7 +1552,7 @@ window.__ModuleLoader__.load({
|
|
|
1302
1552
|
result.manifest && result.manifest.plugins && result.manifest.plugins.length
|
|
1303
1553
|
? h("div", { style: { display: "flex", flexDirection: "column", gap: "2px" } },
|
|
1304
1554
|
result.manifest.plugins.map((p) => h("div", { key: p.name, style: mono },
|
|
1305
|
-
"· " + p.name + "@" + p.version + " " + (p.size ? bytes(p.size) : "") + ((p.mode === "local" || p.localEdits) ? " [本地改动]" : " [基础配置]") + (p.configIncluded ? " [含配置]" : ""))))
|
|
1555
|
+
"· " + p.name + (p.latest ? "@市场最新" : "@" + p.version) + " " + (p.size ? bytes(p.size) : "") + ((p.mode === "local" || p.localEdits) ? " [本地改动]" : " [基础配置]") + (p.configIncluded ? " [含配置]" : ""))))
|
|
1306
1556
|
: null,
|
|
1307
1557
|
result.compat ? h(CompatList, { compat: result.compat }) : null,
|
|
1308
1558
|
result.notes && result.notes.length ? h("div", { style: { ...hint, maxHeight: "110px", overflow: "auto" } }, result.notes.map((n, i) => h("div", { key: i }, "· " + n))) : null,
|
|
@@ -1315,6 +1565,7 @@ window.__ModuleLoader__.load({
|
|
|
1315
1565
|
}
|
|
1316
1566
|
|
|
1317
1567
|
// —— 安装 / 导入 ——
|
|
1568
|
+
// ===== [区块] 页签二:安装 / 导入:InstallPanel =====
|
|
1318
1569
|
function InstallPanel(props) {
|
|
1319
1570
|
const [source, setSource] = useState({ kind: "url", url: "", file: "" })
|
|
1320
1571
|
const [packs, setPacks] = useState([])
|
|
@@ -1346,6 +1597,26 @@ window.__ModuleLoader__.load({
|
|
|
1346
1597
|
setError("")
|
|
1347
1598
|
}), [])
|
|
1348
1599
|
|
|
1600
|
+
// 从「社区资源」点「下载并安装」过来:包已经在后端取回、校验并换成 token,
|
|
1601
|
+
// 这里接住直接读一遍预览,后面的勾选、扫描、兼容提示走的是同一条安装流程。
|
|
1602
|
+
useEffect(() => subscribeInstallRequest((payload) => {
|
|
1603
|
+
if (!payload || !payload.token) return
|
|
1604
|
+
installRequest.value = null
|
|
1605
|
+
setSource({ kind: "token", token: payload.token, url: "", file: "" })
|
|
1606
|
+
setError("")
|
|
1607
|
+
setDone(null)
|
|
1608
|
+
setDeferred([])
|
|
1609
|
+
setAskReplace(false)
|
|
1610
|
+
setBusy("import")
|
|
1611
|
+
api("/inspect", { token: payload.token })
|
|
1612
|
+
.then((data) => {
|
|
1613
|
+
if (data && data.ok) setPreview(data)
|
|
1614
|
+
else { setPreview(null); setError((data && data.error) || "读取失败") }
|
|
1615
|
+
})
|
|
1616
|
+
.catch((e) => { setPreview(null); setError((e && e.message) || String(e)) })
|
|
1617
|
+
.finally(() => setBusy(""))
|
|
1618
|
+
}), [])
|
|
1619
|
+
|
|
1349
1620
|
const fileRef = useRef(null)
|
|
1350
1621
|
|
|
1351
1622
|
// 用「打开文件」的方式挑一个 .dshpack:字节直接读,不要求你写路径
|
|
@@ -1634,7 +1905,7 @@ window.__ModuleLoader__.load({
|
|
|
1634
1905
|
return h("div", { key: p.name, style: { display: "flex", gap: "8px", alignItems: "center", flexWrap: "wrap", padding: "4px 0", borderTop: "0.5px solid var(--dsw-alias-border-l2)" } },
|
|
1635
1906
|
h("input", { type: "checkbox", checked, onChange: () => setPickedNames((prev) => ({ ...prev, [p.name]: !checked })) }),
|
|
1636
1907
|
h("div", { style: { flex: "1 1 220px", minWidth: "170px" } },
|
|
1637
|
-
h("div", { style: label }, p.name, " ", h("span", { style: hint }, "@" + (p.version || "?"))),
|
|
1908
|
+
h("div", { style: label }, p.name, " ", h("span", { style: hint }, p.latest ? "@市场最新(装的时候按名字取)" : "@" + (p.version || "?"))),
|
|
1638
1909
|
h("div", { style: hint }, [p.localEdits ? "含本机修改" : "", p.configIncluded ? "有配置" : "", p.dataIncluded ? "有数据快照" : ""].filter(Boolean).join(" · ")),
|
|
1639
1910
|
row.problems.length ? h("div", { style: { ...hint, color: row.problems.some((f) => f.level === "error") ? "#ff6b6b" : "#ffb020" } },
|
|
1640
1911
|
row.problems.slice(0, 3).map((f) => "· " + f.message).join(";") + (row.problems.length > 3 ? "(还有 " + (row.problems.length - 3) + " 条)" : "")) : null),
|
|
@@ -1657,7 +1928,7 @@ window.__ModuleLoader__.load({
|
|
|
1657
1928
|
h("div", { style: hint }, "要保留本机版本就直接完成;要换成包内版本点下面这个(会覆盖本机那份)。"),
|
|
1658
1929
|
h("div", { style: row },
|
|
1659
1930
|
h("button", { style: btn, disabled: busy !== "", onClick: () => { setAskReplace(false) } }, "直接完成(保留本机版本)"),
|
|
1660
|
-
h("button", { style: btnPrimary, disabled: busy !== "", onClick: () => replaceDeferred(deferred.map((d) => d.name)) },
|
|
1931
|
+
h("button", { style: btnPrimary, disabled: busy !== "", onClick: () => replaceDeferred(deferred.map((d) => d.name)) }, `重新装一下这 ${deferred.length} 个(用包内版本)`)))
|
|
1661
1932
|
: null,
|
|
1662
1933
|
done ? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
|
|
1663
1934
|
h("div", { style: row },
|
|
@@ -1700,14 +1971,16 @@ window.__ModuleLoader__.load({
|
|
|
1700
1971
|
h("span", null, "如果这个插件省了时间,顺手点个 Star,能让更多人找到它。"))
|
|
1701
1972
|
}
|
|
1702
1973
|
|
|
1974
|
+
// ===== [区块] 页签四:设置与记录:SettingsPanel =====
|
|
1703
1975
|
function SettingsPanel(props) {
|
|
1704
|
-
const [cfg, setCfg] = useState(props.status
|
|
1976
|
+
const [cfg, setCfg] = useState(() => ({ ...((props.status && props.status.config) || {}), ...(liveCfg.value || {}) }))
|
|
1705
1977
|
const [saved, setSaved] = useState("")
|
|
1706
1978
|
const [busy, setBusy] = useState(false)
|
|
1707
1979
|
const [scanNag, fireScanNag] = useNag()
|
|
1708
1980
|
// 记录用本地状态:删一条不用整页重读,删完立刻看到结果
|
|
1709
1981
|
const [history, setHistory] = useState((((props.status || {}).history) || []).slice())
|
|
1710
1982
|
const [historyMsg, setHistoryMsg] = useState("")
|
|
1983
|
+
const [marketSidebarMsg, setMarketSidebarMsg] = useState("")
|
|
1711
1984
|
const dropHistory = async (item, all) => {
|
|
1712
1985
|
setHistoryMsg("")
|
|
1713
1986
|
try {
|
|
@@ -1729,13 +2002,33 @@ window.__ModuleLoader__.load({
|
|
|
1729
2002
|
setBusy(true); setSaved("")
|
|
1730
2003
|
try {
|
|
1731
2004
|
const data = await api("/settings", { patch: p })
|
|
1732
|
-
if (data && data.ok) {
|
|
2005
|
+
if (data && data.ok) {
|
|
2006
|
+
setCfg(data.config)
|
|
2007
|
+
mergeLiveConfig(data.config)
|
|
2008
|
+
// 「社区资源」这一栏的开关键在这里:一关,标签立刻消失,不用等重新拉状态
|
|
2009
|
+
if (Object.prototype.hasOwnProperty.call(p, "showModpackMarket")) setMarketVisible(data.config.showModpackMarket !== false)
|
|
2010
|
+
setSaved("已保存")
|
|
2011
|
+
}
|
|
1733
2012
|
else setSaved((data && data.error) || "保存失败")
|
|
1734
2013
|
} catch (e) {
|
|
1735
2014
|
setSaved(e.message || String(e))
|
|
1736
2015
|
} finally { setBusy(false) }
|
|
1737
2016
|
}
|
|
1738
2017
|
const setField = (key, value) => setCfg((prev) => ({ ...(prev || {}), [key]: value }))
|
|
2018
|
+
// 打开就替市场把侧栏入口关掉;关掉就还回去。市场没装就只提示,不报错。
|
|
2019
|
+
const toggleMarketSidebar = async (on) => {
|
|
2020
|
+
setMarketSidebarMsg("")
|
|
2021
|
+
setField("forceHideMarketSidebar", on)
|
|
2022
|
+
await patch({ forceHideMarketSidebar: on })
|
|
2023
|
+
const current = await readMarketSidebar()
|
|
2024
|
+
if (!current) { setMarketSidebarMsg("没装插件市场(dshmarket),或者在旧版本上没有这个入口。"); return }
|
|
2025
|
+
try {
|
|
2026
|
+
await writeMarketSidebar(!on)
|
|
2027
|
+
setMarketSidebarMsg(on ? "已关掉:市场侧栏那一行现在不显示。" : "已恢复:市场侧栏那一行按它的设置显示。")
|
|
2028
|
+
} catch (e) {
|
|
2029
|
+
setMarketSidebarMsg((e && e.message) || String(e))
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
1739
2032
|
// 体积上限按 MB 输:先把输入框里的原始文本存着,点「保存数值」才换算成字节,
|
|
1740
2033
|
// 这样不会每敲一个数字就四舍五入一次(以前会越打越多,最后存成 25 GB 这种值)。
|
|
1741
2034
|
const [limitDraft, setLimitDraft] = useState(String(Math.round(((props.status && props.status.config && props.status.config.maxPackBytes) || 256 * 1048576) / 1048576)))
|
|
@@ -1876,7 +2169,30 @@ window.__ModuleLoader__.load({
|
|
|
1876
2169
|
h(Switch, { checked: cfg.showInSettings !== false, disabled: placementLocked("showInSettings"), label: "在设置里显示(插件设置页内一栏「整合包」)" + (placementLocked("showInSettings") ? "(最后剩这一个,不能关)" : ""), onChange: (v) => savePlacement("showInSettings", v) }),
|
|
1877
2170
|
h(Switch, { checked: cfg.showInSidebar !== false, disabled: placementLocked("showInSidebar"), label: "在侧边栏显示(左侧栏「整合包」入口)" + (placementLocked("showInSidebar") ? "(最后剩这一个,不能关)" : ""), onChange: (v) => savePlacement("showInSidebar", v) }),
|
|
1878
2171
|
h(Switch, { checked: cfg.showInPluginsTab === true, disabled: placementLocked("showInPluginsTab"), label: "在插件页内显示(与插件市场同一位置,单开一栏「整合包」)" + (placementLocked("showInPluginsTab") ? "(最后剩这一个,不能关)" : ""), onChange: (v) => savePlacement("showInPluginsTab", v) })),
|
|
2172
|
+
h("div", { style: { ...hint, borderTop: "0.5px solid var(--dsw-alias-border-l2)", paddingTop: "8px", marginTop: "2px" } }, "插件市场自己那一行(与上面整合包的入口无关):"),
|
|
2173
|
+
h(Switch, {
|
|
2174
|
+
checked: cfg.forceHideMarketSidebar === true,
|
|
2175
|
+
label: "强制关闭侧栏里的插件市场显示",
|
|
2176
|
+
title: "每次开机强制显示还关不掉很烦吧",
|
|
2177
|
+
onChange: (v) => toggleMarketSidebar(v),
|
|
2178
|
+
}),
|
|
2179
|
+
h("div", { style: hint }, "只关市场自己的,不动整合包:改的是它存在 .dsh-market/state.json 里的 sidebarEntry,不动它的安装,也不动整合包的入口。"),
|
|
2180
|
+
marketSidebarMsg ? h("div", { style: hint }, marketSidebarMsg) : null,
|
|
1879
2181
|
saved ? h("span", { style: hint }, saved) : null),
|
|
2182
|
+
h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
|
|
2183
|
+
h("div", { style: strong }, "社区资源(附属功能)"),
|
|
2184
|
+
h(Switch, {
|
|
2185
|
+
checked: cfg.showModpackMarket !== false,
|
|
2186
|
+
label: "显示「社区资源」这一栏",
|
|
2187
|
+
title: "插件自带、默认开启;关掉只是不显示这一栏",
|
|
2188
|
+
onChange: (v) => patch({ showModpackMarket: v }),
|
|
2189
|
+
}),
|
|
2190
|
+
h("div", { style: hint }, "关掉只是不显示这一栏,已经下载与安装的整合包不受影响。目录来自自建仓库 " + (((props.status || {}).modpackMarket || {}).repo || "Vesna-Strivozha-cn/dsh-modpack-catalog") + ",CI 每天重建一次。"),
|
|
2191
|
+
h("div", { style: row },
|
|
2192
|
+
h("span", { style: label }, "自动更新(小时)"),
|
|
2193
|
+
h("input", { style: { ...input, width: "78px" }, type: "number", min: "1", max: "168", value: cfg.modpackRefreshHours || 24, onChange: (e) => setField("modpackRefreshHours", Number(e.target.value)) }),
|
|
2194
|
+
h("button", { style: btn, disabled: busy, onClick: () => patch({ modpackRefreshHours: cfg.modpackRefreshHours }) }, "保存")),
|
|
2195
|
+
h("div", { style: hint }, "搜索、分类、详情与下载码都在「社区资源」那一栏里;上传方式与规则点那一栏右上角。")),
|
|
1880
2196
|
h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
|
|
1881
2197
|
h("div", { style: strong }, "插件目录(分类 · 搜索 · 分页)"),
|
|
1882
2198
|
h("div", { style: hint }, (() => {
|
|
@@ -1895,6 +2211,561 @@ window.__ModuleLoader__.load({
|
|
|
1895
2211
|
)
|
|
1896
2212
|
}
|
|
1897
2213
|
|
|
2214
|
+
// —— 社区资源 ——
|
|
2215
|
+
// 「从市场下载」到「安装页」之间只有一次交接:市场负责下载、校验、把 token 递过去,
|
|
2216
|
+
// 识别 / 扫描 / 兼容 / 许可证 / 安装这些仍然由安装页那条老路做,不另起一套。
|
|
2217
|
+
const installRequest = { value: null, subs: new Set() }
|
|
2218
|
+
const requestInstall = (payload) => {
|
|
2219
|
+
installRequest.value = payload || null
|
|
2220
|
+
for (const fn of [...installRequest.subs]) {
|
|
2221
|
+
try { fn(installRequest.value) } catch (e) { }
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
const subscribeInstallRequest = (fn) => {
|
|
2225
|
+
installRequest.subs.add(fn)
|
|
2226
|
+
if (installRequest.value) {
|
|
2227
|
+
try { fn(installRequest.value) } catch (e) { }
|
|
2228
|
+
}
|
|
2229
|
+
return () => { installRequest.subs.delete(fn) }
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
const MARKET_SORTS = [["new", "最新"], ["downloads", "下载量"], ["size", "体积"], ["name", "名称"]]
|
|
2233
|
+
const MARKET_RULES = [
|
|
2234
|
+
"只收轻量包(strategy: lite):只记插件名与版本、不带插件本体,十几 KB;装的人联网按版本取包。",
|
|
2235
|
+
"第 1 步:在本插件「打包」页选「轻量包」、勾插件、打包并下载成 <名字>-<日期>-lite.dshpack。",
|
|
2236
|
+
"第 2 步:算 sha256(Windows:certutil -hashfile 名字.dshpack SHA256;macOS/Linux:shasum -a 256 名字.dshpack),再记下字节数(≤ 64 MB)。",
|
|
2237
|
+
"第 3 步:fork github.com/Vesna-Strivozha-cn/dsh-modpack-catalog,切一个分支,把包放进 packs/,再写一份 data/packs/<id>.json(只写 id、类型、文件名、sha256、日期)。",
|
|
2238
|
+
"第 4 步:本地跑 node scripts/build.mjs,看到「packs.json: N 个整合包」才算过;报「构建失败」按提示改(多半是 sha256/size 对不上或分类写错)。",
|
|
2239
|
+
"第 5 步:提交、push、开 PR;CI 会重跑构建,合并后每天 03:17 UTC 自动重建目录,也可以在 Actions 里手动 Run workflow 立刻扫一轮。",
|
|
2240
|
+
"条目里不要写介绍、名称、作者、插件清单:目录直接显示包内 dsh-modpack.json(也就是打包那一刻填的内容),写了两边会不一致,构建会挡下。",
|
|
2241
|
+
"包内插件可以不写死版本:清单里写 { \"name\": \"dsh-context\", \"latest\": true },安装时按名字取市场最新版(插件市场认市场版);写 version 就必须是 x.y.z。",
|
|
2242
|
+
"分类按使用场景:工作办公、性能优化、界面美化、实用功能、开发调试、娱乐休闲、学习资料、水槽(插件横跨三类以上会自动归这里)、其它。",
|
|
2243
|
+
"只提交你自己打的包,或者你有权再分发的插件组合;作者没写许可证的组合请先问作者。",
|
|
2244
|
+
]
|
|
2245
|
+
|
|
2246
|
+
// ===== [区块] 页签三:社区资源:MarketPanel =====
|
|
2247
|
+
// 两层:外层管左侧「插件 / 整合包」两个大类,里层各自是独立的浏览面板。
|
|
2248
|
+
// 整合包这层就是原来的整包浏览(列表 / 详情 / 上传规则)。
|
|
2249
|
+
function MarketPanel(props) {
|
|
2250
|
+
const [kind, setKind] = useState(() => (readMarketUi().kind === "plugin" ? "plugin" : "modpack"))
|
|
2251
|
+
useEffect(() => { saveMarketKind(kind) }, [kind])
|
|
2252
|
+
const market = (props.status && props.status.market) || null
|
|
2253
|
+
const installed = Boolean(market && market.installed)
|
|
2254
|
+
const railBtn = (id, text, note) => h("button", {
|
|
2255
|
+
type: "button",
|
|
2256
|
+
key: "rail-" + id,
|
|
2257
|
+
onClick: () => setKind(id),
|
|
2258
|
+
style: {
|
|
2259
|
+
display: "flex",
|
|
2260
|
+
flexDirection: "column",
|
|
2261
|
+
alignItems: "flex-start",
|
|
2262
|
+
gap: "2px",
|
|
2263
|
+
width: "100%",
|
|
2264
|
+
padding: "9px 10px",
|
|
2265
|
+
borderRadius: "8px",
|
|
2266
|
+
border: kind === id ? "1px solid #4C7DF0" : "1px solid transparent",
|
|
2267
|
+
background: kind === id ? "rgba(76, 125, 240, 0.12)" : "transparent",
|
|
2268
|
+
color: "inherit",
|
|
2269
|
+
cursor: "pointer",
|
|
2270
|
+
textAlign: "left",
|
|
2271
|
+
fontSize: "13px",
|
|
2272
|
+
fontWeight: kind === id ? 600 : 400,
|
|
2273
|
+
},
|
|
2274
|
+
},
|
|
2275
|
+
h("span", null, text),
|
|
2276
|
+
note ? h("span", { style: { ...hint, fontSize: "11px", lineHeight: "15px" } }, note) : null)
|
|
2277
|
+
const rail = h("div", {
|
|
2278
|
+
style: {
|
|
2279
|
+
width: "152px",
|
|
2280
|
+
flexShrink: 0,
|
|
2281
|
+
display: "flex",
|
|
2282
|
+
flexDirection: "column",
|
|
2283
|
+
gap: "4px",
|
|
2284
|
+
borderRight: "0.5px solid var(--dsw-alias-border-l2)",
|
|
2285
|
+
paddingRight: "10px",
|
|
2286
|
+
position: "sticky",
|
|
2287
|
+
top: 0,
|
|
2288
|
+
},
|
|
2289
|
+
},
|
|
2290
|
+
h("span", { style: { ...hint, padding: "0 2px 4px" } }, "大类"),
|
|
2291
|
+
railBtn("modpack", "整合包", "打包好的插件组合"),
|
|
2292
|
+
railBtn("plugin", "插件", installed ? "接入插件市场" : "需要插件市场"))
|
|
2293
|
+
return h("div", { style: { display: "flex", gap: "14px", alignItems: "flex-start" } },
|
|
2294
|
+
rail,
|
|
2295
|
+
h("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "10px" } },
|
|
2296
|
+
kind === "plugin" ? h(PluginBrowser, { status: props.status }) : h(ModpackBrowser, props)))
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
// 「插件」这一类不自己造目录:直接用插件市场的目录与检索(dsh-plugin-catalog),
|
|
2300
|
+
// 没装市场就没有这一层可看——所以先提示去装市场,而不是给一个空列表。
|
|
2301
|
+
function PluginBrowser(props) {
|
|
2302
|
+
const market = (props.status && props.status.market) || null
|
|
2303
|
+
const installed = Boolean(market && market.installed)
|
|
2304
|
+
const pluginSnap = readMarketUi().plugin || {}
|
|
2305
|
+
const [query, setQuery] = useState(typeof pluginSnap.query === "string" ? pluginSnap.query : "")
|
|
2306
|
+
const [category, setCategory] = useState(typeof pluginSnap.category === "string" ? pluginSnap.category : "all")
|
|
2307
|
+
const [sort, setSort] = useState(typeof pluginSnap.sort === "string" ? pluginSnap.sort : "market")
|
|
2308
|
+
const [items, setItems] = useState(Array.isArray(pluginSnap.items) ? pluginSnap.items : [])
|
|
2309
|
+
const [total, setTotal] = useState(Number(pluginSnap.total) || 0)
|
|
2310
|
+
const [page, setPage] = useState(Number(pluginSnap.page) || 1)
|
|
2311
|
+
const [hasMore, setHasMore] = useState(pluginSnap.hasMore === true)
|
|
2312
|
+
const [chips, setChips] = useState(Array.isArray(pluginSnap.chips) && pluginSnap.chips.length ? pluginSnap.chips : [{ id: "all", label: "全部", count: 0 }])
|
|
2313
|
+
const [loading, setLoading] = useState(false)
|
|
2314
|
+
const [error, setError] = useState("")
|
|
2315
|
+
// 第一屏如果有上次留下的列表,就别再打一次请求(会闪一下、还把页码冲回 1)
|
|
2316
|
+
const restoredPlugins = useRef(Array.isArray(pluginSnap.items) && pluginSnap.items.length > 0)
|
|
2317
|
+
const applyItems = (data, append) => {
|
|
2318
|
+
const next = Array.isArray(data.items) ? data.items : []
|
|
2319
|
+
setItems(append ? (prev) => prev.concat(next) : next)
|
|
2320
|
+
setTotal(Number(data.total) || 0)
|
|
2321
|
+
setHasMore(Boolean(data.hasMore))
|
|
2322
|
+
if (Array.isArray(data.categories)) {
|
|
2323
|
+
setChips([{ id: "all", label: "全部", count: (data.summary && data.summary.count) || Number(data.total) || 0 }]
|
|
2324
|
+
.concat(data.categories.map((c) => ({ id: c.label, label: c.label, count: c.count || 0 }))))
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
// 分类直接沿用插件市场目录的口径:服务端按 label 过滤,前端只拿一页
|
|
2328
|
+
// 退出程序前一直留着:搜索框文字、分类、排序、页码与已读到的列表
|
|
2329
|
+
useEffect(() => {
|
|
2330
|
+
saveMarketUi("plugin", { query, category, sort, items, total, page, hasMore, chips })
|
|
2331
|
+
}, [query, category, sort, items, total, page, hasMore, chips])
|
|
2332
|
+
useEffect(() => {
|
|
2333
|
+
if (!installed) return undefined
|
|
2334
|
+
if (restoredPlugins.current) { restoredPlugins.current = false; return undefined }
|
|
2335
|
+
let alive = true
|
|
2336
|
+
const timer = setTimeout(() => {
|
|
2337
|
+
setLoading(true)
|
|
2338
|
+
api("/catalog/search", { query, category, sort, page: 1, pageSize: 20 })
|
|
2339
|
+
.then((data) => {
|
|
2340
|
+
if (!alive) return
|
|
2341
|
+
applyItems(data, false)
|
|
2342
|
+
setPage(1)
|
|
2343
|
+
setError(data && data.ok === false ? (data.error || "") : "")
|
|
2344
|
+
})
|
|
2345
|
+
.catch((e) => { if (alive) setError((e && e.message) || String(e)) })
|
|
2346
|
+
.finally(() => { if (alive) setLoading(false) })
|
|
2347
|
+
}, 220)
|
|
2348
|
+
return () => { alive = false; clearTimeout(timer) }
|
|
2349
|
+
}, [installed, query, category, sort])
|
|
2350
|
+
const loadMore = async () => {
|
|
2351
|
+
if (!hasMore || loading) return
|
|
2352
|
+
setLoading(true)
|
|
2353
|
+
try {
|
|
2354
|
+
const data = await api("/catalog/search", { query, category, sort, page: page + 1, pageSize: 20 })
|
|
2355
|
+
if (data && data.ok) { applyItems(data, true); setPage(page + 1) }
|
|
2356
|
+
} catch (e) {
|
|
2357
|
+
setError((e && e.message) || String(e))
|
|
2358
|
+
} finally {
|
|
2359
|
+
setLoading(false)
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
if (!installed) {
|
|
2363
|
+
return h("div", { style: { border: "1px dashed var(--dsw-alias-border-l2)", borderRadius: "10px", padding: "16px", display: "flex", flexDirection: "column", gap: "8px" } },
|
|
2364
|
+
h("span", { style: strong }, "请先安装插件市场"),
|
|
2365
|
+
h("span", { style: hint }, "「插件」这一类直接读插件市场(dshmarket)的目录与检索,功能基于插件市场;没装就没有这一层可看。"),
|
|
2366
|
+
h("span", { style: hint }, "装好插件市场后回到这里,左边这一项会变成「接入插件市场」,列表也就有了。"))
|
|
2367
|
+
}
|
|
2368
|
+
return h("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } },
|
|
2369
|
+
h("div", { style: { border: "1px solid var(--dsw-alias-border-l2)", borderRadius: "10px", padding: "12px", display: "flex", flexDirection: "column", gap: "8px" } },
|
|
2370
|
+
h("div", { style: { ...row, justifyContent: "space-between" } },
|
|
2371
|
+
h("span", { style: { ...strong, fontSize: "13px" } }, "搜索插件"),
|
|
2372
|
+
h("span", { style: hint }, "跟打包页同一套:分类、搜索、已装优先;目录与检索都来自插件市场(dsh-plugin-catalog)")),
|
|
2373
|
+
h("div", { style: { display: "grid", gridTemplateColumns: "minmax(160px, 1fr) 160px 120px", gap: "8px", alignItems: "center" } },
|
|
2374
|
+
h("input", {
|
|
2375
|
+
type: "search",
|
|
2376
|
+
value: query,
|
|
2377
|
+
placeholder: "插件名 / 作者 / 描述(例如 记忆、壁纸、侧边栏)",
|
|
2378
|
+
onChange: (event) => setQuery(event.target.value),
|
|
2379
|
+
style: { height: "30px", borderRadius: "6px", border: "1px solid var(--dsw-alias-border-l2)", background: "transparent", color: "inherit", fontSize: "12.5px", padding: "0 8px" },
|
|
2380
|
+
}),
|
|
2381
|
+
h("select", {
|
|
2382
|
+
value: sort,
|
|
2383
|
+
onChange: (event) => setSort(event.target.value),
|
|
2384
|
+
style: { height: "30px", borderRadius: "6px", border: "1px solid var(--dsw-alias-border-l2)", background: "transparent", color: "inherit", fontSize: "12.5px" },
|
|
2385
|
+
}, [["market", "按相关度"], ["new", "最新发布"], ["name", "按名字"]].map(([value, text]) => h("option", { key: value, value }, text))),
|
|
2386
|
+
h("span", { style: { ...hint, textAlign: "right" } }, loading ? "搜索中…" : "共 " + total + " 个")),
|
|
2387
|
+
h(CategoryChips, { chips, value: category, onChange: setCategory })),
|
|
2388
|
+
error ? h("div", { style: { ...hint, color: "#ff6b6b", lineHeight: "19px" } }, String(error)) : null,
|
|
2389
|
+
loading && items.length === 0 ? h("div", { style: { ...hint, padding: "14px 2px" } }, "正在读取插件目录…") : null,
|
|
2390
|
+
!loading && items.length === 0 && !error
|
|
2391
|
+
? h("div", { style: { border: "1px dashed var(--dsw-alias-border-l2)", borderRadius: "10px", padding: "16px", display: "flex", flexDirection: "column", gap: "6px" } },
|
|
2392
|
+
h("span", { style: strong }, query ? "没有匹配的插件" : "插件目录还是空的"),
|
|
2393
|
+
h("span", { style: hint }, query ? "换个说法试试:插件名、作者名、描述里的词都能搜。" : "插件市场还没建过目录索引:去插件市场里刷一次,或等它自己更新。"))
|
|
2394
|
+
: null,
|
|
2395
|
+
h("div", { style: { border: "1px solid var(--dsw-alias-border-l2)", borderRadius: "10px", overflow: "hidden" } },
|
|
2396
|
+
items.map((item) => h("div", {
|
|
2397
|
+
key: "plug-" + item.name,
|
|
2398
|
+
style: { display: "flex", flexDirection: "column", gap: "3px", padding: "9px 12px", borderBottom: "0.5px solid var(--dsw-alias-border-l2)" },
|
|
2399
|
+
},
|
|
2400
|
+
h("div", { style: row },
|
|
2401
|
+
h("span", { style: { fontSize: "13px", fontWeight: 600 } }, item.title || item.name),
|
|
2402
|
+
h(Tag, null, item.categoryLabel || item.category || "其它"),
|
|
2403
|
+
item.installed ? h("span", { style: { ...hint, color: "#2bb673" } }, "本机已装" + (item.updateAvailable ? "(市场版 " + item.version + " 更新)" : "")) : null,
|
|
2404
|
+
h("span", { style: { ...hint, marginLeft: "auto" } }, item.version ? "v" + item.version : "")),
|
|
2405
|
+
h("span", { style: hint }, item.description || "作者没写说明。"),
|
|
2406
|
+
h("span", { style: { ...hint, fontSize: "11.5px" } }, item.name)))),
|
|
2407
|
+
hasMore ? h("div", { style: row },
|
|
2408
|
+
h("button", { type: "button", style: btn, disabled: loading, onClick: loadMore }, loading ? "读取中…" : "加载更多")) : null,
|
|
2409
|
+
h("div", { style: hint }, "装 / 更新 / 卸载插件仍在插件市场里做:这一层只按它的目录浏览与检索,不重复实现一套安装。"))
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
// ===== [区块] 页签三:社区资源:整合包浏览(列表 / 详情 / 上传规则) =====
|
|
2413
|
+
function ModpackBrowser(props) {
|
|
2414
|
+
const packSnap = readMarketUi().pack || {}
|
|
2415
|
+
const [view, setView] = useState(packSnap.view === "detail" || packSnap.view === "rules" ? packSnap.view : "list")
|
|
2416
|
+
const [summary, setSummary] = useState(packSnap.summary || null)
|
|
2417
|
+
const [items, setItems] = useState(Array.isArray(packSnap.items) ? packSnap.items : [])
|
|
2418
|
+
const [total, setTotal] = useState(Number(packSnap.total) || 0)
|
|
2419
|
+
const [page, setPage] = useState(Number(packSnap.page) || 1)
|
|
2420
|
+
const [hasMore, setHasMore] = useState(packSnap.hasMore === true)
|
|
2421
|
+
const [query, setQuery] = useState(typeof packSnap.query === "string" ? packSnap.query : "")
|
|
2422
|
+
const [category, setCategory] = useState(typeof packSnap.category === "string" ? packSnap.category : "all")
|
|
2423
|
+
const [sort, setSort] = useState(typeof packSnap.sort === "string" ? packSnap.sort : "new")
|
|
2424
|
+
const [loading, setLoading] = useState(!(packSnap.dataReady === true))
|
|
2425
|
+
const [searching, setSearching] = useState(false)
|
|
2426
|
+
const [syncing, setSyncing] = useState(false)
|
|
2427
|
+
const [error, setError] = useState("")
|
|
2428
|
+
const [msg, setMsg] = useState("")
|
|
2429
|
+
const [detail, setDetail] = useState(packSnap.detail || null)
|
|
2430
|
+
const [descOpen, setDescOpen] = useState(packSnap.descOpen !== false)
|
|
2431
|
+
const [descTick, setDescTick] = useState(0)
|
|
2432
|
+
const [downloading, setDownloading] = useState(false)
|
|
2433
|
+
const [reloadKey, setReloadKey] = useState(0)
|
|
2434
|
+
const [searchTick, setSearchTick] = useState(0)
|
|
2435
|
+
const mounted = useRef(true)
|
|
2436
|
+
useEffect(() => () => { mounted.current = false }, [])
|
|
2437
|
+
// 退出程序前一直留着:搜索框文字、分类、排序、页码、读到的列表、打开着的详情/规则页
|
|
2438
|
+
useEffect(() => {
|
|
2439
|
+
saveMarketUi("pack", { view, summary, items, total, page, hasMore, query, category, sort, detail, dataReady: true })
|
|
2440
|
+
}, [view, summary, items, total, page, hasMore, query, category, sort, detail])
|
|
2441
|
+
|
|
2442
|
+
// 打开详情时补齐插件介绍:包里写了就用包里的,没写就问插件市场的目录
|
|
2443
|
+
useEffect(() => {
|
|
2444
|
+
if (view !== "detail" || !detail) return undefined
|
|
2445
|
+
const plugins = Array.isArray(detail.plugins) ? detail.plugins : []
|
|
2446
|
+
const missing = plugins
|
|
2447
|
+
.filter((plugin) => plugin && plugin.name && !(plugin.description && String(plugin.description).trim()) && !hasPluginDesc(plugin.name))
|
|
2448
|
+
.map((plugin) => plugin.name)
|
|
2449
|
+
if (missing.length === 0) return undefined
|
|
2450
|
+
let alive = true
|
|
2451
|
+
api("/catalog/lookup", { names: missing.slice(0, 200) })
|
|
2452
|
+
.then((data) => {
|
|
2453
|
+
if (!alive) return
|
|
2454
|
+
const items = (data && data.items) || {}
|
|
2455
|
+
let hit = 0
|
|
2456
|
+
for (const name of missing) {
|
|
2457
|
+
const item = items[name]
|
|
2458
|
+
// 市场里没有的也记一笔空值:下次打开这份详情不再重复问
|
|
2459
|
+
pluginDescCache.set(name, item && item.description ? item : { description: "" })
|
|
2460
|
+
if (item && item.description) hit += 1
|
|
2461
|
+
}
|
|
2462
|
+
if (hit > 0) setDescTick((n) => n + 1)
|
|
2463
|
+
})
|
|
2464
|
+
.catch(() => {})
|
|
2465
|
+
return () => { alive = false }
|
|
2466
|
+
}, [view, detail])
|
|
2467
|
+
|
|
2468
|
+
const pluginDescOf = (plugin) => {
|
|
2469
|
+
if (plugin.description && String(plugin.description).trim()) return String(plugin.description)
|
|
2470
|
+
const cached = cachedPluginDesc(plugin.name)
|
|
2471
|
+
if (cached) return cached
|
|
2472
|
+
return "插件市场里没有它的介绍。"
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
const applyData = (data) => {
|
|
2476
|
+
if (!data) return
|
|
2477
|
+
if (data.summary) setSummary(data.summary)
|
|
2478
|
+
setItems(Array.isArray(data.items) ? data.items : [])
|
|
2479
|
+
setTotal(Number(data.total) || 0)
|
|
2480
|
+
setHasMore(Boolean(data.hasMore))
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
const restoredPack = useRef(packSnap.dataReady === true)
|
|
2484
|
+
useEffect(() => {
|
|
2485
|
+
if (restoredPack.current) { restoredPack.current = false; return undefined }
|
|
2486
|
+
let alive = true
|
|
2487
|
+
setLoading(true)
|
|
2488
|
+
api("/market").then((data) => {
|
|
2489
|
+
if (!alive) return
|
|
2490
|
+
applyData(data)
|
|
2491
|
+
setError("")
|
|
2492
|
+
}).catch((e) => { if (alive) setError((e && e.message) || String(e)) }).finally(() => { if (alive) setLoading(false) })
|
|
2493
|
+
return () => { alive = false }
|
|
2494
|
+
}, [reloadKey])
|
|
2495
|
+
|
|
2496
|
+
const retry = () => { setError(""); setMsg(""); setLoading(true); setReloadKey((n) => n + 1) }
|
|
2497
|
+
|
|
2498
|
+
// 搜索 / 分类 / 排序都走服务端分页:客户端只拿一页,目录再大也不卡
|
|
2499
|
+
const skipFirstSearch = useRef(packSnap.dataReady === true)
|
|
2500
|
+
useEffect(() => {
|
|
2501
|
+
if (loading) return undefined
|
|
2502
|
+
// 回来时上次的列表还在,没必要为同一组条件再查一遍
|
|
2503
|
+
if (skipFirstSearch.current) { skipFirstSearch.current = false; return undefined }
|
|
2504
|
+
let alive = true
|
|
2505
|
+
const timer = setTimeout(() => {
|
|
2506
|
+
setSearching(true)
|
|
2507
|
+
api("/market/search", { query, category, sort, page: 1, pageSize: 20 })
|
|
2508
|
+
.then((data) => { if (alive) { applyData(data); setError(data && data.ok === false ? (data.error || "") : "") } })
|
|
2509
|
+
.catch((e) => { if (alive) setError((e && e.message) || String(e)) })
|
|
2510
|
+
.finally(() => { if (alive) setSearching(false) })
|
|
2511
|
+
}, 240)
|
|
2512
|
+
return () => { alive = false; clearTimeout(timer) }
|
|
2513
|
+
}, [query, category, sort, searchTick])
|
|
2514
|
+
|
|
2515
|
+
const loadMore = async () => {
|
|
2516
|
+
if (!hasMore || searching) return
|
|
2517
|
+
setSearching(true)
|
|
2518
|
+
try {
|
|
2519
|
+
const data = await api("/market/search", { query, category, sort, page: page + 1, pageSize: 20 })
|
|
2520
|
+
if (data && data.ok) {
|
|
2521
|
+
setItems((prev) => prev.concat(data.items))
|
|
2522
|
+
setPage(page + 1)
|
|
2523
|
+
setHasMore(Boolean(data.hasMore))
|
|
2524
|
+
}
|
|
2525
|
+
} catch (e) {
|
|
2526
|
+
setError((e && e.message) || String(e))
|
|
2527
|
+
} finally {
|
|
2528
|
+
setSearching(false)
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
const syncNow = async () => {
|
|
2533
|
+
setSyncing(true); setError(""); setMsg("")
|
|
2534
|
+
try {
|
|
2535
|
+
const data = await api("/market/sync", { force: true })
|
|
2536
|
+
if (data && data.ok) { applyData(data); setMsg("目录已更新") } else { setError((data && data.error) || "更新失败") }
|
|
2537
|
+
} catch (e) {
|
|
2538
|
+
setError((e && e.message) || String(e))
|
|
2539
|
+
} finally {
|
|
2540
|
+
setSyncing(false)
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
const download = async (pack) => {
|
|
2545
|
+
setDownloading(true); setError(""); setMsg("")
|
|
2546
|
+
try {
|
|
2547
|
+
const data = await api("/market/download", { id: pack.id })
|
|
2548
|
+
if (!data || data.ok !== true) { setError((data && data.error) || "下载失败"); return }
|
|
2549
|
+
requestInstall({ token: data.token, fileName: data.fileName, packName: pack.name })
|
|
2550
|
+
setMsg("已下载并读取:" + pack.name + ",正在转到安装页")
|
|
2551
|
+
if (typeof props.onGoInstall === "function") props.onGoInstall()
|
|
2552
|
+
} catch (e) {
|
|
2553
|
+
setError((e && e.message) || String(e))
|
|
2554
|
+
} finally {
|
|
2555
|
+
setDownloading(false)
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
// 分类英文名(目录里只存中文 label,英文界面在这里映射)
|
|
2560
|
+
const catLabel = (name) => name
|
|
2561
|
+
const CATEGORY_TINT = { 工作办公: "#4C7DF0", 性能优化: "#2bb673", 界面美化: "#a855f7", 实用功能: "#0ea5e9", 开发调试: "#f59e0b", 娱乐休闲: "#ec4899", 学习资料: "#14b8a6", 水槽: "#7c3aed", 其它: "#64748b" }
|
|
2562
|
+
const initialsOf = (name) => String(name || "?").replace(/\s+/gu, "").slice(0, 2) || "?"
|
|
2563
|
+
// 体量词条:不靠作者写,按插件总数自动算(0-3 轻量 / 4-8 中型 / 9-12 大型 / 13+ 大宗)
|
|
2564
|
+
const TIER_LABELS = { small: "轻量", medium: "中型", large: "大型", huge: "大宗" }
|
|
2565
|
+
const TIER_COLORS = { small: "#2bb673", medium: "#0ea5e9", large: "#f59e0b", huge: "#ec4899" }
|
|
2566
|
+
const tierInfo = (pack) => {
|
|
2567
|
+
const count = Array.isArray(pack.plugins) ? pack.plugins.length : 0
|
|
2568
|
+
const id = pack.tier || (count >= 13 ? "huge" : count >= 9 ? "large" : count >= 4 ? "medium" : "small")
|
|
2569
|
+
return { id, color: TIER_COLORS[id] || "#64748b", text: TIER_LABELS[id] || "轻量" }
|
|
2570
|
+
}
|
|
2571
|
+
const tierTag = (pack) => {
|
|
2572
|
+
const info = tierInfo(pack)
|
|
2573
|
+
return h("span", { key: "tier-" + pack.id, style: { ...hint, color: info.color, border: "0.5px solid " + info.color, borderRadius: "99px", padding: "0 6px", lineHeight: "16px" } }, info.text)
|
|
2574
|
+
}
|
|
2575
|
+
const categories = (summary && summary.categories) || []
|
|
2576
|
+
const chips = [{ id: "all", label: "全部", count: (summary && summary.count) || 0 }].concat(
|
|
2577
|
+
categories.map((c) => ({ id: c.label, label: catLabel(c.label), count: c.count || 0 })),
|
|
2578
|
+
)
|
|
2579
|
+
const present = Boolean(summary && summary.present)
|
|
2580
|
+
const sizeText = (bytes) => (bytes >= 1024 * 1024 ? Math.round((bytes / 1024 / 1024) * 10) / 10 + " MB" : Math.max(1, Math.round(bytes / 1024)) + " KB")
|
|
2581
|
+
const compact = (value) => {
|
|
2582
|
+
const n = Number(value) || 0
|
|
2583
|
+
return n >= 10000 ? (n / 10000).toFixed(1) + " 万" : String(n)
|
|
2584
|
+
}
|
|
2585
|
+
// 目录里没有图片资源,就用名字前两个字做一块底色方块,跟 PCL 那种「占位图标」一个意思
|
|
2586
|
+
const descOf = (pack) => {
|
|
2587
|
+
const d = (pack && pack.description) || {}
|
|
2588
|
+
const text = d.zh || d.en
|
|
2589
|
+
return text || "作者没写说明。"
|
|
2590
|
+
}
|
|
2591
|
+
const renderRow = (pack) => {
|
|
2592
|
+
const tint = CATEGORY_TINT[pack.category] || "#64748b"
|
|
2593
|
+
const plugins = pack.plugins || []
|
|
2594
|
+
const meta = []
|
|
2595
|
+
meta.push(plugins.length + " 个插件")
|
|
2596
|
+
meta.push(sizeText(pack.size))
|
|
2597
|
+
meta.push(pack.downloads === null || pack.downloads === undefined ? "下载量未统计" : "下载 " + compact(pack.downloads))
|
|
2598
|
+
if (pack.updatedAt) meta.push("更新 " + String(pack.updatedAt).slice(0, 10))
|
|
2599
|
+
else if (pack.createdAt) meta.push("创建 " + String(pack.createdAt).slice(0, 10))
|
|
2600
|
+
if (pack.author) meta.push("作者 " + pack.author)
|
|
2601
|
+
return h("div", {
|
|
2602
|
+
key: "pack-" + pack.id,
|
|
2603
|
+
onClick: () => { setDetail(pack); setView("detail"); setError(""); setMsg("") },
|
|
2604
|
+
style: { display: "flex", gap: "10px", padding: "10px 12px", borderTop: "0.5px solid var(--dsw-alias-border-l2)", cursor: "pointer", alignItems: "flex-start" },
|
|
2605
|
+
},
|
|
2606
|
+
h("div", {
|
|
2607
|
+
style: {
|
|
2608
|
+
width: "42px", height: "42px", flexShrink: 0, borderRadius: "8px",
|
|
2609
|
+
background: tint, color: "#fff", fontSize: "13px", fontWeight: 600,
|
|
2610
|
+
display: "flex", alignItems: "center", justifyContent: "center", letterSpacing: "0.5px",
|
|
2611
|
+
},
|
|
2612
|
+
}, initialsOf(pack.name)),
|
|
2613
|
+
h("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "3px" } },
|
|
2614
|
+
h("div", { style: row },
|
|
2615
|
+
h("span", { style: { fontWeight: 600, fontSize: "13.5px" } }, pack.name),
|
|
2616
|
+
h(Tag, null, catLabel(pack.category || "其它")),
|
|
2617
|
+
tierTag(pack),
|
|
2618
|
+
h(Tag, null, "v" + pack.version),
|
|
2619
|
+
pack.installed && pack.installed.all ? h("span", { style: { ...hint, color: "#2bb673" } }, "已装") : null,
|
|
2620
|
+
pack.installed && pack.installed.some && !pack.installed.all ? h("span", { style: hint }, "部分已装") : null),
|
|
2621
|
+
h("span", { style: { ...hint, display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", lineHeight: "18px" } }, descOf(pack)),
|
|
2622
|
+
h("div", { style: { ...row, gap: "14px" } }, meta.map((line, index) => h("span", { key: "meta-" + pack.id + "-" + index, style: hint }, line)))))
|
|
2623
|
+
}
|
|
2624
|
+
const resetFilters = () => { setQuery(""); setCategory("all"); setSort("new"); setPage(1); setSearchTick((n) => n + 1) }
|
|
2625
|
+
|
|
2626
|
+
const head = h("div", { style: { ...row, justifyContent: "space-between" } },
|
|
2627
|
+
h("div", { style: row },
|
|
2628
|
+
h("span", { style: { ...strong, fontSize: "14px" } }, "社区资源"),
|
|
2629
|
+
present ? h(Tag, null, total + " 个") : null,
|
|
2630
|
+
present ? h("span", { style: hint }, "目录来自 " + (summary.repo || "dsh-modpack-catalog") + (summary.builtAt ? " · 构建于 " + String(summary.builtAt).slice(0, 10) : "")) : null),
|
|
2631
|
+
h("div", { style: row },
|
|
2632
|
+
h("button", { type: "button", style: chipBtn, onClick: () => { setView("rules"); setDetail(null) } }, "上传方式与规则"),
|
|
2633
|
+
h("button", { type: "button", style: chipBtn, disabled: syncing, onClick: syncNow }, syncing ? "更新中…" : "更新目录")))
|
|
2634
|
+
|
|
2635
|
+
if (view === "rules") {
|
|
2636
|
+
return h("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } },
|
|
2637
|
+
h("div", { style: row },
|
|
2638
|
+
h("button", { type: "button", style: chipBtn, onClick: () => setView("list") }, "← 返回市场"),
|
|
2639
|
+
h("span", { style: { ...strong, fontSize: "14px" } }, "上传方式与规则")),
|
|
2640
|
+
h("div", { style: { ...hint, lineHeight: "20px" } }, "第一阶段只收轻量包;审核与出问题下架都靠 PR 与 issue,和插件市场一样。"),
|
|
2641
|
+
h("ol", { style: { margin: 0, paddingLeft: "18px", display: "flex", flexDirection: "column", gap: "8px" } },
|
|
2642
|
+
MARKET_RULES.map((line, index) => h("li", { key: "rule-" + index, style: { fontSize: "12.5px", lineHeight: "19px" } }, line))),
|
|
2643
|
+
h("div", { style: { border: "1px dashed var(--dsw-alias-border-l2)", borderRadius: "8px", padding: "10px", display: "flex", flexDirection: "column", gap: "4px" } },
|
|
2644
|
+
h("span", { style: strong }, "清单长这样"),
|
|
2645
|
+
h("code", { style: { fontSize: "11.5px", whiteSpace: "pre-wrap", lineHeight: "17px" } },
|
|
2646
|
+
'{\n "id": "bili-trio",\n "category": "实用功能",\n "file": "bili-trio-lite.dshpack",\n "sha256": "…64 位…",\n "createdAt": "2026-11-27",\n "updatedAt": "2026-11-27",\n "homepage": ""\n}\n\n// 名称、作者、介绍、插件清单不写在这里:\n// 全部取包里的 dsh-modpack.json(打包时填的)')),
|
|
2647
|
+
h("div", { style: hint }, "仓库:github.com/" + (summary && summary.repo ? summary.repo : "Vesna-Strivozha-cn/dsh-modpack-catalog") + " · 照着上面 1~5 步走:包进 packs/、清单进 data/packs/、本地 build 过了再提 PR;合并后每天 03:17 UTC 重建,也可以在 Actions 手动 Run workflow。"))
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
if (view === "detail" && detail) {
|
|
2651
|
+
const pack = detail
|
|
2652
|
+
const plugins = pack.plugins || []
|
|
2653
|
+
const downloadCode = [pack.url || "", "sha256: " + (pack.sha256 || ""), "size: " + pack.size + " 字节"].join("\n")
|
|
2654
|
+
return h("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } },
|
|
2655
|
+
h("div", { style: row },
|
|
2656
|
+
h("button", { type: "button", style: chipBtn, onClick: () => { setView("list"); setDetail(null) } }, "← 返回列表"),
|
|
2657
|
+
h("span", { style: { ...strong, fontSize: "15px" } }, pack.name),
|
|
2658
|
+
h(Tag, null, catLabel(pack.category || "其它")),
|
|
2659
|
+
tierTag(pack),
|
|
2660
|
+
h("span", { style: hint }, "v" + pack.version + " · 作者 " + (pack.author || "?") + " · " + sizeText(pack.size) + " · " + plugins.length + " 个插件")),
|
|
2661
|
+
h("div", { style: { ...hint, lineHeight: "20px" } },
|
|
2662
|
+
pack.downloads === null || pack.downloads === undefined
|
|
2663
|
+
? "下载量:暂无统计(安装文件放在 Git 仓库里,没有逐文件计数;放进 GitHub Release 资源才拿得到真实下载数)"
|
|
2664
|
+
: "下载 " + Number(pack.downloads) + " 次(这个安装文件本身的下载量,不是里面插件的)"
|
|
2665
|
+
+ " · 创建 " + (pack.createdAt ? String(pack.createdAt).slice(0, 10) : "未记录")
|
|
2666
|
+
+ " · 上次更新 " + (pack.updatedAt ? String(pack.updatedAt).slice(0, 10) : (pack.createdAt ? String(pack.createdAt).slice(0, 10) : "未记录"))),
|
|
2667
|
+
h("div", { style: { border: "1px solid var(--dsw-alias-border-l2)", borderRadius: "10px", padding: "12px", display: "flex", flexDirection: "column", gap: "8px" } },
|
|
2668
|
+
h("span", { style: strong }, "这个整合包是做什么的"),
|
|
2669
|
+
h("div", { style: { fontSize: "12.5px", lineHeight: "20px" } }, descOf(pack)),
|
|
2670
|
+
pack.installed && pack.installed.all
|
|
2671
|
+
? h("div", { style: { ...hint, color: "#2bb673" } }, "这台机器上已经装齐了它包含的插件,可以只下载留存或再装一遍。")
|
|
2672
|
+
: pack.installed && pack.installed.some
|
|
2673
|
+
? h("div", { style: hint }, "本机已装 " + pack.installed.count + " / " + plugins.length + " 个,安装时会先跳过已装的那些。")
|
|
2674
|
+
: null),
|
|
2675
|
+
h("div", { style: { border: "1px solid var(--dsw-alias-border-l2)", borderRadius: "10px", padding: "12px", display: "flex", flexDirection: "column", gap: "6px" } },
|
|
2676
|
+
h("div", { style: { ...row, justifyContent: "space-between" } },
|
|
2677
|
+
h("span", { style: strong }, "包含的插件(这些插件会干什么)"),
|
|
2678
|
+
plugins.length === 0 ? null : h("button", {
|
|
2679
|
+
type: "button",
|
|
2680
|
+
style: chipBtn,
|
|
2681
|
+
title: descOpen ? "只留插件名与版本" : "显示每个插件在插件市场里的介绍",
|
|
2682
|
+
onClick: () => setDescOpen(!descOpen),
|
|
2683
|
+
}, descOpen ? "收起介绍" : "显示介绍")),
|
|
2684
|
+
plugins.length === 0
|
|
2685
|
+
? h("span", { style: hint }, "清单里没有插件记录。")
|
|
2686
|
+
: plugins.map((plugin) => h("div", { key: "p-" + plugin.name, style: { display: "flex", flexDirection: "column", gap: "2px", borderTop: "0.5px solid var(--dsw-alias-border-l2)", paddingTop: "6px" } },
|
|
2687
|
+
h("div", { style: row },
|
|
2688
|
+
h("span", { style: { fontSize: "12.5px", fontWeight: 600 } }, plugin.name),
|
|
2689
|
+
h(Tag, null, plugin.version ? "@" + plugin.version : "@市场最新")),
|
|
2690
|
+
descOpen ? h("span", { style: hint }, pluginDescOf(plugin)) : null)),
|
|
2691
|
+
h("span", { style: hint }, "安装时按上面的版本从插件市场取包;取不到就明确报错,不会拿别的东西顶替。"),
|
|
2692
|
+
h("span", { style: hint }, "这里只数清单里的顶层插件;像壁纸引擎那样由插件自己带的一组组件不算在里面,装好后由那个插件自己管理。")),
|
|
2693
|
+
h("div", { style: { border: "1px dashed var(--dsw-alias-border-l2)", borderRadius: "10px", padding: "12px", display: "flex", flexDirection: "column", gap: "6px" } },
|
|
2694
|
+
h("span", { style: strong }, "下载码"),
|
|
2695
|
+
h("code", { style: { fontSize: "11.5px", whiteSpace: "pre-wrap", lineHeight: "17px", wordBreak: "break-all" } }, downloadCode),
|
|
2696
|
+
h("span", { style: hint }, "下载码就是包的直链 + sha256:谁拿到都能自己下载核对,不依赖这个界面。")),
|
|
2697
|
+
error ? h("div", { style: { ...hint, color: "#ff6b6b" } }, error) : null,
|
|
2698
|
+
msg ? h("div", { style: hint }, msg) : null,
|
|
2699
|
+
h("div", { style: row },
|
|
2700
|
+
h("button", { type: "button", style: btnPrimary, disabled: downloading, onClick: () => download(pack) }, downloading ? "下载中…" : "下载并安装"),
|
|
2701
|
+
h("span", { style: hint }, "下载后在内存里校验 sha256、跑一遍安全检测,再转到安装页读取;半成品不会留在磁盘上。")))
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
const searchCard = h("div", {
|
|
2705
|
+
style: { border: "1px solid var(--dsw-alias-border-l2)", borderRadius: "10px", padding: "12px", display: "flex", flexDirection: "column", gap: "10px" },
|
|
2706
|
+
},
|
|
2707
|
+
h("div", { style: { ...row, justifyContent: "space-between" } },
|
|
2708
|
+
h("span", { style: { ...strong, fontSize: "13px" } }, "搜索整合包"),
|
|
2709
|
+
h("span", { style: hint }, "目录里现在有 " + ((summary && summary.count) || 0) + " 个" + (summary && summary.builtAt ? " · 构建于 " + String(summary.builtAt).slice(0, 10) : ""))),
|
|
2710
|
+
h("div", { style: { display: "grid", gridTemplateColumns: "56px minmax(160px, 1fr) 56px 150px 56px 130px", gap: "8px 10px", alignItems: "center" } },
|
|
2711
|
+
h("span", { style: hint }, "名称"),
|
|
2712
|
+
h("input", {
|
|
2713
|
+
type: "search",
|
|
2714
|
+
value: query,
|
|
2715
|
+
placeholder: "整合包名 / 作者 / 插件名(例如 B站、壁纸、记忆)",
|
|
2716
|
+
onChange: (event) => { setQuery(event.target.value); setPage(1) },
|
|
2717
|
+
style: { height: "30px", borderRadius: "6px", border: "1px solid var(--dsw-alias-border-l2)", background: "transparent", color: "inherit", padding: "0 8px", fontSize: "12.5px" },
|
|
2718
|
+
}),
|
|
2719
|
+
h("span", { style: hint }, "类型"),
|
|
2720
|
+
h("select", {
|
|
2721
|
+
value: category,
|
|
2722
|
+
onChange: (event) => { setCategory(event.target.value); setPage(1) },
|
|
2723
|
+
style: { height: "30px", borderRadius: "6px", border: "1px solid var(--dsw-alias-border-l2)", background: "transparent", color: "inherit", fontSize: "12.5px" },
|
|
2724
|
+
}, chips.map((chip) => h("option", { key: "sel-" + chip.id, value: chip.id }, chip.label + "(" + (chip.count || 0) + ")"))),
|
|
2725
|
+
h("span", { style: hint }, "排序"),
|
|
2726
|
+
h("select", {
|
|
2727
|
+
value: sort,
|
|
2728
|
+
onChange: (event) => { setSort(event.target.value); setPage(1) },
|
|
2729
|
+
style: { height: "30px", borderRadius: "6px", border: "1px solid var(--dsw-alias-border-l2)", background: "transparent", color: "inherit", fontSize: "12.5px" },
|
|
2730
|
+
}, MARKET_SORTS.map(([value, text]) => h("option", { key: value, value }, text)))),
|
|
2731
|
+
h("div", { style: row },
|
|
2732
|
+
h("button", { type: "button", style: { ...btn, minWidth: "96px" }, disabled: searching, onClick: () => setSearchTick((n) => n + 1) }, searching ? "搜索中…" : "搜索"),
|
|
2733
|
+
h("button", { type: "button", style: { ...btn, minWidth: "96px" }, onClick: resetFilters }, "重置条件"),
|
|
2734
|
+
h("button", { type: "button", style: { ...btn, minWidth: "128px" }, onClick: () => { if (typeof props.onGoInstall === "function") props.onGoInstall() } }, "安装已有整合包"),
|
|
2735
|
+
h("span", { style: { ...hint, marginLeft: "auto" } }, "共 " + total + " 个")))
|
|
2736
|
+
|
|
2737
|
+
const emptyCard = h("div", { style: { border: "1px dashed var(--dsw-alias-border-l2)", borderRadius: "10px", padding: "16px", display: "flex", flexDirection: "column", gap: "8px" } },
|
|
2738
|
+
h("span", { style: strong }, query ? "没有匹配的整合包" : present ? "这个类型下还没有整合包" : "还没有整合包目录"),
|
|
2739
|
+
h("span", { style: hint }, query
|
|
2740
|
+
? "换个说法试试:整合包名、作者名、插件名都能搜。"
|
|
2741
|
+
: present
|
|
2742
|
+
? "目录是通的,只是这一类还没有人提交;换个类型看看,或去「上传方式与规则」自己提交一个。"
|
|
2743
|
+
: "第一次用要先从目录仓库拉一次清单(只有几百 KB)。"),
|
|
2744
|
+
h("div", { style: row },
|
|
2745
|
+
query ? h("button", { type: "button", style: btn, onClick: resetFilters }, "清空条件") : null,
|
|
2746
|
+
h("button", { type: "button", style: { ...btn, minWidth: "96px" }, disabled: syncing || loading, onClick: syncNow }, syncing ? "更新中…" : "更新目录"),
|
|
2747
|
+
h("button", { type: "button", style: btn, disabled: loading, onClick: retry }, "重试"),
|
|
2748
|
+
h("button", { type: "button", style: chipBtn, onClick: () => { setView("rules"); setDetail(null) } }, "上传方式与规则")),
|
|
2749
|
+
/重启|HTTP 40[45]|连不上/u.test(String(error || ""))
|
|
2750
|
+
? h("span", { style: { ...hint, lineHeight: "19px" } }, "网络正常但接口报 404/405 的话,是宿主还跑着旧代码:把 DSH 完全退出再打开,这一栏就会生效。")
|
|
2751
|
+
: null)
|
|
2752
|
+
|
|
2753
|
+
const listBox = items.length > 0
|
|
2754
|
+
? h("div", { style: { border: "1px solid var(--dsw-alias-border-l2)", borderRadius: "10px", overflow: "hidden" } }, items.map(renderRow))
|
|
2755
|
+
: null
|
|
2756
|
+
|
|
2757
|
+
return h("div", { style: { display: "flex", flexDirection: "column", gap: "10px" } },
|
|
2758
|
+
head,
|
|
2759
|
+
searchCard,
|
|
2760
|
+
loading && items.length === 0 ? h("div", { style: { ...hint, padding: "14px 2px" } }, "正在读取整合包目录…") : null,
|
|
2761
|
+
error ? h("div", { style: { ...hint, color: "#ff6b6b", lineHeight: "19px" } }, String(error)) : null,
|
|
2762
|
+
msg ? h("div", { style: hint }, msg) : null,
|
|
2763
|
+
listBox,
|
|
2764
|
+
!loading && items.length === 0 ? emptyCard : null,
|
|
2765
|
+
hasMore ? h("button", { type: "button", style: btn, disabled: searching, onClick: loadMore }, searching ? "加载中…" : "加载更多") : null)
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
// ===== [区块] 外壳:页签、刷新、彩蛋、进度窗挂载:Home =====
|
|
1898
2769
|
function Home(props) {
|
|
1899
2770
|
const [tab, setTab] = useState("pack")
|
|
1900
2771
|
const jobs = useJobs()
|
|
@@ -1905,7 +2776,39 @@ window.__ModuleLoader__.load({
|
|
|
1905
2776
|
const embedded = surface === "plugins"
|
|
1906
2777
|
const [packResult, setPackResult] = useState(() => readPackValue())
|
|
1907
2778
|
const [focus, setFocus] = useState(0)
|
|
2779
|
+
const [unlag, setUnlag] = useState(null)
|
|
2780
|
+
const [unlagMsg, setUnlagMsg] = useState("")
|
|
2781
|
+
// 解除卡顿是别人家的插件:有就出按钮,没有就什么都不显示。
|
|
2782
|
+
useEffect(() => {
|
|
2783
|
+
let alive = true
|
|
2784
|
+
detectUnlag().then((data) => { if (alive) setUnlag(data) })
|
|
2785
|
+
return () => { alive = false }
|
|
2786
|
+
}, [])
|
|
2787
|
+
const pressUnlagNow = async () => {
|
|
2788
|
+
setUnlagMsg("正在让解除卡顿整理…")
|
|
2789
|
+
try {
|
|
2790
|
+
const data = await pressUnlag()
|
|
2791
|
+
const status = data && (data.status || data.verdict)
|
|
2792
|
+
setUnlagMsg(status ? ("解除卡顿:" + status) : "已请求,稍等一下看结果")
|
|
2793
|
+
} catch (e) {
|
|
2794
|
+
setUnlagMsg((e && e.message) || String(e))
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
// 开机把市场的侧栏入口按设置再关一次:市场自己每次启动都会把它打开。
|
|
2798
|
+
const forceHideMarket = !!(status && status.config && status.config.forceHideMarketSidebar === true)
|
|
2799
|
+
useEffect(() => {
|
|
2800
|
+
if (!forceHideMarket) return
|
|
2801
|
+
let alive = true
|
|
2802
|
+
readMarketSidebar().then((data) => {
|
|
2803
|
+
if (!alive || !data || data.enabled !== true) return
|
|
2804
|
+
writeMarketSidebar(false).catch(() => {})
|
|
2805
|
+
})
|
|
2806
|
+
return () => { alive = false }
|
|
2807
|
+
}, [forceHideMarket])
|
|
1908
2808
|
useEffect(() => subscribePack((value) => { setPackResult(value) }), [])
|
|
2809
|
+
// 「社区资源」这一栏开不开:用模块级状态,设置里一关标签立刻消失,切回设置也不会又亮着
|
|
2810
|
+
const [marketOn, setMarketOn] = useState(() => readMarketVisible())
|
|
2811
|
+
useEffect(() => subscribeMarketVisible((on) => { setMarketOn(on) }), [])
|
|
1909
2812
|
const savePackResult = (value) => {
|
|
1910
2813
|
setPackValue(value)
|
|
1911
2814
|
setPackResult(value)
|
|
@@ -1918,14 +2821,83 @@ window.__ModuleLoader__.load({
|
|
|
1918
2821
|
setTab("pack")
|
|
1919
2822
|
setFocus((n) => n + 1)
|
|
1920
2823
|
}
|
|
2824
|
+
const [refreshing, setRefreshing] = useState(false)
|
|
2825
|
+
const [refreshedAt, setRefreshedAt] = useState(0)
|
|
2826
|
+
const [refreshMsg, setRefreshMsg] = useState("")
|
|
2827
|
+
const [refreshNote, setRefreshNote] = useState("")
|
|
2828
|
+
// 刷新只管整合包自己:重读本插件看到的状态,再把三个面板重挂一次让它们各自重新取数。
|
|
2829
|
+
// 不碰别的插件,也不调「解除卡顿」——那个插件有自己的按钮,各管各的。
|
|
2830
|
+
const doRefresh = async () => {
|
|
2831
|
+
if (refreshing) return
|
|
2832
|
+
setRefreshing(true)
|
|
2833
|
+
setRefreshMsg("")
|
|
2834
|
+
setRefreshNote("")
|
|
2835
|
+
try {
|
|
2836
|
+
if (typeof props.onRefresh === "function") await props.onRefresh()
|
|
2837
|
+
setRefreshNote("已重新读取整合包自己的状态")
|
|
2838
|
+
setRefreshedAt(Date.now())
|
|
2839
|
+
} catch (e) {
|
|
2840
|
+
setRefreshMsg("刷新失败:" + String((e && e.message) || e))
|
|
2841
|
+
} finally {
|
|
2842
|
+
setRefreshing(false)
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
const gen = props.gen || 0
|
|
2846
|
+
const refreshBtn = h("button", {
|
|
2847
|
+
type: "button",
|
|
2848
|
+
style: chipBtn,
|
|
2849
|
+
disabled: refreshing,
|
|
2850
|
+
title: "只刷新整合包自己:重新读一遍插件列表、市场目录与进度窗,再把三个面板重挂一次;不调用别的插件",
|
|
2851
|
+
onClick: doRefresh,
|
|
2852
|
+
}, refreshing ? "刷新中…" : (refreshMsg ? "刷新失败" : refreshedAt ? "刷新 ✓" : "刷新"))
|
|
2853
|
+
// 拖到角上挡住界面时用这个:位置清掉、回到右下角默认位,并且强制显示
|
|
2854
|
+
const recallBtn = h("button", {
|
|
2855
|
+
type: "button",
|
|
2856
|
+
style: { ...chipBtn, background: "#4C7DF0", borderColor: "#4C7DF0", color: "#fff", fontWeight: 600 },
|
|
2857
|
+
title: "把进度窗叫回右下角的默认位置(拖到角落挡住了界面就用这个)",
|
|
2858
|
+
onClick: () => { requestDockReset() },
|
|
2859
|
+
}, "召回进度窗")
|
|
2860
|
+
const [eggMsg, setEggMsg] = useState("")
|
|
2861
|
+
const eggClicks = useRef([])
|
|
2862
|
+
const eggTimer = useRef(0)
|
|
2863
|
+
useEffect(() => () => { if (eggTimer.current) clearTimeout(eggTimer.current) }, [])
|
|
2864
|
+
const spotEgg = () => {
|
|
2865
|
+
const now = Date.now()
|
|
2866
|
+
eggClicks.current = eggClicks.current.concat(now).filter((at) => now - at < 1500)
|
|
2867
|
+
if (eggClicks.current.length < 5) return
|
|
2868
|
+
eggClicks.current = []
|
|
2869
|
+
setEggMsg("不不不,我资源无疑是贫乏的")
|
|
2870
|
+
if (eggTimer.current) clearTimeout(eggTimer.current)
|
|
2871
|
+
eggTimer.current = setTimeout(() => { eggTimer.current = 0; setEggMsg("") }, 1000)
|
|
2872
|
+
}
|
|
2873
|
+
const eggNode = eggMsg
|
|
2874
|
+
? h("div", {
|
|
2875
|
+
style: {
|
|
2876
|
+
position: "fixed",
|
|
2877
|
+
left: "50%",
|
|
2878
|
+
bottom: "88px",
|
|
2879
|
+
transform: "translateX(-50%)",
|
|
2880
|
+
background: "rgba(18, 20, 26, 0.92)",
|
|
2881
|
+
color: "#fff",
|
|
2882
|
+
padding: "9px 16px",
|
|
2883
|
+
borderRadius: "10px",
|
|
2884
|
+
fontSize: "13px",
|
|
2885
|
+
letterSpacing: "0.02em",
|
|
2886
|
+
boxShadow: "0 8px 24px rgba(0, 0, 0, 0.28)",
|
|
2887
|
+
pointerEvents: "none",
|
|
2888
|
+
zIndex: 80,
|
|
2889
|
+
},
|
|
2890
|
+
}, eggMsg)
|
|
2891
|
+
: null
|
|
1921
2892
|
const tabs = [
|
|
1922
2893
|
["pack", "打包"],
|
|
1923
2894
|
["install", "安装 / 导入"],
|
|
2895
|
+
...(marketOn ? [["market", "社区资源"]] : []),
|
|
1924
2896
|
["settings", "设置与记录"],
|
|
1925
2897
|
]
|
|
1926
2898
|
const tabBtn = (key, text) => h("button", {
|
|
1927
2899
|
key,
|
|
1928
|
-
onClick: () => setTab(key),
|
|
2900
|
+
onClick: () => { setTab(key); if (key === "market") spotEgg() },
|
|
1929
2901
|
style: {
|
|
1930
2902
|
...btn,
|
|
1931
2903
|
fontSize: embedded ? "12px" : btn.fontSize,
|
|
@@ -1937,11 +2909,28 @@ window.__ModuleLoader__.load({
|
|
|
1937
2909
|
}, text)
|
|
1938
2910
|
|
|
1939
2911
|
const panels = [
|
|
1940
|
-
tab === "pack" ? h(PackPanel, { status, jobs, result: packResult, setResult: savePackResult, focus }) : null,
|
|
1941
|
-
tab === "install" ? h(InstallPanel, { status }) : null,
|
|
1942
|
-
tab === "
|
|
2912
|
+
tab === "pack" ? h(PackPanel, { key: "pack-" + gen, status, jobs, result: packResult, setResult: savePackResult, focus }) : null,
|
|
2913
|
+
tab === "install" ? h(InstallPanel, { key: "install-" + gen, status }) : null,
|
|
2914
|
+
tab === "market" ? h(MarketPanel, { key: "market-" + gen, status, onGoInstall: () => setTab("install") }) : null,
|
|
2915
|
+
tab === "settings" ? h(SettingsPanel, { key: "settings-" + gen, status }) : null,
|
|
1943
2916
|
]
|
|
1944
|
-
|
|
2917
|
+
// 这段是打包/安装的安全说明,社区资源里不该出现(那里是逛目录,不是打包)
|
|
2918
|
+
const footNote = tab === "market" ? null : h("div", { style: hint }, "说明:整合包只打包你选择的插件与必要配置。打包与安装安全检测在内存中进行,命中原文不落盘;请遵守插件作者许可证与你所在地区的法律法规。")
|
|
2919
|
+
const unlagNode = unlag
|
|
2920
|
+
? h("div", { style: row },
|
|
2921
|
+
h("button", {
|
|
2922
|
+
type: "button",
|
|
2923
|
+
style: chipBtn,
|
|
2924
|
+
title: "来自插件市场的 dsh-unlag@" + (unlag.version || "?") + "(不是本插件的功能:装了才有)",
|
|
2925
|
+
onClick: pressUnlagNow,
|
|
2926
|
+
}, "解除卡顿"),
|
|
2927
|
+
unlagMsg ? h("span", { style: hint }, unlagMsg) : null)
|
|
2928
|
+
: null
|
|
2929
|
+
useEffect(() => {
|
|
2930
|
+
if (!refreshedAt) return undefined
|
|
2931
|
+
const timer = setTimeout(() => { setRefreshedAt(0); setRefreshNote("") }, 2400)
|
|
2932
|
+
return () => clearTimeout(timer)
|
|
2933
|
+
}, [refreshedAt])
|
|
1945
2934
|
const envLine = h("span", { style: { ...hint, marginLeft: "auto" } },
|
|
1946
2935
|
status ? ("DSH " + (status.dshVersion || "?") + " · 已装 " + ((status.installed || []).length) + " 个 · v" + (status.pluginVersion || "?")) : "读取环境…")
|
|
1947
2936
|
|
|
@@ -1958,7 +2947,9 @@ window.__ModuleLoader__.load({
|
|
|
1958
2947
|
},
|
|
1959
2948
|
},
|
|
1960
2949
|
h("div", { style: { maxWidth: "1020px", margin: "0 auto", width: "100%", display: "flex", flexDirection: "column", gap: "10px" } },
|
|
1961
|
-
h("div", { style: row }, tabs.map(([key, text]) => tabBtn(key, text)), envLine),
|
|
2950
|
+
h("div", { style: row }, tabs.map(([key, text]) => tabBtn(key, text)), envLine, refreshNote ? h("span", { style: hint }, refreshNote) : null, refreshMsg ? h("span", { style: { ...hint, color: "#ff6b6b" } }, refreshMsg) : null, recallBtn, refreshBtn),
|
|
2951
|
+
eggNode,
|
|
2952
|
+
unlagNode,
|
|
1962
2953
|
panels,
|
|
1963
2954
|
footNote,
|
|
1964
2955
|
h(RepoFooter, null)),
|
|
@@ -1973,7 +2964,8 @@ window.__ModuleLoader__.load({
|
|
|
1973
2964
|
h("div", { style: { display: "flex", alignItems: "baseline", gap: "10px", flexWrap: "wrap" } },
|
|
1974
2965
|
h("h2", { style: { margin: 0, fontSize: "20px", fontWeight: 600 } }, "整合包"),
|
|
1975
2966
|
h("span", { style: hint }, ((status && status.config && status.config.tagline) || "谁说 dsh 不能整整合包呢?(你说这几个插件整一块不牛逼坏了)"))),
|
|
1976
|
-
h("div", { style: row }, tabs.map(([key, text]) => tabBtn(key, text)), envLine),
|
|
2967
|
+
h("div", { style: row }, tabs.map(([key, text]) => tabBtn(key, text)), envLine, refreshNote ? h("span", { style: hint }, refreshNote) : null, refreshMsg ? h("span", { style: { ...hint, color: "#ff6b6b" } }, refreshMsg) : null, recallBtn, refreshBtn),
|
|
2968
|
+
eggNode,
|
|
1977
2969
|
panels,
|
|
1978
2970
|
footNote,
|
|
1979
2971
|
h(RepoFooter, null)),
|
|
@@ -1989,10 +2981,12 @@ window.__ModuleLoader__.load({
|
|
|
1989
2981
|
}
|
|
1990
2982
|
|
|
1991
2983
|
/** 用一个小组件包住面板,进入时拉一次状态,之后交给子面板。 */
|
|
2984
|
+
// ===== [区块] 页面入口:读 status、按显示位决定挂哪里:Page =====
|
|
1992
2985
|
function Page(props) {
|
|
1993
2986
|
const [status, setStatus] = useState(null)
|
|
1994
2987
|
const [error, setError] = useState("")
|
|
1995
2988
|
const [tries, setTries] = useState(0)
|
|
2989
|
+
const [gen, setGen] = useState(0)
|
|
1996
2990
|
const alive = useRef(true)
|
|
1997
2991
|
useEffect(() => () => { alive.current = false }, [])
|
|
1998
2992
|
// 宿主刚起来、会话还在建的时候,第一次可能拿不到状态(401/网络没就绪)。
|
|
@@ -2004,6 +2998,7 @@ window.__ModuleLoader__.load({
|
|
|
2004
2998
|
if (data && data.ok) {
|
|
2005
2999
|
setStatus(data)
|
|
2006
3000
|
setError("")
|
|
3001
|
+
if (data.config) { mergeLiveConfig(data.config); setMarketVisible(data.config.showModpackMarket !== false) }
|
|
2007
3002
|
if (data.placements) setPlacement(data.placements)
|
|
2008
3003
|
setTries(0)
|
|
2009
3004
|
return
|
|
@@ -2029,7 +3024,18 @@ window.__ModuleLoader__.load({
|
|
|
2029
3024
|
return h("div", { style: { padding: "20px 24px", color: "var(--dsw-alias-label-tertiary, #8b909b)", fontSize: "13px" } },
|
|
2030
3025
|
tries > 0 ? "整合包:还在连 DSH 本体…(自动重试 " + tries + " 次)" : "整合包:读取环境…")
|
|
2031
3026
|
}
|
|
2032
|
-
|
|
3027
|
+
// 手动刷新:先重读 status,再把下面几个面板整体重挂一次(gen+1)。
|
|
3028
|
+
// 只重读 status 是不够的:面板里的插件清单、市场信息、目录分页都是挂载时拉一次,
|
|
3029
|
+
// 不重挂就不会重新取,看起来就像「按了没反应」。
|
|
3030
|
+
return h(Home, {
|
|
3031
|
+
status,
|
|
3032
|
+
surface: (props && props.surface) || "sidebar",
|
|
3033
|
+
gen,
|
|
3034
|
+
onRefresh: async () => {
|
|
3035
|
+
await load(3)
|
|
3036
|
+
setGen((n) => n + 1)
|
|
3037
|
+
},
|
|
3038
|
+
})
|
|
2033
3039
|
}
|
|
2034
3040
|
|
|
2035
3041
|
const inject = ["slots"]
|
|
@@ -2088,6 +3094,8 @@ window.__ModuleLoader__.load({
|
|
|
2088
3094
|
try {
|
|
2089
3095
|
const data = await api("/status")
|
|
2090
3096
|
if (data && data.ok && data.placements) setPlacement(data.placements)
|
|
3097
|
+
if (data && data.ok && data.config) { mergeLiveConfig(data.config); setMarketVisible(data.config.showModpackMarket !== false) }
|
|
3098
|
+
if (data && data.config && data.config.forceHideMarketSidebar === true) enforceMarketSidebarOff()
|
|
2091
3099
|
} catch (e) {
|
|
2092
3100
|
if (left > 0) setTimeout(() => { refreshPlacement(left - 1) }, 700 * (3 - left))
|
|
2093
3101
|
}
|
|
@@ -2107,6 +3115,11 @@ window.__ModuleLoader__.load({
|
|
|
2107
3115
|
}
|
|
2108
3116
|
|
|
2109
3117
|
exports.apply = apply
|
|
3118
|
+
exports.MarketPanel = MarketPanel
|
|
3119
|
+
// 自测用:社区资源那层「切页签也保留」的状态存在模块里,测试要能塞一份进去看恢复得对不对
|
|
3120
|
+
exports.__marketUi = marketUi
|
|
3121
|
+
exports.PluginBrowser = PluginBrowser
|
|
3122
|
+
exports.ModpackBrowser = ModpackBrowser
|
|
2110
3123
|
exports.inject = inject
|
|
2111
3124
|
exports.Page = Page
|
|
2112
3125
|
exports.Home = Home
|