Compare commits
4
Commits
@@ -58,3 +58,4 @@ node_modules/
|
|||||||
|
|
||||||
.direnv
|
.direnv
|
||||||
!.envrc
|
!.envrc
|
||||||
|
.env*
|
||||||
|
|||||||
+3
-2
@@ -17,7 +17,8 @@ export default function Home() {
|
|||||||
<div className="mx-auto flex min-h-dvh w-full max-w-6xl flex-col">
|
<div className="mx-auto flex min-h-dvh w-full max-w-6xl flex-col">
|
||||||
<section>
|
<section>
|
||||||
<center>
|
<center>
|
||||||
<Link href="https://www.youtube.com/@Genshinmaichaigamemurtur">
|
{/* TEMPORARY: Hacked channel */}
|
||||||
|
{/* <Link href="https://www.youtube.com/@Genshinmaichaigamemurtur"> */}
|
||||||
<Image
|
<Image
|
||||||
src={Banner}
|
src={Banner}
|
||||||
alt="Banner"
|
alt="Banner"
|
||||||
@@ -26,7 +27,7 @@ export default function Home() {
|
|||||||
height={100}
|
height={100}
|
||||||
fetchPriority="high"
|
fetchPriority="high"
|
||||||
/>
|
/>
|
||||||
</Link>
|
{/* </Link> */}
|
||||||
</center>
|
</center>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export async function GET() {
|
|||||||
);
|
);
|
||||||
return Response.json(
|
return Response.json(
|
||||||
{ red, ...res },
|
{ red, ...res },
|
||||||
{ status: red ? (res.database ? 200 : 201) : 503 },
|
{ status: res.database && red ? 200 : 201 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ export async function GET(req: NextRequest) {
|
|||||||
const channelId = process.env.YOUTUBE_CHANNEL_ID;
|
const channelId = process.env.YOUTUBE_CHANNEL_ID;
|
||||||
const apiKey = process.env.YOUTUBE_API_KEY;
|
const apiKey = process.env.YOUTUBE_API_KEY;
|
||||||
|
|
||||||
if (!apiKey || !channelId) return NextResponse.json<YoutubeLiveInfo>("none");
|
// TEMPORARY: Hacked channel
|
||||||
|
if (!apiKey || !channelId && true) return NextResponse.json<YoutubeLiveInfo>("none");
|
||||||
|
|
||||||
const response = await youtubeCache.fetch(
|
const response = await youtubeCache.fetch(
|
||||||
`https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=${channelId}&eventType=live&type=video&maxResults=1&key=${apiKey}`,
|
`https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=${channelId}&eventType=live&type=video&maxResults=1&key=${apiKey}`,
|
||||||
|
|||||||
+5
-2
@@ -1,7 +1,10 @@
|
|||||||
import ReconnectingEventSource from "reconnecting-eventsource";
|
import ReconnectingEventSource from "reconnecting-eventsource";
|
||||||
import type z from "zod";
|
import type z from "zod";
|
||||||
|
|
||||||
export const redis = typeof Bun !== "undefined" ? Bun.redis : null;
|
export const redis =
|
||||||
|
typeof Bun !== "undefined"
|
||||||
|
? new Bun.RedisClient(undefined, { maxRetries: 0xffffffff })
|
||||||
|
: null;
|
||||||
|
|
||||||
type PubPayload = { event?: string; data: unknown };
|
type PubPayload = { event?: string; data: unknown };
|
||||||
|
|
||||||
@@ -126,7 +129,7 @@ export class EventSourceEndpoint<T extends EventSourceEventMap> {
|
|||||||
throw new Error(
|
throw new Error(
|
||||||
"EventSourceEndpoint.pub(...) can only be called on the server.",
|
"EventSourceEndpoint.pub(...) can only be called on the server.",
|
||||||
);
|
);
|
||||||
return this.manager.publish(this.eventMap[event].parse(data), {
|
this.manager.publish(this.eventMap[event].parse(data), {
|
||||||
topic: this.endpoint,
|
topic: this.endpoint,
|
||||||
event: String(event),
|
event: String(event),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user