Skip to content

Commit 6c9ade8

Browse files
committed
fix: runtime resolution bug on @nuxtjs/robots/util
1 parent 4feaccc commit 6c9ade8

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

src/runtime/app/utils/fingerprinting.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,39 @@
11
import type { BotDetectionResult } from '@fingerprintjs/botd'
2-
import type { BotDetectionContext } from '@nuxtjs/robots/util'
3-
import { mapBotKindToCategory } from '@nuxtjs/robots/util'
2+
import type { BotDetectionContext } from '../../types'
43
import { useStorage } from '@vueuse/core'
54
import { ref } from 'vue'
65

6+
// TODO: import from @nuxtjs/robots/util once CI import issues resolved
7+
type BotCategory = 'search-engine' | 'social' | 'seo' | 'ai' | 'generic' | 'automation' | 'http-tool' | 'security-scanner' | 'scraping'
8+
type BotKind = 'awesomium' | 'cef' | 'cefsharp' | 'coachjs' | 'electron' | 'fminer' | 'geb' | 'nightmarejs' | 'phantomas' | 'phantomjs' | 'rhino' | 'selenium' | 'sequentum' | 'slimerjs' | 'webdriverio' | 'webdriver' | 'headless_chrome' | 'unknown'
9+
function mapBotKindToCategory(botKind: BotKind): BotCategory {
10+
switch (botKind) {
11+
case 'selenium':
12+
case 'webdriver':
13+
case 'webdriverio':
14+
case 'phantomjs':
15+
case 'phantomas':
16+
case 'nightmarejs':
17+
case 'slimerjs':
18+
case 'headless_chrome':
19+
case 'electron':
20+
case 'cef':
21+
case 'cefsharp':
22+
case 'rhino':
23+
return 'automation'
24+
case 'fminer':
25+
case 'sequentum':
26+
case 'geb':
27+
return 'scraping'
28+
case 'awesomium':
29+
case 'coachjs':
30+
return 'security-scanner'
31+
case 'unknown':
32+
default:
33+
return 'generic'
34+
}
35+
}
36+
737
// Persistent storage for client-side fingerprint detection results only
838
const botDetectionStorage = import.meta.client
939
? useStorage<BotDetectionContext | null>('__nuxt_robots:botd', null, localStorage, {

0 commit comments

Comments
 (0)