Added analytics configuration.

This commit is contained in:
DebaucheryLibrarian 2023-07-24 00:59:47 +02:00
parent 997914ec27
commit 9f727a0fa0
3 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,10 @@
<link rel="stylesheet" href="/css/style.css"> <link rel="stylesheet" href="/css/style.css">
<script src="/js/bundle.js" defer></script> <script src="/js/bundle.js" defer></script>
<% if (analytics.enabled) { %>
<script async src="<%- analytics.address %>" data-website-id="<%- analytics.siteId %>"></script>
<% } %>
</head> </head>
<body> <body>
<div id="container"></div> <div id="container"></div>

View File

@ -30,6 +30,11 @@ module.exports = {
}, },
}, },
}, },
analytics: {
enabled: true,
address: 'http://localhost:3000/script.js',
siteId: '1b28ac3b-d229-43bf-aec9-75cf0a72a466',
},
s3: { s3: {
enabled: false, enabled: false,
bucket: 'traxxx', bucket: 'traxxx',

View File

@ -151,6 +151,7 @@ async function initServer() {
router.get('*', (req, res) => { router.get('*', (req, res) => {
res.render(path.join(__dirname, '../../assets/index.ejs'), { res.render(path.join(__dirname, '../../assets/index.ejs'), {
analytics: config.analytics,
env: JSON.stringify({ env: JSON.stringify({
sfw: !!req.headers.sfw || Object.prototype.hasOwnProperty.call(req.query, 'sfw'), sfw: !!req.headers.sfw || Object.prototype.hasOwnProperty.call(req.query, 'sfw'),
login: config.auth.login, login: config.auth.login,