1
0
Fork 0
mirror of synced 2024-06-11 23:34:45 +12:00

Updated DBIP database

This commit is contained in:
Eldad Fux 2020-01-23 10:26:53 +02:00
parent a6d40d81c3
commit 1726ab05cf
7 changed files with 9 additions and 9 deletions

View file

@ -80,7 +80,7 @@ $utopia->get('/v1/account/sessions')
->action(
function () use ($response, $user) {
$tokens = $user->getAttribute('tokens', []);
$reader = new Reader(__DIR__.'/../db/GeoLite2/GeoLite2-Country.mmdb');
$reader = new Reader(__DIR__.'/../db/DBIP/dbip-country-lite-2020-01.mmdb');
$sessions = [];
$current = Auth::tokenVerify($tokens, Auth::TOKEN_TYPE_LOGIN, Auth::$secret);
$index = 0;
@ -158,7 +158,7 @@ $utopia->get('/v1/account/security')
'account.update.password',
]);
$reader = new Reader(__DIR__.'/../db/GeoLite2/GeoLite2-Country.mmdb');
$reader = new Reader(__DIR__.'/../db/DBIP/dbip-country-lite-2020-01.mmdb');
$output = [];
foreach ($logs as $i => &$log) {
@ -183,7 +183,7 @@ $utopia->get('/v1/account/security')
];
try {
$record = $reader->country($log['ip']);
$record = $reader->country('79.176.229.216');
$output[$i]['geo']['isoCode'] = strtolower($record->country->isoCode);
$output[$i]['geo']['country'] = $record->country->name;
$output[$i]['geo']['country'] = (isset($countries[$record->country->isoCode])) ? $countries[$record->country->isoCode] : Locale::getText('locale.country.unknown');

View file

@ -18,7 +18,7 @@ $utopia->get('/v1/locale')
function () use ($response, $request, $utopia) {
$eu = include __DIR__.'/../config/eu.php';
$currencies = include __DIR__.'/../config/currencies.php';
$reader = new Reader(__DIR__.'/../db/GeoLite2/GeoLite2-Country.mmdb');
$reader = new Reader(__DIR__.'/../db/DBIP/dbip-country-lite-2020-01.mmdb');
$output = [];
$ip = $request->getIP();
$time = (60 * 60 * 24 * 45); // 45 days cache

View file

@ -160,7 +160,7 @@ $utopia->get('/v1/users/:userId/sessions')
}
$tokens = $user->getAttribute('tokens', []);
$reader = new Reader(__DIR__.'/../db/GeoLite2/GeoLite2-Country.mmdb');
$reader = new Reader(__DIR__.'/../db/DBIP/dbip-country-lite-2020-01.mmdb');
$sessions = [];
$index = 0;
$countries = Locale::getText('countries');
@ -230,7 +230,7 @@ $utopia->get('/v1/users/:userId/logs')
$logs = $audit->getLogsByUser($user->getUid());
$reader = new Reader(__DIR__.'/../db/GeoLite2/GeoLite2-Country.mmdb');
$reader = new Reader(__DIR__.'/../db/DBIP/dbip-country-lite-2020-01.mmdb');
$output = [];
foreach ($logs as $i => &$log) {

Binary file not shown.

View file

@ -8,9 +8,9 @@ echo "Updating git repository $1 / $2"
git fetch origin
git reset --hard origin/master
if test $(find "./app/db/GeoLite2/GeoLite2-Country.mmdb" -mmin +259200)
if test $(find "./app/db/DBIP/dbip-country-lite-2020-01.mmdb" -mmin +259200)
then
printf "${RED}GEO country DB has not been updated for more than 6 months. Go to https://dev.maxmind.com/geoip/geoip2/geolite2/ for more info${NC}\n"
printf "${RED}GEO country DB has not been updated for more than 6 months. Go to https://db-ip.com/db/download/ip-to-country-lite to download a newer version${NC}\n"
fi
echo 'Starting build...'

View file

@ -2,4 +2,4 @@ The locale service allows you to customize your app based on your users' locatio
The user service supports multiple locales. This feature allows you to fetch countries and continents information in your app language. To switch locales, all you need to do is pass the 'X-Appwrite-Locale' header or set the 'setLocale' method using any of our available SDKs. [View here the list of available locales](https://github.com/appwrite/appwrite/blob/master/app/config/locales.php).
This product includes GeoLite2 data created by MaxMind, available from [https://www.maxmind.com](https://www.maxmind.com).
<a href='https://db-ip.com'>IP Geolocation by DB-IP</a><!-- https://db-ip.com/db/download/ip-to-country-lite -->