pinokiod 8.0.56 → 8.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "8.0.56",
3
+ "version": "8.0.57",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -1993,6 +1993,19 @@ class Server {
1993
1993
  const vault = this.kernel.vault
1994
1994
  if (vault && vault.ready) await vault.ready
1995
1995
  result.vault_enabled = !!(vault && vault.enabled)
1996
+ result.vault_automatic_mode = "automatic"
1997
+ if (result.vault_enabled) {
1998
+ try {
1999
+ const snapshot = await vault.automaticScanStatus()
2000
+ const setting = Array.isArray(snapshot && snapshot.settings)
2001
+ ? snapshot.settings.find((item) =>
2002
+ item && item.app === name)
2003
+ : null
2004
+ result.vault_automatic_mode = setting && setting.mode === "manual"
2005
+ ? "manual"
2006
+ : "automatic"
2007
+ } catch (_) {}
2008
+ }
1996
2009
  if (!registryEnabled) {
1997
2010
  result.pendingSnapshotId = null
1998
2011
  }
@@ -0,0 +1,37 @@
1
+ (() => {
2
+ const status = document.querySelector("[data-app-vault-mode]")
3
+ if (!status) return
4
+
5
+ const app = status.dataset.app || ""
6
+ const tab = status.closest("#save-space-tab")
7
+ const label = status.querySelector("[data-app-vault-mode-label]")
8
+ const setMode = (value) => {
9
+ const mode = value === "manual" ? "manual" : "automatic"
10
+ status.dataset.mode = mode
11
+ status.hidden = false
12
+ if (label) label.textContent = mode === "automatic" ? "Auto" : "Manual"
13
+ if (tab) {
14
+ tab.setAttribute("aria-label",
15
+ `Disk Saver — ${mode === "automatic" ? "Automatic" : "Manual"} checking`)
16
+ }
17
+ }
18
+ const applySnapshot = (snapshot) => {
19
+ const settings = snapshot && Array.isArray(snapshot.settings)
20
+ ? snapshot.settings
21
+ : []
22
+ const setting = settings.find((item) => item && item.app === app)
23
+ setMode(setting && setting.mode)
24
+ }
25
+
26
+ setMode(status.dataset.mode)
27
+ if (!app || typeof window.EventSource !== "function") return
28
+
29
+ const source = new window.EventSource(
30
+ "/info/vault/automatic-scans/events")
31
+ source.onmessage = (event) => {
32
+ try {
33
+ applySnapshot(JSON.parse(event.data))
34
+ } catch (_) {}
35
+ }
36
+ window.addEventListener("beforeunload", () => source.close(), { once: true })
37
+ })()
@@ -2274,8 +2274,8 @@ const renderOverview = () => {
2274
2274
  : activeScan
2275
2275
  ? `<i class="fa-solid fa-circle-notch fa-spin"></i>${esc(COPY.scanning)}`
2276
2276
  : `<i class="fa-solid fa-rotate"></i>${esc(idleScanLabel)}`
2277
- const firstGlobalScan = !IS_APP_MODE && !last && !activeScan
2278
- scanButton.classList.toggle("primary", firstGlobalScan)
2277
+ const firstScan = !last && !activeScan
2278
+ scanButton.classList.toggle("primary", firstScan)
2279
2279
  scanButton.disabled = busyElsewhere || state.scanCancelRequested
2280
2280
  if (state.automaticReviewRequested && !activeScan &&
2281
2281
  !scanButton.disabled) {
@@ -2296,7 +2296,7 @@ const renderOverview = () => {
2296
2296
  if (scanSizeMenu) {
2297
2297
  const scanSizeTrigger = scanSizeMenu.querySelector("summary")
2298
2298
  if (scanSizeTrigger) {
2299
- scanSizeTrigger.classList.toggle("primary", firstGlobalScan)
2299
+ scanSizeTrigger.classList.toggle("primary", firstScan)
2300
2300
  }
2301
2301
  scanSizeMenu.hidden = activeScan
2302
2302
  if (activeScan) scanSizeMenu.open = false
@@ -4102,6 +4102,48 @@ body.dark .disk-usage {
4102
4102
  flex: 0 0 auto;
4103
4103
  min-width: 0;
4104
4104
  }
4105
+ .appcanvas.vertical > aside .menu-actions #save-space-tab {
4106
+ width: 100%;
4107
+ max-width: none;
4108
+ box-sizing: border-box;
4109
+ }
4110
+ .app-vault-mode {
4111
+ flex: 0 0 auto;
4112
+ margin-left: auto;
4113
+ color: rgba(71, 85, 105, 0.82);
4114
+ font-size: 12px;
4115
+ font-weight: 500;
4116
+ letter-spacing: 0;
4117
+ line-height: 1.2;
4118
+ text-align: right;
4119
+ white-space: nowrap;
4120
+ }
4121
+ .app-vault-mode[data-mode="automatic"] {
4122
+ color: #b45309;
4123
+ }
4124
+ body.dark .app-vault-mode {
4125
+ color: rgba(203, 213, 225, 0.74);
4126
+ }
4127
+ body.dark .app-vault-mode[data-mode="automatic"] {
4128
+ color: #e0a54b;
4129
+ }
4130
+ .app-vault-mode-chevron,
4131
+ .app-autolaunch-chevron {
4132
+ display: inline-flex;
4133
+ align-items: center;
4134
+ justify-content: center;
4135
+ width: 10px;
4136
+ flex: 0 0 10px;
4137
+ margin-right: 0;
4138
+ padding: 0;
4139
+ color: var(--pinokio-sidebar-action-muted);
4140
+ font-size: 10px;
4141
+ line-height: 1;
4142
+ box-sizing: border-box;
4143
+ }
4144
+ .appcanvas > aside .menu-actions .header-item .tab .app-vault-mode-chevron {
4145
+ margin-right: 0;
4146
+ }
4105
4147
  .app-autolaunch-row {
4106
4148
  appearance: none;
4107
4149
  display: flex;
@@ -4171,19 +4213,14 @@ body.dark .disk-usage {
4171
4213
  .app-autolaunch-status {
4172
4214
  flex: 0 0 auto;
4173
4215
  color: var(--pinokio-sidebar-action-muted);
4174
- font-size: 11px;
4175
- font-weight: 700;
4176
- letter-spacing: 0.02em;
4216
+ font-size: 12px;
4217
+ font-weight: 500;
4218
+ letter-spacing: 0;
4177
4219
  white-space: nowrap;
4178
4220
  }
4179
4221
  .app-autolaunch-row[data-enabled="true"] .app-autolaunch-status {
4180
4222
  color: rgba(22, 101, 52, 0.95);
4181
4223
  }
4182
- .app-autolaunch-chevron {
4183
- flex: 0 0 auto;
4184
- color: var(--pinokio-sidebar-action-muted);
4185
- font-size: 10px;
4186
- }
4187
4224
  body.dark .app-autolaunch-row {
4188
4225
  background: transparent;
4189
4226
  color: var(--pinokio-sidebar-tab-muted);
@@ -4193,6 +4230,7 @@ body.dark .app-autolaunch.open .app-autolaunch-row {
4193
4230
  background: var(--pinokio-sidebar-tab-hover);
4194
4231
  color: var(--pinokio-sidebar-tab-active-color);
4195
4232
  }
4233
+ body.dark .app-vault-mode-chevron,
4196
4234
  body.dark .app-autolaunch-status,
4197
4235
  body.dark .app-autolaunch-chevron {
4198
4236
  color: var(--pinokio-sidebar-action-muted);
@@ -8163,6 +8201,7 @@ body.dark .pinokio-custom-terminal-header {
8163
8201
  <script src="/tippy-bundle.umd.min.js"></script>
8164
8202
  <script src="/tab-link-popover.js"></script>
8165
8203
  <script src="/browser-popout-surface.js"></script>
8204
+ <script src="/app-vault-mode.js" defer></script>
8166
8205
  <script>
8167
8206
  (function() {
8168
8207
  try {
@@ -8461,11 +8500,16 @@ body.dark .pinokio-custom-terminal-header {
8461
8500
  </div>
8462
8501
  </button>
8463
8502
  <% if (typeof vault_enabled !== 'undefined' && vault_enabled) { %>
8464
- <a id='save-space-tab' data-mode="refresh" target="app-vault" href="/vault/app/<%=encodeURIComponent(name)%>" class="btn header-item frame-link" data-index="vault" data-static="retain" data-tab-link-popover="false">
8503
+ <% const vaultAutomaticMode = typeof vault_automatic_mode === 'string' && vault_automatic_mode === 'manual' ? 'manual' : 'automatic' %>
8504
+ <a id='save-space-tab' data-mode="refresh" target="app-vault" href="/vault/app/<%=encodeURIComponent(name)%>" class="btn header-item frame-link" data-index="vault" data-static="retain" data-tab-link-popover="false" aria-label="Disk Saver — <%=vaultAutomaticMode === 'automatic' ? 'Automatic' : 'Manual'%> checking">
8465
8505
  <div class='tab'>
8466
8506
  <i class="fa-solid fa-hard-drive menu-action-leading-icon"></i>
8467
8507
  <div class='display'>Disk Saver</div>
8468
8508
  <div class='flexible'></div>
8509
+ <span class="app-vault-mode" data-app-vault-mode data-app="<%=name%>" data-mode="<%=vaultAutomaticMode%>" aria-hidden="true">
8510
+ <span data-app-vault-mode-label><%=vaultAutomaticMode === 'automatic' ? 'Auto' : 'Manual'%></span>
8511
+ </span>
8512
+ <i class="fa-solid fa-angle-down app-vault-mode-chevron" aria-hidden="true"></i>
8469
8513
  </div>
8470
8514
  </a>
8471
8515
  <% } %>
@@ -8474,7 +8518,7 @@ body.dark .pinokio-custom-terminal-header {
8474
8518
  <button type="button" class="app-autolaunch-row" data-app-autolaunch-button data-enabled="<%= autolaunch_app.autolaunch_enabled ? 'true' : 'false' %>" aria-haspopup="dialog" aria-expanded="false">
8475
8519
  <span class="app-autolaunch-label"><i class="fa-solid fa-power-off"></i><span>Autolaunch</span></span>
8476
8520
  <span class="app-autolaunch-spacer" aria-hidden="true"></span>
8477
- <span class="app-autolaunch-status" data-app-autolaunch-status><%= autolaunch_app.autolaunch_enabled ? 'ON' : 'OFF' %></span>
8521
+ <span class="app-autolaunch-status" data-app-autolaunch-status><%= autolaunch_app.autolaunch_enabled ? 'On' : 'Off' %></span>
8478
8522
  <i class="fa-solid fa-angle-down app-autolaunch-chevron" aria-hidden="true"></i>
8479
8523
  </button>
8480
8524
  <div class="app-autolaunch-modal hidden" data-app-autolaunch-modal role="dialog" aria-modal="true" aria-label="Autolaunch">
@@ -169,7 +169,7 @@
169
169
  }
170
170
  const renderStatus = () => {
171
171
  const enabled = !!(state && state.autolaunch_enabled)
172
- status.textContent = enabled ? "ON" : "OFF"
172
+ status.textContent = enabled ? "On" : "Off"
173
173
  button.dataset.enabled = enabled ? "true" : "false"
174
174
  button.setAttribute("aria-label", `Autolaunch. Start with Pinokio ${enabled ? "On" : "Off"}`)
175
175
  switchButton.setAttribute("aria-checked", enabled ? "true" : "false")
@@ -122,7 +122,7 @@ function appAutolaunchMarkup(initialApp) {
122
122
  <div class="app-autolaunch" data-app-autolaunch data-app-id="target">
123
123
  <button type="button" class="app-autolaunch-row" data-app-autolaunch-button data-enabled="${initialApp.autolaunch_enabled ? "true" : "false"}" aria-haspopup="dialog" aria-expanded="false">
124
124
  <span class="app-autolaunch-label">Autolaunch</span>
125
- <span class="app-autolaunch-status" data-app-autolaunch-status>${initialApp.autolaunch_enabled ? "ON" : "OFF"}</span>
125
+ <span class="app-autolaunch-status" data-app-autolaunch-status>${initialApp.autolaunch_enabled ? "On" : "Off"}</span>
126
126
  </button>
127
127
  <div class="app-autolaunch-modal hidden" data-app-autolaunch-modal role="dialog" aria-modal="true" aria-label="Autolaunch">
128
128
  <button type="button" class="app-autolaunch-switch" role="switch" aria-checked="${initialApp.autolaunch_enabled ? "true" : "false"}" data-app-autolaunch-switch aria-label="Start with Pinokio">
@@ -478,7 +478,7 @@ browserTest("browser: selecting a launch script from empty state persists and st
478
478
  enabled: false
479
479
  })
480
480
  assert.equal(await page.isChecked('input[name="app-autolaunch-script"][value="start.js"]'), true)
481
- assert.equal((await textContent(page, "[data-app-autolaunch-status]")).trim(), "OFF")
481
+ assert.equal((await textContent(page, "[data-app-autolaunch-status]")).trim(), "Off")
482
482
  })
483
483
  })
484
484
 
@@ -532,7 +532,7 @@ browserTest("browser: startup toggle from empty selection saves the single eligi
532
532
  })
533
533
  assert.equal(state.launchRequirementsGets, 0)
534
534
  assert.equal(await page.isChecked('input[name="app-autolaunch-script"][value="start.js"]'), true)
535
- assert.equal((await textContent(page, "[data-app-autolaunch-status]")).trim(), "ON")
535
+ assert.equal((await textContent(page, "[data-app-autolaunch-status]")).trim(), "On")
536
536
  })
537
537
  })
538
538
 
@@ -570,7 +570,7 @@ browserTest("browser: startup toggle from empty selection warns when no eligible
570
570
  })
571
571
 
572
572
  assert.equal(state.autolaunchPosts.length, 0, scenario.name)
573
- assert.equal((await textContent(page, "[data-app-autolaunch-status]")).trim(), "OFF")
573
+ assert.equal((await textContent(page, "[data-app-autolaunch-status]")).trim(), "Off")
574
574
  })
575
575
  }
576
576
  })
@@ -290,3 +290,80 @@ test("the app workspace focuses Scan this app without starting it after Review",
290
290
  assert.doesNotMatch(source,
291
291
  /automaticReviewRequested[\s\S]{0,200}(post\(|btn-scan\.click)/)
292
292
  })
293
+
294
+ test("the app sidebar mirrors Automatic and Manual Disk Saver modes", async () => {
295
+ const template = await fs.promises.readFile(
296
+ path.join(root, "server", "views", "app.ejs"), "utf8")
297
+ const server = await fs.promises.readFile(
298
+ path.join(root, "server", "index.js"), "utf8")
299
+ const script = await fs.promises.readFile(
300
+ path.join(root, "server", "public", "app-vault-mode.js"), "utf8")
301
+ const dom = new JSDOM(`<a id="save-space-tab">
302
+ <span data-app-vault-mode data-app="ComfyUI" data-mode="automatic">
303
+ <span data-app-vault-mode-label>Auto</span>
304
+ </span>
305
+ </a>`, {
306
+ runScripts: "outside-only",
307
+ url: "http://localhost/v/ComfyUI"
308
+ })
309
+ const eventSources = []
310
+ dom.window.EventSource = class EventSource {
311
+ constructor(url) {
312
+ this.url = url
313
+ eventSources.push(this)
314
+ }
315
+ close() {}
316
+ }
317
+
318
+ dom.window.eval(script)
319
+ const status = dom.window.document.querySelector("[data-app-vault-mode]")
320
+ const label = status.querySelector("[data-app-vault-mode-label]")
321
+ assert.equal(eventSources.length, 1)
322
+ assert.equal(eventSources[0].url,
323
+ "/info/vault/automatic-scans/events")
324
+ assert.equal(status.dataset.mode, "automatic")
325
+ assert.equal(status.hidden, false)
326
+ assert.equal(label.textContent, "Auto")
327
+ assert.equal(dom.window.document.getElementById("save-space-tab")
328
+ .getAttribute("aria-label"), "Disk Saver — Automatic checking")
329
+
330
+ eventSources[0].onmessage({
331
+ data: JSON.stringify({
332
+ settings: [{ app: "ComfyUI", mode: "manual" }]
333
+ })
334
+ })
335
+ assert.equal(status.dataset.mode, "manual")
336
+ assert.equal(status.hidden, false)
337
+ assert.equal(label.textContent, "Manual")
338
+ assert.equal(dom.window.document.getElementById("save-space-tab")
339
+ .getAttribute("aria-label"), "Disk Saver — Manual checking")
340
+
341
+ eventSources[0].onmessage({ data: JSON.stringify({ settings: [] }) })
342
+ assert.equal(status.dataset.mode, "automatic")
343
+ assert.equal(status.hidden, false)
344
+ assert.equal(label.textContent, "Auto")
345
+ assert.match(template, /data-app-vault-mode/)
346
+ assert.match(template, /app-vault-mode\.js/)
347
+ assert.match(template,
348
+ /#save-space-tab\s*\{[^}]*width:\s*100%;[^}]*max-width:\s*none;/s)
349
+ assert.match(template,
350
+ /\.app-vault-mode\s*\{[^}]*margin-left:\s*auto;[^}]*font-size:\s*12px;[^}]*font-weight:\s*500;/s)
351
+ assert.match(template,
352
+ /\.app-vault-mode-chevron,\s*\.app-autolaunch-chevron\s*\{[^}]*width:\s*10px;[^}]*flex:\s*0 0 10px;/s)
353
+ assert.doesNotMatch(template,
354
+ /\.app-vault-mode\s*\{[^}]*(background|border-radius|padding):/s)
355
+ assert.match(template,
356
+ /vaultAutomaticMode === 'automatic' \? 'Auto' : 'Manual'/)
357
+ assert.match(template,
358
+ /fa-solid fa-angle-down app-vault-mode-chevron/)
359
+ assert.match(template,
360
+ /autolaunch_app\.autolaunch_enabled \? 'On' : 'Off'/)
361
+ assert.match(template,
362
+ /\.app-autolaunch-status\s*\{[^}]*font-size:\s*12px;[^}]*font-weight:\s*500;[^}]*letter-spacing:\s*0;/s)
363
+ assert.doesNotMatch(template, /data-app-vault-mode[^>]*hidden/)
364
+ assert.doesNotMatch(template, /app-vault-mode-dot/)
365
+ assert.match(server,
366
+ /result\.vault_automatic_mode = setting && setting\.mode === "manual"/)
367
+
368
+ dom.window.close()
369
+ })
@@ -2184,6 +2184,26 @@ describe("Save Space interface", () => {
2184
2184
  dom.window.close()
2185
2185
  })
2186
2186
 
2187
+ test("a fresh app workspace makes Scan this app primary", async () => {
2188
+ const status = fixture([], {
2189
+ last_scan: null,
2190
+ bytes_without_sharing: 0,
2191
+ bytes_on_disk: 0,
2192
+ saved_by_sharing: 0,
2193
+ effective_bytes: 0
2194
+ })
2195
+ const { dom } = await makePage(status, {
2196
+ appMode: true,
2197
+ scopeId: "app:app"
2198
+ })
2199
+ const scanButton = dom.window.document.getElementById("btn-scan")
2200
+
2201
+ assert.match(scanButton.textContent, /Scan this app/)
2202
+ assert.equal(scanButton.classList.contains("primary"), true)
2203
+
2204
+ dom.window.close()
2205
+ })
2206
+
2187
2207
  test("app mode uses full-width results without redundant locations", async () => {
2188
2208
  const status = fixture([item()])
2189
2209
  const { dom, requests } = await makePage(status, {