mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 08:20:23 +00:00
fix(config): allowlist auto-enabled built-in channels when restricted
Co-authored-by: 4rev <4rev@users.noreply.github.com>
This commit is contained in:
@@ -39,4 +39,16 @@ describe("enablePluginInConfig", () => {
|
||||
expect(result.config.channels?.telegram?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.entries?.telegram).toBeUndefined();
|
||||
});
|
||||
|
||||
it("adds built-in channel id to allowlist when allowlist is configured", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
plugins: {
|
||||
allow: ["memory-core"],
|
||||
},
|
||||
};
|
||||
const result = enablePluginInConfig(cfg, "telegram");
|
||||
expect(result.enabled).toBe(true);
|
||||
expect(result.config.channels?.telegram?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.allow).toEqual(["memory-core", "telegram"]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,19 +24,18 @@ export function enablePluginInConfig(cfg: OpenClawConfig, pluginId: string): Plu
|
||||
existing && typeof existing === "object" && !Array.isArray(existing)
|
||||
? (existing as Record<string, unknown>)
|
||||
: {};
|
||||
return {
|
||||
config: {
|
||||
...cfg,
|
||||
channels: {
|
||||
...cfg.channels,
|
||||
[builtInChannelId]: {
|
||||
...existingRecord,
|
||||
enabled: true,
|
||||
},
|
||||
let next: OpenClawConfig = {
|
||||
...cfg,
|
||||
channels: {
|
||||
...cfg.channels,
|
||||
[builtInChannelId]: {
|
||||
...existingRecord,
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
enabled: true,
|
||||
};
|
||||
next = ensurePluginAllowlisted(next, resolvedId);
|
||||
return { config: next, enabled: true };
|
||||
}
|
||||
|
||||
const entries = {
|
||||
|
||||
Reference in New Issue
Block a user