(raw?: string)
| 28 | } |
| 29 | |
| 30 | function validateUrl(raw?: string): URL | null { |
| 31 | try { |
| 32 | if (!raw) throw new Error('Missing ?url'); |
| 33 | const url = new URL(raw); |
| 34 | if (url.protocol !== 'http:' && url.protocol !== 'https:') { |
| 35 | throw new Error('Only http/https URLs are allowed'); |
| 36 | } |
| 37 | return url; |
| 38 | } catch (error) { |
| 39 | return null; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // Binary cache functions (more efficient than base64) |
| 44 | async function getFromCacheBinary( |
no outgoing calls
no test coverage detected