const express = require('express'); const axios = require('axios'); const cors = require('cors'); const app = express(); app.use(cors()); app.use(express.json()); // The external solver (you can replace this with your own local solver later) const SOLVER_URL = 'https://rynekoo-recaptcha.hf.space/action'; app.post('/action', async (req, res) => { const { mode, url, siteKey } = req.body; if (!url || !siteKey) { return res.status(400).json({ error: 'url and siteKey are required' }); } try { const response = await axios.post(SOLVER_URL, { mode: mode || 'v3', url, siteKey }); const token = response.data?.data?.token; if (!token) { return res.status(500).json({ error: 'Failed to obtain token from solver' }); } res.json({ token }); } catch (err) { console.error(err.message); res.status(500).json({ error: err.message }); } }); app.get('/health', (req, res) => { res.send('OK'); }); const PORT = process.env.PORT || 7860; app.listen(PORT, () => { console.log(`Server running on port ${PORT}`); });