Files
simple-nanoshare/routes/handeling/basics.py
T
daniel156161 fefda61c0b
Build and Push Docker Container / build-and-push (push) Successful in 1m21s
use new convex db base class and remove code that is already into the base class
2025-12-22 11:43:05 +01:00

25 lines
813 B
Python

from my_modules.app.setup import LIMITER
from quart import Blueprint, send_from_directory, render_template, current_app, Response, redirect
basic_bp = Blueprint('basic', __name__)
@basic_bp.route('/favicon', methods=['GET'])
@basic_bp.route('/favicon.ico', methods=['GET'])
@LIMITER.exempt
async def favicon():
file_data = await current_app.convex.get_current_favicon()
return redirect(file_data['file_id'])
@basic_bp.route('/robots.txt', methods=['GET'])
@LIMITER.limit('3 per day')
async def robots():
return await send_from_directory(current_app.static_folder, f'robots.txt')
@basic_bp.route("/storage/<path:file_id>")
async def convex_storage_proxy(file_id:str):
return Response(
current_app.convex.stream_from_storage(file_id, add_api_path=True),
mimetype="application/octet-stream"
)