share too_many to all requests (flask "g") handled by public security module

This commit is contained in:
Kevin 2020-06-30 17:17:22 -05:00
parent 08d2dee18a
commit c46e9590c6
1 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,7 @@ class PublicAPISecurity:
"""Validate request has the correct hostname"""
# If high security level, deny requests to public
# (HS should be disabled anyway for Tor, but might not be for I2P)
g.is_onionr_client = False
transports = gettransports.get()
if public_api.config.get('general.security_level', default=1) > 0:
@ -48,6 +49,11 @@ class PublicAPISecurity:
g.is_onionr_client = False
except KeyError:
g.is_onionr_client = False
# Add shared objects
try:
g.too_many = public_api._too_many
except KeyError:
g.too_many = None
@public_api_security_bp.after_app_request
def send_headers(resp):