feat: add ENABLE_ATTACHMENT config (#99)

This commit is contained in:
Dream Hunter
2024-04-04 14:42:34 +08:00
committed by GitHub
parent 9ce706fad1
commit 47256d2af2
4 changed files with 8 additions and 1 deletions

View File

@@ -137,6 +137,8 @@ PREFIX = "tmp" # 要处理的邮箱名称前缀
DOMAINS = ["xxx.xxx1" , "xxx.xxx2"] # 你的域名
JWT_SECRET = "xxx" # 用于生成 jwt 的密钥
BLACK_LIST = "" # 黑名单,用于过滤发件人,逗号分隔
# 免费版附件过大会造成 Exceeded CPU Limit 错误,如果不需要附件功能,可以关闭
ENABLE_ATTACHMENT = true
[[d1_databases]]
binding = "DB"

View File

@@ -56,6 +56,8 @@ pnpm install
# DOMAINS = ["xxx.xxx1" , "xxx.xxx2"] you domain name
# JWT_SECRET = "xxx"
# BLACK_LIST = ""
# free version attachment too large will cause Exceeded CPU Limit error, if you don't need attachment function, you can close
# ENABLE_ATTACHMENT = true
cp wrangler.toml.template wrangler.toml
# deploy
pnpm run deploy

View File

@@ -82,7 +82,8 @@ async function email(message, env, ctx) {
// process attachments
try {
if (
parsedEmail.attachments
env.ENABLE_ATTACHMENT
&& parsedEmail.attachments
&& parsedEmail.attachments.length > 0
) {
const { success } = await env.DB.prepare(

View File

@@ -12,6 +12,8 @@ PREFIX = "tmp"
DOMAINS = ["xxx.xxx1" , "xxx.xxx2"]
JWT_SECRET = "xxx"
BLACK_LIST = ""
# IF YOU WANT DISABLE ATTACHMENT, SET IT TO false or COMMENT IT
ENABLE_ATTACHMENT = true
[[d1_databases]]
binding = "DB"