fix: protocol-aware iframe vs new-tab behavior for all apps

Apps with absolute-path redirects (Jellyfin, Portainer, PhotoPrism,
OnlyOffice, Uptime Kuma, Fedimint) now correctly open in new tab on
HTTPS where subpath proxy breaks their redirects, but still use iframe
on HTTP where direct port access works fine.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 00:22:41 +00:00
parent c45de13752
commit b581fb4126
2 changed files with 25 additions and 6 deletions

View File

@@ -1,16 +1,35 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
/** Apps that set X-Frame-Options and/or don't support subpath proxy - open in new tab for correct display */
/** Apps that must open in new tab instead of iframe.
* - DENY apps: always new tab (X-Frame-Options: DENY)
* - Redirect apps: new tab on HTTPS (absolute redirects break subpath proxy in iframe)
* On HTTP, these load via direct port URL so iframe works fine.
*/
function mustOpenInNewTab(url: string): boolean {
try {
const u = new URL(url)
return (
u.port === '23000' || // BTCPay
u.port === '8123' || // Home Assistant
// Always new tab: X-Frame-Options DENY or subpath fundamentally breaks the app
if (
u.port === '23000' || // BTCPay (X-Frame-Options: DENY)
u.port === '8123' || // Home Assistant (subpath breaks routing)
u.port === '8085' || // Nextcloud (subpath breaks CSS/assets)
u.port === '2283' // Immich (subpath breaks SPA)
)
) {
return true
}
// On HTTPS, apps with absolute-path redirects break in iframe via proxy
if (window.location.protocol === 'https:') {
return (
u.port === '8096' || // Jellyfin (redirects to /web/index.html)
u.port === '9000' || // Portainer (redirects to /timeout.html)
u.port === '2342' || // PhotoPrism (redirects to /library/login)
u.port === '9980' || // OnlyOffice (redirects to /welcome/)
u.port === '3001' || // Uptime Kuma (redirects to /dashboard)
u.port === '8175' // Fedimint (redirects to /login)
)
}
return false
} catch {
return false
}