|
1 | 1 | import React, { useState, useEffect, useMemo } from "react"; |
| 2 | +import { isElectron } from "../lib/session"; |
2 | 3 |
|
3 | 4 | function getInitialHost() { |
4 | 5 | return ( |
@@ -31,7 +32,7 @@ function buildCategories(BASE) { |
31 | 32 | { label:"Launcher", url:"http://localhost:5190", icon:"🔬", desc:"Jupyter · RStudio · VS Code" }, |
32 | 33 | { label:"Workflows", url:"/_svc/workflows", icon:"⚡", desc:"WDL/NF/Snake/CWL" }, |
33 | 34 | { label:"Dev Hub", url:"/_svc/devhub", icon:"🛠️", desc:"Knowledge graph · RAG search" }, |
34 | | - { label:"Metrics", url:"http://localhost/_svc/monitor", icon:"📊", desc:"Grafana dashboard" }, |
| 35 | + { label:"Metrics", url:"/_svc/monitor", icon:"📊", desc:"Grafana dashboard" }, |
35 | 36 | { label:"Grafana", url:"http://localhost:3000", icon:"📈", desc:"Metrics dashboards" }, |
36 | 37 | ] |
37 | 38 | }, |
@@ -133,9 +134,15 @@ export default function Workbench() { |
133 | 134 | return () => clearInterval(id); |
134 | 135 | }, [BASE]); |
135 | 136 |
|
| 137 | + // Electron's <webview> needs a fully-qualified src (it isn't part of the |
| 138 | + // host page's browsing context, so relative URLs won't resolve). In a |
| 139 | + // browser tab — web/beta mode — relative /_svc/* URLs must stay relative: |
| 140 | + // nginx-router already proxies them on the same origin, and prefixing |
| 141 | + // them with http://localhost causes mixed-content blocks on HTTPS and |
| 142 | + // resolves to the visitor's own machine instead of the server. |
136 | 143 | const open = (url, label) => { |
137 | 144 | let absolute; |
138 | | - if (url.startsWith('/')) { |
| 145 | + if (url.startsWith('/') && isElectron()) { |
139 | 146 | const devHost = url.startsWith('/_svc/') && import.meta.env.DEV |
140 | 147 | ? 'http://localhost:5174' |
141 | 148 | : 'http://localhost'; |
|
0 commit comments