Guard other plugins like ComfyUI Manager; hide Pixaroma's workflow browser
Plugin button groups in the top bar are hidden without the manager permission, and rgthree-comfy / Crystools server-wide settings need it too. Pixaroma's workflow browser (which lists every folder from disk) is hidden with the other workflow browsers and its routes are admin-only.
This commit is contained in:
@@ -89,6 +89,19 @@ function installManagerGuard(client) {
|
||||
client.on("self", apply);
|
||||
client.on("status", apply);
|
||||
setTimeout(apply, 2000); // Manager registers its commands during setup
|
||||
// Other plugins put their buttons in the same place as ComfyUI Manager (just
|
||||
// before ComfyUI's settings group in the top bar): tag them so they are hidden
|
||||
// the same way without the "manager" permission. Their server-side settings
|
||||
// are guarded too (PLUGIN_RULES on the server).
|
||||
const tagPluginButtons = () => {
|
||||
const settings = app.menu?.settingsGroup?.element;
|
||||
const bar = settings?.parentElement;
|
||||
if (!bar) return;
|
||||
for (const group of bar.children) {
|
||||
if (group !== settings && group.classList.contains("comfyui-button-group")) group.classList.add("rs-plugin-bar");
|
||||
}
|
||||
};
|
||||
setInterval(tagPluginButtons, 1000);
|
||||
}
|
||||
|
||||
// Comfy.org account: hide the top-bar sign-in button and refuse the sign-in
|
||||
@@ -139,6 +152,15 @@ function installFileTabsGuard(client) {
|
||||
const apply = () => {
|
||||
if (!client.server) return; // wait for the server's settings
|
||||
const hide = hidden();
|
||||
document.body.classList.toggle("rs-hide-file-browsers", hide);
|
||||
// Pixaroma's workflow browser lists every folder from disk, private ones
|
||||
// included (the server refuses it to non-admins): its shortcut opens Files.
|
||||
const pix = (manager()?.command?.commands ?? []).find((c) => c.id === "Pixaroma.OpenWorkflowBrowser");
|
||||
if (pix && !pix.__rigshare) {
|
||||
const original = pix.function;
|
||||
pix.function = (...args) => (hidden() ? openFiles() : original(...args));
|
||||
pix.__rigshare = true;
|
||||
}
|
||||
for (const id of COMFY_FILE_TABS) {
|
||||
const tab = tabs().find((t) => t.id === id);
|
||||
// Open workflow tabs can be shown in the Workflows sidebar tab: keep it then.
|
||||
|
||||
@@ -866,7 +866,7 @@ export class RigSharePanel {
|
||||
line(f.broadcast, "Share execution progress", "Everyone sees progress and previews, not only whoever queued"),
|
||||
line(f.protect, "Enforce permissions on the ComfyUI API", "Blocks queueing, interrupting and uploads for users without permission"),
|
||||
line(f.hideAccount, "Hide the Comfy.org account login", "Removes ComfyUI's own sign-in button and dialog (used for paid API nodes)"),
|
||||
line(f.hideFileTabs, "Hide ComfyUI's Workflows and Apps tabs", "RigShare's Files tab replaces them. Their shortcuts open Files instead"),
|
||||
line(f.hideFileTabs, "Hide other workflow browsers", "ComfyUI's Workflows and Apps tabs, and Pixaroma's Workflows panel: RigShare's Files tab replaces them and their shortcuts open Files"),
|
||||
line(f.hideApiTemplates, "Hide API templates", "Removes templates that need paid API nodes from the template browser"),
|
||||
h("label", { class: "rs-label" }, "Trusted IPs / networks (skip login and checks)"), f.trusted,
|
||||
h("div", { class: "rs-row" }, h("label", { class: "rs-label rs-grow" }, "Auto snapshot every (min, 0 = off)"), f.interval),
|
||||
|
||||
@@ -107,6 +107,10 @@ code { font-family: ui-monospace, monospace; font-size: 11px; background: var(--
|
||||
/* Comfy.org account sign-in hidden by the admin */
|
||||
body.rs-hide-comfy-account [data-testid="login-button"],
|
||||
body.rs-hide-comfy-account [data-testid="login-button-popover"] { display: none !important; }
|
||||
/* Other plugins' top-bar buttons (rgthree-comfy, Crystools...) hidden like ComfyUI Manager */
|
||||
body.rs-no-manager .rs-plugin-bar { display: none !important; }
|
||||
/* Pixaroma's workflow browser button: RigShare's Files tab replaces it */
|
||||
body.rs-hide-file-browsers .pixwb-group-btn { display: none !important; }
|
||||
/* ComfyUI Manager hidden for accounts without the "manager" permission */
|
||||
body.rs-no-manager .comfyui-button-group:has(> [title="ComfyUI Manager"]),
|
||||
body.rs-no-manager [title="ComfyUI Manager"],
|
||||
|
||||
Reference in New Issue
Block a user