MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / isServer

Function isServer

packages/common/server/parser-user-agent.ts:290–304  ·  view source on GitHub ↗
(res: UAParser.IResult)

Source from the content-addressed store, hash-verified

288}
289
290function isServer(res: UAParser.IResult) {
291 // Matches user agents like "Go-http-client/1.0" or "Go Http Client/1.0"
292 // It should just match the first name (with optional spaces) and version
293 if (SINGLE_NAME_VERSION_REGEX.test(res.ua)) {
294 return true;
295 }
296
297 // If all of these are undefined, we can consider it a server
298 return (
299 res.os.name === undefined &&
300 res.browser.name === undefined &&
301 res.device.vendor === undefined &&
302 res.device.model === undefined
303 );
304}
305
306export function getDevice(ua: string, model?: string) {
307 // Check for known phone models first (from top brands)

Callers 1

parseUserAgentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected