mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 14:30:24 +00:00
refactor: share allowFrom stringification helpers
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { mapAllowFromEntries } from "../../plugin-sdk/channel-config-helpers.js";
|
||||
import type { RuntimeEnv } from "../../runtime.js";
|
||||
|
||||
export type AllowlistUserResolutionLike = {
|
||||
@@ -28,10 +29,7 @@ export function mergeAllowlist(params: {
|
||||
existing?: Array<string | number>;
|
||||
additions: string[];
|
||||
}): string[] {
|
||||
return dedupeAllowlistEntries([
|
||||
...(params.existing ?? []).map((entry) => String(entry)),
|
||||
...params.additions,
|
||||
]);
|
||||
return dedupeAllowlistEntries([...mapAllowFromEntries(params.existing), ...params.additions]);
|
||||
}
|
||||
|
||||
export function buildAllowlistResolutionSummary<T extends AllowlistUserResolutionLike>(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { OpenClawConfig } from "../../config/types.js";
|
||||
import { inspectDiscordAccount } from "../../discord/account-inspect.js";
|
||||
import { mapAllowFromEntries } from "../../plugin-sdk/channel-config-helpers.js";
|
||||
import { inspectSlackAccount } from "../../slack/account-inspect.js";
|
||||
import { inspectTelegramAccount } from "../../telegram/account-inspect.js";
|
||||
import { resolveWhatsAppAccount } from "../../web/accounts.js";
|
||||
@@ -161,7 +162,7 @@ export async function listTelegramDirectoryPeersFromConfig(
|
||||
): Promise<ChannelDirectoryEntry[]> {
|
||||
const account = inspectTelegramAccount({ cfg: params.cfg, accountId: params.accountId });
|
||||
const raw = [
|
||||
...(account.config.allowFrom ?? []).map((entry) => String(entry)),
|
||||
...mapAllowFromEntries(account.config.allowFrom),
|
||||
...Object.keys(account.config.dms ?? {}),
|
||||
];
|
||||
const ids = Array.from(
|
||||
|
||||
Reference in New Issue
Block a user