mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-06 20:32:55 +08:00
Refactor delete setting helper and link skills (#994)
* refactor: add deleteSetting helper and link skills * chore: reorganize project skills layout * docs: update skill paths * chore: add AGENTS link and prune skill links * chore: localize agent skill links
This commit is contained in:
1
.agents/skills/cf-temp-mail-agent-mail
Symbolic link
1
.agents/skills/cf-temp-mail-agent-mail
Symbolic link
@@ -0,0 +1 @@
|
||||
../../skills/cf-temp-mail-agent-mail
|
||||
1
.agents/skills/cf-temp-mail-upgrade-dependencies
Symbolic link
1
.agents/skills/cf-temp-mail-upgrade-dependencies
Symbolic link
@@ -0,0 +1 @@
|
||||
../../.claude/skills/cf-temp-mail-upgrade-dependencies
|
||||
1
.agents/skills/cf-temp-mail-version-upgrade
Symbolic link
1
.agents/skills/cf-temp-mail-version-upgrade
Symbolic link
@@ -0,0 +1 @@
|
||||
../../.claude/skills/cf-temp-mail-version-upgrade
|
||||
1
.claude/skills/cf-temp-mail-agent-mail
Symbolic link
1
.claude/skills/cf-temp-mail-agent-mail
Symbolic link
@@ -0,0 +1 @@
|
||||
../../skills/cf-temp-mail-agent-mail
|
||||
@@ -11,7 +11,7 @@
|
||||
### Features
|
||||
|
||||
- feat: |API| 新增服务端解析邮件接口 `/api/parsed_mails` 与 `/api/parsed_mail/:id`,直接返回 `sender` / `subject` / `text` / `html` / `attachments` 元信息(复用 `commonParseMail`),AI agent 侧不再需要引入 MIME 解析器
|
||||
- feat: |Skill| 新增仓库内置只读 skill `cf-temp-mail-agent-mail`(`.claude/skills/cf-temp-mail-agent-mail/`),让 OpenClaw / Codex / Cursor 等 AI agent 凭用户提供的 Address JWT + API 地址读取邮箱、轮询验证码,绕开创建邮箱时的 Turnstile 人机验证;可通过 `npx degit dreamhunter2333/cloudflare_temp_email/.claude/skills/cf-temp-mail-agent-mail` 安装
|
||||
- feat: |Skill| 新增仓库内置只读 skill `cf-temp-mail-agent-mail`(`skills/cf-temp-mail-agent-mail/`),让 OpenClaw / Codex / Cursor 等 AI agent 凭用户提供的 Address JWT + API 地址读取邮箱、轮询验证码,绕开创建邮箱时的 Turnstile 人机验证;可通过 `npx degit dreamhunter2333/cloudflare_temp_email/skills/cf-temp-mail-agent-mail` 安装
|
||||
- docs: |文档| 新增"AI Agent 使用邮箱"文档(`guide/feature/agent-email`),说明 `parsed_mail` API 用法,并在 parsed API 不可用时给出对齐前端的 `mail-parser-wasm` + `postal-mime` 本地解析回退方案
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
### Features
|
||||
|
||||
- feat: |API| Add server-side parsed-mail endpoints `/api/parsed_mails` and `/api/parsed_mail/:id` that return `sender` / `subject` / `text` / `html` / `attachments` metadata directly (reuses `commonParseMail`), so AI agents no longer need a client-side MIME parser
|
||||
- feat: |Skill| Bundle a read-only skill `cf-temp-mail-agent-mail` (`.claude/skills/cf-temp-mail-agent-mail/`) so AI agents like OpenClaw / Codex / Cursor can consume a mailbox with a user-supplied Address JWT + API base URL — list mails, poll verification codes, etc. — sidestepping the Turnstile challenge required to create a mailbox. Install via `npx degit dreamhunter2333/cloudflare_temp_email/.claude/skills/cf-temp-mail-agent-mail`
|
||||
- feat: |Skill| Bundle a read-only skill `cf-temp-mail-agent-mail` (`skills/cf-temp-mail-agent-mail/`) so AI agents like OpenClaw / Codex / Cursor can consume a mailbox with a user-supplied Address JWT + API base URL — list mails, poll verification codes, etc. — sidestepping the Turnstile challenge required to create a mailbox. Install via `npx degit dreamhunter2333/cloudflare_temp_email/skills/cf-temp-mail-agent-mail`
|
||||
- docs: |Docs| Add "AI Agent Mailbox Usage" doc (`guide/feature/agent-email`) covering the `parsed_mail` API and a local-parse fallback using `mail-parser-wasm` + `postal-mime` (mirrors the frontend) when parsed endpoints are unavailable
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
- [x] Webhook 支持,消息推送集成
|
||||
- [x] 支持 `CF Turnstile` 人机验证
|
||||
- [x] 限流配置,防止滥用
|
||||
- [x] **Agent 友好**:内置 [`cf-temp-mail-agent-mail`](.claude/skills/cf-temp-mail-agent-mail/SKILL.md) skill,AI agent 可直接消费邮箱,详见 [文档](vitepress-docs/docs/zh/guide/feature/agent-email.md)
|
||||
- [x] **Agent 友好**:内置 [`cf-temp-mail-agent-mail`](skills/cf-temp-mail-agent-mail/SKILL.md) skill,AI agent 可直接消费邮箱,详见 [文档](vitepress-docs/docs/zh/guide/feature/agent-email.md)
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ Try it now → [https://mail.awsl.uk/](https://mail.awsl.uk/)
|
||||
- [x] Webhook support and message push integration
|
||||
- [x] Support `CF Turnstile` CAPTCHA verification
|
||||
- [x] Rate limiting configuration to prevent abuse
|
||||
- [x] **Agent-friendly**: bundled [`cf-temp-mail-agent-mail`](.claude/skills/cf-temp-mail-agent-mail/SKILL.md) skill lets AI agents consume a mailbox directly, see [docs](vitepress-docs/docs/en/guide/feature/agent-email.md)
|
||||
- [x] **Agent-friendly**: bundled [`cf-temp-mail-agent-mail`](skills/cf-temp-mail-agent-mail/SKILL.md) skill lets AI agents consume a mailbox directly, see [docs](vitepress-docs/docs/en/guide/feature/agent-email.md)
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ For attachment bytes, use `postal-mime` directly — `parsed.attachments[i].cont
|
||||
|
||||
## `cf-temp-mail-agent-mail` Skill
|
||||
|
||||
The repo ships an agent skill at `.claude/skills/cf-temp-mail-agent-mail/` that wraps the flow above. Works with Claude Code / Cursor / Codex / OpenClaw and other agents.
|
||||
The repo ships an agent skill at `skills/cf-temp-mail-agent-mail/` that wraps the flow above. Works with Claude Code / Cursor / Codex / OpenClaw and other agents.
|
||||
|
||||
Pick any install method:
|
||||
|
||||
@@ -195,14 +195,14 @@ npx skills add dreamhunter2333/cloudflare_temp_email --skill cf-temp-mail-agent-
|
||||
npx skills add dreamhunter2333/cloudflare_temp_email --skill cf-temp-mail-agent-mail -g
|
||||
|
||||
# Option 2: npx degit to copy into your agent's skills folder
|
||||
npx degit dreamhunter2333/cloudflare_temp_email/.claude/skills/cf-temp-mail-agent-mail <your-agent-skills-dir>/cf-temp-mail-agent-mail
|
||||
npx degit dreamhunter2333/cloudflare_temp_email/skills/cf-temp-mail-agent-mail <your-agent-skills-dir>/cf-temp-mail-agent-mail
|
||||
|
||||
# Option 3: clone and copy
|
||||
git clone --depth 1 https://github.com/dreamhunter2333/cloudflare_temp_email.git /tmp/cf-temp-mail
|
||||
cp -r /tmp/cf-temp-mail/.claude/skills/cf-temp-mail-agent-mail <your-agent-skills-dir>/
|
||||
cp -r /tmp/cf-temp-mail/skills/cf-temp-mail-agent-mail <your-agent-skills-dir>/
|
||||
```
|
||||
|
||||
See [SKILL.md](https://github.com/dreamhunter2333/cloudflare_temp_email/blob/main/.claude/skills/cf-temp-mail-agent-mail/SKILL.md) for details.
|
||||
See [SKILL.md](https://github.com/dreamhunter2333/cloudflare_temp_email/blob/main/skills/cf-temp-mail-agent-mail/SKILL.md) for details.
|
||||
|
||||
## Common errors
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ const parsed = await parseRaw(row.raw);
|
||||
|
||||
## `cf-temp-mail-agent-mail` Skill
|
||||
|
||||
仓库内置了 Agent 技能:`.claude/skills/cf-temp-mail-agent-mail/`,把上述流程封装成 AI Agent 可直接调用的形式,支持 Claude Code / Cursor / Codex / OpenClaw 等。
|
||||
仓库内置了 Agent 技能:`skills/cf-temp-mail-agent-mail/`,把上述流程封装成 AI Agent 可直接调用的形式,支持 Claude Code / Cursor / Codex / OpenClaw 等。
|
||||
|
||||
安装方式任选其一:
|
||||
|
||||
@@ -195,14 +195,14 @@ npx skills add dreamhunter2333/cloudflare_temp_email --skill cf-temp-mail-agent-
|
||||
npx skills add dreamhunter2333/cloudflare_temp_email --skill cf-temp-mail-agent-mail -g
|
||||
|
||||
# 方式 2:npx degit 拷贝到你的 agent skills 目录
|
||||
npx degit dreamhunter2333/cloudflare_temp_email/.claude/skills/cf-temp-mail-agent-mail <your-agent-skills-dir>/cf-temp-mail-agent-mail
|
||||
npx degit dreamhunter2333/cloudflare_temp_email/skills/cf-temp-mail-agent-mail <your-agent-skills-dir>/cf-temp-mail-agent-mail
|
||||
|
||||
# 方式 3:克隆后复制
|
||||
git clone --depth 1 https://github.com/dreamhunter2333/cloudflare_temp_email.git /tmp/cf-temp-mail
|
||||
cp -r /tmp/cf-temp-mail/.claude/skills/cf-temp-mail-agent-mail <your-agent-skills-dir>/
|
||||
cp -r /tmp/cf-temp-mail/skills/cf-temp-mail-agent-mail <your-agent-skills-dir>/
|
||||
```
|
||||
|
||||
详情见 [SKILL.md](https://github.com/dreamhunter2333/cloudflare_temp_email/blob/main/.claude/skills/cf-temp-mail-agent-mail/SKILL.md)。
|
||||
详情见 [SKILL.md](https://github.com/dreamhunter2333/cloudflare_temp_email/blob/main/skills/cf-temp-mail-agent-mail/SKILL.md)。
|
||||
|
||||
## 常见错误
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Context } from 'hono'
|
||||
|
||||
import i18n from '../i18n'
|
||||
import { getJsonSetting, saveSetting } from '../utils'
|
||||
import { deleteSetting, getJsonSetting, saveSetting } from '../utils'
|
||||
import { getAddressCreationSettings, getAddressCreationSubdomainMatchStatus } from '../common'
|
||||
import { CONSTANTS } from '../constants'
|
||||
import {
|
||||
@@ -109,9 +109,7 @@ const save = async (c: Context<HonoCustomType>) => {
|
||||
await saveSetting(c, CONSTANTS.EMAIL_RULE_SETTINGS_KEY, JSON.stringify(emailRuleSettings || {}));
|
||||
if (addressCreationSettingsUpdate.shouldUpdate) {
|
||||
if (addressCreationSettingsUpdate.shouldClear) {
|
||||
await c.env.DB.prepare(
|
||||
`DELETE FROM settings WHERE key = ?`
|
||||
).bind(CONSTANTS.ADDRESS_CREATION_SETTINGS_KEY).run();
|
||||
await deleteSetting(c, CONSTANTS.ADDRESS_CREATION_SETTINGS_KEY);
|
||||
} else {
|
||||
await saveSetting(
|
||||
c, CONSTANTS.ADDRESS_CREATION_SETTINGS_KEY,
|
||||
|
||||
@@ -64,6 +64,16 @@ export const saveSetting = async (
|
||||
return true;
|
||||
}
|
||||
|
||||
export const deleteSetting = async (
|
||||
c: Context<HonoCustomType>,
|
||||
key: string
|
||||
) => {
|
||||
await c.env.DB.prepare(
|
||||
`DELETE FROM settings WHERE key = ?`
|
||||
).bind(key).run();
|
||||
return true;
|
||||
}
|
||||
|
||||
export const getStringValue = (value: any): string => {
|
||||
if (typeof value === "string") {
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user