mirror of
https://github.com/wukko/cobalt.git
synced 2025-04-30 06:24:25 +02:00
api/request/local-processing: don't return an empty audio object
& also throw errors whenever a response is invalid
This commit is contained in:
parent
9eb342e6d2
commit
6a13ca347d
@ -70,6 +70,19 @@ export function createResponse(responseType, responseData) {
|
|||||||
|
|
||||||
isHLS: responseData?.isHLS,
|
isHLS: responseData?.isHLS,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!response.audio.format) {
|
||||||
|
if (response.type === "audio") {
|
||||||
|
// audio response without a format is invalid
|
||||||
|
return internalError();
|
||||||
|
}
|
||||||
|
delete response.audio;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.output.type || !response.output.filename) {
|
||||||
|
// response without a type or filename is invalid
|
||||||
|
return internalError();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "picker":
|
case "picker":
|
||||||
|
@ -51,9 +51,9 @@ export type CobaltLocalProcessingResponse = {
|
|||||||
service: string,
|
service: string,
|
||||||
tunnel: string[],
|
tunnel: string[],
|
||||||
|
|
||||||
output?: {
|
output: {
|
||||||
type?: string, // mimetype
|
type: string, // mimetype
|
||||||
filename?: string,
|
filename: string,
|
||||||
metadata?: {
|
metadata?: {
|
||||||
album?: string,
|
album?: string,
|
||||||
copyright?: string,
|
copyright?: string,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user