Skip to content

Commit

Permalink
docs: update cron information
Browse files Browse the repository at this point in the history
  • Loading branch information
Complexlity committed Dec 12, 2024
1 parent d875e26 commit 60fd695
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ DC_API_KEY=
# https://console.upstash.com/qstash
QSTASH_CURRENT_SIGNING_KEY=
QSTASH_NEXT_SIGNING_KEY=
# Qstash can be removed if using Vercel Cron
# https://vercel.com/docs/cron-jobs/quickstart
# DC cron endpoint: frame/send-notifications
# /frame/[[...routes]]/route.tsx line 44 - 61 can be removed and verified with vercel cron env

NEXT_PUBLIC_SITE_URL=
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=
Expand Down
24 changes: 12 additions & 12 deletions app/frame/[[...routes]]/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ app.hono.post("/send-notifications", async (c) => {
}
const body = await c.req.text();
const currentDay = getCurrentDateUTC();

const isValid = await qstashReceiver
.verify({
body,
signature,
})
.catch((e) => false);

if (!isValid) {
return c.json({ error: "Invalid signature" }, 400);
}

const notificationMessage = `
Day ${currentDay} NFT is now mintable!.
${config.PROD_URL}/frame/dc
N/B: Unsubscribe from getting these notifications through the frame.
`;

const isValid = await qstashReceiver
.verify({
body,
signature,
})
.catch((e) => false);

if (!isValid) {
return c.json({ error: "Invalid signature" }, 400);
}

async function sendUserDCs() {
// const userFids = [846887];
const userFids = await kvStore.smembers(UNLOCK_REDIS_KEY);
Expand Down

0 comments on commit 60fd695

Please sign in to comment.