Merge pull request #3465 from undefined-moe/patch-1

allow custom geolite database path
This commit is contained in:
Mike Cao 2025-06-08 22:06:01 -07:00 committed by GitHub
commit bfb7b611e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 4 deletions

View file

@ -25,7 +25,7 @@ body:
- type: input
attributes:
label: Which Umami version are you using? (if relevant)
description: 'For example: Chrome, Edge, Firefox, etc'
description: 'For example: 2.18.0, 2.15.1, 1.39.0, etc'
- type: input
attributes:
label: Which browser are you using? (if relevant)

View file

@ -11,6 +11,8 @@ env:
jobs:
build:
# Only run the CI if it belongs to the original repository
if: github.repository == 'umami-software/umami'
runs-on: ubuntu-latest
strategy:

View file

@ -25,7 +25,8 @@ FROM (SELECT event_id, website_id, session_id,
(regexp_matches(url_query, '(?:[&?]|^)utm_medium=([^&]+)', 'i'))[1] AS utm_medium,
(regexp_matches(url_query, '(?:[&?]|^)utm_source=([^&]+)', 'i'))[1] AS utm_source,
(regexp_matches(url_query, '(?:[&?]|^)utm_term=([^&]+)', 'i'))[1] AS utm_term
FROM "website_event") url
FROM "website_event"
WHERE url_query IS NOT NULL) url
WHERE we.event_id = url.event_id
and we.session_id = url.session_id
and we.website_id = url.website_id;
@ -45,4 +46,4 @@ SET fbclid = LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REGEXP_SUBSTR(url_query, '(?:[
utm_medium = LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REGEXP_SUBSTR(url_query, '(?:[&?]|^)utm_medium=[^&]+'), '=', -1), '&', 1), 255),
utm_source = LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REGEXP_SUBSTR(url_query, '(?:[&?]|^)utm_source=[^&]+'), '=', -1), '&', 1), 255),
utm_term = LEFT(SUBSTRING_INDEX(SUBSTRING_INDEX(REGEXP_SUBSTR(url_query, '(?:[&?]|^)utm_term=[^&]+'), '=', -1), '&', 1), 255)
WHERE 1 = 1;
WHERE url_query IS NOT NULL;

View file

@ -124,7 +124,7 @@ export async function getLocation(ip: string = '', headers: Headers, hasPayloadI
if (!global[MAXMIND]) {
const dir = path.join(process.cwd(), 'geo');
global[MAXMIND] = await maxmind.open(path.resolve(dir, 'GeoLite2-City.mmdb'));
global[MAXMIND] = await maxmind.open(process.env.GEOLITE_DB_PATH || path.resolve(dir, 'GeoLite2-City.mmdb'));
}
const result = global[MAXMIND].get(ip);