Skip to content

Commit

Permalink
fix: ssr redirect issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyphyn committed Mar 15, 2024
1 parent a505bd5 commit ae0657c
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 63 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "photon-lemmy",
"version": "1.28.3",
"version": "1.28.4",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down
112 changes: 80 additions & 32 deletions src/routes/about/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@
<h1 class="text-2xl font-bold leading-8">About</h1>
<p class="my-3">
<strong>Photon</strong>
is a client for
<a href="https://join-lemmy.org" class="underline">Lemmy</a>
that is meant to replace the default lemmy-ui.
</p>
<p class="my-3">
It's named that because some random person in a Discord server said that
would be a good name. Great choice, I know.
is a replacement user interface for Lemmy, with more features and modern design.
</p>
<h1 class="text-2xl font-bold leading-8">Links</h1>
<ul class="list-disc pl-4 my-3">
Expand All @@ -40,42 +34,96 @@
<Link href="https://buymeacoffee.com/xylight" highlight>Donate</Link>
</li>
</ul>
<h1 class="text-2xl font-bold leading-8">Credits</h1>
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
<h1 class="text-2xl font-bold leading-10">Credits</h1>
<div class="flex flex-row flex-wrap gap-6 items-center w-full">
<Profile name="Xylight" description="Main developer" />
<Profile
name="Cole"
badge="lemdro.id"
description="Contributor"
link="/u/[email protected]"
/>
<Profile
avatar="https://lemmy.xylight.dev/pictrs/image/3281f13c-68bb-47c9-8c98-b67f67714d5a.png?format=webp&thumbnail=128"
description="Main developer"
name="Xylight"
class="sm:col-span-3 place-self-center"
link="https://xylight.dev"
name="iJeff"
badge="lemdro.id"
description="Contributor"
link="/u/[email protected]"
/>
<hr class="border-slate-200 dark:border-zinc-800 w-full sm:col-span-3" />
<Profile
description="Early contributor"
name="pbui"
description="Contributor"
link="https://github.com/pbui"
/>
<Profile
description="Early supporter"
name="iJeff of lemdro.id"
link="https://lemdro.id/u/ijeff"
name="Neshura87"
description="Contributor"
link="https://github.com/neshura87"
/>
<Profile
description="Early contributor"
name="Cole of lemdro.id"
link="https://lemdro.id/u/cole"
name="Pieterdd"
description="Contributor"
link="https://github.com/pieterdd"
/>
<Profile
description="Big supporter"
name="lemmy.world team"
link="https://lemmy.world"
name="0xCmdrKeen"
description="Contributor"
link="https://github.com/0xCmdrKeen"
/>
<Profile description="Massive donator" name="rooki" />
<Profile description="Programming help" name="Sheodox" />
<Profile description="Design inspiration" name="ljdawson" />
</div>
<div class="mt-4">
If you've contributed in any way and aren't mentioned here, please let me
know and I'll add you here ASAP.
<Profile
name="sant0s12"
description="Contributor"
link="https://github.com/sant0s12"
/>
<Profile
name="tfaughnan"
description="Contributor"
link="https://github.com/tfaughnan"
/>
<Profile
name="paradox460"
description="Contributor"
link="https://github.com/paradox460"
/>
<Profile
name="ngn13"
description="Contributor"
link="https://github.com/ngn13"
/>
<Profile
name="Tmpod"
description="Contributor"
link="https://github.com/Tmpod"
/>
<Profile
name="Xusontha"
description="Contributor"
link="https://github.com/Xusontha"
/>
<Profile
name="TheSaneWriter"
description="Contributor"
link="https://github.com/TheSaneWriter"
/>
<Profile
name="ZhenyaPav"
description="Contributor"
link="https://github.com/ZhenyaPav"
/>
<Profile
name="zamuz"
description="Contributor"
link="https://github.com/zamuz"
/>
<Profile
name="danielwolbach"
description="Contributor"
link="https://github.com/danielwolbach"
/>
<Profile
name="danielwolbach"
description="Contributor"
link="https://github.com/danielwolbach"
/>
<span>...and you, for using this app!</span>
</div>
</div>
38 changes: 14 additions & 24 deletions src/routes/about/Profile.svelte
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
<script lang="ts">
export let avatar: string | undefined = undefined
import { Badge } from 'mono-svelte'
export let name: string
export let description: string
export let badge: string | undefined = undefined
export let link: string = '#'
</script>

<div class="flex flex-row items-center gap-2 {$$props.class}">
{#if $$slots.avatar || avatar}
{#if $$slots.avatar}
<slot name="avatar" />
{:else}
<img
src={avatar}
alt="{name}'s profile"
width={40}
height={40}
class="w-10 h-10 rounded-full"
/>
<div class="flex flex-col w-max {$$props.class}">
<a
href={link}
class="text-base font-medium inline-flex items-center gap-2 {link != '#'
? 'hover:underline'
: ''}"
>
{name}
{#if badge}
<Badge color="gray-subtle" class="!p-0.5 !px-2">{badge}</Badge>
{/if}
{/if}
<div class="flex flex-col">
<a
href={link}
class="font-semibold text-lg"
class:hover:underline={link != '#'}
>
{name}
</a>
<span class="text-slate-700 dark:text-zinc-300">{description}</span>
</div>
</a>
<span class="text-sm">{description}</span>
</div>
2 changes: 1 addition & 1 deletion src/routes/admin/+page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit'

export const load = () => {
redirect(300, '/admin/config');
redirect(302, '/admin/config');
}
2 changes: 1 addition & 1 deletion src/routes/comment/[instance]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { redirect } from '@sveltejs/kit'

export function load({ params }) {
// If you somehow got to /comment/instance, it likely means you passed in an ID, not an instance.
redirect(300, `/comment/${getInstance()}/${params.instance}`);
redirect(302, `/comment/${getInstance()}/${params.instance}`);
}
2 changes: 1 addition & 1 deletion src/routes/comment/[instance]/[id]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function load({ params, fetch }) {
})

redirect(
300,
302,
`/post/${params.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`
);
}
2 changes: 1 addition & 1 deletion src/routes/post/[instance]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function load({ params, url }) {
const newUrl = new URL(url)
newUrl.pathname = split.join('/')

redirect(300, newUrl.toString());
redirect(302, newUrl.toString());
}

error(404, 'Not found');
Expand Down
2 changes: 1 addition & 1 deletion src/routes/profile/+page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit'

export const load = async () => {
redirect(300, '/profile/user');
redirect(302, '/profile/user');
}
2 changes: 1 addition & 1 deletion src/routes/signup/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { redirect } from "@sveltejs/kit";

export const load = () => {
if (LINKED_INSTANCE_URL) {
redirect(300, `/signup/${LINKED_INSTANCE_URL}`);
redirect(302, `/signup/${LINKED_INSTANCE_URL}`);
}
}

0 comments on commit ae0657c

Please sign in to comment.