From 72c5fe351991213d297eefe95bce9d972f5773b8 Mon Sep 17 00:00:00 2001 From: Joshua Date: Wed, 21 Sep 2022 22:19:09 +0200 Subject: [PATCH] fix and callable s3 function --- src/routes/api/functions/s3.ts | 15 ++++++++++----- src/routes/s3/index.ts | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/routes/api/functions/s3.ts b/src/routes/api/functions/s3.ts index 74f61a7..ae6de02 100644 --- a/src/routes/api/functions/s3.ts +++ b/src/routes/api/functions/s3.ts @@ -4,12 +4,17 @@ export default { method: ["*"], domains: ["*"], handler: async (r: pogo.Request, h: pogo.Toolkit) => { - console.log("searchParams", r.searchParams) if ((r.searchParams.get("token")) === Deno.env.get("TOKEN")) { - await Deno.run({ - cmd: ["ls"] - }) - return { "yes": "yes" } + try { + const sss = await Deno.run({ + cmd: ["deno", "run", "-A", "--unstable", "./scripts/s3.ts"] + }) + const status = sss.status() + + return { "yes": "yes", status } + } catch (error) { + return error + } } else { return { "no": "no" } } diff --git a/src/routes/s3/index.ts b/src/routes/s3/index.ts index 143cb65..d6ee1cf 100644 --- a/src/routes/s3/index.ts +++ b/src/routes/s3/index.ts @@ -1,9 +1,9 @@ import { pogo } from "../../../deps.ts" -import S3Files from "../../s3.generated.ts" +import S3Files from "../../generated/s3.ts" export default { method: ["*"], - domains: ["dreamland.lio.systems"], + domains: ["dreamland.lio.systems", "localhost:3000"], handler: (r: pogo.Request, h: pogo.Toolkit) => { return S3Files