forked from unionlabs/union
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
054782a
commit 5374b3e
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Supabase | ||
.branches | ||
.temp | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const resendSecret = Deno.env.get("RESEND_SECRET") | ||
const resendApiKey = Deno.env.get("RESEND_API_KEY") | ||
|
||
const handler = async (request: Request): Promise<Response> => { | ||
const { secret, email } = await request.json() | ||
if (secret !== resendSecret) { | ||
return new Response(JSON.stringify("too bad"), { | ||
status: 403, | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
}) | ||
} | ||
const res = await fetch("https://api.resend.com/emails", { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: `Bearer ${resendApiKey}` | ||
}, | ||
body: JSON.stringify({ | ||
from: "Union Ceremony <[email protected]>", | ||
to: [email], | ||
reply_to: "[email protected]", | ||
subject: "Your Turn Is Almost Here - Log Into Union Ceremony", | ||
html: ` | ||
<p> | ||
Your contribution slot for the Union Trusted Setup Ceremony is almost here. | ||
</p> | ||
<p> | ||
Your place in queue: <strong>5</strong><br/> | ||
Estimated time until your slot: between <strong>1 hour</strong> and <strong>5 hours</strong> | ||
</p> | ||
<p> | ||
Please go to <strong><a href="https://ceremony.union.build">ceremony.union.build</a></strong>, log in, and follow all steps on the page.<br/> | ||
If you do not follow all steps by the time your contribution slot arrives, <strong>you will lose your slot</strong>. | ||
</p> | ||
` | ||
}) | ||
}) | ||
const data = await res.json() | ||
return new Response(JSON.stringify(data), { | ||
status: 200, | ||
headers: { | ||
"Content-Type": "application/json" | ||
} | ||
}) | ||
} | ||
|
||
Deno.serve(handler) |