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,10 +1,10 @@
import { Handlers } from "$fresh/server.ts";
import { json } from "@lib/helpers.ts";
import { fetchResource } from "@lib/marka/index.ts";
import { define } from "../../../utils.ts";
export const handler: Handlers = {
async GET(_, ctx) {
export const handler = define.handlers({
async GET(ctx) {
const recipe = await fetchResource(`recipes/${ctx.params.name}`);
return json(recipe);
},
};
});

View File

@@ -1,16 +1,15 @@
import { Handlers } from "$fresh/server.ts";
import { AccessDeniedError, BadRequestError } from "@lib/errors.ts";
import { createStreamResponse, isValidUrl } from "@lib/helpers.ts";
import * as openai from "@lib/openai.ts";
import { createLogger } from "@lib/log/index.ts";
import recipeSchema from "@lib/recipeSchema.ts";
import { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts";
import { safeFileName, toUrlSafeString } from "@lib/string.ts";
import { fileExtension, safeFileName, toUrlSafeString } from "@lib/string.ts";
import { parseJsonLdToRecipeSchema } from "./parseJsonLd.ts";
import z from "zod";
import { createResource } from "@lib/marka/index.ts";
import { webScrape } from "@lib/webScraper.ts";
import { RecipeResource } from "@lib/marka/schema.ts";
import { define } from "../../../../utils.ts";
const log = createLogger("api/article");
@@ -93,8 +92,9 @@ async function processCreateRecipeFromUrl(
streamResponse.send({ type: "finished", url: id });
}
export const handler: Handlers = {
GET(req, ctx) {
export const handler = define.handlers({
GET(ctx) {
const req = ctx.req;
const session = ctx.state.session;
if (!session) {
throw new AccessDeniedError();
@@ -120,4 +120,4 @@ export const handler: Handlers = {
return streamResponse.response;
},
};
});

View File

@@ -1,10 +1,10 @@
import { Handlers } from "$fresh/server.ts";
import { json } from "@lib/helpers.ts";
import { fetchResource } from "@lib/marka/index.ts";
import { define } from "../../../utils.ts";
export const handler: Handlers = {
export const handler = define.handlers({
async GET() {
const recipes = await fetchResource("recipes");
return json(recipes);
},
};
});