mirror of https://github.com/openclaw/openclaw.git
fix: honor feishu setup account status
This commit is contained in:
parent
e37c0da23a
commit
fc61e8d280
|
|
@ -134,6 +134,31 @@ describe("feishu setup wizard status", () => {
|
|||
expect(status.configured).toBe(false);
|
||||
});
|
||||
|
||||
it("setup status honors the selected named account", async () => {
|
||||
const status = await feishuGetStatus({
|
||||
cfg: {
|
||||
channels: {
|
||||
feishu: {
|
||||
appId: "top_level_app",
|
||||
appSecret: "top-level-secret", // pragma: allowlist secret
|
||||
accounts: {
|
||||
work: {
|
||||
appId: "",
|
||||
appSecret: "work-secret", // pragma: allowlist secret
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as never,
|
||||
accountOverrides: {
|
||||
feishu: "work",
|
||||
},
|
||||
});
|
||||
|
||||
expect(status.configured).toBe(false);
|
||||
expect(status.statusLines).toEqual(["Feishu: needs app credentials"]);
|
||||
});
|
||||
|
||||
it("treats env SecretRef appId as not configured when env var is missing", async () => {
|
||||
const appIdKey = "FEISHU_APP_ID_STATUS_MISSING_TEST";
|
||||
const appSecretKey = "FEISHU_APP_CREDENTIAL_STATUS_MISSING_TEST"; // pragma: allowlist secret
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
type OpenClawConfig,
|
||||
type SecretInput,
|
||||
} from "openclaw/plugin-sdk/setup";
|
||||
import { inspectFeishuCredentials, listFeishuAccountIds } from "./accounts.js";
|
||||
import { inspectFeishuCredentials, listFeishuAccountIds, resolveFeishuAccount } from "./accounts.js";
|
||||
import { probeFeishu } from "./probe.js";
|
||||
import { feishuSetupAdapter } from "./setup-core.js";
|
||||
import type { FeishuConfig } from "./types.js";
|
||||
|
|
@ -162,10 +162,23 @@ export const feishuSetupWizard: ChannelSetupWizard = {
|
|||
unconfiguredHint: "needs app creds",
|
||||
configuredScore: 2,
|
||||
unconfiguredScore: 0,
|
||||
resolveConfigured: ({ cfg }) => isFeishuConfigured(cfg),
|
||||
resolveStatusLines: async ({ cfg, configured }) => {
|
||||
const feishuCfg = cfg.channels?.feishu as FeishuConfig | undefined;
|
||||
const resolvedCredentials = inspectFeishuCredentials(feishuCfg);
|
||||
resolveConfigured: ({ cfg, accountId }) =>
|
||||
accountId ? resolveFeishuAccount({ cfg, accountId }).configured : isFeishuConfigured(cfg),
|
||||
resolveStatusLines: async ({ cfg, accountId, configured }) => {
|
||||
const resolvedCredentials = accountId
|
||||
? (() => {
|
||||
const account = resolveFeishuAccount({ cfg, accountId });
|
||||
return account.configured && account.appId && account.appSecret
|
||||
? {
|
||||
appId: account.appId,
|
||||
appSecret: account.appSecret,
|
||||
encryptKey: account.encryptKey,
|
||||
verificationToken: account.verificationToken,
|
||||
domain: account.domain,
|
||||
}
|
||||
: null;
|
||||
})()
|
||||
: inspectFeishuCredentials(cfg.channels?.feishu as FeishuConfig | undefined);
|
||||
let probeResult = null;
|
||||
if (configured && resolvedCredentials) {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue