From c7826bd06f6f5be804b365452feda3625fdb6bb5 Mon Sep 17 00:00:00 2001 From: BennyThink Date: Fri, 14 Jan 2022 20:07:29 +0800 Subject: [PATCH] add whitelist --- yyetsweb/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yyetsweb/utils.py b/yyetsweb/utils.py index c100810..6079a8c 100644 --- a/yyetsweb/utils.py +++ b/yyetsweb/utils.py @@ -51,6 +51,9 @@ def send_mail(to: str, subject: str, body: str): def check_spam(ip, ua, author, content) -> int: # 0 means okay token = os.getenv("askismet") + whitelist: "list" = os.getenv("whitelist", "").split(",") + if author in whitelist: + return 0 if token: with contextlib.suppress(Exception): akismet = Akismet(token, blog="https://yyets.dmesg.app/")