From d38f553c4fea62ca0b865d2b600fb4c69b6ea081 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 13 Sep 2024 17:13:38 +0800 Subject: [PATCH] use 127.0.0.1 and fix auth error --- apps/desktop/src/routes/(main)/index.tsx | 34 ++++----- apps/desktop/src/routes/permissions.tsx | 75 ++++++++++--------- .../app/api/desktop/session/request/route.ts | 2 +- 3 files changed, 58 insertions(+), 53 deletions(-) diff --git a/apps/desktop/src/routes/(main)/index.tsx b/apps/desktop/src/routes/(main)/index.tsx index 8dd04d1a..67ab15e0 100644 --- a/apps/desktop/src/routes/(main)/index.tsx +++ b/apps/desktop/src/routes/(main)/index.tsx @@ -79,29 +79,28 @@ export default function () { } }); - const windowsData = createMemo(() => windows.data ?? []); - const audioDevicesData = createMemo(() => audioDevices.data ?? []); - const camerasData = createMemo(() => cameras() ?? []); - createUpdateCheck(); return (
{(options) => { - const selectedWindow = createMemo(() => { + const selectedWindow = () => { const d = options().captureTarget; if (d.type !== "window") return; - return windowsData().find((data) => data.id === d.id); - }); + return windows.data?.find((data) => data.id === d.id); + }; - const audioDevice = () => - audioDevicesData().find((d) => d.name === options().audioInputName); + const audioDevice = () => { + return audioDevices.data?.find( + (d) => d.name === options().audioInputName + ); + }; return ( <> - options={windowsData()} + options={windows.data ?? []} optionValue="id" optionTextValue="name" placeholder="Window" @@ -185,7 +184,7 @@ export default function () { class={topRightAnimateClasses} > 0} + when={(windows.data ?? []).length > 0} fallback={
No windows available @@ -203,10 +202,7 @@ export default function () {
- options={[ - { deviceId: "", label: "No Camera" }, - ...camerasData(), - ]} + options={[{ deviceId: "", label: "No Camera" }, ...cameras()]} optionValue="deviceId" optionTextValue="label" placeholder="No Camera" @@ -232,8 +228,10 @@ export default function () { > - class="flex-1 text-left truncate"> - {(state) => <>{state.selectedOption().label}} + class="flex-1 text-left truncate"> + {(state) => <>{state.selectedOption()?.label}}
}> -
-

- {currentStep().name} Permission -

-
- - Open Settings + + +
+

+ {currentStep().name} Permission +

+
+ + Open Settings + + } + > + + + - } - > - - - -
-
+
+
+ +
); diff --git a/apps/web/app/api/desktop/session/request/route.ts b/apps/web/app/api/desktop/session/request/route.ts index 50b0223a..661a902c 100644 --- a/apps/web/app/api/desktop/session/request/route.ts +++ b/apps/web/app/api/desktop/session/request/route.ts @@ -39,7 +39,7 @@ export async function GET(req: NextRequest) { } const returnUrl = new URL( - `http://localhost:${port}?token=${tokenValue}&expires=${decodedToken?.exp}` + `http://127.0.0.1:${port}?token=${tokenValue}&expires=${decodedToken?.exp}` ); return Response.redirect(returnUrl.href);