use feedback api instead of app=

pull/1/head
ansuz 2017-04-13 12:18:08 +02:00
parent 86c37bfa37
commit df4a250359
7 changed files with 27 additions and 14 deletions

View File

@ -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") {

View File

@ -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 () {

View File

@ -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;

View File

@ -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") {

View File

@ -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,

View File

@ -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") {

View File

@ -618,6 +618,7 @@ window.canvas = canvas;
Cryptpad.ready(function (err, env) {
andThen();
Cryptpad.reportAppUsage();
});
Cryptpad.onError(function (info) {
if (info) {