pinokiod 3.6.35 → 3.6.38

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.
@@ -80,7 +80,8 @@ report_errors: false`)
80
80
  // }
81
81
  let pinned_exists = await this.kernel.exists("bin/miniconda/conda-meta")
82
82
  if (pinned_exists) {
83
- await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda ==24.11.3`)
83
+ //await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda ==24.11.3`)
84
+ await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), "")
84
85
  //sqlite ==3.47.2`)
85
86
  // await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.9.0`)
86
87
  // await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.11.2
@@ -119,10 +120,11 @@ report_errors: false`)
119
120
  let version = chunks[1]
120
121
  conda.add(name)
121
122
  if (name === "conda") {
122
- //if (String(version) === "24.11.1") {
123
- if (String(version) === "24.11.3") {
124
- conda_check.conda = true
125
- }
123
+ conda_check.conda = true
124
+ // //if (String(version) === "24.11.1") {
125
+ // if (String(version) === "24.11.3") {
126
+ // conda_check.conda = true
127
+ // }
126
128
  }
127
129
  // check conda-libmamba-solver is up to date
128
130
  // sometimes it just fails silently so need to check
@@ -207,7 +209,8 @@ report_errors: false`)
207
209
  let pinned_exists = await this.kernel.exists("bin/miniconda/conda-meta")
208
210
  if (pinned_exists) {
209
211
  //await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.11.1`)
210
- await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda ==24.11.3`)
212
+ //await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda ==24.11.3`)
213
+ await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), "")
211
214
  //sqlite ==3.47.2`)
212
215
  // await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.9.0`)
213
216
  // await fs.promises.writeFile(this.kernel.path('bin/miniconda/conda-meta/pinned'), `conda=24.11.2
@@ -4,6 +4,7 @@ const _ = require('lodash')
4
4
  const path = require('path')
5
5
  const { rimraf } = require('rimraf')
6
6
  const { DownloaderHelper } = require('node-downloader-helper');
7
+ const { ProxyAgent } = require('proxy-agent');
7
8
 
8
9
  //const Cmake = require("./cmake")
9
10
  const Python = require('./python')
@@ -23,7 +24,7 @@ const { glob } = require('glob')
23
24
  const fakeUa = require('fake-useragent');
24
25
  const fse = require('fs-extra')
25
26
  const semver = require('semver')
26
- const { bootstrap } = require('global-agent')
27
+ //const { bootstrap } = require('global-agent')
27
28
  const Environment = require('../environment')
28
29
  //const imageToAscii = require("image-to-ascii");
29
30
 
@@ -54,15 +55,27 @@ class Bin {
54
55
  // })
55
56
  // }
56
57
  async download(url, dest, ondata) {
58
+ console.log("DOWNLOAD process.env", process.env)
59
+ const agent = new ProxyAgent();
57
60
  const userAgent = fakeUa()
58
61
  console.log("download userAgent", userAgent)
59
- const dl = new DownloaderHelper(url, this.path(), {
62
+ const opts = {
60
63
  fileName: dest,
61
64
  override: true,
62
65
  headers: {
63
66
  "User-Agent": userAgent
64
67
  }
65
- })
68
+ }
69
+ if (process.env.HTTP_PROXY && process.env.HTTP_PROXY.length > 0) {
70
+ opts.httpRequestOptions = { agent }
71
+ opts.httpsRequestOptions = { agent }
72
+ }
73
+ if (process.env.HTTPS_PROXY && process.env.HTTPS_PROXY.length > 0) {
74
+ opts.httpRequestOptions = { agent }
75
+ opts.httpsRequestOptions = { agent }
76
+ }
77
+ console.log("opts", opts)
78
+ const dl = new DownloaderHelper(url, this.path(), opts)
66
79
  ondata({ raw: `\r\nDownloading ${url} to ${this.path()}...\r\n` })
67
80
  let res = await new Promise((resolve, reject) => {
68
81
  dl.on('end', () => {
@@ -174,6 +187,7 @@ class Bin {
174
187
  return e
175
188
  }
176
189
  async init() {
190
+ console.log("kernel.bin.init", this.kernel.homedir)
177
191
  if (this.kernel.homedir) {
178
192
  const bin_folder = this.path()
179
193
  await fs.promises.mkdir(bin_folder, { recursive: true }).catch((e) => { })
@@ -182,36 +196,34 @@ class Bin {
182
196
  process.env.PLAYWRIGHT_BROWSERS_PATH = playwright_folder
183
197
  }
184
198
  // await fs.promises.mkdir(playwright_folder, { recursive: true }).catch((e) => { })
185
- }
199
+ let system_env = await Environment.get(this.kernel.homedir)
200
+ console.log("***********", { system_env })
186
201
 
187
- let system_env = await Environment.get(this.kernel.homedir)
188
- console.log("***********", { system_env })
189
-
190
- if (system_env.HTTP_PROXY) {
191
- process.env.GLOBAL_AGENT_HTTP_PROXY = system_env.HTTP_PROXY
192
- } else {
193
- if (process.env.GLOBAL_AGENT_HTTP_PROXY) {
194
- delete process.env.GLOBAL_AGENT_HTTP_PROXY
202
+ if (system_env.HTTP_PROXY) {
203
+ process.env.HTTP_PROXY = system_env.HTTP_PROXY
204
+ } else {
205
+ if (process.env.HTTP_PROXY) {
206
+ delete process.env.HTTP_PROXY
207
+ }
195
208
  }
196
- }
197
- if (system_env.HTTPS_PROXY) {
198
- process.env.GLOBAL_AGENT_HTTPS_PROXY = system_env.HTTPS_PROXY
199
- } else {
200
- if (process.env.GLOBAL_AGENT_HTTPS_PROXY) {
201
- delete process.env.GLOBAL_AGENT_HTTPS_PROXY
209
+ if (system_env.HTTPS_PROXY) {
210
+ process.env.HTTPS_PROXY = system_env.HTTPS_PROXY
211
+ } else {
212
+ if (process.env.HTTPS_PROXY) {
213
+ delete process.env.HTTPS_PROXY
214
+ }
202
215
  }
203
- }
204
- if (system_env.NO_PROXY) {
205
- process.env.GLOBAL_AGENT_NO_PROXY = system_env.NO_PROXY
206
- } else {
207
- if (process.env.GLOBAL_AGENT_NO_PROXY) {
208
- delete process.env.GLOBAL_AGENT_NO_PROXY
216
+ if (system_env.NO_PROXY) {
217
+ process.env.NO_PROXY = system_env.NO_PROXY
218
+ } else {
219
+ if (process.env.NO_PROXY) {
220
+ delete process.env.NO_PROXY
221
+ }
209
222
  }
210
223
  }
211
224
 
212
- bootstrap();
213
225
 
214
- console.log("process.env", process.env)
226
+ // bootstrap();
215
227
 
216
228
  // ORDERING MATTERS.
217
229
  // General purpose package managers like conda, conda needs to come at the end
@@ -323,10 +335,11 @@ class Bin {
323
335
  conda.add(name)
324
336
  conda_versions[name] = version
325
337
  if (name === "conda") {
326
- //if (String(version) === "24.11.1") {
327
- if (String(version) === "24.11.3") {
328
- conda_check.conda = true
329
- }
338
+ conda_check.conda = true
339
+ // //if (String(version) === "24.11.1") {
340
+ // if (String(version) === "24.11.3") {
341
+ // conda_check.conda = true
342
+ // }
330
343
  }
331
344
  if (name === "conda-libmamba-solver") {
332
345
  //if (String(version) === "24.7.0") {
package/kernel/index.js CHANGED
@@ -480,6 +480,16 @@ class Kernel {
480
480
  let str = await Environment.ENV("system", this.homedir)
481
481
  await fs.promises.writeFile(path.resolve(this.homedir, "ENVIRONMENT"), str)
482
482
  }
483
+
484
+ const updated = {
485
+ HTTP_PROXY: (this.store.get("HTTP_PROXY") || ""),
486
+ HTTPS_PROXY: (this.store.get("HTTPS_PROXY") || ""),
487
+ NO_PROXY: (this.store.get("NO_PROXY") || "")
488
+ }
489
+ let fullpath = path.resolve(this.homedir, "ENVIRONMENT")
490
+ console.log("> update env", { fullpath, updated })
491
+ await Util.update_env(fullpath, updated)
492
+
483
493
  // 2. mkdir all the folders if not already created
484
494
  await Environment.init_folders(this.homedir)
485
495
 
@@ -604,10 +614,10 @@ class Kernel {
604
614
 
605
615
  await fs.promises.mkdir(this.path("logs"), { recursive: true }).catch((e) => { })
606
616
  await fs.promises.writeFile(this.path("logs/system.json"), JSON.stringify(this.i, null, 2))
617
+ let pwpath = this.bin.path("playwright/node_modules/playwright")
618
+ this.playwright = (await this.loader.load(pwpath)).resolved
607
619
  }
608
620
 
609
- let pwpath = this.bin.path("playwright/node_modules/playwright")
610
- this.playwright = (await this.loader.load(pwpath)).resolved
611
621
  } catch (e) {
612
622
  console.log("### ERROR", e)
613
623
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.6.35",
3
+ "version": "3.6.38",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,7 +31,6 @@
31
31
  "fs-extra": "^11.1.1",
32
32
  "glob": "^10.3.3",
33
33
  "glob-gitignore": "^1.0.14",
34
- "global-agent": "^3.0.0",
35
34
  "go-get-folder-size": "^0.5.5",
36
35
  "http-proxy": "^1.18.1",
37
36
  "http-proxy-middleware": "^3.0.0",
@@ -50,6 +49,7 @@
50
49
  "node-gradio-client": "^0.14.6",
51
50
  "pdrive": "^0.0.26",
52
51
  "portfinder-cp": "^1.0.34",
52
+ "proxy-agent": "^6.5.0",
53
53
  "qrcode": "^1.5.3",
54
54
  "random-useragent": "^0.5.0",
55
55
  "rimraf": "^5.0.0",
package/server/index.js CHANGED
@@ -1981,6 +1981,7 @@ class Server {
1981
1981
  }
1982
1982
  }
1983
1983
  async setConfig(config) {
1984
+ console.log("setConfig", config)
1984
1985
  let home = this.kernel.store.get("home")
1985
1986
  let theme = this.kernel.store.get("theme")
1986
1987
  // let drive = this.kernel.store.get("drive")
@@ -2050,16 +2051,11 @@ class Server {
2050
2051
  // if (config.HTTPS_PROXY) {
2051
2052
  // updated.HTTPS_PROXY = config.HTTPS_PROXY
2052
2053
  // }
2053
- if (this.kernel.homedir) {
2054
- const updated = {
2055
- HTTP_PROXY: config.HTTP_PROXY,
2056
- HTTPS_PROXY: config.HTTPS_PROXY,
2057
- NO_PROXY: config.NO_PROXY,
2058
- }
2059
- let fullpath = path.resolve(this.kernel.homedir, "ENVIRONMENT")
2060
- console.log({ updated })
2061
- await Util.update_env(fullpath, updated)
2062
- }
2054
+
2055
+
2056
+ this.kernel.store.set("HTTP_PROXY", config.HTTP_PROXY)
2057
+ this.kernel.store.set("HTTPS_PROXY", config.HTTPS_PROXY)
2058
+ this.kernel.store.set("NO_PROXY", config.NO_PROXY)
2063
2059
  }
2064
2060
  async startLogging(homedir) {
2065
2061
  console.log(">>>>>>> startLogging", homedir)