pinokiod 3.11.2 → 3.11.7
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/index.js +7 -0
- package/kernel/prototype.js +1 -1
- package/kernel/shell.js +5 -0
- package/kernel/shells.js +15 -0
- package/package.json +1 -1
- package/server/index.js +3 -0
- package/server/socket.js +5 -0
- package/server/views/app.ejs +19 -8
- package/server/views/index.ejs +22 -0
- package/server/views/install.ejs +24 -2
- package/server/views/keys.ejs +30 -11
- package/server/views/shell.ejs +18 -0
- package/server/views/terminal.ejs +19 -1
package/kernel/index.js
CHANGED
|
@@ -649,6 +649,13 @@ class Kernel {
|
|
|
649
649
|
// 2. mkdir all the folders if not already created
|
|
650
650
|
await Environment.init_folders(this.homedir)
|
|
651
651
|
|
|
652
|
+
// if key.json doesn't exist, create an empty json file
|
|
653
|
+
let ee = await this.exists(this.homedir, "key.json")
|
|
654
|
+
if (!ee) {
|
|
655
|
+
await fs.promises.writeFile(path.resolve(this.homedir, "key.json"), JSON.stringify({}))
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
|
|
652
659
|
|
|
653
660
|
// // 3. check if Caddyfile exists
|
|
654
661
|
// let e2 = await this.exists(this.homedir, "Caddyfile")
|
package/kernel/prototype.js
CHANGED
package/kernel/shell.js
CHANGED
|
@@ -318,6 +318,11 @@ class Shell {
|
|
|
318
318
|
|
|
319
319
|
// return this.id
|
|
320
320
|
}
|
|
321
|
+
resize({ cols, rows }) {
|
|
322
|
+
console.log("RESIZE", { cols, rows })
|
|
323
|
+
this.ptyProcess.resize(cols, rows)
|
|
324
|
+
this.vt.resize(cols, rows)
|
|
325
|
+
}
|
|
321
326
|
emit2(message) {
|
|
322
327
|
let i = 0;
|
|
323
328
|
const interval = setInterval(() => {
|
package/kernel/shells.js
CHANGED
|
@@ -257,6 +257,21 @@ class Shells {
|
|
|
257
257
|
let response = await this.send(params, ondata)
|
|
258
258
|
return response
|
|
259
259
|
}
|
|
260
|
+
resize(params) {
|
|
261
|
+
/*
|
|
262
|
+
params := {
|
|
263
|
+
"id": <shell id>,
|
|
264
|
+
"resize": {
|
|
265
|
+
"cols": <cols>,
|
|
266
|
+
"rows": <rows>,
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
*/
|
|
270
|
+
let session = this.get(params.id)
|
|
271
|
+
if (session) {
|
|
272
|
+
session.resize(params.resize)
|
|
273
|
+
}
|
|
274
|
+
}
|
|
260
275
|
emit(params) {
|
|
261
276
|
/*
|
|
262
277
|
params := {
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -2449,6 +2449,9 @@ class Server {
|
|
|
2449
2449
|
let p2 = path.resolve(home, "prototype")
|
|
2450
2450
|
await fse.remove(p2)
|
|
2451
2451
|
|
|
2452
|
+
let p3 = path.resolve(home, "plugin")
|
|
2453
|
+
await fse.remove(p3)
|
|
2454
|
+
|
|
2452
2455
|
let gitconfig = path.resolve(home, "gitconfig")
|
|
2453
2456
|
await fse.remove(gitconfig)
|
|
2454
2457
|
|
package/server/socket.js
CHANGED
package/server/views/app.ejs
CHANGED
|
@@ -811,11 +811,13 @@ body.dark .appcanvas {
|
|
|
811
811
|
<a target="<%=src%>" href="<%=src%>" class='btn header-item frame-link' data-index="0" data-mode="refresh">
|
|
812
812
|
<div class='tab'><i class="fa-regular fa-folder-open"></i> Files <div class='disk-usage'></div></div>
|
|
813
813
|
</a>
|
|
814
|
-
|
|
815
|
-
<
|
|
816
|
-
<
|
|
817
|
-
|
|
818
|
-
|
|
814
|
+
<% if (config.init_required) { %>
|
|
815
|
+
<a data-init class='btn header-item frame-link' href="/prototype?type=init&path=<%=path%>" target="/prototype?type=init&path=<%=path%>" data-index="1" data-mode="refresh">
|
|
816
|
+
<div class='tab'>
|
|
817
|
+
<i class='fa-solid fa-bolt'></i> Initialize
|
|
818
|
+
</div>
|
|
819
|
+
</a>
|
|
820
|
+
<% } %>
|
|
819
821
|
<% if (profile || feed) { %>
|
|
820
822
|
<div class='btn header-item frame-link revealer' data-group='.info-group'>
|
|
821
823
|
<div class='tab'>
|
|
@@ -1696,10 +1698,19 @@ body.dark .appcanvas {
|
|
|
1696
1698
|
// nested menu
|
|
1697
1699
|
e.preventDefault()
|
|
1698
1700
|
e.stopPropagation()
|
|
1701
|
+
debugger
|
|
1699
1702
|
<% if (type === 'run') { %>
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
+
if (target.closest(".dynamic")) {
|
|
1704
|
+
// clicked dev mode menu => switch to dev
|
|
1705
|
+
// run mode => switch to dev mode
|
|
1706
|
+
location.hash = ""
|
|
1707
|
+
location.pathname = location.pathname + "/dev"
|
|
1708
|
+
} else {
|
|
1709
|
+
// regular menu
|
|
1710
|
+
target.closest(".nested-menu").querySelector(".submenu").classList.toggle("hidden")
|
|
1711
|
+
target.querySelector(".loader .fa-angle-down").classList.toggle("hidden")
|
|
1712
|
+
target.querySelector(".loader .fa-angle-up").classList.toggle("hidden")
|
|
1713
|
+
}
|
|
1703
1714
|
<% } else { %>
|
|
1704
1715
|
// dev mode => already dev. reveal the hidden menu
|
|
1705
1716
|
if (target.closest(".dynamic")) {
|
package/server/views/index.ejs
CHANGED
|
@@ -142,6 +142,7 @@ body.dark .context-menu-wrapper {
|
|
|
142
142
|
transition: max-height 1s ease-in-out;
|
|
143
143
|
*/
|
|
144
144
|
display: flex;
|
|
145
|
+
margin: 0 5px 0 0;
|
|
145
146
|
}
|
|
146
147
|
.context-menu .btn:hover {
|
|
147
148
|
color: cornflowerblue !important;
|
|
@@ -245,6 +246,7 @@ body.dark .open-menu, body.dark .browse {
|
|
|
245
246
|
<a class='home' href="/"><img class='icon' src="/pinokio-black.png"></a>
|
|
246
247
|
<button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
|
|
247
248
|
<button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
|
|
249
|
+
<button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
|
|
248
250
|
<a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
|
|
249
251
|
<!--
|
|
250
252
|
<a href="/new" class='btn2'><div><i class='fa-solid fa-folder-plus'></i></div><div>Create</div></a>
|
|
@@ -387,9 +389,15 @@ body.dark .open-menu, body.dark .browse {
|
|
|
387
389
|
<button class='btn copy-menu' data-src="<%=item.browser_url%>/dev">
|
|
388
390
|
<i class='fa-solid fa-copy'></i> Copy
|
|
389
391
|
</button>
|
|
392
|
+
<button class='btn move-menu' data-src="<%=item.browser_url%>/dev" data-disable="To move the folder, the app should not be running.">
|
|
393
|
+
<i class="fa-solid fa-right-to-bracket"></i> Move
|
|
394
|
+
</button>
|
|
390
395
|
<button class='btn edit-menu' data-src="<%=item.browser_url%>/dev">
|
|
391
396
|
<i class='fa-solid fa-pen-to-square'></i> Edit
|
|
392
397
|
</button>
|
|
398
|
+
<button class='btn del' data-src="<%=item.url%>" data-disable="To delete the folder, the app should not be running.">
|
|
399
|
+
<i class="fa-solid fa-trash-can"></i> Delete
|
|
400
|
+
</button>
|
|
393
401
|
</div>
|
|
394
402
|
</div>
|
|
395
403
|
<% if (item.running_scripts) { %>
|
|
@@ -939,6 +947,13 @@ document.addEventListener("click", async (e) => {
|
|
|
939
947
|
if (target) {
|
|
940
948
|
e.preventDefault()
|
|
941
949
|
e.stopPropagation()
|
|
950
|
+
|
|
951
|
+
let disable_message = target.getAttribute('data-disable')
|
|
952
|
+
if (disable_message && disable_message.length > 0) {
|
|
953
|
+
alert(disable_message)
|
|
954
|
+
return
|
|
955
|
+
}
|
|
956
|
+
|
|
942
957
|
let line = target.closest(".line")
|
|
943
958
|
let title = line.getAttribute("data-title")
|
|
944
959
|
let icon = line.getAttribute("data-icon")
|
|
@@ -1043,6 +1058,13 @@ document.addEventListener("click", async (e) => {
|
|
|
1043
1058
|
if (target) {
|
|
1044
1059
|
e.preventDefault()
|
|
1045
1060
|
e.stopPropagation()
|
|
1061
|
+
|
|
1062
|
+
let disable_message = target.getAttribute('data-disable')
|
|
1063
|
+
if (disable_message && disable_message.length > 0) {
|
|
1064
|
+
alert(disable_message)
|
|
1065
|
+
return
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1046
1068
|
let confirmed = confirm("Are you sure you want to delete the folder? All files in the folder will be gone.")
|
|
1047
1069
|
if (confirmed) {
|
|
1048
1070
|
let itemEl = target.closest(".line[data-uri]")
|
package/server/views/install.ejs
CHANGED
|
@@ -143,6 +143,8 @@ body {
|
|
|
143
143
|
//
|
|
144
144
|
// /install_bin?type=bin&uri=conda
|
|
145
145
|
//
|
|
146
|
+
let shell_id
|
|
147
|
+
let fitAddon
|
|
146
148
|
const createTerm = async (_theme) => {
|
|
147
149
|
//const theme = Object.assign({ }, xtermTheme.Terminal_Basic, {
|
|
148
150
|
const theme = Object.assign({ }, _theme, {
|
|
@@ -173,7 +175,7 @@ const createTerm = async (_theme) => {
|
|
|
173
175
|
return true;
|
|
174
176
|
});
|
|
175
177
|
|
|
176
|
-
|
|
178
|
+
fitAddon = new FitAddon.FitAddon();
|
|
177
179
|
term.loadAddon(fitAddon);
|
|
178
180
|
<% if (agent === "electron") { %>
|
|
179
181
|
term.loadAddon(new WebLinksAddon.WebLinksAddon((event, uri) => {
|
|
@@ -187,7 +189,6 @@ const createTerm = async (_theme) => {
|
|
|
187
189
|
return term
|
|
188
190
|
}
|
|
189
191
|
document.addEventListener("DOMContentLoaded", async () => {
|
|
190
|
-
debugger
|
|
191
192
|
const n = new N()
|
|
192
193
|
let socket = new Socket()
|
|
193
194
|
<% if (theme === "dark") { %>
|
|
@@ -210,6 +211,24 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
210
211
|
emit: e.key
|
|
211
212
|
})
|
|
212
213
|
})
|
|
214
|
+
let observer = new ResizeObserver(() => {
|
|
215
|
+
fitAddon.fit()
|
|
216
|
+
console.log(`Resized to ${term.cols}x${term.rows}`);
|
|
217
|
+
// Trigger your custom handler here
|
|
218
|
+
if (socket) {
|
|
219
|
+
console.log({ shell_id, cols: term.cols, rows: term.rows })
|
|
220
|
+
if (shell_id) {
|
|
221
|
+
socket.run({
|
|
222
|
+
resize: {
|
|
223
|
+
cols: term.cols,
|
|
224
|
+
rows: term.rows,
|
|
225
|
+
},
|
|
226
|
+
id: shell_id
|
|
227
|
+
})
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
observer.observe(document.body)
|
|
213
232
|
await new Promise((resolve, reject) => {
|
|
214
233
|
socket.run({
|
|
215
234
|
id: location.pathname,
|
|
@@ -223,6 +242,9 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
223
242
|
}, async (packet) => {
|
|
224
243
|
console.log("packet", packet)
|
|
225
244
|
if (packet.type === "stream") {
|
|
245
|
+
if (packet.data.id) {
|
|
246
|
+
shell_id = packet.data.id
|
|
247
|
+
}
|
|
226
248
|
term.write(packet.data.raw)
|
|
227
249
|
} else if (packet.type === "result") {
|
|
228
250
|
resolve()
|
package/server/views/keys.ejs
CHANGED
|
@@ -212,6 +212,17 @@ footer .btn.go-home {
|
|
|
212
212
|
input[type=text] {
|
|
213
213
|
margin-bottom: 5px;
|
|
214
214
|
}
|
|
215
|
+
main {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-direction: column;
|
|
218
|
+
height: 100%;
|
|
219
|
+
}
|
|
220
|
+
main .empty {
|
|
221
|
+
flex-grow: 1;
|
|
222
|
+
justify-content: center;
|
|
223
|
+
align-items: center;
|
|
224
|
+
opacity: 1;
|
|
225
|
+
}
|
|
215
226
|
</style>
|
|
216
227
|
<script>
|
|
217
228
|
document.addEventListener("DOMContentLoaded", async () => {
|
|
@@ -254,23 +265,31 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
254
265
|
<a class='home-button home' href="/"><i class='fa-solid fa-home'></i></a>
|
|
255
266
|
<div class='flexible'></div>
|
|
256
267
|
<div class='nav-btns'>
|
|
257
|
-
<button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> Open in File Explorer</button>
|
|
268
|
+
<button class='btn' id='open-fs' data-filepath="<%=filepath%>" data-command="view"><i class="fa-solid fa-eye"></i> Open in File Explorer</button>
|
|
258
269
|
<div id='save' class='btn'>
|
|
259
270
|
<span class='save'><i class="fa-solid fa-check"></i> Save</span>
|
|
260
271
|
</div>
|
|
261
272
|
</div>
|
|
262
273
|
</h1>
|
|
263
274
|
</header>
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
<
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
275
|
+
<% if (items.length > 0) { %>
|
|
276
|
+
<div id='editor'>
|
|
277
|
+
<% items.forEach((item) => { %>
|
|
278
|
+
<div class='env-item'>
|
|
279
|
+
<label for="<%=item.host%>"><%=item.host%></label>
|
|
280
|
+
<% item.vals.forEach((val, index) => { %>
|
|
281
|
+
<input data-host="<%=item.host%>" data-index="<%=index%>" type="text" value="<%=val%>">
|
|
282
|
+
<% }) %>
|
|
283
|
+
</div>
|
|
284
|
+
<% }) %>
|
|
285
|
+
</div>
|
|
286
|
+
<% } else { %>
|
|
287
|
+
<div class='empty'>
|
|
288
|
+
<div>no keys are set</div>
|
|
289
|
+
<br>
|
|
290
|
+
<a target="_blank" href="https://pinokiocomputer.github.io/home/docs/#/?id=autofill-from-shared-key-store" class='btn'>Learn how this works</a>
|
|
291
|
+
</div>
|
|
292
|
+
<% } %>
|
|
274
293
|
</main>
|
|
275
294
|
</body>
|
|
276
295
|
</html>
|
package/server/views/shell.ejs
CHANGED
|
@@ -495,6 +495,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
495
495
|
let element = document.querySelector("mark")
|
|
496
496
|
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
497
497
|
|
|
498
|
+
this.stop()
|
|
498
499
|
|
|
499
500
|
|
|
500
501
|
|
|
@@ -709,6 +710,23 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
709
710
|
|
|
710
711
|
}
|
|
711
712
|
this.term.focus()
|
|
713
|
+
this.observer = new ResizeObserver(() => {
|
|
714
|
+
this.fit.fit()
|
|
715
|
+
console.log(`Resized to ${this.term.cols}x${this.term.rows}`);
|
|
716
|
+
// Trigger your custom handler here
|
|
717
|
+
if (this.socket) {
|
|
718
|
+
if (shell_id) {
|
|
719
|
+
this.socket.run({
|
|
720
|
+
resize: {
|
|
721
|
+
cols: this.term.cols,
|
|
722
|
+
rows: this.term.rows,
|
|
723
|
+
},
|
|
724
|
+
id: shell_id
|
|
725
|
+
})
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
this.observer.observe(document.body)
|
|
712
730
|
}
|
|
713
731
|
}
|
|
714
732
|
const rpc = new RPC()
|
|
@@ -186,6 +186,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
186
186
|
document.querySelector(".run .starting").classList.add("hidden")
|
|
187
187
|
}
|
|
188
188
|
stop() {
|
|
189
|
+
console.log("STOP")
|
|
189
190
|
this.socket.run({
|
|
190
191
|
method: "kernel.api.stop",
|
|
191
192
|
params: {
|
|
@@ -554,7 +555,7 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
554
555
|
let element = document.querySelector("mark")
|
|
555
556
|
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
556
557
|
|
|
557
|
-
|
|
558
|
+
this.stop()
|
|
558
559
|
|
|
559
560
|
|
|
560
561
|
} else if (packet.type === "event") {
|
|
@@ -734,6 +735,23 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
734
735
|
|
|
735
736
|
}
|
|
736
737
|
this.term.focus()
|
|
738
|
+
this.observer = new ResizeObserver(() => {
|
|
739
|
+
this.fit.fit()
|
|
740
|
+
console.log(`Resized to ${this.term.cols}x${this.term.rows}`);
|
|
741
|
+
// Trigger your custom handler here
|
|
742
|
+
if (this.socket) {
|
|
743
|
+
if (shell_id) {
|
|
744
|
+
this.socket.run({
|
|
745
|
+
resize: {
|
|
746
|
+
cols: this.term.cols,
|
|
747
|
+
rows: this.term.rows,
|
|
748
|
+
},
|
|
749
|
+
id: shell_id
|
|
750
|
+
})
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
this.observer.observe(document.body)
|
|
737
755
|
}
|
|
738
756
|
}
|
|
739
757
|
<% if (!install_required) { %>
|