Skip to content

Commit

Permalink
accept YNAB API certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
baruchiro committed Jan 11, 2024
1 parent ad81d65 commit 2637fce
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ async function createWindow() {
width: 1152,
webPreferences: {
contextIsolation: false,
nodeIntegration: (process.env.ELECTRON_NODE_INTEGRATION as unknown) as
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION as unknown as
| boolean
| undefined
| undefined,
},
});
await loadUIIntoWindow();
Expand Down Expand Up @@ -67,7 +67,9 @@ async function loadUIIntoWindow() {

if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
const uiDevUrl = useReactUI ? 'http://localhost:3000' : process.env.WEBPACK_DEV_SERVER_URL;
const uiDevUrl = useReactUI
? 'http://localhost:3000'
: process.env.WEBPACK_DEV_SERVER_URL;
loadURL(uiDevUrl);
if (!process.env.IS_TEST) mainWindow.webContents.openDevTools();
} else {
Expand All @@ -85,6 +87,13 @@ async function loadUIIntoWindow() {
registerHandlers();
}

app.on('certificate-error', (event, _, url, __, cert, callback) => {
if (url.startsWith('https://api.youneedabudget.com/v1')) {
event.preventDefault();
callback(true);
} else callback(false);
});

// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
Expand Down

0 comments on commit 2637fce

Please sign in to comment.