mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
api: add an option to always proxy files
This commit is contained in:
parent
2f63f6bab7
commit
a9e65b0da0
3 changed files with 8 additions and 1 deletions
|
@ -4,7 +4,7 @@ import { createResponse } from "./request.js";
|
|||
import { audioIgnore } from "./service-config.js";
|
||||
import { createStream } from "../stream/manage.js";
|
||||
|
||||
export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disableMetadata, filenameStyle, twitterGif, requestIP, audioBitrate }) {
|
||||
export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disableMetadata, filenameStyle, twitterGif, requestIP, audioBitrate, alwaysProxy }) {
|
||||
let action,
|
||||
responseType = "stream",
|
||||
defaultParams = {
|
||||
|
@ -192,5 +192,10 @@ export default function({ r, host, audioFormat, isAudioOnly, isAudioMuted, disab
|
|||
break;
|
||||
}
|
||||
|
||||
if (alwaysProxy && responseType === "redirect") {
|
||||
responseType = "stream";
|
||||
params.type = "proxy";
|
||||
}
|
||||
|
||||
return createResponse(responseType, {...defaultParams, ...params})
|
||||
}
|
||||
|
|
|
@ -282,6 +282,7 @@ export default async function(host, patternMatch, obj) {
|
|||
twitterGif: obj.twitterGif,
|
||||
requestIP,
|
||||
audioBitrate: obj.audioBitrate,
|
||||
alwaysProxy: obj.alwaysProxy,
|
||||
})
|
||||
} catch {
|
||||
return createResponse("error", {
|
||||
|
|
|
@ -37,6 +37,7 @@ export const apiSchema = z.object({
|
|||
.transform(verifyLanguageCode)
|
||||
.optional(),
|
||||
|
||||
alwaysProxy: z.boolean().default(false),
|
||||
disableMetadata: z.boolean().default(false),
|
||||
tiktokFullAudio: z.boolean().default(true),
|
||||
tiktokH265: z.boolean().default(false),
|
||||
|
|
Loading…
Reference in a new issue