添加说明和MIT

This commit is contained in:
eoao
2025-04-27 09:09:43 +08:00
parent ba3442ccb1
commit 741f839d09
12 changed files with 213 additions and 32 deletions

View File

@@ -43,6 +43,10 @@ export async function email(message, env, ctx) {
const emailRow = await emailService.receive({ env }, params);
if (!env.r2) {
console.warn('r2对象存储未配置, 附件取消保存');
return;
}
if (email.attachments.length > 0) {
@@ -58,11 +62,6 @@ export async function email(message, env, ctx) {
await attService.addAtt({ env }, attachments);
if (!env.r2) {
console.log('r2对象存储未配置, 附件取消保存');
return;
}
for (let attachment of attachments) {
await r2Service.putObj({ env }, attachment.key, attachment.content, {
contentType: attachment.mimeType,

View File

@@ -11,7 +11,7 @@ export default {
return app.fetch(req, env, ctx);
}
return env.ASSETS.fetch(req);
return env.assets.fetch(req);
},
email: email
};

View File

@@ -11,20 +11,20 @@ ip = "0.0.0.0"
[[d1_databases]]
binding = "db"
database_name = "email"
database_id = "xxxxx"
database_id = ""
[[kv_namespaces]]
binding = "kv"
id = "xxxxx"
id = ""
[[r2_buckets]]
binding = "r2"
bucket_name = "email"
[vars]
domain = ["xxxxx", "xxxxx"]
admin = "xxxxx"
r2_domain = "xxxxx"
jwt_secret = "xxxxx"
site_key = "xxxxx"
secret_key = "xxxxx"
domain = ["", ""]
admin = ""
r2_domain = ""
jwt_secret = ""
site_key = ""
secret_key = ""

View File

@@ -9,25 +9,25 @@ head_sampling_rate = 1
[[d1_databases]]
binding = "db"
database_name = "email-test"
database_id = "xxxxx"
database_id = ""
[[kv_namespaces]]
binding = "kv"
id = "xxxxx"
id = ""
[[r2_buckets]]
binding = "r2"
bucket_name = "email-test"
[assets]
binding = "assets"
directory = "./dist"
binding = "ASSETS"
[vars]
domain = ["xxxxx", "xxxxx"]
admin = "xxxxx"
r2_domain = "xxxxx"
jwt_secret = "xxxxx"
site_key = "xxxxx"
secret_key = "xxxxx"
domain = ["", ""]
admin = ""
r2_domain = ""
jwt_secret = ""
site_key = ""
secret_key = ""

View File

@@ -5,14 +5,27 @@ compatibility_date = "2025-04-09"
[observability]
enabled = true
[[d1_databases]]
binding = "db" #d1数据库绑定名默认不可修改
database_name = "" #d1数据库名字
database_id = "" #d1数据库id
[[kv_namespaces]]
binding = "kv" #kv绑定名默认不可修改
id = "" #kv数据库id
[[r2_buckets]]
binding = "r2" #r2对象存储绑定名默认不可修改
bucket_name = "" #r2对象存储桶的名字
[assets]
directory = "./dist"
binding = "ASSETS"
binding = "assets" #静态资源存放位置默认不可修改
directory = "./dist" #前端vue项目打包的静态资源存放位置,默认dist
[vars]
domain = ["xxxxx", "xxxxx"]
admin = "xxxxx@xxxxx"
r2_domain = "xxxxx"
jwt_secret = "xxxxx"
site_key = "xxxxx"
secret_key = "xxxxx"
domain = [] #邮件域名可可配置多个 示例: ["example1.com","example2.com"]
admin = "" #管理员的邮箱 示例: admin@example.com
r2_domain = "" #r2对象存储桶的访问域名
jwt_secret = "" #jwt令牌的密钥,随便填一串字符串
site_key = "" #Turnstile人机验证的站点密钥
secret_key = "" #Turnstile人机验证的后端密钥