fix(macos): serve index.html for root path

Swifter's shareFilesFromDirectory doesn't serve index.html for /,
need explicit handler for root path.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Quinn Ftw 2025-12-30 15:24:40 -08:00
parent 06c50c6fe6
commit 8972f44a15

View file

@ -31,7 +31,17 @@ class LocalWebServer {
.appendingPathComponent("Resources/webapp")
.path {
NSLog("LocalWebServer: Serving static files from \(webappPath)")
server["/"] = shareFilesFromDirectory(webappPath)
// Serve index.html for root path
let indexPath = webappPath + "/index.html"
server["/"] = { _ in
if let data = FileManager.default.contents(atPath: indexPath) {
return .ok(.data(data, contentType: "text/html"))
}
return .notFound
}
// Serve other static files
server["/:path"] = shareFilesFromDirectory(webappPath)
} else {
NSLog("LocalWebServer: Warning - webapp directory not found in bundle")