feat(network): centralize proxy settings and add MCP routing (NAN-315) (#6372)
* feat(network): share proxy settings across features and MCP (NAN-315) * fix(network): address shared proxy review regressions * test(network): align rebased OAuth fixtures with runtime admission * fix(webui): configure shared proxy without leaving connection drafts * feat(webui): add optional shared proxy authentication editor * fix(webui): align proxy save tests and loading skeleton
This commit is contained in:
1 parent
872a83340d
commit
084b6bb394
181 files changed
+3740
-807
No files matched your search
@@ -54,6 +54,32 @@ describe("CredentialForm", () => {
|
||||
expect(onChange).toHaveBeenCalledWith(key, "");
|
||||
});
|
||||
|
||||
it.each(["telegram", "discord", "matrix", "slack", "whatsapp"])("renders %s proxy configuration as a switch and submits both boolean states", (channel) => {
|
||||
const key = `channels.${channel}.useProxy`;
|
||||
const setup = channelSetup({
|
||||
name: channel, display_name: channel, type: "channel", enabled: true,
|
||||
webui: channel === "whatsapp" ? "webui/index.tsx" : "webui/index.ts",
|
||||
installed: true, ready: true, status: "enabled",
|
||||
install_supported: true, requires_restart: false,
|
||||
setup: { fields: [{ key, field: "use_proxy", kind: "bool", choices: [], required: false, default_value: "false" }] },
|
||||
});
|
||||
const proxyFields = [...setup.fields ?? [], ...setup.manualFields ?? []];
|
||||
expect(proxyFields[0].section).toBe("connection");
|
||||
const onChange = vi.fn();
|
||||
const { rerender } = render(<CredentialForm fields={proxyFields} values={{ [key]: "true" }}
|
||||
visibleSecrets={{}} onChange={onChange} onToggleSecret={vi.fn()} />);
|
||||
const useProxy = screen.getByRole("switch", { name: "Use proxy" });
|
||||
expect(useProxy).toBeChecked();
|
||||
expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
|
||||
fireEvent.click(useProxy);
|
||||
expect(onChange).toHaveBeenCalledWith(key, "false");
|
||||
expect(channelValuesForSubmit(proxyFields, { [key]: "false" }, new Set([key]))).toEqual({ [key]: "false" });
|
||||
rerender(<CredentialForm fields={proxyFields} values={{ [key]: "false" }}
|
||||
visibleSecrets={{}} onChange={onChange} onToggleSecret={vi.fn()} />);
|
||||
fireEvent.click(screen.getByRole("switch", { name: "Use proxy" }));
|
||||
expect(onChange).toHaveBeenLastCalledWith(key, "true");
|
||||
});
|
||||
|
||||
it("uses native radio semantics for option fields", () => {
|
||||
const onChange = vi.fn();
|
||||
render(
|
||||
|
||||
Reference in new issue
Block a user