Skip to content

Commit af34865

Browse files
committed
fix(umami): update Umami share URLs to use EU endpoint and add theme parameter for iframe embeds
1 parent adc0f5d commit af34865

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

functions/umami/share/[[path]].js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export async function onRequestGet({ request }) {
22
const url = new URL(request.url);
33
const suffix = url.pathname.replace(/^\/umami\/share/, '');
4-
const upstreamUrl = `https://cloud.umami.is/share${suffix}${url.search}`;
4+
const upstreamUrl = `https://eu.umami.is/share${suffix}${url.search}`;
55

66
// If this is a direct request to a country flag asset (we rewrote HTML to /umami/images/country/xx.png),
77
// proxy it explicitly, with a graceful fallback if the country code is missing.

next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const nextConfig = {
101101
},
102102
{
103103
source: '/umami/share/:path*',
104-
destination: 'https://cloud.umami.is/share/:path*',
104+
destination: 'https://eu.umami.is/share/:path*',
105105
},
106106
];
107107
return base;

public/yourselftoscience.pdf

0 Bytes
Binary file not shown.

src/app/stats/page.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ const StatsPage = () => {
173173
// eslint-disable-next-line no-unused-vars
174174
const __iframeConfig = {
175175
src: isProd
176-
? '/umami/share/Ojsa1vCvOf0As7LU/yourselftoscience.org'
177-
: 'https://cloud.umami.is/share/Ojsa1vCvOf0As7LU/yourselftoscience.org',
176+
? '/umami/share/Ojsa1vCvOf0As7LU/yourselftoscience.org?theme=light'
177+
: 'https://cloud.umami.is/share/Ojsa1vCvOf0As7LU/yourselftoscience.org?theme=light',
178178
sandbox: isProd
179179
? 'allow-scripts allow-forms allow-popups allow-presentation allow-same-origin'
180180
: 'allow-scripts allow-forms allow-popups allow-presentation',
@@ -385,8 +385,8 @@ const StatsPage = () => {
385385
{(() => {
386386
const isProd = process.env.NODE_ENV === 'production';
387387
const src = isProd
388-
? '/umami/share/Ojsa1vCvOf0As7LU/yourselftoscience.org'
389-
: 'https://cloud.umami.is/share/Ojsa1vCvOf0As7LU/yourselftoscience.org';
388+
? '/umami/share/Ojsa1vCvOf0As7LU/yourselftoscience.org?theme=light'
389+
: 'https://eu.umami.is/share/Ojsa1vCvOf0As7LU/yourselftoscience.org?theme=light';
390390
const sandbox = isProd
391391
? 'allow-scripts allow-forms allow-popups allow-presentation allow-same-origin'
392392
: 'allow-scripts allow-forms allow-popups allow-presentation allow-same-origin';

src/app/umami/share/[...path]/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const runtime = 'edge';
33
export async function GET(request, { params }) {
44
const url = new URL(request.url);
55
const suffix = '/' + ((params && Array.isArray(params.path)) ? params.path.join('/') : '');
6-
const upstreamUrl = `https://cloud.umami.is/share${suffix}${url.search}`;
6+
const upstreamUrl = `https://eu.umami.is/share${suffix}${url.search}`;
77

88
const upstreamResponse = await fetch(upstreamUrl, {
99
method: 'GET',

0 commit comments

Comments
 (0)