feat: trying to add hashes to scripts
This commit is contained in:
@@ -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 }: {
|
||||
|
||||
Reference in New Issue
Block a user