Always use production to fetch last version number

This commit is contained in:
Juan Ferrer 2020-03-03 13:01:57 +01:00
parent 8b6efa9e2f
commit 548752f55f
1 changed files with 26 additions and 6 deletions

View File

@ -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
}; };
@ -261,11 +262,19 @@ 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);
@ -354,6 +365,15 @@ var App = {
? version ? version
: 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)