mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Added TRACKER_SCRIPT_URL env var.
This commit is contained in:
parent
9758b5523a
commit
1225473c20
@ -3,6 +3,8 @@ require('dotenv').config();
|
||||
const path = require('path');
|
||||
const pkg = require('./package.json');
|
||||
|
||||
const TRACKER_SCRIPT = '/script.js';
|
||||
|
||||
const basePath = process.env.BASE_PATH;
|
||||
const collectApiEndpoint = process.env.COLLECT_API_ENDPOINT;
|
||||
const cloudMode = process.env.CLOUD_MODE;
|
||||
@ -14,6 +16,7 @@ const forceSSL = process.env.FORCE_SSL;
|
||||
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;
|
||||
|
||||
const contentSecurityPolicy = [
|
||||
`default-src 'self'`,
|
||||
@ -58,13 +61,20 @@ const headers = [
|
||||
headers: defaultHeaders,
|
||||
},
|
||||
{
|
||||
source: '/script.js',
|
||||
source: TRACKER_SCRIPT,
|
||||
headers: trackerHeaders,
|
||||
},
|
||||
];
|
||||
|
||||
const rewrites = [];
|
||||
|
||||
if (trackerScriptURL) {
|
||||
rewrites.push({
|
||||
source: TRACKER_SCRIPT,
|
||||
destination: trackerScriptURL,
|
||||
});
|
||||
}
|
||||
|
||||
if (collectApiEndpoint) {
|
||||
rewrites.push({
|
||||
source: collectApiEndpoint,
|
||||
@ -100,7 +110,7 @@ if (trackerScriptName) {
|
||||
|
||||
rewrites.push({
|
||||
source: normalizedSource,
|
||||
destination: '/script.js',
|
||||
destination: TRACKER_SCRIPT,
|
||||
});
|
||||
|
||||
headers.push({
|
||||
@ -184,10 +194,6 @@ const config = {
|
||||
async rewrites() {
|
||||
return [
|
||||
...rewrites,
|
||||
{
|
||||
source: '/script.js',
|
||||
destination: 'https://tracker-script.umami.dev/',
|
||||
},
|
||||
{
|
||||
source: '/telemetry.js',
|
||||
destination: '/api/scripts/telemetry',
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "umami",
|
||||
"version": "2.13.2",
|
||||
"version": "2.14.0",
|
||||
"description": "A simple, fast, privacy-focused alternative to Google Analytics.",
|
||||
"author": "Umami Software, Inc. <hello@umami.is>",
|
||||
"license": "MIT",
|
||||
|
@ -5,7 +5,7 @@ import { terser } from 'rollup-plugin-terser';
|
||||
export default {
|
||||
input: 'src/tracker/index.js',
|
||||
output: {
|
||||
file: 'public/tracker.js',
|
||||
file: 'public/script.js',
|
||||
format: 'iife',
|
||||
},
|
||||
plugins: [
|
||||
|
Loading…
x
Reference in New Issue
Block a user