From d1fe11abf51df251d073ede72ceff4d143ccb986 Mon Sep 17 00:00:00 2001 From: Shawn Grigson Date: Tue, 12 Sep 2023 02:34:56 -0500 Subject: [PATCH] readme updates also 401 status_code becomes skippable --- README.md | 8 ++++++++ etc/sample.fediblockhole.conf.toml | 5 +++-- src/fediblockhole/__init__.py | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bdd295c..6d02789 100644 --- a/README.md +++ b/README.md @@ -386,6 +386,14 @@ Skip the fetching of blocklists from any URLs that are configured. Skip the fetching of blocklists from any remote instances that are configured. +### override_private_comment + +Defaults to None. + +Stamp all *new* blocks pushed to a remote server with this comment or code. +Helps to identify blocks you've created on a server via this process versus ones that +already existed. + ### mergeplan If two (or more) blocklists define blocks for the same domain, but they're diff --git a/etc/sample.fediblockhole.conf.toml b/etc/sample.fediblockhole.conf.toml index a7a7b96..3844512 100644 --- a/etc/sample.fediblockhole.conf.toml +++ b/etc/sample.fediblockhole.conf.toml @@ -77,8 +77,9 @@ blocklist_instance_destinations = [ # merge_threshold_type = 'count' # merge_threshold = 0 -## set an override private comment -# override_private_comment = 'Updated by Fediblockhole' +## set an override private comment to be added when pushing a NEW block to an instance +# this does not require importing private comments +# override_private_comment = 'Added by Fediblock Sync' ## Set which fields we import ## 'domain' and 'severity' are always imported, these are additional diff --git a/src/fediblockhole/__init__.py b/src/fediblockhole/__init__.py index 97e6f51..995fd7e 100755 --- a/src/fediblockhole/__init__.py +++ b/src/fediblockhole/__init__.py @@ -402,6 +402,9 @@ def fetch_instance_blocklist(host: str, token: str=None, admin: bool=False, link = True while link: response = requests.get(url, headers=headers, timeout=REQUEST_TIMEOUT) + if response.status_code == 401: + log.error(f"Cannot fetch remote blocklist. Access token has been revoked for {host}, skipping....") + break if response.status_code != 200: log.error(f"Cannot fetch remote blocklist: {response.content}") raise ValueError("Unable to fetch domain block list: %s", response)