fix: validate mailbox credentials and isolate E2E APIs (#1141)

This commit is contained in:
Dream Hunter
2026-09-09 18:11:53 +08:00
committed by GitHub
parent f88852a353
commit 066fcfc8c2
45 changed files with 601 additions and 171 deletions
+19
View File
@@ -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 };