pinokiod 3.86.0 → 3.88.0
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/Dockerfile +61 -0
- package/docker-entrypoint.sh +75 -0
- package/kernel/api/hf/index.js +1 -1
- package/kernel/api/index.js +1 -1
- package/kernel/api/shell/index.js +6 -0
- package/kernel/api/terminal/index.js +166 -0
- package/kernel/bin/conda.js +3 -2
- package/kernel/bin/index.js +53 -2
- package/kernel/bin/setup.js +32 -0
- package/kernel/bin/vs.js +11 -2
- package/kernel/index.js +42 -2
- package/kernel/info.js +36 -0
- package/kernel/peer.js +42 -15
- package/kernel/router/index.js +23 -15
- package/kernel/router/localhost_static_router.js +0 -3
- package/kernel/router/pinokio_domain_router.js +333 -0
- package/kernel/shells.js +21 -1
- package/kernel/util.js +2 -2
- package/package.json +2 -1
- package/script/install-mode.js +33 -0
- package/script/pinokio.json +7 -0
- package/server/index.js +513 -173
- package/server/public/Socket.js +48 -0
- package/server/public/common.js +1441 -276
- package/server/public/fseditor.js +71 -12
- package/server/public/install.js +1 -1
- package/server/public/layout.js +740 -0
- package/server/public/modalinput.js +0 -1
- package/server/public/style.css +97 -105
- package/server/public/tab-idle-notifier.js +629 -0
- package/server/public/terminal_input_tracker.js +63 -0
- package/server/public/urldropdown.css +319 -53
- package/server/public/urldropdown.js +615 -159
- package/server/public/window_storage.js +97 -28
- package/server/socket.js +40 -9
- package/server/views/500.ejs +2 -2
- package/server/views/app.ejs +3136 -1367
- package/server/views/bookmarklet.ejs +1 -1
- package/server/views/bootstrap.ejs +1 -1
- package/server/views/columns.ejs +2 -13
- package/server/views/connect.ejs +3 -4
- package/server/views/container.ejs +1 -2
- package/server/views/d.ejs +223 -53
- package/server/views/editor.ejs +1 -1
- package/server/views/file_explorer.ejs +1 -1
- package/server/views/index.ejs +12 -11
- package/server/views/index2.ejs +4 -4
- package/server/views/init/index.ejs +4 -5
- package/server/views/install.ejs +1 -1
- package/server/views/layout.ejs +123 -0
- package/server/views/net.ejs +39 -7
- package/server/views/network.ejs +20 -6
- package/server/views/network2.ejs +1 -1
- package/server/views/old_network.ejs +2 -2
- package/server/views/partials/dynamic.ejs +3 -5
- package/server/views/partials/menu.ejs +3 -5
- package/server/views/partials/running.ejs +1 -1
- package/server/views/pro.ejs +1 -1
- package/server/views/prototype/index.ejs +1 -1
- package/server/views/review.ejs +11 -23
- package/server/views/rows.ejs +2 -13
- package/server/views/screenshots.ejs +293 -138
- package/server/views/settings.ejs +3 -4
- package/server/views/setup.ejs +1 -2
- package/server/views/shell.ejs +277 -26
- package/server/views/terminal.ejs +322 -49
- package/server/views/tools.ejs +448 -4
|
@@ -1,30 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
(() => {
|
|
2
|
+
const SESSION_NAMESPACE = (() => {
|
|
3
|
+
const extractSession = (loc) => {
|
|
4
|
+
try {
|
|
5
|
+
const url = new URL(loc);
|
|
6
|
+
const value = url.searchParams.get('session');
|
|
7
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
8
|
+
} catch (_) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
let sessionId = extractSession(window.location.href);
|
|
14
|
+
|
|
15
|
+
if (!sessionId && window.parent && window.parent !== window) {
|
|
16
|
+
try {
|
|
17
|
+
sessionId = extractSession(window.parent.location.href);
|
|
18
|
+
} catch (_) {
|
|
19
|
+
try {
|
|
20
|
+
if (typeof window.parent.PinokioLayout?.getSessionId === 'function') {
|
|
21
|
+
sessionId = window.parent.PinokioLayout.getSessionId() || null;
|
|
22
|
+
}
|
|
23
|
+
} catch (_) {}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!sessionId && window.top && window.top !== window) {
|
|
28
|
+
try {
|
|
29
|
+
sessionId = extractSession(window.top.location.href);
|
|
30
|
+
} catch (_) {}
|
|
31
|
+
}
|
|
10
32
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
setItem: (key, value) => {
|
|
14
|
-
try {
|
|
15
|
-
sessionStorage.setItem(`${WINDOW_ID}:${key}`, value);
|
|
16
|
-
} catch (_) {}
|
|
17
|
-
},
|
|
18
|
-
removeItem: (key, value) => {
|
|
19
|
-
try {
|
|
20
|
-
sessionStorage.removeItem(`${WINDOW_ID}:${key}`)
|
|
21
|
-
} catch (_) {}
|
|
22
|
-
},
|
|
23
|
-
getItem: (key) => {
|
|
24
|
-
try {
|
|
25
|
-
return sessionStorage.getItem(`${WINDOW_ID}:${key}`);
|
|
26
|
-
} catch (_) {
|
|
27
|
-
return null;
|
|
33
|
+
if (sessionId) {
|
|
34
|
+
return `pinokio:session:${sessionId}`;
|
|
28
35
|
}
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
|
|
37
|
+
let fallbackId = null;
|
|
38
|
+
try {
|
|
39
|
+
fallbackId = localStorage.getItem('pinokio:window:fallback');
|
|
40
|
+
if (!fallbackId) {
|
|
41
|
+
fallbackId = `${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
42
|
+
localStorage.setItem('pinokio:window:fallback', fallbackId);
|
|
43
|
+
}
|
|
44
|
+
} catch (_) {
|
|
45
|
+
fallbackId = `${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
46
|
+
}
|
|
47
|
+
return `pinokio:window:${fallbackId}`;
|
|
48
|
+
})();
|
|
49
|
+
|
|
50
|
+
const prefixKey = (key) => {
|
|
51
|
+
if (!key || typeof key !== 'string') {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return `${SESSION_NAMESPACE}:${key}`;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
window.windowStorage = {
|
|
58
|
+
setItem: (key, value) => {
|
|
59
|
+
const namespaced = prefixKey(key);
|
|
60
|
+
if (!namespaced) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
localStorage.setItem(namespaced, value);
|
|
65
|
+
} catch (_) {}
|
|
66
|
+
},
|
|
67
|
+
removeItem: (key) => {
|
|
68
|
+
const namespaced = prefixKey(key);
|
|
69
|
+
if (!namespaced) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
localStorage.removeItem(namespaced);
|
|
74
|
+
} catch (_) {}
|
|
75
|
+
},
|
|
76
|
+
getItem: (key) => {
|
|
77
|
+
const namespaced = prefixKey(key);
|
|
78
|
+
if (!namespaced) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
return localStorage.getItem(namespaced);
|
|
83
|
+
} catch (_) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
clearNamespace: () => {
|
|
88
|
+
try {
|
|
89
|
+
const targetPrefix = `${SESSION_NAMESPACE}:`;
|
|
90
|
+
for (let i = localStorage.length - 1; i >= 0; i -= 1) {
|
|
91
|
+
const key = localStorage.key(i);
|
|
92
|
+
if (key && key.startsWith(targetPrefix)) {
|
|
93
|
+
localStorage.removeItem(key);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
} catch (_) {}
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
})();
|
package/server/socket.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const querystring = require("querystring");
|
|
1
2
|
const WebSocket = require('ws');
|
|
2
3
|
const path = require('path')
|
|
3
4
|
const Util = require("../kernel/util")
|
|
@@ -35,7 +36,7 @@ class Socket {
|
|
|
35
36
|
if (sepIndex === -1) throw new Error("Missing metadata separator");
|
|
36
37
|
const metaStr = buffer.slice(0, sepIndex).toString('utf-8');
|
|
37
38
|
const meta = JSON.parse(metaStr);
|
|
38
|
-
const bufferKeys = meta.buffer_keys;
|
|
39
|
+
const bufferKeys = meta.buffer_keys || [];
|
|
39
40
|
const resultBuffers = {};
|
|
40
41
|
let offset = sepIndex + 1;
|
|
41
42
|
for (const key of bufferKeys) {
|
|
@@ -47,11 +48,27 @@ class Socket {
|
|
|
47
48
|
resultBuffers[key] = fileBuf;
|
|
48
49
|
offset += len;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (meta.rpc) {
|
|
52
|
+
req = meta.rpc
|
|
53
|
+
if (!req.params) {
|
|
54
|
+
req.params = {}
|
|
55
|
+
}
|
|
56
|
+
if (!req.params.buffers) {
|
|
57
|
+
req.params.buffers = {}
|
|
58
|
+
}
|
|
59
|
+
for (const [key, buf] of Object.entries(resultBuffers)) {
|
|
60
|
+
req.params.buffers[key] = buf
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
// legacy path keeps response semantics
|
|
64
|
+
if (!meta.response) {
|
|
65
|
+
meta.response = {}
|
|
66
|
+
}
|
|
67
|
+
for (const [key, buf] of Object.entries(resultBuffers)) {
|
|
68
|
+
meta.response[key] = buf
|
|
69
|
+
}
|
|
70
|
+
req = meta
|
|
53
71
|
}
|
|
54
|
-
req = meta
|
|
55
72
|
} else {
|
|
56
73
|
req = JSON.parse(message)
|
|
57
74
|
}
|
|
@@ -205,10 +222,23 @@ class Socket {
|
|
|
205
222
|
trigger(e) {
|
|
206
223
|
// send to id session
|
|
207
224
|
let id
|
|
208
|
-
if (e.
|
|
209
|
-
|
|
225
|
+
if (typeof e.id === "string") {
|
|
226
|
+
if (e.id.includes("session=")) {
|
|
227
|
+
id = e.id
|
|
228
|
+
} else if (e.id.startsWith("shell/")) {
|
|
229
|
+
id = e.id
|
|
230
|
+
} else if (e.kernel && !(e.id.startsWith("~/") || e.id.startsWith("/") || e.id.startsWith("http"))) {
|
|
231
|
+
// kernel method ids such as "kernel.api.stop" are not paths
|
|
232
|
+
id = e.id
|
|
233
|
+
} else {
|
|
234
|
+
try {
|
|
235
|
+
id = this.parent.kernel.api.filePath(e.id)
|
|
236
|
+
} catch (error) {
|
|
237
|
+
id = e.id
|
|
238
|
+
}
|
|
239
|
+
}
|
|
210
240
|
} else {
|
|
211
|
-
id =
|
|
241
|
+
id = e.id
|
|
212
242
|
}
|
|
213
243
|
|
|
214
244
|
const subscribers = this.subscriptions.get(id) || new Set();
|
|
@@ -327,7 +357,8 @@ class Socket {
|
|
|
327
357
|
let root = await Environment.get_root({ path: cwd }, this.parent.kernel)
|
|
328
358
|
cwd = root.root
|
|
329
359
|
let session = this.sessions[key]
|
|
330
|
-
let logpath = path.resolve(cwd, "logs/dev", path.parse(relative).base)
|
|
360
|
+
//let logpath = path.resolve(cwd, "logs/dev", path.parse(relative).base)
|
|
361
|
+
let logpath = path.resolve(cwd, "logs/dev", relative)
|
|
331
362
|
await Util.log(logpath, buf, session)
|
|
332
363
|
}
|
|
333
364
|
} else if (relative.startsWith("api")) {
|
package/server/views/500.ejs
CHANGED
|
@@ -44,8 +44,8 @@ body.error-body footer.error-footer a {
|
|
|
44
44
|
<div>You may want to try:</div>
|
|
45
45
|
<ol>
|
|
46
46
|
<li>Update Pinokio: Simply install the latest version, it should only update the app binary while keeping all the data in tact. <a href="<%=install%>" target="_blank">Go to Download Page</a></li>
|
|
47
|
-
<li>Try troubleshooting: <a href="
|
|
48
|
-
<li>Ask in community Discord: <a href="http://localhost
|
|
47
|
+
<li>Try troubleshooting: <a href="/home?mode=settings#troubleshoot">Troubleshoot</a></li>
|
|
48
|
+
<li>Ask in community Discord: <a href="http://localhost/home?mode=help" target="_blank">Community</a></li>
|
|
49
49
|
</ol>
|
|
50
50
|
</footer>
|
|
51
51
|
</body>
|