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:
parent
06c50c6fe6
commit
8972f44a15
1 changed files with 11 additions and 1 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue