Skip to content

Commit

Permalink
whitelist chrome in plugins length incosistency (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
xnerhu authored Aug 24, 2023
1 parent 6c1ae6b commit 1a0cc6a
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/detectors/plugins_inconsistency.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { BotKind, BrowserEngineKind, BrowserKind, ComponentDict, DetectorResponse, State } from '../types'
import { getBrowserEngineKind, getBrowserKind, isAndroid, isDesktopSafari } from '../utils/browser'
import { BotKind, BrowserKind, ComponentDict, DetectorResponse, State } from '../types'
import { getBrowserKind, isAndroid } from '../utils/browser'

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

0 comments on commit 1a0cc6a

Please sign in to comment.