remove usernames, refactor a wee bit

pull/1/head
ansuz 9 years ago
parent 2b8c21d292
commit f818d873bb

@ -12,11 +12,12 @@ define([
'/common/TypingTests.js',
'json.sortify',
'/bower_components/textpatcher/TextPatcher.amd.js',
'/common/cryptpad-common.js',
'/bower_components/diff-dom/diffDOM.js',
'/bower_components/jquery/dist/jquery.min.js',
'/customize/pad.js'
], function (Config, Messages, Crypto, realtimeInput, Hyperjson, Hyperscript,
Toolbar, Cursor, JsonOT, TypingTest, JSONSortify, TextPatcher) {
Toolbar, Cursor, JsonOT, TypingTest, JSONSortify, TextPatcher, Cryptpad) {
var $ = window.jQuery;
var ifrw = $('#pad-iframe')[0].contentWindow;
@ -42,8 +43,7 @@ define([
fights: []
};
var userName = Crypto.rand64(8),
toolbar;
var toolbar;
var isNotMagicLine = function (el) {
return !(el && typeof(el.getAttribute) === 'function' &&
@ -58,26 +58,7 @@ define([
};
var andThen = function (Ckeditor) {
/* This is turned off because we prefer that the channel name
be chosen by the server, not generated by the client.
We still need a key, so we use genKey()
*/
// $(window).on('hashchange', function() {
// window.location.reload();
// });
var key;
var channel = '';
if (window.location.href.indexOf('#') === -1) {
key = Crypto.genKey();
// window.location.href = window.location.href + '#' + Crypto.genKey();
// return;
}
else {
var hash = window.location.hash.substring(1);
channel = hash.substr(0,32);
key = hash.substr(32);
}
var secret = Cryptpad.getSecrets();
var fixThings = false;
@ -91,7 +72,6 @@ define([
removePlugins: 'resize'
});
editor.on('instanceReady', function (Ckeditor) {
/* add a class to the magicline plugin so we can pick it out more easily */
@ -188,7 +168,6 @@ define([
}
};
var initializing = true;
var userList = {}; // List of pretty name of all users (mapped with their server ID)
var toolbarList; // List of users still connected to the channel (server IDs)
@ -252,14 +231,11 @@ define([
// the websocket URL
websocketURL: Config.websocketURL,
// our username
userName: userName,
// the channel we will communicate over
channel: channel,
channel: secret.channel,
// our encryption key
cryptKey: key,
cryptKey: secret.key,
// method which allows us to get the id of the user
setMyID: setMyID,
@ -341,7 +317,7 @@ define([
createChangeName('cryptpad-changeName', $bar);
// set the hash
window.location.hash = info.channel + key;
window.location.hash = info.channel + secret.key;
};
// this should only ever get called once, when the chain syncs

Loading…
Cancel
Save