mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
We tell users to check their firewall and ad blocker settings in case they bump into authentication problems. This also separates out the modal to be only used by the session view.
40 lines
1.0 KiB
Svelte
40 lines
1.0 KiB
Svelte
<script lang="ts">
|
|
import type { SessionRoute } from "@app/lib/router/definitions";
|
|
|
|
import { onMount } from "svelte";
|
|
|
|
import * as modal from "@app/lib/modal";
|
|
import * as router from "@app/lib/router";
|
|
import * as httpd from "@app/lib/httpd";
|
|
|
|
import AppLayout from "@app/App/AppLayout.svelte";
|
|
import Loading from "@app/components/Loading.svelte";
|
|
|
|
import AuthenticationErrorModal from "@app/modals/AuthenticationErrorModal.svelte";
|
|
|
|
export let activeRoute: SessionRoute;
|
|
|
|
onMount(async () => {
|
|
const port = Number.parseInt(activeRoute.params.apiAddr.split(":")[1]);
|
|
if (port > 0 && port < 2 ** 16) {
|
|
httpd.changeHttpdPort(port);
|
|
}
|
|
const isAuthenticated = await httpd.authenticate(activeRoute.params);
|
|
|
|
if (!isAuthenticated) {
|
|
modal.show({
|
|
component: AuthenticationErrorModal,
|
|
props: {},
|
|
});
|
|
}
|
|
void router.navigateToUrl(
|
|
"push",
|
|
new URL(activeRoute.params.path || "", window.location.origin),
|
|
);
|
|
});
|
|
</script>
|
|
|
|
<AppLayout>
|
|
<Loading center />
|
|
</AppLayout>
|