From 9ca5bc507e7b759c2782c7084487111c44c9ad93 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 30 May 2017 15:42:53 +0200 Subject: [PATCH] add support for donate button --- www/common/cryptpad-common.js | 13 +++++++++++-- www/common/toolbar2.js | 21 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index ae73867de..ddad01e68 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -25,7 +25,9 @@ define([ */ var common = window.Cryptpad = { Messages: Messages, - Clipboard: Clipboard + Clipboard: Clipboard, + donateURL: 'https://accounts.cryptpad.fr/#/donate?on=' + window.location.hostname, + account: {}, }; // constants @@ -1428,6 +1430,14 @@ define([ console.log('RPC handshake complete'); rpc = common.rpc = env.rpc = call; + common.getPinLimit(function (e, limit, plan, note) { + if (e) { return void console.error(e); } + common.account.limit = limit; + common.account.plan = plan; + common.account.note = note; + cb(); + }); + common.arePinsSynced(function (err, yes) { if (!yes) { common.resetPins(function (err) { @@ -1436,7 +1446,6 @@ define([ }); } }); - cb(); }); } else if (PINNING_ENABLED) { console.log('not logged in. pads will not be pinned'); diff --git a/www/common/toolbar2.js b/www/common/toolbar2.js index a17e24199..127fce91d 100644 --- a/www/common/toolbar2.js +++ b/www/common/toolbar2.js @@ -33,6 +33,7 @@ define([ var LIMIT_CLS = Bar.constants.lag = 'cryptpad-limit'; var TITLE_CLS = Bar.constants.title = "cryptpad-title"; var NEWPAD_CLS = Bar.constants.newpad = "cryptpad-newpad"; + var UPGRADE_CLS = Bar.constants.upgrade = "cryptpad-upgrade"; // User admin menu var USERADMIN_CLS = Bar.constants.user = 'cryptpad-user-dropdown'; @@ -70,6 +71,7 @@ define([ var $userContainer = $('', { 'class': USER_CLS }).appendTo($topContainer); + $('