Add redirection to project depending on rad-web cwd

This commit is contained in:
Sebastian Martinez
2024-02-07 11:47:08 +00:00
committed by Rūdolfs Ošiņš
parent 414c6cafda
commit 2b3b8bc0de
7 changed files with 28 additions and 11 deletions
Generated
+5 -5
View File
@@ -88,17 +88,17 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1706704813,
"narHash": "sha256-o0F1Bm1eUtDyz28hQdyktaW8dDnQl4bLeZhDUbP9dgM=",
"lastModified": 1707134016,
"narHash": "sha256-Cu8fHlircqH6qY9fN7Q5EWFgOZN1751BTKAKUI0AVQo=",
"ref": "master",
"rev": "15d17098315469bb180157d1c20344faa10f4f73",
"revCount": 1658,
"rev": "5abd7bf55a093341231c8b71953777068eade0e2",
"revCount": 1667,
"type": "git",
"url": "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git"
},
"original": {
"ref": "master",
"rev": "15d17098315469bb180157d1c20344faa10f4f73",
"rev": "5abd7bf55a093341231c8b71953777068eade0e2",
"type": "git",
"url": "https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git"
}
+1 -1
View File
@@ -4,7 +4,7 @@
nixpkgs.follows = "heartwood/nixpkgs";
flake-utils.follows = "heartwood/flake-utils";
heartwood = {
url = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git?ref=master&rev=15d17098315469bb180157d1c20344faa10f4f73";
url = "git+https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git?ref=master&rev=5abd7bf55a093341231c8b71953777068eade0e2";
};
};
+5 -2
View File
@@ -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>
+1
View File
@@ -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,
},
};
}
+7 -1
View File
@@ -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 {
+7
View File
@@ -35,7 +35,14 @@
},
});
}
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>
+1 -1
View File
@@ -1 +1 @@
15d17098315469bb180157d1c20344faa10f4f73
5abd7bf55a093341231c8b71953777068eade0e2