This commit is contained in:
Nyako
2026-06-06 12:50:35 +03:00
parent 34f144d240
commit d1bc3fe836
2 changed files with 114 additions and 13 deletions
+2 -11
View File
@@ -34,15 +34,6 @@ log.init_global_exception_hook()
database = db.DB(True)
app = Flask(__name__)
def find_file(filename, file_folders):
for folder in file_folders:
folder_path = Path(folder)
if not folder_path.exists():
continue
for file_path in folder_path.rglob(filename):
return folder_path
return None
if not image_processor.check_ffmpeg(): print("WARNING!\n\nУ вас не установлен ffmpeg. Генерация превью для видео не доступна!")
@app.route("/")
@@ -63,7 +54,7 @@ def post(post_id):
@app.route('/file/<path:filename>')
def serve_image(filename):
folder_path = find_file(filename, FILE_FOLDERS)
folder_path = task.find_file(filename, FILE_FOLDERS)
if folder_path == None:
return make_response("Not found", 404)
else:
@@ -102,7 +93,7 @@ def api():
return jsonify(result_post)
elif data["type"] == "task":
if data["task"] == "analytic":
if tasks.calculate_analytic():
if tasks.calculate_analytic(database, CONFIG_ROOT):
return "", 200
else:
return "", 500