From 4210aad424eab15f1011f125698d42ab361068f9 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Sat, 24 Aug 2024 17:36:15 +0300 Subject: [PATCH] fix: auth and layouting --- src/lib/guestbookAuth.ts | 2 +- src/routes/guestbook/+page.svelte | 102 +++++++++++++++--------------- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/src/lib/guestbookAuth.ts b/src/lib/guestbookAuth.ts index 191ed4c..e20d176 100644 --- a/src/lib/guestbookAuth.ts +++ b/src/lib/guestbookAuth.ts @@ -61,7 +61,7 @@ export const github = { return `https://github.com/login/oauth/authorize?client_id=${client_id}&redirect_uri=${redir_uri}&scope=${scope}&state=${state}` }, getToken: async (code: string): Promise => { - const api = `https://discord.com/api/oauth2/token` + const api = `https://github.com/login/oauth/access_token` const body = new URLSearchParams({ client_id: env.GITHUB_CLIENT_ID, client_secret: env.GITHUB_CLIENT_SECRET, diff --git a/src/routes/guestbook/+page.svelte b/src/routes/guestbook/+page.svelte index 3ae17c6..a4c51a3 100644 --- a/src/routes/guestbook/+page.svelte +++ b/src/routes/guestbook/+page.svelte @@ -58,57 +58,59 @@
- -
- {#if data.getRatelimited} -

- woops, looks like you are being ratelimited, try again in like half a minute :3 -

- {:else if data.getError} -

got error trying to fetch entries, pls tell me about this

-
- error -

{data.getError}

-
- {:else} - {#each data.entries as [entry_id, entry] (entry_id)} - {@const date = new Date(entry.timestamp * 1e3).toLocaleString()} -
-
-

- #{entry_id} -

-

{date}

-
-

{entry.content}

-

- --- posted by {entry.author} -

-
+
+ +
+ {#if data.getRatelimited} +

+ woops, looks like you are being ratelimited, try again in like half a minute :3 +

+ {:else if data.getError} +

got error trying to fetch entries, pls tell me about this

+
+ error +

{data.getError}

+
{:else} -

looks like there are no entries :(

- {/each} - {/if} - {#if hasPreviousPage || hasNextPage} -
- {#if hasPreviousPage} - << previous - {/if} - {#if hasNextPage && hasPreviousPage} -
- {/if} - {#if hasNextPage} - next >> - {/if} -
- {/if} -
- + {#each data.entries as [entry_id, entry] (entry_id)} + {@const date = new Date(entry.timestamp * 1e3).toLocaleString()} +
+
+

+ #{entry_id} +

+

{date}

+
+

{entry.content}

+

+ --- posted by {entry.author} +

+
+ {:else} +

looks like there are no entries :(

+ {/each} + {/if} + {#if hasPreviousPage || hasNextPage} +
+ {#if hasPreviousPage} + << previous + {/if} + {#if hasNextPage && hasPreviousPage} +
+ {/if} + {#if hasNextPage} + next >> + {/if} +
+ {/if} +
+ +