mirror of
https://github.com/Redume/Kekkai.git
synced 2025-03-12 19:44:39 +03:00
chore(server): Changed the name of the keys. Made it easier to change the domain
This commit is contained in:
parent
7240fc4472
commit
da7134f444
1 changed files with 15 additions and 7 deletions
|
@ -47,7 +47,11 @@ fastify.addHook('onResponse', async (request, reply) => {
|
||||||
|
|
||||||
routePartFiltered.unshift('/');
|
routePartFiltered.unshift('/');
|
||||||
|
|
||||||
if (!config?.['analytics']['work'] ? config?.['analytics']['work'] : false)
|
if (
|
||||||
|
!config?.['analytics']['enabled']
|
||||||
|
? config?.['analytics']['enabled']
|
||||||
|
: false
|
||||||
|
)
|
||||||
return;
|
return;
|
||||||
else if (!fastify.printRoutes().includes(routePartFiltered.at(-1))) return;
|
else if (!fastify.printRoutes().includes(routePartFiltered.at(-1))) return;
|
||||||
|
|
||||||
|
@ -81,13 +85,17 @@ fastify.addHook('onResponse', async (request, reply) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await axios.post(config['analytics']['plausible_api'], event, {
|
await axios.post(
|
||||||
headers: {
|
`https://${config['analytics']['plausible_domain']}/api/event`,
|
||||||
Authorization: `Bearer ${config['analytics']['plausible_token']}`,
|
event,
|
||||||
'Content-Type': 'application/json',
|
{
|
||||||
'User-Agent': userAgent,
|
headers: {
|
||||||
|
Authorization: `Bearer ${config['analytics']['plausible_token']}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'User-Agent': userAgent,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
fastify.log.error('Error sending event to Plausible:', error.message);
|
fastify.log.error('Error sending event to Plausible:', error.message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue