diff --git a/apps/buy.immich.app/routes/claim/[[id]]/+page.svelte b/apps/buy.immich.app/routes/claim/[[id]]/+page.svelte deleted file mode 100644 index 382d3f05..00000000 --- a/apps/buy.immich.app/routes/claim/[[id]]/+page.svelte +++ /dev/null @@ -1,96 +0,0 @@ - - - - Immich - Claim - - - - -
- - Claim your key - - If you previously supported Immich by sponsoring the project on GitHub, you are entitled to a free product - key. Login below with your GitHub account to claim your key. - - -
- - {#if response} -
- GitHub profile -
- Welcome back {response.username}! - {#if response.licenses.length > 0} - - We found {response.licenses.length} product key{s(response.licenses.length)}. - - {/if} -
-
- - {#if response.licenses.length === 0} -
- - - Unfortunately, we did not find any product keys associated with your account. If you think this is a - mistake, please send an email to claim@immich.app. - - -
- {/if} - - - {#each response.licenses as license (license.licenseKey)} - - {/each} - - {:else} -
- - - {#if errorMessage} - - {/if} - -
- {/if} -
-
diff --git a/apps/buy.immich.app/routes/claim/[[id]]/+page.ts b/apps/buy.immich.app/routes/claim/[[id]]/+page.ts deleted file mode 100644 index 696c76a2..00000000 --- a/apps/buy.immich.app/routes/claim/[[id]]/+page.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { callback } from '$lib/utils/oauth'; -import type { PageLoad } from './$types'; - -export const load = (async ({ fetch, url, params }) => { - if (params.id === 'callback') { - const { response, error } = await callback(fetch, url.href); - return { response, error }; - } -}) satisfies PageLoad; diff --git a/example.env b/example.env index e571aefc..27785d17 100644 --- a/example.env +++ b/example.env @@ -1,5 +1,3 @@ IMMICH_APP=buy.immich.app PUBLIC_IMMICH_PAY_HOST=https://futopay-test.azurewebsites.net -# PUBLIC_IMMICH_API_HOST=http://localhost:8080 -# PUBLIC_IMMICH_API_HOST=https://api.immich.app # PUBLIC_IMMICH_SPEC_URL=http://localhost:3000/api/spec.json diff --git a/src/lib/utils/oauth.ts b/src/lib/utils/oauth.ts deleted file mode 100644 index c18c141c..00000000 --- a/src/lib/utils/oauth.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { PUBLIC_IMMICH_API_HOST } from '$env/static/public'; -import type { Fetch } from '$lib'; -import type { ImmichLicense } from '$lib/utils/license'; - -export type License = { type: ImmichLicense; licenseKey: string; activationKey: string }; - -export type ClaimSuccessResponseDto = { - username: string; - imageUrl: string; - licenses: License[]; -}; - -export type ClaimErrorResponseDto = { - error: string; -}; - -export const getAuthorizeUrl = async () => { - const response = await fetch(new URL('/oauth/authorize', PUBLIC_IMMICH_API_HOST).href, { - method: 'POST', - body: JSON.stringify({ redirectUri: window.location.origin + '/claim/callback' }), - headers: { 'Content-Type': 'application/json' }, - }); - if (!response.ok) { - return { error: 'Something went wrong' }; - } - - const { url } = await response.json(); - return { url }; -}; - -export const callback = async (fetch: Fetch, url: string) => { - const response = await fetch(new URL('/oauth/callback', PUBLIC_IMMICH_API_HOST).href, { - method: 'POST', - body: JSON.stringify({ url }), - headers: { 'Content-Type': 'application/json' }, - }); - - if (!response.ok) { - return { error: 'Unable to login with GitHub' }; - } - - return { response: (await response.json()) as ClaimSuccessResponseDto }; -}; diff --git a/svelte.config.js b/svelte.config.js index b91a25b0..b6de5fe8 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -5,7 +5,6 @@ import dotenv from 'dotenv'; dotenv.config(); process.env.PUBLIC_IMMICH_PAY_HOST = process.env.PUBLIC_IMMICH_PAY_HOST || 'https://pay.futo.org'; -process.env.PUBLIC_IMMICH_API_HOST = process.env.PUBLIC_IMMICH_API_HOST || 'https://api.immich.app'; process.env.PUBLIC_IMMICH_SPEC_URL = process.env.PUBLIC_IMMICH_SPEC_URL || 'https://static.immich.cloud/docs/spec.json'; const app = process.env.IMMICH_APP || 'my.immich.app';