').append($shareIcon).html(),
options: options,
feedback: 'SHARE_MENU',
+ common: Common
};
var $shareBlock = UIElements.createDropdown(dropdownConfigShare);
$shareBlock.find('.cp-dropdown-content').addClass(SHARE_CLS).addClass(EDITSHARE_CLS).addClass(VIEWSHARE_CLS);
@@ -583,6 +585,7 @@ define([
text: $('
').append($shareIcon).html(),
options: options,
feedback: 'FILESHARE_MENU',
+ common: Common
};
var $shareBlock = UIElements.createDropdown(dropdownConfigShare);
$shareBlock.find('.cp-dropdown-content').addClass(SHARE_CLS);
@@ -868,6 +871,7 @@ define([
left: true,
feedback: /drive/.test(window.location.pathname)?
'DRIVE_NEWPAD': 'NEWPAD',
+ common: Common
};
var $newPadBlock = UIElements.createDropdown(dropdownConfig);
$newPadBlock.find('button').attr('title', Messages.newButtonTitle);
@@ -909,7 +913,7 @@ define([
UI.prompt(Messages.changeNamePrompt, lastName || '', function (newName) {
if (newName === null && typeof(lastName) === "string") { return; }
if (newName === null) { newName = ''; }
- else { Common.feedback('NAME_CHANGED'); }
+ else { Feedback.send('NAME_CHANGED'); }
setDisplayName(newName);
});
});
diff --git a/www/drive/inner.js b/www/drive/inner.js
index e105ff47f..d284612b4 100644
--- a/www/drive/inner.js
+++ b/www/drive/inner.js
@@ -8,7 +8,7 @@ define([
'/common/common-ui-elements.js',
'/common/common-interface.js',
'/common/common-constants.js',
- '/common/cryptget.js',
+ '/common/common-feedback.js',
'/bower_components/nthen/index.js',
'/common/sframe-common.js',
'/common/common-realtime.js',
@@ -30,7 +30,7 @@ define([
UIElements,
UI,
Constants,
- Cryptget,
+ Feedback,
nThen,
SFCommon,
CommonRealtime,
@@ -1417,7 +1417,7 @@ define([
setViewMode('list');
$('#' + FOLDER_CONTENT_ID).removeClass('cp-app-drive-content-grid');
$('#' + FOLDER_CONTENT_ID).addClass('cp-app-drive-content-list');
- common.feedback('DRIVE_LIST_MODE');
+ Feedback.send('DRIVE_LIST_MODE');
});
$gridButton.click(function () {
$listButton.removeClass('cp-app-drive-toolbar-active');
@@ -1425,7 +1425,7 @@ define([
setViewMode('grid');
$('#' + FOLDER_CONTENT_ID).addClass('cp-app-drive-content-grid');
$('#' + FOLDER_CONTENT_ID).removeClass('cp-app-drive-content-list');
- common.feedback('DRIVE_GRID_MODE');
+ Feedback.send('DRIVE_GRID_MODE');
});
if (getViewMode() === 'list') {
@@ -1548,6 +1548,7 @@ define([
text: $plusIcon.html() + ''+Messages.fm_newButton+'',
options: options,
feedback: 'DRIVE_NEWPAD_LOCALFOLDER',
+ common: common
};
var $block = UIElements.createDropdown(dropdownConfig);
@@ -2946,7 +2947,7 @@ define([
}).nThen(function (/* waitFor */) {
APP.loggedIn = common.isLoggedIn();
APP.SFCommon = common;
- if (!APP.loggedIn) { common.feedback('ANONYMOUS_DRIVE'); }
+ if (!APP.loggedIn) { Feedback.send('ANONYMOUS_DRIVE'); }
APP.$body = $('body');
APP.$bar = $('#cp-toolbar');
diff --git a/www/drive/main.js b/www/drive/main.js
index 3b78bea72..438290f34 100644
--- a/www/drive/main.js
+++ b/www/drive/main.js
@@ -5,9 +5,9 @@ define([
'jquery',
'/common/requireconfig.js',
'/common/sframe-common-outer.js',
- '/common/cryptpad-common.js',
+ '/common/outer/network-config.js',
'/bower_components/netflux-websocket/netflux-client.js',
-], function (nThen, ApiConfig, $, RequireConfig, SFCommonO, Cryptpad, Netflux) {
+], function (nThen, ApiConfig, $, RequireConfig, SFCommonO, NetConfig, Netflux) {
var requireConfig = RequireConfig();
// Loaded in load #2
@@ -39,10 +39,11 @@ define([
window.addEventListener('message', onMsg);
}).nThen(function (/*waitFor*/) {
var getSecrets = function (Cryptpad, Utils) {
- var hash = window.location.hash.slice(1) || Cryptpad.getUserHash() || localStorage.FS_hash;
+ var hash = window.location.hash.slice(1) || Utils.LocalStore.getUserHash() ||
+ Utils.LocalStore.getFSHash();
return Utils.Hash.getSecrets('drive', hash);
};
- Netflux.connect(Cryptpad.getWebsocketURL()).then(function (network) {
+ Netflux.connect(NetConfig.getWebsocketURL()).then(function (network) {
SFCommonO.start({
getSecrets: getSecrets,
newNetwork: network,
diff --git a/www/filepicker/main.js b/www/filepicker/main.js
index df6ade62b..d628b401c 100644
--- a/www/filepicker/main.js
+++ b/www/filepicker/main.js
@@ -37,10 +37,10 @@ define([
};
window.addEventListener('message', onMsg);
}).nThen(function (/*waitFor*/) {
- var Cryptpad;
+ var Cryptpad = config.modules.Cryptpad;
+ var Utils = config.modules.Utils;
nThen(function (waitFor) {
- Cryptpad = config.modules.Cryptpad;
config.modules.SFrameChannel.create($('#sbox-filePicker-iframe')[0].contentWindow,
waitFor(function (sfc) {
sframeChan = sfc;
@@ -67,10 +67,10 @@ define([
netfluxId: Cryptpad.getNetwork().webChannels[0].myID,
},
priv: {
- accountName: Cryptpad.getAccountName(),
+ accountName: Utils.LocalStore.getAccountName(),
origin: window.location.origin,
pathname: window.location.pathname,
- feedbackAllowed: Cryptpad.isFeedbackAllowed(),
+ feedbackAllowed: Utils.Feedback.state,
friends: proxy.friends || {},
settings: proxy.settings || {},
types: config.types
diff --git a/www/invite/main.js b/www/invite/main.js
index 7e10abca5..97f64ab8e 100644
--- a/www/invite/main.js
+++ b/www/invite/main.js
@@ -81,7 +81,6 @@ define([
APP.$container = $('#container');
Cryptpad.ready(function () {
- Cryptpad.reportAppUsage();
andThen();
});
});
diff --git a/www/login/main.js b/www/login/main.js
index 47e626753..ce3aa8835 100644
--- a/www/login/main.js
+++ b/www/login/main.js
@@ -4,9 +4,11 @@ define([
'/common/login.js',
'/common/common-interface.js',
'/common/common-realtime.js',
+ '/common/common-feedback.js',
+ '/common/outer/local-store.js',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
-], function ($, Cryptpad, Login, UI, Realtime) {
+], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore) {
$(function () {
var $main = $('#mainBlock');
var Messages = Cryptpad.Messages;
@@ -17,7 +19,7 @@ define([
// Make sure we don't display non-translated content (empty button)
$main.find('#data').removeClass('hidden');
- if (Cryptpad.isLoggedIn()) {
+ if (LocalStore.isLoggedIn()) {
// already logged in, redirect to drive
document.location.href = '/drive/';
return;
@@ -83,9 +85,9 @@ define([
proxy.curvePrivate = result.curvePrivate;
proxy.curvePublic = result.curvePublic;
- Cryptpad.feedback('LOGIN', true);
+ Feedback.send('LOGIN', true);
Realtime.whenRealtimeSyncs(result.realtime, function() {
- Cryptpad.login(result.userHash, result.userName, function () {
+ LocalStore.login(result.userHash, result.userName, function () {
hashing = false;
if (sessionStorage.redirectTo) {
var h = sessionStorage.redirectTo;
diff --git a/www/profile/main.js b/www/profile/main.js
index 99afcef06..195dbdc6b 100644
--- a/www/profile/main.js
+++ b/www/profile/main.js
@@ -48,7 +48,7 @@ define([
return Hash.getSecrets('profile', obj.profile.edit);
}
// 3rd case: profile creation (create a new random hash, store it later if needed)
- if (!Cryptpad.isLoggedIn()) { return; }
+ if (!Utils.LocalStore.isLoggedIn()) { return; }
var hash = Hash.createRandomHash();
var secret = Hash.getSecrets('profile', hash);
Cryptpad.pinPads([secret.channel], function (e) {
diff --git a/www/register/main.js b/www/register/main.js
index 41ac6c81b..295f6acf0 100644
--- a/www/register/main.js
+++ b/www/register/main.js
@@ -8,9 +8,11 @@ define([
'/common/common-util.js',
'/common/common-realtime.js',
'/common/common-constants.js',
+ '/common/common-feedback.js',
+ '/common/outer/local-store.js',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
-], function ($, Login, Cryptpad, Test, Cred, UI, Util, Realtime, Constants) {
+], function ($, Login, Cryptpad, Test, Cred, UI, Util, Realtime, Constants, Feedback, LocalStore) {
var Messages = Cryptpad.Messages;
$(function () {
@@ -22,7 +24,7 @@ define([
// Make sure we don't display non-translated content (empty button)
$main.find('#data').removeClass('hidden');
- if (Cryptpad.isLoggedIn()) {
+ if (LocalStore.isLoggedIn()) {
// already logged in, redirect to drive
document.location.href = '/drive/';
return;
@@ -66,10 +68,10 @@ define([
proxy.curvePublic = result.curvePublic;
proxy.curvePrivate = result.curvePrivate;
- Cryptpad.feedback('REGISTRATION', true);
+ Feedback.send('REGISTRATION', true);
Realtime.whenRealtimeSyncs(result.realtime, function () {
- Cryptpad.login(result.userHash, result.userName, function () {
+ LocalStore.login(result.userHash, result.userName, function () {
registering = false;
if (sessionStorage.redirectTo) {
var h = sessionStorage.redirectTo;
@@ -178,7 +180,7 @@ define([
if (!proxy[Constants.displayNameKey]) {
proxy[Constants.displayNameKey] = uname;
}
- Cryptpad.eraseTempSessionValues();
+ LocalStore.eraseTempSessionValues();
logMeIn(result);
});
});
@@ -192,7 +194,7 @@ define([
if (Test.testing) { return void logMeIn(result); }
- Cryptpad.eraseTempSessionValues();
+ LocalStore.eraseTempSessionValues();
if (shouldImport) {
sessionStorage.migrateAnonDrive = 1;
}
diff --git a/www/settings/main.js b/www/settings/main.js
index 9c4bd42ec..958dcda45 100644
--- a/www/settings/main.js
+++ b/www/settings/main.js
@@ -38,7 +38,7 @@ define([
}).nThen(function (/*waitFor*/) {
var addRpc = function (sframeChan, Cryptpad, Utils) {
sframeChan.on('Q_THUMBNAIL_CLEAR', function (d, cb) {
- Cryptpad.clearThumbnail(function (err, data) {
+ Utils.LocalStore.clearThumbnail(function (err, data) {
cb({err:err, data:data});
});
});
@@ -49,9 +49,8 @@ define([
var sjson = JSON.stringify(data);
require([
'/common/cryptget.js',
- '/common/common-constants.js'
- ], function (Crypt, Constants) {
- var k = Cryptpad.getUserHash() || localStorage[Constants.fileHashKey];
+ ], function (Crypt) {
+ var k = Utils.LocalStore.getUserHash() || Utils.LocalStore.getFSHash();
Crypt.put(k, sjson, function (err) {
cb(err);
});
@@ -75,9 +74,8 @@ define([
var proxyData = Cryptpad.getStore().getProxy();
require([
'/common/mergeDrive.js',
- '/common/common-constants.js'
- ], function (Merge, Constants) {
- Merge.anonDriveIntoUser(proxyData, localStorage[Constants.fileHashKey], cb);
+ ], function (Merge) {
+ Merge.anonDriveIntoUser(proxyData, Utils.LocalStore.getFSHash(), cb);
});
});
};
diff --git a/www/user/main.js b/www/user/main.js
index 37323a2ee..45d1892a5 100644
--- a/www/user/main.js
+++ b/www/user/main.js
@@ -32,16 +32,7 @@ define([
APP.$container = $('#container');
- Cryptpad.ready(function () {
- //if (!Cryptpad.getUserHash()) { return redirectToMain(); }
-
- //var storeObj = Cryptpad.getStore().getProxy && Cryptpad.getStore().getProxy().proxy
- // ? Cryptpad.getStore().getProxy() : undefined;
-
- //andThen(storeObj);
- andThen();
- Cryptpad.reportAppUsage();
- });
+ andThen();
});
});