aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-04-13 02:35:18 -0700
committerFuwn <[email protected]>2024-04-13 02:35:18 -0700
commit841e509c491f7bfc96361a7088e1750aee167f05 (patch)
tree5b8f0e4674d1a15ff480147b7455b2030a15b4cf /src/routes/api
parentfeat(user): markdown biography (diff)
downloaddue.moe-841e509c491f7bfc96361a7088e1750aee167f05.tar.xz
due.moe-841e509c491f7bfc96361a7088e1750aee167f05.zip
feat(user): biography option
Diffstat (limited to 'src/routes/api')
-rw-r--r--src/routes/api/preferences/+server.ts20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/routes/api/preferences/+server.ts b/src/routes/api/preferences/+server.ts
index 2d51c87a..151af298 100644
--- a/src/routes/api/preferences/+server.ts
+++ b/src/routes/api/preferences/+server.ts
@@ -1,5 +1,10 @@
import { userIdentity } from '$lib/Data/AniList/identity';
-import { getUserPreferences, toggleHideMissingBadges, setCSS } from '$lib/Database/userPreferences';
+import {
+ getUserPreferences,
+ toggleHideMissingBadges,
+ setCSS,
+ setBiography
+} from '$lib/Database/userPreferences';
const unauthorised = new Response('Unauthorised', { status: 401 });
@@ -28,21 +33,26 @@ export const PUT = async ({ url, cookies, request }) => {
})
).id;
- if (url.searchParams.get('toggleHideMissingBadges') !== null) {
+ if (url.searchParams.get('toggleHideMissingBadges') !== null)
return Response.json(await toggleHideMissingBadges(userId), {
headers: {
'Access-Control-Allow-Origin': 'https://due.moe'
}
});
- }
- if (url.searchParams.get('badgeWallCSS') !== null) {
+ if (url.searchParams.get('badgeWallCSS') !== null)
return Response.json(await setCSS(userId, await request.text()), {
headers: {
'Access-Control-Allow-Origin': 'https://due.moe'
}
});
- }
+
+ if (url.searchParams.get('biography') !== null)
+ return Response.json(await setBiography(userId, (await request.text()).slice(0, 3000)), {
+ headers: {
+ 'Access-Control-Allow-Origin': 'https://due.moe'
+ }
+ });
return Response.json(await getUserPreferences(Number(url.searchParams.get('id') || 0)), {
headers: {