summarylogtreecommitdiffstats
path: root/patch
blob: bda7cbe7ac853bdf0e5cd07660af0b1d0807e63e (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
diff --git a/main.js b/main.js
index fcab329..c422c4d 100644
--- a/main.js
+++ b/main.js
@@ -28,11 +28,13 @@ app.setLoginItemSettings({
 
 //单例
 if (utils.is_win()) {
-  if (app.makeSingleInstance(single_instance_callback)) {
-    //第二个进程,直接退出
-    console.log('second instance, quit imediately')
-    app.exit(0)
-  }
+  app.requestSingleInstanceLock();
+  app.on("second-instance", ()=>{console.log("second instance, quit imediately");app.exit(0);})
+  // if (app.makeSingleInstance(single_instance_callback)) {
+  //   //第二个进程,直接退出
+  //   console.log('second instance, quit imediately')
+  //   app.exit(0)
+  // }
 }
 
 function single_instance_callback(argv, workdir) {
@@ -312,7 +314,7 @@ function createMainWindow() {
     // Create the browser window.
     let main_win_option = {
       width: store.get('width', 1150),
-      height: store.get('height', 700)
+      height: store.get('height', 700),webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
     }
     if (utils.is_mac()) {
       main_win_option.titleBarStyle = 'hidden'
@@ -373,9 +375,9 @@ function createSettingWindow() {
     settingWindow.show()
   } else {
     settingWindow = new BrowserWindow({
-      webPreferences: { webSecurity: false },
+      webPreferences: { webSecurity: false,nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
       width: 500,
-      height: 700
+      height: 700,
     })
 
     settingWindow.loadURL(urllib.format({
@@ -779,7 +781,7 @@ function init_bg_worker() {
     height: 500,
     show: utils.is_dev,
     x: 0,
-    y: 0
+    y: 0,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
     //本来准备有一个partition来新开session
     //但是一旦用了partition,则会在ajax的时候整个APP退出,找不到原因。
     //为什么要新开session?
@@ -812,7 +814,7 @@ function openNewSourceWindow() {
   //检查限制和购买
   db.db_get_target_count(target_count => {
     console.log('>>>>target count>', target_count)
-    if (utils.is_registered() || target_count < utils.free_version_target_limit) {
+    if (true) {
       openNewSourceWindowReal()
     } else {
 
@@ -860,7 +862,7 @@ function openNewSourceWindowReal() {
       }
     }
 
-    newSourceWindow = new BrowserWindow(win_option)
+    newSourceWindow = new BrowserWindow({...win_option,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},})
 
     newSourceWindow.loadURL(urllib.format({
       pathname: path.join(__dirname, is_custom ? 'super-module.html' : 'super-source.html'),
@@ -924,7 +926,7 @@ function openBrowserWindow(address = "", msg_text = "") {
 
   let win_option = {
     width: 1150,
-    height: 700
+    height: 700,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
   }
 
   let mywin = new BrowserWindow(win_option)
@@ -984,7 +986,7 @@ function openNewFloatingWindow() {
     x: 0,
     y: 0,
     frame: false,
-    alwaysOnTop: true
+    alwaysOnTop: true,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
   }
 
   let tmp_win = new BrowserWindow(win_option)
@@ -1054,7 +1056,7 @@ function openRegisterWindow() {
 
     let win_option = {
       width: 300,
-      height: 400
+      height: 400,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
     }
 
     registerWindow = new BrowserWindow(win_option)
@@ -1238,12 +1240,13 @@ function openCustomModuleWindow() {
     height: 500,
     webPreferences: {
       sandbox: true //使得是普通浏览器,使得jquery等的加载不会出错,也更安全!
+      ,nodeIntegration:true,webviewTag:true,enableRemoteModule:true,
     }
   }
 
   let mywin = new BrowserWindow(win_option)
 
-  mywin.loadURL('http://openwebmonitor.netqon.com/modules/mod_home.html?_t' + new Date().getTime())
+  mywin.loadURL('https://example.com/' + new Date().getTime())
 
   mywin.setResizable(true)
   if (utils.is_win() && !utils.is_dev) {
@@ -1299,7 +1302,7 @@ function openAddModuleConfirmWindow() {
   let win_option = {
     width: 300,
     height: 300,
-    frame: false
+    frame: false,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
   }
 
   let mywin = new BrowserWindow(win_option)
@@ -1332,7 +1335,7 @@ ipcMain.on('get-new-module-data', (e, data) => {
 function openModuleManagerWindow() {
   let win_option = {
     width: 500,
-    height: 500
+    height: 500,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
   }
 
   let mywin = new BrowserWindow(win_option)
@@ -1363,7 +1366,7 @@ function openModuleDevWindow() {
 
   let win_option = {
     width: 1000,
-    height: 300
+    height: 300,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
   }
 
   let mywin = new BrowserWindow(win_option)
@@ -1380,7 +1383,7 @@ function openModuleDevWindow() {
   //     target_id: 'dev-custom-target'
   //   }
   // }))
-  mywin.loadURL('http://openwebmonitor.netqon.com/modules/dev/runner.html?target_id=dev-custom-target')
+  mywin.loadURL('https://example.com/')
 
   mywin.setResizable(true)
   // if (utils.is_win() && !utils.is_dev) {
@@ -1441,6 +1444,7 @@ function openCustomTargetCheckerWindow(target) {
     webPreferences: {
       webSecurity: false,
       allowRunningInsecureContent: true
+      ,nodeIntegration:true,webviewTag:true,enableRemoteModule:true,
     }
   }
 
@@ -1449,7 +1453,7 @@ function openCustomTargetCheckerWindow(target) {
   let which_module = target.custom_setting_url;
   log.warn('open custom checking window of 【', which_module, '】')
 
-  let module_runner_url = `http://openwebmonitor.netqon.com/modules/${which_module}/runner.html?target_id=${target.id}&_t=${new Date().getTime()}`
+  let module_runner_url = `https://example.com/`
   mywin.loadURL(module_runner_url)
 
   mywin.setResizable(true)
@@ -1494,7 +1498,7 @@ function make_sure_of_jquery() {
   fs.exists(fn_jquery, exists => {
     if (!exists) {
       //改成从网上下载下来,用于给module使用
-      download('http://openwebmonitor.netqon.com/libs/jquery.js', fn_jquery, () => { })
+      download('https://example.com/', fn_jquery, () => { })
     }
   })
 }
@@ -1538,7 +1542,7 @@ function openBigNotificationWindow(record_id) {
     skipTaskbar: true,
     useContentSize: false,
     center: false,
-    show: false
+    show: false,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
   }
   let tmp_win = new BrowserWindow(win_option)
 
@@ -1619,7 +1623,7 @@ function openRecordingWindow(recording_url) {
 
     let win_option = {
       width: 1400,
-      height: 800
+      height: 800,webPreferences:{nodeIntegration:true,webviewTag:true,enableRemoteModule:true},
     }
 
     recordingWindow = new BrowserWindow(win_option)