新增支持API添加用户,查询邮件

This commit is contained in:
eoao
2025-08-10 11:37:46 +08:00
parent 2437ff4599
commit 46127a8d67
38 changed files with 894 additions and 713 deletions

View File

@@ -14,7 +14,8 @@ const exclude = [
'/file',
'/setting/websiteConfig',
'/webhooks',
'/init'
'/init',
'/public/genToken'
];
const requirePerms = [
@@ -95,6 +96,16 @@ app.use('*', async (c, next) => {
return await next();
}
if (path.startsWith('/public')) {
const userPublicToken = await c.env.kv.get(KvConst.PUBLIC_KEY);
const publicToken = c.req.header(constant.TOKEN_HEADER);
if (publicToken !== userPublicToken) {
throw new BizError(t('publicTokenFail'), 401);
}
return await next();
}
const jwt = c.req.header(constant.TOKEN_HEADER);