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
This commit is contained in:
Timothy Jaeryang Baek
2026-04-20 15:57:42 +09:00
parent d475bde04a
commit 44c40eabd6
4 changed files with 19 additions and 4 deletions
+6
View File
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.0.9] - 2026-04-20
### Fixed
- **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.
## [0.0.8] - 2026-04-11
### Added
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "open-webui",
"version": "0.0.8",
"version": "0.0.9",
"license": "AGPL-3.0",
"description": "Open WebUI Desktop",
"main": "./out/main/index.js",
+3 -1
View File
@@ -817,6 +817,7 @@ export interface AppConfig {
enabled: boolean
port: number
cwd: string
apiKey: string
}
llamaCpp: {
enabled: boolean
@@ -850,7 +851,8 @@ const DEFAULT_CONFIG: AppConfig = {
},
openTerminal: {
enabled: false,
cwd: ''
cwd: '',
apiKey: ''
},
llamaCpp: {
enabled: false,
+9 -2
View File
@@ -6,6 +6,7 @@ import * as pty from 'node-pty'
import {
getPythonPath,
getConfig,
setConfig,
installPackage,
isPackageInstalled,
isPythonInstalled,
@@ -63,8 +64,14 @@ export const startOpenTerminal = async (
const config = await getConfig()
const configEnvVars = config.envVars ?? {}
// Auto-generate API key
const generatedKey = crypto.randomBytes(24).toString('base64url')
// Use persisted API key or generate and save a new one
let generatedKey = config.openTerminal?.apiKey
if (!generatedKey) {
generatedKey = crypto.randomBytes(24).toString('base64url')
await setConfig({
openTerminal: { ...config.openTerminal, apiKey: generatedKey }
})
}
// Find available port
let desiredPort = port || 39284