cobalt
cobalt copied to clipboard
feat: support external proxies
added support for API_EXTERNAL_PROXY
env variable that sets up a global undici dispatcher
definitely not the best way to do this (i really dislike relying on globals), but did it like this anyway because:
- there isn't a single common wrapper over
fetch()
where i could provide adispatcher
- passing it manually everywhere is very tedious and error-prone (especially considering there aren't any types)
- since api is supposed to run in a separate isolated process it probably won't affect what it isn't supposed to
one thing i worry about is the youtube handler which mentions reading dispatcher
from streamInfo
, but i couldn't find a place where it is being passed there 🧐