fix(chatgpt): use private JSON credential storage without Keychain

This commit is contained in:
amosblomqvist
2026-10-24 18:41:03 +03:00
parent 50a2db775d
commit 24d1dda07d
7 changed files with 215 additions and 64 deletions
+3 -3
View File
@@ -24,8 +24,8 @@
* would shadow every settings-page key change until restart.
*/
const { app, BrowserWindow, Menu, ipcMain, session, shell, dialog, safeStorage } = require("electron");
const { createChatGPT, encryptedStore } = require("./chatgpt.cjs");
const { app, BrowserWindow, Menu, ipcMain, session, shell, dialog } = require("electron");
const { createChatGPT, fileStore } = require("./chatgpt.cjs");
const { attachChatGPTChild, trustedSender, chatGPTControl } = require("./chatgpt-ipc.cjs");
const { desktopAPIHeaders } = require("./desktop-api.cjs");
const { randomBytes } = require("node:crypto");
@@ -589,7 +589,7 @@ async function main() {
callback({ requestHeaders: desktopAPIHeaders(details, ownedOrigin, desktopAPISecret, [...trustedAppWindows]) });
});
chatgpt = createChatGPT({
store: encryptedStore(path.join(app.getPath("userData"), "chatgpt-credentials.enc.json"), safeStorage),
store: fileStore(path.join(app.getPath("userData"), "chatgpt-credentials.json")),
openExternal: (target) => shell.openExternal(target),
onChange: (value) => {
chatgptChild?.send(value);