mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-21 07:26:49 +00:00
plugin
This commit is contained in:
11
lib/utils.js
11
lib/utils.js
@@ -17,17 +17,8 @@ export const isSearchEngineBot = () => {
|
||||
}
|
||||
// 获取用户代理字符串
|
||||
const userAgent = navigator.userAgent;
|
||||
const isEngine = /Googlebot|bingbot|Baidu/.test(userAgent) ||
|
||||
userAgent === 'u-a Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36' ||
|
||||
userAgent === 'u-a Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36'
|
||||
|
||||
if (isEngine) {
|
||||
console.warn('爬虫', userAgent)
|
||||
} else {
|
||||
console.error('u-a', userAgent)
|
||||
}
|
||||
// 使用正则表达式检测是否包含搜索引擎爬虫关键字
|
||||
return isEngine
|
||||
return /Googlebot|bingbot|Baidu/.test(userAgent)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user