mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-08 06:54:24 +00: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);
|
||||
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");
|
||||
console.warn(`[bluebubbles] webhook rejected: ${body.error ?? "invalid payload"}`);
|
||||
return true;
|
||||
|
||||
@@ -79,19 +79,16 @@ function createDiscordGatewayPlugin(params: {
|
||||
params.runtime.log?.("discord: gateway proxy enabled");
|
||||
|
||||
class ProxyGatewayPlugin extends GatewayPlugin {
|
||||
#proxyAgent: HttpsProxyAgent<string>;
|
||||
|
||||
constructor(proxyAgent: HttpsProxyAgent<string>) {
|
||||
constructor() {
|
||||
super(options);
|
||||
this.#proxyAgent = proxyAgent;
|
||||
}
|
||||
|
||||
createWebSocket(url: string) {
|
||||
return new WebSocket(url, { agent: this.#proxyAgent });
|
||||
return new WebSocket(url, { agent });
|
||||
}
|
||||
}
|
||||
|
||||
return new ProxyGatewayPlugin(agent);
|
||||
return new ProxyGatewayPlugin();
|
||||
} catch (err) {
|
||||
params.runtime.error?.(danger(`discord: invalid gateway proxy: ${String(err)}`));
|
||||
return new GatewayPlugin(options);
|
||||
|
||||
Reference in New Issue
Block a user