Use the same network for the apps and the file store

pull/1/head
yflory 8 years ago
parent 004d4a16fe
commit 1e70af0c16

@ -155,6 +155,7 @@ define([
crypto: Crypto.createEncryptor(secret.keys),
setMyID: setMyID,
transformFunction: JsonOT.transform || JsonOT.validate,
network: Cryptpad.getNetwork()
};
var canonicalize = function (t) { return t.replace(/\r\n/g, '\n'); };

@ -43,6 +43,14 @@ define([
if (USE_FS_STORE && !legacy && fsStore) { return fsStore; }
throw new Error("Store is not ready!");
};
var getNetwork = common.getNetwork = function () {
if (USE_FS_STORE && fsStore) {
if (fsStore.getProxy() && fsStore.getProxy().info) {
return fsStore.getProxy().info.network;
}
}
return;
};
var getWebsocketURL = common.getWebsocketURL = function () {
if (!Config.websocketPath) { return Config.websocketURL; }

@ -688,9 +688,6 @@ define([
var before = JSON.stringify(files);
var fixRoot = function (elem) {
if (typeof(files[ROOT]) !== "object") { debug("ROOT was not an object"); files[ROOT] = {}; }
var element = elem || files[ROOT];

@ -376,6 +376,9 @@ define([
// the channel we will communicate over
channel: secret.channel,
// the nework used for the file store if it exists
network: Cryptpad.getNetwork(),
// our public key
validateKey: secret.keys.validateKey || undefined,
readOnly: readOnly,
@ -629,6 +632,11 @@ define([
var onReady = realtimeOptions.onReady = function (info) {
if (!APP.isMaximized) {
editor.execCommand('maximize');
// We have to call it 3 times in Safari in order to have the editor fully maximized -_-
if ((''+window.navigator.vendor).indexOf('Apple') !== -1) {
editor.execCommand('maximize');
editor.execCommand('maximize');
}
APP.isMaximized = true;
}

@ -698,20 +698,21 @@ define([
Cryptpad.alert(Messages.common_connectionLost);
};
var config = {
websocketURL: Cryptpad.getWebsocketURL(),
channel: secret.channel,
readOnly: readOnly,
data: {},
// our public key
validateKey: secret.keys.validateKey || undefined,
//readOnly: readOnly,
crypto: Crypto.createEncryptor(secret.keys),
userName: 'poll',
};
// don't initialize until the store is ready.
Cryptpad.ready(function () {
var config = {
websocketURL: Cryptpad.getWebsocketURL(),
channel: secret.channel,
readOnly: readOnly,
data: {},
// our public key
validateKey: secret.keys.validateKey || undefined,
//readOnly: readOnly,
crypto: Crypto.createEncryptor(secret.keys),
userName: 'poll',
network: Cryptpad.getNetwork()
};
if (readOnly) {
$('#commit, #create-user, #create-option, #publish, #admin').remove();
}

@ -195,7 +195,8 @@ define([
readOnly: readOnly,
crypto: Crypto.createEncryptor(secret.keys),
setMyID: setMyID,
transformFunction: JsonOT.validate
transformFunction: JsonOT.validate,
network: Cryptpad.getNetwork()
};
var canonicalize = function (t) { return t.replace(/\r\n/g, '\n'); };

Loading…
Cancel
Save