Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions openless-all/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,28 @@ export function App({ isCapsule, isQa }: AppProps) {
let cancelled = false;

if (os === 'win') {
// 超时保护:50 次 × 200ms = 10s。hotkey hook 永远 starting(被反作弊 / EDR
// / UAC 拦)时不让 UI 死锁灰屏,过 10s 强 setGate('ready') 让用户进
// Permissions 页看 hotkey_status.lastError 处理。详见 issue #163。
const POLL_INTERVAL_MS = 200;
const POLL_MAX_ATTEMPTS = 50;
const pollHotkeyStatus = async () => {
while (!cancelled) {
let attempts = 0;
while (!cancelled && attempts < POLL_MAX_ATTEMPTS) {
attempts += 1;
const status = await getHotkeyStatus();
if (cancelled) return;
if (status.state !== 'starting') {
setGate('ready');
return;
}
await new Promise(resolve => window.setTimeout(resolve, 200));
await new Promise(resolve => window.setTimeout(resolve, POLL_INTERVAL_MS));
}
if (!cancelled) {
console.warn(
`[startup] hotkey gate timed out after ${POLL_MAX_ATTEMPTS * POLL_INTERVAL_MS}ms; forcing ready so user can reach Permissions page`
);
setGate('ready');
}
};
void pollHotkeyStatus().catch(error => {
Expand Down
Loading