feat(supply-depot): scheme-aware service links (https:port) for TLS-serving apps
This commit is contained in:
parent
7b1b480c5e
commit
3501144caa
|
|
@ -499,6 +499,9 @@ export default class SystemController {
|
|||
// Merge the form fields into the app's existing config rather than rebuilding from scratch,
|
||||
// so advanced settings a curated app ships with (GPU device requests, special env, etc.) are
|
||||
// preserved across an edit.
|
||||
// Preserve an explicit scheme (e.g. ui_location "https:8480") across an edit — otherwise a
|
||||
// TLS-serving app's Open link would silently revert to http after any reconfigure.
|
||||
const prevScheme = (service.ui_location || '').match(/^(https?):\d+$/)?.[1]
|
||||
const { containerConfig, uiLocation } = this.mergeCustomContainerConfig(
|
||||
service.container_config,
|
||||
payload
|
||||
|
|
@ -506,7 +509,9 @@ export default class SystemController {
|
|||
service.friendly_name = payload.friendly_name
|
||||
service.container_image = payload.image
|
||||
service.container_config = JSON.stringify(containerConfig)
|
||||
service.ui_location = uiLocation
|
||||
service.ui_location = prevScheme && uiLocation && /^\d+$/.test(uiLocation)
|
||||
? `${prevScheme}:${uiLocation}`
|
||||
: uiLocation
|
||||
service.category = payload.category ?? service.category ?? 'custom'
|
||||
if (payload.icon) service.icon = payload.icon
|
||||
// Flag as user-modified so the seeder stops overwriting this app's config on future runs.
|
||||
|
|
|
|||
|
|
@ -198,6 +198,12 @@ export class DockerService {
|
|||
|
||||
const hostname = process.env.NODE_ENV === 'production' ? serviceName : 'localhost'
|
||||
|
||||
// "https:8480" / "http:8480" — explicit scheme + port (e.g. an app serving its own TLS).
|
||||
const schemePort = service.ui_location?.match(/^(https?):(\d+)$/)
|
||||
if (schemePort) {
|
||||
return `${schemePort[1]}://${hostname}:${schemePort[2]}`
|
||||
}
|
||||
|
||||
// First, check if ui_location is set and is a valid port number
|
||||
if (service.ui_location && parseInt(service.ui_location, 10)) {
|
||||
return `http://${hostname}:${service.ui_location}`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
|
||||
|
||||
export function getServiceLink(ui_location: string): string {
|
||||
// "https:8480" / "http:8480" — an explicit scheme + port served on the current host. Checked
|
||||
// before the URL parse below because new URL("https:8480") would mis-parse 8480 as the host.
|
||||
const schemePort = ui_location.match(/^(https?):(\d+)$/);
|
||||
if (schemePort) {
|
||||
return `${schemePort[1]}://${window.location.hostname}:${schemePort[2]}`;
|
||||
}
|
||||
|
||||
// Check if the ui location is a valid URL
|
||||
try {
|
||||
const url = new URL(ui_location);
|
||||
|
|
|
|||
Loading…
Reference in New Issue