mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Allow multiple tracker names.
This commit is contained in:
parent
f0d13efc7a
commit
dbc19e4ffd
2 changed files with 11 additions and 6 deletions
|
|
@ -45,12 +45,16 @@ if (process.env.COLLECT_API_ENDPOINT) {
|
|||
}
|
||||
|
||||
if (process.env.TRACKER_SCRIPT_NAME) {
|
||||
const match = process.env.TRACKER_SCRIPT_NAME?.match(/\/?(\w+)(\.js)?/);
|
||||
const names = process.env.TRACKER_SCRIPT_NAME?.split(',').map(name => name.trim());
|
||||
|
||||
if (match) {
|
||||
rewrites.push({
|
||||
source: `/${match[0]}.js`,
|
||||
destination: '/script.js',
|
||||
if (names) {
|
||||
names.forEach(name => {
|
||||
const slash = name.substring(0, 1) === '/' ? '' : '/';
|
||||
|
||||
rewrites.push({
|
||||
source: `${slash}${name}`,
|
||||
destination: '/script.js',
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue