mirror of
https://github.com/halfwaystudent/douyin-sparkflow.git
synced 2026-09-05 07:27:53 +08:00
fix: retry mobile QR loading
This commit is contained in:
@@ -193,6 +193,8 @@ class WebUiSafetyTests(unittest.TestCase):
|
||||
block_end = script.index('document.querySelectorAll(".login-desktop-save")', block_start)
|
||||
block = script[block_start:block_end]
|
||||
self.assertLess(block.index("window.open(publicUrl"), block.index('await postForm("/login-desktop/open")'))
|
||||
self.assertIn("refreshLoginQr(1800)", block)
|
||||
self.assertIn("retries - 1", script)
|
||||
|
||||
def test_schedule_sync_writes_configured_window_to_shared_spool(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
|
||||
@@ -383,7 +383,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
const refreshLoginQr = async (delay = 0) => {
|
||||
const refreshLoginQr = async (delay = 0, retries = 8) => {
|
||||
if (!qrImage) return;
|
||||
window.clearTimeout(qrRefreshTimer);
|
||||
qrRefreshTimer = window.setTimeout(async () => {
|
||||
@@ -401,7 +401,12 @@
|
||||
if (previous) URL.revokeObjectURL(previous);
|
||||
if (qrStatus) qrStatus.textContent = "二维码已加载。如果过期,点击刷新。";
|
||||
} catch {
|
||||
if (qrStatus) qrStatus.textContent = "二维码还未准备好,请稍后刷新。";
|
||||
if (retries > 1) {
|
||||
if (qrStatus) qrStatus.textContent = "登录页正在加载,继续等待二维码...";
|
||||
refreshLoginQr(1400, retries - 1);
|
||||
} else if (qrStatus) {
|
||||
qrStatus.textContent = "二维码还未准备好,请点击刷新重试。";
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user