Make entry autoban opt-in, bound PPTX unpacking, unify skin DB path, prune deploy examples
checks / pytest (push) Has been cancelled
checks / moderation (push) Has been cancelled
checks / node (push) Has been cancelled

This commit is contained in:
2026-10-30 23:14:03 +03:00
parent 0ee6fb843b
commit 52018ca568
24 changed files with 168 additions and 93 deletions
+5 -5
View File
@@ -1,3 +1,6 @@
"""Opt-in: automatic IP-collision bans run only with IISHKO_ENTRY_AUTOBAN=1.
A shared IP (NAT, mobile CGNAT, family Wi-Fi) is otherwise only an operator alert.
Manual operator bans (ban_cluster) are not gated by this flag."""
import json
import logging
import os
@@ -9,14 +12,14 @@ log = logging.getLogger("entry_autoban")
BOT_DB = os.environ.get("IISHKO_BOT_DB", "/opt/grok-bot/bot.db")
GW_DB = os.environ.get("IISHKO_GW_DB", "/opt/grok-gateway/new-api/one-api.db")
SKIN_DB = os.environ.get("IISHKO_SKIN_DB", "/opt/grok-web-skin-tg.db")
SKIN_DB = os.environ.get("IISHKO_SKIN_DB") or os.environ.get("GATE_TG_DB", "/opt/grok-web-skin-tg.db")
PROTECT = tuple(int(v) for v in os.environ.get("IISHKO_PROTECTED_UIDS", "").replace(";", ",").split(",")
if v.strip().isdigit())
def enabled():
return os.environ.get("IISHKO_ENTRY_AUTOBAN", "1").strip().lower() not in ("0", "off", "no", "false")
return os.environ.get("IISHKO_ENTRY_AUTOBAN", "0").strip().lower() in ("1", "on", "yes", "true")
def _connect(path):
@@ -198,9 +201,6 @@ def ban_user(uid, reason="entry_ip_collision", taken=None):
def ban_cluster(uids, reason="entry_ip_collision"):
uids = [int(u) for u in uids]
if not enabled():
log.warning("[ENTRY-AUTOBAN] disabled")
return []
out = []
for uid in dict.fromkeys(uids):
try: