Always use production to fetch last version number
This commit is contained in:
parent
8b6efa9e2f
commit
548752f55f
30
src/main.js
30
src/main.js
|
@ -66,6 +66,7 @@ var App = {
|
||||||
this.compressFile = this.getEnv('TEMP') +'\\'+ this.module +'.7z';
|
this.compressFile = this.getEnv('TEMP') +'\\'+ this.module +'.7z';
|
||||||
this.mdbFile = this.moduleDir +'\\'+ this.module +'.mdb';
|
this.mdbFile = this.moduleDir +'\\'+ this.module +'.mdb';
|
||||||
this.lockFile = this.moduleDir +'\\'+ this.module +'.ldb';
|
this.lockFile = this.moduleDir +'\\'+ this.module +'.ldb';
|
||||||
|
this.certFile = this.appDir +'\\cacert.pem';
|
||||||
|
|
||||||
// Creates the necessary registry entries
|
// Creates the necessary registry entries
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ var App = {
|
||||||
'DESCRIPTION' : Conf.appName,
|
'DESCRIPTION' : Conf.appName,
|
||||||
'SERVER' : Conf.dbHost,
|
'SERVER' : Conf.dbHost,
|
||||||
'DATABASE' : Conf.dbName,
|
'DATABASE' : Conf.dbName,
|
||||||
'SSLCA' : this.appDir +'\\cacert.pem',
|
'SSLCA' : this.certFile,
|
||||||
'SSLVERIFY' : 1,
|
'SSLVERIFY' : 1,
|
||||||
'AUTO_RECONNECT' : 1
|
'AUTO_RECONNECT' : 1
|
||||||
};
|
};
|
||||||
|
@ -262,10 +263,18 @@ var App = {
|
||||||
fetchVersion: function() {
|
fetchVersion: function() {
|
||||||
// Gets the last version number using the MySQL ODBC connection
|
// Gets the last version number using the MySQL ODBC connection
|
||||||
|
|
||||||
var mysqlConn = new ActiveXObject('ADODB.Connection');
|
var mysqlConn;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mysqlConn.open(Conf.dsName);
|
mysqlConn = this.openOdbc({
|
||||||
|
'Driver': '{MySQL ODBC 5.1 Driver}',
|
||||||
|
'Server': Conf.dbHost,
|
||||||
|
'Database': Conf.dbName,
|
||||||
|
'User': this.$('user').value,
|
||||||
|
'Password': this.$('password').value,
|
||||||
|
'SslVerify': 1,
|
||||||
|
'SslCa': this.certFile
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
var dbErrors = mysqlConn.errors;
|
var dbErrors = mysqlConn.errors;
|
||||||
|
|
||||||
|
@ -337,8 +346,10 @@ var App = {
|
||||||
var localVersion;
|
var localVersion;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var mdbConn = new ActiveXObject('ADODB.Connection');
|
var mdbConn = this.openOdbc({
|
||||||
mdbConn.open('Provider=Microsoft.Jet.OLEDB.4.0; Data Source='+ this.mdbFile +';');
|
'Provider': 'Microsoft.Jet.OLEDB.4.0',
|
||||||
|
'Data Source': this.mdbFile
|
||||||
|
});
|
||||||
|
|
||||||
var oRs = new ActiveXObject('ADODB.Recordset');
|
var oRs = new ActiveXObject('ADODB.Recordset');
|
||||||
oRs.Open('SELECT Version FROM tblVariables', mdbConn);
|
oRs.Open('SELECT Version FROM tblVariables', mdbConn);
|
||||||
|
@ -355,6 +366,15 @@ var App = {
|
||||||
: null;
|
: null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
openOdbc(options) {
|
||||||
|
var optionsArray = [];
|
||||||
|
for (var option of options)
|
||||||
|
optionsArray.push(option +'='+ options[option]);
|
||||||
|
|
||||||
|
var conn = new ActiveXObject('ADODB.Connection');
|
||||||
|
return conn.open(optionsArray.join(';'));
|
||||||
|
},
|
||||||
|
|
||||||
onRequestReady: function(request) {
|
onRequestReady: function(request) {
|
||||||
if (request.readyState !== 4)
|
if (request.readyState !== 4)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue