pinokiod 2.15.88 → 2.15.89
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/bin/conda.js +0 -4
- package/kernel/index.js +0 -7
- package/kernel/shell.js +0 -10
- package/kernel/util.js +3 -53
- package/package.json +1 -4
- package/server/index.js +0 -22
- package/server/public/browser.css +2 -0
- package/server/views/browser.ejs +1 -0
package/kernel/bin/conda.js
CHANGED
|
@@ -140,7 +140,6 @@ create_default_packages:
|
|
|
140
140
|
}, (stream) => {
|
|
141
141
|
ondata(stream)
|
|
142
142
|
})
|
|
143
|
-
console.log(">>>>>>>>>> Finished 'conda update-y --all'")
|
|
144
143
|
if (this.kernel.platform === "win32") {
|
|
145
144
|
// copy python.exe to python3.exe so you can run with both python3 and python
|
|
146
145
|
await fs.promises.copyFile(
|
|
@@ -148,10 +147,8 @@ create_default_packages:
|
|
|
148
147
|
this.kernel.bin.path("miniconda", "python3.exe"),
|
|
149
148
|
)
|
|
150
149
|
}
|
|
151
|
-
console.log(">>>>>>>>>> Finished 'copyFile'")
|
|
152
150
|
ondata({ raw: `Install finished\r\n` })
|
|
153
151
|
await this.kernel.bin.rm(installer, ondata)
|
|
154
|
-
console.log(">>>>>>>>>> RM Finished")
|
|
155
152
|
}
|
|
156
153
|
async exists(pattern) {
|
|
157
154
|
let paths = this.paths[this.kernel.platform]
|
|
@@ -171,7 +168,6 @@ create_default_packages:
|
|
|
171
168
|
let e
|
|
172
169
|
for(let p of this.paths[this.kernel.platform]) {
|
|
173
170
|
let e = await this.kernel.bin.exists(p)
|
|
174
|
-
console.log("checking installed", { p, e })
|
|
175
171
|
if (e) return true
|
|
176
172
|
}
|
|
177
173
|
return false
|
package/kernel/index.js
CHANGED
|
@@ -337,18 +337,14 @@ class Kernel {
|
|
|
337
337
|
|
|
338
338
|
// let contents = await fs.promises.readdir(this.homedir)
|
|
339
339
|
//await this.bin.init()
|
|
340
|
-
console.log("> bin.init()")
|
|
341
340
|
this.bin.init()
|
|
342
|
-
console.log("> api.init()")
|
|
343
341
|
await this.api.init()
|
|
344
|
-
console.log("> shell.init()")
|
|
345
342
|
|
|
346
343
|
//await this.shell.init()
|
|
347
344
|
this.shell.init()
|
|
348
345
|
|
|
349
346
|
if (this.homedir) {
|
|
350
347
|
this.sys = new Sysinfo()
|
|
351
|
-
console.log("> sys.init()")
|
|
352
348
|
await this.sys.init(this)
|
|
353
349
|
let info = this.sys.info
|
|
354
350
|
await fs.promises.mkdir(this.path("logs"), { recursive: true }).catch((e) => { })
|
|
@@ -359,7 +355,6 @@ class Kernel {
|
|
|
359
355
|
...info
|
|
360
356
|
}, null, 2))
|
|
361
357
|
this.sysinfo = info
|
|
362
|
-
console.log("> template.init()")
|
|
363
358
|
await this.template.init({
|
|
364
359
|
kernel: this,
|
|
365
360
|
system,
|
|
@@ -372,7 +367,6 @@ class Kernel {
|
|
|
372
367
|
},
|
|
373
368
|
...info
|
|
374
369
|
})
|
|
375
|
-
console.log("> update_sysinfo")
|
|
376
370
|
await this.update_sysinfo()
|
|
377
371
|
}
|
|
378
372
|
|
|
@@ -385,7 +379,6 @@ class Kernel {
|
|
|
385
379
|
}
|
|
386
380
|
process.env.PLAYWRIGHT_BROWSERS_PATH = this.bin.path("playwright/browsers")
|
|
387
381
|
this.playwright = (await this.loader.load(pwpath)).resolved
|
|
388
|
-
console.log("Kernel.init finished")
|
|
389
382
|
|
|
390
383
|
// await this.template.init()
|
|
391
384
|
|
package/kernel/shell.js
CHANGED
|
@@ -539,8 +539,6 @@ class Shell {
|
|
|
539
539
|
if (env_exists) {
|
|
540
540
|
conda_activation = [
|
|
541
541
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
542
|
-
// `conda deactivate`,
|
|
543
|
-
// `conda deactivate`,
|
|
544
542
|
`conda deactivate`,
|
|
545
543
|
`conda activate ${env_path}`,
|
|
546
544
|
]
|
|
@@ -548,8 +546,6 @@ class Shell {
|
|
|
548
546
|
conda_activation = [
|
|
549
547
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
550
548
|
`conda create -y -p ${env_path} ${conda_python} ${conda_args ? conda_args : ''}`,
|
|
551
|
-
// `conda deactivate`,
|
|
552
|
-
// `conda deactivate`,
|
|
553
549
|
`conda deactivate`,
|
|
554
550
|
`conda activate ${env_path}`,
|
|
555
551
|
]
|
|
@@ -558,8 +554,6 @@ class Shell {
|
|
|
558
554
|
if (conda_name === "base") {
|
|
559
555
|
conda_activation = [
|
|
560
556
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
561
|
-
// `conda deactivate`,
|
|
562
|
-
// `conda deactivate`,
|
|
563
557
|
`conda deactivate`,
|
|
564
558
|
`conda activate ${conda_name}`,
|
|
565
559
|
]
|
|
@@ -570,8 +564,6 @@ class Shell {
|
|
|
570
564
|
if (env_exists) {
|
|
571
565
|
conda_activation = [
|
|
572
566
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
573
|
-
// `conda deactivate`,
|
|
574
|
-
// `conda deactivate`,
|
|
575
567
|
`conda deactivate`,
|
|
576
568
|
`conda activate ${conda_name}`,
|
|
577
569
|
]
|
|
@@ -579,8 +571,6 @@ class Shell {
|
|
|
579
571
|
conda_activation = [
|
|
580
572
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
581
573
|
`conda create -y -n ${conda_name} ${conda_python} ${conda_args ? conda_args : ''}`,
|
|
582
|
-
// `conda deactivate`,
|
|
583
|
-
// `conda deactivate`,
|
|
584
574
|
`conda deactivate`,
|
|
585
575
|
`conda activate ${conda_name}`,
|
|
586
576
|
]
|
package/kernel/util.js
CHANGED
|
@@ -15,12 +15,6 @@ const returnPattern = /\r/g;
|
|
|
15
15
|
const returnReplacement = "\\r";
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
const { promisify } = require('util')
|
|
19
|
-
const fastFolderSize = require('fast-folder-size')
|
|
20
|
-
|
|
21
|
-
//const { fdir } = require("fdir");
|
|
22
|
-
const { getDirSize, getDirSizeSync } = require('fast-dir-size')
|
|
23
|
-
|
|
24
18
|
// asar handling for go-get-folder-size
|
|
25
19
|
let g
|
|
26
20
|
if( __dirname.includes(".asar") ) {
|
|
@@ -30,54 +24,13 @@ if( __dirname.includes(".asar") ) {
|
|
|
30
24
|
g = require('go-get-folder-size');
|
|
31
25
|
}
|
|
32
26
|
const { getFolderSize, getFolderSizeBin, getFolderSizeWasm, } = g
|
|
33
|
-
|
|
34
|
-
const fastFolderSizeAsync = promisify(fastFolderSize)
|
|
35
|
-
|
|
36
27
|
const du = async (folderpath) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let totalSize
|
|
41
|
-
|
|
42
|
-
// console.time("1")
|
|
43
|
-
// totalSize = await fastFolderSizeAsync(folderpath)
|
|
44
|
-
// console.timeEnd("1")
|
|
45
|
-
//
|
|
46
|
-
//// console.time(folderpath)
|
|
47
|
-
// console.time("2")
|
|
48
|
-
// totalSize = await getDirSize(folderpath)
|
|
49
|
-
// console.timeEnd("2")
|
|
50
|
-
//// console.log({ totalSize })
|
|
51
|
-
|
|
52
|
-
console.time("3")
|
|
53
|
-
totalSize = await getFolderSizeBin(folderpath)
|
|
54
|
-
console.timeEnd("3")
|
|
28
|
+
console.time("disk size calc")
|
|
29
|
+
let totalSize = await getFolderSizeBin(folderpath)
|
|
30
|
+
console.timeEnd("disk size calc")
|
|
55
31
|
console.log("totalSize", totalSize)
|
|
56
|
-
|
|
57
|
-
// console.time(folderpath + 2)
|
|
58
|
-
// const api = new fdir().withFullPaths().crawl(folderpath);
|
|
59
|
-
// const files = api.sync();
|
|
60
|
-
//
|
|
61
|
-
// totalSize = 0;
|
|
62
|
-
//
|
|
63
|
-
// for (const file of files) {
|
|
64
|
-
// try {
|
|
65
|
-
// const stats = await fs.promises.stat(file);
|
|
66
|
-
// if (stats.isFile()) {
|
|
67
|
-
// totalSize += stats.size; // Add file size in bytes
|
|
68
|
-
// }
|
|
69
|
-
// } catch (err) {
|
|
70
|
-
// console.error(`Error reading file: ${file}`, err);
|
|
71
|
-
// }
|
|
72
|
-
// }
|
|
73
|
-
// console.timeEnd(folderpath + 2)
|
|
74
|
-
// console.log({ totalSize })
|
|
75
|
-
//
|
|
76
32
|
return totalSize;
|
|
77
33
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
34
|
const port_running = async (host, port) => {
|
|
82
35
|
const timeout = 1000
|
|
83
36
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -193,11 +146,8 @@ const parse_env_detail = async (filename) => {
|
|
|
193
146
|
const log_path = (fullpath, kernel) => {
|
|
194
147
|
let api_path = `${kernel.homedir}${path.sep}api`
|
|
195
148
|
let rel_path = path.relative(api_path, fullpath)
|
|
196
|
-
console.log({ rel_path })
|
|
197
149
|
let log_root = `${kernel.homedir}${path.sep}logs`
|
|
198
|
-
console.log({ log_root })
|
|
199
150
|
let current_log_path = path.resolve(log_root, "shell/cleaned/api", rel_path)
|
|
200
|
-
console.log({ current_log_path })
|
|
201
151
|
return current_log_path
|
|
202
152
|
}
|
|
203
153
|
const api_path = (fullpath, kernel) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinokiod",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.89",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,10 +27,7 @@
|
|
|
27
27
|
"express-http-proxy-cp": "^2.0.3",
|
|
28
28
|
"express-session": "^1.17.3",
|
|
29
29
|
"fake-useragent": "^1.0.1",
|
|
30
|
-
"fast-dir-size": "^1.3.0",
|
|
31
|
-
"fast-folder-size": "^2.3.0",
|
|
32
30
|
"fastq": "^1.15.0",
|
|
33
|
-
"fdir": "^6.4.2",
|
|
34
31
|
"fs-extra": "^11.1.1",
|
|
35
32
|
"glob": "^10.3.3",
|
|
36
33
|
"glob-gitignore": "^1.0.14",
|
package/server/index.js
CHANGED
|
@@ -1965,19 +1965,15 @@ class Server {
|
|
|
1965
1965
|
let new_home = this.kernel.store.get("new_home")
|
|
1966
1966
|
}
|
|
1967
1967
|
async startLogging() {
|
|
1968
|
-
console.log("> startLogging", {debug: this.debug, homedir: this.kernel.homedir})
|
|
1969
1968
|
if (!this.debug) {
|
|
1970
1969
|
if (this.logInterval) {
|
|
1971
1970
|
clearInterval(this.logInterval)
|
|
1972
1971
|
}
|
|
1973
1972
|
if (this.kernel.homedir) {
|
|
1974
1973
|
let exists = await this.exists(this.kernel.homedir)
|
|
1975
|
-
console.log({ exists })
|
|
1976
1974
|
if (exists) {
|
|
1977
1975
|
let logsdir = path.resolve(this.kernel.homedir, "logs")
|
|
1978
|
-
console.log({ logsdir })
|
|
1979
1976
|
await fs.promises.mkdir(logsdir, { recursive: true }).catch((e) => { })
|
|
1980
|
-
console.log("this.log", this.log)
|
|
1981
1977
|
if (!this.log) {
|
|
1982
1978
|
this.log = fs.createWriteStream(path.resolve(this.kernel.homedir, "logs/stdout.txt"))
|
|
1983
1979
|
process.stdout.write = process.stderr.write = this.log.write.bind(this.log)
|
|
@@ -2076,16 +2072,8 @@ class Server {
|
|
|
2076
2072
|
let str = await Environment.ENV("system", this.kernel.homedir)
|
|
2077
2073
|
await fs.promises.writeFile(path.resolve(this.homedir, "ENVIRONMENT"), str)
|
|
2078
2074
|
}
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
// let env = await Environment.get(this.kernel.homedir)
|
|
2083
|
-
// if (env && env.PINOKIO_PORT) {
|
|
2084
|
-
// this.port = env.PINOKIO_PORT
|
|
2085
|
-
// }
|
|
2086
2075
|
}
|
|
2087
2076
|
|
|
2088
|
-
console.log("using port", this.port)
|
|
2089
2077
|
|
|
2090
2078
|
|
|
2091
2079
|
// start proxy for Pinokio itself
|
|
@@ -2102,9 +2090,7 @@ class Server {
|
|
|
2102
2090
|
// });
|
|
2103
2091
|
// }
|
|
2104
2092
|
// }
|
|
2105
|
-
console.log("Before startLogging")
|
|
2106
2093
|
await this.startLogging()
|
|
2107
|
-
console.log("After startLogging")
|
|
2108
2094
|
|
|
2109
2095
|
// check version from this.store
|
|
2110
2096
|
let version = this.kernel.store.get("version")
|
|
@@ -2151,28 +2137,22 @@ class Server {
|
|
|
2151
2137
|
origin: '*'
|
|
2152
2138
|
}));
|
|
2153
2139
|
|
|
2154
|
-
console.log(">> 00")
|
|
2155
2140
|
if (this.kernel.homedir) {
|
|
2156
2141
|
this.app.use(express.static(this.kernel.path("web/public")))
|
|
2157
2142
|
}
|
|
2158
|
-
console.log(">> 01")
|
|
2159
2143
|
this.app.use(express.static(path.resolve(__dirname, 'public')));
|
|
2160
2144
|
this.app.use("/web", express.static(path.resolve(__dirname, "..", "..", "web")))
|
|
2161
2145
|
this.app.set('view engine', 'ejs');
|
|
2162
|
-
console.log(">> 1")
|
|
2163
2146
|
if (this.kernel.homedir) {
|
|
2164
|
-
console.log(">> 2")
|
|
2165
2147
|
this.app.set("views", [
|
|
2166
2148
|
this.kernel.path("web/views"),
|
|
2167
2149
|
path.resolve(__dirname, "views")
|
|
2168
2150
|
])
|
|
2169
2151
|
} else {
|
|
2170
|
-
console.log(">> 3")
|
|
2171
2152
|
this.app.set("views", [
|
|
2172
2153
|
path.resolve(__dirname, "views")
|
|
2173
2154
|
])
|
|
2174
2155
|
}
|
|
2175
|
-
console.log(">> 4")
|
|
2176
2156
|
this.app.use(express.json());
|
|
2177
2157
|
this.app.use(express.urlencoded({ extended: true }));
|
|
2178
2158
|
this.app.use(cookieParser());
|
|
@@ -2392,7 +2372,6 @@ class Server {
|
|
|
2392
2372
|
})
|
|
2393
2373
|
}))
|
|
2394
2374
|
this.app.get("/getlog", ex(async (req, res) => {
|
|
2395
|
-
console.log("query", req.query)
|
|
2396
2375
|
let str = await fs.promises.readFile(req.query.logpath, "utf8")
|
|
2397
2376
|
res.send(str)
|
|
2398
2377
|
}))
|
|
@@ -3284,7 +3263,6 @@ class Server {
|
|
|
3284
3263
|
// install
|
|
3285
3264
|
this.server = httpserver.createServer(this.app);
|
|
3286
3265
|
this.socket = new Socket(this)
|
|
3287
|
-
console.log(">> 100")
|
|
3288
3266
|
await new Promise((resolve, reject) => {
|
|
3289
3267
|
this.listening = this.server.listen(this.port, () => {
|
|
3290
3268
|
console.log(`Server listening on port ${this.port}`)
|
package/server/views/browser.ejs
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
<link href="/markdown.css" rel="stylesheet"/>
|
|
11
11
|
<link href="/noty.css" rel="stylesheet"/>
|
|
12
12
|
<link href="/style.css" rel="stylesheet"/>
|
|
13
|
+
<link href="/browser.css" rel="stylesheet"/>
|
|
13
14
|
<script src="/hotkeys.min.js"></script>
|
|
14
15
|
<script src="/sweetalert2.js"></script>
|
|
15
16
|
<script src="/nav.js"></script>
|