fix(debug): fix debug app requiring reload to show drive

This commit is contained in:
yflory 2026-03-13 16:04:35 +01:00
parent a5df4cc9bc
commit 2c06cffd4a
2 changed files with 13 additions and 8 deletions

View File

@ -126,7 +126,7 @@ define([
var parsedUnsafeLink;
var Handler;
var currentPad = window.CryptPad_location = {
var currentPad = {
app: '',
href: cfg.href || window.location.href,
hash: cfg.hash || window.location.hash
@ -401,6 +401,17 @@ define([
burnAfterReading = parsed && parsed.hashData && parsed.hashData.ownerKey;
currentPad.app = parsed.type;
// Allow "debug" to show drive content if no hash is provided
if (parsed.type === "debug" && !currentPad.hash) {
currentPad.app = "debug";
const fsHash = localStorage.FS_hash;
currentPad.hash = Cryptpad.userHash || fsHash;
currentPad.href = '/debug/#'+currentPad.hash;
window.location.hash = currentPad.hash;
parsed = Utils.Hash.parsePadUrl(currentPad.href);
}
if (cfg.getSecrets) {
var w = waitFor();
// No password for drive, profile and todo

View File

@ -37,21 +37,15 @@ define([
SFCommonO.initIframe(waitFor);
}).nThen(function (/*waitFor*/) {
var isDrive = false;
var isMyDrive = false;
if (!window.location.hash) {
isDrive = true;
isMyDrive = true;
} else {
var p = Hash.parsePadUrl('/debug/'+window.location.hash);
if (p && p.hashData && p.hashData.app === 'drive') {
isDrive = true;
}
}
var addData = function (meta, Cryptpad) {
if (isMyDrive) { window.location.hash = Cryptpad.userHash; }
window.CryptPad_location.app = "debug";
window.CryptPad_location.hash = Cryptpad.userHash;
window.CryptPad_location.href = '/debug/#'+Cryptpad.userHash;
var addData = function (meta) {
meta.debugDrive = isDrive;
};
SFCommonO.start({