From b3b8a10e446554bdce1d83b068f2ad449c98531b Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Wed, 27 Sep 2023 18:55:57 -0700 Subject: [PATCH] feat: add linked instances page --- package.json | 2 +- src/lib/components/lemmy/SiteCard.svelte | 12 ++- src/routes/instances/+page.svelte | 95 ++++++++++++++++++++++++ src/routes/instances/+page.ts | 11 +++ 4 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 src/routes/instances/+page.svelte create mode 100644 src/routes/instances/+page.ts diff --git a/package.json b/package.json index 38af9647..f60a97ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "photon-lemmy", - "version": "1.14.1", + "version": "1.14.2", "private": true, "scripts": { "dev": "vite dev", diff --git a/src/lib/components/lemmy/SiteCard.svelte b/src/lib/components/lemmy/SiteCard.svelte index 5e00ad73..62453097 100644 --- a/src/lib/components/lemmy/SiteCard.svelte +++ b/src/lib/components/lemmy/SiteCard.svelte @@ -60,14 +60,22 @@
- - +
{#if admins} diff --git a/src/routes/instances/+page.svelte b/src/routes/instances/+page.svelte new file mode 100644 index 00000000..1923c1c9 --- /dev/null +++ b/src/routes/instances/+page.svelte @@ -0,0 +1,95 @@ + + +

Linked Instances

+{#if data} +
+
+

+ Linked + + +

+ These are the instances your instance can see and interact with + content from. +

+
+

+ + {#if data.linked && data.linked.length > 0} + {#each data.linked?.sort((b, a) => b.id - a.id) as instance} +
+
+ {instance.domain} + + {instance.software ?? 'Unknown'} • + +
+
+ {/each} + {:else} + + {/if} +
+
+
+

+ Blocked + + + +

+ These are the instances your instance is explicitly blocking content + from. +

+
+

+ + {#if data.blocked && data.blocked.length > 0} + {#each data.blocked?.sort((b, a) => b.id - a.id) as instance} +
+
+ {instance.domain} + + {instance.software ?? 'Unknown'} • + +
+
+ {/each} + {:else} + + {/if} +
+
+
+{/if} diff --git a/src/routes/instances/+page.ts b/src/routes/instances/+page.ts new file mode 100644 index 00000000..2557dc88 --- /dev/null +++ b/src/routes/instances/+page.ts @@ -0,0 +1,11 @@ +import { profile } from '$lib/auth.js' +import { getClient } from '$lib/lemmy.js' +import { get } from 'svelte/store' + +export async function load({ fetch }) { + return ( + await getClient(undefined, fetch).getFederatedInstances({ + auth: get(profile)?.jwt, + }) + ).federated_instances +}