Skip to content

Commit 44c40ea

Browse files
committed
fix: persist Open Terminal API key across restarts
The API key is now saved in config.json and reused on subsequent startups instead of being regenerated every time, which was breaking existing integrations that relied on a stable key. Closes #102
1 parent d475bde commit 44c40ea

4 files changed

Lines changed: 19 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.0.9] - 2026-04-20
9+
10+
### Fixed
11+
12+
- **Open Terminal API Key Persistence.** The Open Terminal API key is now saved in config.json and reused across restarts instead of being regenerated on every startup, which was breaking existing integrations.
13+
814
## [0.0.8] - 2026-04-11
915

1016
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "open-webui",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"license": "AGPL-3.0",
55
"description": "Open WebUI Desktop",
66
"main": "./out/main/index.js",

src/main/utils/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ export interface AppConfig {
817817
enabled: boolean
818818
port: number
819819
cwd: string
820+
apiKey: string
820821
}
821822
llamaCpp: {
822823
enabled: boolean
@@ -850,7 +851,8 @@ const DEFAULT_CONFIG: AppConfig = {
850851
},
851852
openTerminal: {
852853
enabled: false,
853-
cwd: ''
854+
cwd: '',
855+
apiKey: ''
854856
},
855857
llamaCpp: {
856858
enabled: false,

src/main/utils/open-terminal.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as pty from 'node-pty'
66
import {
77
getPythonPath,
88
getConfig,
9+
setConfig,
910
installPackage,
1011
isPackageInstalled,
1112
isPythonInstalled,
@@ -63,8 +64,14 @@ export const startOpenTerminal = async (
6364
const config = await getConfig()
6465
const configEnvVars = config.envVars ?? {}
6566

66-
// Auto-generate API key
67-
const generatedKey = crypto.randomBytes(24).toString('base64url')
67+
// Use persisted API key or generate and save a new one
68+
let generatedKey = config.openTerminal?.apiKey
69+
if (!generatedKey) {
70+
generatedKey = crypto.randomBytes(24).toString('base64url')
71+
await setConfig({
72+
openTerminal: { ...config.openTerminal, apiKey: generatedKey }
73+
})
74+
}
6875

6976
// Find available port
7077
let desiredPort = port || 39284

0 commit comments

Comments
 (0)