Compress some responses

Adds dependency `quart-compress`
このコミットが含まれているのは:
n9k 2022-03-10 13:58:17 +00:00
コミット 0352358611
2個のファイルの変更12行の追加0行の削除

ファイルの表示

@ -7,12 +7,15 @@ import toml
from collections import OrderedDict
from quart import Quart
from quart_compress import Compress
from werkzeug.security import generate_password_hash
from anonstream.utils.captcha import create_captcha_factory, create_captcha_signer
from anonstream.utils.colour import color_to_colour
from anonstream.utils.user import generate_token
compress = Compress()
def create_app(config_file):
with open(config_file) as fp:
config = toml.load(fp)
@ -112,4 +115,11 @@ def create_app(config_file):
import anonstream.routes
import anonstream.tasks
# Compress some responses
compress.init_app(app)
app.config.update({
"COMPRESS_MIN_SIZE": 2048,
"COMPRESS_LEVEL": 9,
})
return app

ファイルの表示

@ -1,6 +1,7 @@
aiofiles==0.8.0
asgiref==3.5.0
blinker==1.4
Brotli==1.0.9
git+https://github.com/lepture/captcha@27920681b86c27c990da484984f673dba1dd47e5#egg=captcha
click==8.0.4
h11==0.13.0
@ -16,6 +17,7 @@ MarkupSafe==2.1.0
Pillow==9.0.1
priority==2.0.0
quart==0.16.3
quart-compress==0.2.1
toml==0.10.2
uvicorn==0.17.5
Werkzeug==2.0.3