fix: serve dashboard independently of process cwd (#46)
CI / lint (pull_request) Successful in 10s
CI / build-frontend (pull_request) Successful in 5s

This commit is contained in:
timmy committed 2026-08-05 22:17:33 +00:00
1 parent 94cdd0f407
commit f0dc260c9b
2 files changed
+16 -1

No files matched your search

+4 -1
View File
@@ -1,9 +1,12 @@
from pathlib import Path
from fastapi import APIRouter
from fastapi.responses import HTMLResponse
router = APIRouter()
DASHBOARD_FILE = Path(__file__).resolve().parent.parent / "frontend" / "index.html"
@router.get("/", response_class=HTMLResponse)
async def dashboard() -> str:
return open("frontend/index.html").read()
return DASHBOARD_FILE.read_text()
+12
View File
@@ -0,0 +1,12 @@
import pytest
from src.views import dashboard
@pytest.mark.anyio
async def test_dashboard_renders_outside_repository_working_directory(monkeypatch, tmp_path):
monkeypatch.chdir(tmp_path)
html = await dashboard()
assert "Stackchain Dashboard" in html