4974-datasources-and-improvements #4
25
src/main.js
25
src/main.js
|
@ -131,7 +131,6 @@ var App = {
|
|||
|
||||
var notSignOut = this.regRead(Conf.regPath, 'notSignOut');
|
||||
var password = this.regRead(Conf.odbcPath + Conf.dsName, 'PWD');
|
||||
|
||||
this.$('user').value = this.regRead(Conf.odbcPath + Conf.dsName, 'UID');
|
||||
this.$('password').value = password;
|
||||
|
||||
|
@ -162,16 +161,13 @@ var App = {
|
|||
createODBC: function(path, dsName, driverName) {
|
||||
var driverPath = this.getEnv('ProgramFiles') + Conf.driverPath;
|
||||
var datasource = Conf.defaultDatasource;
|
||||
var serverURL, sslMode;
|
||||
serverURL = Conf.datasources[datasource].SERVER
|
||||
sslMode = Conf.datasources[datasource].SSLMODE
|
||||
var params = {
|
||||
Driver: driverPath,
|
||||
DESCRIPTION: Conf.appName,
|
||||
SERVER: serverURL,
|
||||
SERVER: Conf.datasources[datasource].SERVER,
|
||||
DATABASE: Conf.dbName,
|
||||
SSLCA: this.certFile,
|
||||
SSLMODE: sslMode,
|
||||
SSLMODE: Conf.datasources[datasource].SSLMODE,
|
||||
SSLCIPHER: 'AES256-SHA',
|
||||
AUTO_RECONNECT: 1,
|
||||
NO_PROMPT: 1,
|
||||
|
@ -337,7 +333,7 @@ var App = {
|
|||
? '.archive/'+ this.module +'/'+ version +'.7z'
|
||||
: this.module +'.7z?'+ new Date().getTime();
|
||||
remoteFile = Conf.cdnURL +'/'+ remoteFile;
|
||||
var request = new ActiveXObject("MSXML2.XMLHTTP");
|
||||
var request = new ActiveXObject("MSXML2.XMLHTTP.6.0");
|
||||
request.open('GET', remoteFile, true);
|
||||
request.onreadystatechange = function() {
|
||||
App.onRequestReady(request);
|
||||
|
@ -361,25 +357,22 @@ var App = {
|
|||
var datasource = this.getDatasource();
|
||||
var user = this.$('user').value;
|
||||
var password = this.$('password').value;
|
||||
var serverURL = Conf.datasources[datasource].SERVER;
|
||||
var sslMode = Conf.datasources[datasource].SSLMODE;
|
||||
|
||||
// FIXME: Can't login in dev-db
|
||||
if (datasource == 'dev') {
|
||||
serverURL = Conf.datasources.production.SERVER
|
||||
sslMode = Conf.datasources.production.SERVER
|
||||
datasource = Conf.defaultDatasource
|
||||
};
|
||||
|
||||
// Check credentials
|
||||
try {
|
||||
mysqlConn.open(this.getODBCString({
|
||||
Driver: '{'+ Conf.odbcDriver +'}',
|
||||
SERVER: serverURL,
|
||||
SERVER: Conf.datasources[datasource].SERVER,
|
||||
DATABASE: Conf.dbName,
|
||||
UID: user,
|
||||
PWD: password,
|
||||
SSLCA: this.certFile,
|
||||
SSLMODE: sslMode,
|
||||
SSLMODE: Conf.datasources[datasource].SSLMODE,
|
||||
SSLCIPHER: 'AES256-SHA',
|
||||
ENABLE_CLEARTEXT_PLUGIN : 1
|
||||
}));
|
||||
|
@ -408,7 +401,7 @@ var App = {
|
|||
|
||||
// Request to obtain the token and lastest version of this module
|
||||
try {
|
||||
var request = new ActiveXObject("MSXML2.ServerXMLHTTP");
|
||||
var request = new ActiveXObject("MSXML2.XMLHTTP.6.0");
|
||||
urlLoginMethod = this.getRemoteURL() + '/api/Accounts/login'
|
||||
request.open('POST', urlLoginMethod, false);
|
||||
request.setRequestHeader('Content-Type', 'application/json')
|
||||
|
@ -499,7 +492,7 @@ var App = {
|
|||
|
||||
var stream = new ActiveXObject('ADODB.Stream');
|
||||
stream.open();
|
||||
stream.Type = 1; //adTypeBinary
|
||||
stream.Type = 1; // adTypeBinary
|
||||
stream.write(request.responseBody);
|
||||
stream.Position = 0;
|
||||
stream.saveToFile(this.compressFile, 2);
|
||||
|
@ -528,7 +521,7 @@ var App = {
|
|||
return;
|
||||
|
||||
try {
|
||||
if (request.status == 401) //Unhauthorized
|
||||
if (request.status == 401) // Unhauthorized
|
||||
throw new Error('Bad login in the remoteURL "' + this.getRemoteURL() +
|
||||
'":\nThe latest version could not be obtained');
|
||||
else if (request.status !== 200 )
|
||||
|
|
Loading…
Reference in New Issue