aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api/oauth
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-01 16:20:51 -0800
committerFuwn <[email protected]>2026-03-01 16:21:02 -0800
commiteae5d24d9e79e59a19d4721caaeaa0ca650ecb33 (patch)
tree1b685bb248e051dfa26d2bfdebe6689402dd93c5 /src/routes/api/oauth
parentchore(tooling): remove legacy eslint and prettier (diff)
downloaddue.moe-eae5d24d9e79e59a19d4721caaeaa0ca650ecb33.tar.xz
due.moe-eae5d24d9e79e59a19d4721caaeaa0ca650ecb33.zip
chore(biome): drop formatter style overrides
Diffstat (limited to 'src/routes/api/oauth')
-rw-r--r--src/routes/api/oauth/callback/+server.ts28
-rw-r--r--src/routes/api/oauth/refresh/+server.ts46
2 files changed, 37 insertions, 37 deletions
diff --git a/src/routes/api/oauth/callback/+server.ts b/src/routes/api/oauth/callback/+server.ts
index 986520f9..c5faa859 100644
--- a/src/routes/api/oauth/callback/+server.ts
+++ b/src/routes/api/oauth/callback/+server.ts
@@ -1,16 +1,16 @@
-import { callback } from '$lib/Utility/oauth.js';
-import { env } from '$env/dynamic/private';
-import { env as env2 } from '$env/dynamic/public';
+import { callback } from "$lib/Utility/oauth.js";
+import { env } from "$env/dynamic/private";
+import { env as env2 } from "$env/dynamic/public";
export const GET = async ({ url, cookies }) =>
- callback({
- url,
- cookies,
- cookie: 'user',
- authorise: 'https://anilist.co/api/v2/oauth/token',
- client: {
- id: env2.PUBLIC_ANILIST_CLIENT_ID,
- secret: env.ANILIST_CLIENT_SECRET,
- redirectURI: env2.PUBLIC_ANILIST_REDIRECT_URI
- }
- });
+ callback({
+ url,
+ cookies,
+ cookie: "user",
+ authorise: "https://anilist.co/api/v2/oauth/token",
+ client: {
+ id: env2.PUBLIC_ANILIST_CLIENT_ID,
+ secret: env.ANILIST_CLIENT_SECRET,
+ redirectURI: env2.PUBLIC_ANILIST_REDIRECT_URI,
+ },
+ });
diff --git a/src/routes/api/oauth/refresh/+server.ts b/src/routes/api/oauth/refresh/+server.ts
index 13f4400c..13e7ab09 100644
--- a/src/routes/api/oauth/refresh/+server.ts
+++ b/src/routes/api/oauth/refresh/+server.ts
@@ -1,30 +1,30 @@
-import { env } from '$env/dynamic/private';
-import { env as env2 } from '$env/dynamic/public';
-import { redirect } from '@sveltejs/kit';
+import { env } from "$env/dynamic/private";
+import { env as env2 } from "$env/dynamic/public";
+import { redirect } from "@sveltejs/kit";
export const GET = async ({ url, cookies }) => {
- const formData = new FormData();
+ const formData = new FormData();
- formData.append('grant_type', 'refresh_token');
- formData.append('client_id', env2.PUBLIC_ANILIST_CLIENT_ID as string);
- formData.append('client_secret', env.ANILIST_CLIENT_SECRET as string);
- formData.append('refresh_token', url.searchParams.get('token') || '');
+ formData.append("grant_type", "refresh_token");
+ formData.append("client_id", env2.PUBLIC_ANILIST_CLIENT_ID as string);
+ formData.append("client_secret", env.ANILIST_CLIENT_SECRET as string);
+ formData.append("refresh_token", url.searchParams.get("token") || "");
- const newUser = await (
- await fetch('https://anilist.co/api/v2/oauth/token', {
- method: 'POST',
- body: formData
- })
- ).json();
+ const newUser = await (
+ await fetch("https://anilist.co/api/v2/oauth/token", {
+ method: "POST",
+ body: formData,
+ })
+ ).json();
- cookies.set('user', JSON.stringify(newUser), {
- path: '/',
- maxAge: 60 * 60 * 24 * 7,
- httpOnly: false,
- sameSite: 'lax',
- secure: false
- });
+ cookies.set("user", JSON.stringify(newUser), {
+ path: "/",
+ maxAge: 60 * 60 * 24 * 7,
+ httpOnly: false,
+ sameSite: "lax",
+ secure: false,
+ });
- if (url.searchParams.get('redirect')) redirect(303, '/');
- else return Response.json(newUser);
+ if (url.searchParams.get("redirect")) redirect(303, "/");
+ else return Response.json(newUser);
};