MCPcopy
hub / github.com/CodebuffAI/codebuff / getCountryAccess

Function getCountryAccess

web/src/app/api/v1/freebuff/session/_handlers.ts:31–53  ·  view source on GitHub ↗
(
  userId: string,
  req: NextRequest,
  deps: FreebuffSessionDeps,
)

Source from the content-addressed store, hash-verified

29type GetCountryAccessFn = (req: NextRequest) => Promise<FreeModeCountryAccess>
30
31async function getCountryAccess(
32 userId: string,
33 req: NextRequest,
34 deps: FreebuffSessionDeps,
35): Promise<FreeModeCountryAccess> {
36 return (
37 deps.getCountryAccess?.(req) ??
38 getCachedFreeModeCountryAccess({
39 userId,
40 req,
41 logger: deps.logger,
42 options: {
43 ipinfoToken: env.IPINFO_TOKEN,
44 spurToken: env.SPUR_TOKEN,
45 ipHashSecret: env.NEXTAUTH_SECRET,
46 allowLocalhost: env.NEXT_PUBLIC_CB_ENVIRONMENT === 'dev',
47 forceLimited:
48 env.NEXT_PUBLIC_CB_ENVIRONMENT === 'dev' &&
49 env.FREEBUFF_DEV_FORCE_LIMITED,
50 },
51 })
52 )
53}
54
55function toSessionCountryAccess(
56 countryAccess: FreeModeCountryAccess,

Callers 2

postFreebuffSessionFunction · 0.85
getFreebuffSessionFunction · 0.85

Calls 1

Tested by

no test coverage detected