diff --git a/frontend/src/lib/api/responses.ts b/frontend/src/lib/api/responses.ts new file mode 100644 index 0000000..b7ba0c5 --- /dev/null +++ b/frontend/src/lib/api/responses.ts @@ -0,0 +1,23 @@ +import type { MeUser } from "./entities"; + +export interface SignupResponse { + user: MeUser; + token: string; +} + +export interface MetaResponse { + git_repository: string; + git_commit: string; + users: number; + members: number; + require_invite: boolean; +} + +export interface UrlsResponse { + discord: string; +} + +export interface ExportResponse { + path: string; + created_at: string; +} diff --git a/frontend/src/routes/+layout.server.ts b/frontend/src/routes/+layout.server.ts index d522a21..f8d44d8 100644 --- a/frontend/src/routes/+layout.server.ts +++ b/frontend/src/routes/+layout.server.ts @@ -2,6 +2,7 @@ import { error } from "@sveltejs/kit"; import type { LayoutServerLoad } from "./$types"; import type { APIError } from "$lib/api/entities"; import { apiFetch } from "$lib/api/fetch"; +import type { MetaResponse } from "$lib/api/responses"; export const load = (async (event) => { try { @@ -10,11 +11,3 @@ export const load = (async (event) => { throw error(500, (e as APIError).message); } }) satisfies LayoutServerLoad; - -interface MetaResponse { - git_repository: string; - git_commit: string; - users: number; - members: number; - require_invite: boolean; -} diff --git a/frontend/src/routes/auth/login/+page.server.ts b/frontend/src/routes/auth/login/+page.server.ts index 7595151..e9e880a 100644 --- a/frontend/src/routes/auth/login/+page.server.ts +++ b/frontend/src/routes/auth/login/+page.server.ts @@ -1,5 +1,6 @@ import { apiFetch } from "$lib/api/fetch"; import { PUBLIC_BASE_URL } from "$env/static/public"; +import type { UrlsResponse } from "$lib/api/responses"; export const load = async () => { const resp = await apiFetch("/auth/urls", { @@ -11,7 +12,3 @@ export const load = async () => { return resp; }; - -interface UrlsResponse { - discord: string; -} diff --git a/frontend/src/routes/auth/login/CallbackPage.svelte b/frontend/src/routes/auth/login/CallbackPage.svelte new file mode 100644 index 0000000..b20f111 --- /dev/null +++ b/frontend/src/routes/auth/login/CallbackPage.svelte @@ -0,0 +1,193 @@ + + + + Log in with the {authType} - pronouns.cc + + +

Log in with the {authType}

+ +{#if error} + +{/if} +{#if ticket && $userStore} +
+ + + +
+
+ + + +
+
+ + +
+{:else if ticket} +
signupForm(username, inviteCode)}> +
+ + + +
+
+ + + +
+ {#if requireInvite} +
+ + + +
+ You currently need an invite code to sign up. You can get + one from an existing user. +
+
+ {/if} +
+ By signing up, you agree to the terms of service and the + privacy policy. +
+ +
+{:else if isDeleted && token} +

Your account is pending deletion since {deletedAt}.

+

If you wish to cancel deletion, press the button below.

+

+ +

+

+ Alternatively, if you want your data wiped immediately, press the force delete link below. This is irreversible. +

+

+ +

+ + +

+ If you want to delete your account, type your username below: +
+ + This is irreversible! Your account cannot be recovered after you press "Force delete + account". + +

+

+ +

+ {#if deleteError} + + {/if} +
+ + + + +
+ {#if deleteCancelled} + + Account deletion cancelled! You can now log in again. + + {/if} + {#if deleteError} + + {/if} +{:else} + Loading... +{/if} diff --git a/frontend/src/routes/auth/login/discord/+page.svelte b/frontend/src/routes/auth/login/discord/+page.svelte index c26f486..5cd3926 100644 --- a/frontend/src/routes/auth/login/discord/+page.svelte +++ b/frontend/src/routes/auth/login/discord/+page.svelte @@ -1,36 +1,16 @@ - - Log in with Discord - pronouns.cc - - -

Log in with Discord

- -{#if data.error} - -{/if} -{#if data.ticket && $userStore} -
- - - -
-
- - - -
-
- - -
-{:else if data.ticket} -
-
- - - -
-
- - - -
- {#if data.require_invite} -
- - - -
- You currently need an invite code to sign up. You can get - one from an existing user. -
-
- {/if} -
- By signing up, you agree to the terms of service and the - privacy policy. -
- -
-{:else if data.is_deleted && data.token} -

Your account is pending deletion since {data.deleted_at}.

-

If you wish to cancel deletion, press the button below.

-

- -

- {#if deleteCancelled} - - Account deletion cancelled! You can now log in again. - - {/if} - {#if deleteError} - - {/if} -{:else} - Loading... -{/if} + diff --git a/frontend/src/routes/auth/login/mastodon/[instance]/+page.svelte b/frontend/src/routes/auth/login/mastodon/[instance]/+page.svelte index ac3c7e8..596f727 100644 --- a/frontend/src/routes/auth/login/mastodon/[instance]/+page.svelte +++ b/frontend/src/routes/auth/login/mastodon/[instance]/+page.svelte @@ -1,35 +1,16 @@ - - Log in with the Fediverse - pronouns.cc - - -

Log in with the Fediverse

- -{#if data.error} - -{/if} -{#if data.ticket && $userStore} -
- - - -
-
- - - -
-
- - -
-{:else if data.ticket} -
-
- - - -
-
- - - -
- {#if data.require_invite} -
- - - -
- You currently need an invite code to sign up. You can get - one from an existing user. -
-
- {/if} -
- By signing up, you agree to the terms of service and the - privacy policy. -
- -
-{:else if data.is_deleted && data.token} -

Your account is pending deletion since {data.deleted_at}.

-

If you wish to cancel deletion, press the button below.

-

- -

- {#if deleteCancelled} - - Account deletion cancelled! You can now log in again. - - {/if} - {#if deleteError} - - {/if} -{:else} - Loading... -{/if} + diff --git a/frontend/src/routes/settings/auth/+page.ts b/frontend/src/routes/settings/auth/+page.ts index d4ba145..b044327 100644 --- a/frontend/src/routes/settings/auth/+page.ts +++ b/frontend/src/routes/settings/auth/+page.ts @@ -1,5 +1,6 @@ import { PUBLIC_BASE_URL } from "$env/static/public"; import { apiFetch } from "$lib/api/fetch"; +import type { UrlsResponse } from "$lib/api/responses"; export const load = async () => { const resp = await apiFetch("/auth/urls", { @@ -11,7 +12,3 @@ export const load = async () => { return { urls: resp }; }; - -interface UrlsResponse { - discord: string; -} diff --git a/frontend/src/routes/settings/export/+page.ts b/frontend/src/routes/settings/export/+page.ts index 9ba40c1..4596125 100644 --- a/frontend/src/routes/settings/export/+page.ts +++ b/frontend/src/routes/settings/export/+page.ts @@ -1,5 +1,6 @@ import { ErrorCode, type APIError } from "$lib/api/entities"; import { apiFetchClient } from "$lib/api/fetch"; +import type { ExportResponse } from "$lib/api/responses"; import { error } from "@sveltejs/kit"; export const load = async () => { @@ -12,8 +13,3 @@ export const load = async () => { throw error((e as APIError).code, (e as APIError).message); } }; - -interface ExportResponse { - path: string; - created_at: string; -}