From 584b30f752efc2f2f07a6516fa7c07cd040b8bde Mon Sep 17 00:00:00 2001 From: KI-Sparringpartner Date: Mon, 3 Aug 2026 16:17:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=AF=20FINAL=20FIX:=20Projekt-Ansicht?= =?UTF-8?q?=20f=C3=BCr=20/projects/{name}=20+=20absolute=20URLs=20im=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 00bdead..5e5b9bc 100644 --- a/app/main.py +++ b/app/main.py @@ -30,4 +30,37 @@ TEMPLATES_DIR = Path(__file__).parent / "templates" @app.get("/", response_class=HTMLResponse) async def dashboard(request: Request): with open(TEMPLATES_DIR / "index.html") as f: - return f.read() \ No newline at end of file + return f.read() + + +@app.get("/projects/{project_name}") # ✅ Fuer direkten Zugriff auf Projekte! +def project_view(project_name: str, request: Request): + """Gibt ein einfaches Verzeichnis-Display zurueck.""" + from fastapi.responses import HTMLResponse + + target_dir = PROJECTS_DIR / project_name + + if not target_dir.exists(): + return {"error": "Projekt nicht gefunden", "available_projects": [p.name for p in PROJECTS_DIR.iterdir() if p.is_dir()]} + + # Einfache HTML-Ansicht: + html = f""" +{project_name} + + +

📁 {project_name}

+

Dateien:

+ +""" + + if (target_dir / '.git').exists(): + html += '

✅ Git Repository

' + + for item in sorted(target_dir.iterdir()): + icon = "📁" if item.is_dir() else "📄" + link = f"/projects/{item.name}" if item.is_dir() else "#" + html += f'
{icon} {item.name}
' + + return HTMLResponse(html) \ No newline at end of file