Skip to content

Commit

Permalink
🐛 fix: Try alternative strategy for IP acquisition
Browse files Browse the repository at this point in the history
  • Loading branch information
jolzee committed Jun 9, 2020
1 parent e2f3a7a commit cbeee78
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,20 @@ export default class Setup {

obtainLocation(resolve, vuetify) {
let browserIp;
let ipUrl = window.leopardConfig.ipUrl ? window.leopardConfig.ipUrl : "https://ipapi.co/ip/";
let ipUrl = window.leopardConfig.ipUrl
? window.leopardConfig.ipUrl
: "https://cors.joles.xyz/https://ipapi.co/ip/";
logger.debug(`ipUrl`, ipUrl);

superagent
.get(ipUrl)
.timeout(3000)
.then(res => {
browserIp = res.text;
logger.debug("Client IP Address", browserIp);
let geoUrl = window.leopardConfig.geoUrl
? window.leopardConfig.geoUrl
: `https://cors.joles.xyz/http://www.geoplugin.net/json.gp?ip=${res.text}`;
? `${window.leopardConfig.geoUrl}?ip=${browserIp}`
: `https://cors.joles.xyz/http://www.geoplugin.net/json.gp?ip=${browserIp}`;
logger.debug(`geoUrl`, geoUrl);
return superagent.get(geoUrl).timeout(3000).accept("application/json");
})
Expand Down

0 comments on commit cbeee78

Please sign in to comment.