initial admin

This commit is contained in:
Dreamgineer
2025-10-15 01:03:31 -04:00 Unverified
parent ba6143f63b
commit fc97ebc35f
99 changed files with 2351 additions and 1408 deletions
+1 -1
View File
@@ -15,4 +15,4 @@ export const AmberElementMap: Record<
Electric: "electro",
};
export const uidRegex = /^(?:[0-35-9]|18)[0-9]{8}$/;
export const uidRegex = /^(?:[0-35-9]|18)[0-9]{8}$/;
+6 -2
View File
@@ -1,7 +1,11 @@
import { customType } from "drizzle-orm/pg-core";
export const bytea = customType<{ data: Buffer; notNull: false; default: false }>({
export const bytea = customType<{
data: Buffer;
notNull: false;
default: false;
}>({
dataType() {
return "bytea";
},
});
});
+1 -1
View File
@@ -1,4 +1,4 @@
import { drizzle } from "drizzle-orm/node-postgres";
import * as schema from "./schema";
export const db = drizzle(process.env.DATABASE_URL!, { schema });
export const db = drizzle(process.env.DATABASE_URL!, { schema });
+5
View File
@@ -158,6 +158,11 @@ export const tierlistVersions = tierlist.table("versions", {
onDelete: "cascade",
onUpdate: "cascade",
}),
disclaimer: text().references(() => cdn.id, {
onDelete: "cascade",
onUpdate: "cascade",
}),
deprecates: text().notNull(),
from: text()
.notNull()
.references(() => versions.id),
+61
View File
@@ -0,0 +1,61 @@
/* eslint-disable @next/next/no-img-element */
/** biome-ignore-all lint/performance/noImgElement: og no next/image */
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import { ImageResponse } from "next/og";
// Image generation
export default async function generate({
title,
sub,
}: {
title: string;
sub: string;
}) {
const kanit = await readFile(
join(process.cwd(), "public/Kanit-SemiBold.ttf"),
);
return new ImageResponse(
<div
style={{
display: "flex",
width: "1222px",
height: "560px",
fontFamily: "Kanit",
color: "#fff",
}}
>
<img
src={`http://localhost:3000/web_banner.png`}
alt="Banner"
width={1222}
height={560}
/>
<div
style={{
fontSize: 64,
position: "absolute",
top: "160px",
left: "60px",
display: "flex",
flexDirection: "column",
right: "450px",
bottom: "100px",
}}
>
<div>{title}</div>
<div
style={{
fontSize: 32,
marginTop: "-20",
color: "#aaa",
}}
>
{sub}
</div>
</div>
</div>,
{ fonts: [{ name: "Kanit", data: kanit }], width: 1222, height: 560 },
);
}
+2 -2
View File
@@ -24,11 +24,11 @@ if (!globalThis.sseList) {
export class EventSourceManager {
private id = 0;
new(topic = "_global"): Response {
console.log(` SUB #${topic}`);
let timeout: NodeJS.Timeout | undefined;
this.id++;
if (this.id > 100000) this.id = 0;
const id = this.id;
console.log(` SUB ${topic}#${id}`);
const push = (s: ServerEventSource) => {
globalThis.sseList.push(s);
@@ -38,7 +38,7 @@ export class EventSourceManager {
globalThis.sseList.findIndex((e) => e.id === id),
1,
);
console.log(` DSC #${topic}`);
console.log(` SUB ${topic}#${id}`);
};
return new Response(
new ReadableStream({