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:
@@ -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";
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user