mirror of https://gitlab.com/litecord/litecord.git
run: add dummy ratelimiting handler
This commit is contained in:
parent
69fbd9c117
commit
b17cfd46eb
|
|
@ -0,0 +1,5 @@
|
||||||
|
from quart import current_app as app, request
|
||||||
|
|
||||||
|
async def ratelimit_handler():
|
||||||
|
# dummy handler for future code
|
||||||
|
print(request.headers)
|
||||||
7
run.py
7
run.py
|
|
@ -15,6 +15,8 @@ from litecord.blueprints import (
|
||||||
voice, invites, relationships, dms
|
voice, invites, relationships, dms
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from litecord.ratelimits.main import ratelimit_handler
|
||||||
|
|
||||||
# those blueprints are separated from the "main" ones
|
# those blueprints are separated from the "main" ones
|
||||||
# for code readability if people want to dig through
|
# for code readability if people want to dig through
|
||||||
# the codebase.
|
# the codebase.
|
||||||
|
|
@ -87,6 +89,11 @@ for bp, suffix in bps.items():
|
||||||
app.register_blueprint(bp, url_prefix=f'/api/v6{suffix}')
|
app.register_blueprint(bp, url_prefix=f'/api/v6{suffix}')
|
||||||
|
|
||||||
|
|
||||||
|
@app.before_request
|
||||||
|
async def app_before_request():
|
||||||
|
await ratelimit_handler()
|
||||||
|
|
||||||
|
|
||||||
@app.after_request
|
@app.after_request
|
||||||
async def app_after_request(resp):
|
async def app_after_request(resp):
|
||||||
origin = request.headers.get('Origin', '*')
|
origin = request.headers.get('Origin', '*')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue