Files
Kazuki Yamada c82accf641 refactor(website): Use isbot package on client side for consistency
Replace hand-rolled bot regex with the isbot package (~6.5 KB ESM,
zero deps) to match server-side detection. Eliminates divergence
between client and server bot detection logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 22:44:19 +09:00

13 lines
317 B
TypeScript

import { isbot } from 'isbot';
/**
* Detects whether the current user agent is a bot/crawler.
* Used to prevent automatic API calls when bots render pages with JavaScript.
*/
export function isBot(): boolean {
if (typeof navigator === 'undefined') {
return false;
}
return isbot(navigator.userAgent);
}