mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-05 23:47:50 +08:00
fix: align user send mail behavior
This commit is contained in:
@@ -60,13 +60,12 @@ const send = async (c: Context<HonoCustomType>): Promise<Response> => {
|
||||
if (address instanceof Response) {
|
||||
return address;
|
||||
}
|
||||
const msgs = i18n.getMessagesbyContext(c);
|
||||
try {
|
||||
const reqJson = await c.req.json();
|
||||
await sendMail(c, address, reqJson);
|
||||
} catch (error) {
|
||||
console.error("Failed to send user mail", error);
|
||||
return c.text(msgs.OperationFailedMsg, 500);
|
||||
return c.text(`Failed to send mail ${(error as Error).message}`, 400);
|
||||
}
|
||||
return c.json({ status: "ok" });
|
||||
}
|
||||
|
||||
@@ -65,6 +65,10 @@ app.use('/*', async (c, next) => {
|
||||
c.req.path.startsWith("/api/new_address")
|
||||
|| c.req.path.startsWith("/api/send_mail")
|
||||
|| c.req.path.startsWith("/external/api/send_mail")
|
||||
|| (
|
||||
c.req.path.startsWith("/user_api/address/")
|
||||
&& c.req.path.endsWith("/send_mail")
|
||||
)
|
||||
|| c.req.path.startsWith("/user_api/register")
|
||||
|| c.req.path.startsWith("/user_api/verify_code")
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user