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.
This commit is contained in:
weishu
2025-12-18 16:28:24 +08:00
parent f95350d245
commit 80b8d2e34f
+1 -3
View File
@@ -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')
)