diff --git a/README.MD b/README.MD index 1fcb2b96..519922a3 100644 --- a/README.MD +++ b/README.MD @@ -196,6 +196,30 @@ serve-limit: # 上行速率限制 (KiB/s), 0 表示无限制 upload-rate: 0 +# API 速率限制. 注意: 该功能仅限制对 /api 路径的访问, 不会影响 openbmclapi 基本功能 +api-rate-limit: + # 未登录用户的速率限制, 以访问 IP 为准 (会被 trusted-x-forwarded-for 标志影响) + anonymous: + per-minute: 10 # 每分钟最多请求数, 0 表示不限制 + per-hour: 120 # 每小时最多请求数, 0 表示不限制 + # 已登录用户的速率限制, 以用户名为准 + logged: + per-minute: 120 + per-hour: 6000 + +# 通知设置 +notification: + # 启用邮件通知 + enable-email: false + # 邮件 SMTP 服务器及其端口 + email-smtp: smtp.example.com:25 + # 通知者邮箱用户名 + email-sender: noreply@example.com + # 通知者邮箱密码 + email-sender-password: example-password + # 启用 Webhook (TODO) + enable-webhook: true + # 内置的仪表板 dashboard: # 是否启用 diff --git a/config.yaml b/config.yaml index 519a865e..894d9e43 100644 --- a/config.yaml +++ b/config.yaml @@ -27,6 +27,19 @@ serve-limit: enable: false max-conn: 16384 upload-rate: 10240 +api-rate-limit: + anonymous: + per-minute: 10 + per-hour: 120 + logged: + per-minute: 120 + per-hour: 6000 +notification: + enable-email: false + email-smtp: smtp.example.com:25 + email-sender: noreply@example.com + email-sender-password: example-password + enable-webhook: true dashboard: enable: true username: "" diff --git a/notify/email/email.go b/notify/email/email.go index 433c4dbf..f627c92e 100644 --- a/notify/email/email.go +++ b/notify/email/email.go @@ -53,7 +53,7 @@ var tmpl = func() *template.Template { }, "tojson": json.Marshal, }) - template.Must(t.ParseFS(tmplFS)) + template.Must(t.ParseFS(tmplFS, "**/*.gohtml")) return t }()