fix(theseus/addons): sidebar auto-restore on tab switch + more forgiving tar

Two follow-ups from user reports on the 0.5.x screenshot rollout:

- When the screenshot editor sidebar is maximized (fills the window) and
  the user hits New Tab / Settings / any address-bar nav that opens a
  different tab, the incoming tab was left invisible behind the sidebar.
  setActive now auto-restores the sidebar to its pre-max width whenever
  it detects a tab switch — the user can hit the maximize button again
  on the way back. Pure additive change, no other setActive semantics
  touched.

- The signed-add-on update pipeline failed the 0.5.0 tarball extract on
  a Windows 10 install with the built-in bsdtar: `tar --force-local -x
  -z -f …` — bsdtar doesn't recognise --force-local and errors out
  before it opens the archive. Try the extraction WITHOUT the flag
  first (safe with the posix-slash paths we already pass on every tar
  we care about — bsdtar, GNU tar, MSYS2 tar) and fall back to WITH
  --force-local only if the first invocation exits non-zero (MSYS2
  path where a bare `C:/…` gets parsed as a `host:` prefix). Original
  error message is surfaced on total failure so we can still tell what
  went wrong.
This commit is contained in:
Local Dev 2026-09-09 02:38:32 +02:00
parent 71b803e020
commit 0d583fb749
2 changed files with 24 additions and 1 deletions

View file

@ -197,8 +197,24 @@ async function stageOne({ id, currentVer, updateURL, stagedDir, pubkeysHex, log,
// arrives at tar as `C:\\Users...\\dir` and it can't open the path. // arrives at tar as `C:\\Users...\\dir` and it can't open the path.
// Forward-slash paths dodge both — bsdtar (Win10 built-in), GNU tar, // Forward-slash paths dodge both — bsdtar (Win10 built-in), GNU tar,
// and MSYS2 tar all accept `C:/Users/...` as a plain path. // and MSYS2 tar all accept `C:/Users/...` as a plain path.
// BUT: Windows 10's built-in bsdtar does NOT recognise --force-local at
// all and errors out with "unknown option". Try WITHOUT the flag first
// (safe with posix paths on every tar we care about) and fall back to
// WITH it for MSYS2 tar which parses `C:/…` as a host prefix. Either
// path is a single tar invocation — the fallback only fires on the
// exit-code failure of the first.
const posix = (p) => p.replace(/\\/g, "/"); const posix = (p) => p.replace(/\\/g, "/");
execFileSync("tar", ["--force-local", "-x", "-z", "-f", posix(tmpFile), "-C", posix(tmpDir)], { stdio: "ignore" }); const baseArgs = ["-x", "-z", "-f", posix(tmpFile), "-C", posix(tmpDir)];
try {
execFileSync("tar", baseArgs, { stdio: "ignore" });
} catch (e1) {
try {
execFileSync("tar", ["--force-local", ...baseArgs], { stdio: "ignore" });
} catch (e2) {
// Surface the first error; --force-local retry is opportunistic.
throw e1;
}
}
} catch (e) { } catch (e) {
log(`updates: extract ${id}@${best.version} failed:`, e.message); log(`updates: extract ${id}@${best.version} failed:`, e.message);
try { fs.rmSync(tmpFile, { force: true }); } catch {} try { fs.rmSync(tmpFile, { force: true }); } catch {}

View file

@ -2128,10 +2128,17 @@ function installDownloadTracker() {
}); });
} }
function setActive(id) { function setActive(id) {
const switching = id !== activeId;
activeId = id; activeId = id;
if (popVisible) showPopover(false); // don't carry a stale popover across tabs if (popVisible) showPopover(false); // don't carry a stale popover across tabs
if (epVisible) showEnginePicker(false); if (epVisible) showEnginePicker(false);
if (linkStatusVisible) showLinkStatus(""); // clear any lingering hover pill if (linkStatusVisible) showLinkStatus(""); // clear any lingering hover pill
// A user action that switches to a different tab (New Tab, Settings,
// address-bar nav that opens elsewhere, tab-strip click) shouldn't leave
// the incoming tab hidden behind a maximized sidebar. Auto-restore the
// sidebar to its pre-max width so the tab is actually visible; the
// user can re-maximize when they're done.
if (switching && sidebarMaximized) setSidebarMaximized(false);
// Show the NEW active tab first, THEN hide the others. Reversing this // Show the NEW active tab first, THEN hide the others. Reversing this
// order eliminates the "no tab is visible" frame on switch that made the // order eliminates the "no tab is visible" frame on switch that made the
// tab strip flash — the compositor always has at least one tab view up. // tab strip flash — the compositor always has at least one tab view up.