fix(apps): stabilize saleor and netbird launch
This commit is contained in:
@@ -17,6 +17,15 @@ const NEW_TAB_PORTS = new Set([
|
||||
])
|
||||
|
||||
const NEW_TAB_APP_IDS = new Set([
|
||||
'btcpay-server',
|
||||
'grafana',
|
||||
'photoprism',
|
||||
'homeassistant',
|
||||
'vaultwarden',
|
||||
'nextcloud',
|
||||
'portainer',
|
||||
'onlyoffice',
|
||||
'tailscale',
|
||||
'nginx-proxy-manager',
|
||||
'uptime-kuma',
|
||||
'gitea',
|
||||
@@ -93,6 +102,7 @@ const PORT_TO_APP_ID: Record<string, string> = {
|
||||
'8334': 'bitcoin-knots',
|
||||
'8888': 'searxng',
|
||||
'9000': 'portainer',
|
||||
'9010': 'saleor',
|
||||
'8087': 'netbird',
|
||||
'8086': 'netbird',
|
||||
'9980': 'onlyoffice',
|
||||
@@ -109,6 +119,27 @@ const PORT_TO_APP_ID: Record<string, string> = {
|
||||
'3010': 'thunderhub',
|
||||
}
|
||||
|
||||
const APP_ID_TO_PORT: Record<string, string> = {
|
||||
'btcpay-server': '23000',
|
||||
grafana: '3000',
|
||||
photoprism: '2342',
|
||||
homeassistant: '8123',
|
||||
vaultwarden: '8082',
|
||||
nextcloud: '8085',
|
||||
portainer: '9000',
|
||||
onlyoffice: '8044',
|
||||
tailscale: '8240',
|
||||
'nginx-proxy-manager': '8081',
|
||||
'uptime-kuma': '3002',
|
||||
gitea: '3001',
|
||||
}
|
||||
|
||||
function directAppUrl(appId: string): string | null {
|
||||
const port = APP_ID_TO_PORT[appId]
|
||||
if (!port || typeof window === 'undefined') return null
|
||||
return `http://${window.location.hostname}:${port}`
|
||||
}
|
||||
|
||||
|
||||
const APPROVED_ORIGINS_KEY = 'neode_nostr_approved_origins'
|
||||
|
||||
@@ -161,6 +192,12 @@ export const useAppLauncherStore = defineStore('appLauncher', () => {
|
||||
}
|
||||
|
||||
function openSession(appId: string) {
|
||||
const launchUrl = NEW_TAB_APP_IDS.has(appId) ? directAppUrl(appId) : null
|
||||
if (launchUrl) {
|
||||
window.open(launchUrl, '_blank', 'noopener,noreferrer')
|
||||
return
|
||||
}
|
||||
|
||||
const mode = localStorage.getItem(DISPLAY_MODE_KEY) || 'panel'
|
||||
if (mode === 'panel' && !isMobileViewport()) {
|
||||
panelAppId.value = appId
|
||||
|
||||
Reference in New Issue
Block a user