diff --git a/src/app.html b/src/app.html index 999789f4..5da28614 100644 --- a/src/app.html +++ b/src/app.html @@ -14,4 +14,11 @@
%sveltekit.body%
+ diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 5c14777c..edbac059 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -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, { diff --git a/src/lib/lemmy.ts b/src/lib/lemmy.ts index eaadc8bb..aca36d17 100644 --- a/src/lib/lemmy.ts +++ b/src/lib/lemmy.ts @@ -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) diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte index b3262c26..475cf4f6 100644 --- a/src/routes/+error.svelte +++ b/src/routes/+error.svelte @@ -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'

{$page.status}

The server - 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.

-
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts new file mode 100644 index 00000000..71d2b61c --- /dev/null +++ b/src/routes/+layout.ts @@ -0,0 +1 @@ +export let ssr = false diff --git a/src/style/app.css b/src/style/app.css index d8800890..fc23c5eb 100644 --- a/src/style/app.css +++ b/src/style/app.css @@ -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) {