fix: sso login on mobile

This commit is contained in:
hazre committed 2026-03-12 22:48:57 +01:00
1 parent fd6a135a2b
commit bf36d2b376
4 files changed
+32 -8

No files matched your search

+10 -2
View File
@@ -16,7 +16,15 @@
"deep-link:default",
"os:default",
"opener:default",
"opener:allow-open-url",
"opener:allow-default-urls"
"opener:allow-default-urls",
{
"identifier": "opener:allow-open-url",
"allow": [
{
"url": "https://*",
"app": "inAppBrowser"
}
]
}
]
}
+4 -1
View File
@@ -4,6 +4,7 @@ import { MouseEvent, useMemo } from 'react';
import { isTauri } from '@tauri-apps/api/core';
import { openUrl } from '@tauri-apps/plugin-opener';
import { useAutoDiscoveryInfo } from '$hooks/useAutoDiscoveryInfo';
import { type as osType } from '@tauri-apps/plugin-os';
type SSOLoginProps = {
providers?: IIdentityProvider[];
@@ -30,7 +31,9 @@ export function SSOLogin({ providers, redirectUrl, action, saveScreenSpace }: SS
const openSso = async (event: MouseEvent, url: string) => {
if (!isTauri()) return;
event.preventDefault();
await openUrl(url);
const os = osType();
const urlProgram = os === 'ios' || os === 'android' ? 'inAppBrowser' : undefined;
await openUrl(url, urlProgram);
};
return (
+13 -4
View File
@@ -1,12 +1,21 @@
import { SSO_CALLBACK_PATH } from '$pages/paths';
import { type as osType } from '@tauri-apps/plugin-os';
const TAURI_SSO_PROTOCOL = 'sable:';
const TAURI_SSO_HOST = 'login';
const getAppBaseUrl = (): string =>
import.meta.env.DEV
? 'https://feat-tauri-integration-sable.raspy-dream-bb1d.workers.dev'
: 'https://app.sable.moe';
const getAppBaseUrl = (): string => {
const os = osType();
if (os === 'ios' || os === 'android') {
return `${TAURI_SSO_PROTOCOL}//${TAURI_SSO_HOST}`;
}
if (import.meta.env.DEV) {
return window.location.origin;
}
return 'https://app.sable.moe';
};
type TauriSsoCallback = {
loginToken: string;
+5 -1
View File
@@ -226,7 +226,11 @@ export default defineConfig({
force: true,
// Keep matrix-widget-api prebundled so matrix-js-sdk can import its named exports in dev.
// Force CJS interop for stability across optimizer cache rebuilds.
include: ['matrix-widget-api'],
include: [
'matrix-widget-api',
'workbox-precaching',
'@vanilla-extract/recipes/createRuntimeFn',
],
needsInterop: ['matrix-widget-api'],
esbuildOptions: {
define: {