mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Added connection logging.
This commit is contained in:
parent
0e4f4affea
commit
b355522569
1 changed files with 11 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable no-console */
|
||||
import { isbot } from 'isbot';
|
||||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import {
|
||||
|
|
@ -85,6 +86,16 @@ const schema = {
|
|||
export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
||||
await useCors(req, res);
|
||||
|
||||
req.socket.on('close', () => {
|
||||
console.log('Client closed connection');
|
||||
});
|
||||
|
||||
const abortController = new AbortController();
|
||||
req.on('close', () => {
|
||||
console.log('Request closed');
|
||||
abortController.abort();
|
||||
});
|
||||
|
||||
if (req.method === 'POST') {
|
||||
if (!process.env.DISABLE_BOT_CHECK && isbot(req.headers['user-agent'])) {
|
||||
return ok(res, { beep: 'boop' });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue