MCPcopy Index your code
hub / github.com/anomalyco/opencode / parseRedirectUri

Function parseRedirectUri

packages/opencode/src/mcp/oauth-provider.ts:246–259  ·  view source on GitHub ↗
(redirectUri?: string)

Source from the content-addressed store, hash-verified

244 * Returns defaults if the URI can't be parsed.
245 */
246export function parseRedirectUri(redirectUri?: string): { port: number; path: string } {
247 if (!redirectUri) {
248 return { port: OAUTH_CALLBACK_PORT, path: OAUTH_CALLBACK_PATH }
249 }
250
251 try {
252 const url = new URL(redirectUri)
253 const port = url.port ? parseInt(url.port, 10) : url.protocol === "https:" ? 443 : 80
254 const path = url.pathname || OAUTH_CALLBACK_PATH
255 return { port, path }
256 } catch {
257 return { port: OAUTH_CALLBACK_PORT, path: OAUTH_CALLBACK_PATH }
258 }
259}

Callers 2

ensureRunningFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected