Implement frontend session routing flow

- Validate and prepare access links in apps/frontend
- Add session, ended, and unauthorized routes with polling
- Copy full public access URLs from the admin links page
This commit is contained in:
user
2026-03-28 19:10:24 +02:00
parent 31a501f75b
commit 92deee1b2e
16 changed files with 392 additions and 119 deletions

View File

@@ -1,8 +1,8 @@
import LayoutDashboard from "@lucide/svelte/icons/layout-dashboard";
import { PUBLIC_WS_SCRCPY_SVC_URL } from "$env/static/public";
import AppWindow from "@lucide/svelte/icons/app-window";
import { BellRingIcon, Link } from "@lucide/svelte";
import UserCircle from "~icons/lucide/user-circle";
import { env } from "$env/dynamic/public";
export type AppSidebarItem = {
title: string;
@@ -47,7 +47,7 @@ export const secondaryNavTree = [
},
] as AppSidebarItem[];
export const WS_SCRCPY_URL = PUBLIC_WS_SCRCPY_SVC_URL;
export const WS_SCRCPY_URL = env.PUBLIC_WS_SCRCPY_SVC_URL;
export const COMPANY_NAME = "SaaS Template";
export const WEBSITE_URL = "https://company.com";

View File

@@ -8,6 +8,7 @@
import { Input } from "$lib/components/ui/input";
import { Label } from "$lib/components/ui/label";
import * as Table from "$lib/components/ui/table";
import { env } from "$env/dynamic/public";
import MaxWidthWrapper from "$lib/components/molecules/max-width-wrapper.svelte";
import { mainNavTree } from "$lib/core/constants";
import { linkVM } from "$lib/domains/link/link.vm.svelte";
@@ -49,10 +50,18 @@
if (success) resetForm();
}
async function copyToken(token: string) {
function buildPublicLink(token: string): string {
const base = env.PUBLIC_FRONTEND_URL?.trim() || "/";
const origin = typeof window !== "undefined" ? window.location.origin : "http://localhost";
const url = new URL(base, origin);
url.searchParams.set("token", token);
return url.toString();
}
async function copyLink(token: string) {
try {
await navigator.clipboard.writeText(token);
toast.success("Token copied to clipboard");
await navigator.clipboard.writeText(buildPublicLink(token));
toast.success("Link copied to clipboard");
} catch {
toast.error("Failed to copy");
}
@@ -145,7 +154,7 @@
<button
class="text-muted-foreground hover:text-foreground shrink-0"
onclick={() =>
copyToken(link.token)}
copyLink(link.token)}
>
<Copy class="h-3.5 w-3.5" />
</button>
@@ -270,7 +279,7 @@
<button
class="text-muted-foreground hover:text-foreground"
onclick={() =>
copyToken(link.token)}
copyLink(link.token)}
>
<Copy class="h-3.5 w-3.5" />
</button>