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