A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(api): let the desktop poll its handoff after failed codes (#3571)
Hampus31636941f377
diff --git a/fluxer_api/src/api/auth/services/DesktopHandoffService.ts b/fluxer_api/src/api/auth/services/DesktopHandoffService.tsindex 991cd9538..f1af5757b 100644--- a/fluxer_api/src/api/auth/services/DesktopHandoffService.ts+++ b/fluxer_api/src/api/auth/services/DesktopHandoffService.ts@@ -220,9 +220,12 @@ export class DesktopHandoffService {}> {const {cache} = this.apiContext.services;const normalizedCode = requireNormalizedHandoffCode(code);- await this.checkAttemptLimit(pollerIp);const tokenKey = `${HANDOFF_TOKEN_PREFIX}${normalizedCode}`;const tokenData = await cache.get<HandoffTokenData>(tokenKey);+ const handoffData = await cache.get<HandoffData>(`${HANDOFF_CODE_PREFIX}${normalizedCode}`);+ if (!secretMatchesHash(pollSecret, tokenData?.pollSecretHash ?? handoffData?.pollSecretHash)) {+ await this.checkAttemptLimit(pollerIp);+ }if (tokenData) {if (!secretMatchesHash(pollSecret, tokenData.pollSecretHash)) {await this.recordFailedAttempt(pollerIp);@@ -244,7 +247,6 @@ export class DesktopHandoffService {userId: tokenData.userId,};}- const handoffData = await cache.get<HandoffData>(`${HANDOFF_CODE_PREFIX}${normalizedCode}`);if (handoffData) {return {status: handoffData.denied ? 'denied' : 'pending'};}