pinokiod 8.0.60 → 8.0.61

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.
@@ -10,7 +10,7 @@ const {
10
10
  } = require("./operation_errors")
11
11
 
12
12
  const COMPLETE_PHASES = new Set(["complete", "completed_with_exclusions"])
13
- const STOP_SETTLE_MS = 3000
13
+ const STOP_SETTLE_MS = 1000
14
14
  const PROGRESS_INTERVAL_MS = 5000
15
15
  const isMissing = (error) => !!(error &&
16
16
  (error.code === "ENOENT" || error.code === "ENOTDIR"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "8.0.60",
3
+ "version": "8.0.61",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -105,7 +105,7 @@ const COPY = {
105
105
  never: "Never",
106
106
  scan: "Scan",
107
107
  scan_app: "Scan this app",
108
- scan_all_locations: "Scan all locations",
108
+ setup_disk_saver: "Set up Disk Saver",
109
109
  setup_title: "Run an initial scan to enable app scans",
110
110
  setup_description: "This creates the file index used to compare apps and enables automatic checks.",
111
111
  scan_again: "Scan again",
@@ -537,12 +537,7 @@ const post = async (payload) => {
537
537
  return result
538
538
  }
539
539
  const openGlobalWorkspace = () => {
540
- if (window.parent === window) {
541
- window.location.assign("/vault")
542
- return
543
- }
544
- window.parent.postMessage(
545
- { e: "vault-open-global" }, window.location.origin)
540
+ window.parent.location.assign("/vault")
546
541
  }
547
542
  let automaticModeEventSource = null
548
543
  const applyAutomaticScanSnapshot = (snapshot) => {
@@ -2229,9 +2224,9 @@ const renderSetupOverview = () => {
2229
2224
  restoreAutomaticModeMenu(modeMenuOpen)
2230
2225
 
2231
2226
  const scanButton = el("btn-scan")
2232
- scanButton.innerHTML = `<i class="fa-solid fa-rotate"></i>${esc(COPY.scan_all_locations)}`
2227
+ scanButton.innerHTML = `<i class="fa-solid fa-arrow-right" aria-hidden="true"></i>${esc(COPY.setup_disk_saver)}`
2233
2228
  scanButton.classList.add("primary")
2234
- scanButton.disabled = state.scanCancelRequested
2229
+ scanButton.disabled = false
2235
2230
  const candidateSizeSelect = el("vault-candidate-size")
2236
2231
  if (candidateSizeSelect) candidateSizeSelect.hidden = true
2237
2232
  const scanState = el("vault-scan-state")
@@ -3643,25 +3638,7 @@ document.addEventListener("click", async (event) => {
3643
3638
  return
3644
3639
  }
3645
3640
  if (appSetupRequired()) {
3646
- target.disabled = true
3647
- state.feedback = null
3648
- renderFeedback()
3649
- try {
3650
- const result = await post({
3651
- action: "scan",
3652
- scope_id: null,
3653
- candidate_size: candidateSize()
3654
- })
3655
- if (result.error) throw new Error(result.error)
3656
- openGlobalWorkspace()
3657
- } catch (error) {
3658
- target.disabled = false
3659
- state.feedback = {
3660
- error: true,
3661
- message: error && error.message ? error.message : String(error)
3662
- }
3663
- renderFeedback()
3664
- }
3641
+ openGlobalWorkspace()
3665
3642
  return
3666
3643
  }
3667
3644
  state.scanRequested = true
@@ -12907,13 +12907,6 @@ const rerenderMenuSection = (container, html) => {
12907
12907
  await renderSelection({ target: diskSaverTab, force: true })
12908
12908
  openVaultAutomaticSettings()
12909
12909
  })
12910
- window.addEventListener("message", (event) => {
12911
- const frame = document.querySelector("iframe[name='app-vault']")
12912
- if (!frame || event.source !== frame.contentWindow ||
12913
- event.origin !== window.location.origin ||
12914
- !event.data || event.data.e !== "vault-open-global") return
12915
- window.location.assign("/vault")
12916
- })
12917
12910
  if (window.parent !== window) {
12918
12911
  window.parent.postMessage(
12919
12912
  { e: "vault-auto-settings-ready" }, window.location.origin)
@@ -102,6 +102,10 @@ describe("automatic app checks", () => {
102
102
  assert.deepEqual(automatic.snapshot().rows, [])
103
103
  })
104
104
 
105
+ test("automatic checks wait one second after an app stops", () => {
106
+ assert.equal(AutomaticScans.STOP_SETTLE_MS, 1000)
107
+ })
108
+
105
109
  test("disabled Vault ignores app-stop events", async () => {
106
110
  const home = await makeHome()
107
111
  const appRoot = path.join(home, "api", "disabled-app")
@@ -3,7 +3,7 @@ const assert = require("node:assert/strict")
3
3
  const fs = require("node:fs")
4
4
  const path = require("node:path")
5
5
  const ejs = require("ejs")
6
- const { JSDOM, VirtualConsole } = require("jsdom")
6
+ const { JSDOM } = require("jsdom")
7
7
 
8
8
  const root = path.resolve(__dirname, "..")
9
9
  const publicRoot = path.join(root, "server", "public")
@@ -153,24 +153,17 @@ const makePage = async (status, options = {}) => {
153
153
  const workspace = ejs.render(await source(workspacePath), {
154
154
  appMode
155
155
  })
156
- const navigationErrors = []
157
- const virtualConsole = options.captureNavigation
158
- ? new VirtualConsole().on("jsdomError", (error) => {
159
- navigationErrors.push(error)
160
- })
161
- : undefined
162
156
  const dom = new JSDOM(
163
157
  `<body data-platform="${process.platform}" data-agent="electron" data-vault-mode="${appMode ? "app" : "global"}" data-vault-scope="${scopeId}" data-vault-app="${appMode ? "app" : ""}" data-vault-home="${homePath}">${workspace}</body>`,
164
158
  {
165
159
  runScripts: "outside-only",
166
- virtualConsole,
167
160
  url: appMode
168
161
  ? "http://localhost/vault/app/app"
169
162
  : "http://localhost/vault"
170
163
  }
171
164
  )
172
165
  const requests = []
173
- const parentMessages = []
166
+ const parentNavigations = []
174
167
  const selectedSources = new Set(options.folderDiscoverySelected || [])
175
168
  const recommendedSources = new Set()
176
169
  const confirmations = []
@@ -262,8 +255,10 @@ const makePage = async (status, options = {}) => {
262
255
  Object.defineProperty(dom.window, "parent", {
263
256
  configurable: true,
264
257
  value: {
265
- postMessage(message, targetOrigin) {
266
- parentMessages.push({ message, targetOrigin })
258
+ location: {
259
+ assign(target) {
260
+ parentNavigations.push(target)
261
+ }
267
262
  }
268
263
  }
269
264
  })
@@ -418,8 +413,7 @@ const makePage = async (status, options = {}) => {
418
413
  return {
419
414
  dom,
420
415
  requests,
421
- parentMessages,
422
- navigationErrors,
416
+ parentNavigations,
423
417
  confirmations,
424
418
  pickerRequests,
425
419
  choosePickedPath,
@@ -466,7 +460,8 @@ describe("Save Space interface", () => {
466
460
  assert.doesNotMatch(combined, /Previous completed results were kept\./)
467
461
  assert.match(combined, /Scan completed with exclusions/)
468
462
  assert.match(combined, /Provisional until the scan completes/)
469
- assert.match(combined, /Scan all locations/)
463
+ assert.match(combined, /Set up Disk Saver/)
464
+ assert.doesNotMatch(combined, /Scan all locations/)
470
465
  assert.match(combined, /data-find-home-folder/)
471
466
  assert.match(combined, /data-find-other-folder/)
472
467
  assert.doesNotMatch(combined,
@@ -2226,7 +2221,7 @@ describe("Save Space interface", () => {
2226
2221
  dom.window.close()
2227
2222
  })
2228
2223
 
2229
- test("an app without a global baseline shows setup and starts a global scan", async () => {
2224
+ test("an app without a global baseline shows setup and opens global Disk Saver", async () => {
2230
2225
  const status = fixture([], {
2231
2226
  global_scan_ready: false,
2232
2227
  last_scan: null,
@@ -2234,12 +2229,11 @@ describe("Save Space interface", () => {
2234
2229
  saved_by_sharing: 0,
2235
2230
  pending_bytes: 0
2236
2231
  })
2237
- const { dom, requests, parentMessages } = await makePage(status, {
2232
+ const { dom, requests, parentNavigations } = await makePage(status, {
2238
2233
  appMode: true,
2239
2234
  embeddedApp: true,
2240
2235
  scopeId: "app:app",
2241
2236
  actionResults: {
2242
- scan: { started: true },
2243
2237
  automatic_set_mode: { app: "app", mode: "manual" }
2244
2238
  }
2245
2239
  })
@@ -2250,7 +2244,7 @@ describe("Save Space interface", () => {
2250
2244
  /Run an initial scan to enable app scans/)
2251
2245
  assert.match(document.querySelector(".vault-setup-copy").textContent,
2252
2246
  /creates the file index used to compare apps/)
2253
- assert.match(scanButton.textContent, /Scan all locations/)
2247
+ assert.match(scanButton.textContent, /Set up Disk Saver/)
2254
2248
  assert.equal(scanButton.classList.contains("primary"), true)
2255
2249
  assert.equal(document.getElementById("vault-candidate-size").hidden, true)
2256
2250
  assert.equal(document.getElementById("vault-explorer").style.display,
@@ -2271,45 +2265,8 @@ describe("Save Space interface", () => {
2271
2265
  "none")
2272
2266
 
2273
2267
  scanButton.click()
2274
- await waitFor(() => requests.some((request) =>
2275
- request.action === "scan"))
2276
- assert.deepEqual(requests.find((request) => request.action === "scan"), {
2277
- action: "scan",
2278
- scope_id: null,
2279
- candidate_size: 100 * (process.platform === "win32" ? 1024 : 1000) ** 2
2280
- })
2281
- await waitFor(() => parentMessages.length === 1)
2282
- assert.equal(parentMessages[0].message.e, "vault-open-global")
2283
- assert.equal(parentMessages[0].targetOrigin, "http://localhost")
2284
-
2285
- dom.window.close()
2286
- })
2287
-
2288
- test("app setup navigates to global Disk Saver when standalone", async () => {
2289
- const status = fixture([], {
2290
- global_scan_ready: false,
2291
- last_scan: null
2292
- })
2293
- const { dom, requests, navigationErrors } = await makePage(status, {
2294
- appMode: true,
2295
- captureNavigation: true,
2296
- scopeId: "app:app",
2297
- actionResults: { scan: { started: true } }
2298
- })
2299
-
2300
- dom.window.document.getElementById("btn-scan").click()
2301
- await waitFor(() => requests.some((request) =>
2302
- request.action === "scan"))
2303
- await waitFor(() => navigationErrors.length > 0)
2304
-
2305
- assert.deepEqual(requests.find((request) => request.action === "scan"), {
2306
- action: "scan",
2307
- scope_id: null,
2308
- candidate_size: 100 *
2309
- (process.platform === "win32" ? 1024 : 1000) ** 2
2310
- })
2311
- assert.match(navigationErrors[0].message,
2312
- /Not implemented: navigation/)
2268
+ assert.deepEqual(parentNavigations, ["/vault"])
2269
+ assert.equal(requests.some((request) => request.action === "scan"), false)
2313
2270
 
2314
2271
  dom.window.close()
2315
2272
  })