Remove cryptpad-common dependency for some inner apps

This commit is contained in:
yflory
2017-11-13 18:09:19 +01:00
parent 1514ad5df3
commit 7cfe64fc5b
16 changed files with 35 additions and 173 deletions

View File

@@ -47,7 +47,6 @@ define([
var userNameKey = common.userNameKey = 'User_name';
var fileHashKey = common.fileHashKey = 'FS_hash';
common.displayNameKey = 'cryptpad.username';
var newPadNameKey = common.newPadNameKey = "newPadName";
var newPadPathKey = common.newPadPathKey = "newPadPath";
common.oldStorageKey = 'CryptPad_RECENTPADS';
common.storageKey = 'filesData';
@@ -716,19 +715,6 @@ define([
});
};
var errorHandlers = [];
common.onError = function (h) {
if (typeof h !== "function") { return; }
errorHandlers.push(h);
};
common.storeError = function () {
errorHandlers.forEach(function (h) {
if (typeof h === "function") {
h({type: "store"});
}
});
};
/*
* Buttons
*/
@@ -1145,10 +1131,6 @@ define([
return void setTimeout(function () { f(void 0, env); });
}
if (sessionStorage[newPadNameKey]) {
common.initialName = sessionStorage[newPadNameKey];
delete sessionStorage[newPadNameKey];
}
if (sessionStorage[newPadPathKey]) {
common.initialPath = sessionStorage[newPadPathKey];
delete sessionStorage[newPadPathKey];

View File

@@ -327,15 +327,6 @@ define([
// Drive already exist: return the existing drive, don't load data from legacy store
onReady(f, rt.proxy, Cryptpad, exp);
})
.on('disconnect', function (info) {
// We only manage errors during the loading screen here. Other websocket errors are handled by the apps
if (info.error) {
if (typeof Cryptpad.storeError === "function") {
Cryptpad.storeError();
}
return;
}
})
.on('change', ['drive', 'migrate'], function () {
var path = arguments[2];
var value = arguments[1];

View File

@@ -5,7 +5,6 @@ define([
'/bower_components/chainpad-json-validator/json-ot.js',
'json.sortify',
'/bower_components/textpatcher/TextPatcher.js',
'/common/cryptpad-common.js',
'/bower_components/nthen/index.js',
'/common/sframe-common.js',
'/customize/messages.js',
@@ -24,7 +23,6 @@ define([
JsonOT,
JSONSortify,
TextPatcher,
Cryptpad,
nThen,
SFCommon,
Messages,
@@ -49,10 +47,6 @@ define([
var badStateTimeout = typeof(AppConfig.badStateTimeout) === 'number' ?
AppConfig.badStateTimeout : 30000;
var onConnectError = function () {
UI.errorLoadingScreen(Messages.websocketError);
};
var create = function (options, cb) {
var evContentUpdate = Util.mkEvent();
var evEditableStateChange = Util.mkEvent();
@@ -258,7 +252,7 @@ define([
newContent = normalize(newContent);
contentUpdate(newContent);
} else {
title.updateTitle(Cryptpad.initialName || title.defaultTitle);
title.updateTitle(title.defaultTitle);
evOnDefaultContentNeeded.fire();
}
stateChange(STATE.READY);
@@ -441,12 +435,6 @@ define([
}, 2000);
//common.onLogout(function () { ... });
Cryptpad.onError(function (info) {
if (info && info.type === "store") {
onConnectError();
}
});
}).nThen(function (waitFor) {
if (readOnly) { $('body').addClass('cp-readonly'); }
@@ -478,7 +466,6 @@ define([
metadataMgr: cpNfInner.metadataMgr,
readOnly: readOnly,
realtime: cpNfInner.chainpad,
common: Cryptpad,
sfCommon: common,
$container: $(toolbarContainer),
$contentContainer: $(contentContainer)

View File

@@ -166,14 +166,6 @@ define([
sframeChan.event('EV_LOGOUT');
});
Cryptpad.onError(function (info) {
console.log('error');
console.log(info);
if (info && info.type === "store") {
//onConnectError();
}
});
sframeChan.on('Q_ANON_RPC_MESSAGE', function (data, cb) {
Cryptpad.anonRpcMsg(data.msg, data.content, function (err, response) {
cb({error: err, response: response});