diff --git a/startos/interfaces.ts b/startos/interfaces.ts index 168de16..9bbf28a 100644 --- a/startos/interfaces.ts +++ b/startos/interfaces.ts @@ -1,12 +1,35 @@ import { i18n } from './i18n' import { sdk } from './sdk' import { uiPort } from './utils' +import { store } from './file-models/store.json' export const setInterfaces = sdk.setupInterfaces(async ({ effects }) => { const uiMulti = sdk.MultiHost.of(effects, 'ui-multi') + const storeData = await store.read().const(effects) + const adminPassword = storeData?.adminPassword + const uiMultiOrigin = await uiMulti.bindPort(uiPort, { protocol: 'http', + addSsl: { + preferredExternalPort: 443, + addXForwardedHeaders: true, + alpn: null, + auth: adminPassword + ? { + type: 'basic', + credentials: [ + { + username: 'admin', + password: adminPassword, + }, + ], + realm: 'Munin Bitcoin', + } + : null, + }, + preferredExternalPort: uiPort, + secure: null, }) const ui = sdk.createInterface(effects, {