Allow self certificate accepts

This commit is contained in:
2025-12-23 11:27:58 +07:00
parent c8ae8757fc
commit 6680832486

13
main.js
View File

@@ -79,6 +79,19 @@ app.on('ready', async () => {
createWindow();
app.on('certificate-error', (event, webContents, url, error, cert, callback) => {
// Verify the URL to ensure you only allow your intended self-signed certificate
if (url.startsWith('https://your-self-signed-domain.com')) {
// Prevent the default behavior (which is to reject the cert)
event.preventDefault();
// Accept the certificate
callback(true);
} else {
// For all other URLs, let Chromium handle the error normally
callback(false);
}
});
// Quit app when all windows are closed, except on macOS (common pattern)
app.on('window-all-closed', () => {