Backport changes from Cloudproxy (#11)

This commit is contained in:
Alexandre Beloin
2020-12-12 17:09:03 -05:00
committed by GitHub
parent 5ed7c09160
commit a422756ae6
18 changed files with 3918 additions and 322 deletions

View File

@@ -0,0 +1,21 @@
const solveCaptcha = require('hcaptcha-solver');
import { SolverOptions } from '.'
/*
This method uses the hcaptcha-solver project:
https://github.com/JimmyLaurent/hcaptcha-solver
TODO: allow user pass custom options to the solver.
ENV:
There are no other variables that must be set to get this to work
*/
export default async function solve({ url }: SolverOptions): Promise<string> {
try {
const token = await solveCaptcha(url)
return token
} catch (e) {
console.error(e)
return null
}
}