blob: 154651132746859bfb80ff4c174ddfe846fa4bf2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import { userIdentity } from "$lib/Data/AniList/identity";
import { toggleHololiveStreamPinning } from "$lib/Database/SB/User/preferences";
const unauthorised = new Response("Unauthorised", { status: 401 });
export const PUT = async ({ cookies, url }) => {
const userCookie = cookies.get("user");
if (!userCookie) return unauthorised;
const user = JSON.parse(userCookie);
return Response.json(
await toggleHololiveStreamPinning(
(
await userIdentity({
tokenType: user["token_type"],
expiresIn: user["expires_in"],
accessToken: user["access_token"],
refreshToken: user["refresh_token"],
})
).id,
url.searchParams.get("stream") || "",
),
{
headers: {
method: "PUT",
"Access-Control-Allow-Origin": "https://due.moe",
},
},
);
};
|