Skip to content

Commit 4d2a189

Browse files
committed
lint ajustes
1 parent 48625a7 commit 4d2a189

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ import { createId as cuid } from '@paralleldrive/cuid2';
8282
import { Instance, Message } from '@prisma/client';
8383
import { createJid } from '@utils/createJid';
8484
import { fetchLatestWaWebVersion } from '@utils/fetchLatestWaWebVersion';
85-
import {makeProxyAgent, makeProxyAgentUndici} from '@utils/makeProxyAgent';
85+
import { makeProxyAgent, makeProxyAgentUndici } from '@utils/makeProxyAgent';
8686
import { getOnWhatsappCache, saveOnWhatsappCache } from '@utils/onWhatsappCache';
8787
import { status } from '@utils/renderStatus';
8888
import { sendTelemetry } from '@utils/sendTelemetry';

src/utils/makeProxyAgent.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { HttpsProxyAgent } from 'https-proxy-agent';
22
import { SocksProxyAgent } from 'socks-proxy-agent';
3-
43
import { ProxyAgent } from 'undici'
54

65
type Proxy = {
@@ -46,38 +45,38 @@ export function makeProxyAgent(proxy: Proxy | string): HttpsProxyAgent<string> |
4645
}
4746

4847
export function makeProxyAgentUndici(proxy: Proxy | string): ProxyAgent {
49-
let proxyUrl: string
50-
let protocol: string
48+
let proxyUrl: string;
49+
let protocol: string;
5150

5251
if (typeof proxy === 'string') {
53-
const url = new URL(proxy)
54-
protocol = url.protocol.replace(':', '')
55-
proxyUrl = proxy
52+
const url = new URL(proxy);
53+
protocol = url.protocol.replace(':', '');
54+
proxyUrl = proxy;
5655
} else {
57-
const { host, password, port, protocol: proto, username } = proxy
58-
protocol = (proto || 'http').replace(':', '')
56+
const { host, password, port, protocol: proto, username } = proxy;
57+
protocol = (proto || 'http').replace(':', '');
5958

6059
if (protocol === 'socks') {
61-
protocol = 'socks5'
60+
protocol = 'socks5';
6261
}
6362

64-
const auth = username && password ? `${username}:${password}@` : ''
65-
proxyUrl = `${protocol}://${auth}${host}:${port}`
63+
const auth = username && password ? `${username}:${password}@` : '';
64+
proxyUrl = `${protocol}://${auth}${host}:${port}`;
6665
}
6766

68-
const PROXY_HTTP_PROTOCOL = 'http'
69-
const PROXY_HTTPS_PROTOCOL = 'https'
70-
const PROXY_SOCKS4_PROTOCOL = 'socks4'
71-
const PROXY_SOCKS5_PROTOCOL = 'socks5'
67+
const PROXY_HTTP_PROTOCOL = 'http';
68+
const PROXY_HTTPS_PROTOCOL = 'https';
69+
const PROXY_SOCKS4_PROTOCOL = 'socks4';
70+
const PROXY_SOCKS5_PROTOCOL = 'socks5';
7271

7372
switch (protocol) {
7473
case PROXY_HTTP_PROTOCOL:
7574
case PROXY_HTTPS_PROTOCOL:
7675
case PROXY_SOCKS4_PROTOCOL:
7776
case PROXY_SOCKS5_PROTOCOL:
78-
return new ProxyAgent(proxyUrl)
77+
return new ProxyAgent(proxyUrl);
7978

8079
default:
81-
throw new Error(`Unsupported proxy protocol: ${protocol}`)
80+
throw new Error(`Unsupported proxy protocol: ${protocol}`);
8281
}
8382
}

0 commit comments

Comments
 (0)