mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 02:50:20 +00:00
LINE: avoid runtime lookup during onboarding (#49960)
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import { createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
||||
import type { OpenClawConfig, ResolvedLineAccount } from "../api.js";
|
||||
import { getLineRuntime } from "./runtime.js";
|
||||
|
||||
function resolveLineRuntimeAccount(cfg: OpenClawConfig, accountId?: string | null) {
|
||||
return getLineRuntime().channel.line.resolveLineAccount({
|
||||
cfg,
|
||||
accountId: accountId ?? undefined,
|
||||
});
|
||||
}
|
||||
import {
|
||||
listLineAccountIds,
|
||||
resolveDefaultLineAccountId,
|
||||
resolveLineAccount,
|
||||
type OpenClawConfig,
|
||||
type ResolvedLineAccount,
|
||||
} from "../runtime-api.js";
|
||||
|
||||
export function normalizeLineAllowFrom(entry: string): string {
|
||||
return entry.replace(/^line:(?:user:)?/i, "");
|
||||
@@ -19,9 +17,10 @@ export const lineConfigAdapter = createScopedChannelConfigAdapter<
|
||||
OpenClawConfig
|
||||
>({
|
||||
sectionKey: "line",
|
||||
listAccountIds: (cfg) => getLineRuntime().channel.line.listLineAccountIds(cfg),
|
||||
resolveAccount: (cfg, accountId) => resolveLineRuntimeAccount(cfg, accountId),
|
||||
defaultAccountId: (cfg) => getLineRuntime().channel.line.resolveDefaultLineAccountId(cfg),
|
||||
listAccountIds: listLineAccountIds,
|
||||
resolveAccount: (cfg, accountId) =>
|
||||
resolveLineAccount({ cfg, accountId: accountId ?? undefined }),
|
||||
defaultAccountId: resolveDefaultLineAccountId,
|
||||
clearBaseFields: ["channelSecret", "tokenFile", "secretFile"],
|
||||
resolveAllowFrom: (account) => account.config.allowFrom,
|
||||
formatAllowFrom: (allowFrom) =>
|
||||
|
||||
Reference in New Issue
Block a user