mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-02 03:14:55 +00:00
fix: repair local approval resolution (#86771)
This commit is contained in:
@@ -117,7 +117,7 @@ describe("withOperatorApprovalsGatewayClient", () => {
|
||||
expect(clientState.options?.deviceIdentity).toBeUndefined();
|
||||
});
|
||||
|
||||
it("omits approval runtime token for explicit gateway URL overrides", async () => {
|
||||
it("keeps approval runtime token for loopback explicit gateway URL overrides", async () => {
|
||||
await withOperatorApprovalsGatewayClient(
|
||||
{
|
||||
config: {} as never,
|
||||
@@ -127,6 +127,21 @@ describe("withOperatorApprovalsGatewayClient", () => {
|
||||
async () => undefined,
|
||||
);
|
||||
|
||||
expect(typeof clientState.options?.approvalRuntimeToken).toBe("string");
|
||||
});
|
||||
|
||||
it("omits approval runtime token for remote explicit gateway URL overrides", async () => {
|
||||
bootstrapState.url = "wss://gateway.example/ws";
|
||||
|
||||
await withOperatorApprovalsGatewayClient(
|
||||
{
|
||||
config: {} as never,
|
||||
gatewayUrl: "wss://gateway.example/ws",
|
||||
clientDisplayName: "Matrix approval (@owner:example.org)",
|
||||
},
|
||||
async () => undefined,
|
||||
);
|
||||
|
||||
expect(clientState.options).not.toHaveProperty("approvalRuntimeToken");
|
||||
});
|
||||
|
||||
|
||||
@@ -44,12 +44,15 @@ export async function createOperatorApprovalsGatewayClient(
|
||||
gatewayUrl: params.gatewayUrl,
|
||||
env: process.env,
|
||||
});
|
||||
const shouldSendApprovalRuntimeToken = !params.gatewayUrl || isLoopbackGatewayUrl(bootstrap.url);
|
||||
|
||||
return new GatewayClient({
|
||||
url: bootstrap.url,
|
||||
token: bootstrap.auth.token,
|
||||
password: bootstrap.auth.password,
|
||||
...(params.gatewayUrl ? {} : { approvalRuntimeToken: getOperatorApprovalRuntimeToken() }),
|
||||
...(shouldSendApprovalRuntimeToken
|
||||
? { approvalRuntimeToken: getOperatorApprovalRuntimeToken() }
|
||||
: {}),
|
||||
preauthHandshakeTimeoutMs: bootstrap.preauthHandshakeTimeoutMs,
|
||||
clientName: GATEWAY_CLIENT_NAMES.GATEWAY_CLIENT,
|
||||
clientDisplayName: params.clientDisplayName,
|
||||
|
||||
Reference in New Issue
Block a user