chore: npm run format + lint

This commit is contained in:
2025-12-30 11:23:55 -05:00
parent 55bee20e5d
commit d71b60bd7e
7 changed files with 134 additions and 116 deletions
+1 -1
View File
@@ -78,4 +78,4 @@ export const roles = {
1: 'Moderator',
255: 'Administrator',
403: 'Banned'
}
};
+18 -3
View File
@@ -6,12 +6,22 @@ const REFRESH_TOKEN_KEY = 'refreshToken';
export function getToken() {
if (!browser) return null;
return document.cookie.split('; ').find(c => c.startsWith(`${TOKEN_KEY}=`))?.split('=')[1] || null;
return (
document.cookie
.split('; ')
.find((c) => c.startsWith(`${TOKEN_KEY}=`))
?.split('=')[1] || null
);
}
export function getRefreshToken() {
if (!browser) return null;
return document.cookie.split('; ').find(c => c.startsWith(`${REFRESH_TOKEN_KEY}=`))?.split('=')[1] || null;
return (
document.cookie
.split('; ')
.find((c) => c.startsWith(`${REFRESH_TOKEN_KEY}=`))
?.split('=')[1] || null
);
}
export function setTokens(token: string, refreshToken: string) {
@@ -76,7 +86,12 @@ export function getServerRefreshToken(cookies: Cookies) {
export function setServerTokens(cookies: Cookies, token: string, refreshToken: string) {
cookies.set('token', token, { path: '/', httpOnly: true, sameSite: 'strict', secure: true });
cookies.set('refreshToken', refreshToken, { path: '/', httpOnly: true, sameSite: 'strict', secure: true });
cookies.set('refreshToken', refreshToken, {
path: '/',
httpOnly: true,
sameSite: 'strict',
secure: true
});
}
export function clearServerTokens(cookies: Cookies) {
@@ -48,7 +48,7 @@ export async function decryptAES(result: string, password: string): Promise<stri
try {
const enc = new TextEncoder();
const parsed = JSON.parse(result);
const combined = Uint8Array.from(atob(parsed.data), c => c.charCodeAt(0));
const combined = Uint8Array.from(atob(parsed.data), (c) => c.charCodeAt(0));
const salt = combined.slice(0, 16);
const iv = combined.slice(16, 28);
const data = combined.slice(28);
+8 -4
View File
@@ -38,10 +38,12 @@
{ value: 315360000000, label: 'Expire in 10 Years' }
];
const visibilityOptions = data.options.visibilities.map((visibility: { value: number; displayName: string }) => ({
const visibilityOptions = data.options.visibilities.map(
(visibility: { value: number; displayName: string }) => ({
value: visibility.value,
label: visibility.displayName
}));
})
);
async function handleSubmit(event: Event) {
event.preventDefault();
@@ -91,7 +93,7 @@
<main
class="flex min-h-screen w-full flex-col items-center justify-center bg-neutral-950 text-white"
>
<div class="w-[95%] max-w-5xl rounded border-2 border-neutral-800 bg-neutral-900 p-6">
<div class="w-[95%] max-w-7xl rounded border-2 border-neutral-800 bg-neutral-900 p-6">
<h1 class="mb-6 text-center text-4xl font-bold">Create a Paste</h1>
<form class="mt-4" on:submit|preventDefault={handleSubmit}>
<input
@@ -109,7 +111,9 @@
spellcheck="false"
autocomplete="off"
bind:value={content}
maxlength={data.options.maxContentSize ? Math.floor(data.options.maxContentSize / 4) : undefined}
maxlength={data.options.maxContentSize
? Math.floor(data.options.maxContentSize / 4)
: undefined}
></textarea>
<Dropdown
options={syntaxOptions}
-1
View File
@@ -1,7 +1,6 @@
@import 'tailwindcss';
@import 'highlight.js/styles/github-dark.css';
* {
box-sizing: border-box;
}
@@ -11,6 +11,6 @@ export const load: PageServerLoad = async ({ params, fetch, cookies }) => {
}
});
const user = await res.json() as User;
const user = (await res.json()) as User;
return { user };
}
};