From 2c06cffd4a72fea9ebdc2c0236c95dee7f59dfed Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 13 Mar 2026 16:04:35 +0100 Subject: [PATCH] fix(debug): fix debug app requiring reload to show drive --- www/common/sframe-common-outer.js | 13 ++++++++++++- www/debug/main.js | 8 +------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 8362a1365..0f41809c7 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -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 diff --git a/www/debug/main.js b/www/debug/main.js index 7becc123c..da9774baf 100644 --- a/www/debug/main.js +++ b/www/debug/main.js @@ -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({