Skip to content

Commit

Permalink
Fixed error with players not syncing because of ip location check fai…
Browse files Browse the repository at this point in the history
…led. If it fails it just retuns xx now and will try to check again next time. Bumped to 3.0.3 and released
  • Loading branch information
csprance committed Sep 30, 2019
1 parent 8c98e63 commit e8d768f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "misrcon",
"productName": "MisRCON",
"version": "3.0.2",
"version": "3.0.3",
"description": "RCON Tool and Map for Miscreated game.",
"repository": {
"url": "https://github.com/csprance/misrcon.git"
Expand Down
11 changes: 9 additions & 2 deletions src/redux/players/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export const getSteamAvatar = async (steam: string): Promise<string> => {
};

export const getPlayerLocationByIp = async (ip: string): Promise<string> => {
const { data } = await axios.get(`https://freegeoip.app/json/${ip}`);
return data.country_code !== '' ? data.country_code : 'xx';
try {
const { data } = await axios.get(
`https://freegeoip.app/json/${ip.split(':')[0]}`
);
return data.country_code !== '' ? data.country_code : 'xx';
} catch (e) {
console.log(e);
return 'xx';
}
};

0 comments on commit e8d768f

Please sign in to comment.