mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-05 23:47:50 +08:00
fix: /api/mails' use address from jwt (#5)
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
- 使用 Cloudflare Workers 部署后端
|
- 使用 Cloudflare Workers 部署后端
|
||||||
- email 转发使用 Cloudflare Email Route
|
- email 转发使用 Cloudflare Email Route
|
||||||
- Cloudflare D1 作为数据库。
|
- Cloudflare D1 作为数据库。
|
||||||
|
- 免费版附件过大会造成 Exceeded CPU Limit 错误
|
||||||
|
|
||||||
[在线演示](https://temp-email.dreamhunter2333.xyz/)
|
[在线演示](https://temp-email.dreamhunter2333.xyz/)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const refresh = async () => {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const response = await fetch(`${API_BASE}/api/mails?address=${address.value}`, {
|
const response = await fetch(`${API_BASE}/api/mails`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bearer ${jwt.value}`,
|
"Authorization": `Bearer ${jwt.value}`,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Jwt } from 'hono/utils/jwt'
|
|||||||
const api = new Hono()
|
const api = new Hono()
|
||||||
|
|
||||||
api.get('/api/mails', async (c) => {
|
api.get('/api/mails', async (c) => {
|
||||||
const { address } = c.req.query()
|
const { address } = c.get("jwtPayload")
|
||||||
if (!address) {
|
if (!address) {
|
||||||
return c.json({ "error": "No address" }, 400)
|
return c.json({ "error": "No address" }, 400)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user