* Apply GitHub proxy to URLs if configured * @param {string} url - Original URL * @returns {string} - Proxy URL or original URL
(url)
| 20 | * @returns {string} - Proxy URL or original URL |
| 21 | */ |
| 22 | function 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 |