From 642eff3345e3459495daee3a4ca444beb1f4aa02 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 22 May 2023 06:52:05 +0200 Subject: [PATCH] Continued: - Takahe added (partly WIP) --- api.py | 2 +- fetch_blocks.py | 6 ++++-- fetch_instances.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api.py b/api.py index 2ac1ff9..c0fc29d 100644 --- a/api.py +++ b/api.py @@ -14,7 +14,7 @@ templates = Jinja2Templates(directory=".") @app.get(fba.config["base_url"] + "/info") def info(): - fba.cursor.execute("SELECT (SELECT COUNT(domain) FROM instances), (SELECT COUNT(domain) FROM instances WHERE software IN ('pleroma', 'mastodon', 'misskey', 'gotosocial', 'friendica', 'bookwyrm')), (SELECT COUNT(blocker) FROM blocks)") + fba.cursor.execute("SELECT (SELECT COUNT(domain) FROM instances), (SELECT COUNT(domain) FROM instances WHERE software IN ('pleroma', 'mastodon', 'misskey', 'gotosocial', 'friendica', 'bookwyrm', 'takahe')), (SELECT COUNT(blocker) FROM blocks)") known, indexed, blocks = fba.cursor.fetchone() return { diff --git a/fetch_blocks.py b/fetch_blocks.py index 0f75e15..a0a3020 100644 --- a/fetch_blocks.py +++ b/fetch_blocks.py @@ -6,7 +6,7 @@ import re import fba fba.cursor.execute( - "SELECT domain, software FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial', 'bookwyrm') AND (last_blocked IS NULL OR last_blocked < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_block"]] + "SELECT domain, software FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial', 'bookwyrm', 'takahe') AND (last_blocked IS NULL OR last_blocked < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_block"]] ) for blocker, software in fba.cursor.fetchall(): @@ -271,7 +271,7 @@ for blocker, software in fba.cursor.fetchall(): fba.connection.commit() except Exception as e: print("error:", e, blocker, software) - elif software == "friendica" or software == "misskey" or software == "bookwyrm": + elif software == "friendica" or software == "misskey" or software == "bookwyrm" or software == "takahe": print("INFO: blocker:", blocker) try: if software == "friendica": @@ -280,6 +280,8 @@ for blocker, software in fba.cursor.fetchall(): json = fba.get_misskey_blocks(blocker) elif software == "bookwyrm": json = fba.get_bookwyrm_blocks(blocker) + elif software == "takahe": + json = fba.get_takahe_blocks(blocker) for block_level, blocks in json.items(): # NOISY-DEBUG: print("DEBUG: blocker,block_level,blocks():", blocker, block_level, len(blocks)) diff --git a/fetch_instances.py b/fetch_instances.py index 7ebebc6..0fb8a45 100644 --- a/fetch_instances.py +++ b/fetch_instances.py @@ -55,7 +55,7 @@ fetch_instances(instance, None) # Loop through some instances fba.cursor.execute( - "SELECT domain FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial', 'bookwyrm') AND (last_nodeinfo IS NULL OR last_nodeinfo < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_instance"]] + "SELECT domain FROM instances WHERE software IN ('pleroma', 'mastodon', 'friendica', 'misskey', 'gotosocial', 'bookwyrm', 'takahe') AND (last_nodeinfo IS NULL OR last_nodeinfo < ?) ORDER BY rowid DESC", [time.time() - fba.config["recheck_instance"]] ) for instance in fba.cursor.fetchall(): -- 2.39.5