From 6072f99027a85e0f4151a2474fb4ca6a4d87287f Mon Sep 17 00:00:00 2001 From: cirroskais Date: Sat, 6 Jul 2024 14:58:27 -0400 Subject: [PATCH] NEW PAGE WOOOOO --- src/lib/components/File.svelte | 2 +- src/lib/components/Inputs/Button.svelte | 5 +- src/routes/(app)/settings/+page.svelte | 212 +++++++++++++++++++++++ src/routes/(app)/uploads/+page.server.ts | 3 + src/routes/(app)/uploads/+page.svelte | 45 ++--- 5 files changed, 244 insertions(+), 23 deletions(-) diff --git a/src/lib/components/File.svelte b/src/lib/components/File.svelte index 5200eff..ab11ec0 100644 --- a/src/lib/components/File.svelte +++ b/src/lib/components/File.svelte @@ -61,7 +61,7 @@ {#if !running} + + +
+

+ API Keys + +

+ + + + + + + + + + + + + + +
API KeyRevoke
+ d8895a0c-daa5-4b6e-b66f-2494c039fe9e + + +
+
+ +
+
+

+ Embed Settings + +

+ +
+
+
+ + +

The title shown on the embed.

+
+
+
+
+ + + +

+ The description of the embed. Can have up to 2000 characters. +

+
+
+ +
+
+ + +

The color shown to the left of the embed.

+
+
+ + +
+
+
+
+
+

Security Settings

+ +
+
+
+ +
+ + + +
+ +
+
+ +
+
+ +

+ A One-Time Password will be required each time you login. +

+ + +
+
+
+
+
+
+

Privacy Settings

+ +
+
+
+
+ + +
+

+ Whether newly uploaded posts should be public or not. +

+
+
+
+
+
+ + +
+

Enable encryption for new uploads. (Client-side)

+
+
+ +
+
+
+ diff --git a/src/routes/(app)/uploads/+page.server.ts b/src/routes/(app)/uploads/+page.server.ts index 3d58b8b..b7c9556 100644 --- a/src/routes/(app)/uploads/+page.server.ts +++ b/src/routes/(app)/uploads/+page.server.ts @@ -7,6 +7,9 @@ export async function load({ locals, url }) { if (+(url.searchParams.get('i') || 0) < 0) error(400, { status: 403, message: 'Invalid Index' }); const totalUploads = await prisma.upload.count(); + + if (!totalUploads) return { uploads: [], totalUploads: 0 }; + if (+(url.searchParams.get('i') || 0) >= Math.ceil(totalUploads / 15)) error(400, { status: 403, message: 'Invalid Index' }); diff --git a/src/routes/(app)/uploads/+page.svelte b/src/routes/(app)/uploads/+page.svelte index c68cd50..dab13c8 100644 --- a/src/routes/(app)/uploads/+page.svelte +++ b/src/routes/(app)/uploads/+page.svelte @@ -18,25 +18,29 @@ {#await data.uploads then uploads} -
- {#each uploads as upload, i} - -
- -
-
-

- {upload.fileName} -

-

{bytesToHumanReadable(upload.size)}

-
-
- {/each} -
+ {#if uploads.length} +
+ {#each uploads as upload, i} + +
+ +
+
+

+ {upload.fileName} +

+

{bytesToHumanReadable(upload.size)}

+
+
+ {/each} +
+ {:else} +

no uploads

+ {/if}
{/await}