From b6c9aef455d40a2455f932efce29ea8f18807f95 Mon Sep 17 00:00:00 2001 From: jtgi Date: Tue, 17 Sep 2024 13:33:02 +0900 Subject: [PATCH] fix isbot? --- app/entry.server.tsx | 14 ++------------ package.json | 2 +- pnpm-lock.yaml | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/app/entry.server.tsx b/app/entry.server.tsx index e356618..fe545e0 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -5,7 +5,7 @@ import { PassThrough } from "node:stream"; import type { AppLoadContext, EntryContext } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import * as isbotModule from "isbot"; +import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; export function handleError(error: unknown, { request }: { request: Request }) { @@ -40,17 +40,7 @@ function isBotRequest(userAgent: string | null) { return false; } - // isbot >= 3.8.0, >4 - if ("isbot" in isbotModule && typeof isbotModule.isbot === "function") { - return isbotModule.isbot(userAgent); - } - - // isbot < 3.8.0 - if ("default" in isbotModule && typeof isbotModule.default === "function") { - return isbotModule.default(userAgent); - } - - return false; + return isbot(userAgent); } function handleBotRequest( diff --git a/package.json b/package.json index 7a3fac3..00ff767 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "graphql-request": "^7.1.0", "human-number": "^2.0.4", "ioredis": "^5.3.2", - "isbot": "^5.1.0", + "isbot": "^5.1.17", "js-abbreviation-number": "^1.4.0", "lucide-react": "^0.317.0", "mime-types": "^2.1.35", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a80e9e..627c8c0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -174,7 +174,7 @@ importers: specifier: ^5.3.2 version: 5.3.2 isbot: - specifier: ^5.1.0 + specifier: ^5.1.17 version: 5.1.17 js-abbreviation-number: specifier: ^1.4.0