mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Add redirection to project depending on rad-web cwd
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<script>
|
||||
import { api, httpdStore } from "@app/lib/httpd";
|
||||
import Command from "./Command.svelte";
|
||||
|
||||
$: path = window.location.href.replace(window.location.origin, "");
|
||||
$: pathParam = path === "/" ? "" : `--path "${path}"`;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -31,14 +34,14 @@
|
||||
<div class="label">Authenticate with your local node to make changes.</div>
|
||||
<Command
|
||||
fullWidth
|
||||
command={`rad web ${window.origin} --connect ${api.hostname}:${api.port}`} />
|
||||
command={`rad web ${window.origin} --connect ${api.hostname}:${api.port} ${pathParam}`} />
|
||||
{:else}
|
||||
<div class="heading">Connect & Authenticate</div>
|
||||
<div class="label">
|
||||
Connect to your local node to browse projects on your local machine,
|
||||
create issues, and participate in discussions.
|
||||
</div>
|
||||
<Command fullWidth command={`rad web ${window.origin}`} />
|
||||
<Command fullWidth command={`rad web ${window.origin} ${pathParam}`} />
|
||||
|
||||
<div class="divider" />
|
||||
<div class="heading">New to Radicle?</div>
|
||||
|
||||
@@ -221,6 +221,7 @@ export function urlToRoute(url: URL): Route | null {
|
||||
signature: url.searchParams.get("sig") ?? "",
|
||||
publicKey: url.searchParams.get("pk") ?? "",
|
||||
apiAddr: url.searchParams.get("addr") ?? "127.0.0.1:8080",
|
||||
path: url.searchParams.get("path") || undefined,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,7 +20,13 @@ export interface NotFoundRoute {
|
||||
|
||||
interface SessionRoute {
|
||||
resource: "session";
|
||||
params: { id: string; signature: string; publicKey: string; apiAddr: string };
|
||||
params: {
|
||||
id: string;
|
||||
signature: string;
|
||||
publicKey: string;
|
||||
apiAddr: string;
|
||||
path?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface LoadErrorRoute {
|
||||
|
||||
@@ -35,7 +35,14 @@
|
||||
},
|
||||
});
|
||||
}
|
||||
void router.push({ resource: "home" });
|
||||
const route = router.urlToRoute(
|
||||
new URL(activeRoute.params.path || "", window.location.origin),
|
||||
);
|
||||
if (route) {
|
||||
void router.push(route);
|
||||
} else {
|
||||
void router.push({ resource: "home" });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user