pinokiod 3.2.208 → 3.2.210

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.
@@ -110,7 +110,7 @@ report_errors: false`)
110
110
  for(let line of lines) {
111
111
  if (start) {
112
112
  let chunks = line.split(/\s+/).filter(x => x)
113
- if (chunks.length > 1) {
113
+ if (chunks.length > 2) {
114
114
  let name = chunks[0]
115
115
  let version = chunks[1]
116
116
  conda.add(name)
@@ -167,7 +167,7 @@ class Bin {
167
167
  await fs.promises.mkdir(bin_folder, { recursive: true }).catch((e) => { })
168
168
  const playwright_folder = path.resolve(bin_folder, "playwright/browsers")
169
169
  process.env.PLAYWRIGHT_BROWSERS_PATH = playwright_folder
170
- await fs.promises.mkdir(playwright_folder, { recursive: true }).catch((e) => { })
170
+ // await fs.promises.mkdir(playwright_folder, { recursive: true }).catch((e) => { })
171
171
  }
172
172
  // ORDERING MATTERS.
173
173
  // General purpose package managers like conda, conda needs to come at the end
@@ -272,7 +272,7 @@ class Bin {
272
272
  for(let line of lines) {
273
273
  if (start) {
274
274
  let chunks = line.split(/\s+/).filter(x => x)
275
- if (chunks.length > 1) {
275
+ if (chunks.length > 2) {
276
276
  let name = chunks[0]
277
277
  let version = chunks[1]
278
278
  conda.add(name)
@@ -3,40 +3,15 @@ const path = require('path')
3
3
  const { rimraf } = require('rimraf')
4
4
  class Playwright {
5
5
  async install(req, ondata) {
6
- // let c
7
- // if (this.kernel.platform === "win32") {
8
- // c = `npm config --global set prefix ${this.kernel.bin.path("miniconda")}`
9
- // } else {
10
- // c = [
11
- // `npm config --global set prefix ${this.kernel.bin.path("miniconda")} --loglevel verbose`,
12
- // `npm config set prefix ${this.kernel.bin.path("miniconda")} --loglevel verbose`
13
- // ]
14
- // }
15
- // await this.kernel.exec({
16
- // message: c,
17
- //// path: this.kernel.bin.path("playwright"),
18
- // env: {
19
- // PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
20
- // }
21
- // }, ondata)
22
-
23
-
24
- let p
25
- if (this.kernel.platform === "win32") {
26
- p = this.kernel.path("bin/miniconda")
27
- } else {
28
- p = this.kernel.path("bin/miniconda/lib")
29
- }
6
+ let p = this.kernel.path("bin/playwright")
7
+ await rimraf(p)
8
+ await fs.promises.mkdir(p, { recursive: true }).catch((e) => { })
30
9
  await this.kernel.exec({
31
10
  message: [
32
- // "npm init -y",
33
- // "which npm",
34
- // "npm config get userconfig",
35
- // "npm config get globalconfig",
36
- // "npm config list -l --loglevel verbose",
37
- // "env",
38
- //"npm install -g playwright@1.49.0 --loglevel verbose",
39
- "npm install npm corepack playwright@1.49.1 --loglevel verbose",
11
+ "npm init -y",
12
+ //"npm install npm corepack playwright@1.49.1 --loglevel verbose",
13
+ "npm install playwright --loglevel verbose",
14
+ "playwright install firefox",
40
15
  // "playwright install chromium",
41
16
  ],
42
17
  path: p,
@@ -44,56 +19,13 @@ class Playwright {
44
19
  PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
45
20
  }
46
21
  }, ondata)
47
- let pw_path = path.resolve(p, "node_modules/playwright/cli.js")
48
- await this.kernel.exec({
49
- message: [
50
- // "npm init -y",
51
- `node ${pw_path} install firefox`,
52
- // "playwright install firefox",
53
- // "npx -y playwright install firefox"
54
- ],
55
- //path: this.kernel.bin.path("playwright"),
56
- env: {
57
- PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
58
- }
59
- }, ondata)
60
- // await this.kernel.exec({
61
- // message: [
62
- // "npm init -y",
63
- // "npm install @playwright/browser-chromium@1.47.0",
64
- // "npm install @playwright/browser-firefox@1.47.0",
65
- // "npm install @playwright/browser-webkit@1.47.0"
66
- //// "npx playwright install chromium"
67
- // ],
68
- // path: this.kernel.bin.path("playwright"),
69
- // env: {
70
- // PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
71
- // }
72
- // }, ondata)
73
- // await this.kernel.exec({
74
- // message: [
75
- // "pip install playwright==1.48.0",
76
- //// "playwright install"
77
- //// "npm install playwright --ignore-scripts"
78
- // ],
79
- // env: {
80
- // PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
81
- // }
82
- // }, ondata)
83
-
84
- let pwpath
85
- if (this.kernel.platform === "win32") {
86
- pwpath = this.kernel.bin.path("miniconda/node_modules/playwright")
87
- } else {
88
- pwpath = this.kernel.bin.path("miniconda/lib/node_modules/playwright")
89
- }
90
- process.env.PLAYWRIGHT_BROWSERS_PATH = this.kernel.bin.path("playwright/browsers")
91
- this.kernel.playwright = (await this.kernel.loader.load(pwpath)).resolved
92
22
  }
93
23
  async installed() {
94
- let p = this.kernel.bin.path("playwright/browsers")
95
- let e = await this.kernel.bin.exists(p)
96
- return e
24
+ let browsers = this.kernel.bin.path("playwright/browsers")
25
+ let node_modules = this.kernel.bin.path("playwright/node_modules")
26
+ let e1 = await this.kernel.bin.exists(browsers)
27
+ let e2 = await this.kernel.bin.exists(node_modules)
28
+ return e1 && e2
97
29
  }
98
30
  async uninstall(req, ondata) {
99
31
  ondata({ raw: "cleaning up\r\n" })
package/kernel/index.js CHANGED
@@ -236,6 +236,8 @@ class Kernel {
236
236
  return { cols, rows, id, group, path, index, cmd, done }
237
237
  }),
238
238
  proxies: [],
239
+ api: [],
240
+ bin: {},
239
241
  vars: this.vars,
240
242
  memory: this.memory,
241
243
  procs: this.procs,
@@ -288,8 +290,32 @@ class Kernel {
288
290
  })
289
291
  }
290
292
  }
291
- this.api.proxies,
292
293
 
294
+ let files = await fs.promises.readdir(this.api.userdir, { withFileTypes: true })
295
+ let folders = files.filter((f) => { return f.isDirectory() }).map((x) => { return x.name })
296
+ let meta = {}
297
+ for(let folder of folders) {
298
+ let p = path.resolve(this.api.userdir, folder, "pinokio.js")
299
+ let pinokio = (await this.loader.load(p)).resolved
300
+ if (pinokio) {
301
+ i.api.push({
302
+ path: folder,
303
+ title: pinokio.title,
304
+ description: pinokio.description,
305
+ icon: pinokio.icon ? `/api/${folder}/${pinokio.icon}?raw=true` : null
306
+ })
307
+ } else {
308
+ i.api.push({
309
+ path: folder,
310
+ })
311
+ }
312
+ }
313
+ for(let key in this.bin.installed) {
314
+ let s = this.bin.installed[key]
315
+ i.bin[key] = {
316
+ installed: Array.from(s)
317
+ }
318
+ }
293
319
  this.i = i
294
320
  }
295
321
 
@@ -516,6 +542,13 @@ class Kernel {
516
542
  //await this.shell.init()
517
543
  }
518
544
 
545
+ let pwpath
546
+ if (this.platform === "win32") {
547
+ pwpath = this.bin.path("playwright/node_modules/playwright")
548
+ } else {
549
+ pwpath = this.bin.path("playwright/lib/node_modules/playwright")
550
+ }
551
+ this.kernel.playwright = (await this.kernel.loader.load(pwpath)).resolved
519
552
 
520
553
 
521
554
  // let pwpath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.208",
3
+ "version": "3.2.210",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,6 +35,7 @@
35
35
  "http-proxy": "^1.18.1",
36
36
  "http-proxy-middleware": "^3.0.0",
37
37
  "http-terminator": "^3.2.0",
38
+ "https": "^1.0.0",
38
39
  "isomorphic-git": "^1.23.0",
39
40
  "jimini": "^0.0.7",
40
41
  "jsdom": "^24.0.0",
package/server/index.js CHANGED
@@ -516,8 +516,8 @@ class Server {
516
516
  name: "py"
517
517
  }, {
518
518
  name: "cloudflared"
519
- // }, {
520
- // name: "playwright"
519
+ }, {
520
+ name: "playwright"
521
521
  }, {
522
522
  name: "huggingface"
523
523
  }, {
@@ -798,8 +798,8 @@ class Server {
798
798
  name: "py"
799
799
  }, {
800
800
  name: "cloudflared"
801
- // }, {
802
- // name: "playwright"
801
+ }, {
802
+ name: "playwright"
803
803
  }, {
804
804
  name: "huggingface"
805
805
  }, {