|
|
@ -10,6 +10,7 @@ define([
|
|
|
|
'/common/sframe-common.js',
|
|
|
|
'/common/sframe-common.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
|
|
|
|
'/customize/application_config.js',
|
|
|
|
|
|
|
|
|
|
|
|
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
|
|
|
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
|
|
|
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
|
|
|
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
|
|
@ -25,7 +26,8 @@ define([
|
|
|
|
nThen,
|
|
|
|
nThen,
|
|
|
|
SFCommon,
|
|
|
|
SFCommon,
|
|
|
|
Messages,
|
|
|
|
Messages,
|
|
|
|
Util)
|
|
|
|
Util,
|
|
|
|
|
|
|
|
AppConfig)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var SaveAs = window.saveAs;
|
|
|
|
var SaveAs = window.saveAs;
|
|
|
|
|
|
|
|
|
|
|
@ -40,6 +42,9 @@ define([
|
|
|
|
READY: 'READY'
|
|
|
|
READY: 'READY'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var badStateTimeout = typeof(AppConfig.badStateTimeout) === 'number' ?
|
|
|
|
|
|
|
|
AppConfig.badStateTimeout : 30000;
|
|
|
|
|
|
|
|
|
|
|
|
var onConnectError = function () {
|
|
|
|
var onConnectError = function () {
|
|
|
|
Cryptpad.errorLoadingScreen(Messages.websocketError);
|
|
|
|
Cryptpad.errorLoadingScreen(Messages.websocketError);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -101,7 +106,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var stateChange = function (newState) {
|
|
|
|
var stateChange = function (newState) {
|
|
|
|
var wasEditable = (state === STATE.READY);
|
|
|
|
var wasEditable = (state === STATE.READY);
|
|
|
|
if (state === STATE.INFINITE_SPINNER) { return; }
|
|
|
|
if (state === STATE.INFINITE_SPINNER && newState !== STATE.READY) { return; }
|
|
|
|
if (newState === STATE.INFINITE_SPINNER) {
|
|
|
|
if (newState === STATE.INFINITE_SPINNER) {
|
|
|
|
state = newState;
|
|
|
|
state = newState;
|
|
|
|
} else if (state === STATE.DISCONNECTED && newState !== STATE.INITIALIZING) {
|
|
|
|
} else if (state === STATE.DISCONNECTED && newState !== STATE.INITIALIZING) {
|
|
|
@ -365,15 +370,27 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
textPatcher = TextPatcher.create({ realtime: cpNfInner.chainpad });
|
|
|
|
textPatcher = TextPatcher.create({ realtime: cpNfInner.chainpad });
|
|
|
|
|
|
|
|
|
|
|
|
cpNfInner.onInfiniteSpinner(function () {
|
|
|
|
window.setInterval(function () {
|
|
|
|
toolbar.failed();
|
|
|
|
if (state === STATE.DISCONNECTED) { return; }
|
|
|
|
cpNfInner.chainpad.abort();
|
|
|
|
var l;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
l = cpNfInner.chainpad.getLag();
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
throw new Error("ChainPad.getLag() does not exist, please `bower update`");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (l.lag < badStateTimeout) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
stateChange(STATE.INFINITE_SPINNER);
|
|
|
|
stateChange(STATE.INFINITE_SPINNER);
|
|
|
|
Cryptpad.confirm(Messages.realtime_unrecoverableError, function (yes) {
|
|
|
|
Cryptpad.confirm(Messages.realtime_unrecoverableError, function (yes) {
|
|
|
|
if (!yes) { return; }
|
|
|
|
if (!yes) { return; }
|
|
|
|
common.gotoURL();
|
|
|
|
common.gotoURL();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
cpNfInner.chainpad.onSettle(function () {
|
|
|
|
|
|
|
|
Cryptpad.findCancelButton().click();
|
|
|
|
|
|
|
|
stateChange(STATE.READY);
|
|
|
|
|
|
|
|
onRemote();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}, 2000);
|
|
|
|
|
|
|
|
|
|
|
|
//Cryptpad.onLogout(function () { ... });
|
|
|
|
//Cryptpad.onLogout(function () { ... });
|
|
|
|
|
|
|
|
|
|
|
|