feat: add desktop UI password setting
Adds optional desktop UI password protection Starts Electron with the saved UI password Explains login session duration in settings
This commit is contained in:
@@ -749,6 +749,7 @@ const spawnLocalServer = async () => {
|
||||
// warning and persists the flag via /api/config/settings.
|
||||
const lanAccessEnabled = settings.desktopLanAccessEnabled === true;
|
||||
const bindHost = lanAccessEnabled ? '0.0.0.0' : '127.0.0.1';
|
||||
const desktopUiPassword = typeof settings.desktopUiPassword === 'string' ? settings.desktopUiPassword.trim() : '';
|
||||
|
||||
// Probe before starting the server — main() in the server module sets up a
|
||||
// lot of global state before binding, and calling it twice after a listen
|
||||
@@ -773,6 +774,11 @@ const spawnLocalServer = async () => {
|
||||
process.env.OPENCHAMBER_DIST_DIR = resolveWebDistDir();
|
||||
process.env.OPENCHAMBER_RUNTIME = 'desktop';
|
||||
process.env.OPENCHAMBER_DESKTOP_NOTIFY = 'true';
|
||||
if (desktopUiPassword) {
|
||||
process.env.OPENCHAMBER_UI_PASSWORD = desktopUiPassword;
|
||||
} else {
|
||||
delete process.env.OPENCHAMBER_UI_PASSWORD;
|
||||
}
|
||||
process.env.OPENCHAMBER_SKIP_API_COMPRESSION = process.env.OPENCHAMBER_SKIP_API_COMPRESSION || 'true';
|
||||
process.env.NO_PROXY = process.env.NO_PROXY || 'localhost,127.0.0.1';
|
||||
process.env.no_proxy = process.env.no_proxy || 'localhost,127.0.0.1';
|
||||
@@ -782,6 +788,7 @@ const spawnLocalServer = async () => {
|
||||
const handle = await startWebUiServer({
|
||||
port: chosenPort,
|
||||
host: bindHost,
|
||||
uiPassword: desktopUiPassword || null,
|
||||
attachSignals: false,
|
||||
exitOnShutdown: false,
|
||||
onDesktopNotification: (payload) => maybeShowNativeNotification(payload),
|
||||
|
||||
Reference in New Issue
Block a user