Support for radicle.local seeds

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-05-25 17:35:15 +02:00
parent 8e1c7f45b7
commit b7f2bb01bb
6 changed files with 27 additions and 8 deletions
+4
View File
@@ -8,6 +8,10 @@
export let session: Session | null;
</script>
<Route path="/seeds/radicle.local" let:params>
<View {config} {session} host={"0.0.0.0"}/>
</Route>
<Route path="/seeds/:seed" let:params>
<View {config} {session} host={params.seed}/>
</Route>
+3 -1
View File
@@ -1,7 +1,7 @@
import { Request, type Host } from '@app/api';
import type { Config } from '@app/config';
import * as proj from "@app/project";
import { isDomain } from '@app/utils';
import { isDomain, isLocal } from '@app/utils';
import { assert } from '@app/error';
export class InvalidSeed {
@@ -66,6 +66,8 @@ export class Seed {
const meta = cfg.seeds.pinned[seed.host];
if (meta) {
this.emoji = meta.emoji;
} else if (isLocal(seed.host)) {
this.emoji = "🏠";
} else {
this.emoji = "🌱";
}
+4 -3
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Config } from "@app/config";
import { formatSeedId } from "@app/utils";
import { formatSeedId, formatSeedHost } from "@app/utils";
import { Seed } from "@app/base/seeds/Seed";
import Loading from "@app/Loading.svelte";
import SeedAddress from "@app/SeedAddress.svelte";
@@ -16,6 +16,7 @@
export let session: Session | null;
export let host: string;
const hostName = formatSeedHost(host);
let siweSession: SeedSession | null = null;
$: if (session?.siwe) {
@@ -92,7 +93,7 @@
</style>
<svelte:head>
<title>{host}</title>
<title>{hostName}</title>
</svelte:head>
{#await Seed.lookup(host, config)}
@@ -104,7 +105,7 @@
<header>
<span class="title">
<span class="bold">
{host} <span class="desktop inline">{seed.emoji}</span>
{hostName} <span class="desktop inline">{seed.emoji}</span>
</span>
</span>
<!-- User Session -->