1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
diff --git a/main.js b/main.js
index 4f3546f..1194078 100644
--- a/main.js
+++ b/main.js
@@ -1,7 +1,6 @@
-const {app, BrowserWindow, Menu, ipcMain} = require('electron')
+const {app, BrowserWindow, Menu, ipcMain, nativeImage} = require('electron')
const path = require('path')
const url = require('url')
-const { autoUpdater } = require('electron-updater');
const fs = require('fs');
const {getColorHexRGB} = require('electron-color-picker')
require('@electron/remote/main').initialize()
@@ -41,7 +40,7 @@ function createWindow(second_instance) {
return;
}
let win = new BrowserWindow({
- icon:'icon.ico',
+ icon: nativeImage.createFromPath(path.join(__dirname, 'icon.ico')),
show: false,
backgroundColor: '#21252b',
frame: LaunchSettings.get('native_window_frame') === true,
@@ -204,43 +203,6 @@ app.on('ready', () => {
createWindow()
- ipcMain.on('app-loaded', () => {
-
- if (process.execPath && process.execPath.match(/electron\.\w+$/)) {
-
- console.log('[Blockbench] App launched in development mode')
-
- } else {
-
- autoUpdater.autoInstallOnAppQuit = true;
- autoUpdater.autoDownload = false;
- if (LaunchSettings.get('update_to_prereleases') === true) {
- autoUpdater.allowPrerelease = true;
- autoUpdater.channel = 'beta';
- }
-
- autoUpdater.on('update-available', (a) => {
- console.log('update-available', a)
- ipcMain.on('allow-auto-update', () => {
- autoUpdater.downloadUpdate()
- })
- orig_win.webContents.send('update-available');
- })
- autoUpdater.on('update-downloaded', (a) => {
- console.log('update-downloaded', a)
- orig_win.webContents.send('update-downloaded', a)
- })
- autoUpdater.on('error', (a) => {
- console.log('update-error', a)
- orig_win.webContents.send('update-error', a)
- })
- autoUpdater.on('download-progress', (a) => {
- console.log('update-progress', a)
- orig_win.webContents.send('update-progress', a)
- })
- autoUpdater.checkForUpdates().catch(err => {})
- }
- })
})
app.on('window-all-closed', () => {
|