feat: add daily request limit and refactor access control (#759)

- Add daily request limit per IP in blacklist settings (1-1,000,000/day)
- Refactor access control logic: merge blacklist and rate limit checks
- Remove RATE_LIMIT_API_DAILY_REQUESTS env var, use database config instead
- Move x-custom-auth check earlier in middleware chain
- Add comprehensive English documentation (31 new guide pages)
- Improve code structure and error handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Dream Hunter
2025-11-08 12:46:30 +08:00
committed by GitHub
co-authored by Claude
parent eaeac8ebec
commit b337a44e62
44 changed files with 1983 additions and 154 deletions
+118 -5
View File
@@ -2,13 +2,16 @@ import { defineConfig, type DefaultTheme } from 'vitepress'
export const en = defineConfig({
title: "Temp Mail Doc",
lang: 'zh-Hans',
lang: 'en-US',
description: 'CloudFlare Free sending and receiving of temporary domain name mailboxes',
themeConfig: {
outline: 'deep',
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'
@@ -18,6 +21,31 @@ export const en = defineConfig({
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'
}
})
@@ -29,15 +57,16 @@ function nav(): DefaultTheme.NavItem[] {
},
{
text: 'Guide',
link: '/en/cli',
link: '/en/guide/quick-start',
activeMatch: '/en/guide/'
},
{
text: 'Service Status',
link: '/status',
link: '/en/status',
},
{
text: 'Reference',
link: '/reference',
link: '/en/reference',
},
{
text: process.env.TAG_NAME || 'v0.2.2',
@@ -54,3 +83,87 @@ function nav(): DefaultTheme.NavItem[] {
}
]
}
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: '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' }
]
}