Hide the hash with autostore popup + fix anon shared folders
This commit is contained in:
parent
718610b6db
commit
50b897ee2e
@ -642,7 +642,8 @@ define([
|
|||||||
};
|
};
|
||||||
Cryptpad.setPadTitle(data, function (err, obj) {
|
Cryptpad.setPadTitle(data, function (err, obj) {
|
||||||
if (!err && !(obj && obj.notStored)) {
|
if (!err && !(obj && obj.notStored)) {
|
||||||
// Pad is stored: hide the hash
|
// No error and the pad was correctly stored
|
||||||
|
// hide the hash
|
||||||
var opts = parsed.getOptions();
|
var opts = parsed.getOptions();
|
||||||
var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts);
|
var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts);
|
||||||
if (window.history && window.history.replaceState) {
|
if (window.history && window.history.replaceState) {
|
||||||
@ -677,6 +678,16 @@ define([
|
|||||||
forceSave: true
|
forceSave: true
|
||||||
};
|
};
|
||||||
Cryptpad.setPadTitle(data, function (err) {
|
Cryptpad.setPadTitle(data, function (err) {
|
||||||
|
if (!err && !(obj && obj.notStored)) {
|
||||||
|
// No error and the pad was correctly stored
|
||||||
|
// hide the hash
|
||||||
|
var opts = parsed.getOptions();
|
||||||
|
var hash = Utils.Hash.getHiddenHashFromKeys(parsed.type, secret, opts);
|
||||||
|
if (window.history && window.history.replaceState) {
|
||||||
|
if (!/^#/.test(hash)) { hash = '#' + hash; }
|
||||||
|
window.history.replaceState({}, window.document.title, hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
cb({error: err});
|
cb({error: err});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -51,6 +51,12 @@ define([
|
|||||||
// Add a shared folder!
|
// Add a shared folder!
|
||||||
Cryptpad.addSharedFolder(null, secret, function (id) {
|
Cryptpad.addSharedFolder(null, secret, function (id) {
|
||||||
window.CryptPad_newSharedFolder = id;
|
window.CryptPad_newSharedFolder = id;
|
||||||
|
|
||||||
|
// Clear the hash now that the secrets have been generated
|
||||||
|
if (window.history && window.history.replaceState && hash) {
|
||||||
|
window.history.replaceState({}, window.document.title, '#');
|
||||||
|
}
|
||||||
|
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -58,7 +64,7 @@ define([
|
|||||||
var id = Utils.Util.createRandomInteger();
|
var id = Utils.Util.createRandomInteger();
|
||||||
window.CryptPad_newSharedFolder = id;
|
window.CryptPad_newSharedFolder = id;
|
||||||
var data = {
|
var data = {
|
||||||
href: Utils.Hash.getRelativeHref(href),
|
href: Utils.Hash.getRelativeHref(Cryptpad.currentPad.href),
|
||||||
password: secret.password
|
password: secret.password
|
||||||
};
|
};
|
||||||
return void Cryptpad.loadSharedFolder(id, data, cb);
|
return void Cryptpad.loadSharedFolder(id, data, cb);
|
||||||
@ -119,9 +125,9 @@ define([
|
|||||||
sframeChan.event('EV_DRIVE_REMOVE', data);
|
sframeChan.event('EV_DRIVE_REMOVE', data);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var addData = function (meta) {
|
var addData = function (meta, Cryptpad) {
|
||||||
if (!window.CryptPad_newSharedFolder) { return; }
|
if (!window.CryptPad_newSharedFolder) { return; }
|
||||||
meta.anonSFHref = href;
|
meta.anonSFHref = Cryptpad.currentPad.href;
|
||||||
};
|
};
|
||||||
SFCommonO.start({
|
SFCommonO.start({
|
||||||
hash: hash,
|
hash: hash,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user