Fix Amber timeout: increase to 3 minutes so user has time to approve in Amber and return
Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
bd149fdb2c
commit
dfb60674c5
1 changed files with 7 additions and 4 deletions
|
|
@ -276,7 +276,7 @@ export const LoginDialog: React.FC<LoginDialogProps> = ({ isOpen, onClose, onLog
|
|||
|
||||
amberStepRef.current = 'waiting';
|
||||
setAmberStep('waiting');
|
||||
setAmberStatus('Waiting for Amber to approve...');
|
||||
setAmberStatus('Approve in Amber, then come back here.');
|
||||
|
||||
// Live relay subscription (works on web/PWA; may be backgrounded in Capacitor)
|
||||
const pool = new SimplePool();
|
||||
|
|
@ -316,10 +316,13 @@ export const LoginDialog: React.FC<LoginDialogProps> = ({ isOpen, onClose, onLog
|
|||
);
|
||||
subRef.current = sub;
|
||||
|
||||
// Timeout after 20 seconds — show error, let user retry
|
||||
// On Capacitor (native app) give 3 minutes — the visibility change handler does the real work
|
||||
// after the user returns from Amber, so the live subscription just needs to stay alive.
|
||||
// On web/PWA the live subscription fires instantly, so 3 min is still fine as a safety net.
|
||||
const TIMEOUT_MS = isCapacitor ? 3 * 60 * 1000 : 3 * 60 * 1000;
|
||||
setTimeout(() => {
|
||||
if (!controller.signal.aborted) {
|
||||
console.warn('[Amber] Timed out after 20s — no response received');
|
||||
console.warn('[Amber] Timed out — no response received');
|
||||
controller.abort();
|
||||
cleanup();
|
||||
if (amberStepRef.current === 'waiting') {
|
||||
|
|
@ -328,7 +331,7 @@ export const LoginDialog: React.FC<LoginDialogProps> = ({ isOpen, onClose, onLog
|
|||
setAmberStatus('Amber did not respond in time. Did you approve the connection?');
|
||||
}
|
||||
}
|
||||
}, 20 * 1000);
|
||||
}, TIMEOUT_MS);
|
||||
}, [cleanup, completeLogin, toast]);
|
||||
|
||||
const handleBunkerLogin = async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue