Store request.is_localhost like Etiquette.

This commit is contained in:
voussoir 2021-02-25 19:45:11 -08:00
parent 6db7fe9a24
commit 65fdae97da
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -45,7 +45,8 @@ site.localhost_only = False
@site.before_request
def before_request():
ip = request.remote_addr
if site.localhost_only and ip != '127.0.0.1':
request.is_localhost = ip == '127.0.0.1'
if site.localhost_only and not request.is_localhost:
flask.abort(403)
gzip_minimum_size = 500