Add "Clone" button to projects

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2021-09-16 14:32:03 +02:00
parent 287e56153a
commit 8bbc7ec0f1
4 changed files with 64 additions and 5 deletions
+7 -2
View File
@@ -197,8 +197,13 @@ export function formatRadicleId(hash: Uint8Array): string {
}
// Parse a Radicle Id (URN).
export function parseRadicleId(urn: string): Uint8Array {
const encoded = urn.replace(/^rad:[a-z]+:/, "");
export function parseRadicleId(urn: string): string {
return urn.replace(/^rad:[a-z]+:/, "");
}
// Decode a Radicle Id (URN).
export function decodeRadicleId(urn: string): Uint8Array {
const encoded = parseRadicleId(urn);
const multihash = multibase.decode(encoded);
const hash = multihashes.decode(multihash);