Skip to content

Commit e3c33a6

Browse files
committed
disable cf
1 parent bac3853 commit e3c33a6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

yyetsweb/common/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __init__(self):
127127
self.session.headers.update({"Authorization": "Bearer %s" % os.getenv("CF_TOKEN")})
128128
super().__init__()
129129

130-
def get_old_ips(self) -> dict:
130+
def get_old_ips(self) -> list:
131131
cache = self.r.get(self.key)
132132
if cache:
133133
cache = json.loads(cache)
@@ -137,7 +137,7 @@ def get_old_ips(self) -> dict:
137137
return cache
138138
else:
139139
data = self.session.get(self.endpoint).json()
140-
result = data.get("result", [])
140+
result = data.get("result") or []
141141
cursor = data.get("result_info", {}).get("cursors", {}).get("after")
142142
while cursor:
143143
logging.info("Fetching next page with cursor %s", cursor)
@@ -148,6 +148,8 @@ def get_old_ips(self) -> dict:
148148
return result
149149

150150
def ban_new_ip(self, ip):
151+
# disable it
152+
return
151153
if ":" in ip:
152154
ip = ip.rsplit(":", 4)[0] + "::/64"
153155
old_ips = [d["ip"] for d in self.get_old_ips()]

0 commit comments

Comments
 (0)