mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-06-03 14:40:40 +08:00
* feat: add cf-temp-mail-usage skill and parsed mail API for AI agents - feat: new /api/parsed_mails and /api/parsed_mail/:id endpoints returning server-parsed subject/text/html/attachments metadata (reuses commonParseMail) - feat: add .claude/skills/cf-temp-mail-usage read-only skill so AI agents (OpenClaw / Codex / Cursor) can consume a mailbox with a user-supplied JWT, bypassing the Turnstile challenge required for mailbox creation - refactor: split mails_api/index.ts and admin_api/index.ts into thin route shells; move business logic into dedicated *_api.ts files - docs: update README / README_EN / CHANGELOG with agent-email feature and npx degit install instructions for the skill Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat: rename skill to cf-temp-mail-agent-mail, add agent-email docs, fix sender trim - Rename skill from cf-temp-mail-usage to cf-temp-mail-agent-mail - Rewrite SKILL.md: parsed API primary, local fallback, prerequisites, multi-agent install - Add vitepress docs (zh + en) for AI Agent mailbox usage - Fix leading space in parsed_mail_api sender field via .trim() - Update README install section with 3 install methods - Update changelogs (zh + en) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * docs: simplify README agent skill section to one-liner with links Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * feat: add send mail API to skill, credential persistence, remove poll example Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { Context } from 'hono'
|
|
|
|
const get = async (c: Context<HonoCustomType>) => {
|
|
const { count: mailCount } = await c.env.DB.prepare(
|
|
`SELECT count(*) as count FROM raw_mails`
|
|
).first<{ count: number }>() || {};
|
|
const { count: addressCount } = await c.env.DB.prepare(
|
|
`SELECT count(*) as count FROM address`
|
|
).first<{ count: number }>() || {};
|
|
const { count: activeAddressCount7days } = await c.env.DB.prepare(
|
|
`SELECT count(*) as count FROM address where updated_at > datetime('now', '-7 day')`
|
|
).first<{ count: number }>() || {};
|
|
const { count: activeAddressCount30days } = await c.env.DB.prepare(
|
|
`SELECT count(*) as count FROM address where updated_at > datetime('now', '-30 day')`
|
|
).first<{ count: number }>() || {};
|
|
const { count: sendMailCount } = await c.env.DB.prepare(
|
|
`SELECT count(*) as count FROM sendbox`
|
|
).first<{ count: number }>() || {};
|
|
const { count: userCount } = await c.env.DB.prepare(
|
|
`SELECT count(*) as count FROM users`
|
|
).first<{ count: number }>() || {};
|
|
return c.json({
|
|
mailCount,
|
|
addressCount,
|
|
activeAddressCount7days,
|
|
activeAddressCount30days,
|
|
userCount,
|
|
sendMailCount,
|
|
});
|
|
};
|
|
|
|
export default { get };
|