Skip to content
This repository has been archived by the owner on Feb 21, 2025. It is now read-only.

Commit

Permalink
[TL-DYS-68] v2 (#73)
Browse files Browse the repository at this point in the history
* TL-DYS-63

* Bugfix category and difficulty url state

* Fix isbot error

* Fix import of isbot
  • Loading branch information
Kevin-Umali authored Jan 1, 2024
1 parent c7446c4 commit 2f602ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/middleware/useragent-parser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Request, Response, NextFunction } from "express";
import UAParser from "ua-parser-js";
import isBot from "isbot";
import { isbot } from "isbot";

const userAgentMiddleware = (req: Request, res: Response, next: NextFunction) => {
const userAgentString = req.headers["user-agent"] ?? "";
Expand All @@ -12,7 +12,7 @@ const userAgentMiddleware = (req: Request, res: Response, next: NextFunction) =>
req.useragent = {
isMobile: deviceType === "mobile",
isDesktop: deviceType === undefined || !["wearable", "mobile"].includes(deviceType),
isBot: isBot.isbot(userAgentString),
isBot: isbot(userAgentString),
browser: result.browser.name ?? "Unknown",
version: result.browser.version ?? "Unknown",
os: result.os.name ?? "Unknown",
Expand Down

0 comments on commit 2f602ea

Please sign in to comment.