mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 11:18:28 +00:00
api: allow passing headers from service handler
This commit is contained in:
parent
3197cee473
commit
6f016e7c29
@ -192,7 +192,10 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
|
||||
|
||||
const streamInfo = getInternalStream(req.query.id);
|
||||
if (!streamInfo) return res.sendStatus(404);
|
||||
streamInfo.headers = req.headers;
|
||||
streamInfo.headers = {
|
||||
...req.headers,
|
||||
...streamInfo.headers
|
||||
};
|
||||
|
||||
return stream(res, { type: 'internal', ...streamInfo });
|
||||
} catch {
|
||||
|
@ -9,6 +9,7 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
|
||||
responseType = "stream",
|
||||
defaultParams = {
|
||||
u: r.urls,
|
||||
headers: r.headers,
|
||||
service: host,
|
||||
filename: r.filenameAttributes ?
|
||||
createFilename(r.filenameAttributes, filenamePattern, isAudioOnly, isAudioMuted) : r.filename,
|
||||
@ -80,6 +81,7 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
|
||||
service: "tiktok",
|
||||
type: audioStreamType,
|
||||
u: r.urls,
|
||||
headers: r.headers,
|
||||
filename: r.audioFilename,
|
||||
isAudioOnly: true,
|
||||
audioFormat,
|
||||
|
@ -38,6 +38,7 @@ export function createStream(obj) {
|
||||
filename: obj.filename,
|
||||
audioFormat: obj.audioFormat,
|
||||
isAudioOnly: !!obj.isAudioOnly,
|
||||
headers: obj.headers,
|
||||
copy: !!obj.copy,
|
||||
mute: !!obj.mute,
|
||||
metadata: obj.fileMetadata || false,
|
||||
@ -82,6 +83,7 @@ export function createInternalStream(url, obj = {}) {
|
||||
internalStreamCache[streamID] = {
|
||||
url,
|
||||
service: obj.service,
|
||||
headers: obj.headers,
|
||||
controller: new AbortController(),
|
||||
dispatcher
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user