mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 05:01:15 +00:00
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
import {
|
|
adaptScopedAccountAccessor,
|
|
createScopedChannelConfigAdapter,
|
|
} from "openclaw/plugin-sdk/channel-config-helpers";
|
|
import {
|
|
listMatrixAccountIds,
|
|
resolveDefaultMatrixAccountId,
|
|
resolveMatrixAccount,
|
|
resolveMatrixAccountConfig,
|
|
type ResolvedMatrixAccount,
|
|
} from "./matrix/accounts.js";
|
|
import { normalizeMatrixAllowList } from "./matrix/monitor/allowlist.js";
|
|
import type { CoreConfig } from "./types.js";
|
|
|
|
export { DEFAULT_ACCOUNT_ID };
|
|
|
|
export const matrixConfigAdapter = createScopedChannelConfigAdapter<
|
|
ResolvedMatrixAccount,
|
|
ReturnType<typeof resolveMatrixAccountConfig>,
|
|
CoreConfig
|
|
>({
|
|
sectionKey: "matrix",
|
|
listAccountIds: listMatrixAccountIds,
|
|
resolveAccount: adaptScopedAccountAccessor(resolveMatrixAccount),
|
|
resolveAccessorAccount: ({ cfg, accountId }) => resolveMatrixAccountConfig({ cfg, accountId }),
|
|
defaultAccountId: resolveDefaultMatrixAccountId,
|
|
clearBaseFields: [
|
|
"name",
|
|
"homeserver",
|
|
"network",
|
|
"proxy",
|
|
"userId",
|
|
"accessToken",
|
|
"password",
|
|
"deviceId",
|
|
"deviceName",
|
|
"avatarUrl",
|
|
"initialSyncLimit",
|
|
],
|
|
resolveAllowFrom: (account) => account.dm?.allowFrom,
|
|
formatAllowFrom: (allowFrom) => normalizeMatrixAllowList(allowFrom),
|
|
});
|