pinokiod 8.0.14 → 8.0.15

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.14",
3
+ "version": "8.0.15",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -16619,7 +16619,6 @@ class Server {
16619
16619
  this.app.post("/pinokio/install", ex((req, res) => {
16620
16620
  req.session.requirements = req.body.requirements
16621
16621
  req.session.callback = req.body.callback
16622
- req.session.fresh = req.body.fresh === "1"
16623
16622
  res.redirect("/pinokio/install")
16624
16623
  }))
16625
16624
  this.app.post("/pinokio/install/validate", ex(async (req, res) => {
@@ -16631,10 +16630,8 @@ class Server {
16631
16630
  res.set("Cache-Control", "no-store")
16632
16631
  let requirements = req.session.requirements
16633
16632
  let callback = req.session.callback
16634
- let fresh = req.session.fresh === true
16635
16633
  req.session.requirements = null
16636
16634
  req.session.callback = null
16637
- req.session.fresh = null
16638
16635
  res.render("install", {
16639
16636
  logo: this.logo,
16640
16637
  theme: this.theme,
@@ -16643,8 +16640,7 @@ class Server {
16643
16640
  display: ["form"],
16644
16641
  // query: req.query,
16645
16642
  requirements,
16646
- callback,
16647
- fresh,
16643
+ callback
16648
16644
  })
16649
16645
  }))
16650
16646
  this.app.get("/pinokio", ex((req, res) => {
@@ -1902,6 +1902,16 @@ body.dark .setup-requirement-row.needs-update .setup-requirement-state {
1902
1902
  color: var(--task-muted);
1903
1903
  }
1904
1904
 
1905
+ .setup-reset-loading {
1906
+ display: flex;
1907
+ align-items: center;
1908
+ gap: 8px;
1909
+ margin-top: 12px;
1910
+ color: var(--task-muted);
1911
+ font-size: 12px;
1912
+ line-height: 1.45;
1913
+ }
1914
+
1905
1915
  .setup-state-root {
1906
1916
  min-height: 260px;
1907
1917
  display: flex;
@@ -540,7 +540,6 @@ body.install-page #terminal .xterm {
540
540
  </div>
541
541
  <input id='requirements' type='hidden' value="<%=requirements%>">
542
542
  <input id='callback' type='hidden' value="<%=callback%>">
543
- <input id='fresh' type='hidden' value="<%=fresh ? '1' : '0'%>">
544
543
  <script>
545
544
  //
546
545
  // /install_bin?type=bin&uri=conda
@@ -732,29 +731,6 @@ const navigateToCallback = () => {
732
731
  }
733
732
  location.href = href
734
733
  }
735
- const prepareFreshInstall = async () => {
736
- if (document.querySelector("#fresh").value !== "1") return true
737
- try {
738
- const result = await PinokioPathRemoval.request((background) => fetch("/pinokio/delete", {
739
- method: "post",
740
- headers: { "Content-Type": "application/json" },
741
- body: JSON.stringify({ type: "bin", background })
742
- }))
743
- if (result.cancelled) {
744
- navigateToCallback()
745
- return false
746
- }
747
- if (result.error) throw new Error(result.error)
748
- return true
749
- } catch (error) {
750
- ModalInput({
751
- title: "Error",
752
- type: "modal",
753
- description: error && error.message ? error.message : "Unable to reset managed tools."
754
- })
755
- return false
756
- }
757
- }
758
734
  const resumeInstall = () => {
759
735
  const form = document.createElement("form")
760
736
  form.method = "post"
@@ -827,7 +803,6 @@ const createTerm = async (_theme) => {
827
803
  }
828
804
  document.addEventListener("DOMContentLoaded", async () => {
829
805
  applyInstallSpinnerVariant(randomInstallSpinnerVariant())
830
- if (!await prepareFreshInstall()) return
831
806
  const n = new N()
832
807
  let socket = new Socket()
833
808
  <% if (theme === "dark") { %>
@@ -177,14 +177,9 @@
177
177
  <%= install_required ? 'This uses the same install flow as before.' : 'Pinokio can reopen the same destination without reinstalling anything.' %>
178
178
  </p>
179
179
 
180
- <form class="task-hidden" id="fresh-install-form" method="post" action="/pinokio/install">
181
- <input type="hidden" name="requirements" value="<%= JSON.stringify(requirementList) %>">
182
- <input type="hidden" name="callback" value="<%= targetPath %>">
183
- <input type="hidden" name="fresh" value="1">
184
- </form>
185
180
  <div class="setup-secondary-actions">
186
181
  <span class="task-inline-help">Not working?</span>
187
- <button class="task-button" type="submit" form="fresh-install-form">
182
+ <button class="task-button" type="submit" form="install-form">
188
183
  <i class="fa-solid fa-trash" aria-hidden="true"></i>
189
184
  <span>Try a fresh install</span>
190
185
  </button>
@@ -154,9 +154,6 @@
154
154
  justify-items: end;
155
155
  min-width: 118px;
156
156
  }
157
- body.tools-page .tools-reinstall-form {
158
- margin: 0;
159
- }
160
157
  body.tools-page .tools-bundle-status {
161
158
  display: inline-flex;
162
159
  align-items: center;
@@ -498,10 +495,9 @@
498
495
  <span>Install</span>
499
496
  </a>
500
497
  <% } else { %>
501
- <form class="tools-reinstall-form" method="post" action="/pinokio/install">
498
+ <form method="post" action="/pinokio/install">
502
499
  <input type="hidden" name="requirements" value="<%= JSON.stringify(bundle.requirements) %>">
503
500
  <input type="hidden" name="callback" value="/tools">
504
- <input type="hidden" name="fresh" value="1">
505
501
  <button class="task-link-button" type="submit">
506
502
  <i class="fa-solid fa-rotate" aria-hidden="true"></i>
507
503
  <span>Reinstall</span>
@@ -393,7 +393,6 @@ test("successful runtime cleanup resubmits the interrupted install", async (t) =
393
393
  const html = ejs.render(source, {
394
394
  agent: "web",
395
395
  callback: "/tools",
396
- fresh: false,
397
396
  requirements,
398
397
  theme: "dark",
399
398
  }, { filename: installViewPath })
@@ -458,65 +457,3 @@ test("successful runtime cleanup resubmits the interrupted install", async (t) =
458
457
  fields: { requirements, callback: "/tools" },
459
458
  })
460
459
  })
461
-
462
- test("fresh install removes bin on the install page before starting the installer", async (t) => {
463
- const source = await fs.readFile(installViewPath, "utf8")
464
- const requirements = '[{"name":"conda"}]'
465
- const html = ejs.render(source, {
466
- agent: "web",
467
- callback: "/tools",
468
- fresh: true,
469
- requirements,
470
- theme: "dark",
471
- }, { filename: installViewPath })
472
-
473
- let removal
474
- let started
475
- const startedPromise = new Promise((resolve) => { started = resolve })
476
- const dom = new JSDOM(html, {
477
- runScripts: "dangerously",
478
- url: "http://localhost/pinokio/install",
479
- beforeParse(window) {
480
- window.fetch = async (url, options) => {
481
- if (url === "/pinokio/delete") {
482
- removal = { url, options }
483
- return { ok: true, status: 200, json: async () => ({ success: true }) }
484
- }
485
- return { ok: true, status: 200, json: async () => ({ config: {} }) }
486
- }
487
- window.matchMedia = () => ({ matches: false, addEventListener() {}, removeEventListener() {} })
488
- window.ResizeObserver = class { observe() {} }
489
- window.N = class { Noty() {} }
490
- window.Terminal = class {
491
- constructor() { this.cols = 80; this.rows = 24 }
492
- attachCustomKeyEventHandler() {}
493
- focus() {}
494
- hasSelection() { return false }
495
- loadAddon() {}
496
- onData() {}
497
- open() {}
498
- write() {}
499
- }
500
- window.FitAddon = { FitAddon: class { fit() {} } }
501
- window.WebLinksAddon = { WebLinksAddon: class {} }
502
- window.xtermTheme = { FrontEndDelight: {} }
503
- window.PinokioTouch = { bindTerminalFocus() {} }
504
- window.PinokioPathRemoval = {
505
- request: async (remove) => (await remove(false)).json(),
506
- }
507
- window.Socket = class {
508
- emit() {}
509
- run(request) {
510
- assert.ok(removal, "fresh removal must finish before the installer starts")
511
- assert.equal(request.params, requirements)
512
- started()
513
- }
514
- }
515
- },
516
- })
517
- t.after(() => dom.window.close())
518
-
519
- await startedPromise
520
- assert.equal(removal.url, "/pinokio/delete")
521
- assert.deepEqual(JSON.parse(removal.options.body), { type: "bin", background: false })
522
- })
@@ -36,7 +36,7 @@ test("Tools reinstall immediately submits a fresh install request", async (t) =>
36
36
  })
37
37
  t.after(() => dom.window.close())
38
38
 
39
- const form = dom.window.document.querySelector(".tools-reinstall-form")
39
+ const form = dom.window.document.querySelector('.tools-bundle-actions form[action="/pinokio/install"]')
40
40
  form.addEventListener("submit", (event) => {
41
41
  event.preventDefault()
42
42
  submission = {
@@ -52,33 +52,12 @@ test("Tools reinstall immediately submits a fresh install request", async (t) =>
52
52
  fields: {
53
53
  requirements: '[{"name":"conda","type":"bin","installed":true}]',
54
54
  callback: "/tools",
55
- fresh: "1",
56
55
  },
57
56
  })
58
57
  })
59
58
 
60
- test("setup fresh install is a direct form submission", async () => {
59
+ test("setup fresh install immediately submits the existing install form", async () => {
61
60
  const source = await fs.readFile(setupViewPath, "utf8")
62
- const start = source.indexOf('<form class="task-hidden" id="fresh-install-form"')
63
- const end = source.indexOf("</div>", source.indexOf("</button>", start)) + 6
64
- const fragment = ejs.render(source.slice(start, end), {
65
- requirementList: [{ name: "conda", installed: true }],
66
- targetPath: "/tools",
67
- })
68
- const dom = new JSDOM(fragment, { url: "http://localhost/setup/dev" })
69
- const form = dom.window.document.querySelector("#fresh-install-form")
70
- let submission
71
- form.addEventListener("submit", (event) => {
72
- event.preventDefault()
73
- submission = Object.fromEntries(new dom.window.FormData(form))
74
- })
75
- dom.window.document.querySelector('[form="fresh-install-form"]').click()
76
-
77
- assert.deepEqual(submission, {
78
- requirements: '[{"name":"conda","installed":true}]',
79
- callback: "/tools",
80
- fresh: "1",
81
- })
82
- dom.window.close()
61
+ assert.match(source, /<button class="task-button" type="submit" form="install-form">/)
83
62
  assert.doesNotMatch(source, /id="del-bin"|setup-reset-loading/)
84
63
  })