fix: pass path of request to qstash
This commit is contained in:
@@ -16,9 +16,11 @@ import { getUpcomingTitlesFromAnilist } from "./anilist";
|
|||||||
const app = new Hono();
|
const app = new Hono();
|
||||||
|
|
||||||
app.post("/titles", async (c) => {
|
app.post("/titles", async (c) => {
|
||||||
|
console.log(c.req.path);
|
||||||
if (
|
if (
|
||||||
!(await verifyQstashHeader(
|
!(await verifyQstashHeader(
|
||||||
env<Env, typeof c>(c, "workerd"),
|
env<Env, typeof c>(c, "workerd"),
|
||||||
|
c.req.path,
|
||||||
c.req.header("Upstash-Signature"),
|
c.req.header("Upstash-Signature"),
|
||||||
await c.req.text(),
|
await c.req.text(),
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { Env } from "~/types/env";
|
|||||||
|
|
||||||
export function verifyQstashHeader(
|
export function verifyQstashHeader(
|
||||||
env: Env,
|
env: Env,
|
||||||
|
route: string,
|
||||||
signature: string | undefined,
|
signature: string | undefined,
|
||||||
body: string,
|
body: string,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
@@ -19,6 +20,6 @@ export function verifyQstashHeader(
|
|||||||
return receiver.verify({
|
return receiver.verify({
|
||||||
body,
|
body,
|
||||||
signature,
|
signature,
|
||||||
url: "https://aniplay-v2.rururu.workers.dev",
|
url: `https://aniplay-v2.rururu.workers.dev${route}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user