Allow seeding a missing repo from a reference

Following a link to a repo we don't have only led to the explorer, but
the reason it's missing is usually that we haven't seeded it yet.
A deep link that can't be opened now says so instead of doing nothing.
This commit is contained in:
Rūdolfs Ošiņš
2026-10-06 11:16:14 +02:00
parent e010517b79
commit e793ed5f01
12 changed files with 367 additions and 95 deletions
+34 -19
View File
@@ -26,6 +26,7 @@
import type { Config } from "@bindings/config/Config";
import { writeToClipboard } from "@app/lib/invoke";
import { seedRepo } from "@app/lib/seedRepo";
import { explorerHost } from "@app/lib/utils";
import ContextMenu from "@app/components/ContextMenu.svelte";
@@ -35,33 +36,37 @@
x: number;
y: number;
target: HTMLElement;
url: string;
url?: string;
uri: string;
/** A repo that isn't on this node, offered for seeding. */
seedRid?: string;
config: Config;
onclose: () => void;
}
const { x, y, target, url, uri, config, onclose }: Props = $props();
const { x, y, target, url, uri, seedRid, config, onclose }: Props = $props();
</script>
<ContextMenu {x} {y} {target} {onclose}>
<a
class="menu-item"
role="menuitem"
href={url}
target="_blank"
rel="noreferrer noopener">
<Icon name="open-external" />
Open in {explorerHost(config)}
</a>
<button
class="menu-item"
role="menuitem"
onclick={() => writeToClipboard(url)}>
<Icon name="link" />
Copy link to {explorerHost(config)}
</button>
<div class="menu-separator"></div>
{#if url}
<a
class="menu-item"
role="menuitem"
href={url}
target="_blank"
rel="noreferrer noopener">
<Icon name="open-external" />
Open in {explorerHost(config)}
</a>
<button
class="menu-item"
role="menuitem"
onclick={() => writeToClipboard(url)}>
<Icon name="link" />
Copy link to {explorerHost(config)}
</button>
<div class="menu-separator"></div>
{/if}
<button
class="menu-item"
role="menuitem"
@@ -69,4 +74,14 @@
<Icon name="copy" />
Copy rad: URI
</button>
{#if seedRid}
<div class="menu-separator"></div>
<button
class="menu-item"
role="menuitem"
onclick={() => void seedRepo(seedRid).catch(console.error)}>
<Icon name="seed" />
Seed repository
</button>
{/if}
</ContextMenu>