mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 15:01:48 +03:00
fix(ci): fix discord proxy websocket binding and bluebubbles timeout status
This commit is contained in:
@@ -335,7 +335,13 @@ export async function handleBlueBubblesWebhookRequest(
|
|||||||
|
|
||||||
const body = await readJsonBody(req, 1024 * 1024);
|
const body = await readJsonBody(req, 1024 * 1024);
|
||||||
if (!body.ok) {
|
if (!body.ok) {
|
||||||
res.statusCode = body.error === "payload too large" ? 413 : 400;
|
if (body.error === "payload too large") {
|
||||||
|
res.statusCode = 413;
|
||||||
|
} else if (body.error === "request body timeout") {
|
||||||
|
res.statusCode = 408;
|
||||||
|
} else {
|
||||||
|
res.statusCode = 400;
|
||||||
|
}
|
||||||
res.end(body.error ?? "invalid payload");
|
res.end(body.error ?? "invalid payload");
|
||||||
console.warn(`[bluebubbles] webhook rejected: ${body.error ?? "invalid payload"}`);
|
console.warn(`[bluebubbles] webhook rejected: ${body.error ?? "invalid payload"}`);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -79,19 +79,16 @@ function createDiscordGatewayPlugin(params: {
|
|||||||
params.runtime.log?.("discord: gateway proxy enabled");
|
params.runtime.log?.("discord: gateway proxy enabled");
|
||||||
|
|
||||||
class ProxyGatewayPlugin extends GatewayPlugin {
|
class ProxyGatewayPlugin extends GatewayPlugin {
|
||||||
#proxyAgent: HttpsProxyAgent<string>;
|
constructor() {
|
||||||
|
|
||||||
constructor(proxyAgent: HttpsProxyAgent<string>) {
|
|
||||||
super(options);
|
super(options);
|
||||||
this.#proxyAgent = proxyAgent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createWebSocket(url: string) {
|
createWebSocket(url: string) {
|
||||||
return new WebSocket(url, { agent: this.#proxyAgent });
|
return new WebSocket(url, { agent });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ProxyGatewayPlugin(agent);
|
return new ProxyGatewayPlugin();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
params.runtime.error?.(danger(`discord: invalid gateway proxy: ${String(err)}`));
|
params.runtime.error?.(danger(`discord: invalid gateway proxy: ${String(err)}`));
|
||||||
return new GatewayPlugin(options);
|
return new GatewayPlugin(options);
|
||||||
|
|||||||
Reference in New Issue
Block a user