fix: telegram bot golbalPush (#272)

This commit is contained in:
Dream Hunter
2024-05-25 14:38:33 +08:00
committed by GitHub
parent 6d55acdd42
commit 954ae2dfb1
+3 -4
View File
@@ -136,10 +136,8 @@ async function getMail(c: Context<HonoCustomType>): Promise<Response> {
).bind(mailId).first();
const settings = await c.env.KV.get<TelegramSettings>(CONSTANTS.TG_KV_SETTINGS_KEY, "json");
const superUser = settings?.enableGlobalMailPush && settings?.globalMailPushList.includes(userId);
if (
!superUser && result?.address &&
!(result.address as string in addressIdMap)
) {
if (!superUser) {
if (result?.address && !(result.address as string in addressIdMap)) {
return c.text("无权查看此邮件", 403);
}
const address_id = addressIdMap[result?.address as string];
@@ -149,6 +147,7 @@ async function getMail(c: Context<HonoCustomType>): Promise<Response> {
if (!db_address_id) {
return c.text("无权查看此邮件", 403);
}
}
return c.json(result);
}
catch (e) {