mirror of https://github.com/openclaw/openclaw.git
refactor(imessage): reuse shared setup security
This commit is contained in:
parent
6a57ede661
commit
c9de17fc20
|
|
@ -1,9 +1,5 @@
|
|||
import {
|
||||
buildAccountScopedDmSecurityPolicy,
|
||||
collectAllowlistProviderRestrictSendersWarnings,
|
||||
} from "openclaw/plugin-sdk/channel-config-helpers";
|
||||
import { DEFAULT_ACCOUNT_ID, type ChannelPlugin } from "openclaw/plugin-sdk/imessage";
|
||||
import { resolveIMessageAccount, type ResolvedIMessageAccount } from "./accounts.js";
|
||||
import { type ChannelPlugin } from "openclaw/plugin-sdk/imessage";
|
||||
import { type ResolvedIMessageAccount } from "./accounts.js";
|
||||
import { imessageSetupAdapter } from "./setup-core.js";
|
||||
import { createIMessagePluginBase, imessageSetupWizard } from "./shared.js";
|
||||
|
||||
|
|
@ -12,27 +8,4 @@ export const imessageSetupPlugin: ChannelPlugin<ResolvedIMessageAccount> = {
|
|||
setupWizard: imessageSetupWizard,
|
||||
setup: imessageSetupAdapter,
|
||||
}),
|
||||
security: {
|
||||
resolveDmPolicy: ({ cfg, accountId, account }) =>
|
||||
buildAccountScopedDmSecurityPolicy({
|
||||
cfg,
|
||||
channelKey: "imessage",
|
||||
accountId,
|
||||
fallbackAccountId: account.accountId ?? DEFAULT_ACCOUNT_ID,
|
||||
policy: account.config.dmPolicy,
|
||||
allowFrom: account.config.allowFrom ?? [],
|
||||
policyPathSuffix: "dmPolicy",
|
||||
}),
|
||||
collectWarnings: ({ account, cfg }) =>
|
||||
collectAllowlistProviderRestrictSendersWarnings({
|
||||
cfg,
|
||||
providerConfigPresent: cfg.channels?.imessage !== undefined,
|
||||
configuredGroupPolicy: account.config.groupPolicy,
|
||||
surface: "iMessage groups",
|
||||
openScope: "any member",
|
||||
groupPolicyPath: "channels.imessage.groupPolicy",
|
||||
groupAllowFromPath: "channels.imessage.groupAllowFrom",
|
||||
mentionGated: false,
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue