Files
cloudflare_temp_email/vitepress-docs/docs/.vitepress/en.ts
T
Dream Hunter dbb55d948f feat: add AI email extraction with Cloudflare Workers AI
Add AI-powered email content extraction feature using Cloudflare Workers AI to automatically identify and extract important information from emails including verification codes, authentication links, service links, and subscription links.

Features:
- AI extraction with priority-based logic (auth_code > auth_link > service_link > subscription_link > other_link)
- Admin allowlist configuration with wildcard support (*@example.com)
- Frontend display in both email list (compact) and detail view (full mode)
- Bilingual documentation (Chinese/English)
- Database migration: add metadata field to raw_mails (v0.0.3 -> v0.0.4)

Technical highlights:
- Proper regex escaping for wildcard pattern matching
- Content truncation to avoid AI token limits
- Error handling that won't affect email receiving
- JSON schema validation for AI responses
- Type-safe TypeScript implementation
- Vue I18n support with special character escaping

References:
- Inspired by Alle Project: https://github.com/bestruirui/Alle
- Uses Cloudflare Workers AI JSON Mode

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-06 16:28:19 +08:00

171 lines
6.0 KiB
TypeScript

import { defineConfig, type DefaultTheme } from 'vitepress'
export const en = defineConfig({
title: "Temp Mail Doc",
lang: 'en-US',
description: 'CloudFlare Free sending and receiving of temporary domain name mailboxes',
themeConfig: {
nav: nav(),
sidebar: {
'/en/guide/': { base: '/en/guide/', items: sidebarGuide() },
},
editLink: {
pattern: 'https://github.com/dreamhunter2333/cloudflare_temp_email/edit/main/vitepress-docs/docs/:path',
text: 'Edit this page on GitHub'
},
footer: {
message: 'Based on MIT license',
copyright: `Copyright © 2023-${new Date().getFullYear()} Dream Hunter`
},
docFooter: {
prev: 'Previous',
next: 'Next'
},
outline: {
level: 'deep',
label: 'On this page'
},
lastUpdated: {
text: 'Last updated',
formatOptions: {
dateStyle: 'short',
timeStyle: 'medium'
}
},
langMenuLabel: 'Language',
returnToTopLabel: 'Return to top',
sidebarMenuLabel: 'Menu',
darkModeSwitchLabel: 'Theme',
lightModeSwitchTitle: 'Switch to light mode',
darkModeSwitchTitle: 'Switch to dark mode'
}
})
function nav(): DefaultTheme.NavItem[] {
return [
{
text: 'Home',
link: '/en/',
},
{
text: 'Guide',
link: '/en/guide/quick-start',
activeMatch: '/en/guide/'
},
{
text: 'Service Status',
link: '/en/status',
},
{
text: 'Reference',
link: '/en/reference',
},
{
text: process.env.TAG_NAME || 'v0.2.2',
items: [
{
text: 'CHANGELOG',
link: 'https://github.com/dreamhunter2333/cloudflare_temp_email/blob/main/CHANGELOG.md'
},
{
text: 'Contribute',
link: 'https://github.com/dreamhunter2333/cloudflare_temp_email'
}
]
}
]
}
function sidebarGuide(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Introduction',
collapsed: false,
items: [
{ text: 'What is Temporary Email', link: 'what-is-temp-mail' },
{ text: 'Star History', link: 'star-history' },
{ text: 'Quick Start', link: 'quick-start' },
]
},
{
text: 'Deploy via Command Line',
collapsed: false,
items: [
{ text: 'CLI Prerequisites', link: 'cli/pre-requisite' },
{ text: 'D1 Database', link: 'cli/d1' },
{ text: 'Cloudflare Workers Backend', link: 'cli/worker' },
{ text: 'Configure Email Routing', link: 'email-routing.md' },
{ text: 'Cloudflare Pages Frontend', link: 'cli/pages' },
{ text: 'Configure Email Sending', link: 'config-send-mail' },
]
},
{
text: 'Deploy via User Interface',
collapsed: false,
items: [
{ text: 'D1 Database', link: 'ui/d1' },
{ text: 'Cloudflare Workers Backend', link: 'ui/worker' },
{ text: 'Configure Email Routing', link: 'email-routing.md' },
{ text: 'Cloudflare Pages Frontend', link: 'ui/pages' },
{ text: 'Configure Email Sending', link: 'config-send-mail' },
]
},
{
text: 'Deploy via Github Actions',
collapsed: true,
items: [
{ text: 'Github Actions Prerequisites', link: 'actions/pre-requisite' },
{ text: 'D1 Database', link: 'actions/d1' },
{ text: 'Github Actions Configuration', link: 'actions/github-action' },
{ text: 'Configure Email Routing', link: 'email-routing.md' },
{ text: 'Configure Email Sending', link: 'config-send-mail' },
{ text: 'Auto-Update Configuration', link: 'actions/auto-update' },
]
},
{
text: 'General',
collapsed: false,
items: [
{ text: 'Worker Variables', link: 'worker-vars' },
{ text: 'Common Issues', link: 'common-issues' },
]
},
{
text: 'Additional Features',
collapsed: false,
items: [
{ text: 'AI Email Recognition', link: 'feature/ai-extract' },
{ text: 'Configure SMTP IMAP Proxy', link: 'feature/config-smtp-proxy' },
{ text: 'Send Email API', link: 'feature/send-mail-api' },
{ text: 'View Email API', link: 'feature/mail-api' },
{ text: 'Configure Subdomain Email', link: 'feature/subdomain' },
{ text: 'Configure Telegram Bot', link: 'feature/telegram' },
{ text: 'Configure S3 Attachments', link: 'feature/s3-attachment' },
{ text: 'Configure WASM Email Parser', link: 'feature/mail_parser_wasm_worker' },
{ text: 'Configure Webhook', link: 'feature/webhook' },
{ text: 'New Address API', link: 'feature/new-address-api' },
{ text: 'OAuth2 Third-party Login', link: 'feature/user-oauth2' },
{ text: 'Enhance with Other Workers', link: 'feature/another-worker-enhanced' },
{ text: 'Add Google Ads', link: 'feature/google-ads.md' },
]
},
{
text: 'Feature Overview',
collapsed: false,
items: [
{ text: 'Admin Console', link: 'feature/admin' },
{ text: 'Admin User Management', link: 'feature/admin-user-management' },
]
},
{ text: 'Reference', base: "/en/", link: 'reference' }
]
}