server be & fe

This commit is contained in:
azykov@mail.ru
2026-09-29 13:50:01 +03:00
commit 657009bd6c
56 changed files with 6162 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
export const DEEP_LINK_SCHEME = 'cardy';
export function buildLoginDeepLink(server: string, key: string): string {
return `${DEEP_LINK_SCHEME}://login?server=${encodeURIComponent(server)}&key=${encodeURIComponent(key)}`;
}
export function parseLoginDeepLink(link: string): { server: string; key: string } | null {
let url: URL;
try {
url = new URL(link.trim());
} catch {
return null;
}
// Non-special schemes put "login" into host for "cardy://login?…".
if (url.protocol !== `${DEEP_LINK_SCHEME}:` || url.host !== 'login') return null;
const server = url.searchParams.get('server');
const key = url.searchParams.get('key');
if (!server || !key) return null;
return { server, key };
}