pinokiod 3.2.237 → 3.2.239

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/kernel/index.js CHANGED
@@ -491,31 +491,37 @@ class Kernel {
491
491
  })
492
492
 
493
493
  // get env
494
- for(let api of this.i.api) {
495
- let env_path = path.resolve(this.api.userdir, api.path)
496
- let e = await Environment.get(env_path)
497
- console.log(e)
498
- if (e.PINOKIO_SCRIPT_AUTOLAUNCH && e.PINOKIO_SCRIPT_AUTOLAUNCH.trim().length > 0) {
499
- let autolaunch_path = path.resolve(env_path, e.PINOKIO_SCRIPT_AUTOLAUNCH)
500
- let exists = await this.exists(autolaunch_path)
501
- console.log("ATTEMPTING AUTOLAUNCH", autolaunch_path)
502
- if (exists) {
503
- console.log("SCRIPT EXISTS. Starting...", autolaunch_path)
504
- let res = await new Promise((resolve, reject) => {
505
- this.api.process({
506
- uri: autolaunch_path,
507
- input: {}
508
- // client: req.client,
509
- // caller: req.parent.path,
510
- }, (r) => {
511
- resolve(r.input)
512
- })
513
- })
514
- } else {
515
- console.log("SCRIPT DOES NOT EXIST. Ignoring.", autolaunch_path)
494
+ let interval = setInterval(async () => {
495
+ if (this.i) {
496
+ for(let api of this.i.api) {
497
+ let env_path = path.resolve(this.api.userdir, api.path)
498
+ let e = await Environment.get(env_path)
499
+ console.log(e)
500
+ if (e.PINOKIO_SCRIPT_AUTOLAUNCH && e.PINOKIO_SCRIPT_AUTOLAUNCH.trim().length > 0) {
501
+ let autolaunch_path = path.resolve(env_path, e.PINOKIO_SCRIPT_AUTOLAUNCH)
502
+ let exists = await this.exists(autolaunch_path)
503
+ console.log("ATTEMPTING AUTOLAUNCH", autolaunch_path)
504
+ if (exists) {
505
+ console.log("SCRIPT EXISTS. Starting...", autolaunch_path)
506
+ let res = await new Promise((resolve, reject) => {
507
+ this.api.process({
508
+ uri: autolaunch_path,
509
+ input: {}
510
+ // client: req.client,
511
+ // caller: req.parent.path,
512
+ }, (r) => {
513
+ resolve(r.input)
514
+ })
515
+ })
516
+ } else {
517
+ console.log("SCRIPT DOES NOT EXIST. Ignoring.", autolaunch_path)
518
+ }
519
+ }
516
520
  }
521
+ clearInterval(interval)
522
+ this.launch_complete = true
517
523
  }
518
- }
524
+ }, 1000)
519
525
  }
520
526
  // console.log({ grant_permission })
521
527
  // if (grant_permission) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.237",
3
+ "version": "3.2.239",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -3083,6 +3083,7 @@ class Server {
3083
3083
  await this.kernel.getInfo()
3084
3084
  console.timeEnd("getInfo")
3085
3085
  let info = Object.assign({}, this.kernel.i)
3086
+ info.launch_complete = this.kernel.launch_complete
3086
3087
  delete info.vars
3087
3088
  delete info.shell_env
3088
3089
  delete info.memory
@@ -1077,6 +1077,24 @@ if (document.querySelector("#genlog")) {
1077
1077
  })
1078
1078
  })
1079
1079
  }
1080
+ fetch("/pinokio/info").then((res) => {
1081
+ return res.json()
1082
+ }).then((res) => {
1083
+ if (!res.launch_complete) {
1084
+ let interval = setInterval(async () => {
1085
+ let res = await fetch("/pinokio/info").then((res) => {
1086
+ return res.json()
1087
+ })
1088
+ if (res.launch_complete) {
1089
+ console.log("launched")
1090
+ clearInterval(interval)
1091
+ location.href = location.href
1092
+ } else {
1093
+ console.log("not yet launched")
1094
+ }
1095
+ }, 1000)
1096
+ }
1097
+ })
1080
1098
 
1081
1099
  </script>
1082
1100
  </body>