From 68fab48ab729e7d6ac4d925ab8c35dbedd9885ab Mon Sep 17 00:00:00 2001 From: 360 Date: Thu, 15 May 2025 10:13:07 +0100 Subject: [PATCH 1/9] fix: correct example description for Umami version in bug report template --- .github/ISSUE_TEMPLATE/1.bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/1.bug_report.yml b/.github/ISSUE_TEMPLATE/1.bug_report.yml index 711468f25..2404918b8 100644 --- a/.github/ISSUE_TEMPLATE/1.bug_report.yml +++ b/.github/ISSUE_TEMPLATE/1.bug_report.yml @@ -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) From 8d483d92830cda0efa15d5c54d42a26168004077 Mon Sep 17 00:00:00 2001 From: Eritque arcus Date: Thu, 22 May 2025 00:19:50 -0500 Subject: [PATCH 2/9] fix: hash is not included in record --- src/app/api/send/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/send/route.ts b/src/app/api/send/route.ts index 60d6f7af0..9d41a68f6 100644 --- a/src/app/api/send/route.ts +++ b/src/app/api/send/route.ts @@ -145,7 +145,7 @@ export async function POST(request: Request) { const base = hostname ? `https://${hostname}` : 'https://localhost'; const currentUrl = new URL(url, base); - let urlPath = currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname; + let urlPath = currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname + currentUrl.hash; const urlQuery = currentUrl.search.substring(1); const urlDomain = currentUrl.hostname.replace(/^www./, ''); From 33110a44ec1c04896e4b6f06ba7773156901b6d6 Mon Sep 17 00:00:00 2001 From: Eritque arcus Date: Thu, 22 May 2025 00:24:48 -0500 Subject: [PATCH 3/9] fix: fix remove trailing slash regex --- src/app/api/send/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/send/route.ts b/src/app/api/send/route.ts index 9d41a68f6..65c88a285 100644 --- a/src/app/api/send/route.ts +++ b/src/app/api/send/route.ts @@ -169,7 +169,7 @@ export async function POST(request: Request) { const twclid = currentUrl.searchParams.get('twclid'); if (process.env.REMOVE_TRAILING_SLASH) { - urlPath = urlPath.replace(/(.+)\/$/, '$1'); + urlPath = urlPath.replace(/\/(?=(#.*)?$)/, ''); } if (referrer) { From e8f166cc690c595f21a1ebf6143bbaf61b343848 Mon Sep 17 00:00:00 2001 From: Ru Chern Chong <10343662+ruchernchong@users.noreply.github.com> Date: Thu, 22 May 2025 15:19:34 +0800 Subject: [PATCH 4/9] Update ci.yml Only run the CI if it belongs to the original repository --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 314c6944b..835407b41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: From 19ccfa0745410c4e501a6ce7a577ab51893fbb44 Mon Sep 17 00:00:00 2001 From: Matt Harrington Date: Fri, 13 Jun 2025 12:17:18 -0700 Subject: [PATCH 5/9] fixing the clickhouse schema file --- db/clickhouse/schema.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/clickhouse/schema.sql b/db/clickhouse/schema.sql index fef600e05..1080b4d11 100644 --- a/db/clickhouse/schema.sql +++ b/db/clickhouse/schema.sql @@ -122,7 +122,7 @@ CREATE TABLE umami.website_event_stats_hourly min_time SimpleAggregateFunction(min, DateTime('UTC')), max_time SimpleAggregateFunction(max, DateTime('UTC')), tag SimpleAggregateFunction(groupArrayArray, Array(String)), - distinct_id, + distinct_id String, created_at Datetime('UTC') ) ENGINE = AggregatingMergeTree @@ -213,7 +213,7 @@ FROM (SELECT min(created_at) min_time, max(created_at) max_time, arrayFilter(x -> x != '', groupArray(tag)) tag, - distinct_id String, + distinct_id, toStartOfHour(created_at) timestamp FROM umami.website_event GROUP BY website_id, From 42c0ccc2eb6cc5aa0ed34992a04bef97e9019d10 Mon Sep 17 00:00:00 2001 From: Sov3rain <10755450+Sov3rain@users.noreply.github.com> Date: Mon, 23 Jun 2025 15:17:22 +0200 Subject: [PATCH 6/9] Add keepalive option to tracker fetch request --- src/tracker/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tracker/index.js b/src/tracker/index.js index 905ba4344..76d29a1dd 100644 --- a/src/tracker/index.js +++ b/src/tracker/index.js @@ -150,6 +150,7 @@ try { const res = await fetch(endpoint, { + keepalive: true, method: 'POST', body: JSON.stringify({ type, payload }), headers: { From d72833af133bacdfc3a8093f7a86216e41369659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Alasj=C3=B6?= Date: Thu, 26 Jun 2025 11:37:05 +0200 Subject: [PATCH 7/9] Default empty string, prevent frameAncestors to be undefined --- next.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next.config.mjs b/next.config.mjs index 792d21f18..9646a7f67 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -16,7 +16,7 @@ const disableLogin = process.env.DISABLE_LOGIN; const disableUI = process.env.DISABLE_UI; const faviconURL = process.env.FAVICON_URL; const forceSSL = process.env.FORCE_SSL; -const frameAncestors = process.env.ALLOWED_FRAME_URLS; +const frameAncestors = process.env.ALLOWED_FRAME_URLS ? process.env.ALLOWED_FRAME_URLS : ''; const privateMode = process.env.PRIVATE_MODE; const trackerScriptName = process.env.TRACKER_SCRIPT_NAME; const trackerScriptURL = process.env.TRACKER_SCRIPT_URL; From 5a5e3a1502d977b25740d25ae90f5e2c3de75982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Alasj=C3=B6?= Date: Thu, 26 Jun 2025 11:45:42 +0200 Subject: [PATCH 8/9] Nullish coalescing --- next.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next.config.mjs b/next.config.mjs index 9646a7f67..69ce52bef 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -16,7 +16,7 @@ const disableLogin = process.env.DISABLE_LOGIN; const disableUI = process.env.DISABLE_UI; const faviconURL = process.env.FAVICON_URL; const forceSSL = process.env.FORCE_SSL; -const frameAncestors = process.env.ALLOWED_FRAME_URLS ? process.env.ALLOWED_FRAME_URLS : ''; +const frameAncestors = process.env.ALLOWED_FRAME_URLS ?? ''; const privateMode = process.env.PRIVATE_MODE; const trackerScriptName = process.env.TRACKER_SCRIPT_NAME; const trackerScriptURL = process.env.TRACKER_SCRIPT_URL; From 26ddfd5a80683b1750a821d87cadff781d8fa146 Mon Sep 17 00:00:00 2001 From: Alex Escalante <656454+AlexEscalante@users.noreply.github.com> Date: Mon, 30 Jun 2025 18:40:21 -0600 Subject: [PATCH 9/9] Sanitize IP to remove port for geolocation lookup Sanitize IP address to remove port number before geolocation lookup. This ensures proper MaxMind database resolution in setups where IP:PORT is passed by the proxy. --- src/lib/detect.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/detect.ts b/src/lib/detect.ts index a023d27d2..ae750469b 100644 --- a/src/lib/detect.ts +++ b/src/lib/detect.ts @@ -127,7 +127,9 @@ export async function getLocation(ip: string = '', headers: Headers, hasPayloadI global[MAXMIND] = await maxmind.open(path.resolve(dir, 'GeoLite2-City.mmdb')); } - const result = global[MAXMIND].get(ip); + // When the client IP is extracted from headers, sometimes the value includes a port + const cleanIp = ip?.split(':')[0]; + const result = global[MAXMIND].get(cleanIp); if (result) { const country = result.country?.iso_code ?? result?.registered_country?.iso_code;