mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-26 17:46:06 +00:00
api/types/proxy: use default dispatcher instead of a global one
this function never gets anything but internal streams, so global proxy (`API_EXTERNAL_PROXY`) is only causing issues here. this commit fixes an issue of cobalt attempting to proxy internal streams, and failing spectacularly.
This commit is contained in:
parent
5973d70053
commit
3dafdd825a
|
@ -1,4 +1,4 @@
|
|||
import { request } from "undici";
|
||||
import { Agent, request } from "undici";
|
||||
import ffmpeg from "ffmpeg-static";
|
||||
import { spawn } from "child_process";
|
||||
import { create as contentDisposition } from "content-disposition-header";
|
||||
|
@ -60,6 +60,8 @@ const getCommand = (args) => {
|
|||
return [ffmpeg, args]
|
||||
}
|
||||
|
||||
const defaultAgent = new Agent();
|
||||
|
||||
const proxy = async (streamInfo, res) => {
|
||||
const abortController = new AbortController();
|
||||
const shutdown = () => (
|
||||
|
@ -78,7 +80,8 @@ const proxy = async (streamInfo, res) => {
|
|||
Range: streamInfo.range
|
||||
},
|
||||
signal: abortController.signal,
|
||||
maxRedirections: 16
|
||||
maxRedirections: 16,
|
||||
dispatcher: defaultAgent,
|
||||
});
|
||||
|
||||
res.status(statusCode);
|
||||
|
|
Loading…
Reference in a new issue