fix(sync): let a linked desktop enable mirrored plugins it does not trust on its own (#1632)

* fix(sync): let a linked desktop enable mirrored plugins it does not trust on its own

* fix(sync): switch off an untrusted mirrored plugin when the server updates it

* fix: require local consent for mirrored plugin activation

* docs: describe consent fields on the plugin state endpoint
This commit is contained in:
ZacharyZcR authored and GitHub committed 2026-10-14 09:11:55 +08:00
1 parent 9b0af07607
commit b3b08b4ff2
17 files changed
+515 -36

No files matched your search

+21 -2
View File
@@ -23,7 +23,9 @@ const plugin = {
contributes: {},
versions: [],
downloads: null,
managedByServer: false,
};
let linked = false;
vi.mock("@/plugins/use-plugins-manager", () => ({
usePluginsManager: () => ({
@@ -32,7 +34,7 @@ vi.mock("@/plugins/use-plugins-manager", () => ({
refreshing: false,
refresh: vi.fn(),
registryError: null,
managedByServer: false,
managedByServer: linked,
busy: new Set(),
consent: null,
setConsent: vi.fn(),
@@ -56,7 +58,11 @@ async function renderTab() {
);
}
beforeEach(() => localStorage.clear());
beforeEach(() => {
localStorage.clear();
linked = false;
plugin.managedByServer = false;
});
afterEach(cleanup);
describe("PluginsTab", () => {
@@ -123,4 +129,17 @@ describe("PluginsTab", () => {
);
expect(grid?.style.gridTemplateColumns).toContain("auto-fill");
});
it("lets a linked desktop switch a plugin its server does not decide", async () => {
linked = true;
await renderTab();
const toggle = () =>
screen.getByRole("button", { name: en.plugins.manager.disable });
expect(toggle().hasAttribute("disabled")).toBe(false);
cleanup();
plugin.managedByServer = true;
await renderTab();
expect(toggle().hasAttribute("disabled")).toBe(true);
});
});