forked from umami-software/umami
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6cc6cb
commit 074fa2c
Showing
6 changed files
with
59 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
db/postgresql/migrations/05_add_page_title_subdivision_city/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
-- AlterTable | ||
ALTER TABLE "session" ADD COLUMN "city" VARCHAR(50), | ||
ADD COLUMN "subdivision" CHAR(3); | ||
ADD COLUMN "subdivision1" CHAR(3), | ||
ADD COLUMN "subdivision2" CHAR(3); | ||
|
||
-- AlterTable | ||
ALTER TABLE "website_event" ADD COLUMN "page_title" VARCHAR(500); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable no-console */ | ||
require('dotenv').config(); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const https = require('https'); | ||
const zlib = require('zlib'); | ||
const tar = require('tar'); | ||
const maxmind = require('maxmind'); | ||
|
||
async function getLocation() { | ||
const lookup = await maxmind.open(path.resolve('../node_modules/.geo/GeoLite2-City.mmdb')); | ||
const result = lookup.get('104.93.28.0'); | ||
|
||
const country = result?.country?.iso_code ?? result?.registered_country?.iso_code; | ||
const subdivision = result?.subdivisions[0].iso_code; | ||
const subdivision2 = result?.subdivisions[0].names; | ||
const subdivision3 = result?.subdivisions[1].names; | ||
const city = result?.city?.names?.en; | ||
console.log(result); | ||
console.log(country, subdivision, city, subdivision2, subdivision3); | ||
} | ||
|
||
getLocation(); |