Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sairaj-mote committed Jan 15, 2024
1 parent 0d426e3 commit 75889dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions routes/is-tor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ const axios = require('axios');

router.get('/', async (req, res) => {
try {
const response = await axios.get('https://check.torproject.org/api/ip');
const isTor = response.data.IsTor;
res.json({ isTor });
const ip = req.headers['x-forwarded-for'] || req.get('X-Real-IP') || req.ip;
const response = await axios.get(`https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=${ip}`);
const isTor = response.data.includes(ip);
res.json({ isTor, ip });
} catch (error) {
res.status(500).json({ error: error.message });
}
Expand Down
2 changes: 1 addition & 1 deletion routes/is-tor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75889dd

Please sign in to comment.