Skip to content

Commit 466ee82

Browse files
committed
v3.1.1
1 parent deb839b commit 466ee82

File tree

9 files changed

+63
-182
lines changed

9 files changed

+63
-182
lines changed

app/package.json renamed to app/package.json.npm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
"name": "CoNET Technology Inc.",
1212
"email": "[email protected]"
1313
},
14-
"main": "./core/main",
14+
"main": "./main",
1515
"bugs": {
1616
"url": "https://github.com/QTGate/CoNET/issues"
1717
},
1818
"homepage": "https://www.CoNETTech.ca",
1919
"dependencies": {
20-
"async": "^3.1.0",
20+
"async": "^3.1.0",
2121
"cookie-parser": "^1.4.4",
2222
"express": "^4.17.1",
2323
"jimp": "^0.8.5",

app/public/scripts/home.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ var view_layout;
248248
self.showKeyPair(false);
249249
initPopupArea();
250250
let uu = null;
251+
self.keyPairCalss = new encryptoClass(self.keyPair());
251252
self.imapSetup(uu = new imapForm(config.account, null, function (imapData) {
252253
self.imapSetup(uu = null);
253254
return self.imapSetupClassExit(imapData, sessionHash);

app/public/scripts/home.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ module view_layout {
275275

276276
self.showKeyPair ( false )
277277
initPopupArea ()
278-
let uu = null
278+
let uu = null
279+
self.keyPairCalss = new encryptoClass ( self.keyPair () )
279280
self.imapSetup ( uu = new imapForm ( config.account, null, function ( imapData: IinputData ) {
280281
self.imapSetup ( uu = null )
281282
return self.imapSetupClassExit ( imapData, sessionHash )
@@ -307,7 +308,7 @@ module view_layout {
307308
return self.initConfig ( config )
308309
})
309310

310-
this.connectInformationMessage.socketIo.on ('init', ( err, config: install_config) => {
311+
this.connectInformationMessage.socketIo.on ('init', ( err, config: install_config ) => {
311312
if ( err ) {
312313
return
313314
}

app/public/scripts/keyPairGenerateForm.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ class keyPairGenerateForm {
154154
})
155155
*/
156156
}
157+
157158
public form_AdministratorEmail_submit () {
158159
const self = this
159160
this.checkEmailAddress ( this.SystemAdministratorEmailAddress ())

app/tools/imap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ class ImapServerSwitchStream extends Stream.Transform {
621621
}
622622
this.push(this.cmd + '\r\n');
623623
this.appendWaitResponsrTimeOut = timers_1.setTimeout(() => {
624-
return this.emit('error', new Error('appendStreamV3 mail serrver write timeout!'));
624+
return this.doCommandCallback(new Error('appendStreamV3 mail serrver write timeout!'));
625625
}, _time);
626626
//console.log (`************************************* append time = [${ time }] `)
627627
if (this.imapServer.literalPlus) {
@@ -1085,7 +1085,7 @@ exports.imapAccountTest = (IMapConnect, CallBack) => {
10851085
}
10861086
saveLog(`imapAccountTest doing timeout`);
10871087
doCallBack(new Error('timeout'), null);
1088-
}, pingPongTimeOut);
1088+
}, pingFailureTime);
10891089
exports.seneMessageToFolder(IMapConnect, listenFolder, ramdomText.toString('base64'), null, err => {
10901090
if (err) {
10911091
saveLog(`imapAccountTest seneMessageToFolder Error! ${err.message}`);

app/tools/imap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ class ImapServerSwitchStream extends Stream.Transform {
766766

767767
this.appendWaitResponsrTimeOut = setTimeout (() => {
768768

769-
return this.emit ( 'error', new Error ('appendStreamV3 mail serrver write timeout!') )
769+
return this.doCommandCallback( new Error ('appendStreamV3 mail serrver write timeout!'))
770770

771771
}, _time )
772772

@@ -1342,7 +1342,7 @@ export const imapAccountTest = ( IMapConnect: imapConnect, CallBack ) => {
13421342
}
13431343
saveLog (`imapAccountTest doing timeout`)
13441344
doCallBack ( new Error ( 'timeout' ), null )
1345-
}, pingPongTimeOut )
1345+
}, pingFailureTime )
13461346

13471347
seneMessageToFolder ( IMapConnect, listenFolder, ramdomText.toString ('base64'), null, err => {
13481348
if ( err ) {

index.js

Lines changed: 15 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -20,74 +20,10 @@ const port = 3000;
2020
const path_1 = require("path");
2121
const url_1 = require("url");
2222
const { app, BrowserWindow, Tray, Menu, dialog, autoUpdater, desktopCapturer, shell } = require('electron');
23-
const handleSquirrelEvent = () => {
24-
if (process.argv.length === 1 || process.platform !== 'win32') {
25-
return false;
26-
}
27-
const ChildProcess = require('child_process');
28-
const path = require('path');
29-
const appFolder = path.resolve(process.execPath, '..');
30-
const rootAtomFolder = path.resolve(appFolder, '..');
31-
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
32-
const exeName = path.basename(process.execPath);
33-
const spawn = function (command, args) {
34-
let spawnedProcess, error;
35-
try {
36-
spawnedProcess = ChildProcess.spawn(command, args, { detached: true });
37-
}
38-
catch (error) { }
39-
return spawnedProcess;
40-
};
41-
const spawnUpdate = function (args) {
42-
return spawn(updateDotExe, args);
43-
};
44-
const squirrelEvent = process.argv[1];
45-
switch (squirrelEvent) {
46-
case '--squirrel-install':
47-
case '--squirrel-updated':
48-
// Optionally do things such as:
49-
// - Add your .exe to the PATH
50-
// - Write to the registry for things like file associations and
51-
// explorer context menus
52-
// Install desktop and start menu shortcuts
53-
spawnUpdate(['--createShortcut', exeName]);
54-
setTimeout(app.quit, 1000);
55-
return true;
56-
case '--squirrel-uninstall':
57-
// Undo anything you did in the --squirrel-install and
58-
// --squirrel-updated handlers
59-
// Remove desktop and start menu shortcuts
60-
spawnUpdate(['--removeShortcut', exeName]);
61-
setTimeout(app.quit, 1000);
62-
return true;
63-
case '--squirrel-obsolete':
64-
// This is called on the outgoing version of your app before
65-
// we update to the new version - it's the opposite of
66-
// --squirrel-updated
67-
app.quit();
68-
return true;
69-
}
70-
};
71-
if (handleSquirrelEvent()) {
72-
// squirrel event handled and app will exit in 1000ms, so don't do anything else
73-
}
74-
const makeSingleInstance = () => {
75-
// For Mac App Store build
76-
if (process.platform === 'darwin') {
77-
return false;
78-
}
79-
return app.makeSingleInstance(() => {
80-
createWindow();
81-
});
82-
};
83-
if (makeSingleInstance()) {
84-
app.quit();
85-
}
8623
// squirrel event handled and app will exit in 1000ms, so don't do anything else
8724
const version = app.getVersion();
8825
let localServer1 = null;
8926
let tray = null;
90-
let mainWindow = null;
9127
let doReady = false;
9228
const _doUpdate = (tag_name, _port) => {
9329
let url = null;
@@ -197,7 +133,12 @@ const appReady = () => {
197133
//const menu = Menu.buildFromTemplate( template )
198134
//Menu.setApplicationMenu ( menu)
199135
if (!localServer1) {
200-
localServer1 = new BrowserWindow({ show: DEBUG });
136+
localServer1 = new BrowserWindow({
137+
show: DEBUG,
138+
webPreferences: {
139+
nodeIntegration: true
140+
}
141+
});
201142
localServer1._doUpdate = _doUpdate;
202143
DEBUG ? localServer1.webContents.openDevTools() : null;
203144
//localServer1.maximize ()
@@ -207,7 +148,7 @@ const appReady = () => {
207148
slashes: true
208149
}));
209150
setTimeout(() => {
210-
shell.openExternal(`http://127.0.0.1:${port}`);
151+
createWindow();
211152
}, 2000);
212153
/*
213154
setTimeout (() => {
@@ -235,23 +176,21 @@ const appReady = () => {
235176
}
236177
};
237178
const initialize = () => {
179+
const gotTheLock = app.requestSingleInstanceLock();
180+
if (!gotTheLock) {
181+
return app.quit();
182+
}
183+
app.on('second-instance', (event, commandLine, workingDirectory) => {
184+
createWindow();
185+
});
238186
app.once('ready', () => {
239187
if (doReady) {
240188
return;
241189
}
242190
doReady = true;
243191
return appReady();
244192
});
245-
app.once('will-finish-launching', () => {
246-
/*
247-
if ( doReady )
248-
return
249-
doReady = true
250-
251-
return appReady ()
252-
*/
253-
});
254-
app.on('window-all-closed', () => {
193+
app.once('window-all-closed', () => {
255194
app.quit();
256195
});
257196
};

index.ts

Lines changed: 21 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -22,95 +22,12 @@ import { format } from 'url'
2222

2323
const { app, BrowserWindow, Tray, Menu, dialog, autoUpdater, desktopCapturer, shell } = require ( 'electron' )
2424

25-
const handleSquirrelEvent = () => {
26-
if ( process.argv.length === 1 || process.platform !== 'win32') {
27-
return false;
28-
}
29-
30-
const ChildProcess = require('child_process');
31-
const path = require('path');
32-
33-
const appFolder = path.resolve(process.execPath, '..');
34-
const rootAtomFolder = path.resolve(appFolder, '..');
35-
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
36-
const exeName = path.basename(process.execPath);
37-
38-
const spawn = function(command, args) {
39-
let spawnedProcess, error;
40-
41-
try {
42-
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
43-
} catch (error) {}
44-
45-
return spawnedProcess;
46-
}
47-
48-
const spawnUpdate = function(args) {
49-
return spawn(updateDotExe, args);
50-
}
51-
52-
const squirrelEvent = process.argv[1];
53-
switch (squirrelEvent) {
54-
case '--squirrel-install':
55-
case '--squirrel-updated':
56-
// Optionally do things such as:
57-
// - Add your .exe to the PATH
58-
// - Write to the registry for things like file associations and
59-
// explorer context menus
60-
61-
// Install desktop and start menu shortcuts
62-
spawnUpdate(['--createShortcut', exeName]);
63-
64-
setTimeout(app.quit, 1000);
65-
return true;
66-
67-
case '--squirrel-uninstall':
68-
// Undo anything you did in the --squirrel-install and
69-
// --squirrel-updated handlers
70-
71-
// Remove desktop and start menu shortcuts
72-
spawnUpdate(['--removeShortcut', exeName]);
73-
74-
setTimeout(app.quit, 1000);
75-
return true;
76-
77-
case '--squirrel-obsolete':
78-
// This is called on the outgoing version of your app before
79-
// we update to the new version - it's the opposite of
80-
// --squirrel-updated
81-
82-
app.quit()
83-
return true
84-
}
85-
}
86-
87-
if ( handleSquirrelEvent()) {
88-
// squirrel event handled and app will exit in 1000ms, so don't do anything else
89-
}
90-
91-
const makeSingleInstance = () => {
92-
93-
// For Mac App Store build
94-
if ( process.platform ==='darwin' ) {
95-
return false
96-
}
97-
98-
return app.makeSingleInstance (() => {
99-
createWindow ()
100-
})
101-
}
102-
103-
if ( makeSingleInstance ()) {
104-
app.quit ()
105-
}
106-
10725
// squirrel event handled and app will exit in 1000ms, so don't do anything else
10826
const version = app.getVersion()
10927

11028
let localServer1 = null
11129

11230
let tray = null
113-
let mainWindow = null
11431
let doReady = false
11532

11633
const _doUpdate = ( tag_name: string, _port ) => {
@@ -238,7 +155,13 @@ const appReady = () => {
238155
//Menu.setApplicationMenu ( menu)
239156
if ( ! localServer1 ) {
240157

241-
localServer1 = new BrowserWindow ({ show: DEBUG })
158+
localServer1 = new BrowserWindow (
159+
{
160+
show: DEBUG,
161+
webPreferences: {
162+
nodeIntegration: true
163+
}
164+
})
242165

243166
localServer1._doUpdate = _doUpdate
244167
DEBUG ? localServer1.webContents.openDevTools() : null
@@ -250,7 +173,7 @@ const appReady = () => {
250173
}))
251174

252175
setTimeout (() => {
253-
shell.openExternal (`http://127.0.0.1:${ port }`)
176+
createWindow ()
254177
}, 2000 )
255178

256179
/*
@@ -287,6 +210,17 @@ const appReady = () => {
287210
}
288211

289212
const initialize = () => {
213+
const gotTheLock = app.requestSingleInstanceLock()
214+
215+
if (!gotTheLock) {
216+
217+
return app.quit()
218+
219+
}
220+
221+
app.on('second-instance', ( event, commandLine, workingDirectory) => {
222+
createWindow ()
223+
})
290224

291225
app.once ( 'ready', () => {
292226
if ( doReady ) {
@@ -296,19 +230,9 @@ const initialize = () => {
296230
doReady = true
297231

298232
return appReady ()
299-
})
300-
301-
app.once ('will-finish-launching', () => {
302-
/*
303-
if ( doReady )
304-
return
305-
doReady = true
306-
307-
return appReady ()
308-
*/
309-
})
233+
})
310234

311-
app.on ( 'window-all-closed', () => {
235+
app.once ( 'window-all-closed', () => {
312236
app.quit()
313237
})
314238

0 commit comments

Comments
 (0)