fix(webview): resolve a relative base against the document directory

rebaseRelativeBase resolved a relative <base> against the proxy root, so
a document served from a subdirectory of its dashboard (for example
/webview/<cap>/app/page.html with <base href="./">) pointed at
/webview/<cap>/ and loaded its assets one level too high. Pass the
request's wildcard path into rewriteHtml and resolve the base against
the document URL, which keeps the proxy root for the landing page.
This commit is contained in:
ArizeSky committed 2026-11-16 16:11:58 +08:00
1 parent 238853f96a
commit cc413afdd1
6 files changed
+66 -9

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@
"aicodeman": patch
---
Web tabs whose dashboard ships a relative `<base href>` render again. The proxy rewrites the document URL to strip its `/webview/<cap>/` prefix, and a relative base is resolved against that URL — so `./` (what Vite builds emit, DeepSeek Harness among them) pointed at Codeman's root: every module script 404'd and the page painted its background with nothing on it. The rewrite now resolves such a base against the proxy prefix before the mask runs; a cross-origin base is left exactly as the author wrote it.
Web tabs whose dashboard ships a relative `<base href>` render again. The proxy rewrites the document URL to strip its `/webview/<cap>/` prefix, and a relative base is resolved against that URL — so `./` (what Vite builds emit, DeepSeek Harness among them) pointed at Codeman's root: every module script 404'd and the page painted its background with nothing on it. The rewrite now resolves such a base against the document's own directory inside the proxy prefix before the mask runs (a page at `/webview/<cap>/app/page.html` gets `/webview/<cap>/app/`, not the proxy root); a cross-origin base is left exactly as the author wrote it.