pinokiod 1.3.78 → 1.3.79
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/fs/index.js +1 -9
- package/kernel/api/local/index.js +1 -4
- package/kernel/bin/conda.js +1 -1
- package/kernel/environment.js +5 -6
- package/kernel/index.js +1 -4
- package/package.json +1 -1
- package/server/index.js +15 -3
- package/server/views/browser-experimental.ejs +3 -1
- package/server/views/fullscreen_editor.ejs +5 -1
- package/server/views/index.ejs +6 -0
package/kernel/api/fs/index.js
CHANGED
|
@@ -13,7 +13,6 @@ const Environment = require("../../environment")
|
|
|
13
13
|
const Util = require("../../util")
|
|
14
14
|
|
|
15
15
|
const log = (msgs, ondata) => {
|
|
16
|
-
console.log("# LOG")
|
|
17
16
|
for(let msg of msgs) {
|
|
18
17
|
if (typeof msg === "object") {
|
|
19
18
|
msg = JSON.stringify(msg, null, 2).replace(/\n/g, "\r\n")
|
|
@@ -131,10 +130,7 @@ class FS {
|
|
|
131
130
|
|
|
132
131
|
|
|
133
132
|
// start with the proces.env => merge pinokio global ENVIRONMENT => merge app ENVIRONMENT
|
|
134
|
-
let
|
|
135
|
-
let api_path = Util.api_path(req.parent.path, kernel)
|
|
136
|
-
let api_env = await Environment.get(api_path)
|
|
137
|
-
let current_env = Object.assign(process.env, default_env, api_env)
|
|
133
|
+
let current_env = await Environment.get2(req.parent.path)
|
|
138
134
|
|
|
139
135
|
// if PINOKIO_DRIVE environment variable is specified, use this custom value for the drive path instead of ~/pinokio/drive
|
|
140
136
|
let env_drive_path = current_env.PINOKIO_DRIVE
|
|
@@ -278,9 +274,6 @@ class FS {
|
|
|
278
274
|
}
|
|
279
275
|
}
|
|
280
276
|
|
|
281
|
-
console.log(" >> d before", d)
|
|
282
|
-
console.log(JSON.stringify({ copy, move }, null, 2))
|
|
283
|
-
|
|
284
277
|
for(let relpath of copy) {
|
|
285
278
|
if (drive_home) {
|
|
286
279
|
d.copy[relpath] = path.resolve(drive_home, p, relpath)
|
|
@@ -295,7 +288,6 @@ class FS {
|
|
|
295
288
|
d.move[relpath] = kernel.path("drive", p, relpath)
|
|
296
289
|
}
|
|
297
290
|
}
|
|
298
|
-
console.log(">> d after", d)
|
|
299
291
|
ondata({
|
|
300
292
|
raw: "\r\nLINKING DRIVES:\r\n" + JSON.stringify(d, null, 2).replace(/\n/g, "\r\n")
|
|
301
293
|
})
|
|
@@ -63,10 +63,7 @@ class Local {
|
|
|
63
63
|
}
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
let current_env = await Environment.get(api_path)
|
|
68
|
-
let default_env = await Environment.get(kernel.homedir)
|
|
69
|
-
current_env = Object.assign(process.env, default_env, current_env)
|
|
66
|
+
current_env = await Environment.get2(req.parent.path)
|
|
70
67
|
|
|
71
68
|
// if the key at current_env.PINOKIO_SHARE_VAR (by default it's 'url') is the variable being set, trigger the share logic
|
|
72
69
|
if (current_env.PINOKIO_SHARE_VAR && current_env.PINOKIO_SHARE_VAR in req.params) {
|
package/kernel/bin/conda.js
CHANGED
|
@@ -95,7 +95,7 @@ create_default_packages:
|
|
|
95
95
|
}
|
|
96
96
|
ondata({ raw: `${cmd}\r\n` })
|
|
97
97
|
ondata({ raw: `path: ${this.kernel.bin.path()}\r\n` })
|
|
98
|
-
await this.kernel.bin.exec({ message: cmd, conda: { skip: true } }, (stream) => {
|
|
98
|
+
await this.kernel.bin.exec({ sudo: true, message: cmd, conda: { skip: true } }, (stream) => {
|
|
99
99
|
ondata(stream)
|
|
100
100
|
})
|
|
101
101
|
//// await this.activate()
|
package/kernel/environment.js
CHANGED
|
@@ -259,15 +259,14 @@ const init_folders = async (homedir) => {
|
|
|
259
259
|
for(let key in current_env) {
|
|
260
260
|
let val = current_env[key]
|
|
261
261
|
|
|
262
|
-
console.log({ key, val })
|
|
263
|
-
// skip condarc and pipconfig => special case
|
|
264
|
-
if (["PIP_CONFIG_FILE", "CONDARC"].includes(key)) {
|
|
265
|
-
console.log("IGNORE", key)
|
|
266
|
-
continue
|
|
267
|
-
}
|
|
268
262
|
let is_absolute = path.isAbsolute(val)
|
|
269
263
|
let is_relative = val.startsWith("./")
|
|
270
264
|
if (is_absolute || is_relative) {
|
|
265
|
+
|
|
266
|
+
// skip condarc and pipconfig => special case
|
|
267
|
+
if (["PIP_CONFIG_FILE", "CONDARC"].includes(key)) {
|
|
268
|
+
continue
|
|
269
|
+
}
|
|
271
270
|
// it's a path
|
|
272
271
|
let full_path = path.resolve(homedir, val)
|
|
273
272
|
await fs.promises.mkdir(full_path, { recursive: true }).catch((e) => {})
|
package/kernel/index.js
CHANGED
|
@@ -57,10 +57,7 @@ class Kernel {
|
|
|
57
57
|
} else {
|
|
58
58
|
folderpath = this.homedir
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
let current_env = await Environment.get(api_path)
|
|
62
|
-
let default_env = await Environment.get(this.homedir)
|
|
63
|
-
return Object.assign(process.env, default_env, current_env)
|
|
60
|
+
return Environment.get2(folderpath, this)
|
|
64
61
|
}
|
|
65
62
|
resumeprocess(uri) {
|
|
66
63
|
let proc = this.procs[uri]
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -233,9 +233,22 @@ class Server {
|
|
|
233
233
|
let current = this.kernel.path("api", name, "ENVIRONMENT")
|
|
234
234
|
// if environment.json doesn't exist,
|
|
235
235
|
let exists = await this.exists(current)
|
|
236
|
-
if (
|
|
236
|
+
if (exists) {
|
|
237
|
+
// if ENVIRONMENT already exists, don't do anything
|
|
238
|
+
} else {
|
|
239
|
+
// if ENVIRONMENT doesn't exist, need to create one
|
|
240
|
+
// 1. if _ENVIRONMENT exists, create ENVIRONMENT by appending _ENVIRONMENT to ENVIRONMENT
|
|
241
|
+
// 2. if _ENVIRONMENT doesn't exist, just write ENVIRONMENT
|
|
242
|
+
// if _ENVIRONMENT exists,
|
|
243
|
+
let _environment = this.kernel.path("api", name, "_ENVIRONMENT")
|
|
244
|
+
let _exists = await this.exists(_environment)
|
|
237
245
|
let content = await Environment.ENV("app")
|
|
238
|
-
|
|
246
|
+
if (_exists) {
|
|
247
|
+
let _environmentStr = await fs.promises.readFile(_environment, "utf8")
|
|
248
|
+
await fs.promises.writeFile(current, content + "\n\n" + _environmentStr)
|
|
249
|
+
} else {
|
|
250
|
+
await fs.promises.writeFile(current, content)
|
|
251
|
+
}
|
|
239
252
|
}
|
|
240
253
|
|
|
241
254
|
let mode = "run"
|
|
@@ -2315,7 +2328,6 @@ class Server {
|
|
|
2315
2328
|
await this.renderMenu(uri, name, config, [])
|
|
2316
2329
|
}
|
|
2317
2330
|
|
|
2318
|
-
console.log("this.kernel.shell.shells.length", this.kernel.shell.shells.length)
|
|
2319
2331
|
|
|
2320
2332
|
ejs.renderFile(path.resolve(__dirname, "views/partials/menu.ejs"), { menu: config.menu }, (err, html) => {
|
|
2321
2333
|
res.send(html)
|
|
@@ -1274,7 +1274,8 @@ document.querySelector("aside").addEventListener("click", async (e) => {
|
|
|
1274
1274
|
target.querySelector("i.fa-square").className = "fa-solid fa-check"
|
|
1275
1275
|
n.Noty({
|
|
1276
1276
|
text: `stopping ${src}`,
|
|
1277
|
-
silent: true
|
|
1277
|
+
silent: true,
|
|
1278
|
+
timeout: 2000
|
|
1278
1279
|
})
|
|
1279
1280
|
console.log("src", src)
|
|
1280
1281
|
|
|
@@ -1289,6 +1290,7 @@ document.querySelector("aside").addEventListener("click", async (e) => {
|
|
|
1289
1290
|
if (packet.type === "result") {
|
|
1290
1291
|
socket.close()
|
|
1291
1292
|
n.Noty({
|
|
1293
|
+
timeout: 2000,
|
|
1292
1294
|
text: `stopped`,
|
|
1293
1295
|
silent: true
|
|
1294
1296
|
})
|
|
@@ -95,6 +95,9 @@ header {
|
|
|
95
95
|
.navheader {
|
|
96
96
|
background: var(--dark-bg);
|
|
97
97
|
}
|
|
98
|
+
.btn {
|
|
99
|
+
background: royalblue;
|
|
100
|
+
}
|
|
98
101
|
</style>
|
|
99
102
|
<script>
|
|
100
103
|
document.addEventListener("DOMContentLoaded", async () => {
|
|
@@ -466,6 +469,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
466
469
|
if (options && options.html) {
|
|
467
470
|
n.Noty({
|
|
468
471
|
text: options.html,
|
|
472
|
+
timeout: 3000,
|
|
469
473
|
callbacks: {
|
|
470
474
|
onClose: () => {
|
|
471
475
|
let uri = options.uri || options.href
|
|
@@ -784,7 +788,7 @@ const reloadMemory = async () => {
|
|
|
784
788
|
<% if (!install_required) { %>
|
|
785
789
|
<div class='runner'>
|
|
786
790
|
<div class='btn run <%= mod && runnable ? "" : "hidden" %>'>
|
|
787
|
-
<span class='play'><i class="fa-solid fa-play"></i>
|
|
791
|
+
<span class='play'><i class="fa-solid fa-play"></i> Start</span>
|
|
788
792
|
<span class='starting hidden'><i class="fa-solid fa-circle-notch fa-spin"></i> Starting...</span>
|
|
789
793
|
<span class='stop hidden'><i class="fa-solid fa-stop"></i> Stop</span>
|
|
790
794
|
</div>
|
package/server/views/index.ejs
CHANGED
|
@@ -287,6 +287,9 @@ body.dark .browser-options-row {
|
|
|
287
287
|
<div class='title'><%=item.name%></div>
|
|
288
288
|
<div class='description'><%=item.description%></div>
|
|
289
289
|
<div>
|
|
290
|
+
<button class='btn browse' data-src="<%=item.browser_url%>/browse">
|
|
291
|
+
<i class='fa-regular fa-folder-open'></i>
|
|
292
|
+
</button>
|
|
290
293
|
<% if (item.running_scripts) { %>
|
|
291
294
|
<% item.running_scripts.forEach((s) => { %>
|
|
292
295
|
<button class='btn shutdown' data-src="<%=s.path%>">
|
|
@@ -334,6 +337,9 @@ body.dark .browser-options-row {
|
|
|
334
337
|
<div class='uri'><i class="fa-regular fa-folder"></i><%=item.url%></div>
|
|
335
338
|
<div class='title'><%=item.name%></div>
|
|
336
339
|
<div class='description'><%=item.description%></div>
|
|
340
|
+
<button class='btn browse' data-src="<%=item.browser_url%>/browse">
|
|
341
|
+
<i class='fa-regular fa-folder-open'></i>
|
|
342
|
+
</button>
|
|
337
343
|
<% if (item.shortcuts && item.shortcuts.length > 0) { %>
|
|
338
344
|
<div class='btns'>
|
|
339
345
|
<% item.shortcuts.forEach((btn) => { %>
|