mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Merge pull request 'Bugfixes' (#105) from freamon/pyfedi:17 into main
Reviewed-on: https://codeberg.org/rimu/pyfedi/pulls/105
This commit is contained in:
commit
1a83b4775a
2 changed files with 8 additions and 2 deletions
|
@ -874,7 +874,7 @@ def refresh_instance_profile(instance_id: int):
|
||||||
@celery.task
|
@celery.task
|
||||||
def refresh_instance_profile_task(instance_id: int):
|
def refresh_instance_profile_task(instance_id: int):
|
||||||
instance = Instance.query.get(instance_id)
|
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:
|
try:
|
||||||
instance_data = get_request(f"https://{instance.domain}", headers={'Accept': 'application/activity+json'})
|
instance_data = get_request(f"https://{instance.domain}", headers={'Accept': 'application/activity+json'})
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -121,7 +121,13 @@ def show_community(community: Community):
|
||||||
page = request.args.get('page', 1, type=int)
|
page = request.args.get('page', 1, type=int)
|
||||||
sort = request.args.get('sort', '' if current_user.is_anonymous else current_user.default_sort)
|
sort = request.args.get('sort', '' if current_user.is_anonymous else current_user.default_sort)
|
||||||
low_bandwidth = request.cookies.get('low_bandwidth', '0') == '1'
|
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
|
# If nothing has changed since their last visit, return HTTP 304
|
||||||
current_etag = f"{community.id}{sort}{post_layout}_{hash(community.last_active)}"
|
current_etag = f"{community.id}{sort}{post_layout}_{hash(community.last_active)}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue