forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-09-14 15:53:01 +02:00
parent 8ca033a6ac
commit 5805c0ba0f
1 changed files with 7 additions and 8 deletions

View File

@ -8,6 +8,7 @@ from flask_limiter import Limiter
from flask_compress import Compress
from flask_limiter.util import get_ipaddr
from flaskext.markdown import Markdown
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session, Query as _Query
from sqlalchemy import *
from sqlalchemy.pool import QueuePool
@ -65,10 +66,8 @@ app.config["RATELIMIT_DEFAULTS_EXEMPT_WHEN"]=lambda:False
app.config["RATELIMIT_HEADERS_ENABLED"]=True
redispool=ConnectionPool(max_connections=app.config["REDIS_POOL_SIZE"], host=app.config["CACHE_REDIS_URL"][8:])
app.config["CACHE_OPTIONS"]={'connection_pool':redispool}
Markdown(app)
cache = Cache(app)
Compress(app)
@ -115,9 +114,10 @@ class RetryingQuery(_Query):
def first(self):
return super().first()
db_session=scoped_session(sessionmaker(bind=_engine, query_cls=RetryingQuery))
Base = declarative_base()
#set the shared redis cache for misc stuff
@ -129,10 +129,6 @@ r=redis.Redis(
) if app.config["CACHE_REDIS_URL"] else None
# import and bind all routing functions
from files.routes import *
# enforce https
@app.before_request
def before_request():
@ -186,4 +182,7 @@ def after_request(response):
response.headers.add("Feature-Policy", "geolocation 'none'; midi 'none'; notifications 'none'; push 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; vibrate 'none'; fullscreen 'none'; payment 'none';")
response.headers.add("X-Frame-Options", "deny")
return response
return response
# import and bind all routing functions
from files.routes import *