');
var $icon = $('', {'rowspan': '3', 'class': 'cp-app-drive-search-icon'})
.append(getFileIcon(href));
@@ -2447,13 +2449,13 @@ define([
if (!filesOp.isFile(id)) { return; }
var data = filesOp.getFileData(id);
if (!data) { return; }
- var parsed = Cryptpad.parsePadUrl(data.href);
+ var parsed = Hash.parsePadUrl(data.href);
if (parsed.hashData.type !== "pad") { return; }
var i = data.href.indexOf('#') + 1;
var base = data.href.slice(0, i);
- var hrefsecret = Cryptpad.getSecrets(parsed.type, parsed.hash);
+ var hrefsecret = Hash.getSecrets(parsed.type, parsed.hash);
if (!hrefsecret.keys) { return; }
- var viewHash = Cryptpad.getViewHashFromKeys(hrefsecret.channel, hrefsecret.keys);
+ var viewHash = Hash.getViewHashFromKeys(hrefsecret.channel, hrefsecret.keys);
return base + viewHash;
};
@@ -2486,7 +2488,7 @@ define([
}));
}
- var parsed = Cryptpad.parsePadUrl(data.href);
+ var parsed = Hash.parsePadUrl(data.href);
if (parsed.hashData && parsed.hashData.type === 'pad') {
var roLink = ro ? base + data.href : base + getReadOnlyUrl(el);
if (roLink) {
@@ -2528,7 +2530,7 @@ define([
return void cb(void 0, $d);
}
- var KB = Cryptpad.bytesToKilobytes(bytes);
+ var KB = Util.bytesToKilobytes(bytes);
var formatted = Messages._getKey('formattedKB', [KB]);
$(' ').appendTo($d);
diff --git a/www/drive/main.js b/www/drive/main.js
index 5a46b8f6b..3b78bea72 100644
--- a/www/drive/main.js
+++ b/www/drive/main.js
@@ -38,9 +38,9 @@ define([
};
window.addEventListener('message', onMsg);
}).nThen(function (/*waitFor*/) {
- var getSecrets = function (Cryptpad) {
+ var getSecrets = function (Cryptpad, Utils) {
var hash = window.location.hash.slice(1) || Cryptpad.getUserHash() || localStorage.FS_hash;
- return Cryptpad.getSecrets('drive', hash);
+ return Utils.Hash.getSecrets('drive', hash);
};
Netflux.connect(Cryptpad.getWebsocketURL()).then(function (network) {
SFCommonO.start({
diff --git a/www/file/inner.js b/www/file/inner.js
index ecd449df2..09a302b0a 100644
--- a/www/file/inner.js
+++ b/www/file/inner.js
@@ -2,12 +2,13 @@ define([
'jquery',
'/bower_components/chainpad-crypto/crypto.js',
'/common/toolbar3.js',
- '/common/cryptpad-common.js',
'/bower_components/nthen/index.js',
'/common/sframe-common.js',
'/common/common-realtime.js',
'/common/common-util.js',
+ '/common/common-hash.js',
'/common/common-interface.js',
+ '/customize/messages.js',
'/file/file-crypto.js',
'/common/media-tag.js',
@@ -22,22 +23,20 @@ define([
$,
Crypto,
Toolbar,
- Cryptpad,
nThen,
SFCommon,
CommonRealtime,
Util,
+ Hash,
UI,
+ Messages,
FileCrypto,
MediaTag)
{
- var Messages = Cryptpad.Messages;
var saveAs = window.saveAs;
var Nacl = window.nacl;
- var APP = window.APP = {
- Cryptpad: Cryptpad,
- };
+ var APP = window.APP = {};
var andThen = function (common) {
var $appContainer = $('#cp-app-file-content');
@@ -62,9 +61,9 @@ define([
if (!priv.filehash) {
uploadMode = true;
} else {
- secret = Cryptpad.getSecrets('file', priv.filehash);
+ secret = Hash.getSecrets('file', priv.filehash);
if (!secret.keys) { throw new Error("You need a hash"); }
- hexFileName = Cryptpad.base64ToHex(secret.channel);
+ hexFileName = Util.base64ToHex(secret.channel);
}
var Title = common.createTitle({});
@@ -74,7 +73,6 @@ define([
}
var configTb = {
displayed: displayed,
- common: Cryptpad,
//hideDisplayName: true,
$container: $bar,
metadataMgr: metadataMgr,
@@ -88,7 +86,7 @@ define([
toolbar.$rightside.html('');
if (!uploadMode) {
- var src = Cryptpad.getBlobPathFromHex(hexFileName);
+ var src = Hash.getBlobPathFromHex(hexFileName);
var cryptKey = secret.keys && secret.keys.fileKeyStr;
var key = Nacl.util.decodeBase64(cryptKey);
@@ -110,7 +108,7 @@ define([
var $mt = $dlview.find('media-tag');
var cryptKey = secret.keys && secret.keys.fileKeyStr;
- var hexFileName = Cryptpad.base64ToHex(secret.channel);
+ var hexFileName = Util.base64ToHex(secret.channel);
$mt.attr('src', '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName);
$mt.attr('data-crypto-key', 'cryptpad:'+cryptKey);
@@ -232,7 +230,7 @@ define([
if (e) {
return void UI.errorLoadingScreen(e);
}
- var size = Cryptpad.bytesToMegabytes(data);
+ var size = Util.bytesToMegabytes(data);
return void todoBigFile(size);
});
});
diff --git a/www/filepicker/inner.js b/www/filepicker/inner.js
index e83578668..ccf332d87 100644
--- a/www/filepicker/inner.js
+++ b/www/filepicker/inner.js
@@ -8,6 +8,8 @@ define([
'/common/sframe-common.js',
'/common/common-interface.js',
'/common/common-ui-elements.js',
+ '/common/common-util.js',
+ '/common/common-hash.js',
'json.sortify',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
@@ -23,6 +25,8 @@ define([
SFCommon,
UI,
UIElements,
+ Util,
+ Hash,
Sortify)
{
var Messages = Cryptpad.Messages;
@@ -45,10 +49,10 @@ define([
sframeChan.event('EV_FILE_PICKER_CLOSE');
};
var onFilePicked = function (data) {
- var parsed = Cryptpad.parsePadUrl(data.url);
+ var parsed = Hash.parsePadUrl(data.url);
hideFileDialog();
if (parsed.type === 'file') {
- var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
+ var hexFileName = Util.base64ToHex(parsed.hashData.channel);
var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
sframeChan.event("EV_FILE_PICKED", {
type: parsed.type,
diff --git a/www/invite/main.js b/www/invite/main.js
index 7acaa5589..7e10abca5 100644
--- a/www/invite/main.js
+++ b/www/invite/main.js
@@ -2,10 +2,11 @@ define([
'jquery',
'/common/cryptpad-common.js',
'/common/common-interface.js',
+ //'/common/common-hash.js',
//'/bower_components/chainpad-listmap/chainpad-listmap.js',
//'/common/curve.js',
'less!/invite/main.less',
-], function ($, Cryptpad, UI /*, Listmap, Curve*/) {
+], function ($, Cryptpad, UI/*, Hash , Listmap, Curve*/) {
var Messages = Cryptpad.Messages;
var comingSoon = function () {
return $('', {
@@ -34,7 +35,7 @@ define([
var andThen = function () {
var hash = window.location.hash.slice(1);
- var info = Cryptpad.parseTypeHash('invite', hash);
+ var info = Hash.parseTypeHash('invite', hash);
console.log(info);
if (!info.pubkey) {
diff --git a/www/oldsettings/index.html b/www/oldsettings/index.html
deleted file mode 100644
index 31d4c99f8..000000000
--- a/www/oldsettings/index.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- CryptPad: Zero Knowledge, Collaborative Real Time Editing
-
-
-
-
-
-
-
-
diff --git a/www/oldsettings/main.js b/www/oldsettings/main.js
deleted file mode 100644
index 57b61268d..000000000
--- a/www/oldsettings/main.js
+++ /dev/null
@@ -1,569 +0,0 @@
-define([
- 'jquery',
- '/common/cryptpad-common.js',
- '/common/cryptget.js',
- '/common/mergeDrive.js',
- '/common/toolbar2.js',
- '/bower_components/file-saver/FileSaver.min.js',
-
- 'less!/customize/src/less/cryptpad.less',
- 'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
- 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
- 'less!/customize/src/less/toolbar.less',
- 'less!/settings/main.less',
-], function ($, Cryptpad, Crypt, Merge, Toolbar) {
- var saveAs = window.saveAs;
-
- var USERNAME_KEY = 'cryptpad.username';
-
- var APP = window.APP = {
- Cryptpad: Cryptpad,
- _onRefresh: []
- };
-
- var Messages = Cryptpad.Messages;
-
- // Manage changes in the realtime object made from another page
- var onRefresh = function (h) {
- if (typeof(h) !== "function") { return; }
- if (APP._onRefresh.indexOf(h) !== -1) { return; }
- APP._onRefresh.push(h);
- };
- var refresh = APP.refresh = function () {
- APP._onRefresh.forEach(function (h) {
- h();
- });
- };
-
- var categories = {
- 'account': [
- 'infoBlock',
- 'displayName',
- 'languageSelector',
- 'logoutEverywhere',
- 'resetTips',
- 'thumbnails',
- 'userFeedback'
- ],
- 'drive': [
- 'backupDrive',
- 'importLocalPads',
- 'resetDrive'
- ],
- 'code': [
- 'indentUnit',
- 'indentType'
- ]
- };
-
- var createInfoBlock = function (store) {
- var obj = store.proxy;
- var $div = $(' ', {'class': 'infoBlock'});
-
- var $account = $(' ', {'class': 'element'}).appendTo($div);
- var accountName = obj.login_name || localStorage[Cryptpad.userNameKey];
- var $label = $(' ', {'class': 'label'}).text(Messages.user_accountName);
- var $name = $('').text(accountName || '');
- if (!accountName) {
- $label.text('');
- $name.text(Messages.settings_anonymous);
- }
- $account.append($label).append($name);
-
- var publicKey = obj.edPublic;
- if (publicKey) {
- var $key = $('', {'class': 'element'}).appendTo($div);
- var userHref = Cryptpad.getUserHrefFromKeys(accountName, publicKey);
- var $pubLabel = $(' ', {'class': 'label'})
- .text(Messages.settings_publicSigningKey);
- $key.append($pubLabel).append(Cryptpad.dialog.selectable(userHref));
- }
-
- return $div;
- };
-
- // Create the block containing the display name field
- var createDisplayNameInput = function (store) {
- var obj = store.proxy;
- var $div = $('', {'class': 'displayName element'});
- $(' |