diff options
Diffstat (limited to 'src/routes/api')
| -rw-r--r-- | src/routes/api/animeschedule/oauth/callback/+server.ts | 2 | ||||
| -rw-r--r-- | src/routes/api/authentication/log-out/+server.ts | 2 | ||||
| -rw-r--r-- | src/routes/api/badges/+server.ts | 23 | ||||
| -rw-r--r-- | src/routes/api/myanimelist/oauth/callback/+server.ts | 2 | ||||
| -rw-r--r-- | src/routes/api/notifications/subscribe/+server.ts | 2 | ||||
| -rw-r--r-- | src/routes/api/oauth/callback/+server.ts | 2 | ||||
| -rw-r--r-- | src/routes/api/oauth/refresh/+server.ts | 2 | ||||
| -rw-r--r-- | src/routes/api/preferences/pin/+server.ts | 2 |
8 files changed, 18 insertions, 19 deletions
diff --git a/src/routes/api/animeschedule/oauth/callback/+server.ts b/src/routes/api/animeschedule/oauth/callback/+server.ts index 294abc05..677aff68 100644 --- a/src/routes/api/animeschedule/oauth/callback/+server.ts +++ b/src/routes/api/animeschedule/oauth/callback/+server.ts @@ -1,6 +1,6 @@ -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"; export const GET = async ({ url, cookies }) => callback({ diff --git a/src/routes/api/authentication/log-out/+server.ts b/src/routes/api/authentication/log-out/+server.ts index c04fa5c5..8623dfd1 100644 --- a/src/routes/api/authentication/log-out/+server.ts +++ b/src/routes/api/authentication/log-out/+server.ts @@ -1,5 +1,5 @@ -import root from "$lib/Utility/root.js"; import { redirect } from "@sveltejs/kit"; +import root from "$lib/Utility/root.js"; export const GET = ({ cookies }) => { cookies.delete("user", { path: "/" }); diff --git a/src/routes/api/badges/+server.ts b/src/routes/api/badges/+server.ts index 46b98cbc..2673273c 100644 --- a/src/routes/api/badges/+server.ts +++ b/src/routes/api/badges/+server.ts @@ -1,20 +1,20 @@ +import { Schema } from "effect"; import { safeUserIdentity } from "$lib/Data/AniList/identity"; -import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; -import { decodeRequestJsonOrThrow } from "$lib/Effect/requestBody"; import { - removeAllUserBadges, - removeUserBadge, - updateUserBadge, - getUserBadges, addUserBadge, type Badge, type BadgeInput, + getUserBadges, + incrementClickCount, migrateCategory, + removeAllUserBadges, + removeUserBadge, setShadowHidden, setShadowHiddenBadge, - incrementClickCount, + updateUserBadge, } from "$lib/Database/SB/User/badges"; -import { Schema } from "effect"; +import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; +import { decodeRequestJsonOrThrow } from "$lib/Effect/requestBody"; import { appOrigin, appOriginHeaders } from "$lib/Utility/appOrigin"; import privilegedUser from "$lib/Utility/privilegedUser"; @@ -118,7 +118,7 @@ export const PUT = async ({ cookies, url, request }) => { .map(async (badge) => { await updateUserBadge(identity.id, badge.id as number, { ...badge, - hidden: + hidden: !( allBadges .filter( (badge) => @@ -130,8 +130,7 @@ export const PUT = async ({ cookies, url, request }) => { badge.category === (url.searchParams.get("category") || ""), ).length / 2 - ? false - : true, + ), }); }), ); @@ -144,7 +143,7 @@ export const PUT = async ({ cookies, url, request }) => { await setShadowHiddenBadge( Number(url.searchParams.get("shadowHideBadge")), - url.searchParams.get("status") === "true" ? false : true, + url.searchParams.get("status") !== "true", ); return await badges(Number(url.searchParams.get("id"))); diff --git a/src/routes/api/myanimelist/oauth/callback/+server.ts b/src/routes/api/myanimelist/oauth/callback/+server.ts index 57a5fbe4..0fe774d9 100644 --- a/src/routes/api/myanimelist/oauth/callback/+server.ts +++ b/src/routes/api/myanimelist/oauth/callback/+server.ts @@ -1,6 +1,6 @@ -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"; export const GET = async ({ url, cookies }) => callback({ diff --git a/src/routes/api/notifications/subscribe/+server.ts b/src/routes/api/notifications/subscribe/+server.ts index 203470e0..51dbf340 100644 --- a/src/routes/api/notifications/subscribe/+server.ts +++ b/src/routes/api/notifications/subscribe/+server.ts @@ -1,8 +1,8 @@ +import { Schema } from "effect"; import { safeUserIdentity } from "$lib/Data/AniList/identity"; import { setUserSubscription } from "$lib/Database/SB/User/notifications"; import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; import { decodeRequestJsonOrThrow } from "$lib/Effect/requestBody"; -import { Schema } from "effect"; const unauthorised = new Response("Unauthorised", { status: 401 }); diff --git a/src/routes/api/oauth/callback/+server.ts b/src/routes/api/oauth/callback/+server.ts index c5faa859..96990bf0 100644 --- a/src/routes/api/oauth/callback/+server.ts +++ b/src/routes/api/oauth/callback/+server.ts @@ -1,6 +1,6 @@ -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"; export const GET = async ({ url, cookies }) => callback({ diff --git a/src/routes/api/oauth/refresh/+server.ts b/src/routes/api/oauth/refresh/+server.ts index 13e7ab09..d9e33f51 100644 --- a/src/routes/api/oauth/refresh/+server.ts +++ b/src/routes/api/oauth/refresh/+server.ts @@ -1,6 +1,6 @@ +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(); diff --git a/src/routes/api/preferences/pin/+server.ts b/src/routes/api/preferences/pin/+server.ts index b69a8142..118dd5ba 100644 --- a/src/routes/api/preferences/pin/+server.ts +++ b/src/routes/api/preferences/pin/+server.ts @@ -1,6 +1,6 @@ import { safeUserIdentity } from "$lib/Data/AniList/identity"; -import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; import { toggleHololiveStreamPinning } from "$lib/Database/SB/User/preferences"; +import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; import { appOriginHeaders } from "$lib/Utility/appOrigin"; const unauthorised = new Response("Unauthorised", { status: 401 }); |