Gateway mode hides Agents only for magpie web without agents, and the Library
only goes with its built-in plugin. A docker gateway asked to close both. The
new row is a multi-tick menu of the sidebar's pages (Providers stays), kept in
localStorage magpie.navHidden; navHides and offView read it beside gateway mode
and the built-in plugins, and start.js opens Providers when Agents is out.
Main's TestCoreScriptBudget was already 351 bytes over at origin/main
(1,534,153 > 1,533,802); this commit cuts comments in app.js to land at
1,533,596, under it, with no raise.
Run, on wsl-run (xiaomi-gpu), chromium + webkit: nav-pages-hidden 2 pass;
broken by hand (navHides without the new term) 2 red. settings-general went
red on the first draft (the row was 56 tall, the others 51, the button in a
wrapper) and passes now. i18n-keys, i18n-en-no-cjk, last-page, gateway-mode,
sidebar, phone-tabs 0 fail. go test -tags nogui -run TestCoreScriptBudget ok.
Red the same on an origin/main copy (7 and 14 fails, not from this change):
builtins webkit, side-toggle (both engines) and settings-search ("searching
posts nothing": /api/update/using); filed with this push.
Not tried: a real docker deployment, the full GUI suite, the Mac and Linux
apps, sidebar-glide (3 fails under load, base not compared).
27 lines
1.6 KiB
JavaScript
27 lines
1.6 KiB
JavaScript
// The window's start, loaded last: app.js, the plugins' pages and the
|
|
// scripts after app.js are all there, so the first page shown has its
|
|
// code (the Usage page's is a plugin's, run after app.js).
|
|
// the plugins' pages wired up (kernel.js), before the first is shown
|
|
magpie.start();
|
|
navHides(); // the pages built-in plugins switched off have, from boot.js
|
|
// The window opens on the page the reader last left, as a Mac app comes back
|
|
// as it was (molvqingtai, lc on Discord): a page asked for (?view=, a link
|
|
// from the tray or a reload) first, then the one kept; a page gateway mode
|
|
// leaves out, or one there is no longer, gives way to the first page.
|
|
// the pages the window can open on besides the first (Agents)
|
|
const OPEN_VIEWS = ["providers", "plugins", "settings", ...magpie.pages()];
|
|
function keptView() {
|
|
const asked = params.get("view");
|
|
if (asked === "agents" || OPEN_VIEWS.includes(asked)) return asked;
|
|
let v = "";
|
|
try { v = localStorage.getItem("magpie.lastView") || ""; } catch { /* none kept */ }
|
|
return OPEN_VIEWS.includes(v) ? v : ""; // one gateway mode leaves out, show() makes Providers
|
|
}
|
|
const firstView = mode === "window" ? keptView() || (navMine().includes("agents") ? "providers" : "") : "";
|
|
// from the tray panel's More in Plugins (q): Discover, once show() picked the tab (#3579)
|
|
if (OPEN_VIEWS.includes(firstView)) show(firstView).then(() => view === "plugins" && params.has("q") && window.pluginQuery?.(params.get("q")));
|
|
else if (mode === "window" && !gatewayMode && !sideNav()) slide($("#nav"), "nav");
|
|
// in gateway mode the first page is Providers, Agents' tab gone
|
|
if (gatewayMode) setGatewayMode(true);
|
|
load();
|