mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-03 23:57:37 +01:00
Cleaned up script.
This commit is contained in:
parent
9969c9b6b1
commit
1662b66fbb
@ -2,17 +2,17 @@ import { TELEMETRY_PIXEL } from 'lib/constants';
|
||||
|
||||
export default function handler(req, res) {
|
||||
const { v } = req.query;
|
||||
const script = `
|
||||
(()=>{const i=document.createElement('img');
|
||||
i.setAttribute('src','${TELEMETRY_PIXEL}?v=${v}');
|
||||
i.setAttribute('style','width:0;height:0;position:absolute;pointer-events:none;');
|
||||
document.body.appendChild(i);})();
|
||||
`;
|
||||
|
||||
res.setHeader('content-type', 'text/javascript');
|
||||
if (process.env.DISABLE_TELEMETRY) {
|
||||
res.send('/* telemetry disabled */');
|
||||
} else {
|
||||
res.send(
|
||||
`(() => {
|
||||
const i = document.createElement('img');
|
||||
i.setAttribute('src','${TELEMETRY_PIXEL}?v=${v}');
|
||||
i.setAttribute('style','width:0;height:0;position:absolute;pointer-events:none;');
|
||||
document.body.appendChild(i);
|
||||
})();`,
|
||||
);
|
||||
res.send(script.replace(/\s\s+/g, ''));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user