fix(electron): fix production build crashes

This commit is contained in:
plebeius
2026-01-30 13:12:02 +08:00
parent 16012b4239
commit 388a120c8e
2 changed files with 10 additions and 3 deletions
+8 -1
View File
@@ -18,7 +18,14 @@
</script>
<script>
// Redirect non-hash URLs to hash URLs on initial load
if (window.location.pathname && window.location.pathname !== '/' && window.location.pathname !== '/index.html' && !window.location.hash) {
// Skip redirect for file:// protocol (Electron) or if pathname ends with index.html
if (
window.location.protocol !== 'file:' &&
window.location.pathname &&
window.location.pathname !== '/' &&
!window.location.pathname.endsWith('/index.html') &&
!window.location.hash
) {
window.location.replace('/#' + window.location.pathname + window.location.search);
}
</script>