Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.
TypeScript
feat(supply-depot): scheme-aware service links (https:port) for TLS-serving apps
Chris Sherwood3501144caa70
diff --git a/admin/app/controllers/system_controller.ts b/admin/app/controllers/system_controller.tsindex f3642910..1fc5a0de 100644--- a/admin/app/controllers/system_controller.ts+++ b/admin/app/controllers/system_controller.ts@@ -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_nameservice.container_image = payload.imageservice.container_config = JSON.stringify(containerConfig)- service.ui_location = uiLocation+ service.ui_location = prevScheme && uiLocation && /^\d+$/.test(uiLocation)+ ? `${prevScheme}:${uiLocation}`+ : uiLocationservice.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.diff --git a/admin/app/services/docker_service.ts b/admin/app/services/docker_service.tsindex 19b27e0d..71e208e0 100644--- a/admin/app/services/docker_service.ts+++ b/admin/app/services/docker_service.ts@@ -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 numberif (service.ui_location && parseInt(service.ui_location, 10)) {return `http://${hostname}:${service.ui_location}`diff --git a/admin/inertia/lib/navigation.ts b/admin/inertia/lib/navigation.tsindex 49040ef9..b88255e7 100644--- a/admin/inertia/lib/navigation.ts+++ b/admin/inertia/lib/navigation.ts@@ -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 URLtry {const url = new URL(ui_location);