32 lines
946 B
Python
32 lines
946 B
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Plugin-Adapter für den „Wandler“.
|
|
|
|
Bewusst schlank: Dieses Werkzeug rechnet vollständig im Browser. Es gibt keinen
|
|
Job-Runner, keine Sicherungen und keine KI — es verändert nichts und braucht
|
|
keinen Serverlauf. Das Backend liefert nur die Seite aus.
|
|
|
|
Vorteil: sofort da, funktioniert auch offline und wenn Tandoor gerade streikt.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.responses import FileResponse
|
|
|
|
|
|
def create_app(ctx):
|
|
app = FastAPI(title=ctx.meta.name, docs_url="/api/docs", redoc_url=None)
|
|
|
|
@app.get("/", include_in_schema=False)
|
|
def index():
|
|
return FileResponse(ctx.path("static", "index.html"))
|
|
|
|
@app.get("/api/state")
|
|
def state() -> dict[str, Any]:
|
|
# Nur damit die Oberfläche eine Lebenszeichen-Abfrage hat.
|
|
return {"ok": True, "version": ctx.meta.version, "offline": True}
|
|
|
|
return app
|