Store request.is_localhost like Etiquette.

master
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
1 changed files with 2 additions and 1 deletions

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