aboutsummaryrefslogtreecommitdiff
path: root/src/routes/api/subsplease/+server.ts
blob: 1f678d8c7ac882e03c0b6f94781ef73075a36b93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { appOriginHeaders } from "$lib/Utility/appOrigin";

export const GET = async ({ url }) => {
	const timezone = url.searchParams.get("tz") || "America/Los_Angeles";

	return Response.json(
		await (
			await fetch(
				`https://subsplease.org/api/?f=schedule&tz=${encodeURIComponent(timezone)}`,
			)
		).json(),
		{
			headers: appOriginHeaders({
				"Cache-Control": "max-age=86400, s-maxage=86400",
			}),
		},
	);
};