mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
api: include generated filename
in api response
This commit is contained in:
parent
438fce3c58
commit
08490c54e4
3 changed files with 13 additions and 5 deletions
|
@ -38,19 +38,22 @@ export function createResponse(responseType, responseData) {
|
||||||
case "redirect":
|
case "redirect":
|
||||||
response = {
|
response = {
|
||||||
url: responseData?.u,
|
url: responseData?.u,
|
||||||
|
filename: responseData?.filename
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "tunnel":
|
case "tunnel":
|
||||||
response = {
|
response = {
|
||||||
url: createStream(responseData),
|
url: createStream(responseData),
|
||||||
|
filename: responseData?.filename
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "picker":
|
case "picker":
|
||||||
response = {
|
response = {
|
||||||
picker: responseData?.picker,
|
picker: responseData?.picker,
|
||||||
audio: responseData?.u
|
audio: responseData?.u,
|
||||||
|
audioFilename: responseData?.filename
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,14 @@ the response will always be a JSON object containing the `status` key, which wil
|
||||||
|:-------------|:---------|:------------------------------------------------------------|
|
|:-------------|:---------|:------------------------------------------------------------|
|
||||||
| `status` | `string` | `tunnel / redirect` |
|
| `status` | `string` | `tunnel / redirect` |
|
||||||
| `url` | `string` | url for the cobalt tunnel, or redirect to an external link |
|
| `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
|
### picker response
|
||||||
| key | type | values |
|
| key | type | values |
|
||||||
|:-------------|:---------|:------------------------------------------------------------|
|
|:----------------|:---------|:-------------------------------------------------------------------------------------------------|
|
||||||
| `status` | `string` | `picker` |
|
| `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` | `array` | array of objects containing the individual media |
|
||||||
|
|
||||||
#### picker object
|
#### picker object
|
||||||
|
|
|
@ -18,6 +18,7 @@ export type CobaltErrorResponse = {
|
||||||
|
|
||||||
type CobaltPartialURLResponse = {
|
type CobaltPartialURLResponse = {
|
||||||
url: string,
|
url: string,
|
||||||
|
filename: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
type CobaltPickerResponse = {
|
type CobaltPickerResponse = {
|
||||||
|
@ -28,6 +29,7 @@ type CobaltPickerResponse = {
|
||||||
thumb?: string,
|
thumb?: string,
|
||||||
}[];
|
}[];
|
||||||
audio?: string,
|
audio?: string,
|
||||||
|
audioFilename?: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
type CobaltRedirectResponse = {
|
type CobaltRedirectResponse = {
|
||||||
|
|
Loading…
Reference in a new issue