La version 5 de Planète Casio. Regroupe le forum, les programmes, les tutoriel, les sprites et tous les autres outils développés par nos soins.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
873 B

from flask import send_file, redirect, url_for, abort
from werkzeug.utils import secure_filename
from app import app
from config import V5Config
import os
# These routes are used in development
# In production, those files should be served by the web server (nginx)
def avatar(filename):
filename = secure_filename(filename) # No h4ckers allowed
filepath = os.path.join(V5Config.DATA_FOLDER, "avatars", filename)
if os.path.isfile(filepath):
return send_file(filepath)
return redirect(url_for('static', filename='images/default_avatar.png'))
def attachment(path, name):
file = os.path.join(V5Config.DATA_FOLDER, "attachments",
secure_filename(path), secure_filename(name))
if os.path.isfile(file):
return send_file(file)