|
|
@ -20,9 +20,10 @@ define([
|
|
|
|
'/common/pinpad.js',
|
|
|
|
'/common/pinpad.js',
|
|
|
|
'/customize/application_config.js',
|
|
|
|
'/customize/application_config.js',
|
|
|
|
'/common/media-tag.js',
|
|
|
|
'/common/media-tag.js',
|
|
|
|
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata,
|
|
|
|
], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata,
|
|
|
|
Messaging, CodeMirror, Files, FileCrypto, Realtime, Clipboard,
|
|
|
|
Messaging, CodeMirror, Files, FileCrypto, Realtime, Clipboard,
|
|
|
|
Pinpad, AppConfig, MediaTag) {
|
|
|
|
Pinpad, AppConfig, MediaTag, Nthen) {
|
|
|
|
|
|
|
|
|
|
|
|
// Configure MediaTags to use our local viewer
|
|
|
|
// Configure MediaTags to use our local viewer
|
|
|
|
if (MediaTag && MediaTag.PdfPlugin) {
|
|
|
|
if (MediaTag && MediaTag.PdfPlugin) {
|
|
|
@ -2071,24 +2072,37 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
return function (f) {
|
|
|
|
return function (f) {
|
|
|
|
if (initialized) {
|
|
|
|
if (initialized) {
|
|
|
|
return void window.setTimeout(function () {
|
|
|
|
return void setTimeout(function () { f(void 0, env); });
|
|
|
|
f(void 0, env);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var block = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cb = function () {
|
|
|
|
var proxy;
|
|
|
|
block--;
|
|
|
|
var network;
|
|
|
|
if (!block) {
|
|
|
|
var provideFeedback = function () {
|
|
|
|
initialized = true;
|
|
|
|
if (Object.keys(proxy).length === 1) {
|
|
|
|
|
|
|
|
feedback("FIRST_APP_USE", true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
updateLocalVersion();
|
|
|
|
if (typeof(window.Proxy) === 'undefined') {
|
|
|
|
common.addTooltips();
|
|
|
|
feedback("NO_PROXIES");
|
|
|
|
f(void 0, env);
|
|
|
|
|
|
|
|
if (typeof(window.onhashchange) === 'function') { window.onhashchange(); }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var shimPattern = /CRYPTPAD_SHIM/;
|
|
|
|
|
|
|
|
if (shimPattern.test(Array.isArray.toString())) {
|
|
|
|
|
|
|
|
feedback("NO_ISARRAY");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (shimPattern.test(Array.prototype.fill.toString())) {
|
|
|
|
|
|
|
|
feedback("NO_ARRAYFILL");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof(Symbol) === 'undefined') {
|
|
|
|
|
|
|
|
feedback('NO_SYMBOL');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
common.reportScreenDimensions();
|
|
|
|
|
|
|
|
common.reportLanguage();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nthen(function (waitFor) {
|
|
|
|
if (sessionStorage[newPadNameKey]) {
|
|
|
|
if (sessionStorage[newPadNameKey]) {
|
|
|
|
common.initialName = sessionStorage[newPadNameKey];
|
|
|
|
common.initialName = sessionStorage[newPadNameKey];
|
|
|
|
delete sessionStorage[newPadNameKey];
|
|
|
|
delete sessionStorage[newPadNameKey];
|
|
|
@ -2097,52 +2111,29 @@ define([
|
|
|
|
common.initialPath = sessionStorage[newPadPathKey];
|
|
|
|
common.initialPath = sessionStorage[newPadPathKey];
|
|
|
|
delete sessionStorage[newPadPathKey];
|
|
|
|
delete sessionStorage[newPadPathKey];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
common.onFriendRequest = function (confirmText, cb) {
|
|
|
|
common.onFriendRequest = function (confirmText, cb) {
|
|
|
|
common.confirm(confirmText, cb, null, true);
|
|
|
|
common.confirm(confirmText, cb, null, true);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
common.onFriendComplete = function (data) {
|
|
|
|
common.onFriendComplete = function (data) {
|
|
|
|
common.log(data.logText);
|
|
|
|
common.log(data.logText);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
Store.ready(function (err, storeObj) {
|
|
|
|
Store.ready(waitFor(function (err, storeObj) {
|
|
|
|
store = common.store = env.store = storeObj;
|
|
|
|
store = common.store = env.store = storeObj;
|
|
|
|
common.addDirectMessageHandler(common);
|
|
|
|
common.addDirectMessageHandler(common);
|
|
|
|
|
|
|
|
proxy = getProxy();
|
|
|
|
var proxy = getProxy();
|
|
|
|
network = getNetwork();
|
|
|
|
var network = getNetwork();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
network.on('disconnect', function () {
|
|
|
|
network.on('disconnect', function () {
|
|
|
|
Realtime.setConnectionState(false);
|
|
|
|
Realtime.setConnectionState(false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
network.on('reconnect', function () {
|
|
|
|
network.on('reconnect', function () {
|
|
|
|
Realtime.setConnectionState(true);
|
|
|
|
Realtime.setConnectionState(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
provideFeedback();
|
|
|
|
if (Object.keys(proxy).length === 1) {
|
|
|
|
}), common);
|
|
|
|
feedback("FIRST_APP_USE", true);
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
}
|
|
|
|
$(waitFor());
|
|
|
|
|
|
|
|
}).nThen(function (waitFor) {
|
|
|
|
if (typeof(window.Proxy) === 'undefined') {
|
|
|
|
|
|
|
|
feedback("NO_PROXIES");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var shimPattern = /CRYPTPAD_SHIM/;
|
|
|
|
|
|
|
|
if (shimPattern.test(Array.isArray.toString())) {
|
|
|
|
|
|
|
|
feedback("NO_ISARRAY");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (shimPattern.test(Array.prototype.fill.toString())) {
|
|
|
|
|
|
|
|
feedback("NO_ARRAYFILL");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof(Symbol) === 'undefined') {
|
|
|
|
|
|
|
|
feedback('NO_SYMBOL');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
common.reportScreenDimensions();
|
|
|
|
|
|
|
|
common.reportLanguage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
|
|
|
|
// Race condition : if document.body is undefined when alertify.js is loaded, Alertify
|
|
|
|
// Race condition : if document.body is undefined when alertify.js is loaded, Alertify
|
|
|
|
// won't work. We have to reset it now to make sure it uses a correct "body"
|
|
|
|
// won't work. We have to reset it now to make sure it uses a correct "body"
|
|
|
|
UI.Alertify.reset();
|
|
|
|
UI.Alertify.reset();
|
|
|
@ -2164,19 +2155,16 @@ define([
|
|
|
|
document.location.reload();
|
|
|
|
document.location.reload();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (parsedNew) {
|
|
|
|
if (parsedNew) { oldHref = newHref; }
|
|
|
|
oldHref = newHref;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (PINNING_ENABLED && isLoggedIn()) {
|
|
|
|
if (PINNING_ENABLED && isLoggedIn()) {
|
|
|
|
console.log("logged in. pads will be pinned");
|
|
|
|
console.log("logged in. pads will be pinned");
|
|
|
|
block++;
|
|
|
|
var w0 = waitFor();
|
|
|
|
|
|
|
|
|
|
|
|
Pinpad.create(network, proxy, function (e, call) {
|
|
|
|
Pinpad.create(network, proxy, function (e, call) {
|
|
|
|
if (e) {
|
|
|
|
if (e) {
|
|
|
|
console.error(e);
|
|
|
|
console.error(e);
|
|
|
|
return cb();
|
|
|
|
return w0();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log('RPC handshake complete');
|
|
|
|
console.log('RPC handshake complete');
|
|
|
@ -2187,7 +2175,7 @@ define([
|
|
|
|
common.account.limit = limit;
|
|
|
|
common.account.limit = limit;
|
|
|
|
localStorage.plan = common.account.plan = plan;
|
|
|
|
localStorage.plan = common.account.plan = plan;
|
|
|
|
common.account.note = note;
|
|
|
|
common.account.note = note;
|
|
|
|
cb();
|
|
|
|
w0();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
common.arePinsSynced(function (err, yes) {
|
|
|
|
common.arePinsSynced(function (err, yes) {
|
|
|
@ -2208,43 +2196,42 @@ define([
|
|
|
|
console.log('pinning disabled');
|
|
|
|
console.log('pinning disabled');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
block++;
|
|
|
|
var w1 = waitFor();
|
|
|
|
require([
|
|
|
|
require([
|
|
|
|
'/common/rpc.js',
|
|
|
|
'/common/rpc.js',
|
|
|
|
], function (Rpc) {
|
|
|
|
], function (Rpc) {
|
|
|
|
Rpc.createAnonymous(network, function (e, call) {
|
|
|
|
Rpc.createAnonymous(network, function (e, call) {
|
|
|
|
if (e) {
|
|
|
|
if (e) {
|
|
|
|
console.error(e);
|
|
|
|
console.error(e);
|
|
|
|
return void cb();
|
|
|
|
return void w1();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
anon_rpc = common.anon_rpc = env.anon_rpc = call;
|
|
|
|
anon_rpc = common.anon_rpc = env.anon_rpc = call;
|
|
|
|
cb();
|
|
|
|
w1();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Everything's ready, continue...
|
|
|
|
// Everything's ready, continue...
|
|
|
|
if($('#pad-iframe').length) {
|
|
|
|
if($('#pad-iframe').length) {
|
|
|
|
block++;
|
|
|
|
var w2 = waitFor();
|
|
|
|
var $iframe = $('#pad-iframe');
|
|
|
|
var $iframe = $('#pad-iframe');
|
|
|
|
var iframe = $iframe[0];
|
|
|
|
var iframe = $iframe[0];
|
|
|
|
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
|
|
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
|
|
if (iframeDoc.readyState === 'complete') {
|
|
|
|
if (iframeDoc.readyState === 'complete') {
|
|
|
|
cb();
|
|
|
|
return void w2();
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$iframe.load(cb);
|
|
|
|
$iframe.load(w2); //cb);
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
block++;
|
|
|
|
updateLocalVersion();
|
|
|
|
cb();
|
|
|
|
common.addTooltips();
|
|
|
|
|
|
|
|
f(void 0, env);
|
|
|
|
|
|
|
|
if (typeof(window.onhashchange) === 'function') { window.onhashchange(); }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, common);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}());
|
|
|
|
}());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MAGIC that happens implicitly
|
|
|
|
$(function () {
|
|
|
|
$(function () {
|
|
|
|
Messages._applyTranslation();
|
|
|
|
Messages._applyTranslation();
|
|
|
|
});
|
|
|
|
});
|
|
|
|