diff --git a/www/code/main.js b/www/code/main.js index 227c1e1fa..bdad4cdb6 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -733,6 +733,7 @@ define([ var second = function (CM) { Cryptpad.ready(function (err, env) { andThen(CM); + Cryptpad.reportAppUsage(); }); Cryptpad.onError(function (info) { if (info && info.type === "store") { diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 7fc848d24..4cc0531f7 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1,11 +1,10 @@ define([ '/api/config', - '/customize/messages.js?app=' + window.location.pathname.split('/').filter(function (x) { return x; }).join('.'), + '/customize/messages.js', '/common/fsStore.js', '/common/common-util.js', '/common/hash.js', - '/bower_components/chainpad-crypto/crypto.js?v=0.1.5', '/bower_components/alertifyjs/dist/js/alertify.js', '/common/clipboard.js', '/common/pinpad.js', /* TODO @@ -13,7 +12,7 @@ load pinpad dynamically only after you know that it will be needed */ '/customize/application_config.js', '/bower_components/jquery/dist/jquery.min.js', -], function (Config, Messages, Store, Util, Hash, Crypto, Alertify, Clipboard, Pinpad, AppConfig) { +], function (Config, Messages, Store, Util, Hash, Alertify, Clipboard, Pinpad, AppConfig) { /* This file exposes functionality which is specific to Cryptpad, but not to any particular pad type. This includes functions for committing metadata about pads to your local storage for future use and improved usability. @@ -28,6 +27,25 @@ load pinpad dynamically only after you know that it will be needed */ Clipboard: Clipboard }; + var feedback = common.feedback = function (action) { + if (!action) { return; } + try { + if (!getStore().getProxy().proxy.allowUserFeedback) { return; } + } catch (e) { return void console.error(e); } + + var href = '/common/feedback.html?' + action + '=' + (+new Date()); + $.ajax({ + type: "HEAD", + url: href, + }); + }; + + var reportAppUsage = common.reportAppUsage = function () { + var pattern = window.location.pathname.split('/') + .filter(function (x) { return x; }).join('.'); + feedback(pattern); + }; + // constants var userHashKey = common.userHashKey = 'User_hash'; var userNameKey = common.userNameKey = 'User_name'; @@ -104,17 +122,6 @@ load pinpad dynamically only after you know that it will be needed */ return; }; - common.feedback = function (action) { - if (!action) { return; } - try { - if (!getStore().getProxy().proxy.allowUserFeedback) { return; } - } catch (e) { return void console.error(e); } - $.ajax({ - type: "HEAD", - url: '/common/feedback.html?' + action + '=' + (+new Date()), - }); - }; - var whenRealtimeSyncs = common.whenRealtimeSyncs = function (realtime, cb) { realtime.sync(); window.setTimeout(function () { diff --git a/www/drive/main.js b/www/drive/main.js index 474ea4b06..b8441c0c7 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -2243,6 +2243,7 @@ define([ // don't initialize until the store is ready. Cryptpad.ready(function () { + Cryptpad.reportAppUsage(); APP.$bar = $iframe.find('#toolbar'); var storeObj = Cryptpad.getStore().getProxy && Cryptpad.getStore().getProxy().proxy ? Cryptpad.getStore().getProxy() : undefined; diff --git a/www/pad/main.js b/www/pad/main.js index 1170e3008..4d9cd0244 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -810,6 +810,7 @@ define([ var second = function (Ckeditor) { Cryptpad.ready(function (err, env) { andThen(Ckeditor); + Cryptpad.reportAppUsage(); }); Cryptpad.onError(function (info) { if (info && info.type === "store") { diff --git a/www/poll/main.js b/www/poll/main.js index b3265531e..aa3dceabf 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -782,6 +782,7 @@ define([ // don't initialize until the store is ready. Cryptpad.ready(function () { + Cryptpad.reportAppUsage(); var config = { websocketURL: Cryptpad.getWebsocketURL(), channel: secret.channel, diff --git a/www/slide/main.js b/www/slide/main.js index 25c367a85..9acc6527e 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -929,6 +929,7 @@ define([ var second = function (CM) { Cryptpad.ready(function (err, env) { andThen(CM); + Cryptpad.reportAppUsage(); }); Cryptpad.onError(function (info) { if (info && info.type === "store") { diff --git a/www/whiteboard/main.js b/www/whiteboard/main.js index c28ad84c8..938505d50 100644 --- a/www/whiteboard/main.js +++ b/www/whiteboard/main.js @@ -618,6 +618,7 @@ window.canvas = canvas; Cryptpad.ready(function (err, env) { andThen(); + Cryptpad.reportAppUsage(); }); Cryptpad.onError(function (info) { if (info) {