Skip to content

Commit

Permalink
refactor: electron updater
Browse files Browse the repository at this point in the history
removendo pois não tem utilidade
  • Loading branch information
GustavoOly committed Jan 24, 2025
1 parent 37498ba commit 817e404
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Clone the repository into your desired directory.
Run the following commands to install dependencies and start the development environment:

```bash
npm install && npm run dev
deno install && deno run dev
```

---
Expand Down
2 changes: 1 addition & 1 deletion electron.vite.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve } from 'path'
import { resolve } from 'node:path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'

Expand Down
35 changes: 15 additions & 20 deletions src/main/window.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { BrowserWindow, shell } from 'electron';
import { join } from 'path';
import { autoUpdater } from 'electron-updater';
import { is } from '@electron-toolkit/utils';
import icon from '../../resources/logo-ipameri-min.png?asset';
import { BrowserWindow, shell } from 'electron'
import { join } from 'path'
import { is } from '@electron-toolkit/utils'
import icon from '../../resources/logo-ipameri-min.png?asset'

const WINDOW_OPTIONS = {
width: 1200,
Expand All @@ -17,32 +16,28 @@ const WINDOW_OPTIONS = {
sandbox: false,
contextIsolation: true,
enableRemoteModule: false,
nodeIntegration: false,
nodeIntegration: false
}
};
}

export function createWindow() {
const mainWindow = new BrowserWindow({
...WINDOW_OPTIONS,
...(process.platform === 'linux' || process.platform === "win32" ? { icon } : {}),
});
...(process.platform === 'linux' || process.platform === 'win32' ? { icon } : {})
})

mainWindow.on('ready-to-show', () => {
mainWindow.show();
});
mainWindow.show()
})

mainWindow.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url);
return { action: 'deny' };
});
shell.openExternal(details.url)
return { action: 'deny' }
})

if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']);
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
} else {
mainWindow.loadFile(join(__dirname, '../renderer/index.html'));
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
}

autoUpdater.on('update-downloaded', () => {
autoUpdater.quitAndInstall();
});
}

0 comments on commit 817e404

Please sign in to comment.