diff --git a/www/code/main.js b/www/code/main.js index 87298cbf5..ebdb90167 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -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'); }; diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 0bf419a24..2378b70f2 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -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; } diff --git a/www/file/fileObject.js b/www/file/fileObject.js index eb4af97d6..e29adfb20 100644 --- a/www/file/fileObject.js +++ b/www/file/fileObject.js @@ -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]; diff --git a/www/pad/main.js b/www/pad/main.js index 09c2be0f4..6fbf46428 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -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; } diff --git a/www/poll/main.js b/www/poll/main.js index e689d33a4..a0b9e5273 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -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(); } diff --git a/www/slide/main.js b/www/slide/main.js index adf27c3f1..cd8180b0f 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -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'); };