mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
Update ConnectionModal.tsx
This commit is contained in:
@@ -297,13 +297,20 @@ export default function ConnectionModal({ onClose }: ConnectionModalProps) {
|
|||||||
|
|
||||||
const handleConnect = (app: AppInfo) => {
|
const handleConnect = (app: AppInfo) => {
|
||||||
if (!app.deepLink || !isValidDeepLink(app.deepLink)) return;
|
if (!app.deepLink || !isValidDeepLink(app.deepLink)) return;
|
||||||
const lang = i18n.language?.startsWith('ru') ? 'ru' : 'en';
|
const deepLink = app.deepLink;
|
||||||
const redirectUrl = `${window.location.origin}/miniapp/redirect.html?url=${encodeURIComponent(app.deepLink)}&lang=${lang}`;
|
|
||||||
|
// All deep links (including custom schemes like happ://, clash://, etc.)
|
||||||
|
// go through redirect.html. Telegram's openLink opens the redirect page
|
||||||
|
// in an external browser, which then performs window.location.href to the
|
||||||
|
// actual deep link URL. This works for both http(s) and custom schemes.
|
||||||
|
const redirectUrl = `${window.location.origin}/miniapp/redirect.html?url=${encodeURIComponent(deepLink)}&lang=${i18n.language || 'en'}`;
|
||||||
|
|
||||||
const tg = (
|
const tg = (
|
||||||
window as unknown as {
|
window as unknown as {
|
||||||
Telegram?: { WebApp?: { openLink?: (url: string, options?: object) => void } };
|
Telegram?: { WebApp?: { openLink?: (url: string, options?: object) => void } };
|
||||||
}
|
}
|
||||||
).Telegram?.WebApp;
|
).Telegram?.WebApp;
|
||||||
|
|
||||||
if (tg?.openLink) {
|
if (tg?.openLink) {
|
||||||
try {
|
try {
|
||||||
tg.openLink(redirectUrl, { try_instant_view: false, try_browser: true });
|
tg.openLink(redirectUrl, { try_instant_view: false, try_browser: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user