misc: switch to csr
This commit is contained in:
1 parent
8721e61554
commit
eb1d90478e
6 files changed
+20
-25
No files matched your search
@@ -14,4 +14,11 @@
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
background-color: black;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</html>
|
||||
@@ -35,6 +35,15 @@ export async function handle({ event, resolve }) {
|
||||
url.searchParams.get('auth')
|
||||
) {
|
||||
headers.set('cookie', `jwt=${url.searchParams.get('auth')}`)
|
||||
} else {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
message: 'Only CORS allowed is through /pictrs/image',
|
||||
}),
|
||||
{
|
||||
status: 500,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
const data = await fetch(url, {
|
||||
|
||||
+1
-14
@@ -8,26 +8,13 @@ import { amModOfAny } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
export const LINKED_INSTANCE_URL = env.PUBLIC_INSTANCE_URL
|
||||
export const DEFAULT_INSTANCE_URL = env.PUBLIC_INSTANCE_URL || 'lemmy.ml'
|
||||
export let instance = writable(DEFAULT_INSTANCE_URL)
|
||||
export let corsSupported = writable(true)
|
||||
|
||||
export function buildBaseUrl(instanceURL?: string) {
|
||||
if (!instanceURL) {
|
||||
instanceURL = get(instance)!
|
||||
}
|
||||
|
||||
return `${env.PUBLIC_PROXY_URL!}/cors/${instanceURL}`
|
||||
}
|
||||
|
||||
export function getClient(instanceURL?: string): LemmyHttp {
|
||||
if (!instanceURL) {
|
||||
instanceURL = get(instance)
|
||||
}
|
||||
|
||||
return new LemmyHttp(
|
||||
get(corsSupported)
|
||||
? `https://${instanceURL}`
|
||||
: `${env.PUBLIC_PROXY_URL}/cors/${instanceURL}`
|
||||
)
|
||||
return new LemmyHttp(`https://${instanceURL}`)
|
||||
}
|
||||
|
||||
export const getInstance = () => get(instance)
|
||||
|
||||
@@ -3,22 +3,13 @@
|
||||
import { page } from '$app/stores'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import { corsSupported } from '$lib/lemmy.js'
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col mx-auto gap-4 justify-center items-center">
|
||||
<h1 class="font-black text-5xl">{$page.status}</h1>
|
||||
<p>
|
||||
The <strong>server</strong>
|
||||
failed to fetch the data. Click "retry" to have the client load it.
|
||||
failed to fetch the data. Click "retry" to have the client load it.
|
||||
</p>
|
||||
<Button href={$page.url.toString()}>Retry</Button>
|
||||
<Button
|
||||
on:click={() => {
|
||||
corsSupported.set(false)
|
||||
goto($page.url.toString())
|
||||
}}
|
||||
>
|
||||
Retry through proxy
|
||||
</Button>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
export let ssr = false
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
:root {
|
||||
@apply bg-slate-50 dark:bg-zinc-950 text-slate-900
|
||||
dark:text-zinc-100;
|
||||
dark:text-zinc-100 !important;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
|
||||
Reference in new issue
Block a user