fix: Browser mode 404 error for meeting-detail page

- Preserve query parameters (e.g., ?id=123) when opening in browser
- Add packaged mode detection for CLIENT_DIR path resolution
- Include client files in extraResources for backend to serve
- Add debug logging for client directory detection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-22 17:50:14 +08:00
parent 7d3fc72bd2
commit 771655e03e
3 changed files with 45 additions and 2 deletions

View File

@@ -11,10 +11,23 @@ from .routers import auth, meetings, ai, export, sidecar
from .sidecar_manager import get_sidecar_manager
# Determine client directory path
# In development: backend/../client/src
# In packaged mode: backend/backend/_internal/../../client (relative to backend executable)
BACKEND_DIR = Path(__file__).parent.parent
PROJECT_DIR = BACKEND_DIR.parent
CLIENT_DIR = PROJECT_DIR / "client" / "src"
# Check for packaged mode (PyInstaller sets _MEIPASS)
import sys
if getattr(sys, 'frozen', False):
# Packaged mode: look for client folder relative to executable
# Backend runs from resources/backend/, client files at resources/backend/client/
EXEC_DIR = Path(sys.executable).parent.parent # up from backend/backend.exe
CLIENT_DIR = EXEC_DIR / "client"
print(f"[Backend] Packaged mode: CLIENT_DIR={CLIENT_DIR}")
else:
print(f"[Backend] Development mode: CLIENT_DIR={CLIENT_DIR}")
@asynccontextmanager
async def lifespan(app: FastAPI):
@@ -77,6 +90,7 @@ async def health_check():
# ========================================
# Check if client directory exists for browser mode
print(f"[Backend] CLIENT_DIR exists: {CLIENT_DIR.exists()}")
if CLIENT_DIR.exists():
# Serve static assets (CSS, JS, etc.)
app.mount("/styles", StaticFiles(directory=CLIENT_DIR / "styles"), name="styles")