feat: trying to add hashes to scripts

This commit is contained in:
Max Richter
2026-01-10 13:03:13 +01:00
parent e65938ecc2
commit e55f787a29
79 changed files with 4209 additions and 720 deletions

View File

@@ -1,14 +1,13 @@
import { MainLayout } from "@components/layouts/main.tsx";
import { Handlers, PageProps } from "$fresh/server.ts";
import { PageProps } from "fresh";
import { getCacheInfo } from "@lib/cache.ts";
import { define } from "../../../utils.ts";
export const handler: Handlers<
{ cacheInfo: ReturnType<typeof getCacheInfo> }
> = {
GET(_, ctx) {
return ctx.render({ cacheInfo: getCacheInfo() });
export const handler = define.handlers({
GET() {
return { data: { cacheInfo: getCacheInfo() } };
},
};
});
export default function Greet(
props: PageProps<

View File

@@ -1,31 +1,34 @@
import { MainLayout } from "@components/layouts/main.tsx";
import { Handlers, PageProps } from "$fresh/server.ts";
import { PageProps } from "fresh";
import { AccessDeniedError } from "@lib/errors.ts";
import { getLogs, Log } from "@lib/log/index.ts";
import { formatDate } from "@lib/string.ts";
import { renderMarkdown } from "@lib/markdown.ts";
import { define } from "../../../utils.ts";
const renderLog = (t: unknown) =>
renderMarkdown(`\`\`\`js
${typeof t === "string" ? t : JSON.stringify(t, null, 2).trim()}
\`\`\``);
export const handler: Handlers = {
async GET(_, ctx) {
export const handler = define.handlers({
async GET(ctx) {
const logs = await getLogs();
if (!("session" in ctx.state)) {
throw new AccessDeniedError();
}
return ctx.render({
logs: logs.map((l) => {
return {
...l,
html: l.args.map(renderLog).join("<br/>"),
};
}),
});
return {
data: {
logs: logs.map((l) => {
return {
...l,
html: l.args.map(renderLog).join("<br/>"),
};
}),
},
};
},
};
});
function LogLine(
{ log }: {

View File

@@ -1,18 +1,19 @@
import { MainLayout } from "@components/layouts/main.tsx";
import { Handlers, PageProps } from "$fresh/server.ts";
import { PageProps } from "fresh";
import { getPerformances, PerformanceRes } from "@lib/performance.ts";
import { AccessDeniedError } from "@lib/errors.ts";
import { define } from "../../../utils.ts";
export const handler: Handlers = {
async GET(_, ctx) {
export const handler = define.handlers({
async GET(ctx) {
const performances = await getPerformances();
if (!("session" in ctx.state)) {
throw new AccessDeniedError();
}
return ctx.render({ performances });
return { data: { performances } };
},
};
});
function PerformanceLine(
{ maximum, data: [amount, min, average, max], url }: {