Hidden hash for files

This commit is contained in:
yflory
2020-01-27 15:45:57 +01:00
parent 7b9f86157e
commit 7a02b074b7
5 changed files with 67 additions and 36 deletions

View File

@@ -9,6 +9,7 @@ define([
var requireConfig = RequireConfig();
// Loaded in load #2
var hash, href;
nThen(function (waitFor) {
DomReady.onReady(waitFor());
}).nThen(function (waitFor) {
@@ -19,6 +20,14 @@ define([
};
window.rc = requireConfig;
window.apiconf = ApiConfig;
// Hidden hash
hash = window.location.hash;
href = window.location.href;
if (window.history && window.history.replaceState && hash) {
window.history.replaceState({}, window.document.title, '#');
}
document.getElementById('sbox-iframe').setAttribute('src',
ApiConfig.httpSafeOrigin + '/file/inner.html?' + requireConfig.urlArgs +
'#' + encodeURIComponent(JSON.stringify(req)));
@@ -36,10 +45,12 @@ define([
};
window.addEventListener('message', onMsg);
}).nThen(function (/*waitFor*/) {
var addData = function (meta) {
meta.filehash = window.location.hash;
var addData = function (meta, Cryptpad) {
meta.filehash = Cryptpad.currentPad.hash;
};
SFCommonO.start({
hash: hash,
href: href,
noRealtime: true,
addData: addData
});