chore(vk): temporary deep-link diagnostic (remove after contour catch)
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 56s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m26s

This commit is contained in:
Ilia Denisov
2026-06-29 22:41:08 +02:00
parent 6a5ce12fab
commit 0ea9764a0d
+20 -5
View File
@@ -751,8 +751,19 @@ async function bootVK(): Promise<void> {
for (let attempt = 0; ; attempt++) { for (let attempt = 0; ; attempt++) {
try { try {
await adoptSession(await gateway.authVK(params, displayName)); await adoptSession(await gateway.authVK(params, displayName));
// A VK direct-link deep link (vk.com/app<id>#<param>) rides in as the `hash` launch param. // A VK direct-link deep link (vk.com/app<id>?hash=<param>) rides in as the `hash` launch param.
if (!app.blocked) await routeStartParam(vkStartParam()); const sp = vkStartParam();
const diag = app.blocked ? 'blocked' : await routeStartParam(sp);
// TEMP VK deep-link diagnostic (remove after the contour catch): VK launches are not
// reproducible locally and the cold-boot path lands unexpectedly on the lobby, so surface
// the raw query, the parsed payload, the redeem outcome and the final route.
console.log('[VK deeplink]', {
rawSearch: typeof location !== 'undefined' ? location.search : '',
hash: sp,
outcome: diag,
route: router.route.name,
});
showToast(`VK dl: "${sp || '∅'}" -> ${diag}`);
app.bootError = false; app.bootError = false;
return; return;
} catch (err) { } catch (err) {
@@ -814,12 +825,12 @@ export async function retryTelegramLaunch(): Promise<void> {
* specific game, the friends screen with a friend-code redemption, or the lobby * specific game, the friends screen with a friend-code redemption, or the lobby
* (where invitations surface as a badge). * (where invitations surface as a badge).
*/ */
async function routeStartParam(param: string): Promise<void> { async function routeStartParam(param: string): Promise<string> {
const link = parseStartParam(param); const link = parseStartParam(param);
switch (link.kind) { switch (link.kind) {
case 'game': case 'game':
navigate(`/game/${link.id}`); navigate(`/game/${link.id}`);
return; return 'game:' + link.id;
case 'friendCode': case 'friendCode':
try { try {
const friend = await gateway.friendCodeRedeem(link.code); const friend = await gateway.friendCodeRedeem(link.code);
@@ -832,6 +843,7 @@ async function routeStartParam(param: string): Promise<void> {
showToast(t('friends.added', { name: friend.displayName })); showToast(t('friends.added', { name: friend.displayName }));
} }
void refreshNotifications(); void refreshNotifications();
return 'friendCode ok: ' + friend.displayName;
} catch (err) { } catch (err) {
const code = err instanceof GatewayError ? err.code : ''; const code = err instanceof GatewayError ? err.code : '';
if (code === 'self_relation') { if (code === 'self_relation') {
@@ -839,19 +851,22 @@ async function routeStartParam(param: string): Promise<void> {
// scary "can't do that to yourself" error. // scary "can't do that to yourself" error.
navigate('/friends'); navigate('/friends');
showToast(t('friends.selfInvite')); showToast(t('friends.selfInvite'));
return 'friendCode self_relation';
} else if (code === 'friend_code_invalid') { } else if (code === 'friend_code_invalid') {
// A previously shared link whose single-use, 12h code is already spent or expired: // A previously shared link whose single-use, 12h code is already spent or expired:
// land in the lobby and gently point at the bot, rather than a red error on Friends. // land in the lobby and gently point at the bot, rather than a red error on Friends.
navigate('/'); navigate('/');
app.staleInvite = true; app.staleInvite = true;
return 'friendCode invalid/stale -> lobby';
} else { } else {
navigate('/friends'); navigate('/friends');
handleError(err); handleError(err);
return 'friendCode err: ' + (code || 'unknown');
} }
} }
return;
default: default:
navigate('/'); navigate('/');
return 'lobby (empty/unknown param)';
} }
} }