mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-13 19:36:30 +08:00
fix: validate mailbox credentials and isolate E2E APIs (#1141)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { Hono } from 'hono';
|
||||
import worker from '../../worker/src/worker';
|
||||
import { CONSTANTS } from '../../worker/src/constants';
|
||||
import mailApi from './mail-api';
|
||||
|
||||
const testApi = new Hono<HonoCustomType>();
|
||||
testApi.post('/seed_mail', c => mailApi.seedMail(c.req.raw, c.env));
|
||||
testApi.post('/receive_mail', c => mailApi.receiveMail(c.req.raw, c.env, c.executionCtx as ExecutionContext));
|
||||
testApi.get('/telegram_binding', async c => {
|
||||
const address = c.req.query('address');
|
||||
if (!address) return c.text('address is required', 400);
|
||||
return c.json(await c.env.KV.get(`${CONSTANTS.TG_KV_PREFIX}:${address}`));
|
||||
});
|
||||
|
||||
const app = new Hono<HonoCustomType>();
|
||||
app.route('/__test', testApi);
|
||||
app.all('*', c => worker.fetch(c.req.raw, c.env, c.executionCtx));
|
||||
|
||||
export default { ...worker, fetch: app.fetch };
|
||||
Reference in New Issue
Block a user