share too_many to all requests (flask "g") handled by public security module
This commit is contained in:
parent
08d2dee18a
commit
c46e9590c6
@ -32,6 +32,7 @@ class PublicAPISecurity:
|
|||||||
"""Validate request has the correct hostname"""
|
"""Validate request has the correct hostname"""
|
||||||
# If high security level, deny requests to public
|
# If high security level, deny requests to public
|
||||||
# (HS should be disabled anyway for Tor, but might not be for I2P)
|
# (HS should be disabled anyway for Tor, but might not be for I2P)
|
||||||
|
|
||||||
g.is_onionr_client = False
|
g.is_onionr_client = False
|
||||||
transports = gettransports.get()
|
transports = gettransports.get()
|
||||||
if public_api.config.get('general.security_level', default=1) > 0:
|
if public_api.config.get('general.security_level', default=1) > 0:
|
||||||
@ -48,6 +49,11 @@ class PublicAPISecurity:
|
|||||||
g.is_onionr_client = False
|
g.is_onionr_client = False
|
||||||
except KeyError:
|
except KeyError:
|
||||||
g.is_onionr_client = False
|
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
|
@public_api_security_bp.after_app_request
|
||||||
def send_headers(resp):
|
def send_headers(resp):
|
||||||
|
Loading…
Reference in New Issue
Block a user