pinokiod 3.18.4 → 3.18.5

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": "3.18.4",
3
+ "version": "3.18.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -4983,6 +4983,15 @@ class Server {
4983
4983
  this.app.get("/check", ex((req, res) => {
4984
4984
  res.json({ success: true })
4985
4985
  }))
4986
+ this.app.post("/onrestart", ex(async (req, res) => {
4987
+ console.log("post /onrestart")
4988
+ if (this.onrestart) {
4989
+ this.onrestart()
4990
+ } else {
4991
+ await this.start({ debug: this.debug, browser: this.browser })
4992
+ res.json({ success: true })
4993
+ }
4994
+ }))
4986
4995
  this.app.post("/restart", ex(async (req, res) => {
4987
4996
  console.log("post /restart")
4988
4997
  this.start({ debug: this.debug, browser: this.browser })
@@ -642,11 +642,38 @@ console.log("body", body)
642
642
  allowOutsideClick: false,
643
643
  allowEscapeKey: false,
644
644
  allowEnterKey: false,
645
- showConfirmButton: false,
646
- didOpen: () => {
647
- Swal.showLoading();
645
+ confirmButtonText: "Restart",
646
+ // showConfirmButton: false,
647
+ // didOpen: () => {
648
+ // Swal.showLoading();
649
+ // }
650
+ }).then((result) => {
651
+ if (result.isConfirmed) {
652
+ fetch("/onrestart", {
653
+ method: "POST",
654
+ headers: { "Content-Type": "application/json" },
655
+ body: JSON.stringify({})
656
+ }).then((res) => {
657
+ return res.json()
658
+ })
659
+ setInterval(async () => {
660
+ try {
661
+ let res = await fetch("/check").then((res) => {
662
+ return res.json()
663
+ })
664
+ if (res.success) {
665
+ document.querySelector(".loading").classList.add("hidden")
666
+ setTimeout(() => {
667
+ location.href = "/"
668
+ }, 1000)
669
+ }
670
+ } catch (e) {
671
+ console.log(e)
672
+ }
673
+ }, 1000)
648
674
  }
649
- });
675
+ })
676
+
650
677
  } else {
651
678
  //alert("Successfully updated the pinokio home to " + val)
652
679
  fetch("/restart", {