umer-wasim commited on
Commit
9c7dfa9
·
verified ·
1 Parent(s): 47857ed

Arx 0.5.2: quit on close, single instance

Browse files
Files changed (3) hide show
  1. app/main.cjs +15 -2
  2. app/package.json +1 -1
  3. index.html +2 -2
app/main.cjs CHANGED
@@ -92,7 +92,7 @@ function smokeTest() {
92
 
93
  function createWindow() {
94
  mainWindow = new BrowserWindow({
95
- width: 1100, height: 780, minWidth: 760, minHeight: 560, title: 'Arx · Devseis Endpoint Auditor',
96
  webPreferences: { preload: path.join(__dirname, 'preload.cjs'), contextIsolation: true, nodeIntegration: false, sandbox: true },
97
  });
98
  // DEVSEIS_SMOKE_MODEL=1 also loads the AI model (downloads it on first run).
@@ -100,13 +100,26 @@ function createWindow() {
100
  if (SMOKE) smokeTest();
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
103
  app.whenReady().then(() => {
 
104
  createWindow();
105
  // Fetch newer vulnerability data in the background; the audit uses the last good copy if this fails.
106
  vulndb.refresh(vulndbDirs()[0]).catch(error => console.warn(`Vulnerability data not refreshed: ${error.message}`));
107
  app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) createWindow(); });
108
  });
109
- app.on('window-all-closed', () => { if (process.platform !== 'darwin') app.quit(); });
 
110
 
111
  // --- What will be audited -------------------------------------------------------
112
  ipcMain.handle('audit:plan', () => {
 
92
 
93
  function createWindow() {
94
  mainWindow = new BrowserWindow({
95
+ width: 1100, height: 780, minWidth: 760, minHeight: 560, title: 'Arx',
96
  webPreferences: { preload: path.join(__dirname, 'preload.cjs'), contextIsolation: true, nodeIntegration: false, sandbox: true },
97
  });
98
  // DEVSEIS_SMOKE_MODEL=1 also loads the AI model (downloads it on first run).
 
100
  if (SMOKE) smokeTest();
101
  }
102
 
103
+ // One Arx at a time: a second launch (a double-click while Arx is still starting or closing) hands over to the running
104
+ // copy, which shows its window, and exits; two copies could leave one stuck in the background with no window.
105
+ const firstInstance = !!SMOKE || app.requestSingleInstanceLock();
106
+ if (!firstInstance) app.quit();
107
+ app.on('second-instance', () => {
108
+ if (!mainWindow || mainWindow.isDestroyed()) { createWindow(); return; }
109
+ if (mainWindow.isMinimized()) mainWindow.restore();
110
+ mainWindow.show();
111
+ mainWindow.focus();
112
+ });
113
+
114
  app.whenReady().then(() => {
115
+ if (!firstInstance) return;
116
  createWindow();
117
  // Fetch newer vulnerability data in the background; the audit uses the last good copy if this fails.
118
  vulndb.refresh(vulndbDirs()[0]).catch(error => console.warn(`Vulnerability data not refreshed: ${error.message}`));
119
  app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) createWindow(); });
120
  });
121
+ // Closing the Arx window quits Arx, on macOS too: users expect a closed utility to be gone, not running unseen.
122
+ app.on('window-all-closed', () => app.quit());
123
 
124
  // --- What will be audited -------------------------------------------------------
125
  ipcMain.handle('audit:plan', () => {
app/package.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "name": "devseis-endpoint-auditor",
3
  "productName": "Arx",
4
- "version": "0.5.1",
5
  "description": "Read-only endpoint audit for ISO 27001, GDPR and the EU AI Act, with a local AI auditor.",
6
  "author": {
7
  "name": "Devseis",
 
1
  {
2
  "name": "devseis-endpoint-auditor",
3
  "productName": "Arx",
4
+ "version": "0.5.2",
5
  "description": "Read-only endpoint audit for ISO 27001, GDPR and the EU AI Act, with a local AI auditor.",
6
  "author": {
7
  "name": "Devseis",
index.html CHANGED
@@ -56,7 +56,7 @@
56
  <label class="btn btn-lg" for="reportFile" title="Open the …-evidence.json file Arx saves next to each report">Open a report</label>
57
  <input type="file" id="reportFile" accept=".json,application/json" hidden>
58
  </div>
59
- <p class="tiny muted" id="heroMeta">Free · open source · version 0.5.1</p>
60
  </section>
61
 
62
  <section class="wrap">
@@ -95,7 +95,7 @@
95
  </section>
96
 
97
  <section class="wrap section" id="download">
98
- <div class="section-head"><h2>Download Arx</h2><span class="tiny muted" id="dlVersion">Version 0.5.1</span></div>
99
  <div class="dl-grid">
100
  <article class="dl-card" data-os="mac">
101
  <span class="ribbon ribbon-you hidden">YOUR SYSTEM</span>
 
56
  <label class="btn btn-lg" for="reportFile" title="Open the …-evidence.json file Arx saves next to each report">Open a report</label>
57
  <input type="file" id="reportFile" accept=".json,application/json" hidden>
58
  </div>
59
+ <p class="tiny muted" id="heroMeta">Free · open source · version 0.5.2</p>
60
  </section>
61
 
62
  <section class="wrap">
 
95
  </section>
96
 
97
  <section class="wrap section" id="download">
98
+ <div class="section-head"><h2>Download Arx</h2><span class="tiny muted" id="dlVersion">Version 0.5.2</span></div>
99
  <div class="dl-grid">
100
  <article class="dl-card" data-os="mac">
101
  <span class="ribbon ribbon-you hidden">YOUR SYSTEM</span>