pinokiod 3.9.33 → 3.9.35
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/util.js +14 -1
- package/package.json +1 -1
- package/server/index.js +4 -0
- package/server/public/opener.js +16 -1
- package/server/public/style.css +12 -10
- package/server/views/app.ejs +2 -1
- package/server/views/terminal.ejs +19 -34
package/kernel/util.js
CHANGED
|
@@ -109,6 +109,19 @@ const run = (cmd, cwd, kernel) => {
|
|
|
109
109
|
*/
|
|
110
110
|
|
|
111
111
|
}
|
|
112
|
+
const openURL = (url) => {
|
|
113
|
+
const platform = os.platform()
|
|
114
|
+
let command;
|
|
115
|
+
if (platform === 'darwin') {
|
|
116
|
+
command = `open "${url}"`; // macOS
|
|
117
|
+
} else if (platform === 'win32') {
|
|
118
|
+
command = `start "" "${url}"`; // Windows
|
|
119
|
+
} else {
|
|
120
|
+
command = `xdg-open "${url}"`; // Linux
|
|
121
|
+
}
|
|
122
|
+
console.log("openURL", { url, command })
|
|
123
|
+
child_process.exec(command);
|
|
124
|
+
}
|
|
112
125
|
const openfs = (dirPath, options, kernel) => {
|
|
113
126
|
let command = '';
|
|
114
127
|
const platform = os.platform()
|
|
@@ -362,5 +375,5 @@ function fill_object(obj, pattern, list, cache) {
|
|
|
362
375
|
}
|
|
363
376
|
|
|
364
377
|
module.exports = {
|
|
365
|
-
parse_env, log_path, api_path, update_env, parse_env_detail, openfs, port_running, du, is_port_available, find_python, find_venv, fill_object, run
|
|
378
|
+
parse_env, log_path, api_path, update_env, parse_env_detail, openfs, port_running, du, is_port_available, find_python, find_venv, fill_object, run, openURL
|
|
366
379
|
}
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -2894,6 +2894,10 @@ class Server {
|
|
|
2894
2894
|
Util.run(cmd, cwd, this.kernel)
|
|
2895
2895
|
res.json({ success: true })
|
|
2896
2896
|
}))
|
|
2897
|
+
this.app.post("/go", ex(async (req, res) => {
|
|
2898
|
+
Util.openURL(req.body.url)
|
|
2899
|
+
res.json({ success: true })
|
|
2900
|
+
}))
|
|
2897
2901
|
this.app.post("/openfs", ex(async (req, res) => {
|
|
2898
2902
|
//Util.openfs(req.body.path, req.body.mode)
|
|
2899
2903
|
Util.openfs(req.body.path, req.body, this.kernel)
|
package/server/public/opener.js
CHANGED
|
@@ -69,7 +69,22 @@ document.addEventListener("click", async (e) => {
|
|
|
69
69
|
e.preventDefault()
|
|
70
70
|
e.stopPropagation()
|
|
71
71
|
let features = el.getAttribute("features")
|
|
72
|
-
|
|
72
|
+
if (features.includes("browser")) {
|
|
73
|
+
debugger
|
|
74
|
+
fetch("/go", {
|
|
75
|
+
method: "POST",
|
|
76
|
+
headers: {
|
|
77
|
+
"Content-Type": "application/json"
|
|
78
|
+
},
|
|
79
|
+
body: JSON.stringify({ url: el.href })
|
|
80
|
+
}).then((res) => {
|
|
81
|
+
return res.json()
|
|
82
|
+
}).then((res) => {
|
|
83
|
+
console.log(res)
|
|
84
|
+
})
|
|
85
|
+
} else {
|
|
86
|
+
window.open(el.href, "_blank", features)
|
|
87
|
+
}
|
|
73
88
|
return
|
|
74
89
|
}
|
|
75
90
|
|
package/server/public/style.css
CHANGED
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
|
|
60
60
|
/* Firefox */
|
|
61
61
|
* {
|
|
62
|
-
scrollbar-width:
|
|
63
|
-
scrollbar-color:
|
|
62
|
+
scrollbar-width: thin;
|
|
63
|
+
scrollbar-color: rgba(0,0,0,0.2) transparent;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/* Chrome, Edge, and Safari */
|
|
@@ -69,23 +69,21 @@
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
*::-webkit-scrollbar-track {
|
|
72
|
-
background:
|
|
72
|
+
background: none;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
*::-webkit-scrollbar-thumb {
|
|
76
|
-
background-color:
|
|
76
|
+
background-color: rgba(0,0,0,0.2);
|
|
77
77
|
border-radius: 30px;
|
|
78
|
-
border:
|
|
78
|
+
border: 7px solid rgba(0,0,0,0.2);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
body.dark * {
|
|
82
|
-
scrollbar-color:
|
|
83
|
-
}
|
|
84
|
-
body.dark *::-webkit-scrollbar-track {
|
|
85
|
-
background: black;
|
|
82
|
+
scrollbar-color: rgba(255,255,255,0.3) transparent;
|
|
86
83
|
}
|
|
87
84
|
body.dark *::-webkit-scrollbar-thumb {
|
|
88
|
-
background-color:
|
|
85
|
+
background-color: rgba(255,255,255,0.3);
|
|
86
|
+
border: 7px solid rgba(255,255,255,0.3);
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
@font-face {
|
|
@@ -967,10 +965,14 @@ header a.path {
|
|
|
967
965
|
header .runner {
|
|
968
966
|
padding: 0 10px;
|
|
969
967
|
box-sizing: border-box;
|
|
968
|
+
display: flex;
|
|
969
|
+
align-items: center;
|
|
970
970
|
}
|
|
971
971
|
header .runner .btn {
|
|
972
972
|
padding: 5px 10px;
|
|
973
973
|
font-size: 12px;
|
|
974
|
+
margin-right: 10px;
|
|
975
|
+
flex-shrink: 0;
|
|
974
976
|
}
|
|
975
977
|
body.dark .memory {
|
|
976
978
|
background: rgba(0,0,0,0.8);
|
package/server/views/app.ejs
CHANGED
|
@@ -571,6 +571,7 @@ body.dark #open-location {
|
|
|
571
571
|
}
|
|
572
572
|
#open-location {
|
|
573
573
|
border: none;
|
|
574
|
+
color: black;
|
|
574
575
|
background: rgba(0,0,0,0.04);
|
|
575
576
|
padding: 10px;
|
|
576
577
|
margin-right: 10px;
|
|
@@ -745,7 +746,7 @@ body.dark .appcanvas {
|
|
|
745
746
|
<a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
|
|
746
747
|
<a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
|
|
747
748
|
<input type='url' id='location' readonly value="<%=execUrl%>">
|
|
748
|
-
<a id='open-location' target="_blank"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>
|
|
749
|
+
<a id='open-location' target="_blank" features="browser"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>
|
|
749
750
|
<div class='nav-btns'>
|
|
750
751
|
<a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
|
|
751
752
|
<button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
|
|
@@ -104,6 +104,18 @@ header {
|
|
|
104
104
|
background: royalblue;
|
|
105
105
|
}
|
|
106
106
|
*/
|
|
107
|
+
#status-window {
|
|
108
|
+
flex-grow: 1;
|
|
109
|
+
text-align: right;
|
|
110
|
+
padding: 0 10px;
|
|
111
|
+
}
|
|
112
|
+
#status-window b {
|
|
113
|
+
color: black;
|
|
114
|
+
font-weight: normal;
|
|
115
|
+
}
|
|
116
|
+
body.dark #status-window b {
|
|
117
|
+
color: white;
|
|
118
|
+
}
|
|
107
119
|
#del-bin {
|
|
108
120
|
color: royalblue;
|
|
109
121
|
cursor: pointer;
|
|
@@ -251,15 +263,12 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
251
263
|
document.querySelector(".run .stop").classList.remove("hidden")
|
|
252
264
|
if (packet.data && packet.data.description) {
|
|
253
265
|
if ('current' in packet.data) {
|
|
254
|
-
document.querySelector("
|
|
266
|
+
document.querySelector("#status-window").innerHTML = `<b>
|
|
255
267
|
<i class="fa-solid fa-circle-notch fa-spin"></i>(${packet.data.current+1}/${packet.data.total}) ${packet.data.title ? packet.data.title : ''}
|
|
256
268
|
</b>
|
|
257
269
|
<div class='flexible content'>${packet.data.description}</div>`
|
|
258
|
-
// <div class='toggle-expand'>
|
|
259
|
-
// <i class="fa-solid fa-circle-chevron-up"></i>
|
|
260
|
-
// </div>`
|
|
261
270
|
} else {
|
|
262
|
-
document.querySelector("
|
|
271
|
+
document.querySelector("#status-window").innerHTML = `<b>
|
|
263
272
|
<i class="fa-solid fa-circle-notch fa-spin"></i> ${packet.data.title ? packet.data.title : ''}
|
|
264
273
|
</b>
|
|
265
274
|
<div class='flexible content'></div>`
|
|
@@ -268,13 +277,9 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
268
277
|
// </div>`
|
|
269
278
|
}
|
|
270
279
|
} else if (packet.data && packet.data.method) {
|
|
271
|
-
document.querySelector("
|
|
280
|
+
document.querySelector("#status-window").innerHTML = `<b>
|
|
272
281
|
<i class="fa-solid fa-circle-notch fa-spin"></i> (${packet.data.current+1}/${packet.data.total}) ${packet.data.method}
|
|
273
|
-
</b
|
|
274
|
-
<div class='flexible content'>${packet.data.params ? JSON.stringify(packet.data.params) : ''}</div>`
|
|
275
|
-
// <div class='toggle-expand'>
|
|
276
|
-
// <i class="fa-solid fa-circle-chevron-up"></i>
|
|
277
|
-
// </div>`
|
|
282
|
+
</b>`
|
|
278
283
|
}
|
|
279
284
|
} else if (packet.type === "stream") {
|
|
280
285
|
// set the current shell id
|
|
@@ -298,7 +303,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
298
303
|
refreshParent(packet)
|
|
299
304
|
reloadMemory()
|
|
300
305
|
this.term.write("\r\nDisconnected...\r\n")
|
|
301
|
-
document.querySelector("
|
|
306
|
+
document.querySelector("#status-window").innerHTML = "<b>Ready</b>"
|
|
302
307
|
this.socket.close()
|
|
303
308
|
document.querySelector(".run .play").classList.remove("hidden")
|
|
304
309
|
document.querySelector(".run .stop").classList.add("hidden")
|
|
@@ -527,23 +532,6 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
527
532
|
text: `${packet.data}`,
|
|
528
533
|
})
|
|
529
534
|
} else if (packet.type === "error") {
|
|
530
|
-
// n.Noty({
|
|
531
|
-
// text: `${packet.data}`,
|
|
532
|
-
// type: "error"
|
|
533
|
-
// })
|
|
534
|
-
|
|
535
|
-
// this.socket.close()
|
|
536
|
-
// refreshParent(packet)
|
|
537
|
-
// reloadMemory()
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
//document.querySelector("footer .content").innerHTML = document.querySelector("footer .content").innerHTML + `<pre class='error'>${packet.data}</pre>`
|
|
542
|
-
//document.querySelector("footer .content").innerHTML = document.querySelector("footer .content").innerHTML + `<pre class='error'>ERROR</pre>`
|
|
543
|
-
// document.querySelector("footer .toggle-expand i").className = "fa-solid fa-circle-chevron-down"
|
|
544
|
-
// document.querySelector("footer").classList.add("expanded")
|
|
545
|
-
//document.querySelector("footer i").className = "fa-solid fa-triangle-exclamation"
|
|
546
|
-
|
|
547
535
|
document.querySelector(".run .play").classList.remove("hidden")
|
|
548
536
|
document.querySelector(".run .starting").classList.add("hidden")
|
|
549
537
|
document.querySelector(".run .stop").classList.add("hidden")
|
|
@@ -569,7 +557,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
569
557
|
|
|
570
558
|
} else if (packet.type === "event") {
|
|
571
559
|
if (packet.data === "stop") {
|
|
572
|
-
document.querySelector("
|
|
560
|
+
document.querySelector("#status-window").innerHTML = "<b>Ready</b>"
|
|
573
561
|
setTimeout(() => {
|
|
574
562
|
|
|
575
563
|
let params = new URLSearchParams(location.search)
|
|
@@ -921,9 +909,7 @@ const reloadMemory = async () => {
|
|
|
921
909
|
<% if (locals.filepath) { %>
|
|
922
910
|
<button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> View File</button>
|
|
923
911
|
<% } %>
|
|
924
|
-
|
|
925
|
-
<button class='btn' id='open-log' data-logpath="<%=logpath%>"><i class="fa-solid fa-align-left"></i> View Logs</button>
|
|
926
|
-
-->
|
|
912
|
+
<div id='status-window'></div>
|
|
927
913
|
</div>
|
|
928
914
|
</header>
|
|
929
915
|
<% } %>
|
|
@@ -1007,7 +993,6 @@ const reloadMemory = async () => {
|
|
|
1007
993
|
<% } %>
|
|
1008
994
|
<div id='terminal'></div>
|
|
1009
995
|
</div>
|
|
1010
|
-
<footer><b>Ready</b></footer>
|
|
1011
996
|
<% } %>
|
|
1012
997
|
<% } %>
|
|
1013
998
|
<div id='error-screen' class='hidden'>
|