pinokiod 2.15.31 → 2.15.33
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/hf/index.js
CHANGED
|
@@ -21,15 +21,16 @@ class HF {
|
|
|
21
21
|
*/
|
|
22
22
|
async download(req, ondata, kernel) {
|
|
23
23
|
const shell = new Shell()
|
|
24
|
-
console.log("params before", req.params)
|
|
25
24
|
let params = Object.assign({}, req.params)
|
|
26
25
|
delete params.env
|
|
27
26
|
delete params.path
|
|
28
27
|
let chunks = unparse(params)
|
|
29
|
-
let message =
|
|
28
|
+
let message = [
|
|
29
|
+
`huggingface-cli download ${chunks.join(" ")}`,
|
|
30
|
+
(kernel.platform === "win32" ? "dir" : "ls")
|
|
31
|
+
]
|
|
30
32
|
console.log({ message, before: req.params.message })
|
|
31
33
|
req.params.message = message
|
|
32
|
-
console.log("params after", req.params)
|
|
33
34
|
let res = await shell.run(req, ondata, kernel)
|
|
34
35
|
return res
|
|
35
36
|
}
|
package/package.json
CHANGED
|
@@ -523,7 +523,11 @@ body.dark .loader-container {
|
|
|
523
523
|
aside:not(.active) {
|
|
524
524
|
display: none;
|
|
525
525
|
}
|
|
526
|
+
.container {
|
|
527
|
+
display: none;
|
|
528
|
+
}
|
|
526
529
|
.container.active {
|
|
530
|
+
display: block;
|
|
527
531
|
position: absolute;
|
|
528
532
|
z-index: 10000000;
|
|
529
533
|
width: 100%;
|
|
@@ -740,16 +744,9 @@ const nav = (type) => {
|
|
|
740
744
|
// }
|
|
741
745
|
}
|
|
742
746
|
const renderSelection = (e, force) => {
|
|
743
|
-
console.log("# 1")
|
|
744
747
|
// if the menu has a default item, or if the url specifies a selection
|
|
745
|
-
let selection =
|
|
746
|
-
<% if (type === "run" && env.PINOKIO_SCRIPT_DEFAULT && env.PINOKIO_SCRIPT_DEFAULT.toString().toLowerCase() === "true") { %>
|
|
747
|
-
selection = document.querySelector("[data-default]")
|
|
748
|
-
<% } %>
|
|
748
|
+
let selection = document.querySelector("[data-default]")
|
|
749
749
|
if (selection || location.hash && location.hash.length > 0) {
|
|
750
|
-
console.log("# 2")
|
|
751
|
-
|
|
752
|
-
|
|
753
750
|
let target
|
|
754
751
|
if (location.hash && location.hash.length > 0) {
|
|
755
752
|
// document.querySelector(".bar").classList.remove("hidden")
|
|
@@ -759,7 +756,8 @@ const renderSelection = (e, force) => {
|
|
|
759
756
|
|
|
760
757
|
let selector
|
|
761
758
|
if (id.startsWith("@")) {
|
|
762
|
-
selector = `aside [target='${id.slice(1)}']`
|
|
759
|
+
//selector = `aside [target='${id.slice(1)}']`
|
|
760
|
+
selector = `aside [target='${id}']`
|
|
763
761
|
} else {
|
|
764
762
|
let type = id[0]
|
|
765
763
|
let index = id.slice(1)
|
|
@@ -809,11 +807,9 @@ const renderSelection = (e, force) => {
|
|
|
809
807
|
// minimize aside
|
|
810
808
|
|
|
811
809
|
document.querySelector(".container").classList.add("active")
|
|
812
|
-
document.querySelector(".container").classList.remove("hidden")
|
|
813
810
|
document.querySelector("aside").classList.remove("active")
|
|
814
811
|
} else {
|
|
815
812
|
document.querySelector(".container").classList.remove("active")
|
|
816
|
-
document.querySelector(".container").classList.add("hidden")
|
|
817
813
|
document.querySelector("aside").classList.add("active")
|
|
818
814
|
}
|
|
819
815
|
|
|
@@ -843,17 +839,13 @@ const renderSelection = (e, force) => {
|
|
|
843
839
|
// 2. if it's soft (".s")
|
|
844
840
|
// find using the name attribute
|
|
845
841
|
let targetFrame;
|
|
846
|
-
console.log("> A")
|
|
847
842
|
if (target.closest(".h")) {
|
|
848
|
-
console.log("> B")
|
|
849
843
|
let hardFrames = document.querySelectorAll(".browserview iframe[name^='@']")
|
|
850
844
|
let port = new URL(target.href).port || 80
|
|
851
845
|
for(let frame of hardFrames) {
|
|
852
|
-
console.log("> C")
|
|
853
846
|
console.log({ src: frame.src, href: target.href, target: target.target })
|
|
854
847
|
// Types of links in the tab
|
|
855
848
|
if (String(port) === "<%=port%>") {
|
|
856
|
-
console.log("> D")
|
|
857
849
|
// 1. running from <%=port%> => find a frame whose base URL matches the tab's base URL
|
|
858
850
|
// Pinokio links
|
|
859
851
|
let targetPath = new URL(target.href).pathname
|
|
@@ -867,7 +859,6 @@ const renderSelection = (e, force) => {
|
|
|
867
859
|
}
|
|
868
860
|
} else {
|
|
869
861
|
// 2. rest => find the frame whose src exactly matches the tab's url
|
|
870
|
-
console.log("> E")
|
|
871
862
|
if (target.href === frame.src) {
|
|
872
863
|
frame.name = target.target
|
|
873
864
|
targetFrame = frame
|
|
@@ -881,8 +872,6 @@ const renderSelection = (e, force) => {
|
|
|
881
872
|
} else if (target.closest(".n")) {
|
|
882
873
|
targetFrame = document.querySelector(`iframe[name='${target.target}']`)
|
|
883
874
|
}
|
|
884
|
-
console.log("targetFrame", targetFrame)
|
|
885
|
-
|
|
886
875
|
|
|
887
876
|
/*
|
|
888
877
|
// Load the link in the frame
|
|
@@ -908,7 +897,6 @@ const renderSelection = (e, force) => {
|
|
|
908
897
|
*/
|
|
909
898
|
|
|
910
899
|
if (targetFrame) {
|
|
911
|
-
console.log("> F")
|
|
912
900
|
targetFrame.classList.remove("hidden")
|
|
913
901
|
let mode = target.getAttribute("data-mode")
|
|
914
902
|
if (mode === "refresh") {
|
|
@@ -919,7 +907,6 @@ const renderSelection = (e, force) => {
|
|
|
919
907
|
e.preventDefault()
|
|
920
908
|
e.stopPropagation()
|
|
921
909
|
let sub = subUrlOf(target.href, targetFrame.src)
|
|
922
|
-
console.log("issub", sub)
|
|
923
910
|
if (!sub) {
|
|
924
911
|
targetFrame.src = target.href
|
|
925
912
|
}
|
|
@@ -950,7 +937,6 @@ const renderSelection = (e, force) => {
|
|
|
950
937
|
}
|
|
951
938
|
} else {
|
|
952
939
|
if (force) {
|
|
953
|
-
console.log("# 7")
|
|
954
940
|
targetFrame.src = target.href
|
|
955
941
|
}
|
|
956
942
|
}
|
|
@@ -959,7 +945,6 @@ const renderSelection = (e, force) => {
|
|
|
959
945
|
}, "*")
|
|
960
946
|
}
|
|
961
947
|
} else {
|
|
962
|
-
console.log("# 12")
|
|
963
948
|
let frame = document.createElement("iframe")
|
|
964
949
|
frame.name = target.target
|
|
965
950
|
frame.src = target.href
|
|
@@ -1058,13 +1043,14 @@ const renderSelection = (e, force) => {
|
|
|
1058
1043
|
} else {
|
|
1059
1044
|
console.log("# 14")
|
|
1060
1045
|
document.querySelector(".container").classList.remove("active")
|
|
1061
|
-
document.querySelector(".container").classList.add("hidden")
|
|
1062
1046
|
document.querySelector("aside").classList.add("active")
|
|
1063
1047
|
|
|
1064
1048
|
}
|
|
1065
1049
|
}
|
|
1066
1050
|
console.log("loaded before", loaded)
|
|
1051
|
+
<% if (type === "run" && env.PINOKIO_SCRIPT_DEFAULT && env.PINOKIO_SCRIPT_DEFAULT.toString().toLowerCase() === "true") { %>
|
|
1067
1052
|
renderSelection()
|
|
1053
|
+
<% } %>
|
|
1068
1054
|
//renderCursor()
|
|
1069
1055
|
console.log("loaded after", loaded)
|
|
1070
1056
|
//Reporter()
|
|
@@ -1298,7 +1284,6 @@ document.querySelector("aside").addEventListener("click", async (e) => {
|
|
|
1298
1284
|
uri: "~" + src
|
|
1299
1285
|
}
|
|
1300
1286
|
}, (packet) => {
|
|
1301
|
-
console.log("packet", packet)
|
|
1302
1287
|
if (packet.type === "result") {
|
|
1303
1288
|
socket.close()
|
|
1304
1289
|
n.Noty({
|
|
@@ -1331,7 +1316,6 @@ document.querySelector("aside").addEventListener("click", async (e) => {
|
|
|
1331
1316
|
let confirmText = target.getAttribute("data-confirm")
|
|
1332
1317
|
if (confirmText && confirmText.length > 0) {
|
|
1333
1318
|
const confirmed = confirm(confirmText)
|
|
1334
|
-
console.log('confirmed', confirmed)
|
|
1335
1319
|
if (!confirmed) {
|
|
1336
1320
|
e.preventDefault()
|
|
1337
1321
|
e.stopPropagation()
|
|
@@ -1351,7 +1335,6 @@ document.querySelector("aside").addEventListener("click", async (e) => {
|
|
|
1351
1335
|
uri: action.uri//"~" + location.pathname
|
|
1352
1336
|
}
|
|
1353
1337
|
}, (packet) => {
|
|
1354
|
-
console.log("packet", packet)
|
|
1355
1338
|
if (packet.type === "result") {
|
|
1356
1339
|
socket.close()
|
|
1357
1340
|
// location.href = location.href
|
|
@@ -1401,12 +1384,29 @@ document.querySelector("aside").addEventListener("click", async (e) => {
|
|
|
1401
1384
|
|
|
1402
1385
|
|
|
1403
1386
|
})
|
|
1387
|
+
const refresh_du = () => {
|
|
1388
|
+
fetch("/du/<%=name%>").then((res) => {
|
|
1389
|
+
return res.json()
|
|
1390
|
+
}).then((res) => {
|
|
1391
|
+
let val
|
|
1392
|
+
let k = 1024
|
|
1393
|
+
if (res.du > k * k * k) {
|
|
1394
|
+
// GB
|
|
1395
|
+
val = `${Math.floor(res.du/k/k/k * 100) / 100} GB`
|
|
1396
|
+
} else if (res.du > k * k) {
|
|
1397
|
+
// MB
|
|
1398
|
+
val = `${Math.floor(res.du/k/k * 100) / 100} MB`
|
|
1399
|
+
} else {
|
|
1400
|
+
// KB
|
|
1401
|
+
val = `${Math.floor(res.du/k * 100) / 100} KB`
|
|
1402
|
+
}
|
|
1403
|
+
//document.querySelector(".disk-usage").innerHTML = `<i class="fa-regular fa-hard-drive"></i> ${val}`
|
|
1404
|
+
document.querySelector(".disk-usage").innerHTML = val
|
|
1405
|
+
})
|
|
1406
|
+
}
|
|
1404
1407
|
const refresh = async (silent, options) => {
|
|
1405
|
-
console.log("REFRESH")
|
|
1406
1408
|
if (options && options.nodelay) {
|
|
1407
|
-
console.log("1")
|
|
1408
1409
|
} else {
|
|
1409
|
-
console.log("2")
|
|
1410
1410
|
await new Promise((resolve, reject) => {
|
|
1411
1411
|
setTimeout(() => {
|
|
1412
1412
|
resolve()
|
|
@@ -1424,35 +1424,36 @@ const refresh = async (silent, options) => {
|
|
|
1424
1424
|
} else {
|
|
1425
1425
|
if (options && options.nodelay) {
|
|
1426
1426
|
} else {
|
|
1427
|
-
await new Promise((resolve, reject) => {
|
|
1428
|
-
setTimeout(() => {
|
|
1429
|
-
resolve()
|
|
1430
|
-
}, 500)
|
|
1431
|
-
})
|
|
1427
|
+
// await new Promise((resolve, reject) => {
|
|
1428
|
+
// setTimeout(() => {
|
|
1429
|
+
// resolve()
|
|
1430
|
+
// }, 500)
|
|
1431
|
+
// })
|
|
1432
1432
|
}
|
|
1433
1433
|
renderSelection()
|
|
1434
1434
|
}
|
|
1435
|
+
refresh_du()
|
|
1435
1436
|
}
|
|
1436
|
-
document.querySelector("#genlog")
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1437
|
+
if (document.querySelector("#genlog")) {
|
|
1438
|
+
document.querySelector("#genlog").addEventListener("click", (e) => {
|
|
1439
|
+
e.preventDefault()
|
|
1440
|
+
e.stopPropagation()
|
|
1441
|
+
e.target.innerHTML = '<i class="fa-solid fa-circle-notch fa-spin"></i>'
|
|
1442
|
+
fetch("/pinokio/log", {
|
|
1443
|
+
method: "post",
|
|
1444
|
+
}).then((res) => {
|
|
1445
|
+
let btn = document.querySelector("#genlog")
|
|
1446
|
+
let btn2 = document.querySelector("#downloadlogs")
|
|
1447
|
+
btn2.classList.remove("hidden")
|
|
1448
|
+
btn.classList.add("hidden")
|
|
1449
|
+
btn.innerHTML = '<i class="fa-solid fa-circle-check"></i> Generated!'
|
|
1450
|
+
//btn.classList.add("hidden")
|
|
1451
|
+
})
|
|
1450
1452
|
})
|
|
1451
|
-
}
|
|
1453
|
+
}
|
|
1452
1454
|
window.addEventListener('message', (event) => {
|
|
1453
1455
|
|
|
1454
1456
|
// only process the event it's coming from pinokio
|
|
1455
|
-
console.log("EVENT", event)
|
|
1456
1457
|
let origin = event.origin
|
|
1457
1458
|
if (origin) {
|
|
1458
1459
|
let port = new URL(origin).port || 80
|
|
@@ -1494,24 +1495,7 @@ window.addEventListener('message', (event) => {
|
|
|
1494
1495
|
|
|
1495
1496
|
|
|
1496
1497
|
});
|
|
1497
|
-
|
|
1498
|
-
return res.json()
|
|
1499
|
-
}).then((res) => {
|
|
1500
|
-
let val
|
|
1501
|
-
let k = 1024
|
|
1502
|
-
if (res.du > k * k * k) {
|
|
1503
|
-
// GB
|
|
1504
|
-
val = `${Math.floor(res.du/k/k/k * 100) / 100} GB`
|
|
1505
|
-
} else if (res.du > k * k) {
|
|
1506
|
-
// MB
|
|
1507
|
-
val = `${Math.floor(res.du/k/k * 100) / 100} MB`
|
|
1508
|
-
} else {
|
|
1509
|
-
// KB
|
|
1510
|
-
val = `${Math.floor(res.du/k * 100) / 100} KB`
|
|
1511
|
-
}
|
|
1512
|
-
//document.querySelector(".disk-usage").innerHTML = `<i class="fa-regular fa-hard-drive"></i> ${val}`
|
|
1513
|
-
document.querySelector(".disk-usage").innerHTML = val
|
|
1514
|
-
})
|
|
1498
|
+
refresh_du()
|
|
1515
1499
|
/*
|
|
1516
1500
|
document.addEventListener("keydown", (e) => {
|
|
1517
1501
|
let size = document.querySelectorAll(".selectable").length
|
|
@@ -192,7 +192,6 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
192
192
|
rows: this.term.rows,
|
|
193
193
|
}
|
|
194
194
|
}, async (packet) => {
|
|
195
|
-
console.log({ packet })
|
|
196
195
|
if (packet.type === 'start') {
|
|
197
196
|
refreshParent(packet)
|
|
198
197
|
reloadMemory()
|
|
@@ -455,7 +454,6 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
455
454
|
})
|
|
456
455
|
*/
|
|
457
456
|
console.log("instance", instance)
|
|
458
|
-
console.log("EVENT", packet.event)
|
|
459
457
|
instance.mark(packet.event)
|
|
460
458
|
let element = document.querySelector("mark")
|
|
461
459
|
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
package/server/views/index.ejs
CHANGED
|
@@ -1060,22 +1060,24 @@ if (document.querySelector("#forward")) {
|
|
|
1060
1060
|
history.forward()
|
|
1061
1061
|
})
|
|
1062
1062
|
}
|
|
1063
|
-
document.querySelector("#genlog")
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1063
|
+
if (document.querySelector("#genlog")) {
|
|
1064
|
+
document.querySelector("#genlog").addEventListener("click", (e) => {
|
|
1065
|
+
e.preventDefault()
|
|
1066
|
+
e.stopPropagation()
|
|
1067
|
+
e.target.innerHTML = '<i class="fa-solid fa-circle-notch fa-spin"></i>'
|
|
1068
|
+
fetch("/pinokio/log", {
|
|
1069
|
+
method: "post",
|
|
1070
|
+
}).then((res) => {
|
|
1071
|
+
console.log("RES", res)
|
|
1072
|
+
let btn = document.querySelector("#genlog")
|
|
1073
|
+
let btn2 = document.querySelector("#downloadlogs")
|
|
1074
|
+
btn2.classList.remove("hidden")
|
|
1075
|
+
btn.classList.add("hidden")
|
|
1076
|
+
btn.innerHTML = '<i class="fa-solid fa-circle-check"></i> Generated!'
|
|
1077
|
+
//btn.classList.add("hidden")
|
|
1078
|
+
})
|
|
1077
1079
|
})
|
|
1078
|
-
}
|
|
1080
|
+
}
|
|
1079
1081
|
|
|
1080
1082
|
</script>
|
|
1081
1083
|
</body>
|