pinokiod 8.0.15 → 8.0.16

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.15",
3
+ "version": "8.0.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -16619,7 +16619,7 @@ 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
- res.redirect("/pinokio/install")
16622
+ res.redirect(req.query.fresh === "1" ? "/pinokio/install?fresh=1" : "/pinokio/install")
16623
16623
  }))
16624
16624
  this.app.post("/pinokio/install/validate", ex(async (req, res) => {
16625
16625
  res.json({
@@ -819,6 +819,27 @@ document.addEventListener("DOMContentLoaded", async () => {
819
819
  options[key] = value;
820
820
  }
821
821
  }
822
+ if (options && options.fresh === "1") {
823
+ try {
824
+ const result = await PinokioPathRemoval.request((background) => fetch("/pinokio/delete", {
825
+ method: "post",
826
+ headers: { "Content-Type": "application/json" },
827
+ body: JSON.stringify({ type: "bin", background })
828
+ }))
829
+ if (result.cancelled) {
830
+ navigateToCallback()
831
+ return
832
+ }
833
+ if (result.error) throw new Error(result.error)
834
+ } catch (error) {
835
+ ModalInput({
836
+ title: "Error",
837
+ type: "modal",
838
+ description: error && error.message ? error.message : "Unable to reset managed tools."
839
+ })
840
+ return
841
+ }
842
+ }
822
843
  term.onData((data) => {
823
844
  if (shell_id) {
824
845
  socket.emit({
@@ -179,7 +179,7 @@
179
179
 
180
180
  <div class="setup-secondary-actions">
181
181
  <span class="task-inline-help">Not working?</span>
182
- <button class="task-button" type="submit" form="install-form">
182
+ <button class="task-button" type="submit" form="install-form" formaction="/pinokio/install?fresh=1">
183
183
  <i class="fa-solid fa-trash" aria-hidden="true"></i>
184
184
  <span>Try a fresh install</span>
185
185
  </button>
@@ -495,7 +495,7 @@
495
495
  <span>Install</span>
496
496
  </a>
497
497
  <% } else { %>
498
- <form method="post" action="/pinokio/install">
498
+ <form method="post" action="/pinokio/install?fresh=1">
499
499
  <input type="hidden" name="requirements" value="<%= JSON.stringify(bundle.requirements) %>">
500
500
  <input type="hidden" name="callback" value="/tools">
501
501
  <button class="task-link-button" type="submit">
@@ -36,11 +36,11 @@ 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-bundle-actions form[action="/pinokio/install"]')
39
+ const form = dom.window.document.querySelector('.tools-bundle-actions form[action="/pinokio/install?fresh=1"]')
40
40
  form.addEventListener("submit", (event) => {
41
41
  event.preventDefault()
42
42
  submission = {
43
- action: new URL(form.action).pathname,
43
+ action: `${new URL(form.action).pathname}${new URL(form.action).search}`,
44
44
  fields: Object.fromEntries(new dom.window.FormData(form)),
45
45
  }
46
46
  })
@@ -48,7 +48,7 @@ test("Tools reinstall immediately submits a fresh install request", async (t) =>
48
48
  button.click()
49
49
 
50
50
  assert.deepEqual(submission, {
51
- action: "/pinokio/install",
51
+ action: "/pinokio/install?fresh=1",
52
52
  fields: {
53
53
  requirements: '[{"name":"conda","type":"bin","installed":true}]',
54
54
  callback: "/tools",
@@ -58,6 +58,6 @@ test("Tools reinstall immediately submits a fresh install request", async (t) =>
58
58
 
59
59
  test("setup fresh install immediately submits the existing install form", async () => {
60
60
  const source = await fs.readFile(setupViewPath, "utf8")
61
- assert.match(source, /<button class="task-button" type="submit" form="install-form">/)
61
+ assert.match(source, /<button class="task-button" type="submit" form="install-form" formaction="\/pinokio\/install\?fresh=1">/)
62
62
  assert.doesNotMatch(source, /id="del-bin"|setup-reset-loading/)
63
63
  })