MCPcopy
hub / github.com/electerm/electerm / applyProxy

Function applyProxy

npm/utils.js:22–32  ·  view source on GitHub ↗

* Apply GitHub proxy to URLs if configured * @param {string} url - Original URL * @returns {string} - Proxy URL or original URL

(url)

Source from the content-addressed store, hash-verified

20 * @returns {string} - Proxy URL or original URL
21 */
22function applyProxy (url) {
23 if (!GITHUB_PROXY) return url
24 if (!url.includes('github.com')) return url
25
26 // Remove trailing slash from proxy if present
27 const proxy = GITHUB_PROXY.replace(/\/+$/, '')
28 // Ensure url has protocol
29 const urlWithProto = url.startsWith('http') ? url : `https://${url}`
30
31 return `${proxy}/${urlWithProto}`
32}
33
34/**
35 * Format bytes to human readable

Callers 7

runLinuxFunction · 0.85
runWinFunction · 0.85
runWin7Function · 0.85
runMacFunction · 0.85
runMac10Function · 0.85
downloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected