diff --git a/api/src/processing/request.js b/api/src/processing/request.js index 7add3006..4287267c 100644 --- a/api/src/processing/request.js +++ b/api/src/processing/request.js @@ -38,19 +38,22 @@ export function createResponse(responseType, responseData) { case "redirect": response = { url: responseData?.u, + filename: responseData?.filename } break; case "tunnel": response = { url: createStream(responseData), + filename: responseData?.filename } break; case "picker": response = { picker: responseData?.picker, - audio: responseData?.u + audio: responseData?.u, + audioFilename: responseData?.filename } break; diff --git a/docs/api.md b/docs/api.md index 2e7958ac..44186527 100644 --- a/docs/api.md +++ b/docs/api.md @@ -46,12 +46,15 @@ the response will always be a JSON object containing the `status` key, which wil |:-------------|:---------|:------------------------------------------------------------| | `status` | `string` | `tunnel / redirect` | | `url` | `string` | url for the cobalt tunnel, or redirect to an external link | +| `filename` | `string` | cobalt-generated filename for the file being downloaded | ### picker response -| key | type | values | -|:-------------|:---------|:------------------------------------------------------------| -| `status` | `string` | `picker` | -| `picker` | `array` | array of objects containing the individual media | +| key | type | values | +|:----------------|:---------|:-------------------------------------------------------------------------------------------------| +| `status` | `string` | `picker` | +| `audio` | `string` | **optional** returned when an image slideshow (such as on tiktok) has a general background audio | +| `audioFilename` | `string` | **optional** cobalt-generated filename, returned if `audio` exists | +| `picker` | `array` | array of objects containing the individual media | #### picker object | key | type | values | diff --git a/web/src/lib/types/api.ts b/web/src/lib/types/api.ts index c7823639..4df054aa 100644 --- a/web/src/lib/types/api.ts +++ b/web/src/lib/types/api.ts @@ -18,6 +18,7 @@ export type CobaltErrorResponse = { type CobaltPartialURLResponse = { url: string, + filename: string, } type CobaltPickerResponse = { @@ -28,6 +29,7 @@ type CobaltPickerResponse = { thumb?: string, }[]; audio?: string, + audioFilename?: string, }; type CobaltRedirectResponse = {