mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:47:40 +00:00
refactor(channels): share allowlist + resolver helpers
This commit is contained in:
@@ -11,7 +11,10 @@ import { promptChannelAccessConfig } from "../../../src/channels/plugins/onboard
|
||||
import { addWildcardAllowFrom } from "../../../src/channels/plugins/onboarding/helpers.js";
|
||||
|
||||
import { resolveMSTeamsCredentials } from "./token.js";
|
||||
import { resolveMSTeamsChannelAllowlist } from "./resolve-allowlist.js";
|
||||
import {
|
||||
parseMSTeamsTeamEntry,
|
||||
resolveMSTeamsChannelAllowlist,
|
||||
} from "./resolve-allowlist.js";
|
||||
|
||||
const channel = "msteams" as const;
|
||||
|
||||
@@ -94,18 +97,6 @@ function setMSTeamsTeamsAllowlist(
|
||||
};
|
||||
}
|
||||
|
||||
function parseMSTeamsTeamEntry(raw: string): { teamKey: string; channelKey?: string } | null {
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) return null;
|
||||
const parts = trimmed.split("/");
|
||||
const teamPart = parts[0]?.trim();
|
||||
if (!teamPart) return null;
|
||||
const channelPart = parts.length > 1 ? parts.slice(1).join("/").trim() : undefined;
|
||||
const teamKey = teamPart.replace(/^team:/i, "").trim();
|
||||
const channelKey = channelPart ? channelPart.replace(/^#/, "").trim() : undefined;
|
||||
return { teamKey, ...(channelKey ? { channelKey } : {}) };
|
||||
}
|
||||
|
||||
const dmPolicy: ChannelOnboardingDmPolicy = {
|
||||
label: "MS Teams",
|
||||
channel,
|
||||
|
||||
Reference in New Issue
Block a user