feat(FN-1535): fix theme-data.css URL resolution for file:// contexts

- Fix CSS URL resolution in memory when loading with file:// protocol
- Add DASHBOARD_URL re-export from renderer module for backward compatibility
- Update main.test.ts to use correct renderer mock reference (rendererMocks vs mocks)
- Document the URL resolution bug fix in memory
This commit is contained in:
gsxdsm
2026-04-10 08:37:28 -07:00
parent 05bd2f6623
commit 2ee6d246d4
5 changed files with 169 additions and 43 deletions

View File

@@ -32,13 +32,9 @@
var base = document.baseURI || (document.location && document.location.href) || '';
if (base.indexOf('file://') === 0) {
// For file:// URLs, derive path relative to the HTML file directory
var pathMatch = base.match(/^file:\/\/[^\/]*(\/.*?)?\/[^\/]*$/);
if (pathMatch && pathMatch[1]) {
var dirPath = pathMatch[1];
themeDataUrl = base.substring(0, 7) + dirPath + 'theme-data.css';
} else {
themeDataUrl = base.replace(/\/[^\/]+$/, '/theme-data.css');
}
// Replace the filename at the end of the path with theme-data.css
// This produces correct paths like: file:///path/to/app/theme-data.css
themeDataUrl = base.replace(/\/[^\/]+$/, '/theme-data.css');
} else {
// For HTTP/HTTPS URLs, use URL resolution
themeDataUrl = new URL('/theme-data.css', base).href;