pinokiod 3.5.3 → 3.5.4

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.
@@ -15,8 +15,8 @@ class Conda {
15
15
  },
16
16
  win32: {
17
17
  //x64: "https://github.com/cocktailpeanut/miniconda/releases/download/v23.5.2/Miniconda3-py310_23.5.2-0-Windows-x86_64.exe",
18
- x64: "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.5.0-0-Windows-x86_64.exe"
19
- //x64: "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.11.1-0-Windows-x86_64.exe"
18
+ //x64: "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.5.0-0-Windows-x86_64.exe"
19
+ x64: "https://repo.anaconda.com/miniconda/Miniconda3-py310_24.11.1-0-Windows-x86_64.exe"
20
20
  },
21
21
  linux: {
22
22
  //x64: "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-Linux-x86_64.sh",
@@ -69,13 +69,14 @@ class Conda {
69
69
  - conda-forge
70
70
  - defaults
71
71
  create_default_packages:
72
- - python=3.10`)
73
- /*
72
+ - python=3.10
74
73
  remote_connect_timeout_secs: 20.0
75
74
  remote_read_timeout_secs: 300.0
76
75
  remote_max_retries: 6
77
76
  report_errors: false`)
78
- */
77
+ //repodata_threads: 4
78
+ //fetch_threads: 5
79
+ //report_errors: false`)
79
80
  // }
80
81
  let pinned_exists = await this.kernel.exists("bin/miniconda/conda-meta")
81
82
  if (pinned_exists) {
package/kernel/index.js CHANGED
@@ -370,7 +370,28 @@ class Kernel {
370
370
  return which.sync(name, { nothrow: true, path: this.envs.PATH })
371
371
  }
372
372
  }
373
-
373
+ async initHome() {
374
+ // first make dir
375
+ await fs.promises.mkdir(this.homedir, { recursive: true }).catch((e) => {})
376
+ // then wait until the app launches, and when it launches, grant access
377
+ if (this.platform === "win32") {
378
+ console.log("[initHome] Wait until the app launches")
379
+ let interval = setInterval(() => {
380
+ console.log("[initHome] Has the app launched?", this.launch_complete)
381
+ if (this.launch_complete) {
382
+ console.log("[initHome] 1 Give full permission")
383
+ await this.bin.exec({
384
+ sudo: true,
385
+ message: `icacls ${this.homedir} /grant Users:(OI)(CI)F /T`
386
+ }, (stream) => {
387
+ ondata(stream)
388
+ })
389
+ console.log("[initHome] 2 Give full permission done")
390
+ clearInterval(interval)
391
+ }
392
+ }, 1000)
393
+ }
394
+ }
374
395
  async init(options) {
375
396
  let home = this.store.get("home")
376
397
 
@@ -439,17 +460,13 @@ class Kernel {
439
460
  this.procs = {}
440
461
  this.template = new Template()
441
462
  try {
442
- let grant_permission = false
443
463
  if (this.homedir) {
444
464
 
445
465
  // 0. create homedir
446
466
  let home_exists = await this.exists(this.homedir)
447
467
  console.log({ home_exists, homedir: this.homedir })
448
468
  if (!home_exists) {
449
- await fs.promises.mkdir(this.homedir, { recursive: true }).catch((e) => {})
450
-
451
- // If the homedir was newly created, give full permission to pinokio folder on windows
452
- grant_permission = true
469
+ await this.initHome()
453
470
  }
454
471
 
455
472
 
@@ -547,19 +564,6 @@ class Kernel {
547
564
  }, 1000)
548
565
  }
549
566
  }
550
- // console.log({ grant_permission })
551
- // if (grant_permission) {
552
- // if (this.platform === "win32") {
553
- // console.log("2 Give full permission")
554
- // await this.bin.exec({
555
- // sudo: true,
556
- // message: `icacls ${this.homedir} /grant Users:(OI)(CI)F /T`
557
- // }, (stream) => {
558
- // ondata(stream)
559
- // })
560
- // console.log("2 Give full permission done")
561
- // }
562
- // }
563
567
  })
564
568
  }
565
569
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.5.3",
3
+ "version": "3.5.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2025,6 +2025,7 @@ class Server {
2025
2025
  console.log({ homedir })
2026
2026
  let logsdir = path.resolve(homedir, "logs")
2027
2027
  console.log({ logsdir })
2028
+ await this.kernel.initHome()
2028
2029
  await fs.promises.mkdir(logsdir, { recursive: true }).catch((e) => { console.log(e) })
2029
2030
  console.log("this.log", this.log)
2030
2031
  if (!this.log) {