dsh-modpack-kit 0.2.2 → 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/client.js CHANGED
@@ -1,9 +1,11 @@
1
1
  /**
2
- * dsh-modpack —— 客户端半边:左侧栏「整合包」。
2
+ * dsh-modpack-kit —— 客户端半边:左侧栏「整合包」。
3
3
  *
4
- * 三页:打包(挑插件、选版本、看检测报告)、安装(链接/本机包、预览、落地)、
5
- * 设置与记录(扫描策略、白名单、历史)。数据全部来自 /dsh-modpack/api/*(同源 fetch),
6
- * 与 host 半端共用同一份状态;这里不碰文件,也不做网络请求。
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: "仅下载码(轻量包)", online: true, note: "只记 名字@版本,体积最小。安装时必须联网从市场取包,不带自定义配置与数据,插件市场按版本认成市场版。" },
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) {
@@ -370,6 +425,7 @@ window.__ModuleLoader__.load({
370
425
 
371
426
  // 一整块可以折叠的区域:标题行常驻,点标题或「展开/收起」都行。
372
427
  // 默认收起,只有真有问题(高危 / 阻断)才默认摊开。
428
+ // ===== [区块] 通用折叠容器:FoldBox =====
373
429
  function FoldBox(props) {
374
430
  const [open, setOpen] = useState(props.defaultOpen === true)
375
431
  const summary = Array.isArray(props.summary) ? props.summary : [props.summary]
@@ -386,6 +442,7 @@ window.__ModuleLoader__.load({
386
442
  open ? props.children : (props.collapsedNote ? h("div", { style: hint }, props.collapsedNote) : null))
387
443
  }
388
444
 
445
+ // ===== [区块] 安全检测报告(可折叠):ScanReport =====
389
446
  function ScanReport(props) {
390
447
  const scan = props.scan
391
448
  const counts = (scan && scan.counts) || { high: 0, medium: 0, low: 0 }
@@ -429,6 +486,7 @@ window.__ModuleLoader__.load({
429
486
  h("div", { style: hint }, props.footNote || "命中内容只在内存里比对,报告只保留类型、位置与掩码,原文不落盘。"))
430
487
  }
431
488
 
489
+ // ===== [区块] 兼容性列表(可折叠):CompatList =====
432
490
  function CompatList(props) {
433
491
  const compat = props.compat
434
492
  if (!compat) return null
@@ -556,6 +614,7 @@ window.__ModuleLoader__.load({
556
614
  return { width, height }
557
615
  }
558
616
 
617
+ // ===== [区块] 悬浮进度窗(拖动 / 召回 / 终止):JobDock =====
559
618
  function JobDock(props) {
560
619
  const given = Array.isArray(props.jobs) ? props.jobs : []
561
620
  // 「清空进程」之后,就算服务端还残留一条,也在界面上立刻拿掉
@@ -839,6 +898,21 @@ window.__ModuleLoader__.load({
839
898
  }
840
899
 
841
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
+
842
916
  function PackPanel(props) {
843
917
  const status = props.status
844
918
  const jobs = Array.isArray(props.jobs) ? props.jobs : []
@@ -1198,7 +1272,7 @@ window.__ModuleLoader__.load({
1198
1272
  // 停在风险点的任务:按插件分栏列出命中项,确认/删除都在这里做
1199
1273
  const pausedRiskNodes = []
1200
1274
  if (pausedJobs.length > 0) {
1201
- pausedRiskNodes.push(h("div", { key: "title", style: { ...strong, color: "#ff6b6b" } }, "打包停在风险点(" + pausedJobs.length + " 个任务)"))
1275
+ pausedRiskNodes.push(h("div", { key: "title", style: { ...strong, color: "#ff6b6b" } }, `打包停在风险点(${pausedJobs.length} 个任务)`))
1202
1276
  pausedRiskNodes.push(h("div", { key: "hint", style: hint }, "下面是每个插件自己的命中项。确认后原任务从这个检测点接着跑完,不再重复检测。"))
1203
1277
  for (const job of pausedJobs) {
1204
1278
  const groupNodes = (job.risk.groups || []).map((group, index) => {
@@ -1342,7 +1416,7 @@ window.__ModuleLoader__.load({
1342
1416
  return h("div", { style: { display: "flex", flexDirection: "column", gap: "14px" } },
1343
1417
  h(Notice, null,
1344
1418
  h("b", null, "打包:将所选插件封装为一个 .dshpack 文件"),
1345
- " 三种策略:完整包自带插件本体、不联网也能装;仅下载码只记版本、体积最小;混合包带版本与配置片段、体积接近仅下载码。完整包与混合包在安装前均不允许修改 profile 内容。",
1419
+ " 三种策略:完整包自带插件本体、不联网也能装;轻量包只记版本、体积最小;混合包带版本与配置片段、体积接近轻量包。完整包与混合包在安装前均不允许修改 profile 内容。",
1346
1420
  status && status.market && status.market.installed
1347
1421
  ? h("div", { style: { ...hint, marginTop: "6px" } }, "已检测到插件市场 v" + status.market.version + ":本插件与其共用目录源与安装链路,但不依赖该插件,移除后打包与安装功能不受影响。")
1348
1422
  : h("div", { style: { ...hint, marginTop: "6px" } }, "未检测到插件市场,功能不受影响:打包、安装与检测均在本地完成。建议先安装 dshmarket 以获得分类、搜索与「切换市场版」入口;未安装时,首次使用请点击「建立目录索引」。"),
@@ -1372,13 +1446,7 @@ window.__ModuleLoader__.load({
1372
1446
  h("button", { style: btn, disabled: !!syncing, onClick: buildCatalog }, syncing || "建立目录索引(5~30 秒)"))
1373
1447
  : null,
1374
1448
  catalog.present && syncing ? h("div", { style: hint }, syncing) : null,
1375
- catalog.present ? h("div", { style: { ...row, rowGap: "4px", maxHeight: "78px", overflow: "auto" } },
1376
- chips.map((c) => h("button", {
1377
- key: c.id,
1378
- style: category === c.id ? chipOn : chipBtn,
1379
- onClick: () => setCategory(c.id),
1380
- title: "只看「" + c.label + "」" + (c.count ? ",市场内 " + c.count + " 个" : ""),
1381
- }, c.label + (c.count ? " " + c.count : "")))) : null,
1449
+ catalog.present ? h(CategoryChips, { chips, value: category, onChange: setCategory }) : null,
1382
1450
  aiReady === false ? h("div", { style: hint }, "当前装的插件市场没有 AI 搜索(旧版本或未安装):这里只做关键词搜索。装新版 dshmarket 后开关会自动出现。") : null,
1383
1451
  aiRun ? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "6px", borderColor: aiRun.error ? "#ff6b6b" : "var(--dsw-alias-border-l2)" } },
1384
1452
  h("div", { style: row },
@@ -1460,8 +1528,8 @@ window.__ModuleLoader__.load({
1460
1528
  h("input", { style: { ...input, width: "100%" }, placeholder: "一句话描述(可空)", value: options.description, onChange: (e) => setOptions({ ...options, description: e.target.value }) }),
1461
1529
  h(Switch, { checked: options.confirmLicense, label: "我确认所选插件的许可证允许再分发,或已获得作者授权", onChange: (v) => setOptions({ ...options, confirmLicense: v }) }),
1462
1530
  h("div", { style: row },
1463
- h("button", { style: btnPrimary, disabled: picked.length === 0 || busy === "start" || Boolean(currentBlocked), onClick: doPack }, busy === "start" ? "提交中…" : (currentBlocked ? "先换个可用的策略" : ("打包 " + picked.length + " 个插件"))),
1464
- started ? h("span", { style: hint }, "已开始:" + started + "(进度在左下角,可以接着选别的再打一个)") : null,
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,
1465
1533
  status ? h("span", { style: hint }, "DSH " + (status.dshVersion || "?") + " · profile " + status.profile) : null)),
1466
1534
  pausedRiskNodes.length ? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "10px", borderColor: "#d9534f" } }, pausedRiskNodes) : null,
1467
1535
  error ? h(Notice, { tone: "bad" }, error) : null,
@@ -1484,7 +1552,7 @@ window.__ModuleLoader__.load({
1484
1552
  result.manifest && result.manifest.plugins && result.manifest.plugins.length
1485
1553
  ? h("div", { style: { display: "flex", flexDirection: "column", gap: "2px" } },
1486
1554
  result.manifest.plugins.map((p) => h("div", { key: p.name, style: mono },
1487
- "· " + 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 ? " [含配置]" : ""))))
1488
1556
  : null,
1489
1557
  result.compat ? h(CompatList, { compat: result.compat }) : null,
1490
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,
@@ -1497,6 +1565,7 @@ window.__ModuleLoader__.load({
1497
1565
  }
1498
1566
 
1499
1567
  // —— 安装 / 导入 ——
1568
+ // ===== [区块] 页签二:安装 / 导入:InstallPanel =====
1500
1569
  function InstallPanel(props) {
1501
1570
  const [source, setSource] = useState({ kind: "url", url: "", file: "" })
1502
1571
  const [packs, setPacks] = useState([])
@@ -1528,6 +1597,26 @@ window.__ModuleLoader__.load({
1528
1597
  setError("")
1529
1598
  }), [])
1530
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
+
1531
1620
  const fileRef = useRef(null)
1532
1621
 
1533
1622
  // 用「打开文件」的方式挑一个 .dshpack:字节直接读,不要求你写路径
@@ -1816,7 +1905,7 @@ window.__ModuleLoader__.load({
1816
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)" } },
1817
1906
  h("input", { type: "checkbox", checked, onChange: () => setPickedNames((prev) => ({ ...prev, [p.name]: !checked })) }),
1818
1907
  h("div", { style: { flex: "1 1 220px", minWidth: "170px" } },
1819
- 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 || "?"))),
1820
1909
  h("div", { style: hint }, [p.localEdits ? "含本机修改" : "", p.configIncluded ? "有配置" : "", p.dataIncluded ? "有数据快照" : ""].filter(Boolean).join(" · ")),
1821
1910
  row.problems.length ? h("div", { style: { ...hint, color: row.problems.some((f) => f.level === "error") ? "#ff6b6b" : "#ffb020" } },
1822
1911
  row.problems.slice(0, 3).map((f) => "· " + f.message).join(";") + (row.problems.length > 3 ? "(还有 " + (row.problems.length - 3) + " 条)" : "")) : null),
@@ -1839,7 +1928,7 @@ window.__ModuleLoader__.load({
1839
1928
  h("div", { style: hint }, "要保留本机版本就直接完成;要换成包内版本点下面这个(会覆盖本机那份)。"),
1840
1929
  h("div", { style: row },
1841
1930
  h("button", { style: btn, disabled: busy !== "", onClick: () => { setAskReplace(false) } }, "直接完成(保留本机版本)"),
1842
- h("button", { style: btnPrimary, disabled: busy !== "", onClick: () => replaceDeferred(deferred.map((d) => d.name)) }, "替换为包内版本(" + deferred.length + " 个)")))
1931
+ h("button", { style: btnPrimary, disabled: busy !== "", onClick: () => replaceDeferred(deferred.map((d) => d.name)) }, `重新装一下这 ${deferred.length} 个(用包内版本)`)))
1843
1932
  : null,
1844
1933
  done ? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
1845
1934
  h("div", { style: row },
@@ -1882,8 +1971,9 @@ window.__ModuleLoader__.load({
1882
1971
  h("span", null, "如果这个插件省了时间,顺手点个 Star,能让更多人找到它。"))
1883
1972
  }
1884
1973
 
1974
+ // ===== [区块] 页签四:设置与记录:SettingsPanel =====
1885
1975
  function SettingsPanel(props) {
1886
- const [cfg, setCfg] = useState(props.status ? props.status.config : null)
1976
+ const [cfg, setCfg] = useState(() => ({ ...((props.status && props.status.config) || {}), ...(liveCfg.value || {}) }))
1887
1977
  const [saved, setSaved] = useState("")
1888
1978
  const [busy, setBusy] = useState(false)
1889
1979
  const [scanNag, fireScanNag] = useNag()
@@ -1912,7 +2002,13 @@ window.__ModuleLoader__.load({
1912
2002
  setBusy(true); setSaved("")
1913
2003
  try {
1914
2004
  const data = await api("/settings", { patch: p })
1915
- if (data && data.ok) { setCfg(data.config); setSaved("已保存") }
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
+ }
1916
2012
  else setSaved((data && data.error) || "保存失败")
1917
2013
  } catch (e) {
1918
2014
  setSaved(e.message || String(e))
@@ -2083,6 +2179,20 @@ window.__ModuleLoader__.load({
2083
2179
  h("div", { style: hint }, "只关市场自己的,不动整合包:改的是它存在 .dsh-market/state.json 里的 sidebarEntry,不动它的安装,也不动整合包的入口。"),
2084
2180
  marketSidebarMsg ? h("div", { style: hint }, marketSidebarMsg) : null,
2085
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 }, "搜索、分类、详情与下载码都在「社区资源」那一栏里;上传方式与规则点那一栏右上角。")),
2086
2196
  h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
2087
2197
  h("div", { style: strong }, "插件目录(分类 · 搜索 · 分页)"),
2088
2198
  h("div", { style: hint }, (() => {
@@ -2101,6 +2211,561 @@ window.__ModuleLoader__.load({
2101
2211
  )
2102
2212
  }
2103
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 =====
2104
2769
  function Home(props) {
2105
2770
  const [tab, setTab] = useState("pack")
2106
2771
  const jobs = useJobs()
@@ -2141,6 +2806,9 @@ window.__ModuleLoader__.load({
2141
2806
  return () => { alive = false }
2142
2807
  }, [forceHideMarket])
2143
2808
  useEffect(() => subscribePack((value) => { setPackResult(value) }), [])
2809
+ // 「社区资源」这一栏开不开:用模块级状态,设置里一关标签立刻消失,切回设置也不会又亮着
2810
+ const [marketOn, setMarketOn] = useState(() => readMarketVisible())
2811
+ useEffect(() => subscribeMarketVisible((on) => { setMarketOn(on) }), [])
2144
2812
  const savePackResult = (value) => {
2145
2813
  setPackValue(value)
2146
2814
  setPackResult(value)
@@ -2189,14 +2857,47 @@ window.__ModuleLoader__.load({
2189
2857
  title: "把进度窗叫回右下角的默认位置(拖到角落挡住了界面就用这个)",
2190
2858
  onClick: () => { requestDockReset() },
2191
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
2192
2892
  const tabs = [
2193
2893
  ["pack", "打包"],
2194
2894
  ["install", "安装 / 导入"],
2895
+ ...(marketOn ? [["market", "社区资源"]] : []),
2195
2896
  ["settings", "设置与记录"],
2196
2897
  ]
2197
2898
  const tabBtn = (key, text) => h("button", {
2198
2899
  key,
2199
- onClick: () => setTab(key),
2900
+ onClick: () => { setTab(key); if (key === "market") spotEgg() },
2200
2901
  style: {
2201
2902
  ...btn,
2202
2903
  fontSize: embedded ? "12px" : btn.fontSize,
@@ -2210,9 +2911,11 @@ window.__ModuleLoader__.load({
2210
2911
  const panels = [
2211
2912
  tab === "pack" ? h(PackPanel, { key: "pack-" + gen, status, jobs, result: packResult, setResult: savePackResult, focus }) : null,
2212
2913
  tab === "install" ? h(InstallPanel, { key: "install-" + gen, status }) : null,
2914
+ tab === "market" ? h(MarketPanel, { key: "market-" + gen, status, onGoInstall: () => setTab("install") }) : null,
2213
2915
  tab === "settings" ? h(SettingsPanel, { key: "settings-" + gen, status }) : null,
2214
2916
  ]
2215
- const footNote = h("div", { style: hint }, "说明:整合包只打包你选择的插件与必要配置。打包与安装安全检测在内存中进行,命中原文不落盘;请遵守插件作者许可证与你所在地区的法律法规。")
2917
+ // 这段是打包/安装的安全说明,社区资源里不该出现(那里是逛目录,不是打包)
2918
+ const footNote = tab === "market" ? null : h("div", { style: hint }, "说明:整合包只打包你选择的插件与必要配置。打包与安装安全检测在内存中进行,命中原文不落盘;请遵守插件作者许可证与你所在地区的法律法规。")
2216
2919
  const unlagNode = unlag
2217
2920
  ? h("div", { style: row },
2218
2921
  h("button", {
@@ -2245,8 +2948,8 @@ window.__ModuleLoader__.load({
2245
2948
  },
2246
2949
  h("div", { style: { maxWidth: "1020px", margin: "0 auto", width: "100%", display: "flex", flexDirection: "column", gap: "10px" } },
2247
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,
2248
2952
  unlagNode,
2249
- unlagNode,
2250
2953
  panels,
2251
2954
  footNote,
2252
2955
  h(RepoFooter, null)),
@@ -2262,6 +2965,7 @@ window.__ModuleLoader__.load({
2262
2965
  h("h2", { style: { margin: 0, fontSize: "20px", fontWeight: 600 } }, "整合包"),
2263
2966
  h("span", { style: hint }, ((status && status.config && status.config.tagline) || "谁说 dsh 不能整整合包呢?(你说这几个插件整一块不牛逼坏了)"))),
2264
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,
2265
2969
  panels,
2266
2970
  footNote,
2267
2971
  h(RepoFooter, null)),
@@ -2277,6 +2981,7 @@ window.__ModuleLoader__.load({
2277
2981
  }
2278
2982
 
2279
2983
  /** 用一个小组件包住面板,进入时拉一次状态,之后交给子面板。 */
2984
+ // ===== [区块] 页面入口:读 status、按显示位决定挂哪里:Page =====
2280
2985
  function Page(props) {
2281
2986
  const [status, setStatus] = useState(null)
2282
2987
  const [error, setError] = useState("")
@@ -2293,6 +2998,7 @@ window.__ModuleLoader__.load({
2293
2998
  if (data && data.ok) {
2294
2999
  setStatus(data)
2295
3000
  setError("")
3001
+ if (data.config) { mergeLiveConfig(data.config); setMarketVisible(data.config.showModpackMarket !== false) }
2296
3002
  if (data.placements) setPlacement(data.placements)
2297
3003
  setTries(0)
2298
3004
  return
@@ -2388,6 +3094,7 @@ window.__ModuleLoader__.load({
2388
3094
  try {
2389
3095
  const data = await api("/status")
2390
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) }
2391
3098
  if (data && data.config && data.config.forceHideMarketSidebar === true) enforceMarketSidebarOff()
2392
3099
  } catch (e) {
2393
3100
  if (left > 0) setTimeout(() => { refreshPlacement(left - 1) }, 700 * (3 - left))
@@ -2408,6 +3115,11 @@ window.__ModuleLoader__.load({
2408
3115
  }
2409
3116
 
2410
3117
  exports.apply = apply
3118
+ exports.MarketPanel = MarketPanel
3119
+ // 自测用:社区资源那层「切页签也保留」的状态存在模块里,测试要能塞一份进去看恢复得对不对
3120
+ exports.__marketUi = marketUi
3121
+ exports.PluginBrowser = PluginBrowser
3122
+ exports.ModpackBrowser = ModpackBrowser
2411
3123
  exports.inject = inject
2412
3124
  exports.Page = Page
2413
3125
  exports.Home = Home