diff options
| author | Fuwn <[email protected]> | 2024-05-27 18:38:30 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-05-27 18:38:30 -0700 |
| commit | c4ec98bc96679586f6867870de8e00e043090354 (patch) | |
| tree | ea3abd178d2387f76b1521d316ce352f0e997335 /src/routes/api/badges | |
| parent | feat(hololive): parallax image for thumbnails (diff) | |
| download | due.moe-c4ec98bc96679586f6867870de8e00e043090354.tar.xz due.moe-c4ec98bc96679586f6867870de8e00e043090354.zip | |
feat(badges): click counter for badges
Diffstat (limited to 'src/routes/api/badges')
| -rw-r--r-- | src/routes/api/badges/+server.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/routes/api/badges/+server.ts b/src/routes/api/badges/+server.ts index 21561cbb..483d0b9c 100644 --- a/src/routes/api/badges/+server.ts +++ b/src/routes/api/badges/+server.ts @@ -8,7 +8,8 @@ import { type Badge, migrateCategory, setShadowHidden, - setShadowHiddenBadge + setShadowHiddenBadge, + incrementClickCount } from '$lib/Database/userBadges'; import authorisedJson from '$lib/Data/Static/authorised.json'; @@ -48,6 +49,12 @@ export const DELETE = async ({ url, cookies }) => { }; export const PUT = async ({ cookies, url, request }) => { + if (url.searchParams.get('incrementClickCount') || undefined) { + await incrementClickCount(Number(url.searchParams.get('incrementClickCount'))); + + return new Response('Incremented', { status: 200 }); + } + const userCookie = cookies.get('user'); if (!userCookie) return unauthorised; |