Add readonly todo and archive providers and retire legacy writes

This commit is contained in:
abaishu0730 committed 2026-10-19 12:43:03 +08:00
1 parent 37b4a156c9
commit 5c7ce76f5d
12 files changed
+187 -25

No files matched your search

+4
View File
@@ -6,6 +6,10 @@ async function mailApi({mail,workspace,user,route,method,body,request,response,r
if(method==='POST'&&user.role!=='admin')fail('仅管理员可以维护邮箱和确认模板。',403);
if(route==='/api/mail'&&method==='GET'){reply(200,{historyOnly:mail.historyOnly===true,channels:store.channels(),templates:store.templates(),receipts:store.receipts(),sends:store.sends()});return true;}
const audit=(action,detail)=>workspace?.record(user,action,detail);
if(route==='/api/mail/templates/categories'){
if(method==='GET'){reply(200,{categories:require('../order-rules/catalog.cjs').seedRules().map(({id,name})=>({id,name})),bindings:store.categoryBindings()});return true;}
if(method==='POST'){if(mail.historyOnly)fail('只读邮件空间不能修改类别关联。',409);const saved=store.bindCategory(body);audit('mail.category.bind',saved.categoryId);reply(200,saved);return true;}
}
if(route==='/api/mail/channels'&&method==='POST'){
if(!secureBpmTransport(request,trustedProxy))fail('请在部署机本地或 HTTPS 页面维护邮箱账号。',403);
if(mail.historyOnly&&body?.readOnly!==true)fail('此空间只允许配置只读 IMAP 邮箱。',409);