-
-
Notifications
You must be signed in to change notification settings - Fork 163
Open
Description
I have been going insane over this for 2 hours. I have tried to do just about everything but for some reason I cannot get COMET_URL and MEDIAFUSION_URL to be stored
types.ts
export interface UserConfig {
TMDB_API_KEY: string;
SUPABASE_URL: string;
SUPABASE_ANON_KEY: string;
COMET_URL: string;
MEDIAFUSION_URL: string;
}
import Store from "electron-store";
export const store = new Store({
schema: {
TMDB_API_KEY: { type: "string", default: "" },
SUPABASE_URL: { type: "string", default: "" },
SUPABASE_ANON_KEY: { type: "string", default: "" },
COMET_URL: { type: "string", default: "" },
MEDIAFUSION_URL: { type: "string", default: "" },
},
});
cache.ts
import { app, BrowserWindow, ipcMain } from "electron";
import path from "path";
import { isDev } from "./util.js";
import { dirname } from "path/win32";
import { fileURLToPath } from "url";
import { store } from "./cache.js";
import { UserConfig } from "../shared/types.js";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
ipcMain.handle("save-config", (_event, config: UserConfig) => {
store.set("TMDB_API_KEY", config.TMDB_API_KEY);
store.set("SUPABASE_URL", config.SUPABASE_URL);
store.set("SUPABASE_ANON_KEY", config.SUPABASE_ANON_KEY);
store.set("COMET_URL", config.COMET_URL);
store.set("MEDIAFUSION_URL", config.MEDIAFUSION_URL);
return { success: true };
});
ipcMain.handle("get-config", () => {
return {
TMDB_API_KEY: store.get("TMDB_API_KEY"),
SUPABASE_URL: store.get("SUPABASE_URL"),
SUPABASE_ANON_KEY: store.get("SUPABASE_ANON_KEY"),
COMET_URL: store.get("COMET_URL"),
MEDIAFUSION_URL: store.get("MEDIAFUSION_URL"),
};
});
app.on("ready", () => {
const mainWindow = new BrowserWindow({
titleBarStyle: "hidden",
fullscreen: true,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
contextIsolation: true,
nodeIntegration: false,
sandbox: false,
},
});
if (isDev()) {
mainWindow.loadURL("http://localhost:5123");
} else {
mainWindow.loadFile(path.join(app.getAppPath() + "/dist-react/index.html"));
}
});
my main.ts for electron
I can get the previous values to be saved but it does not store the 2 new values. I have tried deleting the file and tried everything but nop
Metadata
Metadata
Assignees
Labels
No labels