fix: restore desktop SSO callback

This commit is contained in:
Erwan Leboucher committed 2026-07-22 18:03:32 +02:00
1 parent e6b16c883c
commit 6d1dd90110
2 files changed
+20 -1

No files matched your search

+19
View File
@@ -1,4 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { type as osType } from '@tauri-apps/plugin-os';
import {
buildTauriSsoRedirectUrl,
parseTauriOidcCallback,
@@ -12,10 +13,28 @@ vi.mock('@tauri-apps/plugin-os', () => ({
}));
beforeEach(() => {
vi.unstubAllEnvs();
vi.mocked(osType).mockReturnValue('android');
localStorage.clear();
});
describe('buildTauriSsoRedirectUrl', () => {
it('uses the registered deep-link callback in production desktop builds', () => {
vi.stubEnv('DEV', false);
vi.mocked(osType).mockReturnValue('linux');
const url = new URL(buildTauriSsoRedirectUrl('https://hs.example'));
expect(url.protocol).toBe('sable:');
expect(url.hostname).toBe('login');
expect(url.pathname).toBe('/lp/sso-callback');
expect(url.searchParams.get('server')).toBe('https://hs.example');
const nonce = url.searchParams.get('sso_nonce');
expect(nonce).toBeTruthy();
expect(takeTauriSsoNonce()).toBe(nonce);
expect(takeTauriSsoNonce()).toBeUndefined();
});
it('embeds the server and stores the same nonce it puts in the url', () => {
const url = new URL(buildTauriSsoRedirectUrl('https://hs.example'));
expect(url.searchParams.get('server')).toBe('https://hs.example');
+1 -1
View File
@@ -16,7 +16,7 @@ const getAppBaseUrl = (): string => {
return `${TAURI_SSO_PROTOCOL}//${TAURI_SSO_HOST}`;
}
return 'https://app.sable.moe';
return `${TAURI_SSO_PROTOCOL}//${TAURI_SSO_HOST}`;
};
type TauriSsoCallback = {