fix: properly resolve dynamic urls

This commit is contained in:
2026-11-06 08:36:32 -05:00
parent eed65b754e
commit 892624f6ac
5 changed files with 20 additions and 20 deletions
@@ -34,7 +34,7 @@
{#if compact} {#if compact}
<a <a
href={resolve(`/${paste.id}`)} href={resolve(`/[id]`, { id: paste.id })}
class="flex flex-col gap-1 rounded border border-neutral-700 bg-neutral-800 px-4 py-3 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none" class="flex flex-col gap-1 rounded border border-neutral-700 bg-neutral-800 px-4 py-3 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
> >
<div class="flex w-full flex-row justify-between"> <div class="flex w-full flex-row justify-between">
@@ -119,7 +119,7 @@
</a> </a>
{:else} {:else}
<a <a
href={resolve(`/${paste.id}`)} href={resolve(`/[id]`, { id: paste.id })}
class="flex flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none" class="flex flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
> >
<span <span
@@ -101,7 +101,7 @@
<span class="text-red-500">BANNED</span> <span class="text-red-500">BANNED</span>
{/if} {/if}
<a <a
href={resolve(`/user/${node.author?.username}`)} href={resolve(`/user/[username]`, { username: node.author?.username})}
class="flex items-center gap-2 underline" class="flex items-center gap-2 underline"
> >
<span <span
@@ -75,7 +75,7 @@
{#if report.reporterUsername} {#if report.reporterUsername}
<a <a
class="text-neutral-200 hover:text-white hover:underline" class="text-neutral-200 hover:text-white hover:underline"
href={resolve(`/user/${report.reporterUsername}`)} href={resolve(`/user/[username]`, { username: report.reporterUsername})}
use:tooltip={report.reporterUUID} use:tooltip={report.reporterUUID}
> >
{report.reporterDisplayName || report.reporterUsername} {report.reporterDisplayName || report.reporterUsername}
@@ -89,7 +89,7 @@
Target Paste: Target Paste:
<a <a
class="text-neutral-200 hover:text-white hover:underline" class="text-neutral-200 hover:text-white hover:underline"
href={resolve(`/${report.pasteId}`)} href={resolve(`/[id]`, { id: report.pasteId})}
> >
{report.pasteTitle !== '' ? report.pasteTitle : report.pasteId} {report.pasteTitle !== '' ? report.pasteTitle : report.pasteId}
</a> </a>
@@ -101,7 +101,7 @@
{#if report.targetUsername} {#if report.targetUsername}
<a <a
class="text-neutral-200 hover:text-white hover:underline" class="text-neutral-200 hover:text-white hover:underline"
href={resolve(`/user/${report.targetUsername}`)} href={resolve(`/user/[username]`, { username: report.targetUsername})}
use:tooltip={report.userUUID} use:tooltip={report.userUUID}
> >
{report.targetDisplayName || report.targetUsername} {report.targetDisplayName || report.targetUsername}
@@ -200,11 +200,11 @@
class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none" class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
role="link" role="link"
tabindex="0" tabindex="0"
onclick={() => goto(resolve(`/report/${report.reportID}`))} onclick={() => goto(resolve(`/report/[reportId]`, { reportId: String(report.reportID)}))}
onkeydown={(e) => { onkeydown={(e) => {
if (e.key === 'Enter' || e.key === ' ') { if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault(); e.preventDefault();
goto(resolve(`/report/${report.reportID}`)); goto(resolve(`/report/[reportId]`, { reportId: String(report.reportID)}));
} }
}} }}
> >
@@ -221,7 +221,7 @@
<span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span> <span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span>
{#if report.pasteId} {#if report.pasteId}
<a <a
href={resolve(`/${report.pasteId}`)} href={resolve(`/[id]`, { id: report.pasteId})}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
onclick={stopPropagation(bubble('click'))} onclick={stopPropagation(bubble('click'))}
> >
@@ -231,7 +231,7 @@
{#if report.userUUID} {#if report.userUUID}
{#if report.targetUsername} {#if report.targetUsername}
<a <a
href={resolve(`/user/${report.targetUsername}`)} href={resolve(`/user/[username]`, {username: report.targetUsername})}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
use:tooltip={report.userUUID} use:tooltip={report.userUUID}
onclick={stopPropagation(bubble('click'))} onclick={stopPropagation(bubble('click'))}
@@ -244,7 +244,7 @@
{/if} {/if}
{#if report.reporterUsername} {#if report.reporterUsername}
<a <a
href={resolve(`/user/${report.reporterUsername}`)} href={resolve(`/user/[username]`, { username: report.reporterUsername})}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
use:tooltip={report.reporterUUID} use:tooltip={report.reporterUUID}
onclick={stopPropagation(bubble('click'))} onclick={stopPropagation(bubble('click'))}
@@ -1676,11 +1676,11 @@
class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none" class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
role="link" role="link"
tabindex="0" tabindex="0"
onclick={() => goto(resolve(`/report/${report.reportID}`))} onclick={() => goto(resolve(`/report/[reportId]`, { reportId: String(report.reportID)}))}
onkeydown={(e) => { onkeydown={(e) => {
if (e.key === 'Enter' || e.key === ' ') { if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault(); e.preventDefault();
goto(resolve(`/report/${report.reportID}`)); goto(resolve(`/report/[reportId]`, { reportId: String(report.reportID)}));
} }
}} }}
> >
@@ -1697,7 +1697,7 @@
<span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span> <span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span>
{#if report.pasteId} {#if report.pasteId}
<a <a
href={resolve(`/${report.pasteId}`)} href={resolve(`/[id]`, {id:report.pasteId})}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
onclick={stopPropagation(bubble('click'))} onclick={stopPropagation(bubble('click'))}
> >
@@ -1707,7 +1707,7 @@
{#if report.userUUID} {#if report.userUUID}
{#if report.targetUsername} {#if report.targetUsername}
<a <a
href={resolve(`/user/${report.targetUsername}`)} href={resolve(`/user/[username]`, { username: report.targetUsername})}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
use:tooltip={report.userUUID} use:tooltip={report.userUUID}
onclick={stopPropagation(bubble('click'))} onclick={stopPropagation(bubble('click'))}
@@ -1735,11 +1735,11 @@
class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none" class="flex cursor-pointer flex-col gap-2 rounded border border-neutral-700 bg-neutral-800 px-5 py-4 transition-colors duration-200 hover:bg-neutral-700 focus:ring-2 focus:ring-neutral-600 focus:outline-none"
role="link" role="link"
tabindex="0" tabindex="0"
onclick={() => goto(resolve(`/report/${report.reportID}`))} onclick={() => goto(resolve(`/report/[reportId]`, { reportId: String(report.reportID)}))}
onkeydown={(e) => { onkeydown={(e) => {
if (e.key === 'Enter' || e.key === ' ') { if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault(); e.preventDefault();
goto(resolve(`/report/${report.reportID}`)); goto(resolve(`/report/[reportId]`, { reportId: String(report.reportID)}));
} }
}} }}
> >
@@ -1756,7 +1756,7 @@
<span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span> <span>{reportTargetLabels[report.targetType] ?? 'Unknown'}</span>
{#if report.reporterUsername} {#if report.reporterUsername}
<a <a
href={resolve(`/user/${report.reporterUsername}`)} href={resolve(`/user/[username]`, { username: report.reporterUsername})}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
use:tooltip={report.reporterUUID} use:tooltip={report.reporterUUID}
onclick={stopPropagation(bubble('click'))} onclick={stopPropagation(bubble('click'))}
@@ -1768,7 +1768,7 @@
{/if} {/if}
{#if report.pastePID} {#if report.pastePID}
<a <a
href={resolve(`/${report.pasteId ?? report.pastePID}`)} href={resolve(`/[id]`, { id: report.pasteId ?? ""})}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
onclick={stopPropagation(bubble('click'))} onclick={stopPropagation(bubble('click'))}
> >
@@ -1778,7 +1778,7 @@
{#if report.userUUID} {#if report.userUUID}
{#if report.targetUsername} {#if report.targetUsername}
<a <a
href={resolve(`/user/${report.targetUsername}`)} href={resolve(`/user/[username]`, { username: report.targetUsername})}
class="text-neutral-300 hover:text-white" class="text-neutral-300 hover:text-white"
use:tooltip={report.userUUID} use:tooltip={report.userUUID}
onclick={stopPropagation(bubble('click'))} onclick={stopPropagation(bubble('click'))}