A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(passkeys): accept the Android app on self-hosted instances (#3811)
Hampusa7905df27e5e
diff --git a/packages/config/src/ConfigLoader.ts b/packages/config/src/ConfigLoader.tsindex b392bee10..8a43938f5 100644--- a/packages/config/src/ConfigLoader.ts+++ b/packages/config/src/ConfigLoader.ts@@ -23,14 +23,18 @@ let cachedConfig: MasterConfig | null = null;const MAX_REPORT_RETENTION_DAYS = 36_500;+const OFFICIAL_ANDROID_PASSKEY_ORIGINS = [+ 'android:apk-key-hash:keSY4bimyLqZQV7bKXgpa2xYuqXi0qZJzsYtp6gpx7w',+ 'android:apk-key-hash:Ld4qnT0TfBeHMT3Yu2H0WTwqlxgFs-32uDmwqtLndsk',+];+const DEFAULT_PASSKEY_ORIGINS = ['https://fluxer.app','https://web.fluxer.app','https://web.canary.fluxer.app','https://fluxer.com','https://canary.fluxer.com',- 'android:apk-key-hash:keSY4bimyLqZQV7bKXgpa2xYuqXi0qZJzsYtp6gpx7w',- 'android:apk-key-hash:Ld4qnT0TfBeHMT3Yu2H0WTwqlxgFs-32uDmwqtLndsk',+ ...OFFICIAL_ANDROID_PASSKEY_ORIGINS,];function defaultConfig(): MasterConfig {@@ -894,6 +898,9 @@ function normalizePasskeys(config: MasterConfig, useDefaultOrigins: boolean): vo...new Set([...passkeys.additional_allowed_origins, new URL(config.endpoints.app).origin]),];}+ passkeys.additional_allowed_origins = [+ ...new Set([...passkeys.additional_allowed_origins, ...OFFICIAL_ANDROID_PASSKEY_ORIGINS]),+ ];}export async function loadConfig(): Promise<MasterConfig> {diff --git a/packages/config/src/__tests__/ConfigLoader.test.ts b/packages/config/src/__tests__/ConfigLoader.test.tsindex 4a974e7a5..a46edd154 100644--- a/packages/config/src/__tests__/ConfigLoader.test.ts+++ b/packages/config/src/__tests__/ConfigLoader.test.ts@@ -312,7 +312,11 @@ describe('FLUXER_PUBLIC_ORIGIN', () => {expect(config.endpoints.media).toBe('https://chat.example.com:29080/media');expect(config.services.media_proxy.upload_relay.endpoint).toBe('https://chat.example.com:29080/media');expect(config.integrations.voice.url).toBe('https://chat.example.com:29080/livekit');- expect(config.auth.passkeys.additional_allowed_origins).toEqual(['https://chat.example.com:29080']);+ expect(config.auth.passkeys.additional_allowed_origins).toEqual([+ 'https://chat.example.com:29080',+ 'android:apk-key-hash:keSY4bimyLqZQV7bKXgpa2xYuqXi0qZJzsYtp6gpx7w',+ 'android:apk-key-hash:Ld4qnT0TfBeHMT3Yu2H0WTwqlxgFs-32uDmwqtLndsk',+ ]);});test('the origin port wins over a FLUXER_PUBLIC_PORT that disagrees', async () => {