1
0

fix: auth and layouting

This commit is contained in:
dusk 2024-08-24 17:36:15 +03:00
parent f036998fad
commit 4210aad424
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
2 changed files with 53 additions and 51 deletions

View File

@ -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}` return `https://github.com/login/oauth/authorize?client_id=${client_id}&redirect_uri=${redir_uri}&scope=${scope}&state=${state}`
}, },
getToken: async (code: string): Promise<TokenResponse> => { getToken: async (code: string): Promise<TokenResponse> => {
const api = `https://discord.com/api/oauth2/token` const api = `https://github.com/login/oauth/access_token`
const body = new URLSearchParams({ const body = new URLSearchParams({
client_id: env.GITHUB_CLIENT_ID, client_id: env.GITHUB_CLIENT_ID,
client_secret: env.GITHUB_CLIENT_SECRET, client_secret: env.GITHUB_CLIENT_SECRET,

View File

@ -58,57 +58,59 @@
</div> </div>
</Window> </Window>
<div class="grow" /> <div class="grow" />
<Window title="entries" iconUri="/icons/entries.png"> <div class="mb-[7vh] md:mb-0">
<div class="flex flex-col gap-2 md:gap-4 2xl:w-[60ch]"> <Window title="entries" iconUri="/icons/entries.png">
{#if data.getRatelimited} <div class="flex flex-col gap-2 md:gap-4 2xl:w-[60ch]">
<p class="text-error"> {#if data.getRatelimited}
woops, looks like you are being ratelimited, try again in like half a minute :3 <p class="text-error">
</p> woops, looks like you are being ratelimited, try again in like half a minute :3
{:else if data.getError} </p>
<p class="text-error">got error trying to fetch entries, pls tell me about this</p> {:else if data.getError}
<details> <p class="text-error">got error trying to fetch entries, pls tell me about this</p>
<summary>error</summary> <details>
<p>{data.getError}</p> <summary>error</summary>
</details> <p>{data.getError}</p>
{:else} </details>
{#each data.entries as [entry_id, entry] (entry_id)}
{@const date = new Date(entry.timestamp * 1e3).toLocaleString()}
<div class="entry entryflex">
<div class="flex flex-row">
<p class="place-self-start grow text-2xl font-monospace">
#{entry_id}
</p>
<p class="justify-end self-center text-sm font-monospace">{date}</p>
</div>
<p class="text-lg ml-0.5">{entry.content}</p>
<p
class="place-self-end text-sm font-monospace max-w-[16ch] md:max-w-[24ch] lg:max-w-[32ch] overflow-hidden text-ellipsis"
title={entry.author}
>
--- posted by {entry.author}
</p>
</div>
{:else} {:else}
<p>looks like there are no entries :(</p> {#each data.entries as [entry_id, entry] (entry_id)}
{/each} {@const date = new Date(entry.timestamp * 1e3).toLocaleString()}
{/if} <div class="entry entryflex">
{#if hasPreviousPage || hasNextPage} <div class="flex flex-row">
<div class="flex flex-row w-full justify-center items-center font-monospace"> <p class="place-self-start grow text-2xl font-monospace">
{#if hasPreviousPage} #{entry_id}
<a href="/guestbook/?page={data.entries.length < 0 ? data.page - 1 : 1}" </p>
>&lt;&lt; previous</a <p class="justify-end self-center text-sm font-monospace">{date}</p>
> </div>
{/if} <p class="text-lg ml-0.5 max-w-[56ch]">{entry.content}</p>
{#if hasNextPage && hasPreviousPage} <p
<div class="w-1/12" /> class="place-self-end text-sm font-monospace max-w-[16ch] md:max-w-[24ch] lg:max-w-[32ch] overflow-hidden text-ellipsis"
{/if} title={entry.author}
{#if hasNextPage} >
<a href="/guestbook/?page={data.page + 1}">next &gt;&gt;</a> --- posted by {entry.author}
{/if} </p>
</div> </div>
{/if} {:else}
</div> <p>looks like there are no entries :(</p>
</Window> {/each}
{/if}
{#if hasPreviousPage || hasNextPage}
<div class="flex flex-row w-full justify-center items-center font-monospace">
{#if hasPreviousPage}
<a href="/guestbook/?page={data.entries.length < 0 ? data.page - 1 : 1}"
>&lt;&lt; previous</a
>
{/if}
{#if hasNextPage && hasPreviousPage}
<div class="w-1/12" />
{/if}
{#if hasNextPage}
<a href="/guestbook/?page={data.page + 1}">next &gt;&gt;</a>
{/if}
</div>
{/if}
</div>
</Window>
</div>
</div> </div>
<style lang="postcss"> <style lang="postcss">