blob: 45a231fd4cda2493b0a45af82ac19a10b88ad98c (
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
|
import { userIdentity } from "$lib/Data/AniList/identity";
import { decodeAuthCookieOrThrow } from "$lib/Effect/authCookie";
import { toggleHololiveStreamPinning } from "$lib/Database/SB/User/preferences";
import { appOriginHeaders } from "$lib/Utility/appOrigin";
const unauthorised = new Response("Unauthorised", { status: 401 });
export const PUT = async ({ cookies, url }) => {
const userCookie = cookies.get("user");
if (!userCookie) return unauthorised;
const user = decodeAuthCookieOrThrow(userCookie);
return Response.json(
await toggleHololiveStreamPinning(
(await userIdentity(user)).id,
url.searchParams.get("stream") || "",
),
{
headers: appOriginHeaders({
method: "PUT",
}),
},
);
};
|