MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getDeviceInfo

Function getDeviceInfo

cli/src/hooks/use-gravity-ad.ts:478–494  ·  view source on GitHub ↗

Get device info for ads API

()

Source from the content-addressed store, hash-verified

476
477/** Get device info for ads API */
478function getDeviceInfo(): DeviceInfo {
479 // Map Node.js platform to Gravity API os values
480 const platformToOs: Record<string, 'macos' | 'windows' | 'linux'> = {
481 darwin: 'macos',
482 win32: 'windows',
483 linux: 'linux',
484 }
485 const os = platformToOs[process.platform] ?? 'linux'
486
487 // Get IANA timezone (e.g., "America/New_York")
488 const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
489
490 // Get locale (e.g., "en-US")
491 const locale = Intl.DateTimeFormat().resolvedOptions().locale
492
493 return { os, timezone, locale }
494}
495
496/**
497 * Useragent string passed to ad providers. Carbon (BuySellAds) requires a

Callers 1

fetchAdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected