Remove util and hash from common

This commit is contained in:
yflory
2017-11-13 16:32:40 +01:00
parent c9e1de042c
commit 30c8c253dd
38 changed files with 414 additions and 3114 deletions

View File

@@ -3,8 +3,11 @@ define([
'/bower_components/chainpad-crypto/crypto.js',
'/bower_components/chainpad-netflux/chainpad-netflux.js',
'/common/cryptpad-common.js',
'/common/common-util.js',
'/common/common-hash.js',
'/common/common-realtime.js',
'/bower_components/textpatcher/TextPatcher.js'
], function ($, Crypto, Realtime, Cryptpad, TextPatcher) {
], function ($, Crypto, CPNetflux, Cryptpad, Util, Hash, Realtime, TextPatcher) {
//var Messages = Cryptpad.Messages;
//var noop = function () {};
var finish = function (S, err, doc) {
@@ -12,9 +15,9 @@ define([
S.cb(err, doc);
S.done = true;
var disconnect = Cryptpad.find(S, ['network', 'disconnect']);
var disconnect = Util.find(S, ['network', 'disconnect']);
if (typeof(disconnect) === 'function') { disconnect(); }
var abort = Cryptpad.find(S, ['realtime', 'realtime', 'abort']);
var abort = Util.find(S, ['realtime', 'realtime', 'abort']);
if (typeof(abort) === 'function') {
S.realtime.realtime.sync();
abort();
@@ -23,7 +26,7 @@ define([
var makeConfig = function (hash) {
// We can't use cryptget with a file or a user so we can use 'pad' as hash type
var secret = Cryptpad.getSecrets('pad', hash);
var secret = Hash.getSecrets('pad', hash);
if (!secret.keys) { secret.keys = secret.key; } // support old hashses
var config = {
websocketURL: Cryptpad.getWebsocketURL(),
@@ -58,7 +61,7 @@ define([
};
overwrite(config, opt);
Session.realtime = Realtime.start(config);
Session.realtime = CPNetflux.start(config);
};
var put = function (hash, doc, cb, opt) {
@@ -80,7 +83,7 @@ define([
cb(new Error("Timeout"));
}, 5000);
Cryptpad.whenRealtimeSyncs(realtime, function () {
Realtime.whenRealtimeSyncs(realtime, function () {
window.clearTimeout(to);
realtime.abort();
finish(Session, void 0);
@@ -88,7 +91,7 @@ define([
};
overwrite(config, opt);
Session.session = Realtime.start(config);
Session.session = CPNetflux.start(config);
};
return {