securityos/node_modules/next/dist/server/web/spec-extension/user-agent.js

46 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
isBot: null,
userAgentFromString: null,
userAgent: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
isBot: function() {
return isBot;
},
userAgentFromString: function() {
return userAgentFromString;
},
userAgent: function() {
return userAgent;
}
});
const _uaparserjs = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/ua-parser-js"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function isBot(input) {
return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Google-InspectionTool|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(input);
}
function userAgentFromString(input) {
return {
...(0, _uaparserjs.default)(input),
isBot: input === undefined ? false : isBot(input)
};
}
function userAgent({ headers }) {
return userAgentFromString(headers.get("user-agent") || undefined);
}
//# sourceMappingURL=user-agent.js.map