pinokiod 1.1.12 → 1.1.14
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/shell.js +17 -2
- package/package.json +1 -1
- package/server/index.js +33 -15
- package/server/views/settings.ejs +87 -2
package/kernel/shell.js
CHANGED
|
@@ -469,6 +469,9 @@ class Shell {
|
|
|
469
469
|
// using the base env
|
|
470
470
|
params.message = [
|
|
471
471
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
472
|
+
`conda deactivate`,
|
|
473
|
+
`conda deactivate`,
|
|
474
|
+
`conda deactivate`,
|
|
472
475
|
`conda activate ${params.conda}`,
|
|
473
476
|
].concat(params.message)
|
|
474
477
|
} else {
|
|
@@ -479,13 +482,19 @@ class Shell {
|
|
|
479
482
|
params.message = [
|
|
480
483
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
481
484
|
//`conda activate ${params.conda}`,
|
|
485
|
+
`conda deactivate`,
|
|
486
|
+
`conda deactivate`,
|
|
487
|
+
`conda deactivate`,
|
|
482
488
|
`conda activate ${env_path}`,
|
|
483
489
|
].concat(params.message)
|
|
484
490
|
} else {
|
|
485
491
|
params.message = [
|
|
486
492
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
487
|
-
`conda create -y -p ${env_path}`,
|
|
493
|
+
`conda create -y -p ${env_path} python=3.10`,
|
|
488
494
|
//`conda activate ${params.conda}`,
|
|
495
|
+
`conda deactivate`,
|
|
496
|
+
`conda deactivate`,
|
|
497
|
+
`conda deactivate`,
|
|
489
498
|
`conda activate ${env_path}`,
|
|
490
499
|
].concat(params.message)
|
|
491
500
|
}
|
|
@@ -495,6 +504,9 @@ class Shell {
|
|
|
495
504
|
if (env_exists) {
|
|
496
505
|
params.message = [
|
|
497
506
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
507
|
+
`conda deactivate`,
|
|
508
|
+
`conda deactivate`,
|
|
509
|
+
`conda deactivate`,
|
|
498
510
|
`conda activate ${env_path}`,
|
|
499
511
|
].concat(params.message)
|
|
500
512
|
} else {
|
|
@@ -502,11 +514,14 @@ class Shell {
|
|
|
502
514
|
if (params.conda.python) {
|
|
503
515
|
create_command = `conda create -y -p ${env_path} python=${params.conda.python}`
|
|
504
516
|
} else {
|
|
505
|
-
create_command = `conda create -y -p ${env_path}`
|
|
517
|
+
create_command = `conda create -y -p ${env_path} python=3.10`
|
|
506
518
|
}
|
|
507
519
|
params.message = [
|
|
508
520
|
(this.platform === 'win32' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
509
521
|
create_command,
|
|
522
|
+
`conda deactivate`,
|
|
523
|
+
`conda deactivate`,
|
|
524
|
+
`conda deactivate`,
|
|
510
525
|
`conda activate ${env_path}`,
|
|
511
526
|
].concat(params.message)
|
|
512
527
|
}
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -345,7 +345,10 @@ class Server {
|
|
|
345
345
|
} else if (pathComponents.length === 0 && req.query.mode === "settings") {
|
|
346
346
|
let configArray = [{
|
|
347
347
|
key: "home",
|
|
348
|
-
description:
|
|
348
|
+
description: [
|
|
349
|
+
"* Do NOT use a path that includes white spaces (' ').",
|
|
350
|
+
"* Do NOT use exFAT drives.",
|
|
351
|
+
],
|
|
349
352
|
val: this.kernel.homedir,
|
|
350
353
|
placeholder: "Enter the absolute path to use as your Pinokio home folder (D:\\pinokio, /Users/alice/pinokiofs, etc.)"
|
|
351
354
|
}, {
|
|
@@ -1660,7 +1663,10 @@ class Server {
|
|
|
1660
1663
|
if (req.query.mode === 'settings') {
|
|
1661
1664
|
let configArray = [{
|
|
1662
1665
|
key: "home",
|
|
1663
|
-
description:
|
|
1666
|
+
description: [
|
|
1667
|
+
"* Do NOT use a path that includes white spaces (' ').",
|
|
1668
|
+
"* Do NOT use exFAT drives.",
|
|
1669
|
+
],
|
|
1664
1670
|
val: this.kernel.homedir ? this.kernel.homedir : path.resolve(os.homedir(), "pinokio"),
|
|
1665
1671
|
placeholder: "Enter the absolute path to use as your Pinokio home folder (D:\\pinokio, /Users/alice/pinokiofs, etc.)"
|
|
1666
1672
|
}, {
|
|
@@ -1914,19 +1920,31 @@ class Server {
|
|
|
1914
1920
|
})
|
|
1915
1921
|
})
|
|
1916
1922
|
this.app.post("/pinokio/delete", async (req, res) => {
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1923
|
+
try {
|
|
1924
|
+
if (req.body.type === 'bin') {
|
|
1925
|
+
let folderPath = this.kernel.path("bin")
|
|
1926
|
+
console.log("del folderPath", folderPath)
|
|
1927
|
+
await fse.remove(folderPath)
|
|
1928
|
+
res.json({ success: true })
|
|
1929
|
+
} else if (req.body.type === 'cache') {
|
|
1930
|
+
let folderPath = this.kernel.path("cache")
|
|
1931
|
+
console.log("del folderPath", folderPath)
|
|
1932
|
+
await fse.remove(folderPath)
|
|
1933
|
+
res.json({ success: true })
|
|
1934
|
+
} else if (req.body.name) {
|
|
1935
|
+
let folderPath = this.kernel.path("api", req.body.name)
|
|
1936
|
+
console.log("delete", folderPath)
|
|
1937
|
+
await fse.remove(folderPath)
|
|
1938
|
+
await new Promise((resolve, reject) => {
|
|
1939
|
+
setTimeout(() => {
|
|
1940
|
+
resolve()
|
|
1941
|
+
}, 5000)
|
|
1942
|
+
})
|
|
1943
|
+
console.log("deleted")
|
|
1944
|
+
res.json({ success: true })
|
|
1945
|
+
}
|
|
1946
|
+
} catch(err) {
|
|
1947
|
+
res.json({ error: err.stack })
|
|
1930
1948
|
}
|
|
1931
1949
|
})
|
|
1932
1950
|
// this.app.get("/pinokio/shell_state", (req, res) => {
|
|
@@ -70,17 +70,21 @@
|
|
|
70
70
|
text-transform: uppercase;
|
|
71
71
|
letter-spacing: 0;
|
|
72
72
|
}
|
|
73
|
+
.item > .d {
|
|
74
|
+
padding-bottom: 10px;
|
|
75
|
+
}
|
|
73
76
|
.item button {
|
|
74
77
|
padding: 10px 20px;
|
|
75
78
|
}
|
|
76
79
|
.item label {
|
|
77
80
|
display: block;
|
|
78
|
-
text-transform:
|
|
81
|
+
text-transform: capitalize;
|
|
79
82
|
font-size: 20px;
|
|
80
83
|
font-weight: bold;
|
|
81
84
|
padding-bottom: 5px;
|
|
82
85
|
}
|
|
83
86
|
.item .explanation {
|
|
87
|
+
white-space: pre;
|
|
84
88
|
padding-top: 5px;
|
|
85
89
|
color: brown;
|
|
86
90
|
font-size: 14px;
|
|
@@ -160,6 +164,16 @@ header .home {
|
|
|
160
164
|
color: var(--light-color);
|
|
161
165
|
padding: 10px;
|
|
162
166
|
}
|
|
167
|
+
body.dark hr {
|
|
168
|
+
background: white;
|
|
169
|
+
}
|
|
170
|
+
hr {
|
|
171
|
+
opacity: 0.03;
|
|
172
|
+
background: black;
|
|
173
|
+
margin: 50px 0;
|
|
174
|
+
height: 1px;
|
|
175
|
+
border: none;
|
|
176
|
+
}
|
|
163
177
|
</style>
|
|
164
178
|
<script src="/hotkeys.min.js"></script>
|
|
165
179
|
<script src="/sweetalert2.js"></script>
|
|
@@ -240,7 +254,13 @@ header .home {
|
|
|
240
254
|
<% } %>
|
|
241
255
|
<% } %>
|
|
242
256
|
<% if (c.description) { %>
|
|
243
|
-
|
|
257
|
+
<% if (Array.isArray(c.description)) { %>
|
|
258
|
+
<% c.description.forEach((d) => { %>
|
|
259
|
+
<div class='explanation'><%=d%></div>
|
|
260
|
+
<% }) %>
|
|
261
|
+
<% } else { %>
|
|
262
|
+
<div class='explanation'><%=c.description%></div>
|
|
263
|
+
<% } %>
|
|
244
264
|
<% } %>
|
|
245
265
|
</div>
|
|
246
266
|
<% }) %>
|
|
@@ -250,6 +270,29 @@ header .home {
|
|
|
250
270
|
<div class='loading hidden'>
|
|
251
271
|
<i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
|
|
252
272
|
</div>
|
|
273
|
+
<hr/>
|
|
274
|
+
<div class='troubleshoot'>
|
|
275
|
+
<h1>Troubleshoot</h1>
|
|
276
|
+
<br>
|
|
277
|
+
<br>
|
|
278
|
+
<div class='item'>
|
|
279
|
+
<label>Reset bin</label>
|
|
280
|
+
<div class='d'>Reset the bin folder and start fresh from scratch</div>
|
|
281
|
+
<div class='reset-bin-loading hidden'>
|
|
282
|
+
<i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
|
|
283
|
+
</div>
|
|
284
|
+
<div><button class='btn' id='del-bin'>Reset</button></div>
|
|
285
|
+
</div>
|
|
286
|
+
<div class='item'>
|
|
287
|
+
<label>Reset cache</label>
|
|
288
|
+
<div class='d'>Reset the cache folder and start fresh from scratch</div>
|
|
289
|
+
<div class='reset-cache-loading hidden'>
|
|
290
|
+
<i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
|
|
291
|
+
</div>
|
|
292
|
+
<div><button class='btn' id='del-cache'>Reset</button></div>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
<hr/>
|
|
253
296
|
</div>
|
|
254
297
|
</div>
|
|
255
298
|
</main>
|
|
@@ -257,6 +300,48 @@ header .home {
|
|
|
257
300
|
document.addEventListener("DOMContentLoaded", async () => {
|
|
258
301
|
Reporter()
|
|
259
302
|
const n = new N()
|
|
303
|
+
document.querySelector("#del-bin").addEventListener("click", async (e) => {
|
|
304
|
+
console.log("del-bin")
|
|
305
|
+
document.querySelector(".reset-bin-loading").classList.remove("hidden")
|
|
306
|
+
document.querySelector("#del-bin").classList.add("hidden")
|
|
307
|
+
let res = await fetch("/pinokio/delete", {
|
|
308
|
+
method: "post",
|
|
309
|
+
headers: {
|
|
310
|
+
"Content-Type": "application/json"
|
|
311
|
+
},
|
|
312
|
+
body: JSON.stringify({ type: "bin" })
|
|
313
|
+
}).then((res) => {
|
|
314
|
+
return res.json()
|
|
315
|
+
})
|
|
316
|
+
console.log(res)
|
|
317
|
+
document.querySelector(".reset-bin-loading").classList.add("hidden")
|
|
318
|
+
if (res.error) {
|
|
319
|
+
alert(res.error)
|
|
320
|
+
} else {
|
|
321
|
+
location.href = location.href
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
document.querySelector("#del-cache").addEventListener("click", async (e) => {
|
|
325
|
+
console.log("del-cache")
|
|
326
|
+
document.querySelector(".reset-cache-loading").classList.remove("hidden")
|
|
327
|
+
document.querySelector("#del-cache").classList.add("hidden")
|
|
328
|
+
let res = await fetch("/pinokio/delete", {
|
|
329
|
+
method: "post",
|
|
330
|
+
headers: {
|
|
331
|
+
"Content-Type": "application/json"
|
|
332
|
+
},
|
|
333
|
+
body: JSON.stringify({ type: "cache" })
|
|
334
|
+
}).then((res) => {
|
|
335
|
+
return res.json()
|
|
336
|
+
})
|
|
337
|
+
console.log(res)
|
|
338
|
+
document.querySelector(".reset-cache-loading").classList.add("hidden")
|
|
339
|
+
if (res.error) {
|
|
340
|
+
alert(res.error)
|
|
341
|
+
} else {
|
|
342
|
+
location.href = location.href
|
|
343
|
+
}
|
|
344
|
+
})
|
|
260
345
|
document.querySelector("form").addEventListener("submit", async (e) => {
|
|
261
346
|
e.preventDefault()
|
|
262
347
|
e.stopPropagation()
|