feat: Add instance changing

This commit is contained in:
Xyphyn committed 2023-07-02 14:27:04 -07:00
1 parent f201123291
commit 3159583654
17 files changed
+142 -35

No files matched your search

+14 -1
View File
@@ -1,6 +1,8 @@
<script lang="ts">
import Link from '$lib/components/Link.svelte'
import Logo from '$lib/components/Logo.svelte'
export let instance_url: string | undefined
</script>
<nav
@@ -10,7 +12,18 @@
<div class="flex flex-row gap-2 items-center mr-auto">
<a href="/" class="flex flex-row items-center gap-2">
<Logo width={40} />
<span class="font-bold">Xylemmy</span>
<div class="flex flex-col">
<span class="font-bold">Xylemmy</span>
{#if instance_url}
<a
class="text-xs opacity-50 hover:opacity-100 hover:underline
transition-opacity"
href="/instance"
>
{new URL(`https://${instance_url}`).hostname}
</a>
{/if}
</div>
</a>
</div>
<Link href="/communities">Communities</Link>
@@ -0,0 +1,7 @@
<script lang="ts">
import SvelteMarkdown from 'svelte-markdown'
export let source: string
</script>
<SvelteMarkdown {source} />
+6 -1
View File
@@ -1,5 +1,10 @@
import { LemmyHttp, type LoginResponse } from 'lemmy-js-client'
import { writable } from 'svelte/store'
import { PUBLIC_PROXY_URL } from '$env/static/public'
export let instance_url = 'programming.dev'
export function getClient(instance: string = `programming.dev`): LemmyHttp {
return new LemmyHttp(`${PUBLIC_PROXY_URL}/cors/${instance}`)
}
export let lemmy = new LemmyHttp(`https://lemmy.world`)
export const token = writable<LoginResponse>()
+2
View File
@@ -0,0 +1,2 @@
export const isImage = (url: string | undefined) =>
/\.(jpeg|jpg|gif|png|svg|bmp|webp)$/i.test(url ?? '')