pinokiod 3.283.0 → 3.285.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/package.json +1 -1
- package/server/public/common.js +97 -80
- package/server/public/style.css +1 -2
- package/server/public/tab-link-popover.js +12 -12
- package/server/views/app.ejs +1 -3
- package/server/views/index.ejs +54 -2
package/package.json
CHANGED
package/server/public/common.js
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
const CAPTURE_MIN_SIZE = 32;
|
|
2
2
|
|
|
3
|
+
function createMinimalLoadingSwal () {
|
|
4
|
+
if (typeof window === 'undefined' || typeof window.Swal === 'undefined') {
|
|
5
|
+
return () => {};
|
|
6
|
+
}
|
|
7
|
+
const swal = window.Swal;
|
|
8
|
+
if (typeof swal.fire !== 'function') {
|
|
9
|
+
return () => {};
|
|
10
|
+
}
|
|
11
|
+
const close = () => {
|
|
12
|
+
if (swal.isVisible()) {
|
|
13
|
+
swal.close();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
swal.fire({
|
|
17
|
+
html: "<i class='fa-solid fa-circle-notch fa-spin'></i> Loading...",
|
|
18
|
+
allowOutsideClick: false,
|
|
19
|
+
allowEscapeKey: false,
|
|
20
|
+
showConfirmButton: false,
|
|
21
|
+
customClass: {
|
|
22
|
+
container: 'loader-container',
|
|
23
|
+
popup: 'loader-popup',
|
|
24
|
+
htmlContainer: 'loader-dialog',
|
|
25
|
+
footer: 'hidden',
|
|
26
|
+
actions: 'hidden'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return close;
|
|
30
|
+
}
|
|
31
|
+
function check_ready () {
|
|
32
|
+
return fetch("/pinokio/requirements_ready").then((res) => {
|
|
33
|
+
return res.json()
|
|
34
|
+
}).then((res) => {
|
|
35
|
+
if (res.error) {
|
|
36
|
+
return false
|
|
37
|
+
} else if (!res.requirements_pending) {
|
|
38
|
+
return true
|
|
39
|
+
}
|
|
40
|
+
return false
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function check_dev () {
|
|
45
|
+
return fetch('/bundle/dev').then((response) => response.json())
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
let onfinish = await wait_ready()
|
|
51
|
+
if (onfinish) {
|
|
52
|
+
onfinish()
|
|
53
|
+
}
|
|
54
|
+
// The original task
|
|
55
|
+
*/
|
|
56
|
+
function wait_ready () {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
check_ready().then((ready) => {
|
|
59
|
+
if (ready) {
|
|
60
|
+
check_dev().then((data) => {
|
|
61
|
+
if (data && data.available === false) {
|
|
62
|
+
resolve({ closeModal: null, ready: false })
|
|
63
|
+
} else {
|
|
64
|
+
resolve({ closeModal: null, ready: true })
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
} else {
|
|
68
|
+
let loader = createMinimalLoadingSwal();
|
|
69
|
+
let interval = setInterval(() => {
|
|
70
|
+
check_ready().then((ready) => {
|
|
71
|
+
if (ready) {
|
|
72
|
+
clearInterval(interval)
|
|
73
|
+
check_dev().then((data) => {
|
|
74
|
+
if (data && data.available === false) {
|
|
75
|
+
resolve({ ready: false, closeModal: loader })
|
|
76
|
+
} else {
|
|
77
|
+
resolve({ ready: true, closeModal: loader })
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
}, 500)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
3
88
|
function collectPostMessageTargets(contextWindow) {
|
|
4
89
|
const ctx = contextWindow || window;
|
|
5
90
|
const targets = new Set();
|
|
@@ -2872,93 +2957,25 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
2872
2957
|
}
|
|
2873
2958
|
}
|
|
2874
2959
|
|
|
2960
|
+
|
|
2875
2961
|
function guardCreateLauncher(api, defaults = null) {
|
|
2876
2962
|
if (!api || typeof api.showModal !== 'function') {
|
|
2877
2963
|
return;
|
|
2878
2964
|
}
|
|
2879
|
-
|
|
2880
|
-
if (
|
|
2881
|
-
|
|
2882
|
-
} else {
|
|
2883
|
-
api.showModal();
|
|
2884
|
-
}
|
|
2885
|
-
};
|
|
2886
|
-
const createMinimalLoadingSwal = () => {
|
|
2887
|
-
if (typeof window === 'undefined' || typeof window.Swal === 'undefined') {
|
|
2888
|
-
return () => {};
|
|
2965
|
+
wait_ready().then(({ closeModal, ready }) => {
|
|
2966
|
+
if (closeModal) {
|
|
2967
|
+
closeModal()
|
|
2889
2968
|
}
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
}
|
|
2894
|
-
const close = () => {
|
|
2895
|
-
if (swal.isVisible()) {
|
|
2896
|
-
swal.close();
|
|
2897
|
-
}
|
|
2898
|
-
};
|
|
2899
|
-
swal.fire({
|
|
2900
|
-
html: "<i class='fa-solid fa-circle-notch fa-spin'></i> Loading...",
|
|
2901
|
-
allowOutsideClick: false,
|
|
2902
|
-
allowEscapeKey: false,
|
|
2903
|
-
showConfirmButton: false,
|
|
2904
|
-
customClass: {
|
|
2905
|
-
container: 'loader-container',
|
|
2906
|
-
popup: 'loader-popup',
|
|
2907
|
-
htmlContainer: 'loader-dialog',
|
|
2908
|
-
footer: 'hidden',
|
|
2909
|
-
actions: 'hidden'
|
|
2910
|
-
}
|
|
2911
|
-
});
|
|
2912
|
-
return close;
|
|
2913
|
-
};
|
|
2914
|
-
const check_ready = () => {
|
|
2915
|
-
return fetch("/pinokio/requirements_ready").then((res) => {
|
|
2916
|
-
return res.json()
|
|
2917
|
-
}).then((res) => {
|
|
2918
|
-
if (res.error) {
|
|
2919
|
-
return false
|
|
2920
|
-
} else if (!res.requirements_pending) {
|
|
2921
|
-
return true
|
|
2922
|
-
}
|
|
2923
|
-
return false
|
|
2924
|
-
})
|
|
2925
|
-
}
|
|
2926
|
-
let closeMinimalLoadingModal
|
|
2927
|
-
let promise = new Promise((resolve, reject) => {
|
|
2928
|
-
check_ready().then((ready) => {
|
|
2929
|
-
if (ready) {
|
|
2930
|
-
console.log("ready 1", ready)
|
|
2931
|
-
resolve()
|
|
2932
|
-
} else {
|
|
2933
|
-
closeMinimalLoadingModal = createMinimalLoadingSwal();
|
|
2934
|
-
let interval = setInterval(() => {
|
|
2935
|
-
check_ready().then((ready) => {
|
|
2936
|
-
console.log("ready 2", ready)
|
|
2937
|
-
if (ready) {
|
|
2938
|
-
clearInterval(interval)
|
|
2939
|
-
resolve()
|
|
2940
|
-
}
|
|
2941
|
-
})
|
|
2942
|
-
}, 500)
|
|
2943
|
-
}
|
|
2944
|
-
})
|
|
2945
|
-
})
|
|
2946
|
-
promise.then(() => {
|
|
2947
|
-
if (closeMinimalLoadingModal) {
|
|
2948
|
-
closeMinimalLoadingModal()
|
|
2949
|
-
}
|
|
2950
|
-
console.log("ready")
|
|
2951
|
-
fetch('/bundle/dev')
|
|
2952
|
-
.then((response) => response.json())
|
|
2953
|
-
.then((data) => {
|
|
2954
|
-
console.log("Data", data)
|
|
2955
|
-
if (data && data.available === false) {
|
|
2956
|
-
const callback = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash);
|
|
2957
|
-
window.location.href = `/setup/dev?callback=${callback}`;
|
|
2969
|
+
if (ready) {
|
|
2970
|
+
if (defaults) {
|
|
2971
|
+
api.showModal(defaults);
|
|
2958
2972
|
} else {
|
|
2959
|
-
|
|
2973
|
+
api.showModal();
|
|
2960
2974
|
}
|
|
2961
|
-
}
|
|
2975
|
+
} else {
|
|
2976
|
+
const callback = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash);
|
|
2977
|
+
window.location.href = `/setup/dev?callback=${callback}`;
|
|
2978
|
+
}
|
|
2962
2979
|
})
|
|
2963
2980
|
}
|
|
2964
2981
|
|
package/server/public/style.css
CHANGED
|
@@ -2752,8 +2752,7 @@ aside .qr {
|
|
|
2752
2752
|
|
|
2753
2753
|
@media only screen and (max-width: 600px) {
|
|
2754
2754
|
aside .tab, aside .tab.submenu {
|
|
2755
|
-
|
|
2756
|
-
padding: 10px 0 !important;
|
|
2755
|
+
font-size: 11px;
|
|
2757
2756
|
}
|
|
2758
2757
|
aside .caption {
|
|
2759
2758
|
width: 50px !important;
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
if (targetMode === "_self") {
|
|
39
39
|
window.location.assign(url)
|
|
40
40
|
} else {
|
|
41
|
-
|
|
42
|
-
fetch("/go", {
|
|
43
|
-
method: "POST",
|
|
44
|
-
headers: {
|
|
45
|
-
"Content-Type": "application/json"
|
|
46
|
-
},
|
|
47
|
-
body: JSON.stringify({ url })
|
|
48
|
-
}).then((res) => {
|
|
49
|
-
return res.json()
|
|
50
|
-
}).then((res) => {
|
|
51
|
-
console.log(res)
|
|
52
|
-
})
|
|
41
|
+
window.open(url, "_blank", "browser")
|
|
42
|
+
// fetch("/go", {
|
|
43
|
+
// method: "POST",
|
|
44
|
+
// headers: {
|
|
45
|
+
// "Content-Type": "application/json"
|
|
46
|
+
// },
|
|
47
|
+
// body: JSON.stringify({ url })
|
|
48
|
+
// }).then((res) => {
|
|
49
|
+
// return res.json()
|
|
50
|
+
// }).then((res) => {
|
|
51
|
+
// console.log(res)
|
|
52
|
+
// })
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
hideTabLinkPopover({ immediate: true })
|
package/server/views/app.ejs
CHANGED
|
@@ -5361,7 +5361,6 @@ body.dark .pinokio-fork-dropdown-remote, body.dark .pinokio-publish-dropdown-rem
|
|
|
5361
5361
|
}
|
|
5362
5362
|
let default_selection = document.querySelector(".dynamic .submenu [data-default]")
|
|
5363
5363
|
if (default_selection) {
|
|
5364
|
-
console.log("CLICK default")
|
|
5365
5364
|
default_selection.click()
|
|
5366
5365
|
}
|
|
5367
5366
|
rendered = true
|
|
@@ -5387,7 +5386,6 @@ body.dark .pinokio-fork-dropdown-remote, body.dark .pinokio-publish-dropdown-rem
|
|
|
5387
5386
|
}
|
|
5388
5387
|
}
|
|
5389
5388
|
const refresh = async (silent, options) => {
|
|
5390
|
-
console.log("REFRESH")
|
|
5391
5389
|
|
|
5392
5390
|
if (options && options.nodelay) {
|
|
5393
5391
|
} else {
|
|
@@ -5502,7 +5500,7 @@ body.dark .pinokio-fork-dropdown-remote, body.dark .pinokio-publish-dropdown-rem
|
|
|
5502
5500
|
refresh_du("logs")
|
|
5503
5501
|
} else {
|
|
5504
5502
|
<% if (type === 'run') { %>
|
|
5505
|
-
if (event.data.type === 'start') {
|
|
5503
|
+
if (event.data.type === 'start' || event.data.type === "disconnect" || (event.data.type === 'event' && event.data.data === 'stop')) {
|
|
5506
5504
|
ignorePersistedSelection = true
|
|
5507
5505
|
}
|
|
5508
5506
|
<% } %>
|
package/server/views/index.ejs
CHANGED
|
@@ -756,6 +756,49 @@ let paths = location.pathname.split("/").filter(x=>x)
|
|
|
756
756
|
var term
|
|
757
757
|
const n = new N()
|
|
758
758
|
let socket = new Socket()
|
|
759
|
+
window.PinokioHomeGuardNavigate = null;
|
|
760
|
+
<% if (ishome) { %>
|
|
761
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
762
|
+
// Run wait_ready for every /home navigation so we only leave when requirements are satisfied
|
|
763
|
+
const guardNavigate = (href, options = {}) => {
|
|
764
|
+
wait_ready().then(({ closeModal, ready }) => {
|
|
765
|
+
if (closeModal) {
|
|
766
|
+
closeModal()
|
|
767
|
+
}
|
|
768
|
+
if (ready) {
|
|
769
|
+
options?.replace ? location.replace(href) : location.assign(href);
|
|
770
|
+
} else {
|
|
771
|
+
const callback = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash);
|
|
772
|
+
window.location.href = `/setup/dev?callback=${callback}`;
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
};
|
|
776
|
+
// Capture same-window anchor clicks and reroute them through the guard
|
|
777
|
+
document.addEventListener("click", (event) => {
|
|
778
|
+
// Ignore clicks the page already handled or anything besides a plain left-click
|
|
779
|
+
if (event.defaultPrevented || event.button !== 0) return;
|
|
780
|
+
// Let modifier-assisted shortcuts (open in new tab, etc.) behave normally
|
|
781
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
782
|
+
// Only guard actual anchor navigations
|
|
783
|
+
const anchor = event.target.closest("a[href]");
|
|
784
|
+
if (!anchor) return;
|
|
785
|
+
// Skip downloads so they aren’t blocked by readiness polling
|
|
786
|
+
if (anchor.hasAttribute("download")) return;
|
|
787
|
+
// Don’t intercept links that explicitly open in another browsing context
|
|
788
|
+
const targetAttr = anchor.getAttribute("target");
|
|
789
|
+
if (targetAttr && targetAttr !== "_self") return;
|
|
790
|
+
// Ignore hash jumps, javascript: URLs, and empty hrefs
|
|
791
|
+
const rawHref = anchor.getAttribute("href") || "";
|
|
792
|
+
if (!rawHref || rawHref.startsWith("#") || /^javascript:/i.test(rawHref)) return;
|
|
793
|
+
// Prevent cross-origin navigations from being delayed—they don’t hit Pinokio anyway
|
|
794
|
+
const url = new URL(anchor.href, location.href);
|
|
795
|
+
if (url.origin !== location.origin) return;
|
|
796
|
+
event.preventDefault();
|
|
797
|
+
guardNavigate(url.toString());
|
|
798
|
+
});
|
|
799
|
+
window.PinokioHomeGuardNavigate = guardNavigate;
|
|
800
|
+
});
|
|
801
|
+
<% } %>
|
|
759
802
|
const pull = async () => {
|
|
760
803
|
if (!term) {
|
|
761
804
|
<% if (theme === "dark") { %>
|
|
@@ -1004,7 +1047,12 @@ document.querySelector("form input[type=search]").focus()
|
|
|
1004
1047
|
//})
|
|
1005
1048
|
<% if (display.includes("install")) { %>
|
|
1006
1049
|
document.querySelector("#install").addEventListener("click", async (e) => {
|
|
1007
|
-
|
|
1050
|
+
const targetUrl = e.target.getAttribute("data-url");
|
|
1051
|
+
if (window.PinokioHomeGuardNavigate) {
|
|
1052
|
+
window.PinokioHomeGuardNavigate(targetUrl);
|
|
1053
|
+
} else {
|
|
1054
|
+
location.href = targetUrl;
|
|
1055
|
+
}
|
|
1008
1056
|
})
|
|
1009
1057
|
<% } %>
|
|
1010
1058
|
//Reporter()
|
|
@@ -1384,7 +1432,11 @@ document.addEventListener("click", async (e) => {
|
|
|
1384
1432
|
e.preventDefault()
|
|
1385
1433
|
e.stopPropagation()
|
|
1386
1434
|
let src = target.getAttribute("data-src")
|
|
1387
|
-
|
|
1435
|
+
if (window.PinokioHomeGuardNavigate) {
|
|
1436
|
+
window.PinokioHomeGuardNavigate(src)
|
|
1437
|
+
} else {
|
|
1438
|
+
location.href = src
|
|
1439
|
+
}
|
|
1388
1440
|
return
|
|
1389
1441
|
}
|
|
1390
1442
|
|