mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-04 23:17:34 +08:00
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:
@@ -0,0 +1,66 @@
|
||||
# Mail API
|
||||
|
||||
## Viewing Emails via Mail API
|
||||
|
||||
This is a `python` example using the `requests` library to view emails.
|
||||
|
||||
```python
|
||||
limit = 10
|
||||
offset = 0
|
||||
res = requests.get(
|
||||
f"https://<your-worker-address>/api/mails?limit={limit}&offset={offset}",
|
||||
headers={
|
||||
"Authorization": f"Bearer {your-JWT-password}",
|
||||
# "x-custom-auth": "<your-website-password>", # If custom password is enabled
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
## Admin Mail API
|
||||
|
||||
Supports `address` filter and `keyword` filter
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
url = "https://<your-worker-address>/admin/mails"
|
||||
|
||||
querystring = {
|
||||
"limit":"20",
|
||||
"offset":"0",
|
||||
# address and keyword are optional parameters
|
||||
"address":"xxxx@awsl.uk",
|
||||
"keyword":"xxxx"
|
||||
}
|
||||
|
||||
headers = {"x-admin-auth": "<your-Admin-password>"}
|
||||
|
||||
response = requests.get(url, headers=headers, params=querystring)
|
||||
|
||||
print(response.json())
|
||||
```
|
||||
|
||||
## User Mail API
|
||||
|
||||
Supports `address` filter and `keyword` filter
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
url = "https://<your-worker-address>/user_api/mails"
|
||||
|
||||
querystring = {
|
||||
"limit":"20",
|
||||
"offset":"0",
|
||||
# address and keyword are optional parameters
|
||||
"address":"xxxx@awsl.uk",
|
||||
"keyword":"xxxx"
|
||||
}
|
||||
|
||||
headers = {"x-admin-auth": "<your-Admin-password>"}
|
||||
|
||||
response = requests.get(url, headers=headers, params=querystring)
|
||||
|
||||
print(response.json())
|
||||
```
|
||||
Reference in New Issue
Block a user