From b121c13d4e14e6a98fb8f8e22060b700e77a5823 Mon Sep 17 00:00:00 2001 From: freamon Date: Sun, 17 Mar 2024 07:28:03 +0000 Subject: [PATCH 1/2] post_layout: always show or always hide (for low-bandwidth) --- app/community/routes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/community/routes.py b/app/community/routes.py index f7f61d94..2284912c 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -121,7 +121,13 @@ def show_community(community: Community): page = request.args.get('page', 1, type=int) sort = request.args.get('sort', '' if current_user.is_anonymous else current_user.default_sort) low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1' - post_layout = request.args.get('layout', community.default_layout if not low_bandwidth else None) + if low_bandwidth: + post_layout = None + else: + if community.default_layout is not None: + post_layout = request.args.get('layout', community.default_layout) + else: + post_layout = request.args.get('layout', 'list') # If nothing has changed since their last visit, return HTTP 304 current_etag = f"{community.id}{sort}{post_layout}_{hash(community.last_active)}" From 057d6e113d37006bae59e73cd22743ba01c9f09b Mon Sep 17 00:00:00 2001 From: freamon Date: Sun, 17 Mar 2024 19:32:35 +0000 Subject: [PATCH 2/2] Newly-discovered instances bugfix --- app/activitypub/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index 4f38ca7c..8ba6bb77 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -874,7 +874,7 @@ def refresh_instance_profile(instance_id: int): @celery.task def refresh_instance_profile_task(instance_id: int): instance = Instance.query.get(instance_id) - if instance.updated_at < utcnow() - timedelta(days=7): + if instance.inbox is None or instance.updated_at < utcnow() - timedelta(days=7): try: instance_data = get_request(f"https://{instance.domain}", headers={'Accept': 'application/activity+json'}) except: