Skip to content

Commit

Permalink
Add logic to prevent multiple instances
Browse files Browse the repository at this point in the history
  • Loading branch information
asyncButNeverAwaits authored and sunner committed Mar 30, 2024
1 parent af987c1 commit bbf04b0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ const isDevelopment = process.env.NODE_ENV !== "production";
const DEFAULT_USER_AGENT = ""; // Empty string to use the Electron default
let mainWindow = null;

// start - makes application a Single Instance Application
const singleInstanceLock = app.requestSingleInstanceLock();
if (!singleInstanceLock) {
app.quit();
} else {
app.on("second-instance", () => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});
}
// end - makes application a Single Instance Application

// Disable QUIC
// Prevent Cloudflare from detecting the real IP when using a proxy that bypasses UDP traffic
app.commandLine.appendSwitch("disable-quic");
Expand Down

0 comments on commit bbf04b0

Please sign in to comment.