Compare commits
4
Commits
@@ -58,4 +58,3 @@ node_modules/
|
|||||||
|
|
||||||
.direnv
|
.direnv
|
||||||
!.envrc
|
!.envrc
|
||||||
.env*
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import { auditLog, user } from "@/lib/db/schema";
|
|||||||
import AuditLogViewer from "./client";
|
import AuditLogViewer from "./client";
|
||||||
|
|
||||||
export default async function AuditLogViewerPage() {
|
export default async function AuditLogViewerPage() {
|
||||||
const logs = (await db.execute(sql`
|
const logs = (
|
||||||
|
await db.execute(sql`
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM (
|
FROM (
|
||||||
SELECT *
|
SELECT *
|
||||||
@@ -13,7 +14,8 @@ export default async function AuditLogViewerPage() {
|
|||||||
LIMIT 1000
|
LIMIT 1000
|
||||||
) t
|
) t
|
||||||
ORDER BY id ASC;
|
ORDER BY id ASC;
|
||||||
`)) as (typeof auditLog.$inferSelect)[];
|
`)
|
||||||
|
).rows as (typeof auditLog.$inferSelect)[];
|
||||||
const users = await db
|
const users = await db
|
||||||
.select({ name: user.name, email: user.email })
|
.select({ name: user.name, email: user.email })
|
||||||
.from(user);
|
.from(user);
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ export default async function AdminLayout({
|
|||||||
}) {
|
}) {
|
||||||
if (!(await adminCheck()))
|
if (!(await adminCheck()))
|
||||||
redirect(`/login?next=${encodeURIComponent("/artifact/admin")}`);
|
redirect(`/login?next=${encodeURIComponent("/artifact/admin")}`);
|
||||||
const subs = (await db.execute(sql`
|
const subs = (
|
||||||
|
await db.execute(sql`
|
||||||
WITH max_checked AS (
|
WITH max_checked AS (
|
||||||
SELECT MAX(queue) AS max_queue
|
SELECT MAX(queue) AS max_queue
|
||||||
FROM artifact.submissions
|
FROM artifact.submissions
|
||||||
@@ -62,7 +63,8 @@ export default async function AdminLayout({
|
|||||||
|
|
||||||
ELSE s.queue
|
ELSE s.queue
|
||||||
END,
|
END,
|
||||||
s.id;`)) as (typeof submissions.$inferSelect)[];
|
s.id;`)
|
||||||
|
).rows as (typeof submissions.$inferSelect)[];
|
||||||
const config = await getArtifactConfig();
|
const config = await getArtifactConfig();
|
||||||
const count = await db
|
const count = await db
|
||||||
.select({ a: sql`NULL` })
|
.select({ a: sql`NULL` })
|
||||||
|
|||||||
+2
-3
@@ -17,8 +17,7 @@ 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>
|
||||||
{/* TEMPORARY: Hacked channel */}
|
<Link href="https://www.youtube.com/@Genshinmaichaigamemurtur">
|
||||||
{/* <Link href="https://www.youtube.com/@Genshinmaichaigamemurtur"> */}
|
|
||||||
<Image
|
<Image
|
||||||
src={Banner}
|
src={Banner}
|
||||||
alt="Banner"
|
alt="Banner"
|
||||||
@@ -27,7 +26,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: res.database && red ? 200 : 201 },
|
{ status: red ? (res.database ? 200 : 201) : 503 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ 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;
|
||||||
|
|
||||||
// TEMPORARY: Hacked channel
|
if (!apiKey || !channelId) return NextResponse.json<YoutubeLiveInfo>("none");
|
||||||
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}`,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"@headless-tree/core": "^1.6.0",
|
"@headless-tree/core": "^1.6.0",
|
||||||
"@headless-tree/react": "^1.6.0",
|
"@headless-tree/react": "^1.6.0",
|
||||||
"@hookform/resolvers": "^5.2.2",
|
"@hookform/resolvers": "^5.2.2",
|
||||||
|
"@neondatabase/serverless": "^1.1.0",
|
||||||
"@next/bundle-analyzer": "16.2.6",
|
"@next/bundle-analyzer": "16.2.6",
|
||||||
"@origin-space/image-cropper": "^0.1.9",
|
"@origin-space/image-cropper": "^0.1.9",
|
||||||
"@radix-ui/react-accordion": "^1.2.12",
|
"@radix-ui/react-accordion": "^1.2.12",
|
||||||
@@ -384,6 +385,8 @@
|
|||||||
|
|
||||||
"@mrleebo/prisma-ast": ["@mrleebo/[email protected]", "", { "dependencies": { "chevrotain": "^10.5.0", "lilconfig": "^2.1.0" } }, "sha512-VxS+okLpNp6YUDLz3rAXv6sE8G4W5cX039bumkPub65xRr9BFxjHaT5ebX4DsiixIGaBwitjWTvx3mAbyI2EUQ=="],
|
"@mrleebo/prisma-ast": ["@mrleebo/[email protected]", "", { "dependencies": { "chevrotain": "^10.5.0", "lilconfig": "^2.1.0" } }, "sha512-VxS+okLpNp6YUDLz3rAXv6sE8G4W5cX039bumkPub65xRr9BFxjHaT5ebX4DsiixIGaBwitjWTvx3mAbyI2EUQ=="],
|
||||||
|
|
||||||
|
"@neondatabase/serverless": ["@neondatabase/[email protected]", "", {}, "sha512-r3ZZhRjEcfEdKIZnoB1RusNgvHuaBRqfCzV4Gi+5A9yUX0S4HTws/ASWqt13wL4y4I+0rqsWGdA2w7EQXHi3+Q=="],
|
||||||
|
|
||||||
"@next/bundle-analyzer": ["@next/[email protected]", "", { "dependencies": { "webpack-bundle-analyzer": "4.10.1" } }, "sha512-amPkVtHCTJAdBwyhhl5+qztHk24O4JlASgrWqh15AmnYi74apfZR46NGC0u4pM6BMAU1mYld4WdzD3cRBP3dOA=="],
|
"@next/bundle-analyzer": ["@next/[email protected]", "", { "dependencies": { "webpack-bundle-analyzer": "4.10.1" } }, "sha512-amPkVtHCTJAdBwyhhl5+qztHk24O4JlASgrWqh15AmnYi74apfZR46NGC0u4pM6BMAU1mYld4WdzD3cRBP3dOA=="],
|
||||||
|
|
||||||
"@next/env": ["@next/[email protected]", "", {}, "sha512-gd8HoHN4ufj73WmR3JmVolrpJR47ILK6LouP5xElPglaVxir6e1a7VzvTvDWkOoPXT9rkkTzyCxBu4yeZfZwcw=="],
|
"@next/env": ["@next/[email protected]", "", {}, "sha512-gd8HoHN4ufj73WmR3JmVolrpJR47ILK6LouP5xElPglaVxir6e1a7VzvTvDWkOoPXT9rkkTzyCxBu4yeZfZwcw=="],
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { drizzle } from "drizzle-orm/bun-sql";
|
import { drizzle } from "drizzle-orm/neon-http";
|
||||||
import * as schema from "./schema";
|
import * as schema from "./schema";
|
||||||
import { withReplicas } from "drizzle-orm/pg-core";
|
import { withReplicas } from "drizzle-orm/pg-core";
|
||||||
|
|
||||||
|
|||||||
+2
-5
@@ -1,10 +1,7 @@
|
|||||||
import ReconnectingEventSource from "reconnecting-eventsource";
|
import ReconnectingEventSource from "reconnecting-eventsource";
|
||||||
import type z from "zod";
|
import type z from "zod";
|
||||||
|
|
||||||
export const redis =
|
export const redis = typeof Bun !== "undefined" ? Bun.redis : null;
|
||||||
typeof Bun !== "undefined"
|
|
||||||
? new Bun.RedisClient(undefined, { maxRetries: 0xffffffff })
|
|
||||||
: null;
|
|
||||||
|
|
||||||
type PubPayload = { event?: string; data: unknown };
|
type PubPayload = { event?: string; data: unknown };
|
||||||
|
|
||||||
@@ -129,7 +126,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.",
|
||||||
);
|
);
|
||||||
this.manager.publish(this.eventMap[event].parse(data), {
|
return this.manager.publish(this.eventMap[event].parse(data), {
|
||||||
topic: this.endpoint,
|
topic: this.endpoint,
|
||||||
event: String(event),
|
event: String(event),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
"@headless-tree/core": "^1.6.0",
|
"@headless-tree/core": "^1.6.0",
|
||||||
"@headless-tree/react": "^1.6.0",
|
"@headless-tree/react": "^1.6.0",
|
||||||
"@hookform/resolvers": "^5.2.2",
|
"@hookform/resolvers": "^5.2.2",
|
||||||
|
"@neondatabase/serverless": "^1.1.0",
|
||||||
"@next/bundle-analyzer": "16.2.6",
|
"@next/bundle-analyzer": "16.2.6",
|
||||||
"@origin-space/image-cropper": "^0.1.9",
|
"@origin-space/image-cropper": "^0.1.9",
|
||||||
"@radix-ui/react-accordion": "^1.2.12",
|
"@radix-ui/react-accordion": "^1.2.12",
|
||||||
|
|||||||
Reference in New Issue
Block a user