Put constants in a separate file
This commit is contained in:
@@ -36,17 +36,6 @@ define([
|
||||
};
|
||||
window.addEventListener('message', onMsg);
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
/* TODO
|
||||
window.addEventListener('storage', function (e) {
|
||||
if (e.key !== Cryptpad.userHashKey) { return; }
|
||||
var o = e.oldValue;
|
||||
var n = e.newValue;
|
||||
window.location.reload();
|
||||
if (o && !n) { // disconnect
|
||||
//redirectToMain();
|
||||
}
|
||||
});
|
||||
*/
|
||||
var addRpc = function (sframeChan, Cryptpad, Utils) {
|
||||
sframeChan.on('Q_THUMBNAIL_CLEAR', function (d, cb) {
|
||||
Cryptpad.clearThumbnail(function (err, data) {
|
||||
@@ -58,8 +47,11 @@ define([
|
||||
});
|
||||
sframeChan.on('Q_SETTINGS_DRIVE_SET', function (data, cb) {
|
||||
var sjson = JSON.stringify(data);
|
||||
var k = Cryptpad.getUserHash() || localStorage[Cryptpad.fileHashKey];
|
||||
require(['/common/cryptget.js'], function (Crypt) {
|
||||
require([
|
||||
'/common/cryptget.js',
|
||||
'/common/common-constants.js'
|
||||
], function (Crypt, Constants) {
|
||||
var k = Cryptpad.getUserHash() || localStorage[Constants.fileHashKey];
|
||||
Crypt.put(k, sjson, function (err) {
|
||||
cb(err);
|
||||
});
|
||||
@@ -81,8 +73,11 @@ define([
|
||||
});
|
||||
sframeChan.on('Q_SETTINGS_IMPORT_LOCAL', function (data, cb) {
|
||||
var proxyData = Cryptpad.getStore().getProxy();
|
||||
require(['/common/mergeDrive.js'], function (Merge) {
|
||||
Merge.anonDriveIntoUser(proxyData, localStorage.FS_hash, cb);
|
||||
require([
|
||||
'/common/mergeDrive.js',
|
||||
'/common/common-constants.js'
|
||||
], function (Merge, Constants) {
|
||||
Merge.anonDriveIntoUser(proxyData, localStorage[Constants.fileHashKey], cb);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user