mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
change headers to reduce network usage
This commit is contained in:
parent
6bdc23bad7
commit
ebea77c37d
5 changed files with 7 additions and 7 deletions
|
@ -1069,7 +1069,7 @@ def comment_ap(comment_id):
|
||||||
}
|
}
|
||||||
resp = jsonify(reply_data)
|
resp = jsonify(reply_data)
|
||||||
resp.content_type = 'application/activity+json'
|
resp.content_type = 'application/activity+json'
|
||||||
resp.headers.set('Vary', 'Accept, Accept-Encoding, Cookie')
|
resp.headers.set('Vary', 'Accept')
|
||||||
return resp
|
return resp
|
||||||
else:
|
else:
|
||||||
reply = PostReply.query.get_or_404(comment_id)
|
reply = PostReply.query.get_or_404(comment_id)
|
||||||
|
@ -1090,7 +1090,7 @@ def post_ap(post_id):
|
||||||
post_data['@context'] = default_context()
|
post_data['@context'] = default_context()
|
||||||
resp = jsonify(post_data)
|
resp = jsonify(post_data)
|
||||||
resp.content_type = 'application/activity+json'
|
resp.content_type = 'application/activity+json'
|
||||||
resp.headers.set('Vary', 'Accept, Accept-Encoding, Cookie')
|
resp.headers.set('Vary', 'Accept')
|
||||||
return resp
|
return resp
|
||||||
else:
|
else:
|
||||||
return show_post(post_id)
|
return show_post(post_id)
|
||||||
|
|
|
@ -182,7 +182,7 @@ def show_post(post_id: int):
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
||||||
)
|
)
|
||||||
response.headers.set('Vary', 'Accept, Accept-Encoding, Cookie')
|
response.headers.set('Vary', 'Accept, Cookie')
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ def continue_discussion(post_id, comment_id):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()), community=post.community,
|
joined_communities=joined_communities(current_user.get_id()), community=post.community,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)])
|
inoculation=inoculation[randint(0, len(inoculation) - 1)])
|
||||||
response.headers.set('Vary', 'Accept, Accept-Encoding, Cookie')
|
response.headers.set('Vary', 'Accept, Cookie')
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ def return_304(etag, content_type=None):
|
||||||
resp = make_response('', 304)
|
resp = make_response('', 304)
|
||||||
resp.headers.add_header('ETag', request.headers['If-None-Match'])
|
resp.headers.add_header('ETag', request.headers['If-None-Match'])
|
||||||
resp.headers.add_header('Cache-Control', 'no-cache, max-age=600, must-revalidate')
|
resp.headers.add_header('Cache-Control', 'no-cache, max-age=600, must-revalidate')
|
||||||
resp.headers.add_header('Vary', 'Accept, Accept-Encoding, Cookie')
|
resp.headers.add_header('Vary', 'Accept, Cookie')
|
||||||
if content_type:
|
if content_type:
|
||||||
resp.headers.set('Content-Type', content_type)
|
resp.headers.set('Content-Type', content_type)
|
||||||
return resp
|
return resp
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Config(object):
|
||||||
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY")
|
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY")
|
||||||
MODE = os.environ.get('MODE') or 'development'
|
MODE = os.environ.get('MODE') or 'development'
|
||||||
LANGUAGES = ['en']
|
LANGUAGES = ['en']
|
||||||
FULL_AP_CONTEXT = os.environ.get('FULL_AP_CONTEXT') or True
|
FULL_AP_CONTEXT = os.environ.get('FULL_AP_CONTEXT') is not None
|
||||||
CACHE_TYPE = os.environ.get('CACHE_TYPE') or 'FileSystemCache'
|
CACHE_TYPE = os.environ.get('CACHE_TYPE') or 'FileSystemCache'
|
||||||
CACHE_REDIS_URL = os.environ.get('CACHE_REDIS_URL') or 'redis://localhost:6379/1'
|
CACHE_REDIS_URL = os.environ.get('CACHE_REDIS_URL') or 'redis://localhost:6379/1'
|
||||||
CACHE_DIR = os.environ.get('CACHE_DIR') or '/dev/shm/pyfedi'
|
CACHE_DIR = os.environ.get('CACHE_DIR') or '/dev/shm/pyfedi'
|
||||||
|
|
|
@ -12,7 +12,7 @@ MAIL_ERRORS=False
|
||||||
RECAPTCHA3_PUBLIC_KEY=''
|
RECAPTCHA3_PUBLIC_KEY=''
|
||||||
RECAPTCHA3_PRIVATE_KEY=''
|
RECAPTCHA3_PRIVATE_KEY=''
|
||||||
MODE='development'
|
MODE='development'
|
||||||
FULL_AP_CONTEXT=True
|
|
||||||
CACHE_TYPE='FileSystemCache'
|
CACHE_TYPE='FileSystemCache'
|
||||||
CACHE_DIR='/dev/shm/pyfedi'
|
CACHE_DIR='/dev/shm/pyfedi'
|
||||||
CELERY_BROKER_URL='redis://localhost:6379/1'
|
CELERY_BROKER_URL='redis://localhost:6379/1'
|
||||||
|
|
Loading…
Reference in a new issue