Skip to content

Commit

Permalink
v3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
KloakIT committed Nov 10, 2019
1 parent deb839b commit 466ee82
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 182 deletions.
4 changes: 2 additions & 2 deletions app/package.json → app/package.json.npm
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"name": "CoNET Technology Inc.",
"email": "info@CoNETTech.ca"
},
"main": "./core/main",
"main": "./main",
"bugs": {
"url": "https://github.com/QTGate/CoNET/issues"
},
"homepage": "https://www.CoNETTech.ca",
"dependencies": {
"async": "^3.1.0",
"async": "^3.1.0",
"cookie-parser": "^1.4.4",
"express": "^4.17.1",
"jimp": "^0.8.5",
Expand Down
1 change: 1 addition & 0 deletions app/public/scripts/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ var view_layout;
self.showKeyPair(false);
initPopupArea();
let uu = null;
self.keyPairCalss = new encryptoClass(self.keyPair());
self.imapSetup(uu = new imapForm(config.account, null, function (imapData) {
self.imapSetup(uu = null);
return self.imapSetupClassExit(imapData, sessionHash);
Expand Down
5 changes: 3 additions & 2 deletions app/public/scripts/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ module view_layout {

self.showKeyPair ( false )
initPopupArea ()
let uu = null
let uu = null
self.keyPairCalss = new encryptoClass ( self.keyPair () )
self.imapSetup ( uu = new imapForm ( config.account, null, function ( imapData: IinputData ) {
self.imapSetup ( uu = null )
return self.imapSetupClassExit ( imapData, sessionHash )
Expand Down Expand Up @@ -307,7 +308,7 @@ module view_layout {
return self.initConfig ( config )
})

this.connectInformationMessage.socketIo.on ('init', ( err, config: install_config) => {
this.connectInformationMessage.socketIo.on ('init', ( err, config: install_config ) => {
if ( err ) {
return
}
Expand Down
1 change: 1 addition & 0 deletions app/public/scripts/keyPairGenerateForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class keyPairGenerateForm {
})
*/
}

public form_AdministratorEmail_submit () {
const self = this
this.checkEmailAddress ( this.SystemAdministratorEmailAddress ())
Expand Down
4 changes: 2 additions & 2 deletions app/tools/imap.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ class ImapServerSwitchStream extends Stream.Transform {
}
this.push(this.cmd + '\r\n');
this.appendWaitResponsrTimeOut = timers_1.setTimeout(() => {
return this.emit('error', new Error('appendStreamV3 mail serrver write timeout!'));
return this.doCommandCallback(new Error('appendStreamV3 mail serrver write timeout!'));
}, _time);
//console.log (`************************************* append time = [${ time }] `)
if (this.imapServer.literalPlus) {
Expand Down Expand Up @@ -1085,7 +1085,7 @@ exports.imapAccountTest = (IMapConnect, CallBack) => {
}
saveLog(`imapAccountTest doing timeout`);
doCallBack(new Error('timeout'), null);
}, pingPongTimeOut);
}, pingFailureTime);
exports.seneMessageToFolder(IMapConnect, listenFolder, ramdomText.toString('base64'), null, err => {
if (err) {
saveLog(`imapAccountTest seneMessageToFolder Error! ${err.message}`);
Expand Down
4 changes: 2 additions & 2 deletions app/tools/imap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ class ImapServerSwitchStream extends Stream.Transform {

this.appendWaitResponsrTimeOut = setTimeout (() => {

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

}, _time )

Expand Down Expand Up @@ -1342,7 +1342,7 @@ export const imapAccountTest = ( IMapConnect: imapConnect, CallBack ) => {
}
saveLog (`imapAccountTest doing timeout`)
doCallBack ( new Error ( 'timeout' ), null )
}, pingPongTimeOut )
}, pingFailureTime )

seneMessageToFolder ( IMapConnect, listenFolder, ramdomText.toString ('base64'), null, err => {
if ( err ) {
Expand Down
91 changes: 15 additions & 76 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,74 +20,10 @@ const port = 3000;
const path_1 = require("path");
const url_1 = require("url");
const { app, BrowserWindow, Tray, Menu, dialog, autoUpdater, desktopCapturer, shell } = require('electron');
const handleSquirrelEvent = () => {
if (process.argv.length === 1 || process.platform !== 'win32') {
return false;
}
const ChildProcess = require('child_process');
const path = require('path');
const appFolder = path.resolve(process.execPath, '..');
const rootAtomFolder = path.resolve(appFolder, '..');
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
const exeName = path.basename(process.execPath);
const spawn = function (command, args) {
let spawnedProcess, error;
try {
spawnedProcess = ChildProcess.spawn(command, args, { detached: true });
}
catch (error) { }
return spawnedProcess;
};
const spawnUpdate = function (args) {
return spawn(updateDotExe, args);
};
const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
// Optionally do things such as:
// - Add your .exe to the PATH
// - Write to the registry for things like file associations and
// explorer context menus
// Install desktop and start menu shortcuts
spawnUpdate(['--createShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-uninstall':
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers
// Remove desktop and start menu shortcuts
spawnUpdate(['--removeShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-obsolete':
// This is called on the outgoing version of your app before
// we update to the new version - it's the opposite of
// --squirrel-updated
app.quit();
return true;
}
};
if (handleSquirrelEvent()) {
// squirrel event handled and app will exit in 1000ms, so don't do anything else
}
const makeSingleInstance = () => {
// For Mac App Store build
if (process.platform === 'darwin') {
return false;
}
return app.makeSingleInstance(() => {
createWindow();
});
};
if (makeSingleInstance()) {
app.quit();
}
// squirrel event handled and app will exit in 1000ms, so don't do anything else
const version = app.getVersion();
let localServer1 = null;
let tray = null;
let mainWindow = null;
let doReady = false;
const _doUpdate = (tag_name, _port) => {
let url = null;
Expand Down Expand Up @@ -197,7 +133,12 @@ const appReady = () => {
//const menu = Menu.buildFromTemplate( template )
//Menu.setApplicationMenu ( menu)
if (!localServer1) {
localServer1 = new BrowserWindow({ show: DEBUG });
localServer1 = new BrowserWindow({
show: DEBUG,
webPreferences: {
nodeIntegration: true
}
});
localServer1._doUpdate = _doUpdate;
DEBUG ? localServer1.webContents.openDevTools() : null;
//localServer1.maximize ()
Expand All @@ -207,7 +148,7 @@ const appReady = () => {
slashes: true
}));
setTimeout(() => {
shell.openExternal(`http://127.0.0.1:${port}`);
createWindow();
}, 2000);
/*
setTimeout (() => {
Expand Down Expand Up @@ -235,23 +176,21 @@ const appReady = () => {
}
};
const initialize = () => {
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
return app.quit();
}
app.on('second-instance', (event, commandLine, workingDirectory) => {
createWindow();
});
app.once('ready', () => {
if (doReady) {
return;
}
doReady = true;
return appReady();
});
app.once('will-finish-launching', () => {
/*
if ( doReady )
return
doReady = true
return appReady ()
*/
});
app.on('window-all-closed', () => {
app.once('window-all-closed', () => {
app.quit();
});
};
Expand Down
118 changes: 21 additions & 97 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,95 +22,12 @@ import { format } from 'url'

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

const handleSquirrelEvent = () => {
if ( process.argv.length === 1 || process.platform !== 'win32') {
return false;
}

const ChildProcess = require('child_process');
const path = require('path');

const appFolder = path.resolve(process.execPath, '..');
const rootAtomFolder = path.resolve(appFolder, '..');
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
const exeName = path.basename(process.execPath);

const spawn = function(command, args) {
let spawnedProcess, error;

try {
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
} catch (error) {}

return spawnedProcess;
}

const spawnUpdate = function(args) {
return spawn(updateDotExe, args);
}

const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
// Optionally do things such as:
// - Add your .exe to the PATH
// - Write to the registry for things like file associations and
// explorer context menus

// Install desktop and start menu shortcuts
spawnUpdate(['--createShortcut', exeName]);

setTimeout(app.quit, 1000);
return true;

case '--squirrel-uninstall':
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers

// Remove desktop and start menu shortcuts
spawnUpdate(['--removeShortcut', exeName]);

setTimeout(app.quit, 1000);
return true;

case '--squirrel-obsolete':
// This is called on the outgoing version of your app before
// we update to the new version - it's the opposite of
// --squirrel-updated

app.quit()
return true
}
}

if ( handleSquirrelEvent()) {
// squirrel event handled and app will exit in 1000ms, so don't do anything else
}

const makeSingleInstance = () => {

// For Mac App Store build
if ( process.platform ==='darwin' ) {
return false
}

return app.makeSingleInstance (() => {
createWindow ()
})
}

if ( makeSingleInstance ()) {
app.quit ()
}

// squirrel event handled and app will exit in 1000ms, so don't do anything else
const version = app.getVersion()

let localServer1 = null

let tray = null
let mainWindow = null
let doReady = false

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

localServer1 = new BrowserWindow ({ show: DEBUG })
localServer1 = new BrowserWindow (
{
show: DEBUG,
webPreferences: {
nodeIntegration: true
}
})

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

setTimeout (() => {
shell.openExternal (`http://127.0.0.1:${ port }`)
createWindow ()
}, 2000 )

/*
Expand Down Expand Up @@ -287,6 +210,17 @@ const appReady = () => {
}

const initialize = () => {
const gotTheLock = app.requestSingleInstanceLock()

if (!gotTheLock) {

return app.quit()

}

app.on('second-instance', ( event, commandLine, workingDirectory) => {
createWindow ()
})

app.once ( 'ready', () => {
if ( doReady ) {
Expand All @@ -296,19 +230,9 @@ const initialize = () => {
doReady = true

return appReady ()
})

app.once ('will-finish-launching', () => {
/*
if ( doReady )
return
doReady = true
return appReady ()
*/
})
})

app.on ( 'window-all-closed', () => {
app.once ( 'window-all-closed', () => {
app.quit()
})

Expand Down
Loading

0 comments on commit 466ee82

Please sign in to comment.