"bot_token": "",
"bot_visibility": "unlisted",
"slogan": "### Your footer slogan ###",
- "recheck_instance": 3600
+ "recheck_instance": 3600,
+ "recheck_block": 3600
}
# NOISY-DEBUG: print("DEBUG: Calculating hash for domain:", domain)
return sha256(domain.encode("utf-8")).hexdigest()
+def update_last_blocked(domain: str):
+ # NOISY-DEBUG: print("DEBUG: Updating last_blocked for domain", domain)
+
+ try:
+ c.execute("UPDATE instances SET last_blocked = ? WHERE domain = ?", [
+ time.time(),
+ domain
+ ])
+
+ except:
+ print("ERROR: failed SQL query:", domain)
+ sys.exit(255)
+
def update_last_error(domain: str, res: any):
# NOISY-DEBUG: print("DEBUG: domain,res.status_code", domain, res.status_code)
import fba
fba.c.execute(
- "SELECT domain, software FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial') ORDER BY rowid DESC"
+ "SELECT domain, software FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial') AND (last_blocked IS NULL OR last_blocked < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_block"]]
)
for blocker, software in fba.c.fetchall():
print("WARNING: blocker is now empty!")
continue
+ fba.update_last_blocked(blocker)
+
if software == "pleroma":
print("INFO: blocker:", blocker)
try: