From 85dbd5cb6e6d863efd8ab318de7b6902c0c540fe Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 3 Jun 2016 17:27:01 +0200 Subject: [PATCH] pass in websocketURL from main --- www/common/chainpad-listmap.js | 9 ++++++--- www/json/main.js | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/www/common/chainpad-listmap.js b/www/common/chainpad-listmap.js index fe0c1b1ec..3e7fe8c8f 100644 --- a/www/common/chainpad-listmap.js +++ b/www/common/chainpad-listmap.js @@ -1,6 +1,5 @@ require.config({ paths: { 'json.sortify': '/bower_components/json.sortify/dist/JSON.sortify' } }); define([ - '/api/config?cb=' + Math.random().toString(16).substring(2), '/common/crypto.js', '/common/realtime-input.js', '/bower_components/chainpad-json-validator/json-ot.js', @@ -8,7 +7,7 @@ define([ '/bower_components/textpatcher/TextPatcher.amd.js', '/bower_components/jquery/dist/jquery.min.js', '/bower_components/proxy-polyfill/proxy.min.js', // https://github.com/GoogleChrome/proxy-polyfill -], function (Config, Crypto, Realtime, JsonOT, Sortify, TextPatcher) { +], function (Crypto, Realtime, JsonOT, Sortify, TextPatcher) { var api = {}; // linter complains if this isn't defined var Proxy = window.Proxy; @@ -67,6 +66,10 @@ define([ create: [], }; + /* TODO implement 'off' as well. + change 'setter' to warn users when they attempt to set 'off' + */ + var on = function (evt, pattern, f) { switch (evt) { case 'change': @@ -547,7 +550,7 @@ define([ channel: cfg.channel, cryptKey: cfg.cryptKey, crypto: Crypto, - websocketURL: Config.websocketURL, + websocketURL: cfg.websocketURL, logLevel: 0 }; diff --git a/www/json/main.js b/www/json/main.js index 02e3a63c9..64f1ac552 100644 --- a/www/json/main.js +++ b/www/json/main.js @@ -1,14 +1,16 @@ define([ + '/api/config?cb=' + Math.random().toString(16).substring(2), '/common/chainpad-listmap.js', '/common/crypto.js', '/common/cryptpad-common.js', //'/customize/pad.js' -], function (RtListMap, Crypto, Common) { +], function (Config, RtListMap, Crypto, Common) { var $ = window.jQuery; var secret = Common.getSecrets(); var config = { + websocketURL: Config.websocketURL, channel: secret.channel, cryptKey: secret.key, data: {},