Fix the text example
This commit is contained in:
@@ -113,12 +113,13 @@ Version 1
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hash = href.replace(patt, function (a, domain, type) {
|
href.replace(patt, function (a, domain, type) {
|
||||||
ret.domain = domain;
|
ret.domain = domain;
|
||||||
ret.type = type;
|
ret.type = type;
|
||||||
return '';
|
return '';
|
||||||
});
|
});
|
||||||
ret.hash = hash.replace(/#/g, '');
|
var idx = href.indexOf('/#');
|
||||||
|
ret.hash = href.slice(idx + 2);
|
||||||
ret.hashData = parseTypeHash(ret.type, ret.hash);
|
ret.hashData = parseTypeHash(ret.type, ret.hash);
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ define([
|
|||||||
], function ($, Config, Realtime, Crypto, TextPatcher, Cryptpad) {
|
], function ($, Config, Realtime, Crypto, TextPatcher, Cryptpad) {
|
||||||
|
|
||||||
var secret = Cryptpad.getSecrets();
|
var secret = Cryptpad.getSecrets();
|
||||||
|
if (!secret.keys) {
|
||||||
|
secret.keys = secret.key;
|
||||||
|
}
|
||||||
|
|
||||||
var module = window.APP = {
|
var module = window.APP = {
|
||||||
TextPatcher: TextPatcher
|
TextPatcher: TextPatcher
|
||||||
@@ -19,8 +22,9 @@ define([
|
|||||||
var config = module.config = {
|
var config = module.config = {
|
||||||
initialState: '',
|
initialState: '',
|
||||||
websocketURL: Config.websocketURL,
|
websocketURL: Config.websocketURL,
|
||||||
|
validateKey: secret.keys.validateKey || undefined,
|
||||||
channel: secret.channel,
|
channel: secret.channel,
|
||||||
crypto: Crypto.createEncryptor(secret.key),
|
crypto: Crypto.createEncryptor(secret.keys),
|
||||||
};
|
};
|
||||||
|
|
||||||
var setEditable = function (bool) { $textarea.attr('disabled', !bool); };
|
var setEditable = function (bool) { $textarea.attr('disabled', !bool); };
|
||||||
@@ -29,7 +33,8 @@ define([
|
|||||||
setEditable(false);
|
setEditable(false);
|
||||||
|
|
||||||
config.onInit = function (info) {
|
config.onInit = function (info) {
|
||||||
window.location.hash = info.channel + secret.key;
|
var editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
|
||||||
|
Cryptpad.replaceHash(editHash);
|
||||||
$(window).on('hashchange', function() {
|
$(window).on('hashchange', function() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user