From 80b8d2e34f8625202b32d982ea974a3ac158ce3f Mon Sep 17 00:00:00 2001 From: weishu Date: Thu, 18 Dec 2025 16:28:24 +0800 Subject: [PATCH] fix: remove unreliable Telegram environment detection to fix loading delay Remove unreliable conditions from Telegram environment detection in useAuthSource: - window.Telegram !== undefined: Always true due to unconditional SDK loading - window.self !== window.top: Causes false positives in iframe scenarios Only keep URL parameter detection (tgWebApp in search/hash) which is reliable. This prevents 5-second polling delay before login page displays on PC browser. --- web/src/hooks/useAuthSource.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/web/src/hooks/useAuthSource.ts b/web/src/hooks/useAuthSource.ts index 8439642e..bc36bafb 100644 --- a/web/src/hooks/useAuthSource.ts +++ b/web/src/hooks/useAuthSource.ts @@ -78,11 +78,9 @@ export function useAuthSource(): { } // Check if we're likely in a Telegram environment before polling - // Hints: Telegram object exists (SDK loading), iframe, or Telegram URL params (in query or hash) + // Only use URL params (tgWebApp) as reliable indicator const hasTelegramHint = typeof window !== 'undefined' && ( - window.Telegram !== undefined || - window.self !== window.top || window.location.search.includes('tgWebApp') || window.location.hash.includes('tgWebApp') )