Revert "chore(server): Changed the name of the keys. Made it easier to change the domain"

This reverts commit da7134f444.
This commit is contained in:
Данил 2025-03-05 22:25:26 +03:00
parent 8675fd918f
commit dd73f73869
2 changed files with 11 additions and 6 deletions

View file

@ -25,6 +25,7 @@
{
plausible_domain: plausible.io
plausible_token: TOKEN
plausiblee_api: https://plausible.io//api/event/
enabled: false
}
currency:

View file

@ -47,11 +47,7 @@ fastify.addHook('onResponse', async (request, reply) => {
routePartFiltered.unshift('/');
if (
!config?.['analytics']['enabled']
? config?.['analytics']['enabled']
: false
)
if (!config?.['analytics']['work'] ? config?.['analytics']['work'] : false)
return;
else if (!fastify.printRoutes().includes(routePartFiltered.at(-1))) return;
@ -85,6 +81,7 @@ fastify.addHook('onResponse', async (request, reply) => {
};
try {
<<<<<<< HEAD
await axios.post(
`https://${config['analytics']['plausible_domain']}/api/event/`,
event,
@ -94,8 +91,15 @@ fastify.addHook('onResponse', async (request, reply) => {
'Content-Type': 'application/json',
'User-Agent': userAgent,
},
=======
await axios.post(config['analytics']['plausible_api'], event, {
headers: {
Authorization: `Bearer ${config['analytics']['plausible_token']}`,
'Content-Type': 'application/json',
'User-Agent': userAgent,
>>>>>>> parent of da7134f (chore(server): Changed the name of the keys. Made it easier to change the domain)
},
);
});
} catch (error) {
fastify.log.error('Error sending event to Plausible:', error.message);
}