pinokiod 7.1.66 → 7.1.67
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
CHANGED
|
@@ -49,11 +49,6 @@
|
|
|
49
49
|
color-scheme: light;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
body[data-page="connect"][data-agent="electron"] {
|
|
53
|
-
padding-top: 26px;
|
|
54
|
-
box-sizing: border-box;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
52
|
@media (prefers-color-scheme: dark) {
|
|
58
53
|
body[data-page="connect"] {
|
|
59
54
|
--connect-body-bg: #010617;
|
|
@@ -558,10 +553,8 @@
|
|
|
558
553
|
const name = "<%=name%>"
|
|
559
554
|
const SECURE_CONNECT_POLL_INTERVAL = 2000
|
|
560
555
|
const SECURE_CONNECT_TIMEOUT = 120000
|
|
561
|
-
const SECURE_CONNECT_BROWSER_RETRY_DELAY = 1200
|
|
562
556
|
let secureConnectPollTimer = null
|
|
563
557
|
let secureConnectTimeoutHandle = null
|
|
564
|
-
let secureConnectBrowserRetryHandle = null
|
|
565
558
|
|
|
566
559
|
function generateRandomString(length) {
|
|
567
560
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
@@ -593,21 +586,6 @@
|
|
|
593
586
|
.replace(/=/g, '');
|
|
594
587
|
}
|
|
595
588
|
|
|
596
|
-
async function openAuthInBrowser(authUrl) {
|
|
597
|
-
const response = await fetch('/go', {
|
|
598
|
-
method: 'POST',
|
|
599
|
-
headers: { 'Content-Type': 'application/json' },
|
|
600
|
-
body: JSON.stringify({ url: authUrl })
|
|
601
|
-
});
|
|
602
|
-
if (!response.ok) {
|
|
603
|
-
throw new Error(`Browser launch failed with status ${response.status}`);
|
|
604
|
-
}
|
|
605
|
-
const payload = await response.json().catch(() => ({}));
|
|
606
|
-
if (payload && payload.error) {
|
|
607
|
-
throw new Error(payload.error);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
589
|
// OAuth functions
|
|
612
590
|
async function login() {
|
|
613
591
|
try {
|
|
@@ -641,24 +619,10 @@
|
|
|
641
619
|
startSecureConnectPolling();
|
|
642
620
|
setStatus(`Continue the ${name} login in your browser.`, 'warning');
|
|
643
621
|
try {
|
|
644
|
-
|
|
645
|
-
clearTimeout(secureConnectBrowserRetryHandle);
|
|
646
|
-
secureConnectBrowserRetryHandle = null;
|
|
647
|
-
}
|
|
648
|
-
await openAuthInBrowser(authUrl);
|
|
649
|
-
secureConnectBrowserRetryHandle = setTimeout(async () => {
|
|
650
|
-
secureConnectBrowserRetryHandle = null;
|
|
651
|
-
try {
|
|
652
|
-
const token = await ensureValidToken();
|
|
653
|
-
if (!token && document.visibilityState === 'visible' && document.hasFocus()) {
|
|
654
|
-
await openAuthInBrowser(authUrl);
|
|
655
|
-
}
|
|
656
|
-
} catch (retryError) {
|
|
657
|
-
console.warn('Retry browser launch failed:', retryError);
|
|
658
|
-
}
|
|
659
|
-
}, SECURE_CONNECT_BROWSER_RETRY_DELAY);
|
|
622
|
+
window.open(authUrl, '_blank', 'browser');
|
|
660
623
|
} catch (openError) {
|
|
661
|
-
|
|
624
|
+
hideLoader();
|
|
625
|
+
setStatus(`Could not open the browser. Please open ${authUrl} manually.`, 'error');
|
|
662
626
|
return;
|
|
663
627
|
}
|
|
664
628
|
return;
|
|
@@ -684,10 +648,6 @@
|
|
|
684
648
|
clearTimeout(secureConnectTimeoutHandle);
|
|
685
649
|
secureConnectTimeoutHandle = null;
|
|
686
650
|
}
|
|
687
|
-
if (secureConnectBrowserRetryHandle) {
|
|
688
|
-
clearTimeout(secureConnectBrowserRetryHandle);
|
|
689
|
-
secureConnectBrowserRetryHandle = null;
|
|
690
|
-
}
|
|
691
651
|
if (message) {
|
|
692
652
|
hideLoader();
|
|
693
653
|
setStatus(message, type);
|
|
@@ -866,15 +826,12 @@
|
|
|
866
826
|
|
|
867
827
|
function startHttpConnect() {
|
|
868
828
|
stopConnectPolling()
|
|
869
|
-
showLoader(
|
|
829
|
+
showLoader(`Connecting... Complete the login in the ${CONNECT_AGENT === 'electron' ? 'browser' : 'secure window'}.`, {
|
|
870
830
|
cancellable: true,
|
|
871
831
|
onCancel: () => stopConnectPolling('Connection cancelled.', 'warning')
|
|
872
832
|
})
|
|
873
833
|
setStatus('Waiting for connection...', 'warning')
|
|
874
|
-
|
|
875
|
-
if (!secureWindow) {
|
|
876
|
-
setStatus('Could not open the secure window. Please allow pop-ups or open https://pinokio.localhost/connect/<%=name%> manually.', 'error')
|
|
877
|
-
}
|
|
834
|
+
window.open(SECURE_CONNECT_URL, '_blank', 'browser')
|
|
878
835
|
pollConnectStatus()
|
|
879
836
|
connectPollTimer = setInterval(pollConnectStatus, CONNECT_POLL_INTERVAL)
|
|
880
837
|
connectTimeoutHandle = setTimeout(() => {
|