Skip to content

Commit

Permalink
use browser engine instead of browser kind in plugins length inconsis…
Browse files Browse the repository at this point in the history
…tency
  • Loading branch information
xnerhu committed Nov 22, 2022
1 parent e27c367 commit 5fc258d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/detectors/plugins_inconsistency.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { BotKind, BrowserEngineKind, BrowserKind, ComponentDict, DetectorResponse, State } from '../types'
import { getBrowserEngineKind, getBrowserKind, isAndroid, isDesktopSafari } from '../utils/browser'
import { BotKind, BrowserEngineKind, ComponentDict, DetectorResponse, State } from '../types'
import { getBrowserEngineKind, isAndroid, isDesktopSafari } from '../utils/browser'

export function detectPluginsLengthInconsistency({ pluginsLength }: ComponentDict): DetectorResponse {
if (pluginsLength.state !== State.Success) return
const browserKind = getBrowserKind()
const browserEngineKind = getBrowserEngineKind()
// Chromium based android browsers and mobile safari have 0 plugins length.
// Chromium based android browsers and mobile webkit based browsers have 0 plugins length.
if (
(browserEngineKind === BrowserEngineKind.Chromium && isAndroid()) ||
(browserKind === BrowserKind.Safari && !isDesktopSafari())
(browserEngineKind === BrowserEngineKind.Webkit && !isDesktopSafari())
)
return
if (pluginsLength.value === 0) return BotKind.HeadlessChrome
Expand Down

0 comments on commit 5fc258d

Please sign in to comment.