move sdk packages to its own folder and rename api & dashboard
This commit is contained in:
19
apps/api/src/bots/index.ts
Normal file
19
apps/api/src/bots/index.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import bots from './bots';
|
||||
|
||||
export function isBot(ua: string) {
|
||||
const res = bots.find((bot) => {
|
||||
if (new RegExp(bot.regex).test(ua)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!res) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
name: res.name,
|
||||
type: res.category || 'Unknown',
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user