mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 10:52:17 -05:00
Fix build errors... still runtime errors though
This commit is contained in:
parent
da5a9e2c17
commit
7eeff8ec75
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
var appCfg = {};
|
var appCfg = {};
|
||||||
|
|
||||||
var ngModule = angular.module('woAppConfig');
|
var ngModule = angular.module('woAppConfig', []);
|
||||||
ngModule.factory('appConfig', function() {
|
ngModule.factory('appConfig', function() {
|
||||||
return appCfg;
|
return appCfg;
|
||||||
});
|
});
|
||||||
exports = appCfg;
|
module.exports = appCfg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global app configurations
|
* Global app configurations
|
||||||
|
@ -15,28 +15,28 @@ if (typeof window.applicationCache !== 'undefined') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var axe = require('axe-logger'),
|
var axe = require('axe-logger'),
|
||||||
DialogCtrl = require('./controller/dialog'),
|
AddAccountCtrl = require('./controller/login/add-account'),
|
||||||
AddAccountCtrl = require('./controller/add-account'),
|
CreateAccountCtrl = require('./controller/login/create-account'),
|
||||||
CreateAccountCtrl = require('./controller/create-account'),
|
ValidatePhoneCtrl = require('./controller/login/validate-phone'),
|
||||||
ValidatePhoneCtrl = require('./controller/validate-phone'),
|
LoginCtrl = require('./controller/login/login'),
|
||||||
AccountCtrl = require('./controller/account'),
|
LoginInitialCtrl = require('./controller/login/login-initial'),
|
||||||
SetPassphraseCtrl = require('./controller/set-passphrase'),
|
LoginNewDeviceCtrl = require('./controller/login/login-new-device'),
|
||||||
PrivateKeyUploadCtrl = require('./controller/privatekey-upload'),
|
LoginExistingCtrl = require('./controller/login/login-existing'),
|
||||||
ContactsCtrl = require('./controller/contacts'),
|
LoginPrivateKeyDownloadCtrl = require('./controller/login/login-privatekey-download'),
|
||||||
AboutCtrl = require('./controller/about'),
|
LoginSetCredentialsCtrl = require('./controller/login/login-set-credentials'),
|
||||||
LoginCtrl = require('./controller/login'),
|
DialogCtrl = require('./controller/app/dialog'),
|
||||||
LoginInitialCtrl = require('./controller/login-initial'),
|
AccountCtrl = require('./controller/app/account'),
|
||||||
LoginNewDeviceCtrl = require('./controller/login-new-device'),
|
SetPassphraseCtrl = require('./controller/app/set-passphrase'),
|
||||||
LoginExistingCtrl = require('./controller/login-existing'),
|
PrivateKeyUploadCtrl = require('./controller/app/privatekey-upload'),
|
||||||
LoginPrivateKeyDownloadCtrl = require('./controller/login-privatekey-download'),
|
ContactsCtrl = require('./controller/app/contacts'),
|
||||||
LoginSetCredentialsCtrl = require('./controller/login-set-credentials'),
|
AboutCtrl = require('./controller/app/about'),
|
||||||
MailListCtrl = require('./controller/mail-list'),
|
MailListCtrl = require('./controller/app/mail-list'),
|
||||||
ReadCtrl = require('./controller/read'),
|
ReadCtrl = require('./controller/app/read'),
|
||||||
WriteCtrl = require('./controller/write'),
|
WriteCtrl = require('./controller/app/write'),
|
||||||
NavigationCtrl = require('./controller/navigation'),
|
NavigationCtrl = require('./controller/app/navigation'),
|
||||||
ActionBarCtrl = require('./controller/action-bar'),
|
ActionBarCtrl = require('./controller/app/action-bar'),
|
||||||
backButtonUtil = require('./util/backbutton-handler'),
|
StatusDisplayCtrl = require('./controller/app/status-display'),
|
||||||
StatusDisplayCtrl = require('./controller/app/status-display');
|
backButtonUtil = require('./util/backbutton-handler');
|
||||||
|
|
||||||
// include angular modules
|
// include angular modules
|
||||||
require('./app-config');
|
require('./app-config');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var backBtnHandler = require('../util/backbutton-handler');
|
var backBtnHandler = require('../../util/backbutton-handler');
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constants
|
// Constants
|
||||||
|
@ -5,9 +5,6 @@ ngModule.service('connectionDoctor', ConnectionDoctor);
|
|||||||
module.exports = ConnectionDoctor;
|
module.exports = ConnectionDoctor;
|
||||||
|
|
||||||
var TCPSocket = require('tcp-socket'),
|
var TCPSocket = require('tcp-socket'),
|
||||||
appConfig = require('../app-config'),
|
|
||||||
cfg = appConfig.config,
|
|
||||||
strings = appConfig.string,
|
|
||||||
ImapClient = require('imap-client'),
|
ImapClient = require('imap-client'),
|
||||||
SmtpClient = require('wo-smtpclient');
|
SmtpClient = require('wo-smtpclient');
|
||||||
|
|
||||||
@ -18,8 +15,10 @@ var TCPSocket = require('tcp-socket'),
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function ConnectionDoctor() {}
|
function ConnectionDoctor(appConfig) {
|
||||||
|
this._appConfig = appConfig;
|
||||||
|
this._workerPath = appConfig.config.workerPath + '/tcp-socket-tls-worker.min.js';
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Error codes
|
// Error codes
|
||||||
@ -33,9 +32,6 @@ var AUTH_REJECTED = ConnectionDoctor.AUTH_REJECTED = 46;
|
|||||||
var NO_INBOX = ConnectionDoctor.NO_INBOX = 47;
|
var NO_INBOX = ConnectionDoctor.NO_INBOX = 47;
|
||||||
var GENERIC_ERROR = ConnectionDoctor.GENERIC_ERROR = 48;
|
var GENERIC_ERROR = ConnectionDoctor.GENERIC_ERROR = 48;
|
||||||
|
|
||||||
|
|
||||||
var WORKER_PATH = cfg.workerPath + '/tcp-socket-tls-worker.min.js';
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Public API
|
// Public API
|
||||||
//
|
//
|
||||||
@ -58,7 +54,7 @@ ConnectionDoctor.prototype.configure = function(credentials) {
|
|||||||
secure: this.credentials.imap.secure,
|
secure: this.credentials.imap.secure,
|
||||||
ignoreTLS: this.credentials.imap.ignoreTLS,
|
ignoreTLS: this.credentials.imap.ignoreTLS,
|
||||||
ca: this.credentials.imap.ca,
|
ca: this.credentials.imap.ca,
|
||||||
tlsWorkerPath: WORKER_PATH,
|
tlsWorkerPath: this._workerPath,
|
||||||
auth: {
|
auth: {
|
||||||
user: this.credentials.username,
|
user: this.credentials.username,
|
||||||
pass: this.credentials.password,
|
pass: this.credentials.password,
|
||||||
@ -70,7 +66,7 @@ ConnectionDoctor.prototype.configure = function(credentials) {
|
|||||||
useSecureTransport: this.credentials.smtp.secure,
|
useSecureTransport: this.credentials.smtp.secure,
|
||||||
ignoreTLS: this.credentials.smtp.ignoreTLS,
|
ignoreTLS: this.credentials.smtp.ignoreTLS,
|
||||||
ca: this.credentials.smtp.ca,
|
ca: this.credentials.smtp.ca,
|
||||||
tlsWorkerPath: WORKER_PATH,
|
tlsWorkerPath: this._workerPath,
|
||||||
auth: {
|
auth: {
|
||||||
user: this.credentials.username,
|
user: this.credentials.username,
|
||||||
pass: this.credentials.password,
|
pass: this.credentials.password,
|
||||||
@ -137,7 +133,7 @@ ConnectionDoctor.prototype._checkOnline = function(callback) {
|
|||||||
if (navigator.onLine) {
|
if (navigator.onLine) {
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
callback(createError(OFFLINE, strings.connDocOffline));
|
callback(createError(OFFLINE, this._appConfig.string.connDocOffline));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -154,18 +150,19 @@ ConnectionDoctor.prototype._checkReachable = function(options, callback) {
|
|||||||
error, // remember the error message
|
error, // remember the error message
|
||||||
timeout, // remember the timeout object
|
timeout, // remember the timeout object
|
||||||
host = options.host + ':' + options.port,
|
host = options.host + ':' + options.port,
|
||||||
hasTimedOut = false; // prevents multiple callbacks
|
hasTimedOut = false, // prevents multiple callbacks
|
||||||
|
cfg = this._appConfig.config;
|
||||||
|
|
||||||
timeout = setTimeout(function() {
|
timeout = setTimeout(function() {
|
||||||
hasTimedOut = true;
|
hasTimedOut = true;
|
||||||
callback(createError(HOST_TIMEOUT, strings.connDocHostTimeout.replace('{0}', host).replace('{1}', cfg.connDocTimeout)));
|
callback(createError(HOST_TIMEOUT, this._appConfig.string.connDocHostTimeout.replace('{0}', host).replace('{1}', cfg.connDocTimeout)));
|
||||||
}, cfg.connDocTimeout);
|
}, cfg.connDocTimeout);
|
||||||
|
|
||||||
socket = TCPSocket.open(options.host, options.port, {
|
socket = TCPSocket.open(options.host, options.port, {
|
||||||
binaryType: 'arraybuffer',
|
binaryType: 'arraybuffer',
|
||||||
useSecureTransport: options.secure,
|
useSecureTransport: options.secure,
|
||||||
ca: options.ca,
|
ca: options.ca,
|
||||||
tlsWorkerPath: WORKER_PATH
|
tlsWorkerPath: this._workerPath
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.ondata = function() {}; // we don't actually care about the data
|
socket.ondata = function() {}; // we don't actually care about the data
|
||||||
@ -178,14 +175,14 @@ ConnectionDoctor.prototype._checkReachable = function(options, callback) {
|
|||||||
socket.oncert = function() {
|
socket.oncert = function() {
|
||||||
if (options.ca) {
|
if (options.ca) {
|
||||||
// the certificate we already have is outdated
|
// the certificate we already have is outdated
|
||||||
error = createError(TLS_WRONG_CERT, strings.connDocTlsWrongCert.replace('{0}', host));
|
error = createError(TLS_WRONG_CERT, this._appConfig.string.connDocTlsWrongCert.replace('{0}', host));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
socket.onerror = function(e) {
|
socket.onerror = function(e) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
error = createError(HOST_UNREACHABLE, strings.connDocHostUnreachable.replace('{0}', host), e.data);
|
error = createError(HOST_UNREACHABLE, this._appConfig.string.connDocHostUnreachable.replace('{0}', host), e.data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -223,9 +220,9 @@ ConnectionDoctor.prototype._checkImap = function(callback) {
|
|||||||
// the global onError handler, so we need to track if login was successful
|
// the global onError handler, so we need to track if login was successful
|
||||||
self._imap.onError = function(error) {
|
self._imap.onError = function(error) {
|
||||||
if (!loggedIn) {
|
if (!loggedIn) {
|
||||||
callback(createError(AUTH_REJECTED, strings.connDocAuthRejected.replace('{0}', host), error));
|
callback(createError(AUTH_REJECTED, this._appConfig.string.connDocAuthRejected.replace('{0}', host), error));
|
||||||
} else {
|
} else {
|
||||||
callback(createError(GENERIC_ERROR, strings.connDocGenericError.replace('{0}', host).replace('{1}', error.message), error));
|
callback(createError(GENERIC_ERROR, this._appConfig.string.connDocGenericError.replace('{0}', host).replace('{1}', error.message), error));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -234,12 +231,12 @@ ConnectionDoctor.prototype._checkImap = function(callback) {
|
|||||||
|
|
||||||
self._imap.listWellKnownFolders(function(error, wellKnownFolders) {
|
self._imap.listWellKnownFolders(function(error, wellKnownFolders) {
|
||||||
if (error) {
|
if (error) {
|
||||||
return callback(createError(GENERIC_ERROR, strings.connDocGenericError.replace('{0}', host).replace('{1}', error.message), error));
|
return callback(createError(GENERIC_ERROR, this._appConfig.string.connDocGenericError.replace('{0}', host).replace('{1}', error.message), error));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wellKnownFolders.Inbox.length === 0) {
|
if (wellKnownFolders.Inbox.length === 0) {
|
||||||
// the client needs at least an inbox folder to work properly
|
// the client needs at least an inbox folder to work properly
|
||||||
return callback(createError(NO_INBOX, strings.connDocNoInbox.replace('{0}', host)));
|
return callback(createError(NO_INBOX, this._appConfig.string.connDocNoInbox.replace('{0}', host)));
|
||||||
}
|
}
|
||||||
|
|
||||||
self._imap.logout(function() {
|
self._imap.logout(function() {
|
||||||
@ -269,7 +266,7 @@ ConnectionDoctor.prototype._checkSmtp = function(callback) {
|
|||||||
self._smtp.onerror = function(error) {
|
self._smtp.onerror = function(error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
errored = true;
|
errored = true;
|
||||||
callback(createError(AUTH_REJECTED, strings.connDocAuthRejected.replace('{0}', host), error));
|
callback(createError(AUTH_REJECTED, this._appConfig.string.connDocAuthRejected.replace('{0}', host), error));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user