feat: Add instance changing
This commit is contained in:
1 parent
f201123291
commit
3159583654
17 files changed
+142
-35
No files matched your search
@@ -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
@@ -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>()
|
||||
@@ -0,0 +1,2 @@
|
||||
export const isImage = (url: string | undefined) =>
|
||||
/\.(jpeg|jpg|gif|png|svg|bmp|webp)$/i.test(url ?? '')
|
||||
Reference in new issue
Block a user