aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api/badges
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-11-18 19:34:30 -0800
committerFuwn <[email protected]>2024-11-18 19:34:36 -0800
commit43ecb0640c085971a77f243d72b9d62d961feecd (patch)
tree1907adb4220b1a4df1b958b848317b5dcc1cacb3 /src/routes/api/badges
parentfix(CleanAnimeList): completed total chapter count calculation (diff)
downloaddue.moe-43ecb0640c085971a77f243d72b9d62d961feecd.tar.xz
due.moe-43ecb0640c085971a77f243d72b9d62d961feecd.zip
refactor(authorised): move authorised user functionality to module
Diffstat (limited to 'src/routes/api/badges')
-rw-r--r--src/routes/api/badges/+server.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/routes/api/badges/+server.ts b/src/routes/api/badges/+server.ts
index 7c62285d..9d5cb9a0 100644
--- a/src/routes/api/badges/+server.ts
+++ b/src/routes/api/badges/+server.ts
@@ -11,7 +11,7 @@ import {
setShadowHiddenBadge,
incrementClickCount
} from '$lib/Database/SB/User/badges';
-import authorisedJson from '$lib/Data/Static/authorised.json';
+import privilegedUser from '$lib/Utility/privilegedUser';
const unauthorised = new Response('Unauthorised', { status: 401 });
@@ -66,7 +66,7 @@ export const PUT = async ({ cookies, url, request }) => {
accessToken: user['access_token'],
refreshToken: user['refresh_token']
});
- const authorised = authorisedJson.includes(identity.id);
+ const authorised = privilegedUser(identity.id);
if (url.searchParams.get('shadowHide'))
setShadowHidden(Number(url.searchParams.get('shadowHide')), authorised);
@@ -100,9 +100,9 @@ export const PUT = async ({ cookies, url, request }) => {
allBadges
.filter((badge) => badge.category === (url.searchParams.get('category') || ''))
.filter((badge) => badge.hidden).length >
- allBadges.filter(
- (badge) => badge.category === (url.searchParams.get('category') || '')
- ).length /
+ allBadges.filter(
+ (badge) => badge.category === (url.searchParams.get('category') || '')
+ ).length /
2
? false
: true