pinokiod 3.8.1530 → 3.8.1532
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/api/index.js +27 -7
- package/kernel/api/web/index.js +6 -0
- package/kernel/bin/git.js +36 -10
- package/kernel/bin/index.js +3 -20
- package/kernel/prototype.js +1 -1
- package/kernel/shell.js +1 -0
- package/package.json +1 -1
- package/server/index.js +244 -73
- package/server/public/fscreator.js +32 -15
- package/server/public/style.css +10 -3
- package/server/views/app.ejs +71 -6
- package/server/views/editor.ejs +37 -0
- package/server/views/file_explorer.ejs +1 -1
- package/server/views/github.ejs +179 -0
- package/server/views/index.ejs +20 -2
- package/server/views/network.ejs +1 -1
- package/server/views/partials/dynamic.ejs +6 -0
- package/server/views/prototype.ejs +299 -0
- package/server/views/settings.ejs +1 -1
- package/server/views/setup_home.ejs +1 -1
- package/server/views/shell.ejs +1 -1
- package/server/views/terminal.ejs +55 -10
- package/server/views/local_editor.ejs +0 -282
- package/server/views/prototypes.ejs +0 -482
package/kernel/api/index.js
CHANGED
|
@@ -28,6 +28,21 @@ class Api {
|
|
|
28
28
|
this.child_procs = {}
|
|
29
29
|
this.lproxy = new Lproxy()
|
|
30
30
|
}
|
|
31
|
+
async meta(name) {
|
|
32
|
+
let p = this.kernel.path("api", name, "pinokio.js")
|
|
33
|
+
let pinokio = (await this.kernel.loader.load(p)).resolved
|
|
34
|
+
let p2 = this.kernel.path("api", name, "pinokio_meta.json")
|
|
35
|
+
let pinokio2 = (await this.kernel.loader.load(p2)).resolved
|
|
36
|
+
let p3 = this.kernel.path("api", name, "pinokio.json")
|
|
37
|
+
let pinokio3 = (await this.kernel.loader.load(p3)).resolved
|
|
38
|
+
let meta = Object.assign({}, pinokio, pinokio2, pinokio3)
|
|
39
|
+
meta.iconpath = meta.icon ? this.kernel.path("api", name, meta.icon) : null
|
|
40
|
+
meta.icon = meta.icon ? `/api/${name}/${meta.icon}?raw=true` : "/pinokio-black.png"
|
|
41
|
+
meta.path = this.kernel.path("api", name)
|
|
42
|
+
meta.name = meta.title
|
|
43
|
+
meta.link = `/pinokio/browser/${name}/browse#n1`
|
|
44
|
+
return meta
|
|
45
|
+
}
|
|
31
46
|
get_proxy_url(root, port) {
|
|
32
47
|
if (this.proxies) {
|
|
33
48
|
let proxies = this.proxies[root]
|
|
@@ -160,7 +175,6 @@ class Api {
|
|
|
160
175
|
|
|
161
176
|
await this.kernel.stopCloudflare({ path: requestPath })
|
|
162
177
|
|
|
163
|
-
|
|
164
178
|
// if there are any pending waiters, delete them
|
|
165
179
|
|
|
166
180
|
if (this.waiter[requestPath]) {
|
|
@@ -431,14 +445,18 @@ class Api {
|
|
|
431
445
|
let method
|
|
432
446
|
let dirname
|
|
433
447
|
let mod
|
|
434
|
-
if (req.
|
|
448
|
+
if (req.method && typeof req.method === "function") {
|
|
449
|
+
modpath = null
|
|
450
|
+
method = req.method
|
|
451
|
+
dirname = __dirname
|
|
452
|
+
mod = null
|
|
453
|
+
} else if (req.uri) {
|
|
435
454
|
modpath = this.resolvePath(cwd, req.uri)
|
|
436
455
|
let m = (await this.loader.load(modpath))
|
|
437
456
|
const stats = await fs.promises.stat(modpath)
|
|
438
457
|
if (!this.child_procs[req.parent.path]) {
|
|
439
458
|
this.child_procs[req.parent.path] = new Set()
|
|
440
459
|
}
|
|
441
|
-
console.log("SCRIPT RESOLVE METHOD", req)
|
|
442
460
|
if (this.mods[modpath]) {
|
|
443
461
|
// use the cached module if unchanged
|
|
444
462
|
if (String(stats.mtime) === String(this.mods[modpath].updated)) {
|
|
@@ -572,9 +590,7 @@ class Api {
|
|
|
572
590
|
|
|
573
591
|
}
|
|
574
592
|
async step (request, rawrpc, input, i, total, args) {
|
|
575
|
-
console.time("STEP INIT")
|
|
576
593
|
await Promise.all([this.init(), this.kernel.update_sysinfo()])
|
|
577
|
-
console.timeEnd("STEP INIT")
|
|
578
594
|
|
|
579
595
|
// clear global regular expression object RegExp.lastMatch (memory leak prevention)
|
|
580
596
|
let r = /\s*/g.exec("");
|
|
@@ -583,6 +599,10 @@ class Api {
|
|
|
583
599
|
|
|
584
600
|
let { cwd, script } = await this.resolveScript(request.path)
|
|
585
601
|
|
|
602
|
+
if (request.cwd) {
|
|
603
|
+
cwd = request.cwd
|
|
604
|
+
}
|
|
605
|
+
|
|
586
606
|
let memory = {
|
|
587
607
|
script: this.kernel.script,
|
|
588
608
|
input,
|
|
@@ -635,7 +655,6 @@ class Api {
|
|
|
635
655
|
break;
|
|
636
656
|
}
|
|
637
657
|
}
|
|
638
|
-
|
|
639
658
|
// replace {{{ }}} with {{ }}
|
|
640
659
|
rpc = this.kernel.template.flatten(rpc)
|
|
641
660
|
|
|
@@ -769,6 +788,7 @@ class Api {
|
|
|
769
788
|
uri: request.path
|
|
770
789
|
}
|
|
771
790
|
})
|
|
791
|
+
console.log(">>>>>> STOPPED", request)
|
|
772
792
|
}
|
|
773
793
|
return { request, input: null, step: rpc.next, total: script.run.length, args }
|
|
774
794
|
} else {
|
|
@@ -987,6 +1007,7 @@ class Api {
|
|
|
987
1007
|
uri: request.path
|
|
988
1008
|
}
|
|
989
1009
|
})
|
|
1010
|
+
console.log("<<<<<< STOPPED", request)
|
|
990
1011
|
return { request, input: result, step: rpc.next, total: script.run.length, args }
|
|
991
1012
|
}
|
|
992
1013
|
|
|
@@ -1232,7 +1253,6 @@ class Api {
|
|
|
1232
1253
|
} else {
|
|
1233
1254
|
console.log({ request })
|
|
1234
1255
|
let { cwd, script } = await this.resolveScript(request.path)
|
|
1235
|
-
request.cwd = cwd
|
|
1236
1256
|
|
|
1237
1257
|
if (!script) {
|
|
1238
1258
|
this.ondata({
|
package/kernel/api/web/index.js
CHANGED
|
@@ -21,5 +21,11 @@ class Web {
|
|
|
21
21
|
kernel.exposed[app] = req.params.uri
|
|
22
22
|
console.log("kernel.exposed", kernel.exposed)
|
|
23
23
|
}
|
|
24
|
+
async open(req, ondata, kernel) {
|
|
25
|
+
ondata(req.params, "browser.open")
|
|
26
|
+
}
|
|
27
|
+
async close(req, ondata, kernel) {
|
|
28
|
+
ondata(req.params, "browser.close")
|
|
29
|
+
}
|
|
24
30
|
}
|
|
25
31
|
module.exports = Web
|
package/kernel/bin/git.js
CHANGED
|
@@ -5,15 +5,26 @@ const { rimraf } = require('rimraf')
|
|
|
5
5
|
const path = require("path")
|
|
6
6
|
class Git {
|
|
7
7
|
cmd() {
|
|
8
|
-
|
|
8
|
+
if (this.kernel.platform === "darwin") {
|
|
9
|
+
return "git git-lfs"
|
|
10
|
+
} else {
|
|
11
|
+
return "git git-lfs gh"
|
|
12
|
+
}
|
|
9
13
|
}
|
|
10
14
|
async install(req, ondata) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
15
|
+
if (this.kernel.platform === "darwin") {
|
|
16
|
+
await this.kernel.bin.exec({
|
|
17
|
+
conda: { skip: true },
|
|
18
|
+
message: "brew install gh",
|
|
19
|
+
}, ondata)
|
|
20
|
+
} else {
|
|
21
|
+
await this.kernel.bin.exec({
|
|
22
|
+
message: [
|
|
23
|
+
"conda clean -y --all",
|
|
24
|
+
`conda install -y -c conda-forge ${this.cmd()}`
|
|
25
|
+
]
|
|
26
|
+
}, ondata)
|
|
27
|
+
}
|
|
17
28
|
await fs.promises.mkdir(this.kernel.path("config/gh"), { recursive: true }).catch((e) => { })
|
|
18
29
|
// if (this.kernel.platform === 'win32') {
|
|
19
30
|
// let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
|
|
@@ -29,11 +40,26 @@ class Git {
|
|
|
29
40
|
// }
|
|
30
41
|
}
|
|
31
42
|
async installed() {
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
if (this.kernel.platform === "darwin") {
|
|
44
|
+
let gh_config_exists = await this.kernel.exists("config/gh")
|
|
45
|
+
console.log("conda installed", this.kernel.bin.installed.conda)
|
|
46
|
+
return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.brew.has("gh") && gh_config_exists
|
|
47
|
+
} else {
|
|
48
|
+
let gh_config_exists = await this.kernel.exists("config/gh")
|
|
49
|
+
console.log("conda installed", this.kernel.bin.installed.conda)
|
|
50
|
+
return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && gh_config_exists
|
|
51
|
+
}
|
|
34
52
|
}
|
|
35
53
|
async uninstall(req, ondata) {
|
|
36
|
-
|
|
54
|
+
if (this.kernel.platform === "darwin") {
|
|
55
|
+
await this.kernel.bin.exec({ message: "conda remove git" }, ondata)
|
|
56
|
+
await this.kernel.bin.exec({
|
|
57
|
+
conda: { skip: true },
|
|
58
|
+
message: "brew uninstall gh",
|
|
59
|
+
})
|
|
60
|
+
} else {
|
|
61
|
+
await this.kernel.bin.exec({ message: "conda remove git gh" }, ondata)
|
|
62
|
+
}
|
|
37
63
|
}
|
|
38
64
|
env() {
|
|
39
65
|
let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
|
package/kernel/bin/index.js
CHANGED
|
@@ -56,7 +56,6 @@ class Bin {
|
|
|
56
56
|
params.cols = this.client.cols
|
|
57
57
|
params.rows = this.client.rows
|
|
58
58
|
}
|
|
59
|
-
console.log({ params })
|
|
60
59
|
let response = await this.kernel.shell.run(params, null, ondata)
|
|
61
60
|
return response
|
|
62
61
|
}
|
|
@@ -360,17 +359,12 @@ class Bin {
|
|
|
360
359
|
conda_versions[name] = version
|
|
361
360
|
if (name === "conda") {
|
|
362
361
|
conda_check.conda = true
|
|
363
|
-
// //if (String(version) === "24.11.1") {
|
|
364
|
-
// if (String(version) === "24.11.3") {
|
|
365
|
-
// conda_check.conda = true
|
|
366
|
-
// }
|
|
367
362
|
}
|
|
368
363
|
if (name === "conda-libmamba-solver") {
|
|
369
364
|
//if (String(version) === "24.7.0") {
|
|
370
365
|
let channel = chunks[3]
|
|
371
366
|
let coerced = semver.coerce(version)
|
|
372
367
|
let mamba_requirement = ">=24.11.1"
|
|
373
|
-
// console.log({ name, channel, version })
|
|
374
368
|
//if (semver.satisfies(coerced, mamba_requirement) && channel === "conda-forge") {
|
|
375
369
|
if (semver.satisfies(coerced, mamba_requirement)) {
|
|
376
370
|
conda_check.mamba = true
|
|
@@ -382,16 +376,6 @@ class Bin {
|
|
|
382
376
|
if (String(version) === "3.47.2") {
|
|
383
377
|
conda_check.sqlite = true
|
|
384
378
|
}
|
|
385
|
-
// let coerced = semver.coerce(version)
|
|
386
|
-
// let sqlite_requirement = ">=3.47.2"
|
|
387
|
-
// // console.log({ coerced, version, sqlite_requirement })
|
|
388
|
-
// if (semver.satisfies(coerced, sqlite_requirement)) {
|
|
389
|
-
// console.log("semver satisfied")
|
|
390
|
-
//
|
|
391
|
-
// conda_check.sqlite = true
|
|
392
|
-
// } else {
|
|
393
|
-
// console.log("semver NOT satisfied")
|
|
394
|
-
// }
|
|
395
379
|
}
|
|
396
380
|
}
|
|
397
381
|
} else {
|
|
@@ -443,15 +427,12 @@ class Bin {
|
|
|
443
427
|
|
|
444
428
|
let brew_path = path.resolve(this.kernel.homedir, "bin", "homebrew")
|
|
445
429
|
let brew_exists = await this.exists(brew_path)
|
|
446
|
-
// console.log({ brew_path, brew_exists })
|
|
447
430
|
|
|
448
431
|
let brew = []
|
|
449
432
|
if (brew_exists) {
|
|
450
433
|
start = false
|
|
451
434
|
res = await this.exec({ message: `brew list -1`, conda: { skip: true } }, (stream) => {
|
|
452
|
-
// console.log("brew list check", { stream })
|
|
453
435
|
})
|
|
454
|
-
// console.log("BREW", res.response)
|
|
455
436
|
lines = res.response.split(/[\r\n]+/).slice(0, -1) // ignore last line since it's the prompt
|
|
456
437
|
let end = false
|
|
457
438
|
for(let line of lines) {
|
|
@@ -475,7 +456,6 @@ class Bin {
|
|
|
475
456
|
|
|
476
457
|
|
|
477
458
|
// check brew_installed
|
|
478
|
-
// console.log("checking brew installed")
|
|
479
459
|
let e = await this.kernel.bin.exists("homebrew")
|
|
480
460
|
let { stdout }= await this.exec({ message: "xcode-select -p", conda: { skip: true } }, (stream) => { })
|
|
481
461
|
let e2 = /(.*Library.*Developer.*CommandLineTools.*|.*Xcode.*Developer.*)/gi.test(stdout)
|
|
@@ -666,6 +646,7 @@ class Bin {
|
|
|
666
646
|
this.client = null
|
|
667
647
|
}
|
|
668
648
|
let requirements = JSON.parse(req.params)
|
|
649
|
+
console.log({ requirements })
|
|
669
650
|
for(let x=0; x<10; x++) {
|
|
670
651
|
console.log(`## Install Attempt ${x}`)
|
|
671
652
|
let i = 0;
|
|
@@ -975,6 +956,8 @@ class Bin {
|
|
|
975
956
|
let dependencies
|
|
976
957
|
if (r.name === "conda") {
|
|
977
958
|
dependencies = config.bin.conda_requirements
|
|
959
|
+
console.log("check dependencies", dependencies)
|
|
960
|
+
requirements[i].dependencies = dependencies
|
|
978
961
|
}
|
|
979
962
|
let installed = await this.check_installed(r, dependencies)
|
|
980
963
|
requirements[i].installed = installed
|
package/kernel/prototype.js
CHANGED
|
@@ -30,7 +30,7 @@ class Proto {
|
|
|
30
30
|
let proto = path.dirname(prototype_path)
|
|
31
31
|
let pinokiojs = path.resolve(prototype_dir, prototype_path)
|
|
32
32
|
let config = await this.kernel.require(pinokiojs)
|
|
33
|
-
if (config && config.
|
|
33
|
+
if (config && config.run) {
|
|
34
34
|
if (config.icon) {
|
|
35
35
|
config.icon = "/prototype/" + proto + "/" + config.icon
|
|
36
36
|
} else {
|
package/kernel/shell.js
CHANGED