Document picker code and architecture
This commit is contained in:
@@ -5,27 +5,32 @@ from flask import Flask, render_template, send_from_directory
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
# Конфигурация демо содержит только разрешённые расширения для browser picker.
|
||||
with (ROOT / "config.json").open(encoding="utf-8") as config_file:
|
||||
CONFIG = json.load(config_file)
|
||||
|
||||
|
||||
VERSION = "0.1.9"
|
||||
|
||||
# Flask нужен здесь только как статический сервер HTML, CSS и ES-модулей.
|
||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
"""Возвращает demo-страницу и передаёт в неё версию и JSON-конфигурацию."""
|
||||
return render_template("index.html", version=VERSION, config=CONFIG)
|
||||
|
||||
|
||||
@app.route("/health")
|
||||
def health():
|
||||
"""Возвращает 200 для liveness-проверки платформы."""
|
||||
return "ok", 200
|
||||
|
||||
|
||||
@app.get("/upload-frontend/<path:filename>")
|
||||
def upload_frontend(filename):
|
||||
"""Отдаёт один frontend-файл из изолированного каталога upload/frontend."""
|
||||
return send_from_directory(ROOT / "upload" / "frontend", filename)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user