add protection that shares the data with my webside
This commit is contained in:
+11
-4
@@ -1,8 +1,7 @@
|
||||
from my_modules.functions import custom_limit_key
|
||||
from my_modules.app.constens import SECRET_KEY, UPLOAD_DIR
|
||||
from my_modules.functions import custom_limit_key, get_my_ip_address, get_local_ip_addresses, replace_last_ip_segment, generate_all_ips
|
||||
from my_modules.app.constens import SECRET_KEY, THE_IP_BOT_MANAGER
|
||||
from my_modules.AsyncCache import AsyncCache
|
||||
from my_modules.app.logger import logger
|
||||
|
||||
from my_modules.db.ConvexDB import ConvexDB
|
||||
|
||||
from quart_session import Session
|
||||
@@ -16,7 +15,6 @@ app = Quart(__name__, template_folder="../../templates/side", static_folder="../
|
||||
app.config['MAX_CONTENT_LENGTH'] = 1024 * 1024 * 1024
|
||||
|
||||
app.secret_key = SECRET_KEY
|
||||
app.upload_folder = UPLOAD_DIR
|
||||
|
||||
# Cache, Sessions and Limiter over Valkey
|
||||
if os.getenv("VALKEY_HOST", None) is not None:
|
||||
@@ -71,6 +69,15 @@ async def init_convex():
|
||||
app.convex = ConvexDB(os.getenv("CONVEX_URL"))
|
||||
await app.convex.connect()
|
||||
|
||||
THE_IP_BOT_MANAGER.add_always_allowed_ip('127.0.0.1')
|
||||
THE_IP_BOT_MANAGER.add_always_allowed_ip(await get_my_ip_address())
|
||||
|
||||
local_docker_host_ip = get_local_ip_addresses()
|
||||
if local_docker_host_ip:
|
||||
base_ip = replace_last_ip_segment(local_docker_host_ip, 1)
|
||||
all_local_ips = generate_all_ips(base_ip)
|
||||
THE_IP_BOT_MANAGER.update_always_allowed_ip(all_local_ips)
|
||||
|
||||
@app.after_serving
|
||||
async def close_convex():
|
||||
if app.convex:
|
||||
|
||||
Reference in New Issue
Block a user