pinokiod 8.0.37 → 8.0.38
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/kernel/vault/index.js +238 -69
- package/kernel/vault/registry.js +2 -2
- package/kernel/vault/sweeper.js +70 -25
- package/package.json +1 -1
- package/server/index.js +22 -0
- package/server/views/vault.ejs +404 -196
- package/test/vault-engine.test.js +96 -9
- package/test/vault-sweep.test.js +53 -0
- package/test/vault-ui.test.js +85 -0
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -15740,6 +15740,10 @@ class Server {
|
|
|
15740
15740
|
res.json({ enabled: false })
|
|
15741
15741
|
return
|
|
15742
15742
|
}
|
|
15743
|
+
if (req.query && req.query.progress === "1") {
|
|
15744
|
+
res.json(vault.progressStatus())
|
|
15745
|
+
return
|
|
15746
|
+
}
|
|
15743
15747
|
res.json(await vault.status())
|
|
15744
15748
|
}))
|
|
15745
15749
|
this.app.get("/vault", ex(async (req, res) => {
|
|
@@ -15754,6 +15758,19 @@ class Server {
|
|
|
15754
15758
|
const body = req.body || {}
|
|
15755
15759
|
try {
|
|
15756
15760
|
switch (body.action) {
|
|
15761
|
+
case "add_source": {
|
|
15762
|
+
const result = await vault.addExternalSource(body.path)
|
|
15763
|
+
res.json({
|
|
15764
|
+
created: result.created,
|
|
15765
|
+
source: {
|
|
15766
|
+
id: result.source.id,
|
|
15767
|
+
label: result.source.label,
|
|
15768
|
+
target_path: result.source.root,
|
|
15769
|
+
shareable: !!result.source.shareable
|
|
15770
|
+
}
|
|
15771
|
+
})
|
|
15772
|
+
return
|
|
15773
|
+
}
|
|
15757
15774
|
case "deduplicate": {
|
|
15758
15775
|
const scopeId = typeof body.scope_id === "string" ? body.scope_id : null
|
|
15759
15776
|
if (scopeId) {
|
|
@@ -15803,7 +15820,12 @@ class Server {
|
|
|
15803
15820
|
vault.sweeper.scan().catch(() => {})
|
|
15804
15821
|
res.json({ started: true })
|
|
15805
15822
|
return
|
|
15823
|
+
case "repair":
|
|
15806
15824
|
case "rebuild":
|
|
15825
|
+
if (vault.sweeper && vault.sweeper.state.active) {
|
|
15826
|
+
res.json({ error: "Wait for the current scan to finish before repairing the index." })
|
|
15827
|
+
return
|
|
15828
|
+
}
|
|
15807
15829
|
await vault.rebuild()
|
|
15808
15830
|
res.json({ done: true })
|
|
15809
15831
|
return
|