const axios = require('axios'); const handler = async (req, res) => { try { const { site_url, site_key, key } = req.query; if (!site_url || !site_key || !key) { return res.status(400).json({ author: 'Herza', success: false, error: 'Missing required parameters: site_url, site_key, or key' }); } const solverUrl = `https://herzaj-turnstile-solver.hf.space/turnstile?url=${encodeURIComponent(site_url)}&sitekey=${encodeURIComponent(site_key)}`; const firstResponse = await axios.get(solverUrl, { timeout: 30000 }); const taskId = firstResponse.data?.task_id; if (!taskId) { return res.status(400).json({ author: 'Herza', success: false, error: 'Failed to obtain task_id from solver service' }); } await new Promise(resolve => setTimeout(resolve, 8000)); const resultUrl = `https://herzaj-turnstile-solver.hf.space/result?id=${encodeURIComponent(taskId)}`; const secondResponse = await axios.get(resultUrl, { timeout: 30000 }); const { elapsed_time, value } = secondResponse.data; if (!value) { return res.status(400).json({ author: 'Herza', success: false, error: 'Failed to retrieve token value from solver service' }); } return res.json({ author: 'Herza', success: true, data: { elapsed_time, value, site_url, site_key } }); } catch (error) { return res.status(500).json({ author: 'Herza', success: false, error: error.message }); } }; module.exports = { name: 'Cloudflare Turnstile Bypass', description: 'Generate Cloudflare Turnstile tokens with custom site URL and site key', type: 'GET', routes: ['api/tools/bypasscf'], tags: ['utility', 'turnstile', 'solver'], parameters: ['site_url', 'site_key', 'key'], enabled: true, main: ['tools'], limit: 8, handler };