feat(CaptchaHandler): Must not use due to safety concerns

This commit is contained in:
March 7th
2022-11-04 18:40:19 +07:00
parent 9616ef19a7
commit b3eedc34be
9 changed files with 112 additions and 12 deletions

View File

@@ -34,7 +34,7 @@ class APIRequest {
this.path = `${path}${queryString && `?${queryString}`}`;
}
make() {
make(captchaKey = undefined) {
agent ??=
typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0
? new proxy(this.client.options.proxy)
@@ -101,6 +101,12 @@ class APIRequest {
headers = Object.assign(headers, body.getHeaders());
}
if (headers['Content-Type'] === 'application/json' && captchaKey && typeof captchaKey == 'string' && body) {
body = JSON.parse(body);
body.captcha_key = captchaKey;
body = JSON.stringify(body);
}
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), this.client.options.restRequestTimeout).unref();
return fetch(url, {