mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2026-04-07 01:44:30 +02:00
Improve Docker image and clean TODOs
This commit is contained in:
@@ -102,7 +102,7 @@ export default async function resolveChallenge(url: string, page: Page, response
|
||||
|
||||
// const captchaSolver = getCaptchaSolver()
|
||||
// if (captchaSolver) {
|
||||
// // todo: get the params
|
||||
// // to-do: get the params
|
||||
// log.info('Waiting to receive captcha token to bypass challenge...')
|
||||
// const token = await captchaSolver({
|
||||
// url,
|
||||
@@ -110,7 +110,7 @@ export default async function resolveChallenge(url: string, page: Page, response
|
||||
// type: captchaType
|
||||
// })
|
||||
// log.debug(`Token received: ${token}`);
|
||||
// // todo: send the token
|
||||
// // to-do: send the token
|
||||
// }
|
||||
// } else {
|
||||
// throw new Error('Captcha detected but no automatic solver is configured.');
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface SessionCreateOptions {
|
||||
oneTimeSession: boolean
|
||||
cookies?: SetCookie[],
|
||||
maxTimeout?: number
|
||||
proxy?: any// TODO: use interface not any
|
||||
proxy?: Proxy
|
||||
}
|
||||
|
||||
const sessionCache: SessionsCache = {}
|
||||
@@ -120,12 +120,9 @@ export async function create(session: string, options: SessionCreateOptions): Pr
|
||||
|
||||
log.debug('Launching web browser...')
|
||||
|
||||
// TODO: maybe access env variable?
|
||||
// TODO: sometimes browser instances are created and not connected to correctly.
|
||||
// how do we handle/quit those instances inside Docker?
|
||||
// todo: the retries are required?
|
||||
let launchTries = 3
|
||||
let browser: Browser;
|
||||
|
||||
while (0 <= launchTries--) {
|
||||
try {
|
||||
browser = await puppeteer.launch(puppeteerOptions)
|
||||
@@ -154,8 +151,6 @@ export function list(): string[] {
|
||||
return Object.keys(sessionCache)
|
||||
}
|
||||
|
||||
// todo: create a sessions.close that doesn't rm the userDataDir
|
||||
|
||||
export async function destroy(id: string): Promise<boolean>{
|
||||
if (id && sessionCache.hasOwnProperty(id)) {
|
||||
const { browser, userDataDir } = sessionCache[id]
|
||||
|
||||
Reference in New Issue
Block a user