refactor: share config adapter allowFrom and defaultTo helpers

This commit is contained in:
Peter Steinberger
2026-03-07 23:02:59 +00:00
parent feac26c3b7
commit 556aa8a702
17 changed files with 100 additions and 57 deletions

View File

@@ -1,6 +1,7 @@
import {
buildAccountScopedDmSecurityPolicy,
buildOpenGroupPolicyWarning,
mapAllowFromEntries,
} from "openclaw/plugin-sdk";
import {
applyAccountNameToChannelSection,
@@ -156,7 +157,7 @@ export const matrixPlugin: ChannelPlugin<ResolvedMatrixAccount> = {
}),
resolveAllowFrom: ({ cfg, accountId }) => {
const matrixConfig = resolveMatrixAccountConfig({ cfg: cfg as CoreConfig, accountId });
return (matrixConfig.dm?.allowFrom ?? []).map((entry: string | number) => String(entry));
return mapAllowFromEntries(matrixConfig.dm?.allowFrom);
},
formatAllowFrom: ({ allowFrom }) => normalizeMatrixAllowList(allowFrom),
},