mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
fix deprecated endpoints
This commit is contained in:
@@ -30,15 +30,23 @@ router.post('/metrics/push', json(jsonOptions), async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const ip = getIPFromRequest(req);
|
const ip = getIPFromRequest(req);
|
||||||
const sessionHash = createSessionHash(req.body.website, ip, req.body.userAgent);
|
const sessionHash = createSessionHash(req.body.website, ip, req.body.userAgent);
|
||||||
|
|
||||||
const { type } = req.body;
|
const { type } = req.body;
|
||||||
|
|
||||||
if (type === 0) {
|
if (type === 0) {
|
||||||
await RedisStreamService.addToStream(streamName, { ...req.body, _type: 'visit', sessionHash, ip });
|
await RedisStreamService.addToStream(streamName, {
|
||||||
|
...req.body, _type: 'visit', sessionHash, ip,
|
||||||
|
screenWidth: '0',
|
||||||
|
screenHeight: '0',
|
||||||
|
type: req.body.type.toString()
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
await RedisStreamService.addToStream(streamName, { ...req.body, _type: 'event', sessionHash, ip });
|
await RedisStreamService.addToStream(streamName, {
|
||||||
|
...req.body, _type: 'event', sessionHash, ip,
|
||||||
|
type: req.body.type.toString()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.sendStatus(200);
|
return res.sendStatus(200);
|
||||||
} catch (ex: any) {
|
} catch (ex: any) {
|
||||||
return res.status(500).json({ error: ex.message });
|
return res.status(500).json({ error: ex.message });
|
||||||
|
|||||||
Reference in New Issue
Block a user