dsh-modpack-kit 0.1.3 → 0.1.5
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 +104 -24
- package/assets/install-stub.mjs +78 -3
- package/client.js +408 -45
- package/docs/DETAIL.md +57 -12
- package/index.js +341 -66
- package/lib/install.mjs +196 -44
- package/lib/manifest.mjs +24 -2
- package/lib/pack.mjs +114 -7
- package/lib/scan.mjs +21 -0
- package/lib/store.mjs +7 -0
- package/lib/yamlish.mjs +19 -9
- package/lib/zip.mjs +22 -2
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
package/client.js
CHANGED
|
@@ -76,6 +76,42 @@ window.__ModuleLoader__.load({
|
|
|
76
76
|
return () => packStore.subs.delete(fn)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
// 已导入的整合包:可以同时留好几份,各自显示名字 / 作者 / 描述,切页签也还在
|
|
80
|
+
const importStore = { value: [], subs: new Set() }
|
|
81
|
+
function readImports() {
|
|
82
|
+
return importStore.value.slice()
|
|
83
|
+
}
|
|
84
|
+
function setImports(next) {
|
|
85
|
+
importStore.value = Array.isArray(next) ? next.slice(0, 8) : []
|
|
86
|
+
for (const fn of [...importStore.subs]) { try { fn(readImports()) } catch (e) { /* 订阅出错不影响别的 */ } }
|
|
87
|
+
}
|
|
88
|
+
function subscribeImports(fn) {
|
|
89
|
+
importStore.subs.add(fn)
|
|
90
|
+
return () => importStore.subs.delete(fn)
|
|
91
|
+
}
|
|
92
|
+
function importEntry(data, fileName) {
|
|
93
|
+
const manifest = (data && data.manifest) || {}
|
|
94
|
+
return {
|
|
95
|
+
token: data.token,
|
|
96
|
+
fileName: fileName || "",
|
|
97
|
+
name: manifest.name || "(未命名整合包)",
|
|
98
|
+
description: manifest.description || "",
|
|
99
|
+
author: manifest.author || "",
|
|
100
|
+
format: manifest.format || "",
|
|
101
|
+
createdAt: manifest.createdAt || "",
|
|
102
|
+
plugins: Array.isArray(manifest.plugins) ? manifest.plugins.length : 0,
|
|
103
|
+
importedAt: new Date().toISOString(),
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function addImport(entry) {
|
|
107
|
+
if (!entry || !entry.token) return
|
|
108
|
+
const rest = importStore.value.filter((item) => item.token !== entry.token)
|
|
109
|
+
setImports([entry, ...rest])
|
|
110
|
+
}
|
|
111
|
+
function removeImport(token) {
|
|
112
|
+
setImports(importStore.value.filter((item) => item.token !== token))
|
|
113
|
+
}
|
|
114
|
+
|
|
79
115
|
// 点了「清空进程」:打包页上的旧报错、旧的失败结果也一起收掉,别留着当幽灵
|
|
80
116
|
const clearSignal = { subs: new Set() }
|
|
81
117
|
function fireClear() {
|
|
@@ -113,6 +149,51 @@ window.__ModuleLoader__.load({
|
|
|
113
149
|
return data
|
|
114
150
|
}
|
|
115
151
|
|
|
152
|
+
// 宿主有没有原生的目录选择器:有就能点「浏览文件夹…」,没有就退回手填
|
|
153
|
+
let pickDirectoryHost = null
|
|
154
|
+
|
|
155
|
+
const arrayBufferToBase64 = (buffer) => {
|
|
156
|
+
const view = new Uint8Array(buffer)
|
|
157
|
+
const chunk = 0x8000
|
|
158
|
+
let text = ""
|
|
159
|
+
for (let i = 0; i < view.length; i += chunk) {
|
|
160
|
+
text += String.fromCharCode.apply(null, view.subarray(i, i + chunk))
|
|
161
|
+
}
|
|
162
|
+
return btoa(text)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// 把 .dshpack 交给宿主读:先按原始字节 POST,环境不允许时退回 base64 JSON
|
|
166
|
+
async function uploadPackFile(file) {
|
|
167
|
+
if (!file) throw new Error("没有拿到文件")
|
|
168
|
+
if (file.size && file.size > 250 * 1024 * 1024) throw new Error("文件太大(超过 250 MB)")
|
|
169
|
+
let firstError = ""
|
|
170
|
+
try {
|
|
171
|
+
const res = await fetch(API + "/pack/drop", {
|
|
172
|
+
method: "POST",
|
|
173
|
+
headers: { "Content-Type": "application/octet-stream" },
|
|
174
|
+
body: file,
|
|
175
|
+
})
|
|
176
|
+
const text = await res.text()
|
|
177
|
+
let data = null
|
|
178
|
+
try { data = JSON.parse(text) } catch {}
|
|
179
|
+
if (res.ok && data && data.ok) return data
|
|
180
|
+
firstError = (data && data.error) || ("HTTP " + res.status + (text ? ":" + text.slice(0, 120) : ""))
|
|
181
|
+
} catch (e) {
|
|
182
|
+
firstError = (e && e.message) || String(e)
|
|
183
|
+
}
|
|
184
|
+
// 退回 base64:有些环境不许 POST 二进制,JSON 一定通
|
|
185
|
+
let buffer
|
|
186
|
+
try { buffer = await file.arrayBuffer() } catch (e) { throw new Error("读文件失败:" + ((e && e.message) || e)) }
|
|
187
|
+
let data
|
|
188
|
+
try {
|
|
189
|
+
data = await api("/pack/drop", { name: file.name || "dropped.dshpack", data: arrayBufferToBase64(buffer) })
|
|
190
|
+
} catch (e) {
|
|
191
|
+
throw new Error(((e && e.message) || String(e)) + "(原始字节也没通:" + firstError + ")")
|
|
192
|
+
}
|
|
193
|
+
if (!data || !data.ok) throw new Error((data && data.error) || ("读取失败:" + firstError))
|
|
194
|
+
return data
|
|
195
|
+
}
|
|
196
|
+
|
|
116
197
|
const bytes = (n) => {
|
|
117
198
|
const v = Number(n) || 0
|
|
118
199
|
if (v < 1024) return v + " B"
|
|
@@ -278,7 +359,13 @@ window.__ModuleLoader__.load({
|
|
|
278
359
|
}
|
|
279
360
|
|
|
280
361
|
function JobDock(props) {
|
|
281
|
-
const
|
|
362
|
+
const given = Array.isArray(props.jobs) ? props.jobs : []
|
|
363
|
+
// 「清空进程」之后,就算服务端还残留一条,也在界面上立刻拿掉
|
|
364
|
+
const [cleared, setCleared] = useState([])
|
|
365
|
+
const jobs = given.filter((job) => !cleared.includes(job.id))
|
|
366
|
+
useEffect(() => {
|
|
367
|
+
setCleared((prev) => (prev.length === 0 ? prev : prev.filter((id) => given.some((job) => job.id === id))))
|
|
368
|
+
}, [given])
|
|
282
369
|
const [pos, setPos] = useState(readDockPos())
|
|
283
370
|
const [pinned, setPinned] = useState(false) // 手动唤出:没有任务时也显示
|
|
284
371
|
const [hidden, setHidden] = useState(false) // 手动收起:连进行中的也先藏起来
|
|
@@ -296,6 +383,9 @@ window.__ModuleLoader__.load({
|
|
|
296
383
|
|
|
297
384
|
const startDrag = (event) => {
|
|
298
385
|
if (!event || typeof event.clientX !== "number") return
|
|
386
|
+
// 按在按钮上就别当拖动:否则指针捕获会把 click 抢走,按钮点不到,
|
|
387
|
+
// 而且抬手时还会顺带把窗口展开/收起(就是「判定重叠」那个毛病)
|
|
388
|
+
if (event.target && typeof event.target.closest === "function" && event.target.closest("button")) return
|
|
299
389
|
const el = boxRef.current
|
|
300
390
|
const rect = el && el.getBoundingClientRect ? el.getBoundingClientRect() : { left: 0, top: 0, width: 0, height: 0 }
|
|
301
391
|
dragRef.current = {
|
|
@@ -371,25 +461,33 @@ window.__ModuleLoader__.load({
|
|
|
371
461
|
try { await api("/jobs/ack", { id }) } catch (error) { setDockMsg((error && error.message) || "确认失败") }
|
|
372
462
|
}
|
|
373
463
|
const dismiss = async (id) => {
|
|
374
|
-
try {
|
|
464
|
+
try {
|
|
465
|
+
await api("/jobs/dismiss", { id })
|
|
466
|
+
// 删掉一条也算收尾:安装页那条「完成 · 100%」的结论一起收掉
|
|
467
|
+
setCleared((prev) => (prev.includes(id) ? prev : [...prev, id]))
|
|
468
|
+
fireClear()
|
|
469
|
+
} catch (error) { setDockMsg((error && error.message) || "删除失败") }
|
|
375
470
|
}
|
|
376
471
|
const clearDone = async () => {
|
|
377
|
-
//
|
|
472
|
+
// 只看「收尾」的:正在跑的和停在风险点等你决定的,一律留着、照常显示
|
|
473
|
+
const targets = given.filter((job) => job.status !== "running" && job.status !== "paused")
|
|
474
|
+
if (targets.length === 0) {
|
|
475
|
+
setDockMsg("没有可清空的进程(正在跑的和停在风险点的会留着)")
|
|
476
|
+
return
|
|
477
|
+
}
|
|
478
|
+
// 先摘行:服务端慢一点也能立刻看到效果,不用等下一轮轮询
|
|
479
|
+
setCleared((prev) => [...new Set([...prev, ...targets.map((job) => job.id)])])
|
|
480
|
+
fireClear()
|
|
481
|
+
setDockMsg("已清 " + targets.length + " 条")
|
|
378
482
|
try {
|
|
379
|
-
|
|
380
|
-
setDockMsg(data && data.removed && data.removed.length ? "" : "没有可清空的进程")
|
|
381
|
-
fireClear()
|
|
483
|
+
await api("/jobs/clear", {})
|
|
382
484
|
return
|
|
383
|
-
} catch (
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
for (const job of targets) {
|
|
388
|
-
try { await api("/jobs/dismiss", { id: job.id }) } catch { bad += 1 }
|
|
389
|
-
}
|
|
390
|
-
fireClear()
|
|
391
|
-
setDockMsg(bad ? ("有 " + bad + " 条没删掉(可能还在跑),其余已清") : "")
|
|
485
|
+
} catch (ignored) { /* 老宿主没有这条路由:退回逐条删 */ }
|
|
486
|
+
let bad = 0
|
|
487
|
+
for (const job of targets) {
|
|
488
|
+
try { await api("/jobs/dismiss", { id: job.id }) } catch (error) { bad += 1 }
|
|
392
489
|
}
|
|
490
|
+
if (bad) setDockMsg("有 " + bad + " 条没删掉(可能还在跑),其余已清")
|
|
393
491
|
}
|
|
394
492
|
// 只要有一条不是「在跑」或「停在风险点」,就给清空入口(状态再怪也算收尾)
|
|
395
493
|
const finished = jobs.filter((job) => job.status !== "running" && job.status !== "paused")
|
|
@@ -425,16 +523,20 @@ window.__ModuleLoader__.load({
|
|
|
425
523
|
h("span", { style: { fontSize: "12px", color: "var(--dsw-alias-label-secondary, #b6bac3)", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, headText),
|
|
426
524
|
h("span", { style: { marginLeft: "auto", fontSize: "12px", fontVariantNumeric: "tabular-nums" } }, headPct + "%"),
|
|
427
525
|
running.length > 1 ? h("span", { style: { ...hint, marginLeft: "0" } }, "+" + (running.length - 1)) : null,
|
|
428
|
-
|
|
526
|
+
jobs.length > 0
|
|
429
527
|
? h("button", {
|
|
430
|
-
|
|
528
|
+
type: "button",
|
|
529
|
+
style: { ...chipBtn, marginLeft: "2px", padding: "2px 8px", lineHeight: "18px", flexShrink: 0 },
|
|
431
530
|
title: "清掉所有收尾与失败的进程(跑着的和停在风险点的留着)",
|
|
531
|
+
onPointerDown: (event) => { if (event && event.stopPropagation) event.stopPropagation() },
|
|
432
532
|
onClick: (event) => { if (event && event.stopPropagation) event.stopPropagation(); clearDone() },
|
|
433
533
|
}, "清空进程")
|
|
434
534
|
: null,
|
|
435
535
|
h("button", {
|
|
436
|
-
|
|
536
|
+
type: "button",
|
|
537
|
+
style: { ...chipBtn, marginLeft: "2px", padding: "2px 8px", lineHeight: "18px", flexShrink: 0 },
|
|
437
538
|
title: "收起(有任务时还会再冒出来)",
|
|
539
|
+
onPointerDown: (event) => { if (event && event.stopPropagation) event.stopPropagation() },
|
|
438
540
|
onClick: (event) => { if (event && event.stopPropagation) event.stopPropagation(); setHidden(true); setPinned(false) },
|
|
439
541
|
}, "收起")),
|
|
440
542
|
current ? h(ProgressBar, { pct: headPct, tone: current.status === "failed" ? "#ff6b6b" : current.status === "cancelled" ? "#8b8f99" : undefined }) : null,
|
|
@@ -469,7 +571,7 @@ window.__ModuleLoader__.load({
|
|
|
469
571
|
job.canAck
|
|
470
572
|
? h("button", { style: { ...chipBtn, color: "#ff6b6b", borderColor: "#ff6b6b" }, title: "忽略风险,在同一个任务里接着跑完", onClick: () => ack(job.id) }, "我知道在干什么")
|
|
471
573
|
: null,
|
|
472
|
-
job.
|
|
574
|
+
job.status !== "running" && job.status !== "paused"
|
|
473
575
|
? h("button", { style: { ...chipBtn, color: "var(--dsw-alias-label-tertiary, #8b8f99)" }, title: "从列表里删掉这条记录", onClick: () => dismiss(job.id) }, "删除该进程")
|
|
474
576
|
: null,
|
|
475
577
|
job.error && job.status !== "paused" ? h("span", { style: { ...hint, color: "#ff6b6b" } }, job.error) : null)))))
|
|
@@ -627,13 +729,15 @@ window.__ModuleLoader__.load({
|
|
|
627
729
|
}
|
|
628
730
|
|
|
629
731
|
const picked = Object.keys(selected)
|
|
732
|
+
// 市场里没装的插件也能打包:走 npm 源(安装时由市场按版本取包)
|
|
733
|
+
const entrySource = (entry) => (entry.installed === false ? "npm" : "profile")
|
|
630
734
|
const toggle = (entry) => {
|
|
631
735
|
setSelected((prev) => {
|
|
632
736
|
const next = { ...prev }
|
|
633
737
|
if (next[entry.name]) delete next[entry.name]
|
|
634
738
|
else next[entry.name] = {
|
|
635
739
|
name: entry.name,
|
|
636
|
-
source: entry
|
|
740
|
+
source: entrySource(entry),
|
|
637
741
|
spec: entry.version || "",
|
|
638
742
|
mode: "base",
|
|
639
743
|
}
|
|
@@ -843,12 +947,12 @@ window.__ModuleLoader__.load({
|
|
|
843
947
|
h("div", { style: { flex: "1 1 220px", minWidth: "180px" } },
|
|
844
948
|
h("div", { style: label }, entry.title || entry.name, " ", h("span", { style: hint }, "@" + (entry.version || "?"))),
|
|
845
949
|
h("div", { style: hint }, (entry.description || "").slice(0, 110))),
|
|
846
|
-
h("span", { style: chip }, entry.installed === false ? "市场" : "本机"),
|
|
950
|
+
h("span", { style: chip }, entry.installed === false ? "市场 · 未装" : "本机"),
|
|
847
951
|
h("span", { style: { ...chip, color: "var(--dsw-alias-label-tertiary)" } }, labelOf(categoryOf(entry))),
|
|
848
952
|
entry.updateAvailable ? h(Tag, { color: "#2bb673" }, "市场版 " + (entry.marketVersion || entry.version) + " 更新") : null,
|
|
849
953
|
on ? h("input", {
|
|
850
954
|
style: { ...input, width: "120px" },
|
|
851
|
-
placeholder: selected[entry.name].source === "npm" ? "
|
|
955
|
+
placeholder: selected[entry.name].source === "npm" ? "版本,空=最新(从市场取包)" : "版本,空=本机版本",
|
|
852
956
|
value: selected[entry.name].spec || "",
|
|
853
957
|
onChange: (e) => setSpec(entry.name, e.target.value),
|
|
854
958
|
}) : null,
|
|
@@ -865,7 +969,7 @@ window.__ModuleLoader__.load({
|
|
|
865
969
|
h("button", { style: btn, disabled: searching, onClick: loadMore }, searching ? "加载中…" : ("加载更多(还有 " + Math.max(0, search.total - rows.length) + " 条)"))) : null,
|
|
866
970
|
h("div", { style: hint }, active
|
|
867
971
|
? "排序:已装的排前面,其余按插件市场的相关度与目录顺序。分类和词条都来自插件市场目录。"
|
|
868
|
-
: "
|
|
972
|
+
: "首屏只列本机已装。搜索或点分类才会去插件市场目录里查,服务端分页、一次一页。搜索结果里没装的插件也能直接勾选——打包时按版本从插件市场取包,装的时候同样从市场下载。")
|
|
869
973
|
),
|
|
870
974
|
h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
|
|
871
975
|
h("div", { style: strong }, "包选项"),
|
|
@@ -920,22 +1024,100 @@ window.__ModuleLoader__.load({
|
|
|
920
1024
|
function InstallPanel(props) {
|
|
921
1025
|
const [source, setSource] = useState({ kind: "url", url: "", file: "" })
|
|
922
1026
|
const [packs, setPacks] = useState([])
|
|
1027
|
+
const [dirInput, setDirInput] = useState((props.status && props.status.paths && props.status.paths.packs) || "")
|
|
1028
|
+
const [dirInfo, setDirInfo] = useState({ dir: (props.status && props.status.paths && props.status.paths.packs) || "", error: "" })
|
|
923
1029
|
const [preview, setPreview] = useState(null)
|
|
924
1030
|
const [busy, setBusy] = useState("")
|
|
925
1031
|
const [error, setError] = useState("")
|
|
926
1032
|
const [done, setDone] = useState(null)
|
|
927
|
-
const [options, setOptions] = useState({ keepLocal: true, applyConfig: true, force: false, dryRun: false, enableBundles: !!((props.status && props.status.config && props.status.config.enableOnInstall) === true) })
|
|
1033
|
+
const [options, setOptions] = useState({ keepLocal: true, applyConfig: true, force: false, dryRun: false, preferMarket: !!((props.status && props.status.config && props.status.config.preferMarketOnInstall !== false)), enableBundles: !!((props.status && props.status.config && props.status.config.enableOnInstall) === true) })
|
|
1034
|
+
// 安装也走任务队列:进度直接显示在左下角那个窗里,这里留一份给页面内看
|
|
1035
|
+
const [progress, setProgress] = useState(null)
|
|
1036
|
+
const [deferred, setDeferred] = useState([])
|
|
1037
|
+
const [askReplace, setAskReplace] = useState(false)
|
|
1038
|
+
const [imports, setImportsState] = useState(readImports())
|
|
1039
|
+
|
|
1040
|
+
// 已导入的几份包各自留在列表里:切页签、开关进度窗都不丢
|
|
1041
|
+
useEffect(() => subscribeImports((next) => setImportsState(next)), [])
|
|
1042
|
+
|
|
1043
|
+
// 进度窗里点了「清空进程」:安装页上那条「完成 / 失败」的结论也一起收掉,别留着当幽灵
|
|
1044
|
+
useEffect(() => subscribeClear(() => {
|
|
1045
|
+
setProgress(null)
|
|
1046
|
+
setDone(null)
|
|
1047
|
+
setDeferred([])
|
|
1048
|
+
setAskReplace(false)
|
|
1049
|
+
setError("")
|
|
1050
|
+
}), [])
|
|
1051
|
+
|
|
1052
|
+
const fileRef = useRef(null)
|
|
928
1053
|
|
|
929
|
-
|
|
1054
|
+
// 用「打开文件」的方式挑一个 .dshpack:字节直接读,不要求你写路径
|
|
1055
|
+
const pickFile = async (file) => {
|
|
1056
|
+
if (!file) return
|
|
1057
|
+
if (!/\.dshpack$/i.test(file.name || "")) { setError("只认 .dshpack 整合包"); return }
|
|
1058
|
+
setBusy("upload"); setError(""); setDone(null); setDeferred([]); setAskReplace(false)
|
|
1059
|
+
try {
|
|
1060
|
+
const data = await uploadPackFile(file)
|
|
1061
|
+
setSource({ kind: "token", token: data.token, url: "", file: "" })
|
|
1062
|
+
setPreview(data)
|
|
1063
|
+
addImport(importEntry(data, file.name))
|
|
1064
|
+
} catch (e) {
|
|
1065
|
+
setError((e && e.message) || String(e))
|
|
1066
|
+
} finally { setBusy("") }
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// 从「已导入的整合包」里挑一份:重新读一遍拿预览(token 过期就提示并去掉这条)
|
|
1070
|
+
const pickImport = async (item) => {
|
|
1071
|
+
if (!item || !item.token) return
|
|
1072
|
+
setBusy("import"); setError(""); setDone(null); setDeferred([]); setAskReplace(false)
|
|
1073
|
+
try {
|
|
1074
|
+
const data = await api("/inspect", { token: item.token })
|
|
1075
|
+
if (!data || data.ok !== true) throw new Error((data && data.error) || "这份导入的包已经过期了,重新导入一次")
|
|
1076
|
+
setSource({ kind: "token", token: item.token, url: "", file: "" })
|
|
1077
|
+
setPreview(data)
|
|
1078
|
+
} catch (e) {
|
|
1079
|
+
const message = (e && e.message) || String(e)
|
|
1080
|
+
setError(message)
|
|
1081
|
+
if (/过期|找不到|expired/iu.test(message)) removeImport(item.token)
|
|
1082
|
+
} finally { setBusy("") }
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// 原生目录选择器:拿到绝对路径就填进去并列出该目录的 .dshpack
|
|
1086
|
+
const browseFolder = async () => {
|
|
1087
|
+
if (typeof pickDirectoryHost !== "function") {
|
|
1088
|
+
setDirInfo({ ...dirInfo, error: "这个环境没有系统目录选择器,直接在上面填路径也能用" })
|
|
1089
|
+
return
|
|
1090
|
+
}
|
|
1091
|
+
setBusy("dir")
|
|
930
1092
|
try {
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
|
|
1093
|
+
const picked = await pickDirectoryHost()
|
|
1094
|
+
if (picked) {
|
|
1095
|
+
setDirInput(picked)
|
|
1096
|
+
await reloadPacks(picked)
|
|
1097
|
+
}
|
|
1098
|
+
} catch (e) {
|
|
1099
|
+
setDirInfo({ ...dirInfo, error: "打不开目录选择器:" + ((e && e.message) || e) })
|
|
1100
|
+
} finally { setBusy("") }
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
// 列目录:不传目录就看插件自己的 packs,传了就看你指定的目录
|
|
1104
|
+
const reloadPacks = useCallback(async (dir) => {
|
|
1105
|
+
const want = typeof dir === "string" ? dir.trim() : ""
|
|
1106
|
+
try {
|
|
1107
|
+
const data = want ? await api("/packs", { dir: want }) : await api("/packs")
|
|
1108
|
+
if (data && data.items) setPacks(data.items)
|
|
1109
|
+
setDirInfo({ dir: (data && data.dir) || want, error: (data && data.error) || "" })
|
|
1110
|
+
} catch (e) {
|
|
1111
|
+
setDirInfo({ dir: want, error: (e && e.message) || String(e) })
|
|
1112
|
+
}
|
|
934
1113
|
}, [])
|
|
935
1114
|
useEffect(() => { reloadPacks() }, [reloadPacks])
|
|
936
1115
|
|
|
1116
|
+
// 拖进来的包:外面读好了,这里接住直接当预览
|
|
1117
|
+
|
|
937
1118
|
const bodyFor = () => {
|
|
938
1119
|
if (source.kind === "url") return { url: source.url.trim() }
|
|
1120
|
+
if (source.kind === "token") return { token: source.token }
|
|
939
1121
|
return { file: source.file }
|
|
940
1122
|
}
|
|
941
1123
|
|
|
@@ -950,18 +1132,73 @@ window.__ModuleLoader__.load({
|
|
|
950
1132
|
} finally { setBusy("") }
|
|
951
1133
|
}
|
|
952
1134
|
|
|
1135
|
+
// 等一个任务跑完(安装同样在后台跑,进度窗里能看到)
|
|
1136
|
+
const waitJob = async (jobId) => {
|
|
1137
|
+
const started = Date.now()
|
|
1138
|
+
while (Date.now() - started < 15 * 60 * 1000) {
|
|
1139
|
+
const data = await api("/jobs")
|
|
1140
|
+
const job = data && data.jobs ? data.jobs.find((item) => item.id === jobId) : null
|
|
1141
|
+
if (!job) throw new Error("任务不见了(可能已过期),再试一次")
|
|
1142
|
+
setProgress({ pct: job.pct, note: job.note, status: job.status })
|
|
1143
|
+
if (job.status !== "running") return job
|
|
1144
|
+
await new Promise((resolve) => setTimeout(resolve, 700))
|
|
1145
|
+
}
|
|
1146
|
+
throw new Error("等了 15 分钟还没结束,去左下角看看是不是卡住了")
|
|
1147
|
+
}
|
|
1148
|
+
|
|
953
1149
|
const install = async () => {
|
|
954
|
-
setBusy("install"); setError(""); setDone(null)
|
|
1150
|
+
setBusy("install"); setError(""); setDone(null); setDeferred([]); setAskReplace(false); setProgress(null)
|
|
955
1151
|
try {
|
|
956
|
-
const data = await api("/install", { ...bodyFor(), ...options })
|
|
957
|
-
if (!data.ok) {
|
|
958
|
-
|
|
1152
|
+
const data = await api("/install", { ...bodyFor(), ...options, async: true })
|
|
1153
|
+
if (!data || data.ok !== true || !data.job) {
|
|
1154
|
+
// 老宿主不认 async:退回同步调用
|
|
1155
|
+
const plain = await api("/install", { ...bodyFor(), ...options })
|
|
1156
|
+
if (!plain.ok) {
|
|
1157
|
+
setDone({ ok: false, error: plain.error, refused: plain.refused, scan: plain.scan, report: plain.report })
|
|
1158
|
+
return
|
|
1159
|
+
}
|
|
1160
|
+
setDone(plain)
|
|
1161
|
+
setDeferred(Array.isArray(plain.deferred) ? plain.deferred : [])
|
|
1162
|
+
setAskReplace(Array.isArray(plain.deferred) && plain.deferred.length > 0)
|
|
1163
|
+
return
|
|
1164
|
+
}
|
|
1165
|
+
const job = await waitJob(data.job.id)
|
|
1166
|
+
const payload = job.data || {}
|
|
1167
|
+
// 结果已经拿到页面上了,这条任务就从进度窗里摘掉:不用你再去点一次清空
|
|
1168
|
+
try { await api("/jobs/dismiss", { id: job.id }) } catch (ignored) { /* 老宿主没有这条路由就留着 */ }
|
|
1169
|
+
if (job.status === "cancelled") { setDone({ ok: false, error: "已取消(没有改动 profile)" }); return }
|
|
1170
|
+
if (!payload.ok) {
|
|
1171
|
+
setDone({ ok: false, error: payload.error || job.error || "安装失败", refused: Boolean(payload.refused), scan: payload.scan, report: payload.report })
|
|
959
1172
|
return
|
|
960
1173
|
}
|
|
961
|
-
setDone(
|
|
1174
|
+
setDone(payload)
|
|
1175
|
+
setDeferred(Array.isArray(payload.deferred) ? payload.deferred : [])
|
|
1176
|
+
setAskReplace(Array.isArray(payload.deferred) && payload.deferred.length > 0)
|
|
962
1177
|
} catch (e) {
|
|
963
1178
|
setDone({ ok: false, error: e.message || String(e), scan: (e.data && e.data.scan) || null, report: (e.data && e.data.report) || "", refused: Boolean(e.data && e.data.refused) })
|
|
964
|
-
} finally { setBusy("") }
|
|
1179
|
+
} finally { setBusy(""); setProgress(null) }
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
// 把刚才跳过的换成包内版本
|
|
1183
|
+
const replaceDeferred = async (names) => {
|
|
1184
|
+
if (!done || !done.token) { setError("这次安装的上下文过期了,重新读一遍包"); return }
|
|
1185
|
+
setBusy("replace"); setError("")
|
|
1186
|
+
try {
|
|
1187
|
+
const data = await api("/install/replace", { token: done.token, names, async: true })
|
|
1188
|
+
if (!data || data.ok !== true || !data.job) {
|
|
1189
|
+
const plain = await api("/install/replace", { token: done.token, names })
|
|
1190
|
+
if (!plain.ok) { setError(plain.error || "替换失败"); return }
|
|
1191
|
+
setDone(plain); setDeferred(Array.isArray(plain.deferred) ? plain.deferred : []); setAskReplace(false)
|
|
1192
|
+
return
|
|
1193
|
+
}
|
|
1194
|
+
const job = await waitJob(data.job.id)
|
|
1195
|
+
const payload = job.data || {}
|
|
1196
|
+
try { await api("/jobs/dismiss", { id: job.id }) } catch (ignored) { /* 同上 */ }
|
|
1197
|
+
if (!payload.ok) { setError(payload.error || job.error || "替换失败"); return }
|
|
1198
|
+
setDone(payload); setDeferred([]); setAskReplace(false)
|
|
1199
|
+
} catch (e) {
|
|
1200
|
+
setError(e.message || String(e))
|
|
1201
|
+
} finally { setBusy(""); setProgress(null) }
|
|
965
1202
|
}
|
|
966
1203
|
|
|
967
1204
|
return h("div", { style: { display: "flex", flexDirection: "column", gap: "14px" } },
|
|
@@ -969,28 +1206,106 @@ window.__ModuleLoader__.load({
|
|
|
969
1206
|
h("b", null, "先看清楚,再装"),
|
|
970
1207
|
" 读取阶段解压、校验完整性、扫一遍风险,全部在内存里完成;只有你点「安装」才会碰 profile。安装走官方 ",
|
|
971
1208
|
h("code", { style: mono }, "dsh plugin add"), ",不手改 node_modules。"),
|
|
1209
|
+
imports.length > 0
|
|
1210
|
+
? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
|
|
1211
|
+
h("div", { style: row },
|
|
1212
|
+
h("div", { style: strong }, "已导入的整合包"),
|
|
1213
|
+
h("span", { style: hint }, imports.length + " 份 · 可以同时留着,各自显示打包时的名字、作者与描述"),
|
|
1214
|
+
h("button", { style: { ...chipBtn, marginLeft: "auto" }, onClick: () => setImports([]) }, "全部移除")),
|
|
1215
|
+
h("div", { style: { display: "flex", flexDirection: "column", gap: "8px", maxHeight: "260px", overflow: "auto" } },
|
|
1216
|
+
imports.map((item) => h("div", {
|
|
1217
|
+
key: item.token,
|
|
1218
|
+
style: {
|
|
1219
|
+
display: "flex",
|
|
1220
|
+
flexDirection: "column",
|
|
1221
|
+
gap: "3px",
|
|
1222
|
+
padding: "8px 10px",
|
|
1223
|
+
borderRadius: "8px",
|
|
1224
|
+
border: "0.5px solid " + (source.kind === "token" && source.token === item.token ? "#4C7DF0" : "var(--dsw-alias-border-l2)"),
|
|
1225
|
+
},
|
|
1226
|
+
},
|
|
1227
|
+
h("div", { style: row },
|
|
1228
|
+
h("span", { style: { ...label, fontSize: "13px" } }, item.name),
|
|
1229
|
+
h(Tag, null, FORMAT_TEXT[item.format] || item.format || "整合包"),
|
|
1230
|
+
h("span", { style: hint }, item.plugins + " 个插件"),
|
|
1231
|
+
h("button", {
|
|
1232
|
+
style: { ...chipBtn, marginLeft: "auto" },
|
|
1233
|
+
disabled: busy !== "",
|
|
1234
|
+
onClick: () => pickImport(item),
|
|
1235
|
+
}, source.kind === "token" && source.token === item.token ? "当前选中" : "选择"),
|
|
1236
|
+
h("button", {
|
|
1237
|
+
style: { ...chipBtn, color: "var(--dsw-alias-label-tertiary, #8b8f99)" },
|
|
1238
|
+
onClick: () => {
|
|
1239
|
+
removeImport(item.token)
|
|
1240
|
+
if (source.kind === "token" && source.token === item.token) {
|
|
1241
|
+
setSource({ kind: "url", url: "", file: "" })
|
|
1242
|
+
setPreview(null)
|
|
1243
|
+
}
|
|
1244
|
+
},
|
|
1245
|
+
}, "移除")),
|
|
1246
|
+
h("div", { style: { ...hint, fontSize: "10.5px" } },
|
|
1247
|
+
"作者:" + (item.author || "未填写") + " · 生成于 " + (item.createdAt ? when(item.createdAt) : "未知")),
|
|
1248
|
+
item.description ? h("div", { style: { ...hint, fontSize: "11.5px", color: "var(--dsw-alias-label-secondary, #b6bac3)" } }, item.description) : null,
|
|
1249
|
+
item.fileName ? h("div", { style: { ...hint, fontSize: "10px" } }, item.fileName) : null))))
|
|
1250
|
+
: null,
|
|
972
1251
|
h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "10px" } },
|
|
973
1252
|
h("div", { style: row },
|
|
974
1253
|
h("button", { style: source.kind === "url" ? btnPrimary : btn, onClick: () => setSource({ ...source, kind: "url" }) }, "从链接读取"),
|
|
975
|
-
h("button", { style: source.kind === "file" ? btnPrimary : btn, onClick: () => setSource({ ...source, kind: "file" }) }, "
|
|
1254
|
+
h("button", { style: source.kind === "file" ? btnPrimary : btn, onClick: () => setSource({ ...source, kind: "file" }) }, "从本机文件读取"),
|
|
1255
|
+
h("input", {
|
|
1256
|
+
type: "file",
|
|
1257
|
+
accept: ".dshpack",
|
|
1258
|
+
ref: fileRef,
|
|
1259
|
+
style: { display: "none" },
|
|
1260
|
+
onChange: (e) => {
|
|
1261
|
+
const picked = e && e.target && e.target.files ? e.target.files[0] : null
|
|
1262
|
+
if (picked) pickFile(picked)
|
|
1263
|
+
if (e && e.target) e.target.value = ""
|
|
1264
|
+
},
|
|
1265
|
+
}),
|
|
1266
|
+
h("button", { style: btn, disabled: busy !== "", onClick: () => { if (fileRef.current) fileRef.current.click() } }, busy === "upload" ? "读取中…" : "选择文件…"),
|
|
1267
|
+
source.kind === "token"
|
|
1268
|
+
? h("button", { style: btnPrimary, onClick: () => { if (imports.length === 0) setSource({ ...source, kind: "url" }) } }, "已导入的整合包")
|
|
1269
|
+
: null),
|
|
976
1270
|
source.kind === "url"
|
|
977
1271
|
? h("input", { style: { ...input, width: "100%" }, placeholder: "https://…/xxx.dshpack", value: source.url, onChange: (e) => setSource({ ...source, url: e.target.value }) })
|
|
978
|
-
: h("div", { style:
|
|
979
|
-
h("div", { style:
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
1272
|
+
: h("div", { style: { display: "flex", flexDirection: "column", gap: "8px" } },
|
|
1273
|
+
h("div", { style: row },
|
|
1274
|
+
h("input", {
|
|
1275
|
+
style: { ...input, flex: "1 1 320px" },
|
|
1276
|
+
placeholder: "整合包所在的目录(默认是插件自己的 packs)",
|
|
1277
|
+
value: dirInput,
|
|
1278
|
+
onChange: (e) => setDirInput(e.target.value),
|
|
1279
|
+
onKeyDown: (e) => { if (e.key === "Enter") reloadPacks(dirInput) },
|
|
1280
|
+
}),
|
|
1281
|
+
h("button", { style: btn, disabled: busy !== "", onClick: browseFolder }, busy === "dir" ? "选择中…" : "浏览文件夹…"),
|
|
1282
|
+
h("button", { style: btn, onClick: () => reloadPacks(dirInput) }, "读这个目录"),
|
|
1283
|
+
h("button", { style: btn, onClick: () => reloadPacks() }, "回到默认")),
|
|
1284
|
+
dirInfo.error ? h("div", { style: { ...hint, color: "#ff6b6b" } }, dirInfo.error) : null,
|
|
1285
|
+
h("div", { style: { display: "flex", flexDirection: "column", gap: "3px", maxHeight: "170px", overflow: "auto" } },
|
|
1286
|
+
packs.length === 0 ? h("div", { style: hint }, "这个目录里没有 .dshpack。先去打包页生成一个,或者把文件拖到界面上。") : null,
|
|
1287
|
+
packs.map((p) => h("label", { key: p.path || p.name, style: { ...row, gap: "6px", cursor: "pointer" } },
|
|
1288
|
+
h("input", { type: "radio", name: "packfile", checked: source.file === (p.path || p.name), onChange: () => setSource({ ...source, file: p.path || p.name }) }),
|
|
983
1289
|
h("span", { style: label }, p.name),
|
|
984
1290
|
h("span", { style: hint }, bytes(p.size) + " · " + when(p.mtime))))),
|
|
985
|
-
h("
|
|
1291
|
+
dirInfo.dir ? h("div", { style: { ...hint, fontSize: "10.5px" } }, "当前目录:" + dirInfo.dir) : null),
|
|
986
1292
|
h("div", { style: row },
|
|
987
1293
|
h(Switch, { checked: options.keepLocal, label: "保留本地已有修改(不覆盖已装插件)", onChange: (v) => setOptions({ ...options, keepLocal: v }) }),
|
|
988
1294
|
h(Switch, { checked: options.applyConfig, label: "安装后回填包内配置", onChange: (v) => setOptions({ ...options, applyConfig: v }) }),
|
|
1295
|
+
h(Switch, { checked: options.preferMarket, label: "联网时优先用插件市场的版本(市场查不到就用包内的)", onChange: (v) => setOptions({ ...options, preferMarket: v }) }),
|
|
989
1296
|
h(Switch, { checked: options.enableBundles, label: "安装后直接启用(登记 bundle,重启后加载;默认关)", onChange: (v) => setOptions({ ...options, enableBundles: v }) }),
|
|
990
1297
|
h(Switch, { checked: options.force, label: "忽略阻断(我知道自己在干什么)", onChange: (v) => setOptions({ ...options, force: v }) })),
|
|
991
1298
|
h("div", { style: row },
|
|
992
1299
|
h("button", { style: btnPrimary, disabled: busy !== "" || (source.kind === "url" ? !source.url.trim() : !source.file), onClick: inspect }, busy === "inspect" ? "检测中…" : "检测这个包"),
|
|
993
|
-
source.kind === "file" && source.file ? h("span", { style: hint }, "选中:" + source.file) : null
|
|
1300
|
+
source.kind === "file" && source.file ? h("span", { style: hint }, "选中:" + source.file) : null,
|
|
1301
|
+
source.kind === "token" ? h("span", { style: hint }, "这份是导入到列表里的包,已经读过一遍;点上面的「选择」可以换另一份") : null)),
|
|
1302
|
+
progress
|
|
1303
|
+
? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
|
|
1304
|
+
h("div", { style: row },
|
|
1305
|
+
h("div", { style: strong }, "正在安装"),
|
|
1306
|
+
h("span", { style: hint }, (progress.note || "") + " " + Math.round(progress.pct || 0) + "%")),
|
|
1307
|
+
h(ProgressBar, { pct: progress.pct }))
|
|
1308
|
+
: null,
|
|
994
1309
|
error ? h(Notice, { tone: "bad" }, error) : null,
|
|
995
1310
|
preview ? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "10px" } },
|
|
996
1311
|
h("div", { style: row },
|
|
@@ -1012,6 +1327,16 @@ window.__ModuleLoader__.load({
|
|
|
1012
1327
|
h(Switch, { checked: options.dryRun, label: "只演练不落地", onChange: (v) => setOptions({ ...options, dryRun: v }) }),
|
|
1013
1328
|
h("button", { style: btnPrimary, disabled: busy !== "", onClick: install }, busy === "install" ? "安装中…" : (options.dryRun ? "演练一次" : "安装这个整合包"))))
|
|
1014
1329
|
: null,
|
|
1330
|
+
askReplace && deferred.length > 0
|
|
1331
|
+
? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
|
|
1332
|
+
h("div", { style: { ...label, color: "#ffb020" } }, "以下 " + deferred.length + " 个插件本机已经装了,这次先跳过没动它们:"),
|
|
1333
|
+
deferred.map((d) => h("div", { key: d.name, style: mono },
|
|
1334
|
+
"· " + d.name + " 本机 " + (d.localVersion || "未知") + " → 包内 " + (d.packVersion || "未知") + (d.sameVersion ? "(版本相同)" : ""))),
|
|
1335
|
+
h("div", { style: hint }, "要保留本机版本就直接完成;要换成包内版本点下面这个(会覆盖本机那份)。"),
|
|
1336
|
+
h("div", { style: row },
|
|
1337
|
+
h("button", { style: btn, disabled: busy !== "", onClick: () => { setAskReplace(false) } }, "直接完成(保留本机版本)"),
|
|
1338
|
+
h("button", { style: btnPrimary, disabled: busy !== "", onClick: () => replaceDeferred(deferred.map((d) => d.name)) }, "替换为包内版本(" + deferred.length + " 个)")))
|
|
1339
|
+
: null,
|
|
1015
1340
|
done ? h("div", { style: { ...box, display: "flex", flexDirection: "column", gap: "8px" } },
|
|
1016
1341
|
h("div", { style: row },
|
|
1017
1342
|
h("div", { style: strong }, done.ok ? "安装完成" : "没有装成"),
|
|
@@ -1026,6 +1351,33 @@ window.__ModuleLoader__.load({
|
|
|
1026
1351
|
}
|
|
1027
1352
|
|
|
1028
1353
|
// —— 设置与记录 ——
|
|
1354
|
+
const REPO_URL = "https://github.com/Vesna-Strivozha-cn/dsh-modpack-kit"
|
|
1355
|
+
|
|
1356
|
+
// 页脚:仓库地址 + 求星。放在页面与设置最底下,不抢功能的位置。
|
|
1357
|
+
function RepoFooter(props) {
|
|
1358
|
+
return h("div", {
|
|
1359
|
+
style: {
|
|
1360
|
+
marginTop: "6px",
|
|
1361
|
+
paddingTop: "12px",
|
|
1362
|
+
borderTop: "1px solid var(--dsw-alias-border-l2)",
|
|
1363
|
+
display: "flex",
|
|
1364
|
+
alignItems: "baseline",
|
|
1365
|
+
gap: "8px",
|
|
1366
|
+
flexWrap: "wrap",
|
|
1367
|
+
fontSize: "12px",
|
|
1368
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
1369
|
+
},
|
|
1370
|
+
},
|
|
1371
|
+
h("span", null, "项目地址:"),
|
|
1372
|
+
h("a", {
|
|
1373
|
+
href: REPO_URL,
|
|
1374
|
+
target: "_blank",
|
|
1375
|
+
rel: "noreferrer",
|
|
1376
|
+
style: { color: "var(--dsw-alias-label-primary)", textDecoration: "underline", textUnderlineOffset: "2px" },
|
|
1377
|
+
}, "github.com/Vesna-Strivozha-cn/dsh-modpack-kit"),
|
|
1378
|
+
h("span", null, "如果这个插件省了时间,顺手点个 Star,能让更多人找到它。"))
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1029
1381
|
function SettingsPanel(props) {
|
|
1030
1382
|
const [cfg, setCfg] = useState(props.status ? props.status.config : null)
|
|
1031
1383
|
const [saved, setSaved] = useState("")
|
|
@@ -1132,7 +1484,8 @@ window.__ModuleLoader__.load({
|
|
|
1132
1484
|
h("span", { style: label }, "自动更新(小时)"),
|
|
1133
1485
|
h("input", { style: { ...input, width: "78px" }, type: "number", min: "1", max: "168", value: cfg.catalogRefreshHours || 24, onChange: (e) => setField("catalogRefreshHours", Number(e.target.value)) }),
|
|
1134
1486
|
h("button", { style: btn, disabled: busy, onClick: () => patch({ catalogPageSize: cfg.catalogPageSize, catalogRefreshHours: cfg.catalogRefreshHours }) }, "保存目录设置")),
|
|
1135
|
-
h("div", { style: hint }, "目录就是插件市场自己发布的那份 dsh-plugin-catalog:CDN 优先,失败退回 npm 包。分类与词条都照它来,本插件不另造一套。")
|
|
1487
|
+
h("div", { style: hint }, "目录就是插件市场自己发布的那份 dsh-plugin-catalog:CDN 优先,失败退回 npm 包。分类与词条都照它来,本插件不另造一套。"),
|
|
1488
|
+
h(RepoFooter, null))
|
|
1136
1489
|
)
|
|
1137
1490
|
}
|
|
1138
1491
|
|
|
@@ -1171,7 +1524,9 @@ window.__ModuleLoader__.load({
|
|
|
1171
1524
|
},
|
|
1172
1525
|
}, text)
|
|
1173
1526
|
|
|
1174
|
-
return h("div", {
|
|
1527
|
+
return h("div", {
|
|
1528
|
+
style: { height: "100%", overflow: "auto", boxSizing: "border-box", padding: "22px 26px 44px", color: "var(--dsw-alias-label-primary)", position: "relative" },
|
|
1529
|
+
},
|
|
1175
1530
|
h("div", { style: { maxWidth: "1020px", margin: "0 auto", display: "flex", flexDirection: "column", gap: "14px" } },
|
|
1176
1531
|
h("div", { style: { display: "flex", alignItems: "baseline", gap: "10px", flexWrap: "wrap" } },
|
|
1177
1532
|
h("h2", { style: { margin: 0, fontSize: "20px", fontWeight: 600 } }, "整合包"),
|
|
@@ -1182,7 +1537,8 @@ window.__ModuleLoader__.load({
|
|
|
1182
1537
|
tab === "pack" ? h(PackPanel, { status, jobs, result: packResult, setResult: savePackResult, focus }) : null,
|
|
1183
1538
|
tab === "install" ? h(InstallPanel, { status }) : null,
|
|
1184
1539
|
tab === "settings" ? h(SettingsPanel, { status }) : null,
|
|
1185
|
-
h("div", { style: hint }, "说明:整合包只打包你选择的插件与必要配置。打包与安装安全检测在内存中进行,命中原文不落盘;请遵守插件作者许可证与你所在地区的法律法规。")
|
|
1540
|
+
h("div", { style: hint }, "说明:整合包只打包你选择的插件与必要配置。打包与安装安全检测在内存中进行,命中原文不落盘;请遵守插件作者许可证与你所在地区的法律法规。"),
|
|
1541
|
+
h(RepoFooter, null)),
|
|
1186
1542
|
h(JobDock, { jobs, onOpenResult: openResult })
|
|
1187
1543
|
)
|
|
1188
1544
|
}
|
|
@@ -1257,6 +1613,13 @@ window.__ModuleLoader__.load({
|
|
|
1257
1613
|
else for (const item of items) unmount(group + ":" + item.slot)
|
|
1258
1614
|
}
|
|
1259
1615
|
}
|
|
1616
|
+
try {
|
|
1617
|
+
const workspace = ctx.get('uiWorkspace')
|
|
1618
|
+
if (workspace && typeof workspace.pickDirectory === "function") {
|
|
1619
|
+
pickDirectoryHost = () => workspace.pickDirectory()
|
|
1620
|
+
}
|
|
1621
|
+
} catch {}
|
|
1622
|
+
|
|
1260
1623
|
ctx.effect(() => {
|
|
1261
1624
|
const unsubscribe = subscribePlacement(sync)
|
|
1262
1625
|
sync(placement.value)
|