feat: custom solve captcha function

This commit is contained in:
March 7th
2023-01-03 13:56:24 +07:00
parent 84e2e23468
commit c9d2d1bd18
7 changed files with 30 additions and 5 deletions

View File

@@ -92,6 +92,15 @@ const { randomUA } = require('../util/Constants');
* @property {SweeperOptions} [sweepers={}] Options for cache sweeping
* @property {WebsocketOptions} [ws] Options for the WebSocket
* @property {HTTPOptions} [http] HTTP options
* @property {CustomCaptchaSolver} [captchaSolver] Function to solve a captcha (custom)
*/
/**
* Function to solve a captcha
* @typedef {function} CustomCaptchaSolver
* @param {Captcha} captcha The captcha to solve
* @param {string} userAgent The user agent to use for the request
* @returns {Promise<string>} hcaptcha token
*/
/**
@@ -148,6 +157,7 @@ class Options extends null {
static createDefault() {
return {
jsonTransformer: object => JSONBig.stringify(object),
captchaSolver: captcha => Promise.reject(new Error('CAPTCHA_SOLVER_NOT_IMPLEMENTED', captcha)),
closeTimeout: 5_000,
checkUpdate: true,
readyStatus: true,