重构为 HTTP SSO 扫码方案并引入 Vue3 前端

移除 Playwright 浏览器自动化,改用 passport/SSO HTTP 接口获取二维码与轮询登录;后端模块化拆分,前端替换为 Vue3 SPA。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
travel
2026-06-25 10:47:55 +08:00
parent 853dacf528
commit 9e0644095f
33 changed files with 4792 additions and 1640 deletions
+60
View File
@@ -0,0 +1,60 @@
import { ref, onUnmounted } from 'vue'
/**
* 自适应间隔轮询:tick 返回后按 getInterval() 调度下一次
* @param {() => Promise<void>|void} tickFn
* @param {() => number} getIntervalMs
*/
export function useLivePoll(tickFn, getIntervalMs = () => 1000) {
const lastTickAt = ref(null)
const ticking = ref(false)
let timer = null
let inFlight = false
let running = false
async function runTick() {
if (inFlight) return
inFlight = true
ticking.value = true
try {
await tickFn()
lastTickAt.value = Date.now()
} catch (e) {
console.error('[livePoll]', e)
} finally {
inFlight = false
ticking.value = false
}
}
function scheduleNext() {
if (!running) return
clearTimeout(timer)
const ms = Math.max(500, getIntervalMs())
timer = setTimeout(async () => {
await runTick()
scheduleNext()
}, ms)
}
function start() {
if (running) return
running = true
runTick().then(scheduleNext)
}
function stop() {
running = false
clearTimeout(timer)
timer = null
}
function restart() {
stop()
start()
}
onUnmounted(stop)
return { start, stop, restart, runTick, lastTickAt, ticking }
}