@@ -4,8 +4,7 @@ var app = express();
44const atob = require ( 'atob' ) ;
55// const KEY = require('./key');
66const Base64 = require ( 'base-64' ) ;
7- const KEY = process . env . GITHUB_TOKEN ;
8- const cheerio = require ( 'cheerio' ) ;
7+ const KEY = process . env . GITHUB_TOKEN
98app . use ( cors ( ) )
109
1110
@@ -24,15 +23,14 @@ app.get('/', async (req, res) => {
2423 const ip = req . headers [ 'x-forwarded-for' ]
2524 const agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36' ;
2625
27- const url = "https://community.spiceworks.com/tools/ip-lookup/results?hostname=223.238.102.248" ;
26+ const url = "https://api.ip8.com/ip/lookup/" + ip ;
27+ // const url = "https://api.ip8.com/ip/lookup/176.10.112.40";
2828
2929 await Axios . get ( url , {
3030 headers : {
3131 'user-agent' : agent ,
32- 'accept' : 'text/html'
3332 }
3433 } ) . then ( async result => {
35- console . log ( result )
3634 const data = {
3735 headers : req . headers [ 'user-agent' ] ,
3836 ip,
@@ -47,7 +45,7 @@ app.get('/', async (req, res) => {
4745 longitude : result . data . details . geoip [ 0 ] . city . details . longitude ,
4846 }
4947
50- return res . status ( 200 ) . json ( { message : "11" } )
48+ return res . status ( 200 ) . json ( data )
5149 } ) . catch ( e => {
5250 console . log ( "Something Went Wrong, wonderfully handled exception" , e )
5351 } )
@@ -101,4 +99,4 @@ app.get('/add-sha/:sha', (req, res) => {
10199const port = process . env . PORT || 4000 ;
102100app . listen ( port , ( ) => {
103101 console . log ( `Waiting on port for someone :) ${ port } ` ) ;
104- } ) ;
102+ } ) ;
0 commit comments