From bce0115285dce6caa3f75378e3e9e7b33980e8cb Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Mon, 21 Sep 2020 17:11:16 -0700 Subject: [PATCH 01/12] Generate types from OpenAPI --- .gitignore | 3 +- Public API v1.yaml | 250 ++++++++++++++++----------------- package-lock.json | 97 +++++++++++++ package.json | 5 +- src/app/main/main.component.ts | 2 +- src/app/posts.services.ts | 53 +++---- 6 files changed, 257 insertions(+), 153 deletions(-) diff --git a/.gitignore b/.gitignore index 9d2ac87..32c9fd9 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ backend/subscriptions/playlists/* backend/subscriptions/archives/* backend/*.exe src/assets/default.json +src/api-types backend/appdata/db.json backend/appdata/archives/archive_audio.txt backend/appdata/archives/archive_video.txt @@ -65,4 +66,4 @@ backend/appdata/logs/error.log backend/appdata/users.json backend/users/* backend/appdata/cookies.txt -backend/public \ No newline at end of file +backend/public diff --git a/Public API v1.yaml b/Public API v1.yaml index e82328a..15013e0 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -21,14 +21,16 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body' + $ref: '#/components/schemas/Mp3DownloadRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200' + $ref: '#/components/schemas/Mp3DownloadResponse' + '500': + description: Server download error security: - Auth query parameter: [] /api/tomp4: @@ -46,14 +48,16 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_1' + $ref: '#/components/schemas/Mp4DownloadRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_1' + $ref: '#/components/schemas/Mp4DownloadResponse' + '500': + description: Server download error security: - Auth query parameter: [] /api/getMp3s: @@ -69,8 +73,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_2' - requestBody: {} + $ref: '#/components/schemas/GetMp3sResponse' security: - Auth query parameter: [] /api/getMp4s: @@ -86,7 +89,23 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_3' + $ref: '#/components/schemas/GetMp4sResponse' + security: + - Auth query parameter: [] + /api/getAllFiles: + post: + tags: + - files + summary: Get all files + description: Gets all files and playlists stored in the db + operationId: get-getAllFiles + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetAllFilesResponse' security: - Auth query parameter: [] /api/getFile: @@ -100,14 +119,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_2' + $ref: '#/components/schemas/GetFileRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_4' + $ref: '#/components/schemas/GetFileResponse' security: - Auth query parameter: [] /api/enableSharing: @@ -122,7 +141,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_3' + $ref: '#/components/schemas/SharingToggle' responses: '200': description: OK @@ -144,7 +163,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_4' + $ref: '#/components/schemas/SharingToggle' responses: '200': description: OK @@ -718,7 +737,7 @@ paths: type: object properties: user: - $ref: '#/components/schemas/user' + $ref: '#/components/schemas/User' token: type: string permissions: @@ -761,7 +780,7 @@ paths: type: object properties: user: - $ref: '#/components/schemas/user' + $ref: '#/components/schemas/User' description: Use this endpoint to register a user. It will only work if registration is enabled. requestBody: content: @@ -958,7 +977,7 @@ paths: users: type: array items: - $ref: '#/components/schemas/user' + $ref: '#/components/schemas/User' description: 'Gets all users, returns a list of the user objects including their user permissions, videos, playlists, subscriptions, etc.' security: - Auth query parameter: [] @@ -966,7 +985,12 @@ paths: - multi-user mode components: schemas: - body: + FileType: + type: string + enum: + - audio + - video + BaseDownloadRequest: required: - url type: object @@ -975,64 +999,72 @@ components: type: string customQualityConfiguration: type: string + description: Video format code. Overrides other quality options. example: '251' - maxBitrate: - type: string - example: '160' customArgs: type: string + description: Custom command-line arguments for youtubedl. Overrides all other options, except url. customOutput: type: string + description: Custom output filename template. youtubeUsername: type: string + description: Login with this account ID youtubePassword: type: string - inline_response_200: + description: Account password + ui_uid: + type: string + nullable: true + Mp3DownloadRequest: + allOf: + - $ref: '#/components/schemas/BaseDownloadRequest' + - type: object + properties: + maxBitrate: + type: string + description: Specify ffmpeg/avconv audio quality + example: '160' + Mp4DownloadRequest: + allOf: + - $ref: '#/components/schemas/BaseDownloadRequest' + - type: object + properties: + selectedHeight: + type: string + description: Height of the video, if known + example: '1080' + BaseDownloadResponse: required: - - audiopathEncoded - uid type: object properties: uid: type: string file_names: - type: string - audiopathEncoded: - type: string - body_1: - required: - - url - type: object - properties: - url: - type: string - customQualityConfiguration: - type: string - example: 242+251 - selectedHeight: - type: string - example: '1080' - customArgs: - type: string - customOutput: - type: string - youtubeUsername: - type: string - youtubePassword: - type: string - inline_response_200_1: - required: - - uid - - videopathEncoded - type: object - properties: - uid: - type: string - file_names: - type: string - videopathEncoded: - type: string - inline_response_200_2: + nullable: true + type: array + items: + type: string + Mp3DownloadResponse: + allOf: + - $ref: '#/components/schemas/BaseDownloadResponse' + - type: object + required: + - audiopathEncoded + properties: + audiopathEncoded: + type: string + Mp4DownloadResponse: + allOf: + - $ref: '#/components/schemas/BaseDownloadResponse' + - type: object + required: + - videopathEncoded + properties: + videopathEncoded: + type: string + GetMp3sResponse: required: - mp3s - playlists @@ -1041,48 +1073,66 @@ components: mp3s: type: array items: - $ref: '#/components/schemas/inline_response_200_2_mp3s' + $ref: '#/components/schemas/DatabaseFile' playlists: type: array description: All audio playlists items: - $ref: '#/components/schemas/inline_response_200_2_playlists' - inline_response_200_3: + $ref: '#/components/schemas/Playlist' + GetMp4sResponse: required: - mp4s + - playlists type: object properties: mp4s: type: array items: - $ref: '#/components/schemas/inline_response_200_3_mp4s' + $ref: '#/components/schemas/DatabaseFile' playlists: type: array description: All video playlists items: - type: object - body_2: + $ref: '#/components/schemas/Playlist' + GetAllFilesResponse: + required: + - files + - playlists + type: object + properties: + files: + type: array + items: + $ref: '#/components/schemas/DatabaseFile' + playlists: + type: array + description: All video playlists + items: + $ref: '#/components/schemas/Playlist' + GetFileRequest: required: - uid type: object properties: uid: type: string + description: Video UID type: + $ref: '#/components/schemas/FileType' + uuid: type: string - inline_response_200_4: + description: User UID + GetFileResponse: required: - - file - success type: object properties: success: - type: string + type: boolean file: - $ref: '#/components/schemas/inline_response_200_2_mp3s' - body_3: + $ref: '#/components/schemas/DatabaseFile' + SharingToggle: required: - - is_playlist - type - uid type: object @@ -1090,7 +1140,7 @@ components: uid: type: string type: - type: string + $ref: '#/components/schemas/FileType' is_playlist: type: boolean inline_response_200_5: @@ -1100,19 +1150,6 @@ components: properties: success: type: boolean - body_4: - required: - - type - - uid - type: object - properties: - type: - type: string - uid: - type: string - description: uid is either the video uid or the playlist ID - is_playlist: - type: boolean body_5: required: - url @@ -1303,7 +1340,7 @@ components: type: object properties: playlist: - $ref: '#/components/schemas/inline_response_200_2_playlists' + $ref: '#/components/schemas/Playlist' type: type: string success: @@ -1457,7 +1494,7 @@ components: properties: new_config_file: type: object - inline_response_200_2_mp3s: + DatabaseFile: required: - duration - id @@ -1497,7 +1534,7 @@ components: type: string sharingEnabled: type: boolean - inline_response_200_2_playlists: + Playlist: required: - fileNames - id @@ -1515,45 +1552,6 @@ components: type: string thumbnailURL: type: string - inline_response_200_3_mp4s: - required: - - duration - - id - - isAudio - - path - - size - - thumbnailURL - - title - - uid - - upload_date - - uploader - - url - type: object - properties: - id: - type: string - title: - type: string - thumbnailURL: - type: string - isAudio: - type: boolean - duration: - type: number - url: - type: string - uploader: - type: string - size: - type: number - path: - type: string - upload_date: - type: string - uid: - type: string - sharingEnabled: - type: boolean inline_response_200_6_new_sub: required: - id @@ -1633,7 +1631,7 @@ components: type: string type: type: string - user: + User: title: user type: object properties: diff --git a/package-lock.json b/package-lock.json index 08cd667..2cfdacc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9618,6 +9618,76 @@ "is-wsl": "^2.1.1" } }, + "openapi-typescript-codegen": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/openapi-typescript-codegen/-/openapi-typescript-codegen-0.4.11.tgz", + "integrity": "sha512-KWhJE4xlFXDd7sNyEiJeUx7+H1hqQ+WETzwrcXCE+CNR+pmfKkOH87fjPRUPu1TY3hSgDgZ6ex7F3lWLbirvMQ==", + "dev": true, + "requires": { + "camelcase": "6.0.0", + "commander": "6.1.0", + "handlebars": "4.7.6", + "js-yaml": "3.14.0", + "mkdirp": "1.0.4", + "path": "0.12.7", + "rimraf": "3.0.2" + }, + "dependencies": { + "camelcase": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.0.0.tgz", + "integrity": "sha512-8KMDF1Vz2gzOq54ONPJS65IvTUaB1cHJ2DMM7MbPmLZljDH1qpzzLsWdiN9pHh6qvkRVDTi/07+eNGch/oLU4w==", + "dev": true + }, + "commander": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.1.0.tgz", + "integrity": "sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==", + "dev": true + }, + "handlebars": { + "version": "4.7.6", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", + "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", + "dev": true, + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, + "js-yaml": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + } + } + }, "opn": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/opn/-/opn-5.5.0.tgz", @@ -10048,6 +10118,33 @@ "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", "dev": true }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", + "dev": true, + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + } + } + }, "path-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", diff --git a/package.json b/package.json index 14aa13e..0e1ff92 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,9 @@ "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", - "electron": "ng build --base-href ./ && electron ." + "electron": "ng build --base-href ./ && electron .", + "generate": "openapi --input ./\"Public API v1.yaml\" --output ./src/api-types --exportCore false --exportServices false --exportModels true", + "prepare": "npm run generate" }, "engines": { "node": "12.3.1", @@ -66,6 +68,7 @@ "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", + "openapi-typescript-codegen": "^0.4.11", "protractor": "~5.1.2", "ts-node": "~3.0.4", "tslint": "~5.3.2" diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index b444e11..3625449 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -63,7 +63,7 @@ export class MainComponent implements OnInit { youtubeUsername = null; youtubePassword = null; urlError = false; - path = ''; + path: string | string[] = ''; url = ''; exists = ''; percentDownloaded: number; diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 416fd2d..2153f73 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -8,9 +8,9 @@ import { THEMES_CONFIG } from '../themes'; import { Router, CanActivate } from '@angular/router'; import { DOCUMENT } from '@angular/common'; import { BehaviorSubject } from 'rxjs'; -import { v4 as uuid } from 'uuid'; import { MatSnackBar } from '@angular/material/snack-bar'; import * as Fingerprint2 from 'fingerprintjs2'; +import type { FileType, GetAllFilesResponse, GetFileRequest, GetFileResponse, GetMp3sResponse, GetMp4sResponse, Mp3DownloadRequest, Mp3DownloadResponse, Mp4DownloadRequest, Mp4DownloadResponse } from 'api-types'; @Injectable() export class PostsService implements CanActivate { @@ -25,7 +25,9 @@ export class PostsService implements CanActivate { // auth auth_token = '4241b401-7236-493e-92b5-b72696b9d853'; session_id = null; - httpOptions = null; + httpOptions: { + params: HttpParams + }; http_params: string = null; unauthorized = false; @@ -155,27 +157,29 @@ export class PostsService implements CanActivate { } // tslint:disable-next-line: max-line-length - makeMP3(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, ui_uid = null) { - return this.http.post(this.path + 'tomp3', {url: url, - maxBitrate: selectedQuality, - customQualityConfiguration: customQualityConfiguration, - customArgs: customArgs, - customOutput: customOutput, - youtubeUsername: youtubeUsername, - youtubePassword: youtubePassword, - ui_uid: ui_uid}, this.httpOptions); + makeMP3(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, ui_uid: string = null) { + const body: Mp3DownloadRequest = {url: url, + maxBitrate: selectedQuality, + customQualityConfiguration: customQualityConfiguration, + customArgs: customArgs, + customOutput: customOutput, + youtubeUsername: youtubeUsername, + youtubePassword: youtubePassword, + ui_uid: ui_uid} + return this.http.post(this.path + 'tomp3', body, this.httpOptions); } // tslint:disable-next-line: max-line-length makeMP4(url: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, ui_uid = null) { - return this.http.post(this.path + 'tomp4', {url: url, - selectedHeight: selectedQuality, - customQualityConfiguration: customQualityConfiguration, - customArgs: customArgs, - customOutput: customOutput, - youtubeUsername: youtubeUsername, - youtubePassword: youtubePassword, - ui_uid: ui_uid}, this.httpOptions); + const body: Mp4DownloadRequest = {url: url, + selectedHeight: selectedQuality, + customQualityConfiguration: customQualityConfiguration, + customArgs: customArgs, + customOutput: customOutput, + youtubeUsername: youtubeUsername, + youtubePassword: youtubePassword, + ui_uid: ui_uid} + return this.http.post(this.path + 'tomp4', body, this.httpOptions); } killAllDownloads() { @@ -207,19 +211,20 @@ export class PostsService implements CanActivate { } getMp3s() { - return this.http.get(this.path + 'getMp3s', this.httpOptions); + return this.http.get(this.path + 'getMp3s', this.httpOptions); } getMp4s() { - return this.http.get(this.path + 'getMp4s', this.httpOptions); + return this.http.get(this.path + 'getMp4s', this.httpOptions); } - getFile(uid, type, uuid = null) { - return this.http.post(this.path + 'getFile', {uid: uid, type: type, uuid: uuid}, this.httpOptions); + getFile(uid: string, type: FileType, uuid: string = null) { + const body: GetFileRequest = {uid: uid, type: type, uuid: uuid}; + return this.http.post(this.path + 'getFile', body, this.httpOptions); } getAllFiles() { - return this.http.post(this.path + 'getAllFiles', {}, this.httpOptions); + return this.http.post(this.path + 'getAllFiles', {}, this.httpOptions); } downloadFileFromServer(fileName, type, outputName = null, fullPathProvided = null, subscriptionName = null, subPlaylist = null, From b667e1dc7970bf57ca17095b6e3be77d0e3063ec Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Thu, 24 Sep 2020 14:16:13 -0700 Subject: [PATCH 02/12] Add additional named types --- Public API v1.yaml | 261 +++++++++++++++++++++----------------- src/app/posts.services.ts | 17 ++- 2 files changed, 156 insertions(+), 122 deletions(-) diff --git a/Public API v1.yaml b/Public API v1.yaml index 15013e0..2289c3b 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -395,7 +395,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_14' + $ref: '#/components/schemas/DeleteMp3Mp4Request' responses: '200': description: OK @@ -436,7 +436,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_16' + $ref: '#/components/schemas/DeleteFileRequest' responses: '200': description: OK @@ -581,7 +581,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_21' + $ref: '#/components/schemas/DeleteMp3Mp4Request' responses: '200': description: OK @@ -637,33 +637,7 @@ paths: content: application/json: schema: - type: object - properties: - downloads: - type: object - properties: - uid: - type: string - downloading: - type: boolean - complete: - type: boolean - url: - type: string - type: - type: string - percent_complete: - type: string - is_playlist: - type: boolean - timestamp_start: - type: number - timestamp_end: - type: number - fileNames: - type: array - items: - type: string + $ref: '#/components/schemas/GetAllDownloadsResponse' operationId: get-api-downloads description: Retrieves all downloads recorded by the server and their status. security: @@ -678,46 +652,12 @@ paths: content: application/json: schema: - type: object - properties: - download: - type: object - properties: - uid: - type: string - downloading: - type: boolean - complete: - type: boolean - url: - type: string - type: - type: string - percent_complete: - type: string - is_playlist: - type: boolean - timestamp_start: - type: number - timestamp_end: - type: number - fileNames: - type: array - items: - type: string + $ref: '#/components/schemas/GetDownloadResponse' requestBody: content: application/json: schema: - type: object - properties: - session_id: - type: string - download_id: - type: string - required: - - session_id - - download_id + $ref: '#/components/schemas/GetDownloadRequest' description: '' description: "Gets a single download using its download_id and session_id. session_id is the device fingerprint. If none was provided at the time of download, then set session_id is 'undeclared'." security: @@ -809,6 +749,10 @@ paths: responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' requestBody: content: application/json: @@ -816,8 +760,12 @@ paths: type: object properties: change_object: + required: + - uid type: object properties: + uid: + type: string name: type: string role: @@ -839,10 +787,7 @@ paths: content: application/json: schema: - type: object - properties: - success: - type: boolean + $ref: '#/components/schemas/SuccessObject' description: Deletes a user by its uid. requestBody: content: @@ -879,14 +824,14 @@ paths: permissions: type: array items: - type: string + $ref: '#/components/schemas/UserPermission' user: type: object properties: permissions: type: array items: - type: string + $ref: '#/components/schemas/UserPermission' description: Gets the available roles and their permissions security: - Auth query parameter: [] @@ -902,10 +847,7 @@ paths: content: application/json: schema: - type: object - properties: - success: - type: boolean + $ref: '#/components/schemas/SuccessObject' description: "Changes the permissions for a user. Available values for each permission are: `default`, `yes`, and `no`. `default` will use the user's role's default permission." security: - Auth query parameter: [] @@ -913,18 +855,7 @@ paths: content: application/json: schema: - type: object - properties: - user_uid: - type: string - permission: - type: string - new_value: - type: string - required: - - user_uid - - permission - - new_value + $ref: '#/components/schemas/ChangeUserPermissionsRequest' tags: - multi-user mode /api/changeRolePermissions: @@ -937,26 +868,12 @@ paths: content: application/json: schema: - type: object - properties: - success: - type: boolean + $ref: '#/components/schemas/SuccessObject' requestBody: content: application/json: schema: - type: object - properties: - role: - type: string - permission: - type: string - new_value: - type: string - required: - - role - - permission - - new_value + $ref: '#/components/schemas/ChangeRolePermissionsRequest' description: 'Changes the permissions for a role. Available values for each permission are: `yes`, and `no`.' security: - Auth query parameter: [] @@ -985,6 +902,13 @@ paths: - multi-user mode components: schemas: + SuccessObject: + required: + - success + type: object + properties: + success: + type: boolean FileType: type: string enum: @@ -1064,6 +988,33 @@ components: properties: videopathEncoded: type: string + GetDownloadRequest: + type: object + properties: + session_id: + type: string + download_id: + type: string + required: + - session_id + - download_id + GetDownloadResponse: + type: object + properties: + download: + $ref: '#/components/schemas/Download' + nullable: true + GetAllDownloadsResponse: + type: object + properties: + downloads: + type: object + description: Map of Session ID to inner map + additionalProperties: + type: object + description: Map of Download UID to downoad + additionalProperties: + $ref: '#/components/schemas/Download' GetMp3sResponse: required: - mp3s @@ -1370,13 +1321,6 @@ components: type: string type: type: string - body_14: - required: - - uid - type: object - properties: - uid: - type: string body_15: required: - fileNames @@ -1402,7 +1346,7 @@ components: subscriptionPlaylist: type: boolean description: Only used for subscriptions - body_16: + DeleteFileRequest: required: - fileName - type @@ -1411,7 +1355,7 @@ components: fileName: type: string type: - type: string + $ref: '#/components/schemas/FileType' apidownloadArchive_sub: required: - archive_dir @@ -1470,13 +1414,15 @@ components: new_api_key: type: string example: 4241b401-7236-493e-92b5-b72696b9d853 - body_21: + DeleteMp3Mp4Request: required: - uid type: object properties: uid: type: string + blacklistMode: + type: boolean inline_response_200_17: required: - config_file @@ -1552,6 +1498,49 @@ components: type: string thumbnailURL: type: string + Download: + required: + - uid + - ui_uid + - downloading + - complete + - url + - type + - percent_complete + - is_playlist + - timestamp_start + type: object + properties: + uid: + type: string + ui_uid: + type: string + downloading: + type: boolean + complete: + type: boolean + url: + type: string + type: + type: string + percent_complete: + type: number + is_playlist: + type: boolean + timestamp_start: + type: number + timestamp_end: + type: number + filesize: + type: number + nullable: true + error: + type: string + description: Error text, set if download fails. + fileNames: + type: array + items: + type: string inline_response_200_6_new_sub: required: - id @@ -1674,11 +1663,51 @@ components: permissions: type: array items: - type: string + $ref: '#/components/schemas/UserPermission' permission_overrides: type: array items: - type: string + $ref: '#/components/schemas/UserPermission' + UserPermission: + type: string + enum: + - filemanager + - settings + - subscriptions + - sharing + - advanced_download + - downloads_manager + BaseChangePermissionsRequest: + required: + - permission + - new_value + type: object + properties: + permission: + $ref: '#/components/schemas/UserPermission' + new_value: + type: string + enum: + - 'yes' + - 'no' + ChangeUserPermissionsRequest: + allOf: + - $ref: '#/components/schemas/BaseChangePermissionsRequest' + - type: object + properties: + user_uid: + type: string + required: + - user_uid + ChangeRolePermissionsRequest: + allOf: + - $ref: '#/components/schemas/BaseChangePermissionsRequest' + - type: object + properties: + role: + type: string + required: + - role file: title: file type: object diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 2153f73..c6784f5 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -10,7 +10,10 @@ import { DOCUMENT } from '@angular/common'; import { BehaviorSubject } from 'rxjs'; import { MatSnackBar } from '@angular/material/snack-bar'; import * as Fingerprint2 from 'fingerprintjs2'; -import type { FileType, GetAllFilesResponse, GetFileRequest, GetFileResponse, GetMp3sResponse, GetMp4sResponse, Mp3DownloadRequest, Mp3DownloadResponse, Mp4DownloadRequest, Mp4DownloadResponse } from 'api-types'; +import type { DeleteMp3Mp4Request, FileType, GetAllFilesResponse, GetFileRequest, GetFileResponse, GetMp3sResponse, GetMp4sResponse, Mp3DownloadRequest, Mp3DownloadResponse, Mp4DownloadRequest, Mp4DownloadResponse } from 'api-types'; +import { GetAllDownloadsResponse } from 'api-types/models/GetAllDownloadsResponse'; +import { GetDownloadResponse } from 'api-types/models/GetDownloadResponse'; +import { GetDownloadRequest } from 'api-types/models/GetDownloadRequest'; @Injectable() export class PostsService implements CanActivate { @@ -203,10 +206,11 @@ export class PostsService implements CanActivate { } deleteFile(uid: string, isAudio: boolean, blacklistMode = false) { + const body: DeleteMp3Mp4Request = {uid: uid, blacklistMode: blacklistMode} if (isAudio) { - return this.http.post(this.path + 'deleteMp3', {uid: uid, blacklistMode: blacklistMode}, this.httpOptions); + return this.http.post(this.path + 'deleteMp3', body, this.httpOptions); } else { - return this.http.post(this.path + 'deleteMp4', {uid: uid, blacklistMode: blacklistMode}, this.httpOptions); + return this.http.post(this.path + 'deleteMp4', body, this.httpOptions); } } @@ -330,12 +334,13 @@ export class PostsService implements CanActivate { // current downloads getCurrentDownloads() { - return this.http.get(this.path + 'downloads', this.httpOptions); + return this.http.get(this.path + 'downloads', this.httpOptions); } // current download - getCurrentDownload(session_id, download_id) { - return this.http.post(this.path + 'download', {download_id: download_id, session_id: session_id}, this.httpOptions); + getCurrentDownload(session_id: string, download_id: string) { + const body: GetDownloadRequest = {download_id: download_id, session_id: session_id}; + return this.http.post(this.path + 'download', body, this.httpOptions); } // clear downloads. download_id is optional, if it exists only 1 download will be cleared From 62c79c267e805ea16682be0aace33c640b12629d Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Thu, 24 Sep 2020 15:15:23 -0700 Subject: [PATCH 03/12] Add additional types, mainly for subscriptions --- Public API v1.yaml | 226 ++++++++++++++------------------------ src/app/posts.services.ts | 56 +++++++--- 2 files changed, 126 insertions(+), 156 deletions(-) diff --git a/Public API v1.yaml b/Public API v1.yaml index 2289c3b..589e91f 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -184,14 +184,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_5' + $ref: '#/components/schemas/SubscribeRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_6' + $ref: '#/components/schemas/SubscribeResponse' security: - Auth query parameter: [] /api/unsubscribe: @@ -205,14 +205,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_6' + $ref: '#/components/schemas/UnsubscribeRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_7' + $ref: '#/components/schemas/UnsubscribeResponse' security: - Auth query parameter: [] /api/deleteSubscriptionFile: @@ -226,14 +226,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_7' + $ref: '#/components/schemas/DeleteSubscriptionFileRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_8' + $ref: '#/components/schemas/SuccessObject' '500': description: Internal Server Error security: @@ -249,14 +249,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_8' + $ref: '#/components/schemas/GetSubscriptionRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_9' + $ref: '#/components/schemas/GetSubscriptionResponse' security: - Auth query parameter: [] /api/downloadVideosForSubscription: @@ -270,14 +270,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_9' + $ref: '#/components/schemas/DownloadVideosForSubscriptionRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_10' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/getAllSubscriptions: @@ -297,7 +297,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_11' + $ref: '#/components/schemas/GetAllSubscriptionsResponse' security: - Auth query parameter: [] /api/createPlaylist: @@ -360,7 +360,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/deletePlaylist: @@ -457,6 +457,8 @@ paths: responses: '200': description: The archive text file is sent as a response + '404': + description: If the archive dir is not found, 404 is sent as a response security: - Auth query parameter: [] /api/updaterStatus: @@ -1094,16 +1096,11 @@ components: $ref: '#/components/schemas/FileType' is_playlist: type: boolean - inline_response_200_5: - required: - - success - type: object - properties: - success: - type: boolean - body_5: + SubscribeRequest: required: + - name - url + - streamingOnly type: object properties: name: @@ -1114,46 +1111,32 @@ components: type: string streamingOnly: type: boolean - inline_response_200_6: + audioOnly: + type: boolean + customArgs: + type: string + customFileOutput: + type: string + SubscribeResponse: required: - new_sub type: object properties: new_sub: - $ref: '#/components/schemas/inline_response_200_6_new_sub' + $ref: '#/components/schemas/Subscription' error: type: string - apiunsubscribe_sub: - required: - - id - - name - - url - - videos - type: object - properties: - name: - type: string - url: - type: string - id: - type: string - streamingOnly: - type: boolean - videos: - type: array - items: - type: object - body_6: + UnsubscribeRequest: required: - sub type: object properties: sub: - $ref: '#/components/schemas/apiunsubscribe_sub' + $ref: '#/components/schemas/SubscriptionRequestData' deleteMode: type: boolean description: Defaults to false - inline_response_200_7: + UnsubscribeResponse: required: - success type: object @@ -1162,30 +1145,7 @@ components: type: boolean error: type: string - apideleteSubscriptionFile_sub: - required: - - id - - isPlaylist - - name - - url - - videos - type: object - properties: - name: - type: string - url: - type: string - id: - type: string - streamingOnly: - type: boolean - isPlaylist: - type: boolean - videos: - type: array - items: - type: object - body_7: + DeleteSubscriptionFileRequest: required: - file - sub @@ -1193,50 +1153,41 @@ components: properties: file: type: string + file_uid: + type: string sub: - $ref: '#/components/schemas/apideleteSubscriptionFile_sub' + $ref: '#/components/schemas/SubscriptionRequestData' deleteForever: type: boolean description: 'If true, does not remove id from archive. Only valid if youtube-dl archive is enabled in settings.' - inline_response_200_8: - type: object - properties: - success: - type: boolean - body_8: + GetSubscriptionRequest: required: - - subID + - id type: object properties: - subID: + id: type: string - inline_response_200_9: + description: Subscription ID + GetSubscriptionResponse: required: - files - subscription type: object properties: subscription: - $ref: '#/components/schemas/inline_response_200_9_subscription' + $ref: '#/components/schemas/Subscription' files: type: array items: type: object - body_9: + DownloadVideosForSubscriptionRequest: required: - subID type: object properties: subID: type: string - inline_response_200_10: - required: - - success - type: object - properties: - success: - type: number - inline_response_200_11: + GetAllSubscriptionsResponse: required: - subscriptions type: object @@ -1244,7 +1195,7 @@ components: subscriptions: type: array items: - $ref: '#/components/schemas/inline_response_200_11_subscriptions' + $ref: '#/components/schemas/Subscription' body_10: required: - fileNames @@ -1356,20 +1307,18 @@ components: type: string type: $ref: '#/components/schemas/FileType' - apidownloadArchive_sub: - required: - - archive_dir - type: object - properties: - archive_dir: - type: string - body_17: + DownloadArchiveRequest: required: - sub type: object properties: sub: - $ref: '#/components/schemas/apidownloadArchive_sub' + required: + - archive_dir + type: object + properties: + archive_dir: + type: string inline_response_200_14: required: - details @@ -1541,11 +1490,32 @@ components: type: array items: type: string - inline_response_200_6_new_sub: + SubscriptionRequestData: + required: + - id + - name + type: object + properties: + name: + type: string + id: + type: string + type: + $ref: '#/components/schemas/FileType' + isPlaylist: + type: boolean + archive: + type: string + Subscription: required: - id - name - url + - type + - user_uid + - streamingOnly + - isPlaylist + - videos type: object properties: name: @@ -1554,53 +1524,27 @@ components: type: string id: type: string + type: + $ref: '#/components/schemas/FileType' + user_uid: + type: string + nullable: true streamingOnly: type: boolean + isPlaylist: + type: boolean + archive: + type: string timerange: type: string - inline_response_200_9_subscription: - required: - - archive - - id - - isPlaylist - - name - - url - type: object - properties: - name: + custom_args: type: string - url: - type: string - id: - type: string - streamingOnly: - type: boolean - isPlaylist: - type: boolean - archive: - type: string - inline_response_200_11_subscriptions: - required: - - archive - - id - - isPlaylist - - name - - streamingOnly - - url - type: object - properties: - name: - type: string - url: - type: string - id: - type: string - streamingOnly: - type: boolean - isPlaylist: - type: boolean - archive: + custom_output: type: string + videos: + type: array + items: + type: object inline_response_200_12_new_playlist: required: - fileNames diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index c6784f5..92b2b43 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -10,10 +10,32 @@ import { DOCUMENT } from '@angular/common'; import { BehaviorSubject } from 'rxjs'; import { MatSnackBar } from '@angular/material/snack-bar'; import * as Fingerprint2 from 'fingerprintjs2'; -import type { DeleteMp3Mp4Request, FileType, GetAllFilesResponse, GetFileRequest, GetFileResponse, GetMp3sResponse, GetMp4sResponse, Mp3DownloadRequest, Mp3DownloadResponse, Mp4DownloadRequest, Mp4DownloadResponse } from 'api-types'; -import { GetAllDownloadsResponse } from 'api-types/models/GetAllDownloadsResponse'; -import { GetDownloadResponse } from 'api-types/models/GetDownloadResponse'; -import { GetDownloadRequest } from 'api-types/models/GetDownloadRequest'; +import { + DeleteMp3Mp4Request, + DeleteSubscriptionFileRequest, + FileType, + GetAllDownloadsResponse, + GetAllFilesResponse, + GetAllSubscriptionsResponse, + GetDownloadResponse, + GetDownloadRequest, + GetFileRequest, + GetFileResponse, + GetMp3sResponse, + GetMp4sResponse, + GetSubscriptionRequest, + GetSubscriptionResponse, + Mp3DownloadRequest, + Mp3DownloadResponse, + Mp4DownloadRequest, + Mp4DownloadResponse, + SubscribeRequest, + SubscribeResponse, + SubscriptionRequestData, + SuccessObject, + UnsubscribeRequest, + UnsubscribeResponse +} from 'api-types'; @Injectable() export class PostsService implements CanActivate { @@ -306,30 +328,34 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'deletePlaylist', {playlistID: playlistID, type: type}, this.httpOptions); } - createSubscription(url, name, timerange = null, streamingOnly = false, audioOnly = false, customArgs = null, customFileOutput = null) { - return this.http.post(this.path + 'subscribe', {url: url, name: name, timerange: timerange, streamingOnly: streamingOnly, - audioOnly: audioOnly, customArgs: customArgs, customFileOutput: customFileOutput}, this.httpOptions); + createSubscription(url: string, name: string, timerange: string = null, streamingOnly = false, audioOnly = false, customArgs: string = null, customFileOutput: string = null) { + const body: SubscribeRequest = {url: url, name: name, timerange: timerange, streamingOnly: streamingOnly, + audioOnly: audioOnly, customArgs: customArgs, customFileOutput: customFileOutput}; + return this.http.post(this.path + 'subscribe', body, this.httpOptions); } updateSubscription(subscription) { return this.http.post(this.path + 'updateSubscription', {subscription: subscription}, this.httpOptions); } - unsubscribe(sub, deleteMode = false) { - return this.http.post(this.path + 'unsubscribe', {sub: sub, deleteMode: deleteMode}, this.httpOptions) + unsubscribe(sub: SubscriptionRequestData, deleteMode = false) { + const body: UnsubscribeRequest = {sub: sub, deleteMode: deleteMode}; + return this.http.post(this.path + 'unsubscribe', body, this.httpOptions) } - deleteSubscriptionFile(sub, file, deleteForever, file_uid) { - return this.http.post(this.path + 'deleteSubscriptionFile', {sub: sub, file: file, deleteForever: deleteForever, - file_uid: file_uid}, this.httpOptions) + deleteSubscriptionFile(sub: SubscriptionRequestData, file: string, deleteForever: boolean, file_uid: string) { + const body: DeleteSubscriptionFileRequest = {sub: sub, file: file, deleteForever: deleteForever, + file_uid: file_uid}; + return this.http.post(this.path + 'deleteSubscriptionFile', body, this.httpOptions) } - getSubscription(id) { - return this.http.post(this.path + 'getSubscription', {id: id}, this.httpOptions); + getSubscription(id: string) { + const body: GetSubscriptionRequest = {id: id}; + return this.http.post(this.path + 'getSubscription', body, this.httpOptions); } getAllSubscriptions() { - return this.http.post(this.path + 'getAllSubscriptions', {}, this.httpOptions); + return this.http.post(this.path + 'getAllSubscriptions', {}, this.httpOptions); } // current downloads From 4d74c375f4c5ad188b28e3ae243abab158987244 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Thu, 24 Sep 2020 15:39:37 -0700 Subject: [PATCH 04/12] Add playlist types --- Public API v1.yaml | 114 +++++++++++++++++------------ src/app/main/main.component.ts | 5 +- src/app/player/player.component.ts | 5 +- src/app/posts.services.ts | 60 +++++++++------ 4 files changed, 112 insertions(+), 72 deletions(-) diff --git a/Public API v1.yaml b/Public API v1.yaml index 589e91f..96ba54d 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -148,7 +148,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/disableSharing: @@ -170,7 +170,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/subscribe: @@ -311,14 +311,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_10' + $ref: '#/components/schemas/CreatePlaylistRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_12' + $ref: '#/components/schemas/CreatePlaylistResponse' security: - Auth query parameter: [] /api/getPlaylist: @@ -332,28 +332,49 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_11' + $ref: '#/components/schemas/GetPlaylistRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_13' + $ref: '#/components/schemas/GetPlaylistResponse' security: - Auth query parameter: [] /api/updatePlaylist: post: tags: - playlists - summary: Update playlist files - description: Updates the list of filenames in the playlist object + summary: Update playlist + description: Updates the playlist object operationId: post-api-updatePlaylist requestBody: content: application/json: schema: - $ref: '#/components/schemas/body_12' + $ref: '#/components/schemas/UpdatePlaylistRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' + security: + - Auth query parameter: [] + /api/updatePlaylistFiles: + post: + tags: + - playlists + summary: Update playlist files + description: Updates the list of filenames in the playlist object + operationId: post-api-updatePlaylistFiles + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePlaylistFilesRequest' responses: '200': description: OK @@ -374,14 +395,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_13' + $ref: '#/components/schemas/DeletePlaylistRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/deleteMp4: @@ -495,7 +516,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/isPinSet: @@ -532,7 +553,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/setPin: @@ -552,7 +573,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] description: '' @@ -625,7 +646,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/downloads: @@ -1196,12 +1217,13 @@ components: type: array items: $ref: '#/components/schemas/Subscription' - body_10: + CreatePlaylistRequest: required: - fileNames - playlistName - thumbnailURL - type + - duration type: object properties: playlistName: @@ -1211,30 +1233,33 @@ components: items: type: string type: - type: string + $ref: '#/components/schemas/FileType' thumbnailURL: type: string - inline_response_200_12: + duration: + type: number + CreatePlaylistResponse: required: - new_playlist - success type: object properties: new_playlist: - $ref: '#/components/schemas/inline_response_200_12_new_playlist' + $ref: '#/components/schemas/Playlist' success: type: boolean - body_11: + GetPlaylistRequest: required: - playlistID - - type type: object properties: playlistID: type: string type: + $ref: '#/components/schemas/FileType' + uuid: type: string - inline_response_200_13: + GetPlaylistResponse: required: - playlist - success @@ -1244,10 +1269,17 @@ components: playlist: $ref: '#/components/schemas/Playlist' type: - type: string + $ref: '#/components/schemas/FileType' success: type: boolean - body_12: + UpdatePlaylistRequest: + required: + - playlist + type: object + properties: + playlist: + $ref: '#/components/schemas/Playlist' + UpdatePlaylistFilesRequest: required: - fileNames - playlistID @@ -1261,8 +1293,8 @@ components: items: type: string type: - type: string - body_13: + $ref: '#/components/schemas/FileType' + DeletePlaylistRequest: required: - playlistID - type @@ -1271,7 +1303,7 @@ components: playlistID: type: string type: - type: string + $ref: '#/components/schemas/FileType' body_15: required: - fileNames @@ -1435,6 +1467,9 @@ components: - id - name - thumbnailURL + - type + - registered + - duration type: object properties: name: @@ -1447,6 +1482,12 @@ components: type: string thumbnailURL: type: string + type: + $ref: '#/components/schemas/FileType' + registered: + type: number + duration: + type: number Download: required: - uid @@ -1545,25 +1586,6 @@ components: type: array items: type: object - inline_response_200_12_new_playlist: - required: - - fileNames - - id - - name - - thumbnailURL - - type - type: object - properties: - name: - type: string - fileNames: - type: string - id: - type: string - thumbnailURL: - type: string - type: - type: string User: title: user type: object diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 3625449..28e672c 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -20,6 +20,7 @@ import { CreatePlaylistComponent } from 'app/create-playlist/create-playlist.com import { Platform } from '@angular/cdk/platform'; import { v4 as uuid } from 'uuid'; import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component'; +import type { FileType } from 'api-types'; export let audioFilesMouseHovering = false; export let videoFilesMouseHovering = false; @@ -453,7 +454,7 @@ export class MainComponent implements OnInit { } public removePlaylistMp3(playlistID, index) { - this.postsService.removePlaylist(playlistID, 'audio').subscribe(res => { + this.postsService.removePlaylist(playlistID, 'audio' as FileType).subscribe(res => { if (res['success']) { this.playlists.audio.splice(index, 1); this.openSnackBar('Playlist successfully removed.', ''); @@ -472,7 +473,7 @@ export class MainComponent implements OnInit { } public removePlaylistMp4(playlistID, index) { - this.postsService.removePlaylist(playlistID, 'video').subscribe(res => { + this.postsService.removePlaylist(playlistID, 'video' as FileType).subscribe(res => { if (res['success']) { this.playlists.video.splice(index, 1); this.openSnackBar('Playlist successfully removed.', ''); diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts index 3640d7ad..79eb371 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -7,6 +7,7 @@ import { MatSnackBar } from '@angular/material/snack-bar'; import { InputDialogComponent } from 'app/input-dialog/input-dialog.component'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { ShareMediaDialogComponent } from '../dialogs/share-media-dialog/share-media-dialog.component'; +import type { FileType } from 'api-types'; export interface IMedia { title: string; @@ -360,7 +361,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { // Eventually do additional checks on name if (name) { const fileNames = this.getFileNames(); - this.postsService.createPlaylist(name, fileNames, this.type, null).subscribe(res => { + this.postsService.createPlaylist(name, fileNames, this.type as FileType, null).subscribe(res => { if (res['success']) { dialogRef.close(); const new_playlist = res['new_playlist']; @@ -401,7 +402,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { updatePlaylist() { const fileNames = this.getFileNames(); this.playlist_updating = true; - this.postsService.updatePlaylistFiles(this.id, fileNames, this.type).subscribe(res => { + this.postsService.updatePlaylistFiles(this.id, fileNames, this.type as FileType).subscribe(res => { this.playlist_updating = false; if (res['success']) { const fileNamesEncoded = fileNames.join('|nvr|'); diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 92b2b43..c7e7322 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -11,7 +11,10 @@ import { BehaviorSubject } from 'rxjs'; import { MatSnackBar } from '@angular/material/snack-bar'; import * as Fingerprint2 from 'fingerprintjs2'; import { + CreatePlaylistRequest, + CreatePlaylistResponse, DeleteMp3Mp4Request, + DeletePlaylistRequest, DeleteSubscriptionFileRequest, FileType, GetAllDownloadsResponse, @@ -23,18 +26,24 @@ import { GetFileResponse, GetMp3sResponse, GetMp4sResponse, + GetPlaylistRequest, + GetPlaylistResponse, GetSubscriptionRequest, GetSubscriptionResponse, Mp3DownloadRequest, Mp3DownloadResponse, Mp4DownloadRequest, Mp4DownloadResponse, + Playlist, + SharingToggle, SubscribeRequest, SubscribeResponse, SubscriptionRequestData, SuccessObject, UnsubscribeRequest, - UnsubscribeResponse + UnsubscribeResponse, + UpdatePlaylistFilesRequest, + UpdatePlaylistRequest, } from 'api-types'; @Injectable() @@ -293,39 +302,46 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions); } - enableSharing(uid, type, is_playlist) { - return this.http.post(this.path + 'enableSharing', {uid: uid, type: type, is_playlist: is_playlist}, this.httpOptions); + enableSharing(uid: string, type: FileType, is_playlist: boolean) { + const body: SharingToggle = {uid: uid, type: type, is_playlist: is_playlist}; + return this.http.post(this.path + 'enableSharing', body, this.httpOptions); } - disableSharing(uid, type, is_playlist) { - return this.http.post(this.path + 'disableSharing', {uid: uid, type: type, is_playlist: is_playlist}, this.httpOptions); + disableSharing(uid: string, type: FileType, is_playlist: boolean) { + const body: SharingToggle = {uid: uid, type: type, is_playlist: is_playlist}; + return this.http.post(this.path + 'disableSharing', body, this.httpOptions); } - createPlaylist(playlistName, fileNames, type, thumbnailURL, duration = null) { - return this.http.post(this.path + 'createPlaylist', {playlistName: playlistName, - fileNames: fileNames, - type: type, - thumbnailURL: thumbnailURL, - duration: duration}, this.httpOptions); + createPlaylist(playlistName: string, fileNames: string[], type: FileType, thumbnailURL: string, duration: number = null) { + const body: CreatePlaylistRequest = {playlistName: playlistName, + fileNames: fileNames, + type: type, + thumbnailURL: thumbnailURL, + duration: duration}; + return this.http.post(this.path + 'createPlaylist', body, this.httpOptions); } - getPlaylist(playlistID, type, uuid = null) { - return this.http.post(this.path + 'getPlaylist', {playlistID: playlistID, - type: type, uuid: uuid}, this.httpOptions); + getPlaylist(playlistID: string, type: FileType, uuid: string = null) { + const body: GetPlaylistRequest = {playlistID: playlistID, + type: type, uuid: uuid}; + return this.http.post(this.path + 'getPlaylist', body, this.httpOptions); } - updatePlaylist(playlist) { - return this.http.post(this.path + 'updatePlaylist', {playlist: playlist}, this.httpOptions); + updatePlaylist(playlist: Playlist) { + const body: UpdatePlaylistRequest = {playlist: playlist}; + return this.http.post(this.path + 'updatePlaylist', body, this.httpOptions); } - updatePlaylistFiles(playlistID, fileNames, type) { - return this.http.post(this.path + 'updatePlaylistFiles', {playlistID: playlistID, - fileNames: fileNames, - type: type}, this.httpOptions); + updatePlaylistFiles(playlistID: string, fileNames: string[], type: FileType) { + const body: UpdatePlaylistFilesRequest = {playlistID: playlistID, + fileNames: fileNames, + type: type}; + return this.http.post(this.path + 'updatePlaylistFiles', body, this.httpOptions); } - removePlaylist(playlistID, type) { - return this.http.post(this.path + 'deletePlaylist', {playlistID: playlistID, type: type}, this.httpOptions); + removePlaylist(playlistID: string, type: FileType) { + const body: DeletePlaylistRequest = {playlistID: playlistID, type: type}; + return this.http.post(this.path + 'deletePlaylist', body, this.httpOptions); } createSubscription(url: string, name: string, timerange: string = null, streamingOnly = false, audioOnly = false, customArgs: string = null, customFileOutput: string = null) { From fe7a3075d6dca48058518815e1f37b7fa216e237 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Fri, 25 Sep 2020 10:26:05 -0700 Subject: [PATCH 05/12] Rename last few active API routes --- Public API v1.yaml | 75 +++++++++++-------- .../recent-videos/recent-videos.component.ts | 9 ++- .../update-progress-dialog.component.ts | 3 +- src/app/main/main.component.ts | 8 +- src/app/player/player.component.ts | 8 +- src/app/posts.services.ts | 72 +++++++++++------- .../subscription/subscription.component.ts | 3 +- 7 files changed, 106 insertions(+), 72 deletions(-) diff --git a/Public API v1.yaml b/Public API v1.yaml index 96ba54d..e508fd5 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -437,11 +437,7 @@ paths: content: application/json: schema: - type: object - properties: {} - application/xml: - schema: - $ref: '#/components/schemas/body_15' + $ref: '#/components/schemas/DownloadFileRequest' responses: '200': description: 'The file itself is in the response, as well as an options object.' @@ -474,7 +470,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_17' + $ref: '#/components/schemas/DownloadArchiveRequest' responses: '200': description: The archive text file is sent as a response @@ -495,7 +491,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_14' + $ref: '#/components/schemas/UpdaterStatus' security: - Auth query parameter: [] /api/updateServer: @@ -509,7 +505,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_18' + $ref: '#/components/schemas/UpdateServerRequest' responses: '200': description: OK @@ -590,7 +586,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_16' + $ref: '#/components/schemas/GenerateNewApiKeyResponse' security: - Auth query parameter: [] /api/deleteMp3: @@ -627,7 +623,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_17' + $ref: '#/components/schemas/ConfigResponse' security: - Auth query parameter: [] /api/setConfig: @@ -639,7 +635,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_22' + $ref: '#/components/schemas/SetConfigRequest' responses: '200': description: OK @@ -647,6 +643,8 @@ paths: application/json: schema: $ref: '#/components/schemas/SuccessObject' + '404': + description: Tried to save invalid config file. security: - Auth query parameter: [] /api/downloads: @@ -937,6 +935,13 @@ components: enum: - audio - video + Config: + required: + - YoutubeDLMaterial + type: object + properties: + YoutubeDLMaterial: + type: object BaseDownloadRequest: required: - url @@ -1304,29 +1309,33 @@ components: type: string type: $ref: '#/components/schemas/FileType' - body_15: + DownloadFileRequest: required: - fileNames - type type: object properties: fileNames: - type: array - description: Array of 1 or more files to download - items: - type: string + oneOf: + - type: string + - type: array + description: Array of 1 or more files to download + items: + type: string zip_mode: type: boolean type: - type: string + $ref: '#/components/schemas/FileType' outputName: type: string fullPathProvided: + type: boolean + uuid: type: string subscriptionName: type: boolean description: Only used for subscriptions - subscriptionPlaylist: + subPlaylist: type: boolean description: Only used for subscriptions DeleteFileRequest: @@ -1351,7 +1360,7 @@ components: properties: archive_dir: type: string - inline_response_200_14: + UpdaterStatus: required: - details - updating @@ -1361,7 +1370,11 @@ components: type: boolean details: type: string - body_18: + error: + type: boolean + UpdateServerRequest: + required: + - tag type: object properties: tag: @@ -1387,7 +1400,7 @@ components: properties: unhashed_pin: type: string - inline_response_200_16: + GenerateNewApiKeyResponse: required: - new_api_key type: object @@ -1404,23 +1417,23 @@ components: type: string blacklistMode: type: boolean - inline_response_200_17: + ConfigResponse: required: - config_file - success type: object properties: config_file: - type: object + $ref: '#/components/schemas/Config' success: type: boolean - body_22: + SetConfigRequest: required: - new_config_file type: object properties: new_config_file: - type: object + $ref: '#/components/schemas/Config' DatabaseFile: required: - duration @@ -1621,7 +1634,7 @@ components: subscriptions: type: array items: - $ref: '#/components/schemas/inline_response_200_9_subscription' + $ref: '#/components/schemas/Subscription' created: type: number role: @@ -1643,6 +1656,11 @@ components: - sharing - advanced_download - downloads_manager + YesNo: + type: string + enum: + - 'yes' + - 'no' BaseChangePermissionsRequest: required: - permission @@ -1652,10 +1670,7 @@ components: permission: $ref: '#/components/schemas/UserPermission' new_value: - type: string - enum: - - 'yes' - - 'no' + $ref: '#/components/schemas/YesNo' ChangeUserPermissionsRequest: allOf: - $ref: '#/components/schemas/BaseChangePermissionsRequest' diff --git a/src/app/components/recent-videos/recent-videos.component.ts b/src/app/components/recent-videos/recent-videos.component.ts index 8333f79..11a6dcc 100644 --- a/src/app/components/recent-videos/recent-videos.component.ts +++ b/src/app/components/recent-videos/recent-videos.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { PostsService } from 'app/posts.services'; import { Router } from '@angular/router'; +import type { FileType } from '../../../api-types'; @Component({ selector: 'app-recent-videos', @@ -161,7 +162,7 @@ export class RecentVideosComponent implements OnInit { // normal subscriptions !new_tab ? this.router.navigate(['/player', {fileNames: file.id, type: file.isAudio ? 'audio' : 'video', subscriptionName: sub.name, - subPlaylist: sub.isPlaylist}]) + subPlaylist: sub.isPlaylist}]) : window.open(`/#/player;fileNames=${file.id};type=${file.isAudio ? 'audio' : 'video'};subscriptionName=${sub.name};subPlaylist=${sub.isPlaylist}`); } } else { @@ -186,7 +187,7 @@ export class RecentVideosComponent implements OnInit { } downloadSubscriptionFile(file) { - const type = file.isAudio ? 'audio' : 'video'; + const type = (file.isAudio ? 'audio' : 'video') as FileType; const ext = type === 'audio' ? '.mp3' : '.mp4' const sub = this.postsService.getSubscriptionByID(file.sub_id); this.postsService.downloadFileFromServer(file.id, type, null, null, sub.name, sub.isPlaylist, @@ -199,7 +200,7 @@ export class RecentVideosComponent implements OnInit { } downloadNormalFile(file) { - const type = file.isAudio ? 'audio' : 'video'; + const type = (file.isAudio ? 'audio' : 'video') as FileType; const ext = type === 'audio' ? '.mp3' : '.mp4' const name = file.id; this.downloading_content[type][name] = true; @@ -276,7 +277,7 @@ export class RecentVideosComponent implements OnInit { const result = b.registered - a.registered; return result; } - + durationStringToNumber(dur_str) { let num_sum = 0; const dur_str_parts = dur_str.split(':'); diff --git a/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts b/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts index fe1fbf4..9ca066f 100644 --- a/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts +++ b/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { PostsService } from 'app/posts.services'; import { MatSnackBar } from '@angular/material/snack-bar'; +import type { UpdaterStatus } from '../../../api-types'; @Component({ selector: 'app-update-progress-dialog', @@ -9,7 +10,7 @@ import { MatSnackBar } from '@angular/material/snack-bar'; }) export class UpdateProgressDialogComponent implements OnInit { - updateStatus = null; + updateStatus: UpdaterStatus = null; updateInterval = 250; errored = false; diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 28e672c..c0bb894 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -20,7 +20,7 @@ import { CreatePlaylistComponent } from 'app/create-playlist/create-playlist.com import { Platform } from '@angular/cdk/platform'; import { v4 as uuid } from 'uuid'; import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component'; -import type { FileType } from 'api-types'; +import type { FileType } from '../../api-types'; export let audioFilesMouseHovering = false; export let videoFilesMouseHovering = false; @@ -34,7 +34,7 @@ export interface Download { percent_complete: number; downloading: boolean; is_playlist: boolean; - error: boolean | string; + error?: boolean | string; fileNames?: string[]; complete?: boolean; timestamp_start?: number; @@ -740,7 +740,7 @@ export class MainComponent implements OnInit { downloadAudioFile(name) { this.downloading_content['audio'][name] = true; - this.postsService.downloadFileFromServer(name, 'audio').subscribe(res => { + this.postsService.downloadFileFromServer(name, 'audio' as FileType).subscribe(res => { this.downloading_content['audio'][name] = false; const blob: Blob = res; saveAs(blob, decodeURIComponent(name) + '.mp3'); @@ -757,7 +757,7 @@ export class MainComponent implements OnInit { downloadVideoFile(name) { this.downloading_content['video'][name] = true; - this.postsService.downloadFileFromServer(name, 'video').subscribe(res => { + this.postsService.downloadFileFromServer(name, 'video' as FileType).subscribe(res => { this.downloading_content['video'][name] = false; const blob: Blob = res; saveAs(blob, decodeURIComponent(name) + '.mp4'); diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts index 79eb371..57e2ea4 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -7,7 +7,7 @@ import { MatSnackBar } from '@angular/material/snack-bar'; import { InputDialogComponent } from 'app/input-dialog/input-dialog.component'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { ShareMediaDialogComponent } from '../dialogs/share-media-dialog/share-media-dialog.component'; -import type { FileType } from 'api-types'; +import type { FileType } from '../../api-types'; export interface IMedia { title: string; @@ -35,7 +35,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { // params fileNames: string[]; - type: string; + type: FileType; id = null; // used for playlists (not subscription) uid = null; // used for non-subscription files (audio, video, playlist) subscriptionName = null; @@ -74,7 +74,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { ngOnInit(): void { this.innerWidth = window.innerWidth; - this.type = this.route.snapshot.paramMap.get('type'); + this.type = this.route.snapshot.paramMap.get('type') as FileType; this.id = this.route.snapshot.paramMap.get('id'); this.uid = this.route.snapshot.paramMap.get('uid'); this.subscriptionName = this.route.snapshot.paramMap.get('subscriptionName'); @@ -160,7 +160,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { if (!this.id) { // regular video/audio file (not playlist) this.fileNames = [this.db_file['id']]; - this.type = this.db_file['isAudio'] ? 'audio' : 'video'; + this.type = (this.db_file['isAudio'] ? 'audio' : 'video') as FileType; if (!already_has_filenames) { this.parseFileNames(); } } } diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index c7e7322..d0fad49 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -10,13 +10,19 @@ import { DOCUMENT } from '@angular/common'; import { BehaviorSubject } from 'rxjs'; import { MatSnackBar } from '@angular/material/snack-bar'; import * as Fingerprint2 from 'fingerprintjs2'; -import { +import type { + ChangeRolePermissionsRequest, + ChangeUserPermissionsRequest, + ConfigResponse, CreatePlaylistRequest, CreatePlaylistResponse, DeleteMp3Mp4Request, DeletePlaylistRequest, DeleteSubscriptionFileRequest, + DownloadArchiveRequest, + DownloadFileRequest, FileType, + GenerateNewApiKeyResponse, GetAllDownloadsResponse, GetAllFilesResponse, GetAllSubscriptionsResponse, @@ -35,16 +41,21 @@ import { Mp4DownloadRequest, Mp4DownloadResponse, Playlist, + SetConfigRequest, SharingToggle, SubscribeRequest, SubscribeResponse, SubscriptionRequestData, SuccessObject, + UpdaterStatus, UnsubscribeRequest, UnsubscribeResponse, UpdatePlaylistFilesRequest, UpdatePlaylistRequest, -} from 'api-types'; + UpdateServerRequest, + UserPermission, + YesNo, +} from '../api-types'; @Injectable() export class PostsService implements CanActivate { @@ -224,7 +235,7 @@ export class PostsService implements CanActivate { if (isDevMode()) { return this.http.get('./assets/default.json'); } else { - return this.http.get(this.path + 'config', this.httpOptions); + return this.http.get(this.path + 'config', this.httpOptions); } } @@ -233,7 +244,8 @@ export class PostsService implements CanActivate { } setConfig(config) { - return this.http.post(this.path + 'setConfig', {new_config_file: config}, this.httpOptions); + const body: SetConfigRequest = {new_config_file: config}; + return this.http.post(this.path + 'setConfig', body, this.httpOptions); } deleteFile(uid: string, isAudio: boolean, blacklistMode = false) { @@ -262,19 +274,19 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'getAllFiles', {}, this.httpOptions); } - downloadFileFromServer(fileName, type, outputName = null, fullPathProvided = null, subscriptionName = null, subPlaylist = null, - uid = null, uuid = null, id = null) { - return this.http.post(this.path + 'downloadFile', {fileNames: fileName, - type: type, - zip_mode: Array.isArray(fileName), - outputName: outputName, - fullPathProvided: fullPathProvided, - subscriptionName: subscriptionName, - subPlaylist: subPlaylist, - uuid: uuid, - uid: uid, - id: id - }, + downloadFileFromServer(fileName: string | string[], type: FileType, outputName: string = null, fullPathProvided: boolean = null, subscriptionName: boolean = null, subPlaylist: boolean = null, + uid = null, uuid: string = null, id = null) { + const body: DownloadFileRequest = {fileNames: fileName, + type: type, + zip_mode: Array.isArray(fileName), + outputName: outputName, + fullPathProvided: fullPathProvided, + subscriptionName: subscriptionName, + subPlaylist: subPlaylist, + uuid: uuid, + id: id, + }; + return this.http.post(this.path + 'downloadFile', body, {responseType: 'blob', params: this.httpOptions.params}); } @@ -283,7 +295,8 @@ export class PostsService implements CanActivate { } downloadArchive(sub) { - return this.http.post(this.path + 'downloadArchive', {sub: sub}, {responseType: 'blob', params: this.httpOptions.params}); + const body: DownloadArchiveRequest = {sub: sub}; + return this.http.post(this.path + 'downloadArchive', body, {responseType: 'blob', params: this.httpOptions.params}); } getFileInfo(fileNames, type, urlMode) { @@ -299,7 +312,7 @@ export class PostsService implements CanActivate { } generateNewAPIKey() { - return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions); + return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions); } enableSharing(uid: string, type: FileType, is_playlist: boolean) { @@ -393,12 +406,13 @@ export class PostsService implements CanActivate { } // updates the server to the latest version - updateServer(tag) { - return this.http.post(this.path + 'updateServer', {tag: tag}, this.httpOptions); + updateServer(tag: string) { + const body: UpdateServerRequest = {tag: tag}; + return this.http.post(this.path + 'updateServer', body, this.httpOptions); } getUpdaterStatus() { - return this.http.get(this.path + 'updaterStatus', this.httpOptions); + return this.http.get(this.path + 'updaterStatus', this.httpOptions); } // gets tag of the latest version of youtubedl-material @@ -534,11 +548,11 @@ export class PostsService implements CanActivate { } changeUser(change_obj) { - return this.http.post(this.path + 'updateUser', {change_object: change_obj}, this.httpOptions); + return this.http.post(this.path + 'updateUser', {change_object: change_obj}, this.httpOptions); } deleteUser(uid) { - return this.http.post(this.path + 'deleteUser', {uid: uid}, this.httpOptions); + return this.http.post(this.path + 'deleteUser', {uid: uid}, this.httpOptions); } changeUserPassword(user_uid, new_password) { @@ -553,13 +567,15 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'getRoles', {}, this.httpOptions); } - setUserPermission(user_uid, permission, new_value) { - return this.http.post(this.path + 'changeUserPermissions', {user_uid: user_uid, permission: permission, new_value: new_value}, + setUserPermission(user_uid: string, permission: UserPermission, new_value: YesNo) { + const body: ChangeUserPermissionsRequest = {user_uid: user_uid, permission: permission, new_value: new_value}; + return this.http.post(this.path + 'changeUserPermissions', body, this.httpOptions); } - setRolePermission(role_name, permission, new_value) { - return this.http.post(this.path + 'changeRolePermissions', {role: role_name, permission: permission, new_value: new_value}, + setRolePermission(role_name: string, permission: UserPermission, new_value: YesNo) { + const body: ChangeRolePermissionsRequest = {role: role_name, permission: permission, new_value: new_value}; + return this.http.post(this.path + 'changeRolePermissions', body, this.httpOptions); } diff --git a/src/app/subscription/subscription/subscription.component.ts b/src/app/subscription/subscription/subscription.component.ts index 794a268..eb2f35b 100644 --- a/src/app/subscription/subscription/subscription.component.ts +++ b/src/app/subscription/subscription/subscription.component.ts @@ -3,6 +3,7 @@ import { PostsService } from 'app/posts.services'; import { ActivatedRoute, Router, ParamMap } from '@angular/router'; import { MatDialog } from '@angular/material/dialog'; import { EditSubscriptionDialogComponent } from 'app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component'; +import type { FileType } from '../../../api-types'; @Component({ selector: 'app-subscription', @@ -151,7 +152,7 @@ export class SubscriptionComponent implements OnInit { } this.downloading = true; - this.postsService.downloadFileFromServer(fileNames, 'video', this.subscription.name, true).subscribe(res => { + this.postsService.downloadFileFromServer(fileNames, 'video' as FileType, this.subscription.name, true).subscribe(res => { this.downloading = false; const blob: Blob = res; saveAs(blob, this.subscription.name + '.zip'); From 70d1afce762f71684823b9f66c558df83d804e4c Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Fri, 25 Sep 2020 10:46:55 -0700 Subject: [PATCH 06/12] Move user schemas so they can be imported --- Public API v1.yaml | 191 +++++++++++++++++++++----------------- src/app/posts.services.ts | 46 +++++---- 2 files changed, 134 insertions(+), 103 deletions(-) diff --git a/Public API v1.yaml b/Public API v1.yaml index e508fd5..70d56c5 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -695,35 +695,13 @@ paths: content: application/json: schema: - type: object - properties: - user: - $ref: '#/components/schemas/User' - token: - type: string - permissions: - type: array - items: - type: string - available_permissions: - type: array - items: - type: string + $ref: '#/components/schemas/LoginResponse' description: Use this method to log into a user using their username and password and receive a jwt auth token so you can send per-user requests. requestBody: content: application/json: schema: - type: object - properties: - userid: - type: string - description: 'This is the username, not the user uid' - password: - type: string - required: - - userid - - password + $ref: '#/components/schemas/LoginRequest' security: - Auth query parameter: [] tags: @@ -738,27 +716,13 @@ paths: content: application/json: schema: - type: object - properties: - user: - $ref: '#/components/schemas/User' + $ref: '#/components/schemas/RegisterResponse' description: Use this endpoint to register a user. It will only work if registration is enabled. requestBody: content: application/json: schema: - type: object - properties: - userid: - type: string - username: - type: string - password: - type: string - required: - - userid - - username - - password + $ref: '#/components/schemas/RegisterRequest' security: - Auth query parameter: [] tags: @@ -778,21 +742,7 @@ paths: content: application/json: schema: - type: object - properties: - change_object: - required: - - uid - type: object - properties: - uid: - type: string - name: - type: string - role: - type: string - required: - - change_object + $ref: '#/components/schemas/UpdateUserRequest' description: Updates certain properties for a user. Only two are possible right now. security: - Auth query parameter: [] @@ -814,12 +764,7 @@ paths: content: application/json: schema: - type: object - properties: - uid: - type: string - required: - - uid + $ref: '#/components/schemas/DeleteUserRequest' security: - Auth query parameter: [] tags: @@ -834,25 +779,7 @@ paths: content: application/json: schema: - type: object - properties: - roles: - type: object - properties: - admin: - type: object - properties: - permissions: - type: array - items: - $ref: '#/components/schemas/UserPermission' - user: - type: object - properties: - permissions: - type: array - items: - $ref: '#/components/schemas/UserPermission' + $ref: '#/components/schemas/GetRolesResponse' description: Gets the available roles and their permissions security: - Auth query parameter: [] @@ -910,12 +837,7 @@ paths: content: application/json: schema: - type: object - properties: - users: - type: array - items: - $ref: '#/components/schemas/User' + $ref: '#/components/schemas/GetUsersResponse' description: 'Gets all users, returns a list of the user objects including their user permissions, videos, playlists, subscriptions, etc.' security: - Auth query parameter: [] @@ -1695,6 +1617,103 @@ components: properties: id: type: string + RegisterRequest: + required: + - userid + - username + - password + type: object + properties: + userid: + type: string + username: + type: string + password: + type: string + RegisterResponse: + type: object + properties: + user: + $ref: '#/components/schemas/User' + LoginRequest: + required: + - username + - password + type: object + properties: + username: + type: string + password: + type: string + LoginResponse: + type: object + properties: + user: + $ref: '#/components/schemas/User' + token: + type: string + permissions: + type: array + items: + $ref: '#/components/schemas/UserPermission' + available_permissions: + type: array + items: + $ref: '#/components/schemas/UserPermission' + UpdateUserRequest: + required: + - change_object + type: object + properties: + change_object: + required: + - uid + type: object + properties: + uid: + type: string + name: + type: string + role: + type: string + DeleteUserRequest: + required: + - uid + type: object + properties: + uid: + type: string + GetUsersResponse: + required: + - users + type: object + properties: + users: + type: array + items: + $ref: '#/components/schemas/User' + GetRolesResponse: + required: + - roles + type: object + properties: + roles: + type: object + properties: + admin: + type: object + properties: + permissions: + type: array + items: + $ref: '#/components/schemas/UserPermission' + user: + type: object + properties: + permissions: + type: array + items: + $ref: '#/components/schemas/UserPermission' securitySchemes: Auth query parameter: name: apiKey diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index d0fad49..976298c 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -19,6 +19,7 @@ import type { DeleteMp3Mp4Request, DeletePlaylistRequest, DeleteSubscriptionFileRequest, + DeleteUserRequest, DownloadArchiveRequest, DownloadFileRequest, FileType, @@ -34,13 +35,19 @@ import type { GetMp4sResponse, GetPlaylistRequest, GetPlaylistResponse, + GetRolesResponse, GetSubscriptionRequest, GetSubscriptionResponse, + GetUsersResponse, + LoginRequest, + LoginResponse, Mp3DownloadRequest, Mp3DownloadResponse, Mp4DownloadRequest, Mp4DownloadResponse, Playlist, + RegisterRequest, + RegisterResponse, SetConfigRequest, SharingToggle, SubscribeRequest, @@ -53,6 +60,7 @@ import type { UpdatePlaylistFilesRequest, UpdatePlaylistRequest, UpdateServerRequest, + UpdateUserRequest, UserPermission, YesNo, } from '../api-types'; @@ -444,9 +452,9 @@ export class PostsService implements CanActivate { } // user methods - login(username, password) { - const call = this.http.post(this.path + 'auth/login', {username: username, password: password}, this.httpOptions); - return call; + login(username: string, password: string) { + const body: LoginRequest = {username: username, password: password}; + return this.http.post(this.path + 'auth/login', body, this.httpOptions); } // user methods @@ -481,10 +489,11 @@ export class PostsService implements CanActivate { } // user methods - register(username, password) { - const call = this.http.post(this.path + 'auth/register', {userid: username, - username: username, - password: password}, this.httpOptions); + register(username: string, password: string) { + const body: RegisterRequest = {userid: username, + username: username, + password: password} + const call = this.http.post(this.path + 'auth/register', body, this.httpOptions); return call; } @@ -529,10 +538,11 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'auth/adminExists', {}, this.httpOptions); } - createAdminAccount(password) { - return this.http.post(this.path + 'auth/register', {userid: 'admin', - username: 'admin', - password: password}, this.httpOptions); + createAdminAccount(password: string) { + const body: RegisterRequest = {userid: 'admin', + username: 'admin', + password: password}; + return this.http.post(this.path + 'auth/register', body, this.httpOptions); } checkAdminCreationStatus(force_show = false) { @@ -547,12 +557,14 @@ export class PostsService implements CanActivate { }); } - changeUser(change_obj) { - return this.http.post(this.path + 'updateUser', {change_object: change_obj}, this.httpOptions); + changeUser(change_obj: UpdateUserRequest['change_object']) { + const body: UpdateUserRequest = {change_object: change_obj}; + return this.http.post(this.path + 'updateUser', body, this.httpOptions); } - deleteUser(uid) { - return this.http.post(this.path + 'deleteUser', {uid: uid}, this.httpOptions); + deleteUser(uid: string) { + const body: DeleteUserRequest = {uid: uid}; + return this.http.post(this.path + 'deleteUser', body, this.httpOptions); } changeUserPassword(user_uid, new_password) { @@ -560,11 +572,11 @@ export class PostsService implements CanActivate { } getUsers() { - return this.http.post(this.path + 'getUsers', {}, this.httpOptions); + return this.http.post(this.path + 'getUsers', {}, this.httpOptions); } getRoles() { - return this.http.post(this.path + 'getRoles', {}, this.httpOptions); + return this.http.post(this.path + 'getRoles', {}, this.httpOptions); } setUserPermission(user_uid: string, permission: UserPermission, new_value: YesNo) { From 111254824631891d53d91b9ad05a5f176c3376d9 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Fri, 25 Sep 2020 10:47:25 -0700 Subject: [PATCH 07/12] Commit api types --- .gitignore | 1 - src/api-types/index.ts | 70 +++++++++++++++++++ .../models/BaseChangePermissionsRequest.ts | 11 +++ src/api-types/models/BaseDownloadRequest.ts | 29 ++++++++ src/api-types/models/BaseDownloadResponse.ts | 9 +++ .../models/ChangeRolePermissionsRequest.ts | 9 +++ .../models/ChangeUserPermissionsRequest.ts | 9 +++ src/api-types/models/Config.ts | 8 +++ src/api-types/models/ConfigResponse.ts | 10 +++ src/api-types/models/CreatePlaylistRequest.ts | 13 ++++ .../models/CreatePlaylistResponse.ts | 10 +++ src/api-types/models/DatabaseFile.ts | 22 ++++++ src/api-types/models/DeleteFileRequest.ts | 10 +++ src/api-types/models/DeleteMp3Mp4Request.ts | 9 +++ src/api-types/models/DeletePlaylistRequest.ts | 10 +++ .../models/DeleteSubscriptionFileRequest.ts | 15 ++++ src/api-types/models/DeleteUserRequest.ts | 8 +++ src/api-types/models/Dictionary.ts | 7 ++ src/api-types/models/Download.ts | 23 ++++++ .../models/DownloadArchiveRequest.ts | 10 +++ src/api-types/models/DownloadFileRequest.ts | 22 ++++++ .../DownloadVideosForSubscriptionRequest.ts | 8 +++ src/api-types/models/File.ts | 8 +++ src/api-types/models/FileType.ts | 9 +++ .../models/GenerateNewApiKeyResponse.ts | 8 +++ .../models/GetAllDownloadsResponse.ts | 13 ++++ src/api-types/models/GetAllFilesResponse.ts | 14 ++++ .../models/GetAllSubscriptionsResponse.ts | 9 +++ src/api-types/models/GetDownloadRequest.ts | 9 +++ src/api-types/models/GetDownloadResponse.ts | 9 +++ src/api-types/models/GetFileRequest.ts | 17 +++++ src/api-types/models/GetFileResponse.ts | 10 +++ src/api-types/models/GetMp3sResponse.ts | 14 ++++ src/api-types/models/GetMp4sResponse.ts | 14 ++++ src/api-types/models/GetPlaylistRequest.ts | 11 +++ src/api-types/models/GetPlaylistResponse.ts | 12 ++++ src/api-types/models/GetRolesResponse.ts | 16 +++++ .../models/GetSubscriptionRequest.ts | 11 +++ .../models/GetSubscriptionResponse.ts | 10 +++ src/api-types/models/GetUsersResponse.ts | 9 +++ src/api-types/models/LoginRequest.ts | 9 +++ src/api-types/models/LoginResponse.ts | 13 ++++ src/api-types/models/Mp3DownloadRequest.ts | 12 ++++ src/api-types/models/Mp3DownloadResponse.ts | 9 +++ src/api-types/models/Mp4DownloadRequest.ts | 12 ++++ src/api-types/models/Mp4DownloadResponse.ts | 9 +++ src/api-types/models/Playlist.ts | 15 ++++ src/api-types/models/RegisterRequest.ts | 10 +++ src/api-types/models/RegisterResponse.ts | 9 +++ src/api-types/models/SetConfigRequest.ts | 9 +++ src/api-types/models/SharingToggle.ts | 11 +++ src/api-types/models/SubscribeRequest.ts | 14 ++++ src/api-types/models/SubscribeResponse.ts | 10 +++ src/api-types/models/Subscription.ts | 20 ++++++ .../models/SubscriptionRequestData.ts | 13 ++++ src/api-types/models/SuccessObject.ts | 8 +++ src/api-types/models/UnsubscribeRequest.ts | 13 ++++ src/api-types/models/UnsubscribeResponse.ts | 9 +++ .../models/UpdatePlaylistFilesRequest.ts | 11 +++ src/api-types/models/UpdatePlaylistRequest.ts | 9 +++ src/api-types/models/UpdateServerRequest.ts | 8 +++ src/api-types/models/UpdateUserRequest.ts | 12 ++++ src/api-types/models/UpdaterStatus.ts | 10 +++ src/api-types/models/User.ts | 25 +++++++ src/api-types/models/UserPermission.ts | 13 ++++ src/api-types/models/YesNo.ts | 9 +++ src/api-types/models/body_19.ts | 8 +++ src/api-types/models/body_20.ts | 8 +++ .../models/inline_response_200_15.ts | 8 +++ 69 files changed, 851 insertions(+), 1 deletion(-) create mode 100644 src/api-types/index.ts create mode 100644 src/api-types/models/BaseChangePermissionsRequest.ts create mode 100644 src/api-types/models/BaseDownloadRequest.ts create mode 100644 src/api-types/models/BaseDownloadResponse.ts create mode 100644 src/api-types/models/ChangeRolePermissionsRequest.ts create mode 100644 src/api-types/models/ChangeUserPermissionsRequest.ts create mode 100644 src/api-types/models/Config.ts create mode 100644 src/api-types/models/ConfigResponse.ts create mode 100644 src/api-types/models/CreatePlaylistRequest.ts create mode 100644 src/api-types/models/CreatePlaylistResponse.ts create mode 100644 src/api-types/models/DatabaseFile.ts create mode 100644 src/api-types/models/DeleteFileRequest.ts create mode 100644 src/api-types/models/DeleteMp3Mp4Request.ts create mode 100644 src/api-types/models/DeletePlaylistRequest.ts create mode 100644 src/api-types/models/DeleteSubscriptionFileRequest.ts create mode 100644 src/api-types/models/DeleteUserRequest.ts create mode 100644 src/api-types/models/Dictionary.ts create mode 100644 src/api-types/models/Download.ts create mode 100644 src/api-types/models/DownloadArchiveRequest.ts create mode 100644 src/api-types/models/DownloadFileRequest.ts create mode 100644 src/api-types/models/DownloadVideosForSubscriptionRequest.ts create mode 100644 src/api-types/models/File.ts create mode 100644 src/api-types/models/FileType.ts create mode 100644 src/api-types/models/GenerateNewApiKeyResponse.ts create mode 100644 src/api-types/models/GetAllDownloadsResponse.ts create mode 100644 src/api-types/models/GetAllFilesResponse.ts create mode 100644 src/api-types/models/GetAllSubscriptionsResponse.ts create mode 100644 src/api-types/models/GetDownloadRequest.ts create mode 100644 src/api-types/models/GetDownloadResponse.ts create mode 100644 src/api-types/models/GetFileRequest.ts create mode 100644 src/api-types/models/GetFileResponse.ts create mode 100644 src/api-types/models/GetMp3sResponse.ts create mode 100644 src/api-types/models/GetMp4sResponse.ts create mode 100644 src/api-types/models/GetPlaylistRequest.ts create mode 100644 src/api-types/models/GetPlaylistResponse.ts create mode 100644 src/api-types/models/GetRolesResponse.ts create mode 100644 src/api-types/models/GetSubscriptionRequest.ts create mode 100644 src/api-types/models/GetSubscriptionResponse.ts create mode 100644 src/api-types/models/GetUsersResponse.ts create mode 100644 src/api-types/models/LoginRequest.ts create mode 100644 src/api-types/models/LoginResponse.ts create mode 100644 src/api-types/models/Mp3DownloadRequest.ts create mode 100644 src/api-types/models/Mp3DownloadResponse.ts create mode 100644 src/api-types/models/Mp4DownloadRequest.ts create mode 100644 src/api-types/models/Mp4DownloadResponse.ts create mode 100644 src/api-types/models/Playlist.ts create mode 100644 src/api-types/models/RegisterRequest.ts create mode 100644 src/api-types/models/RegisterResponse.ts create mode 100644 src/api-types/models/SetConfigRequest.ts create mode 100644 src/api-types/models/SharingToggle.ts create mode 100644 src/api-types/models/SubscribeRequest.ts create mode 100644 src/api-types/models/SubscribeResponse.ts create mode 100644 src/api-types/models/Subscription.ts create mode 100644 src/api-types/models/SubscriptionRequestData.ts create mode 100644 src/api-types/models/SuccessObject.ts create mode 100644 src/api-types/models/UnsubscribeRequest.ts create mode 100644 src/api-types/models/UnsubscribeResponse.ts create mode 100644 src/api-types/models/UpdatePlaylistFilesRequest.ts create mode 100644 src/api-types/models/UpdatePlaylistRequest.ts create mode 100644 src/api-types/models/UpdateServerRequest.ts create mode 100644 src/api-types/models/UpdateUserRequest.ts create mode 100644 src/api-types/models/UpdaterStatus.ts create mode 100644 src/api-types/models/User.ts create mode 100644 src/api-types/models/UserPermission.ts create mode 100644 src/api-types/models/YesNo.ts create mode 100644 src/api-types/models/body_19.ts create mode 100644 src/api-types/models/body_20.ts create mode 100644 src/api-types/models/inline_response_200_15.ts diff --git a/.gitignore b/.gitignore index 32c9fd9..c99f53f 100644 --- a/.gitignore +++ b/.gitignore @@ -55,7 +55,6 @@ backend/subscriptions/playlists/* backend/subscriptions/archives/* backend/*.exe src/assets/default.json -src/api-types backend/appdata/db.json backend/appdata/archives/archive_audio.txt backend/appdata/archives/archive_video.txt diff --git a/src/api-types/index.ts b/src/api-types/index.ts new file mode 100644 index 0000000..5a0b927 --- /dev/null +++ b/src/api-types/index.ts @@ -0,0 +1,70 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type { BaseChangePermissionsRequest } from './models/BaseChangePermissionsRequest'; +export type { BaseDownloadRequest } from './models/BaseDownloadRequest'; +export type { BaseDownloadResponse } from './models/BaseDownloadResponse'; +export type { body_19 } from './models/body_19'; +export type { body_20 } from './models/body_20'; +export type { ChangeRolePermissionsRequest } from './models/ChangeRolePermissionsRequest'; +export type { ChangeUserPermissionsRequest } from './models/ChangeUserPermissionsRequest'; +export type { Config } from './models/Config'; +export type { ConfigResponse } from './models/ConfigResponse'; +export type { CreatePlaylistRequest } from './models/CreatePlaylistRequest'; +export type { CreatePlaylistResponse } from './models/CreatePlaylistResponse'; +export type { DatabaseFile } from './models/DatabaseFile'; +export type { DeleteFileRequest } from './models/DeleteFileRequest'; +export type { DeleteMp3Mp4Request } from './models/DeleteMp3Mp4Request'; +export type { DeletePlaylistRequest } from './models/DeletePlaylistRequest'; +export type { DeleteSubscriptionFileRequest } from './models/DeleteSubscriptionFileRequest'; +export type { DeleteUserRequest } from './models/DeleteUserRequest'; +export type { Download } from './models/Download'; +export type { DownloadArchiveRequest } from './models/DownloadArchiveRequest'; +export type { DownloadFileRequest } from './models/DownloadFileRequest'; +export type { DownloadVideosForSubscriptionRequest } from './models/DownloadVideosForSubscriptionRequest'; +export type { File } from './models/File'; +export { FileType } from './models/FileType'; +export type { GenerateNewApiKeyResponse } from './models/GenerateNewApiKeyResponse'; +export type { GetAllDownloadsResponse } from './models/GetAllDownloadsResponse'; +export type { GetAllFilesResponse } from './models/GetAllFilesResponse'; +export type { GetAllSubscriptionsResponse } from './models/GetAllSubscriptionsResponse'; +export type { GetDownloadRequest } from './models/GetDownloadRequest'; +export type { GetDownloadResponse } from './models/GetDownloadResponse'; +export type { GetFileRequest } from './models/GetFileRequest'; +export type { GetFileResponse } from './models/GetFileResponse'; +export type { GetMp3sResponse } from './models/GetMp3sResponse'; +export type { GetMp4sResponse } from './models/GetMp4sResponse'; +export type { GetPlaylistRequest } from './models/GetPlaylistRequest'; +export type { GetPlaylistResponse } from './models/GetPlaylistResponse'; +export type { GetRolesResponse } from './models/GetRolesResponse'; +export type { GetSubscriptionRequest } from './models/GetSubscriptionRequest'; +export type { GetSubscriptionResponse } from './models/GetSubscriptionResponse'; +export type { GetUsersResponse } from './models/GetUsersResponse'; +export type { inline_response_200_15 } from './models/inline_response_200_15'; +export type { LoginRequest } from './models/LoginRequest'; +export type { LoginResponse } from './models/LoginResponse'; +export type { Mp3DownloadRequest } from './models/Mp3DownloadRequest'; +export type { Mp3DownloadResponse } from './models/Mp3DownloadResponse'; +export type { Mp4DownloadRequest } from './models/Mp4DownloadRequest'; +export type { Mp4DownloadResponse } from './models/Mp4DownloadResponse'; +export type { Playlist } from './models/Playlist'; +export type { RegisterRequest } from './models/RegisterRequest'; +export type { RegisterResponse } from './models/RegisterResponse'; +export type { SetConfigRequest } from './models/SetConfigRequest'; +export type { SharingToggle } from './models/SharingToggle'; +export type { SubscribeRequest } from './models/SubscribeRequest'; +export type { SubscribeResponse } from './models/SubscribeResponse'; +export type { Subscription } from './models/Subscription'; +export type { SubscriptionRequestData } from './models/SubscriptionRequestData'; +export type { SuccessObject } from './models/SuccessObject'; +export type { UnsubscribeRequest } from './models/UnsubscribeRequest'; +export type { UnsubscribeResponse } from './models/UnsubscribeResponse'; +export type { UpdatePlaylistFilesRequest } from './models/UpdatePlaylistFilesRequest'; +export type { UpdatePlaylistRequest } from './models/UpdatePlaylistRequest'; +export type { UpdaterStatus } from './models/UpdaterStatus'; +export type { UpdateServerRequest } from './models/UpdateServerRequest'; +export type { UpdateUserRequest } from './models/UpdateUserRequest'; +export type { User } from './models/User'; +export { UserPermission } from './models/UserPermission'; +export { YesNo } from './models/YesNo'; diff --git a/src/api-types/models/BaseChangePermissionsRequest.ts b/src/api-types/models/BaseChangePermissionsRequest.ts new file mode 100644 index 0000000..6551d46 --- /dev/null +++ b/src/api-types/models/BaseChangePermissionsRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { UserPermission } from './UserPermission'; +import { YesNo } from './YesNo'; + +export interface BaseChangePermissionsRequest { + permission: UserPermission; + new_value: YesNo; +} diff --git a/src/api-types/models/BaseDownloadRequest.ts b/src/api-types/models/BaseDownloadRequest.ts new file mode 100644 index 0000000..b6cf3fb --- /dev/null +++ b/src/api-types/models/BaseDownloadRequest.ts @@ -0,0 +1,29 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface BaseDownloadRequest { + url: string; + /** + * Video format code. Overrides other quality options. + */ + customQualityConfiguration?: string; + /** + * Custom command-line arguments for youtubedl. Overrides all other options, except url. + */ + customArgs?: string; + /** + * Custom output filename template. + */ + customOutput?: string; + /** + * Login with this account ID + */ + youtubeUsername?: string; + /** + * Account password + */ + youtubePassword?: string; + ui_uid?: string | null; +} diff --git a/src/api-types/models/BaseDownloadResponse.ts b/src/api-types/models/BaseDownloadResponse.ts new file mode 100644 index 0000000..83d848f --- /dev/null +++ b/src/api-types/models/BaseDownloadResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface BaseDownloadResponse { + uid: string; + file_names?: Array | null; +} diff --git a/src/api-types/models/ChangeRolePermissionsRequest.ts b/src/api-types/models/ChangeRolePermissionsRequest.ts new file mode 100644 index 0000000..a6f6ed9 --- /dev/null +++ b/src/api-types/models/ChangeRolePermissionsRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { BaseChangePermissionsRequest } from './BaseChangePermissionsRequest'; + +export interface ChangeRolePermissionsRequest extends BaseChangePermissionsRequest { + role: string; +} diff --git a/src/api-types/models/ChangeUserPermissionsRequest.ts b/src/api-types/models/ChangeUserPermissionsRequest.ts new file mode 100644 index 0000000..e6f044a --- /dev/null +++ b/src/api-types/models/ChangeUserPermissionsRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { BaseChangePermissionsRequest } from './BaseChangePermissionsRequest'; + +export interface ChangeUserPermissionsRequest extends BaseChangePermissionsRequest { + user_uid: string; +} diff --git a/src/api-types/models/Config.ts b/src/api-types/models/Config.ts new file mode 100644 index 0000000..509c42f --- /dev/null +++ b/src/api-types/models/Config.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface Config { + YoutubeDLMaterial: any; +} diff --git a/src/api-types/models/ConfigResponse.ts b/src/api-types/models/ConfigResponse.ts new file mode 100644 index 0000000..b493361 --- /dev/null +++ b/src/api-types/models/ConfigResponse.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Config } from './Config'; + +export interface ConfigResponse { + config_file: Config; + success: boolean; +} diff --git a/src/api-types/models/CreatePlaylistRequest.ts b/src/api-types/models/CreatePlaylistRequest.ts new file mode 100644 index 0000000..e497dff --- /dev/null +++ b/src/api-types/models/CreatePlaylistRequest.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface CreatePlaylistRequest { + playlistName: string; + fileNames: Array; + type: FileType; + thumbnailURL: string; + duration: number; +} diff --git a/src/api-types/models/CreatePlaylistResponse.ts b/src/api-types/models/CreatePlaylistResponse.ts new file mode 100644 index 0000000..7d5a98c --- /dev/null +++ b/src/api-types/models/CreatePlaylistResponse.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Playlist } from './Playlist'; + +export interface CreatePlaylistResponse { + new_playlist: Playlist; + success: boolean; +} diff --git a/src/api-types/models/DatabaseFile.ts b/src/api-types/models/DatabaseFile.ts new file mode 100644 index 0000000..d6009b2 --- /dev/null +++ b/src/api-types/models/DatabaseFile.ts @@ -0,0 +1,22 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface DatabaseFile { + id: string; + title: string; + thumbnailURL: string; + isAudio: boolean; + /** + * In seconds + */ + duration: number; + url: string; + uploader: string; + size: number; + path: string; + upload_date: string; + uid: string; + sharingEnabled?: boolean; +} diff --git a/src/api-types/models/DeleteFileRequest.ts b/src/api-types/models/DeleteFileRequest.ts new file mode 100644 index 0000000..c64af6c --- /dev/null +++ b/src/api-types/models/DeleteFileRequest.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface DeleteFileRequest { + fileName: string; + type: FileType; +} diff --git a/src/api-types/models/DeleteMp3Mp4Request.ts b/src/api-types/models/DeleteMp3Mp4Request.ts new file mode 100644 index 0000000..f6d65d6 --- /dev/null +++ b/src/api-types/models/DeleteMp3Mp4Request.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface DeleteMp3Mp4Request { + uid: string; + blacklistMode?: boolean; +} diff --git a/src/api-types/models/DeletePlaylistRequest.ts b/src/api-types/models/DeletePlaylistRequest.ts new file mode 100644 index 0000000..25830bb --- /dev/null +++ b/src/api-types/models/DeletePlaylistRequest.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface DeletePlaylistRequest { + playlistID: string; + type: FileType; +} diff --git a/src/api-types/models/DeleteSubscriptionFileRequest.ts b/src/api-types/models/DeleteSubscriptionFileRequest.ts new file mode 100644 index 0000000..aebe91b --- /dev/null +++ b/src/api-types/models/DeleteSubscriptionFileRequest.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { SubscriptionRequestData } from './SubscriptionRequestData'; + +export interface DeleteSubscriptionFileRequest { + file: string; + file_uid?: string; + sub: SubscriptionRequestData; + /** + * If true, does not remove id from archive. Only valid if youtube-dl archive is enabled in settings. + */ + deleteForever?: boolean; +} diff --git a/src/api-types/models/DeleteUserRequest.ts b/src/api-types/models/DeleteUserRequest.ts new file mode 100644 index 0000000..a994369 --- /dev/null +++ b/src/api-types/models/DeleteUserRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface DeleteUserRequest { + uid: string; +} diff --git a/src/api-types/models/Dictionary.ts b/src/api-types/models/Dictionary.ts new file mode 100644 index 0000000..8ba0443 --- /dev/null +++ b/src/api-types/models/Dictionary.ts @@ -0,0 +1,7 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Dictionary = { + [key: string]: T; +} diff --git a/src/api-types/models/Download.ts b/src/api-types/models/Download.ts new file mode 100644 index 0000000..b4d91d9 --- /dev/null +++ b/src/api-types/models/Download.ts @@ -0,0 +1,23 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface Download { + uid: string; + ui_uid: string; + downloading: boolean; + complete: boolean; + url: string; + type: string; + percent_complete: number; + is_playlist: boolean; + timestamp_start: number; + timestamp_end?: number; + filesize?: number | null; + /** + * Error text, set if download fails. + */ + error?: string; + fileNames?: Array; +} diff --git a/src/api-types/models/DownloadArchiveRequest.ts b/src/api-types/models/DownloadArchiveRequest.ts new file mode 100644 index 0000000..46c5c45 --- /dev/null +++ b/src/api-types/models/DownloadArchiveRequest.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface DownloadArchiveRequest { + sub: { + archive_dir: string, + }; +} diff --git a/src/api-types/models/DownloadFileRequest.ts b/src/api-types/models/DownloadFileRequest.ts new file mode 100644 index 0000000..18c6cac --- /dev/null +++ b/src/api-types/models/DownloadFileRequest.ts @@ -0,0 +1,22 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface DownloadFileRequest { + fileNames: ; + zip_mode?: boolean; + type: FileType; + outputName?: string; + fullPathProvided?: boolean; + uuid?: string; + /** + * Only used for subscriptions + */ + subscriptionName?: boolean; + /** + * Only used for subscriptions + */ + subPlaylist?: boolean; +} diff --git a/src/api-types/models/DownloadVideosForSubscriptionRequest.ts b/src/api-types/models/DownloadVideosForSubscriptionRequest.ts new file mode 100644 index 0000000..4b64af3 --- /dev/null +++ b/src/api-types/models/DownloadVideosForSubscriptionRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface DownloadVideosForSubscriptionRequest { + subID: string; +} diff --git a/src/api-types/models/File.ts b/src/api-types/models/File.ts new file mode 100644 index 0000000..2e81613 --- /dev/null +++ b/src/api-types/models/File.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface File { + id?: string; +} diff --git a/src/api-types/models/FileType.ts b/src/api-types/models/FileType.ts new file mode 100644 index 0000000..e1b6f79 --- /dev/null +++ b/src/api-types/models/FileType.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export enum FileType { + AUDIO = 'audio', + VIDEO = 'video', +} \ No newline at end of file diff --git a/src/api-types/models/GenerateNewApiKeyResponse.ts b/src/api-types/models/GenerateNewApiKeyResponse.ts new file mode 100644 index 0000000..d96a464 --- /dev/null +++ b/src/api-types/models/GenerateNewApiKeyResponse.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GenerateNewApiKeyResponse { + new_api_key: string; +} diff --git a/src/api-types/models/GetAllDownloadsResponse.ts b/src/api-types/models/GetAllDownloadsResponse.ts new file mode 100644 index 0000000..1f99a85 --- /dev/null +++ b/src/api-types/models/GetAllDownloadsResponse.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Dictionary } from './Dictionary'; +import { Download } from './Download'; + +export interface GetAllDownloadsResponse { + /** + * Map of Session ID to inner map + */ + downloads?: Dictionary>; +} diff --git a/src/api-types/models/GetAllFilesResponse.ts b/src/api-types/models/GetAllFilesResponse.ts new file mode 100644 index 0000000..79f7fc6 --- /dev/null +++ b/src/api-types/models/GetAllFilesResponse.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { DatabaseFile } from './DatabaseFile'; +import { Playlist } from './Playlist'; + +export interface GetAllFilesResponse { + files: Array; + /** + * All video playlists + */ + playlists: Array; +} diff --git a/src/api-types/models/GetAllSubscriptionsResponse.ts b/src/api-types/models/GetAllSubscriptionsResponse.ts new file mode 100644 index 0000000..fafb6f5 --- /dev/null +++ b/src/api-types/models/GetAllSubscriptionsResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Subscription } from './Subscription'; + +export interface GetAllSubscriptionsResponse { + subscriptions: Array; +} diff --git a/src/api-types/models/GetDownloadRequest.ts b/src/api-types/models/GetDownloadRequest.ts new file mode 100644 index 0000000..9ad5fdf --- /dev/null +++ b/src/api-types/models/GetDownloadRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetDownloadRequest { + session_id: string; + download_id: string; +} diff --git a/src/api-types/models/GetDownloadResponse.ts b/src/api-types/models/GetDownloadResponse.ts new file mode 100644 index 0000000..b027cbf --- /dev/null +++ b/src/api-types/models/GetDownloadResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Download } from './Download'; + +export interface GetDownloadResponse { + download?: Download | null; +} diff --git a/src/api-types/models/GetFileRequest.ts b/src/api-types/models/GetFileRequest.ts new file mode 100644 index 0000000..0d85afb --- /dev/null +++ b/src/api-types/models/GetFileRequest.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface GetFileRequest { + /** + * Video UID + */ + uid: string; + type?: FileType; + /** + * User UID + */ + uuid?: string; +} diff --git a/src/api-types/models/GetFileResponse.ts b/src/api-types/models/GetFileResponse.ts new file mode 100644 index 0000000..71b3563 --- /dev/null +++ b/src/api-types/models/GetFileResponse.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { DatabaseFile } from './DatabaseFile'; + +export interface GetFileResponse { + success: boolean; + file?: DatabaseFile; +} diff --git a/src/api-types/models/GetMp3sResponse.ts b/src/api-types/models/GetMp3sResponse.ts new file mode 100644 index 0000000..13f03dc --- /dev/null +++ b/src/api-types/models/GetMp3sResponse.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { DatabaseFile } from './DatabaseFile'; +import { Playlist } from './Playlist'; + +export interface GetMp3sResponse { + mp3s: Array; + /** + * All audio playlists + */ + playlists: Array; +} diff --git a/src/api-types/models/GetMp4sResponse.ts b/src/api-types/models/GetMp4sResponse.ts new file mode 100644 index 0000000..9ef2c1f --- /dev/null +++ b/src/api-types/models/GetMp4sResponse.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { DatabaseFile } from './DatabaseFile'; +import { Playlist } from './Playlist'; + +export interface GetMp4sResponse { + mp4s: Array; + /** + * All video playlists + */ + playlists: Array; +} diff --git a/src/api-types/models/GetPlaylistRequest.ts b/src/api-types/models/GetPlaylistRequest.ts new file mode 100644 index 0000000..ca86a2d --- /dev/null +++ b/src/api-types/models/GetPlaylistRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface GetPlaylistRequest { + playlistID: string; + type?: FileType; + uuid?: string; +} diff --git a/src/api-types/models/GetPlaylistResponse.ts b/src/api-types/models/GetPlaylistResponse.ts new file mode 100644 index 0000000..c3bf7c9 --- /dev/null +++ b/src/api-types/models/GetPlaylistResponse.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; +import { Playlist } from './Playlist'; + +export interface GetPlaylistResponse { + playlist: Playlist; + type: FileType; + success: boolean; +} diff --git a/src/api-types/models/GetRolesResponse.ts b/src/api-types/models/GetRolesResponse.ts new file mode 100644 index 0000000..ce5e696 --- /dev/null +++ b/src/api-types/models/GetRolesResponse.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { UserPermission } from './UserPermission'; + +export interface GetRolesResponse { + roles: { + admin?: { + permissions?: Array, + }, + user?: { + permissions?: Array, + }, + }; +} diff --git a/src/api-types/models/GetSubscriptionRequest.ts b/src/api-types/models/GetSubscriptionRequest.ts new file mode 100644 index 0000000..99ee221 --- /dev/null +++ b/src/api-types/models/GetSubscriptionRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetSubscriptionRequest { + /** + * Subscription ID + */ + id: string; +} diff --git a/src/api-types/models/GetSubscriptionResponse.ts b/src/api-types/models/GetSubscriptionResponse.ts new file mode 100644 index 0000000..9d2209a --- /dev/null +++ b/src/api-types/models/GetSubscriptionResponse.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Subscription } from './Subscription'; + +export interface GetSubscriptionResponse { + subscription: Subscription; + files: Array; +} diff --git a/src/api-types/models/GetUsersResponse.ts b/src/api-types/models/GetUsersResponse.ts new file mode 100644 index 0000000..f5f9eb0 --- /dev/null +++ b/src/api-types/models/GetUsersResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { User } from './User'; + +export interface GetUsersResponse { + users: Array; +} diff --git a/src/api-types/models/LoginRequest.ts b/src/api-types/models/LoginRequest.ts new file mode 100644 index 0000000..a06327f --- /dev/null +++ b/src/api-types/models/LoginRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface LoginRequest { + username: string; + password: string; +} diff --git a/src/api-types/models/LoginResponse.ts b/src/api-types/models/LoginResponse.ts new file mode 100644 index 0000000..c94f444 --- /dev/null +++ b/src/api-types/models/LoginResponse.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { User } from './User'; +import { UserPermission } from './UserPermission'; + +export interface LoginResponse { + user?: User; + token?: string; + permissions?: Array; + available_permissions?: Array; +} diff --git a/src/api-types/models/Mp3DownloadRequest.ts b/src/api-types/models/Mp3DownloadRequest.ts new file mode 100644 index 0000000..b4b4f8f --- /dev/null +++ b/src/api-types/models/Mp3DownloadRequest.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { BaseDownloadRequest } from './BaseDownloadRequest'; + +export interface Mp3DownloadRequest extends BaseDownloadRequest { + /** + * Specify ffmpeg/avconv audio quality + */ + maxBitrate?: string; +} diff --git a/src/api-types/models/Mp3DownloadResponse.ts b/src/api-types/models/Mp3DownloadResponse.ts new file mode 100644 index 0000000..32924a6 --- /dev/null +++ b/src/api-types/models/Mp3DownloadResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { BaseDownloadResponse } from './BaseDownloadResponse'; + +export interface Mp3DownloadResponse extends BaseDownloadResponse { + audiopathEncoded: string; +} diff --git a/src/api-types/models/Mp4DownloadRequest.ts b/src/api-types/models/Mp4DownloadRequest.ts new file mode 100644 index 0000000..faeb6ab --- /dev/null +++ b/src/api-types/models/Mp4DownloadRequest.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { BaseDownloadRequest } from './BaseDownloadRequest'; + +export interface Mp4DownloadRequest extends BaseDownloadRequest { + /** + * Height of the video, if known + */ + selectedHeight?: string; +} diff --git a/src/api-types/models/Mp4DownloadResponse.ts b/src/api-types/models/Mp4DownloadResponse.ts new file mode 100644 index 0000000..0763c07 --- /dev/null +++ b/src/api-types/models/Mp4DownloadResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { BaseDownloadResponse } from './BaseDownloadResponse'; + +export interface Mp4DownloadResponse extends BaseDownloadResponse { + videopathEncoded: string; +} diff --git a/src/api-types/models/Playlist.ts b/src/api-types/models/Playlist.ts new file mode 100644 index 0000000..1afe993 --- /dev/null +++ b/src/api-types/models/Playlist.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface Playlist { + name: string; + fileNames: Array; + id: string; + thumbnailURL: string; + type: FileType; + registered: number; + duration: number; +} diff --git a/src/api-types/models/RegisterRequest.ts b/src/api-types/models/RegisterRequest.ts new file mode 100644 index 0000000..73bee22 --- /dev/null +++ b/src/api-types/models/RegisterRequest.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface RegisterRequest { + userid: string; + username: string; + password: string; +} diff --git a/src/api-types/models/RegisterResponse.ts b/src/api-types/models/RegisterResponse.ts new file mode 100644 index 0000000..4e45b65 --- /dev/null +++ b/src/api-types/models/RegisterResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { User } from './User'; + +export interface RegisterResponse { + user?: User; +} diff --git a/src/api-types/models/SetConfigRequest.ts b/src/api-types/models/SetConfigRequest.ts new file mode 100644 index 0000000..41ef52a --- /dev/null +++ b/src/api-types/models/SetConfigRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Config } from './Config'; + +export interface SetConfigRequest { + new_config_file: Config; +} diff --git a/src/api-types/models/SharingToggle.ts b/src/api-types/models/SharingToggle.ts new file mode 100644 index 0000000..2de90fc --- /dev/null +++ b/src/api-types/models/SharingToggle.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface SharingToggle { + uid: string; + type: FileType; + is_playlist?: boolean; +} diff --git a/src/api-types/models/SubscribeRequest.ts b/src/api-types/models/SubscribeRequest.ts new file mode 100644 index 0000000..d475cb9 --- /dev/null +++ b/src/api-types/models/SubscribeRequest.ts @@ -0,0 +1,14 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface SubscribeRequest { + name: string; + url: string; + timerange?: string; + streamingOnly: boolean; + audioOnly?: boolean; + customArgs?: string; + customFileOutput?: string; +} diff --git a/src/api-types/models/SubscribeResponse.ts b/src/api-types/models/SubscribeResponse.ts new file mode 100644 index 0000000..fa4c235 --- /dev/null +++ b/src/api-types/models/SubscribeResponse.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Subscription } from './Subscription'; + +export interface SubscribeResponse { + new_sub: Subscription; + error?: string; +} diff --git a/src/api-types/models/Subscription.ts b/src/api-types/models/Subscription.ts new file mode 100644 index 0000000..8cd369e --- /dev/null +++ b/src/api-types/models/Subscription.ts @@ -0,0 +1,20 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface Subscription { + name: string; + url: string; + id: string; + type: FileType; + user_uid: string | null; + streamingOnly: boolean; + isPlaylist: boolean; + archive?: string; + timerange?: string; + custom_args?: string; + custom_output?: string; + videos: Array; +} diff --git a/src/api-types/models/SubscriptionRequestData.ts b/src/api-types/models/SubscriptionRequestData.ts new file mode 100644 index 0000000..6c99499 --- /dev/null +++ b/src/api-types/models/SubscriptionRequestData.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface SubscriptionRequestData { + name: string; + id: string; + type?: FileType; + isPlaylist?: boolean; + archive?: string; +} diff --git a/src/api-types/models/SuccessObject.ts b/src/api-types/models/SuccessObject.ts new file mode 100644 index 0000000..cd0a11e --- /dev/null +++ b/src/api-types/models/SuccessObject.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface SuccessObject { + success: boolean; +} diff --git a/src/api-types/models/UnsubscribeRequest.ts b/src/api-types/models/UnsubscribeRequest.ts new file mode 100644 index 0000000..598faee --- /dev/null +++ b/src/api-types/models/UnsubscribeRequest.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { SubscriptionRequestData } from './SubscriptionRequestData'; + +export interface UnsubscribeRequest { + sub: SubscriptionRequestData; + /** + * Defaults to false + */ + deleteMode?: boolean; +} diff --git a/src/api-types/models/UnsubscribeResponse.ts b/src/api-types/models/UnsubscribeResponse.ts new file mode 100644 index 0000000..0f0d991 --- /dev/null +++ b/src/api-types/models/UnsubscribeResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface UnsubscribeResponse { + success: boolean; + error?: string; +} diff --git a/src/api-types/models/UpdatePlaylistFilesRequest.ts b/src/api-types/models/UpdatePlaylistFilesRequest.ts new file mode 100644 index 0000000..3fa95c2 --- /dev/null +++ b/src/api-types/models/UpdatePlaylistFilesRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface UpdatePlaylistFilesRequest { + playlistID: string; + fileNames: Array; + type: FileType; +} diff --git a/src/api-types/models/UpdatePlaylistRequest.ts b/src/api-types/models/UpdatePlaylistRequest.ts new file mode 100644 index 0000000..1eaee52 --- /dev/null +++ b/src/api-types/models/UpdatePlaylistRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Playlist } from './Playlist'; + +export interface UpdatePlaylistRequest { + playlist: Playlist; +} diff --git a/src/api-types/models/UpdateServerRequest.ts b/src/api-types/models/UpdateServerRequest.ts new file mode 100644 index 0000000..95db6e4 --- /dev/null +++ b/src/api-types/models/UpdateServerRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface UpdateServerRequest { + tag: string; +} diff --git a/src/api-types/models/UpdateUserRequest.ts b/src/api-types/models/UpdateUserRequest.ts new file mode 100644 index 0000000..c6e2f05 --- /dev/null +++ b/src/api-types/models/UpdateUserRequest.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface UpdateUserRequest { + change_object: { + uid: string, + name?: string, + role?: string, + }; +} diff --git a/src/api-types/models/UpdaterStatus.ts b/src/api-types/models/UpdaterStatus.ts new file mode 100644 index 0000000..19e513c --- /dev/null +++ b/src/api-types/models/UpdaterStatus.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface UpdaterStatus { + updating: boolean; + details: string; + error?: boolean; +} diff --git a/src/api-types/models/User.ts b/src/api-types/models/User.ts new file mode 100644 index 0000000..8a49d3c --- /dev/null +++ b/src/api-types/models/User.ts @@ -0,0 +1,25 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Subscription } from './Subscription'; +import { UserPermission } from './UserPermission'; + +export interface User { + uid?: string; + name?: string; + passhash?: string; + files?: { + audio?: Array, + video?: Array, + }; + playlists?: { + audio?: Array, + video?: Array, + }; + subscriptions?: Array; + created?: number; + role?: string; + permissions?: Array; + permission_overrides?: Array; +} diff --git a/src/api-types/models/UserPermission.ts b/src/api-types/models/UserPermission.ts new file mode 100644 index 0000000..b22ef87 --- /dev/null +++ b/src/api-types/models/UserPermission.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export enum UserPermission { + FILEMANAGER = 'filemanager', + SETTINGS = 'settings', + SUBSCRIPTIONS = 'subscriptions', + SHARING = 'sharing', + ADVANCED_DOWNLOAD = 'advanced_download', + DOWNLOADS_MANAGER = 'downloads_manager', +} \ No newline at end of file diff --git a/src/api-types/models/YesNo.ts b/src/api-types/models/YesNo.ts new file mode 100644 index 0000000..dbe9c62 --- /dev/null +++ b/src/api-types/models/YesNo.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export enum YesNo { + YES = 'yes', + NO = 'no', +} \ No newline at end of file diff --git a/src/api-types/models/body_19.ts b/src/api-types/models/body_19.ts new file mode 100644 index 0000000..b0ce9cb --- /dev/null +++ b/src/api-types/models/body_19.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface body_19 { + input_pin: string; +} diff --git a/src/api-types/models/body_20.ts b/src/api-types/models/body_20.ts new file mode 100644 index 0000000..84a7b47 --- /dev/null +++ b/src/api-types/models/body_20.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface body_20 { + unhashed_pin: string; +} diff --git a/src/api-types/models/inline_response_200_15.ts b/src/api-types/models/inline_response_200_15.ts new file mode 100644 index 0000000..bb98ac6 --- /dev/null +++ b/src/api-types/models/inline_response_200_15.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface inline_response_200_15 { + is_set: boolean; +} From d1311d00ea2e06ed900017f91bf52f780a366078 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Sat, 26 Sep 2020 14:50:10 -0700 Subject: [PATCH 08/12] Use named arguments with download file --- Public API v1.yaml | 10 +++++++++- src/api-types/models/DownloadFileRequest.ts | 4 +++- .../custom-playlists.component.ts | 2 +- .../recent-videos/recent-videos.component.ts | 16 +++++++++------- src/app/main/main.component.ts | 2 +- src/app/player/player.component.ts | 12 ++++++++---- src/app/posts.services.ts | 14 ++++++++++---- .../subscription/subscription.component.ts | 2 +- 8 files changed, 42 insertions(+), 20 deletions(-) diff --git a/Public API v1.yaml b/Public API v1.yaml index 70d56c5..866493e 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -127,6 +127,8 @@ paths: application/json: schema: $ref: '#/components/schemas/GetFileResponse' + '401': + description: User is not authorized to view the file. security: - Auth query parameter: [] /api/enableSharing: @@ -441,6 +443,8 @@ paths: responses: '200': description: 'The file itself is in the response, as well as an options object.' + '401': + description: User is not authorized to view the file. security: - Auth query parameter: [] /api/deleteFile: @@ -1254,8 +1258,12 @@ components: type: boolean uuid: type: string + uid: + type: string + id: + type: string subscriptionName: - type: boolean + type: string description: Only used for subscriptions subPlaylist: type: boolean diff --git a/src/api-types/models/DownloadFileRequest.ts b/src/api-types/models/DownloadFileRequest.ts index 18c6cac..61816c9 100644 --- a/src/api-types/models/DownloadFileRequest.ts +++ b/src/api-types/models/DownloadFileRequest.ts @@ -11,10 +11,12 @@ export interface DownloadFileRequest { outputName?: string; fullPathProvided?: boolean; uuid?: string; + uid?: string; + id?: string; /** * Only used for subscriptions */ - subscriptionName?: boolean; + subscriptionName?: string; /** * Only used for subscriptions */ diff --git a/src/app/components/custom-playlists/custom-playlists.component.ts b/src/app/components/custom-playlists/custom-playlists.component.ts index d2d65d6..3212708 100644 --- a/src/app/components/custom-playlists/custom-playlists.component.ts +++ b/src/app/components/custom-playlists/custom-playlists.component.ts @@ -71,7 +71,7 @@ export class CustomPlaylistsComponent implements OnInit { } downloadPlaylist(fileNames, type, zipName = null, playlistID = null) { - this.postsService.downloadFileFromServer(fileNames, type, zipName).subscribe(res => { + this.postsService.downloadFileFromServer(fileNames, type, {outputName: zipName}).subscribe(res => { if (playlistID) { this.downloading_content[type][playlistID] = false }; const blob: Blob = res; saveAs(blob, zipName + '.zip'); diff --git a/src/app/components/recent-videos/recent-videos.component.ts b/src/app/components/recent-videos/recent-videos.component.ts index 11a6dcc..b90fee5 100644 --- a/src/app/components/recent-videos/recent-videos.component.ts +++ b/src/app/components/recent-videos/recent-videos.component.ts @@ -190,13 +190,15 @@ export class RecentVideosComponent implements OnInit { const type = (file.isAudio ? 'audio' : 'video') as FileType; const ext = type === 'audio' ? '.mp3' : '.mp4' const sub = this.postsService.getSubscriptionByID(file.sub_id); - this.postsService.downloadFileFromServer(file.id, type, null, null, sub.name, sub.isPlaylist, - this.postsService.user ? this.postsService.user.uid : null, null).subscribe(res => { - const blob: Blob = res; - saveAs(blob, file.id + ext); - }, err => { - console.log(err); - }); + this.postsService.downloadFileFromServer( + file.id, type, + {subscriptionName: sub.name, subPlaylist: sub.isPlaylist, uid: this.postsService.user ? this.postsService.user.uid : null} + ).subscribe(res => { + const blob: Blob = res; + saveAs(blob, file.id + ext); + }, err => { + console.log(err); + }); } downloadNormalFile(file) { diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index c0bb894..e524057 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -773,7 +773,7 @@ export class MainComponent implements OnInit { } downloadPlaylist(fileNames, type, zipName = null, playlistID = null) { - this.postsService.downloadFileFromServer(fileNames, type, zipName).subscribe(res => { + this.postsService.downloadFileFromServer(fileNames, type, {outputName: zipName}).subscribe(res => { if (playlistID) { this.downloading_content[type][playlistID] = false }; const blob: Blob = res; saveAs(blob, zipName + '.zip'); diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts index 57e2ea4..c6fb53d 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -318,8 +318,10 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { const zipName = fileNames[0].split(' ')[0] + fileNames[1].split(' ')[0]; this.downloading = true; - this.postsService.downloadFileFromServer(fileNames, this.type, zipName, null, null, null, null, - !this.uuid ? this.postsService.user.uid : this.uuid, this.id).subscribe(res => { + this.postsService.downloadFileFromServer( + fileNames, this.type, + {outputName: zipName, uuid: !this.uuid ? this.postsService.user.uid : this.uuid, id: this.id} + ).subscribe(res => { this.downloading = false; const blob: Blob = res; saveAs(blob, zipName + '.zip'); @@ -333,8 +335,10 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { const ext = (this.type === 'audio') ? '.mp3' : '.mp4'; const filename = this.playlist[0].title; this.downloading = true; - this.postsService.downloadFileFromServer(filename, this.type, null, null, this.subscriptionName, this.subPlaylist, - this.is_shared ? this.db_file['uid'] : null, this.uuid).subscribe(res => { + this.postsService.downloadFileFromServer( + filename, this.type, + {subscriptionName: this.subscriptionName, subPlaylist: this.subPlaylist, uid: this.is_shared ? this.db_file['uid'] : null, uuid: this.uuid} + ).subscribe(res => { this.downloading = false; const blob: Blob = res; saveAs(blob, filename + ext); diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 976298c..be2f39e 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -282,8 +282,14 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'getAllFiles', {}, this.httpOptions); } - downloadFileFromServer(fileName: string | string[], type: FileType, outputName: string = null, fullPathProvided: boolean = null, subscriptionName: boolean = null, subPlaylist: boolean = null, - uid = null, uuid: string = null, id = null) { + downloadFileFromServer( + fileName: string | string[], type: FileType, + options: {outputName?: string, fullPathProvided?: boolean, subscriptionName?: string, subPlaylist?: boolean, uid?: string, uuid?: string, id?: string} = {} + ) { + const {outputName = null, fullPathProvided = null, + subscriptionName = null, subPlaylist = null, + uid = null, uuid = null, id = null} = options; + const body: DownloadFileRequest = {fileNames: fileName, type: type, zip_mode: Array.isArray(fileName), @@ -291,11 +297,11 @@ export class PostsService implements CanActivate { fullPathProvided: fullPathProvided, subscriptionName: subscriptionName, subPlaylist: subPlaylist, + uid: uid, uuid: uuid, id: id, }; - return this.http.post(this.path + 'downloadFile', body, - {responseType: 'blob', params: this.httpOptions.params}); + return this.http.post(this.path + 'downloadFile', body, {responseType: 'blob', params: this.httpOptions.params}); } uploadCookiesFile(fileFormData) { diff --git a/src/app/subscription/subscription/subscription.component.ts b/src/app/subscription/subscription/subscription.component.ts index eb2f35b..2c8f9dd 100644 --- a/src/app/subscription/subscription/subscription.component.ts +++ b/src/app/subscription/subscription/subscription.component.ts @@ -152,7 +152,7 @@ export class SubscriptionComponent implements OnInit { } this.downloading = true; - this.postsService.downloadFileFromServer(fileNames, 'video' as FileType, this.subscription.name, true).subscribe(res => { + this.postsService.downloadFileFromServer(fileNames, 'video' as FileType, {outputName: this.subscription.name, fullPathProvided: true}).subscribe(res => { this.downloading = false; const blob: Blob = res; saveAs(blob, this.subscription.name + '.zip'); From 389c5b5df327b2054478a33632406af6470aae64 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Sat, 26 Sep 2020 14:50:39 -0700 Subject: [PATCH 09/12] Take out import type --- .../components/custom-playlists/custom-playlists.component.ts | 2 +- src/app/components/recent-videos/recent-videos.component.ts | 2 +- .../update-progress-dialog/update-progress-dialog.component.ts | 2 +- src/app/main/main.component.ts | 2 +- src/app/player/player.component.ts | 2 +- src/app/posts.services.ts | 2 +- src/app/subscription/subscription/subscription.component.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/components/custom-playlists/custom-playlists.component.ts b/src/app/components/custom-playlists/custom-playlists.component.ts index 3212708..d4fd013 100644 --- a/src/app/components/custom-playlists/custom-playlists.component.ts +++ b/src/app/components/custom-playlists/custom-playlists.component.ts @@ -91,7 +91,7 @@ export class CustomPlaylistsComponent implements OnInit { this.getAllPlaylists(); }); } - + editPlaylistDialog(args) { const playlist = args.playlist; const index = args.index; diff --git a/src/app/components/recent-videos/recent-videos.component.ts b/src/app/components/recent-videos/recent-videos.component.ts index b90fee5..2bbd96b 100644 --- a/src/app/components/recent-videos/recent-videos.component.ts +++ b/src/app/components/recent-videos/recent-videos.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { PostsService } from 'app/posts.services'; import { Router } from '@angular/router'; -import type { FileType } from '../../../api-types'; +import { FileType } from '../../../api-types'; @Component({ selector: 'app-recent-videos', diff --git a/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts b/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts index 9ca066f..4862839 100644 --- a/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts +++ b/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { PostsService } from 'app/posts.services'; import { MatSnackBar } from '@angular/material/snack-bar'; -import type { UpdaterStatus } from '../../../api-types'; +import { UpdaterStatus } from '../../../api-types'; @Component({ selector: 'app-update-progress-dialog', diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index e524057..376d573 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -20,7 +20,7 @@ import { CreatePlaylistComponent } from 'app/create-playlist/create-playlist.com import { Platform } from '@angular/cdk/platform'; import { v4 as uuid } from 'uuid'; import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component'; -import type { FileType } from '../../api-types'; +import { FileType } from '../../api-types'; export let audioFilesMouseHovering = false; export let videoFilesMouseHovering = false; diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts index c6fb53d..ca845c1 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -7,7 +7,7 @@ import { MatSnackBar } from '@angular/material/snack-bar'; import { InputDialogComponent } from 'app/input-dialog/input-dialog.component'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { ShareMediaDialogComponent } from '../dialogs/share-media-dialog/share-media-dialog.component'; -import type { FileType } from '../../api-types'; +import { FileType } from '../../api-types'; export interface IMedia { title: string; diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index be2f39e..8258ef7 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -10,7 +10,7 @@ import { DOCUMENT } from '@angular/common'; import { BehaviorSubject } from 'rxjs'; import { MatSnackBar } from '@angular/material/snack-bar'; import * as Fingerprint2 from 'fingerprintjs2'; -import type { +import { ChangeRolePermissionsRequest, ChangeUserPermissionsRequest, ConfigResponse, diff --git a/src/app/subscription/subscription/subscription.component.ts b/src/app/subscription/subscription/subscription.component.ts index 2c8f9dd..ffbbde5 100644 --- a/src/app/subscription/subscription/subscription.component.ts +++ b/src/app/subscription/subscription/subscription.component.ts @@ -3,7 +3,7 @@ import { PostsService } from 'app/posts.services'; import { ActivatedRoute, Router, ParamMap } from '@angular/router'; import { MatDialog } from '@angular/material/dialog'; import { EditSubscriptionDialogComponent } from 'app/dialogs/edit-subscription-dialog/edit-subscription-dialog.component'; -import type { FileType } from '../../../api-types'; +import { FileType } from '../../../api-types'; @Component({ selector: 'app-subscription', From 2cf0c61facd04d3311b64fd33eeea8e456d906f8 Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Sat, 26 Sep 2020 14:53:51 -0700 Subject: [PATCH 10/12] Default booleans to false --- src/app/posts.services.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 8258ef7..66c8a38 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -286,8 +286,8 @@ export class PostsService implements CanActivate { fileName: string | string[], type: FileType, options: {outputName?: string, fullPathProvided?: boolean, subscriptionName?: string, subPlaylist?: boolean, uid?: string, uuid?: string, id?: string} = {} ) { - const {outputName = null, fullPathProvided = null, - subscriptionName = null, subPlaylist = null, + const {outputName = null, fullPathProvided = false, + subscriptionName = null, subPlaylist = false, uid = null, uuid = null, id = null} = options; const body: DownloadFileRequest = {fileNames: fileName, From 94006ef7945ff1a9c4c3a38026b555455f4b8a76 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Thu, 30 Sep 2021 19:37:21 -0600 Subject: [PATCH 11/12] Updated API Removed unused component --- Public API v1.yaml | 298 ++++++------------ backend/app.js | 4 +- src/api-types/index.ts | 13 +- .../models/BaseChangePermissionsRequest.ts | 2 +- src/api-types/models/BaseDownloadRequest.ts | 29 -- src/api-types/models/BaseDownloadResponse.ts | 9 - .../models/ChangeRolePermissionsRequest.ts | 2 +- .../models/ChangeUserPermissionsRequest.ts | 2 +- src/api-types/models/Config.ts | 2 +- src/api-types/models/ConfigResponse.ts | 2 +- src/api-types/models/CreatePlaylistRequest.ts | 5 +- .../models/CreatePlaylistResponse.ts | 2 +- src/api-types/models/CropFileSettings.ts | 9 + src/api-types/models/DatabaseFile.ts | 2 +- src/api-types/models/DeleteFileRequest.ts | 10 - src/api-types/models/DeleteMp3Mp4Request.ts | 2 +- src/api-types/models/DeletePlaylistRequest.ts | 4 +- .../models/DeleteSubscriptionFileRequest.ts | 2 +- src/api-types/models/DeleteUserRequest.ts | 2 +- src/api-types/models/Download.ts | 21 +- .../models/DownloadArchiveRequest.ts | 6 +- src/api-types/models/DownloadFileRequest.ts | 18 +- src/api-types/models/DownloadRequest.ts | 44 +++ src/api-types/models/DownloadResponse.ts | 9 + .../DownloadVideosForSubscriptionRequest.ts | 2 +- src/api-types/models/File.ts | 2 +- .../models/GenerateNewApiKeyResponse.ts | 2 +- .../models/GetAllDownloadsResponse.ts | 8 +- src/api-types/models/GetAllFilesResponse.ts | 2 +- .../models/GetAllSubscriptionsResponse.ts | 2 +- src/api-types/models/GetDownloadRequest.ts | 5 +- src/api-types/models/GetDownloadResponse.ts | 2 +- src/api-types/models/GetFileRequest.ts | 2 +- src/api-types/models/GetFileResponse.ts | 2 +- src/api-types/models/GetMp3sResponse.ts | 2 +- src/api-types/models/GetMp4sResponse.ts | 2 +- src/api-types/models/GetPlaylistRequest.ts | 5 +- src/api-types/models/GetPlaylistResponse.ts | 2 +- src/api-types/models/GetPlaylistsRequest.ts | 8 + src/api-types/models/GetPlaylistsResponse.ts | 9 + src/api-types/models/GetRolesResponse.ts | 16 +- .../models/GetSubscriptionRequest.ts | 6 +- .../models/GetSubscriptionResponse.ts | 2 +- src/api-types/models/GetUsersResponse.ts | 2 +- src/api-types/models/LoginRequest.ts | 2 +- src/api-types/models/LoginResponse.ts | 2 +- src/api-types/models/Mp3DownloadRequest.ts | 12 - src/api-types/models/Mp3DownloadResponse.ts | 9 - src/api-types/models/Mp4DownloadRequest.ts | 12 - src/api-types/models/Mp4DownloadResponse.ts | 9 - src/api-types/models/Playlist.ts | 5 +- src/api-types/models/RegisterRequest.ts | 2 +- src/api-types/models/RegisterResponse.ts | 2 +- src/api-types/models/SetConfigRequest.ts | 2 +- src/api-types/models/SharingToggle.ts | 4 +- src/api-types/models/SubscribeRequest.ts | 4 +- src/api-types/models/SubscribeResponse.ts | 2 +- src/api-types/models/Subscription.ts | 2 +- .../models/SubscriptionRequestData.ts | 2 +- src/api-types/models/SuccessObject.ts | 2 +- src/api-types/models/UnsubscribeRequest.ts | 2 +- src/api-types/models/UnsubscribeResponse.ts | 2 +- .../models/UpdatePlaylistFilesRequest.ts | 11 - src/api-types/models/UpdatePlaylistRequest.ts | 2 +- src/api-types/models/UpdateServerRequest.ts | 2 +- src/api-types/models/UpdateUserRequest.ts | 10 +- src/api-types/models/UpdaterStatus.ts | 2 +- src/api-types/models/User.ts | 14 +- src/api-types/models/body_19.ts | 2 +- src/api-types/models/body_20.ts | 2 +- .../models/inline_response_200_15.ts | 2 +- src/app/app.module.ts | 2 - .../subscribe-dialog.component.ts | 2 +- .../download-item.component.html | 41 --- .../download-item.component.scss | 16 - .../download-item.component.spec.ts | 25 -- .../download-item/download-item.component.ts | 45 --- src/app/main/main.component.ts | 28 +- src/app/player/player.component.ts | 2 +- src/app/posts.services.ts | 21 +- 80 files changed, 300 insertions(+), 588 deletions(-) delete mode 100644 src/api-types/models/BaseDownloadRequest.ts delete mode 100644 src/api-types/models/BaseDownloadResponse.ts create mode 100644 src/api-types/models/CropFileSettings.ts delete mode 100644 src/api-types/models/DeleteFileRequest.ts create mode 100644 src/api-types/models/DownloadRequest.ts create mode 100644 src/api-types/models/DownloadResponse.ts create mode 100644 src/api-types/models/GetPlaylistsRequest.ts create mode 100644 src/api-types/models/GetPlaylistsResponse.ts delete mode 100644 src/api-types/models/Mp3DownloadRequest.ts delete mode 100644 src/api-types/models/Mp3DownloadResponse.ts delete mode 100644 src/api-types/models/Mp4DownloadRequest.ts delete mode 100644 src/api-types/models/Mp4DownloadResponse.ts delete mode 100644 src/api-types/models/UpdatePlaylistFilesRequest.ts delete mode 100644 src/app/download-item/download-item.component.html delete mode 100644 src/app/download-item/download-item.component.scss delete mode 100644 src/app/download-item/download-item.component.spec.ts delete mode 100644 src/app/download-item/download-item.component.ts diff --git a/Public API v1.yaml b/Public API v1.yaml index 5ebe9f3..01cdfcd 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -6,34 +6,7 @@ info: servers: - url: 'http://localhost:17442' paths: - /api/tomp3: - post: - tags: - - downloader - summary: Download audio file - description: |- - Downloads an audio file with the given URL. Will include global args if they exist. - - - HTTP requests will return once the audio file download completes. In the future, it will (by default) return once the download starts, and a separate API call will be used for checking the download status. - operationId: post-tomp3 - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Mp3DownloadRequest' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Mp3DownloadResponse' - '500': - description: Server download error - security: - - Auth query parameter: [] - /api/tomp4: + /api/downloadFile: post: tags: - downloader @@ -48,14 +21,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Mp4DownloadRequest' + $ref: '#/components/schemas/DownloadRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/Mp4DownloadResponse' + $ref: '#/components/schemas/DownloadResponse' '500': description: Server download error security: @@ -365,27 +338,6 @@ paths: $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] - /api/updatePlaylistFiles: - post: - tags: - - playlists - summary: Update playlist files - description: Updates the list of filenames in the playlist object - operationId: post-api-updatePlaylistFiles - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UpdatePlaylistFilesRequest' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/SuccessObject' - security: - - Auth query parameter: [] /api/deletePlaylist: post: tags: @@ -429,7 +381,7 @@ paths: description: Whether the operation succeeded security: - Auth query parameter: [] - /api/downloadFile: + /api/downloadFileFromServer: post: tags: - files @@ -451,13 +403,13 @@ paths: post: tags: - files - summary: Delete downloaded file (unused) + summary: Delete downloaded file operationId: post-api-deleteFile requestBody: content: application/json: schema: - $ref: '#/components/schemas/DeleteFileRequest' + $ref: '#/components/schemas/DeleteMp3Mp4Request' responses: '200': description: OK @@ -861,6 +813,16 @@ components: enum: - audio - video + CropFileSettings: + type: object + required: + - cropFileStart + - cropFileEnd + properties: + cropFileStart: + type: number + cropFileEnd: + type: number Config: required: - YoutubeDLMaterial @@ -868,7 +830,7 @@ components: properties: YoutubeDLMaterial: type: object - BaseDownloadRequest: + DownloadRequest: required: - url type: object @@ -881,7 +843,10 @@ components: example: '251' customArgs: type: string - description: Custom command-line arguments for youtubedl. Overrides all other options, except url. + description: Custom command-line arguments for youtube-dl. Overrides all other options, except url. + additionalArgs: + type: string + description: Additional command-line arguments for youtube-dl. Added to whatever args would normally be used. customOutput: type: string description: Custom output filename template. @@ -891,67 +856,31 @@ components: youtubePassword: type: string description: Account password - ui_uid: + selectedHeight: type: string - nullable: true - Mp3DownloadRequest: - allOf: - - $ref: '#/components/schemas/BaseDownloadRequest' - - type: object - properties: - maxBitrate: - type: string - description: Specify ffmpeg/avconv audio quality - example: '160' - Mp4DownloadRequest: - allOf: - - $ref: '#/components/schemas/BaseDownloadRequest' - - type: object - properties: - selectedHeight: - type: string - description: Height of the video, if known - example: '1080' - BaseDownloadResponse: - required: - - uid + description: Height of the video, if known + example: '1080' + maxBitrate: + type: string + description: Specify ffmpeg/avconv audio quality + example: '160' + type: + $ref: '#/components/schemas/FileType' + cropFileSettings: + $ref: '#/components/schemas/CropFileSettings' + DownloadResponse: type: object properties: - uid: - type: string - file_names: + download: + $ref: '#/components/schemas/Download' nullable: true - type: array - items: - type: string - Mp3DownloadResponse: - allOf: - - $ref: '#/components/schemas/BaseDownloadResponse' - - type: object - required: - - audiopathEncoded - properties: - audiopathEncoded: - type: string - Mp4DownloadResponse: - allOf: - - $ref: '#/components/schemas/BaseDownloadResponse' - - type: object - required: - - videopathEncoded - properties: - videopathEncoded: - type: string GetDownloadRequest: type: object properties: - session_id: - type: string - download_id: + download_uid: type: string required: - - session_id - - download_id + - download_uid GetDownloadResponse: type: object properties: @@ -962,13 +891,9 @@ components: type: object properties: downloads: - type: object - description: Map of Session ID to inner map - additionalProperties: - type: object - description: Map of Download UID to downoad - additionalProperties: - $ref: '#/components/schemas/Download' + type: array + items: + $ref: '#/components/schemas/Download' GetMp3sResponse: required: - mp3s @@ -1038,14 +963,11 @@ components: $ref: '#/components/schemas/DatabaseFile' SharingToggle: required: - - type - uid type: object properties: uid: type: string - type: - $ref: '#/components/schemas/FileType' is_playlist: type: boolean SubscribeRequest: @@ -1061,14 +983,14 @@ components: type: string timerange: type: string - streamingOnly: - type: boolean audioOnly: type: boolean customArgs: type: string customFileOutput: type: string + maxQuality: + type: string SubscribeResponse: required: - new_sub @@ -1120,6 +1042,9 @@ components: id: type: string description: Subscription ID + name: + type: string + description: Subscription name GetSubscriptionResponse: required: - files @@ -1150,16 +1075,15 @@ components: $ref: '#/components/schemas/Subscription' CreatePlaylistRequest: required: - - fileNames + - uids - playlistName - thumbnailURL - type - - duration type: object properties: playlistName: type: string - fileNames: + uids: type: array items: type: string @@ -1167,8 +1091,6 @@ components: $ref: '#/components/schemas/FileType' thumbnailURL: type: string - duration: - type: number CreatePlaylistResponse: required: - new_playlist @@ -1181,15 +1103,17 @@ components: type: boolean GetPlaylistRequest: required: - - playlistID + - playlist_id type: object properties: - playlistID: + playlist_id: type: string type: $ref: '#/components/schemas/FileType' uuid: type: string + include_file_metadata: + type: boolean GetPlaylistResponse: required: - playlist @@ -1203,6 +1127,20 @@ components: $ref: '#/components/schemas/FileType' success: type: boolean + GetPlaylistsRequest: + type: object + properties: + include_categories: + type: boolean + GetPlaylistsResponse: + required: + - playlists + type: object + properties: + playlists: + type: array + items: + $ref: '#/components/schemas/Playlist' UpdatePlaylistRequest: required: - playlist @@ -1210,74 +1148,30 @@ components: properties: playlist: $ref: '#/components/schemas/Playlist' - UpdatePlaylistFilesRequest: - required: - - fileNames - - playlistID - - type - type: object - properties: - playlistID: - type: string - fileNames: - type: array - items: - type: string - type: - $ref: '#/components/schemas/FileType' DeletePlaylistRequest: required: - - playlistID + - playlist_id - type type: object properties: - playlistID: + playlist_id: type: string type: $ref: '#/components/schemas/FileType' DownloadFileRequest: required: - - fileNames - - type + - uid type: object properties: - fileNames: - oneOf: - - type: string - - type: array - description: Array of 1 or more files to download - items: - type: string - zip_mode: - type: boolean - type: - $ref: '#/components/schemas/FileType' - outputName: - type: string - fullPathProvided: - type: boolean - uuid: - type: string uid: type: string - id: + uuid: type: string - subscriptionName: + sub_id: type: string - description: Only used for subscriptions - subPlaylist: + is_playlist: type: boolean description: Only used for subscriptions - DeleteFileRequest: - required: - - fileName - - type - type: object - properties: - fileName: - type: string - type: - $ref: '#/components/schemas/FileType' DownloadArchiveRequest: required: - sub @@ -1406,7 +1300,7 @@ components: type: boolean Playlist: required: - - fileNames + - uids - id - name - thumbnailURL @@ -1417,7 +1311,7 @@ components: properties: name: type: string - fileNames: + uids: type: array items: type: string @@ -1431,16 +1325,22 @@ components: type: number duration: type: number + user_uid: + type: string Download: required: - - uid - - ui_uid - - downloading - - complete - url - type + - title + - type + - options + - uid + - step_index + - paused + - running + - finished_step - percent_complete - - is_playlist + - finished - timestamp_start type: object properties: @@ -1448,32 +1348,36 @@ components: type: string ui_uid: type: string - downloading: + running: type: boolean - complete: + finished: + type: boolean + paused: + type: boolean + finished_step: type: boolean url: type: string type: type: string + title: + type: string + step_index: + type: number percent_complete: type: number - is_playlist: - type: boolean timestamp_start: type: number - timestamp_end: - type: number - filesize: - type: number - nullable: true error: type: string description: Error text, set if download fails. - fileNames: - type: array - items: - type: string + nullable: true + user_uid: + type: string + sub_id: + type: string + sub_name: + type: string SubscriptionRequestData: required: - id diff --git a/backend/app.js b/backend/app.js index 97a29df..6b2ca95 100644 --- a/backend/app.js +++ b/backend/app.js @@ -1348,7 +1348,6 @@ app.post('/api/subscribe', optionalJwt, async (req, res) => { let url = req.body.url; let maxQuality = req.body.maxQuality; let timerange = req.body.timerange; - let streamingOnly = req.body.streamingOnly; let audioOnly = req.body.audioOnly; let customArgs = req.body.customArgs; let customOutput = req.body.customFileOutput; @@ -1358,7 +1357,6 @@ app.post('/api/subscribe', optionalJwt, async (req, res) => { url: url, maxQuality: maxQuality, id: uuid(), - streamingOnly: streamingOnly, user_uid: user_uid, type: audioOnly ? 'audio' : 'video' }; @@ -1554,7 +1552,7 @@ app.post('/api/getPlaylists', optionalJwt, async (req, res) => { const uuid = req.isAuthenticated() ? req.user.uid : null; const include_categories = req.body.include_categories; - const playlists = await db_api.getRecords('playlists', {user_uid: uuid}); + let playlists = await db_api.getRecords('playlists', {user_uid: uuid}); if (include_categories) { const categories = await categories_api.getCategoriesAsPlaylists(files); if (categories) { diff --git a/src/api-types/index.ts b/src/api-types/index.ts index 5a0b927..83c73a8 100644 --- a/src/api-types/index.ts +++ b/src/api-types/index.ts @@ -3,8 +3,6 @@ /* eslint-disable */ export type { BaseChangePermissionsRequest } from './models/BaseChangePermissionsRequest'; -export type { BaseDownloadRequest } from './models/BaseDownloadRequest'; -export type { BaseDownloadResponse } from './models/BaseDownloadResponse'; export type { body_19 } from './models/body_19'; export type { body_20 } from './models/body_20'; export type { ChangeRolePermissionsRequest } from './models/ChangeRolePermissionsRequest'; @@ -13,8 +11,8 @@ export type { Config } from './models/Config'; export type { ConfigResponse } from './models/ConfigResponse'; export type { CreatePlaylistRequest } from './models/CreatePlaylistRequest'; export type { CreatePlaylistResponse } from './models/CreatePlaylistResponse'; +export type { CropFileSettings } from './models/CropFileSettings'; export type { DatabaseFile } from './models/DatabaseFile'; -export type { DeleteFileRequest } from './models/DeleteFileRequest'; export type { DeleteMp3Mp4Request } from './models/DeleteMp3Mp4Request'; export type { DeletePlaylistRequest } from './models/DeletePlaylistRequest'; export type { DeleteSubscriptionFileRequest } from './models/DeleteSubscriptionFileRequest'; @@ -22,6 +20,8 @@ export type { DeleteUserRequest } from './models/DeleteUserRequest'; export type { Download } from './models/Download'; export type { DownloadArchiveRequest } from './models/DownloadArchiveRequest'; export type { DownloadFileRequest } from './models/DownloadFileRequest'; +export type { DownloadRequest } from './models/DownloadRequest'; +export type { DownloadResponse } from './models/DownloadResponse'; export type { DownloadVideosForSubscriptionRequest } from './models/DownloadVideosForSubscriptionRequest'; export type { File } from './models/File'; export { FileType } from './models/FileType'; @@ -37,6 +37,8 @@ export type { GetMp3sResponse } from './models/GetMp3sResponse'; export type { GetMp4sResponse } from './models/GetMp4sResponse'; export type { GetPlaylistRequest } from './models/GetPlaylistRequest'; export type { GetPlaylistResponse } from './models/GetPlaylistResponse'; +export type { GetPlaylistsRequest } from './models/GetPlaylistsRequest'; +export type { GetPlaylistsResponse } from './models/GetPlaylistsResponse'; export type { GetRolesResponse } from './models/GetRolesResponse'; export type { GetSubscriptionRequest } from './models/GetSubscriptionRequest'; export type { GetSubscriptionResponse } from './models/GetSubscriptionResponse'; @@ -44,10 +46,6 @@ export type { GetUsersResponse } from './models/GetUsersResponse'; export type { inline_response_200_15 } from './models/inline_response_200_15'; export type { LoginRequest } from './models/LoginRequest'; export type { LoginResponse } from './models/LoginResponse'; -export type { Mp3DownloadRequest } from './models/Mp3DownloadRequest'; -export type { Mp3DownloadResponse } from './models/Mp3DownloadResponse'; -export type { Mp4DownloadRequest } from './models/Mp4DownloadRequest'; -export type { Mp4DownloadResponse } from './models/Mp4DownloadResponse'; export type { Playlist } from './models/Playlist'; export type { RegisterRequest } from './models/RegisterRequest'; export type { RegisterResponse } from './models/RegisterResponse'; @@ -60,7 +58,6 @@ export type { SubscriptionRequestData } from './models/SubscriptionRequestData'; export type { SuccessObject } from './models/SuccessObject'; export type { UnsubscribeRequest } from './models/UnsubscribeRequest'; export type { UnsubscribeResponse } from './models/UnsubscribeResponse'; -export type { UpdatePlaylistFilesRequest } from './models/UpdatePlaylistFilesRequest'; export type { UpdatePlaylistRequest } from './models/UpdatePlaylistRequest'; export type { UpdaterStatus } from './models/UpdaterStatus'; export type { UpdateServerRequest } from './models/UpdateServerRequest'; diff --git a/src/api-types/models/BaseChangePermissionsRequest.ts b/src/api-types/models/BaseChangePermissionsRequest.ts index 6551d46..d548225 100644 --- a/src/api-types/models/BaseChangePermissionsRequest.ts +++ b/src/api-types/models/BaseChangePermissionsRequest.ts @@ -8,4 +8,4 @@ import { YesNo } from './YesNo'; export interface BaseChangePermissionsRequest { permission: UserPermission; new_value: YesNo; -} +} \ No newline at end of file diff --git a/src/api-types/models/BaseDownloadRequest.ts b/src/api-types/models/BaseDownloadRequest.ts deleted file mode 100644 index b6cf3fb..0000000 --- a/src/api-types/models/BaseDownloadRequest.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - - -export interface BaseDownloadRequest { - url: string; - /** - * Video format code. Overrides other quality options. - */ - customQualityConfiguration?: string; - /** - * Custom command-line arguments for youtubedl. Overrides all other options, except url. - */ - customArgs?: string; - /** - * Custom output filename template. - */ - customOutput?: string; - /** - * Login with this account ID - */ - youtubeUsername?: string; - /** - * Account password - */ - youtubePassword?: string; - ui_uid?: string | null; -} diff --git a/src/api-types/models/BaseDownloadResponse.ts b/src/api-types/models/BaseDownloadResponse.ts deleted file mode 100644 index 83d848f..0000000 --- a/src/api-types/models/BaseDownloadResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - - -export interface BaseDownloadResponse { - uid: string; - file_names?: Array | null; -} diff --git a/src/api-types/models/ChangeRolePermissionsRequest.ts b/src/api-types/models/ChangeRolePermissionsRequest.ts index a6f6ed9..417c8ef 100644 --- a/src/api-types/models/ChangeRolePermissionsRequest.ts +++ b/src/api-types/models/ChangeRolePermissionsRequest.ts @@ -6,4 +6,4 @@ import { BaseChangePermissionsRequest } from './BaseChangePermissionsRequest'; export interface ChangeRolePermissionsRequest extends BaseChangePermissionsRequest { role: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/ChangeUserPermissionsRequest.ts b/src/api-types/models/ChangeUserPermissionsRequest.ts index e6f044a..c74dc09 100644 --- a/src/api-types/models/ChangeUserPermissionsRequest.ts +++ b/src/api-types/models/ChangeUserPermissionsRequest.ts @@ -6,4 +6,4 @@ import { BaseChangePermissionsRequest } from './BaseChangePermissionsRequest'; export interface ChangeUserPermissionsRequest extends BaseChangePermissionsRequest { user_uid: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/Config.ts b/src/api-types/models/Config.ts index 509c42f..855217a 100644 --- a/src/api-types/models/Config.ts +++ b/src/api-types/models/Config.ts @@ -5,4 +5,4 @@ export interface Config { YoutubeDLMaterial: any; -} +} \ No newline at end of file diff --git a/src/api-types/models/ConfigResponse.ts b/src/api-types/models/ConfigResponse.ts index b493361..d3ff49a 100644 --- a/src/api-types/models/ConfigResponse.ts +++ b/src/api-types/models/ConfigResponse.ts @@ -7,4 +7,4 @@ import { Config } from './Config'; export interface ConfigResponse { config_file: Config; success: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/CreatePlaylistRequest.ts b/src/api-types/models/CreatePlaylistRequest.ts index e497dff..2fef41b 100644 --- a/src/api-types/models/CreatePlaylistRequest.ts +++ b/src/api-types/models/CreatePlaylistRequest.ts @@ -6,8 +6,7 @@ import { FileType } from './FileType'; export interface CreatePlaylistRequest { playlistName: string; - fileNames: Array; + uids: Array; type: FileType; thumbnailURL: string; - duration: number; -} +} \ No newline at end of file diff --git a/src/api-types/models/CreatePlaylistResponse.ts b/src/api-types/models/CreatePlaylistResponse.ts index 7d5a98c..4cac9cf 100644 --- a/src/api-types/models/CreatePlaylistResponse.ts +++ b/src/api-types/models/CreatePlaylistResponse.ts @@ -7,4 +7,4 @@ import { Playlist } from './Playlist'; export interface CreatePlaylistResponse { new_playlist: Playlist; success: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/CropFileSettings.ts b/src/api-types/models/CropFileSettings.ts new file mode 100644 index 0000000..ec8edec --- /dev/null +++ b/src/api-types/models/CropFileSettings.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface CropFileSettings { + cropFileStart: number; + cropFileEnd: number; +} \ No newline at end of file diff --git a/src/api-types/models/DatabaseFile.ts b/src/api-types/models/DatabaseFile.ts index d6009b2..b1a17c0 100644 --- a/src/api-types/models/DatabaseFile.ts +++ b/src/api-types/models/DatabaseFile.ts @@ -19,4 +19,4 @@ export interface DatabaseFile { upload_date: string; uid: string; sharingEnabled?: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/DeleteFileRequest.ts b/src/api-types/models/DeleteFileRequest.ts deleted file mode 100644 index c64af6c..0000000 --- a/src/api-types/models/DeleteFileRequest.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import { FileType } from './FileType'; - -export interface DeleteFileRequest { - fileName: string; - type: FileType; -} diff --git a/src/api-types/models/DeleteMp3Mp4Request.ts b/src/api-types/models/DeleteMp3Mp4Request.ts index f6d65d6..3202c4f 100644 --- a/src/api-types/models/DeleteMp3Mp4Request.ts +++ b/src/api-types/models/DeleteMp3Mp4Request.ts @@ -6,4 +6,4 @@ export interface DeleteMp3Mp4Request { uid: string; blacklistMode?: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/DeletePlaylistRequest.ts b/src/api-types/models/DeletePlaylistRequest.ts index 25830bb..76f2f81 100644 --- a/src/api-types/models/DeletePlaylistRequest.ts +++ b/src/api-types/models/DeletePlaylistRequest.ts @@ -5,6 +5,6 @@ import { FileType } from './FileType'; export interface DeletePlaylistRequest { - playlistID: string; + playlist_id: string; type: FileType; -} +} \ No newline at end of file diff --git a/src/api-types/models/DeleteSubscriptionFileRequest.ts b/src/api-types/models/DeleteSubscriptionFileRequest.ts index aebe91b..7a166a9 100644 --- a/src/api-types/models/DeleteSubscriptionFileRequest.ts +++ b/src/api-types/models/DeleteSubscriptionFileRequest.ts @@ -12,4 +12,4 @@ export interface DeleteSubscriptionFileRequest { * If true, does not remove id from archive. Only valid if youtube-dl archive is enabled in settings. */ deleteForever?: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/DeleteUserRequest.ts b/src/api-types/models/DeleteUserRequest.ts index a994369..15a1d09 100644 --- a/src/api-types/models/DeleteUserRequest.ts +++ b/src/api-types/models/DeleteUserRequest.ts @@ -5,4 +5,4 @@ export interface DeleteUserRequest { uid: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/Download.ts b/src/api-types/models/Download.ts index b4d91d9..d91dd00 100644 --- a/src/api-types/models/Download.ts +++ b/src/api-types/models/Download.ts @@ -5,19 +5,22 @@ export interface Download { uid: string; - ui_uid: string; - downloading: boolean; - complete: boolean; + ui_uid?: string; + running: boolean; + finished: boolean; + paused: boolean; + finished_step: boolean; url: string; type: string; + title: string; + step_index: number; percent_complete: number; - is_playlist: boolean; timestamp_start: number; - timestamp_end?: number; - filesize?: number | null; /** * Error text, set if download fails. */ - error?: string; - fileNames?: Array; -} + error?: string | null; + user_uid?: string; + sub_id?: string; + sub_name?: string; +} \ No newline at end of file diff --git a/src/api-types/models/DownloadArchiveRequest.ts b/src/api-types/models/DownloadArchiveRequest.ts index 46c5c45..857910c 100644 --- a/src/api-types/models/DownloadArchiveRequest.ts +++ b/src/api-types/models/DownloadArchiveRequest.ts @@ -5,6 +5,6 @@ export interface DownloadArchiveRequest { sub: { - archive_dir: string, - }; -} +archive_dir: string, +}; +} \ No newline at end of file diff --git a/src/api-types/models/DownloadFileRequest.ts b/src/api-types/models/DownloadFileRequest.ts index 61816c9..0bee9d2 100644 --- a/src/api-types/models/DownloadFileRequest.ts +++ b/src/api-types/models/DownloadFileRequest.ts @@ -2,23 +2,13 @@ /* tslint:disable */ /* eslint-disable */ -import { FileType } from './FileType'; export interface DownloadFileRequest { - fileNames: ; - zip_mode?: boolean; - type: FileType; - outputName?: string; - fullPathProvided?: boolean; + uid: string; uuid?: string; - uid?: string; - id?: string; + sub_id?: string; /** * Only used for subscriptions */ - subscriptionName?: string; - /** - * Only used for subscriptions - */ - subPlaylist?: boolean; -} + is_playlist?: boolean; +} \ No newline at end of file diff --git a/src/api-types/models/DownloadRequest.ts b/src/api-types/models/DownloadRequest.ts new file mode 100644 index 0000000..5c6da09 --- /dev/null +++ b/src/api-types/models/DownloadRequest.ts @@ -0,0 +1,44 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { CropFileSettings } from './CropFileSettings'; +import { FileType } from './FileType'; + +export interface DownloadRequest { + url: string; + /** + * Video format code. Overrides other quality options. + */ + customQualityConfiguration?: string; + /** + * Custom command-line arguments for youtube-dl. Overrides all other options, except url. + */ + customArgs?: string; + /** + * Additional command-line arguments for youtube-dl. Added to whatever args would normally be used. + */ + additionalArgs?: string; + /** + * Custom output filename template. + */ + customOutput?: string; + /** + * Login with this account ID + */ + youtubeUsername?: string; + /** + * Account password + */ + youtubePassword?: string; + /** + * Height of the video, if known + */ + selectedHeight?: string; + /** + * Specify ffmpeg/avconv audio quality + */ + maxBitrate?: string; + type?: FileType; + cropFileSettings?: CropFileSettings; +} \ No newline at end of file diff --git a/src/api-types/models/DownloadResponse.ts b/src/api-types/models/DownloadResponse.ts new file mode 100644 index 0000000..5450cfd --- /dev/null +++ b/src/api-types/models/DownloadResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Download } from './Download'; + +export interface DownloadResponse { + download?: Download | null; +} \ No newline at end of file diff --git a/src/api-types/models/DownloadVideosForSubscriptionRequest.ts b/src/api-types/models/DownloadVideosForSubscriptionRequest.ts index 4b64af3..31d0c6d 100644 --- a/src/api-types/models/DownloadVideosForSubscriptionRequest.ts +++ b/src/api-types/models/DownloadVideosForSubscriptionRequest.ts @@ -5,4 +5,4 @@ export interface DownloadVideosForSubscriptionRequest { subID: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/File.ts b/src/api-types/models/File.ts index 2e81613..5114e53 100644 --- a/src/api-types/models/File.ts +++ b/src/api-types/models/File.ts @@ -5,4 +5,4 @@ export interface File { id?: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/GenerateNewApiKeyResponse.ts b/src/api-types/models/GenerateNewApiKeyResponse.ts index d96a464..378a642 100644 --- a/src/api-types/models/GenerateNewApiKeyResponse.ts +++ b/src/api-types/models/GenerateNewApiKeyResponse.ts @@ -5,4 +5,4 @@ export interface GenerateNewApiKeyResponse { new_api_key: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetAllDownloadsResponse.ts b/src/api-types/models/GetAllDownloadsResponse.ts index 1f99a85..5367f56 100644 --- a/src/api-types/models/GetAllDownloadsResponse.ts +++ b/src/api-types/models/GetAllDownloadsResponse.ts @@ -2,12 +2,8 @@ /* tslint:disable */ /* eslint-disable */ -import { Dictionary } from './Dictionary'; import { Download } from './Download'; export interface GetAllDownloadsResponse { - /** - * Map of Session ID to inner map - */ - downloads?: Dictionary>; -} + downloads?: Array; +} \ No newline at end of file diff --git a/src/api-types/models/GetAllFilesResponse.ts b/src/api-types/models/GetAllFilesResponse.ts index 79f7fc6..d067555 100644 --- a/src/api-types/models/GetAllFilesResponse.ts +++ b/src/api-types/models/GetAllFilesResponse.ts @@ -11,4 +11,4 @@ export interface GetAllFilesResponse { * All video playlists */ playlists: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetAllSubscriptionsResponse.ts b/src/api-types/models/GetAllSubscriptionsResponse.ts index fafb6f5..485d0cd 100644 --- a/src/api-types/models/GetAllSubscriptionsResponse.ts +++ b/src/api-types/models/GetAllSubscriptionsResponse.ts @@ -6,4 +6,4 @@ import { Subscription } from './Subscription'; export interface GetAllSubscriptionsResponse { subscriptions: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetDownloadRequest.ts b/src/api-types/models/GetDownloadRequest.ts index 9ad5fdf..49f102a 100644 --- a/src/api-types/models/GetDownloadRequest.ts +++ b/src/api-types/models/GetDownloadRequest.ts @@ -4,6 +4,5 @@ export interface GetDownloadRequest { - session_id: string; - download_id: string; -} + download_uid: string; +} \ No newline at end of file diff --git a/src/api-types/models/GetDownloadResponse.ts b/src/api-types/models/GetDownloadResponse.ts index b027cbf..029e21f 100644 --- a/src/api-types/models/GetDownloadResponse.ts +++ b/src/api-types/models/GetDownloadResponse.ts @@ -6,4 +6,4 @@ import { Download } from './Download'; export interface GetDownloadResponse { download?: Download | null; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetFileRequest.ts b/src/api-types/models/GetFileRequest.ts index 0d85afb..3bb14b1 100644 --- a/src/api-types/models/GetFileRequest.ts +++ b/src/api-types/models/GetFileRequest.ts @@ -14,4 +14,4 @@ export interface GetFileRequest { * User UID */ uuid?: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetFileResponse.ts b/src/api-types/models/GetFileResponse.ts index 71b3563..df78e28 100644 --- a/src/api-types/models/GetFileResponse.ts +++ b/src/api-types/models/GetFileResponse.ts @@ -7,4 +7,4 @@ import { DatabaseFile } from './DatabaseFile'; export interface GetFileResponse { success: boolean; file?: DatabaseFile; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetMp3sResponse.ts b/src/api-types/models/GetMp3sResponse.ts index 13f03dc..23a80d7 100644 --- a/src/api-types/models/GetMp3sResponse.ts +++ b/src/api-types/models/GetMp3sResponse.ts @@ -11,4 +11,4 @@ export interface GetMp3sResponse { * All audio playlists */ playlists: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetMp4sResponse.ts b/src/api-types/models/GetMp4sResponse.ts index 9ef2c1f..06e1f98 100644 --- a/src/api-types/models/GetMp4sResponse.ts +++ b/src/api-types/models/GetMp4sResponse.ts @@ -11,4 +11,4 @@ export interface GetMp4sResponse { * All video playlists */ playlists: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetPlaylistRequest.ts b/src/api-types/models/GetPlaylistRequest.ts index ca86a2d..9a48a9b 100644 --- a/src/api-types/models/GetPlaylistRequest.ts +++ b/src/api-types/models/GetPlaylistRequest.ts @@ -5,7 +5,8 @@ import { FileType } from './FileType'; export interface GetPlaylistRequest { - playlistID: string; + playlist_id: string; type?: FileType; uuid?: string; -} + include_file_metadata?: boolean; +} \ No newline at end of file diff --git a/src/api-types/models/GetPlaylistResponse.ts b/src/api-types/models/GetPlaylistResponse.ts index c3bf7c9..afe4184 100644 --- a/src/api-types/models/GetPlaylistResponse.ts +++ b/src/api-types/models/GetPlaylistResponse.ts @@ -9,4 +9,4 @@ export interface GetPlaylistResponse { playlist: Playlist; type: FileType; success: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetPlaylistsRequest.ts b/src/api-types/models/GetPlaylistsRequest.ts new file mode 100644 index 0000000..2693d19 --- /dev/null +++ b/src/api-types/models/GetPlaylistsRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetPlaylistsRequest { + include_categories?: boolean; +} \ No newline at end of file diff --git a/src/api-types/models/GetPlaylistsResponse.ts b/src/api-types/models/GetPlaylistsResponse.ts new file mode 100644 index 0000000..e01f586 --- /dev/null +++ b/src/api-types/models/GetPlaylistsResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Playlist } from './Playlist'; + +export interface GetPlaylistsResponse { + playlists: Array; +} \ No newline at end of file diff --git a/src/api-types/models/GetRolesResponse.ts b/src/api-types/models/GetRolesResponse.ts index ce5e696..2209ec4 100644 --- a/src/api-types/models/GetRolesResponse.ts +++ b/src/api-types/models/GetRolesResponse.ts @@ -6,11 +6,11 @@ import { UserPermission } from './UserPermission'; export interface GetRolesResponse { roles: { - admin?: { - permissions?: Array, - }, - user?: { - permissions?: Array, - }, - }; -} +admin?: { +permissions?: Array, +}, +user?: { +permissions?: Array, +}, +}; +} \ No newline at end of file diff --git a/src/api-types/models/GetSubscriptionRequest.ts b/src/api-types/models/GetSubscriptionRequest.ts index 99ee221..c11c5fa 100644 --- a/src/api-types/models/GetSubscriptionRequest.ts +++ b/src/api-types/models/GetSubscriptionRequest.ts @@ -8,4 +8,8 @@ export interface GetSubscriptionRequest { * Subscription ID */ id: string; -} + /** + * Subscription name + */ + name?: string; +} \ No newline at end of file diff --git a/src/api-types/models/GetSubscriptionResponse.ts b/src/api-types/models/GetSubscriptionResponse.ts index 9d2209a..0efb102 100644 --- a/src/api-types/models/GetSubscriptionResponse.ts +++ b/src/api-types/models/GetSubscriptionResponse.ts @@ -7,4 +7,4 @@ import { Subscription } from './Subscription'; export interface GetSubscriptionResponse { subscription: Subscription; files: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/GetUsersResponse.ts b/src/api-types/models/GetUsersResponse.ts index f5f9eb0..2f17953 100644 --- a/src/api-types/models/GetUsersResponse.ts +++ b/src/api-types/models/GetUsersResponse.ts @@ -6,4 +6,4 @@ import { User } from './User'; export interface GetUsersResponse { users: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/LoginRequest.ts b/src/api-types/models/LoginRequest.ts index a06327f..2e99447 100644 --- a/src/api-types/models/LoginRequest.ts +++ b/src/api-types/models/LoginRequest.ts @@ -6,4 +6,4 @@ export interface LoginRequest { username: string; password: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/LoginResponse.ts b/src/api-types/models/LoginResponse.ts index c94f444..7f5c42d 100644 --- a/src/api-types/models/LoginResponse.ts +++ b/src/api-types/models/LoginResponse.ts @@ -10,4 +10,4 @@ export interface LoginResponse { token?: string; permissions?: Array; available_permissions?: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/Mp3DownloadRequest.ts b/src/api-types/models/Mp3DownloadRequest.ts deleted file mode 100644 index b4b4f8f..0000000 --- a/src/api-types/models/Mp3DownloadRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import { BaseDownloadRequest } from './BaseDownloadRequest'; - -export interface Mp3DownloadRequest extends BaseDownloadRequest { - /** - * Specify ffmpeg/avconv audio quality - */ - maxBitrate?: string; -} diff --git a/src/api-types/models/Mp3DownloadResponse.ts b/src/api-types/models/Mp3DownloadResponse.ts deleted file mode 100644 index 32924a6..0000000 --- a/src/api-types/models/Mp3DownloadResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import { BaseDownloadResponse } from './BaseDownloadResponse'; - -export interface Mp3DownloadResponse extends BaseDownloadResponse { - audiopathEncoded: string; -} diff --git a/src/api-types/models/Mp4DownloadRequest.ts b/src/api-types/models/Mp4DownloadRequest.ts deleted file mode 100644 index faeb6ab..0000000 --- a/src/api-types/models/Mp4DownloadRequest.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import { BaseDownloadRequest } from './BaseDownloadRequest'; - -export interface Mp4DownloadRequest extends BaseDownloadRequest { - /** - * Height of the video, if known - */ - selectedHeight?: string; -} diff --git a/src/api-types/models/Mp4DownloadResponse.ts b/src/api-types/models/Mp4DownloadResponse.ts deleted file mode 100644 index 0763c07..0000000 --- a/src/api-types/models/Mp4DownloadResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import { BaseDownloadResponse } from './BaseDownloadResponse'; - -export interface Mp4DownloadResponse extends BaseDownloadResponse { - videopathEncoded: string; -} diff --git a/src/api-types/models/Playlist.ts b/src/api-types/models/Playlist.ts index 1afe993..7741f41 100644 --- a/src/api-types/models/Playlist.ts +++ b/src/api-types/models/Playlist.ts @@ -6,10 +6,11 @@ import { FileType } from './FileType'; export interface Playlist { name: string; - fileNames: Array; + uids: Array; id: string; thumbnailURL: string; type: FileType; registered: number; duration: number; -} + user_uid?: string; +} \ No newline at end of file diff --git a/src/api-types/models/RegisterRequest.ts b/src/api-types/models/RegisterRequest.ts index 73bee22..87b7f0f 100644 --- a/src/api-types/models/RegisterRequest.ts +++ b/src/api-types/models/RegisterRequest.ts @@ -7,4 +7,4 @@ export interface RegisterRequest { userid: string; username: string; password: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/RegisterResponse.ts b/src/api-types/models/RegisterResponse.ts index 4e45b65..5aaa76a 100644 --- a/src/api-types/models/RegisterResponse.ts +++ b/src/api-types/models/RegisterResponse.ts @@ -6,4 +6,4 @@ import { User } from './User'; export interface RegisterResponse { user?: User; -} +} \ No newline at end of file diff --git a/src/api-types/models/SetConfigRequest.ts b/src/api-types/models/SetConfigRequest.ts index 41ef52a..f307009 100644 --- a/src/api-types/models/SetConfigRequest.ts +++ b/src/api-types/models/SetConfigRequest.ts @@ -6,4 +6,4 @@ import { Config } from './Config'; export interface SetConfigRequest { new_config_file: Config; -} +} \ No newline at end of file diff --git a/src/api-types/models/SharingToggle.ts b/src/api-types/models/SharingToggle.ts index 2de90fc..5acba30 100644 --- a/src/api-types/models/SharingToggle.ts +++ b/src/api-types/models/SharingToggle.ts @@ -2,10 +2,8 @@ /* tslint:disable */ /* eslint-disable */ -import { FileType } from './FileType'; export interface SharingToggle { uid: string; - type: FileType; is_playlist?: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/SubscribeRequest.ts b/src/api-types/models/SubscribeRequest.ts index d475cb9..2cca0df 100644 --- a/src/api-types/models/SubscribeRequest.ts +++ b/src/api-types/models/SubscribeRequest.ts @@ -7,8 +7,8 @@ export interface SubscribeRequest { name: string; url: string; timerange?: string; - streamingOnly: boolean; audioOnly?: boolean; customArgs?: string; customFileOutput?: string; -} + maxQuality?: string; +} \ No newline at end of file diff --git a/src/api-types/models/SubscribeResponse.ts b/src/api-types/models/SubscribeResponse.ts index fa4c235..a1f1331 100644 --- a/src/api-types/models/SubscribeResponse.ts +++ b/src/api-types/models/SubscribeResponse.ts @@ -7,4 +7,4 @@ import { Subscription } from './Subscription'; export interface SubscribeResponse { new_sub: Subscription; error?: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/Subscription.ts b/src/api-types/models/Subscription.ts index 8cd369e..1184827 100644 --- a/src/api-types/models/Subscription.ts +++ b/src/api-types/models/Subscription.ts @@ -17,4 +17,4 @@ export interface Subscription { custom_args?: string; custom_output?: string; videos: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/SubscriptionRequestData.ts b/src/api-types/models/SubscriptionRequestData.ts index 6c99499..056ff28 100644 --- a/src/api-types/models/SubscriptionRequestData.ts +++ b/src/api-types/models/SubscriptionRequestData.ts @@ -10,4 +10,4 @@ export interface SubscriptionRequestData { type?: FileType; isPlaylist?: boolean; archive?: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/SuccessObject.ts b/src/api-types/models/SuccessObject.ts index cd0a11e..f59e3fa 100644 --- a/src/api-types/models/SuccessObject.ts +++ b/src/api-types/models/SuccessObject.ts @@ -5,4 +5,4 @@ export interface SuccessObject { success: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/UnsubscribeRequest.ts b/src/api-types/models/UnsubscribeRequest.ts index 598faee..1ee72e3 100644 --- a/src/api-types/models/UnsubscribeRequest.ts +++ b/src/api-types/models/UnsubscribeRequest.ts @@ -10,4 +10,4 @@ export interface UnsubscribeRequest { * Defaults to false */ deleteMode?: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/UnsubscribeResponse.ts b/src/api-types/models/UnsubscribeResponse.ts index 0f0d991..1d43b7b 100644 --- a/src/api-types/models/UnsubscribeResponse.ts +++ b/src/api-types/models/UnsubscribeResponse.ts @@ -6,4 +6,4 @@ export interface UnsubscribeResponse { success: boolean; error?: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/UpdatePlaylistFilesRequest.ts b/src/api-types/models/UpdatePlaylistFilesRequest.ts deleted file mode 100644 index 3fa95c2..0000000 --- a/src/api-types/models/UpdatePlaylistFilesRequest.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import { FileType } from './FileType'; - -export interface UpdatePlaylistFilesRequest { - playlistID: string; - fileNames: Array; - type: FileType; -} diff --git a/src/api-types/models/UpdatePlaylistRequest.ts b/src/api-types/models/UpdatePlaylistRequest.ts index 1eaee52..38f98ac 100644 --- a/src/api-types/models/UpdatePlaylistRequest.ts +++ b/src/api-types/models/UpdatePlaylistRequest.ts @@ -6,4 +6,4 @@ import { Playlist } from './Playlist'; export interface UpdatePlaylistRequest { playlist: Playlist; -} +} \ No newline at end of file diff --git a/src/api-types/models/UpdateServerRequest.ts b/src/api-types/models/UpdateServerRequest.ts index 95db6e4..8c616f6 100644 --- a/src/api-types/models/UpdateServerRequest.ts +++ b/src/api-types/models/UpdateServerRequest.ts @@ -5,4 +5,4 @@ export interface UpdateServerRequest { tag: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/UpdateUserRequest.ts b/src/api-types/models/UpdateUserRequest.ts index c6e2f05..19e32c8 100644 --- a/src/api-types/models/UpdateUserRequest.ts +++ b/src/api-types/models/UpdateUserRequest.ts @@ -5,8 +5,8 @@ export interface UpdateUserRequest { change_object: { - uid: string, - name?: string, - role?: string, - }; -} +uid: string, +name?: string, +role?: string, +}; +} \ No newline at end of file diff --git a/src/api-types/models/UpdaterStatus.ts b/src/api-types/models/UpdaterStatus.ts index 19e513c..8db6a17 100644 --- a/src/api-types/models/UpdaterStatus.ts +++ b/src/api-types/models/UpdaterStatus.ts @@ -7,4 +7,4 @@ export interface UpdaterStatus { updating: boolean; details: string; error?: boolean; -} +} \ No newline at end of file diff --git a/src/api-types/models/User.ts b/src/api-types/models/User.ts index 8a49d3c..0568e06 100644 --- a/src/api-types/models/User.ts +++ b/src/api-types/models/User.ts @@ -10,16 +10,16 @@ export interface User { name?: string; passhash?: string; files?: { - audio?: Array, - video?: Array, - }; +audio?: Array, +video?: Array, +}; playlists?: { - audio?: Array, - video?: Array, - }; +audio?: Array, +video?: Array, +}; subscriptions?: Array; created?: number; role?: string; permissions?: Array; permission_overrides?: Array; -} +} \ No newline at end of file diff --git a/src/api-types/models/body_19.ts b/src/api-types/models/body_19.ts index b0ce9cb..c7f8fb8 100644 --- a/src/api-types/models/body_19.ts +++ b/src/api-types/models/body_19.ts @@ -5,4 +5,4 @@ export interface body_19 { input_pin: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/body_20.ts b/src/api-types/models/body_20.ts index 84a7b47..559ea14 100644 --- a/src/api-types/models/body_20.ts +++ b/src/api-types/models/body_20.ts @@ -5,4 +5,4 @@ export interface body_20 { unhashed_pin: string; -} +} \ No newline at end of file diff --git a/src/api-types/models/inline_response_200_15.ts b/src/api-types/models/inline_response_200_15.ts index bb98ac6..7147a1e 100644 --- a/src/api-types/models/inline_response_200_15.ts +++ b/src/api-types/models/inline_response_200_15.ts @@ -5,4 +5,4 @@ export interface inline_response_200_15 { is_set: boolean; -} +} \ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9277a4f..7b26e63 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -47,7 +47,6 @@ import { InputDialogComponent } from './input-dialog/input-dialog.component'; import { LazyLoadImageModule, IsVisibleProps } from 'ng-lazyload-image'; import { audioFilesMouseHovering, videoFilesMouseHovering, audioFilesOpened, videoFilesOpened } from './main/main.component'; import { CreatePlaylistComponent } from './create-playlist/create-playlist.component'; -import { DownloadItemComponent } from './download-item/download-item.component'; import { SubscriptionsComponent } from './subscriptions/subscriptions.component'; import { SubscribeDialogComponent } from './dialogs/subscribe-dialog/subscribe-dialog.component'; import { SubscriptionComponent } from './subscription//subscription/subscription.component'; @@ -102,7 +101,6 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible PlayerComponent, InputDialogComponent, CreatePlaylistComponent, - DownloadItemComponent, SubscriptionsComponent, SubscribeDialogComponent, SubscriptionComponent, diff --git a/src/app/dialogs/subscribe-dialog/subscribe-dialog.component.ts b/src/app/dialogs/subscribe-dialog/subscribe-dialog.component.ts index 0d3ab68..916b5f9 100644 --- a/src/app/dialogs/subscribe-dialog/subscribe-dialog.component.ts +++ b/src/app/dialogs/subscribe-dialog/subscribe-dialog.component.ts @@ -90,7 +90,7 @@ export class SubscribeDialogComponent implements OnInit { if (!this.download_all) { timerange = 'now-' + this.timerange_amount.toString() + this.timerange_unit; } - this.postsService.createSubscription(this.url, this.name, timerange, this.streamingOnlyMode, this.maxQuality, + this.postsService.createSubscription(this.url, this.name, timerange, this.maxQuality, this.audioOnlyMode, this.customArgs, this.customFileOutput).subscribe(res => { this.subscribing = false; if (res['new_sub']) { diff --git a/src/app/download-item/download-item.component.html b/src/app/download-item/download-item.component.html deleted file mode 100644 index 07d4310..0000000 --- a/src/app/download-item/download-item.component.html +++ /dev/null @@ -1,41 +0,0 @@ -
- - -
ID: {{url_id ? url_id : download.uid}}
-
- - - done - error - - - - -
- - -
- Details -
-
-
- {{download.timestamp_start | date:'medium'}} -
-
-
-
- An error has occurred: -
- {{download.error}} -
-
- Download start: {{download.timestamp_start | date:'medium'}} -
-
- Download end: {{download.timestamp_end | date:'medium'}} -
-
- File path(s): {{download.fileNames.join(', ')}} -
-
-
\ No newline at end of file diff --git a/src/app/download-item/download-item.component.scss b/src/app/download-item/download-item.component.scss deleted file mode 100644 index f28a49f..0000000 --- a/src/app/download-item/download-item.component.scss +++ /dev/null @@ -1,16 +0,0 @@ -.shorten { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - display: block; -} - -.mat-expansion-panel:not([class*='mat-elevation-z']) { - box-shadow: none; -} - -.ignore-margin { - margin-left: -15px; - margin-right: -15px; - margin-bottom: -15px; -} diff --git a/src/app/download-item/download-item.component.spec.ts b/src/app/download-item/download-item.component.spec.ts deleted file mode 100644 index 7baea1e..0000000 --- a/src/app/download-item/download-item.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; - -import { DownloadItemComponent } from './download-item.component'; - -describe('DownloadItemComponent', () => { - let component: DownloadItemComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ DownloadItemComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DownloadItemComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/download-item/download-item.component.ts b/src/app/download-item/download-item.component.ts deleted file mode 100644 index 5803afd..0000000 --- a/src/app/download-item/download-item.component.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; -import { Download } from 'app/main/main.component'; - - -@Component({ - selector: 'app-download-item', - templateUrl: './download-item.component.html', - styleUrls: ['./download-item.component.scss'] -}) -export class DownloadItemComponent implements OnInit { - - @Input() download: Download = { - uid: null, - type: 'audio', - percent_complete: 0, - complete: false, - url: 'http://youtube.com/watch?v=17848rufj', - downloading: true, - timestamp_start: null, - timestamp_end: null, - is_playlist: false, - error: false - }; - @Output() cancelDownload = new EventEmitter(); - - @Input() queueNumber = null; - - url_id = null; - - constructor() { } - - ngOnInit() { - if (this.download && this.download.url && this.download.url.includes('youtu')) { - const string_id = (this.download.is_playlist ? '?list=' : '?v=') - const index_offset = (this.download.is_playlist ? 6 : 3); - const end_index = this.download.url.indexOf(string_id) + index_offset; - this.url_id = this.download.url.substring(end_index, this.download.url.length); - } - } - - cancelTheDownload() { - this.cancelDownload.emit(this.download); - } - -} diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index de787ca..08906bd 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -10,26 +10,13 @@ import { Router, ActivatedRoute } from '@angular/router'; import { Platform } from '@angular/cdk/platform'; import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component'; import { RecentVideosComponent } from 'app/components/recent-videos/recent-videos.component'; +import { Download, FileType } from 'api-types'; export let audioFilesMouseHovering = false; export let videoFilesMouseHovering = false; export let audioFilesOpened = false; export let videoFilesOpened = false; -export interface Download { - uid: string; - type: string; - url: string; - percent_complete: number; - downloading: boolean; - is_playlist: boolean; - error?: boolean | string; - fileNames?: string[]; - complete?: boolean; - timestamp_start?: number; - timestamp_end?: number; -} - @Component({ selector: 'app-root', templateUrl: './main.component.html', @@ -198,16 +185,6 @@ export class MainComponent implements OnInit { last_valid_url = ''; last_url_check = 0; - test_download: Download = { - uid: null, - type: 'audio', - percent_complete: 0, - url: 'http://youtube.com/watch?v=17848rufj', - downloading: true, - is_playlist: false, - error: false - }; - argsChangedSubject: Subject = new Subject(); simulatedOutput = ''; @@ -411,7 +388,7 @@ export class MainComponent implements OnInit { const urls = this.getURLArray(this.url); for (let i = 0; i < urls.length; i++) { const url = urls[i]; - this.postsService.downloadFile(url, type, (selected_quality === '' ? null : selected_quality), + this.postsService.downloadFile(url, type as FileType, (selected_quality === '' ? null : selected_quality), customQualityConfiguration, customArgs, additionalArgs, customOutput, youtubeUsername, youtubePassword, cropFileSettings).subscribe(res => { this.current_download = res['download']; this.downloads.push(res['download']); @@ -439,7 +416,6 @@ export class MainComponent implements OnInit { return; } this.downloadingfile = false; - this.current_download.downloading = false; this.current_download = null; } diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts index d87c858..fb40ed1 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -157,7 +157,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { }); // regular video/audio file (not playlist) this.uids = [this.db_file['uid']]; - this.type = this.db_file['isAudio'] ? 'audio' : 'video' as FileType; + this.type = this.db_file['isAudio'] ? 'audio' as FileType : 'video' as FileType; this.parseFileNames(); }); } diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index fd81f73..56cc403 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -16,6 +16,7 @@ import { ConfigResponse, CreatePlaylistRequest, CreatePlaylistResponse, + CropFileSettings, DeleteMp3Mp4Request, DeletePlaylistRequest, DeleteSubscriptionFileRequest, @@ -41,10 +42,8 @@ import { GetUsersResponse, LoginRequest, LoginResponse, - Mp3DownloadRequest, - Mp3DownloadResponse, - Mp4DownloadRequest, - Mp4DownloadResponse, + DownloadRequest, + DownloadResponse, Playlist, RegisterRequest, RegisterResponse, @@ -57,7 +56,6 @@ import { UpdaterStatus, UnsubscribeRequest, UnsubscribeResponse, - UpdatePlaylistFilesRequest, UpdatePlaylistRequest, UpdateServerRequest, UpdateUserRequest, @@ -231,7 +229,7 @@ export class PostsService implements CanActivate { // tslint:disable-next-line: max-line-length // tslint:disable-next-line: max-line-length - downloadFile(url: string, type: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, additionalArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, cropFileSettings: CropFileSettings = null) { + downloadFile(url: string, type: FileType, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, additionalArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, cropFileSettings: CropFileSettings = null) { const body: DownloadRequest = {url: url, selectedHeight: selectedQuality, customQualityConfiguration: customQualityConfiguration, @@ -299,7 +297,7 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'setConfig', body, this.httpOptions); } - deleteFile(uid: string, isAudio: boolean, blacklistMode = false) { + deleteFile(uid: string, blacklistMode = false) { const body: DeleteMp3Mp4Request = {uid: uid, blacklistMode: blacklistMode} return this.http.post(this.path + 'deleteFile', body, this.httpOptions); } @@ -392,12 +390,12 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions); } - enableSharing(uid: string, type: FileType, is_playlist: boolean) { + enableSharing(uid: string, is_playlist: boolean) { const body: SharingToggle = {uid: uid, is_playlist: is_playlist}; return this.http.post(this.path + 'enableSharing', body, this.httpOptions); } - disableSharing(uid: string, type: FileType, is_playlist: boolean) { + disableSharing(uid: string, is_playlist: boolean) { const body: SharingToggle = {uid: uid, is_playlist: is_playlist}; return this.http.post(this.path + 'disableSharing', body, this.httpOptions); } @@ -434,10 +432,9 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'deletePlaylist', body, this.httpOptions); } - createSubscription(url, name, timerange = null, streamingOnly = false, maxQuality = 'best', audioOnly = false, customArgs: string = null, customFileOutput: string = null) { + createSubscription(url, name, timerange = null, maxQuality = 'best', audioOnly = false, customArgs: string = null, customFileOutput: string = null) { const body: SubscribeRequest = {url: url, name: name, timerange: timerange, maxQuality: maxQuality, - streamingOnly: streamingOnly, audioOnly: audioOnly, customArgs: customArgs, - customFileOutput: customFileOutput}; + audioOnly: audioOnly, customArgs: customArgs, customFileOutput: customFileOutput}; return this.http.post(this.path + 'subscribe', body, this.httpOptions); } From c5db1d30e26dce62a809a5879703b707312fb462 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Thu, 30 Sep 2021 22:18:55 -0600 Subject: [PATCH 12/12] Added missing routes to API Changed getDBInfo from post to get request --- Public API v1.yaml | 765 ++++++++++++++++-- backend/app.js | 2 +- package-lock.json | 7 + src/api-types/index.ts | 34 + .../models/AddFileToPlaylistRequest.ts | 9 + src/api-types/models/Category.ts | 15 + src/api-types/models/CategoryRule.ts | 26 + .../models/CheckConcurrentStreamRequest.ts | 11 + .../models/CheckConcurrentStreamResponse.ts | 9 + src/api-types/models/ConcurrentStream.ts | 10 + src/api-types/models/CreateCategoryRequest.ts | 8 + .../models/CreateCategoryResponse.ts | 10 + src/api-types/models/DBInfoResponse.ts | 18 + src/api-types/models/DeleteCategoryRequest.ts | 8 + src/api-types/models/DownloadFileRequest.ts | 7 +- .../DownloadTwitchChatByVODIDRequest.ts | 26 + .../DownloadTwitchChatByVODIDResponse.ts | 9 + src/api-types/models/GenerateArgsResponse.ts | 8 + .../models/GetAllCategoriesResponse.ts | 9 + .../models/GetAllDownloadsRequest.ts | 11 + src/api-types/models/GetFileFormatsRequest.ts | 8 + .../models/GetFileFormatsResponse.ts | 12 + .../models/GetFullTwitchChatRequest.ts | 22 + .../models/GetFullTwitchChatResponse.ts | 9 + src/api-types/models/GetLogsRequest.ts | 8 + src/api-types/models/GetLogsResponse.ts | 12 + .../models/IncrementViewCountRequest.ts | 13 + src/api-types/models/TableInfo.ts | 8 + .../models/TestConnectionStringRequest.ts | 11 + .../models/TestConnectionStringResponse.ts | 9 + src/api-types/models/TransferDBRequest.ts | 11 + src/api-types/models/TransferDBResponse.ts | 9 + src/api-types/models/TwitchChatMessage.ts | 18 + .../models/UpdateCategoriesRequest.ts | 9 + src/api-types/models/UpdateCategoryRequest.ts | 9 + .../models/UpdateConcurrentStreamRequest.ts | 12 + .../models/UpdateConcurrentStreamResponse.ts | 9 + src/api-types/models/Version.ts | 11 + src/api-types/models/VersionInfoResponse.ts | 9 + src/app/main/main.component.ts | 2 +- src/app/posts.services.ts | 160 ++-- 41 files changed, 1255 insertions(+), 118 deletions(-) create mode 100644 src/api-types/models/AddFileToPlaylistRequest.ts create mode 100644 src/api-types/models/Category.ts create mode 100644 src/api-types/models/CategoryRule.ts create mode 100644 src/api-types/models/CheckConcurrentStreamRequest.ts create mode 100644 src/api-types/models/CheckConcurrentStreamResponse.ts create mode 100644 src/api-types/models/ConcurrentStream.ts create mode 100644 src/api-types/models/CreateCategoryRequest.ts create mode 100644 src/api-types/models/CreateCategoryResponse.ts create mode 100644 src/api-types/models/DBInfoResponse.ts create mode 100644 src/api-types/models/DeleteCategoryRequest.ts create mode 100644 src/api-types/models/DownloadTwitchChatByVODIDRequest.ts create mode 100644 src/api-types/models/DownloadTwitchChatByVODIDResponse.ts create mode 100644 src/api-types/models/GenerateArgsResponse.ts create mode 100644 src/api-types/models/GetAllCategoriesResponse.ts create mode 100644 src/api-types/models/GetAllDownloadsRequest.ts create mode 100644 src/api-types/models/GetFileFormatsRequest.ts create mode 100644 src/api-types/models/GetFileFormatsResponse.ts create mode 100644 src/api-types/models/GetFullTwitchChatRequest.ts create mode 100644 src/api-types/models/GetFullTwitchChatResponse.ts create mode 100644 src/api-types/models/GetLogsRequest.ts create mode 100644 src/api-types/models/GetLogsResponse.ts create mode 100644 src/api-types/models/IncrementViewCountRequest.ts create mode 100644 src/api-types/models/TableInfo.ts create mode 100644 src/api-types/models/TestConnectionStringRequest.ts create mode 100644 src/api-types/models/TestConnectionStringResponse.ts create mode 100644 src/api-types/models/TransferDBRequest.ts create mode 100644 src/api-types/models/TransferDBResponse.ts create mode 100644 src/api-types/models/TwitchChatMessage.ts create mode 100644 src/api-types/models/UpdateCategoriesRequest.ts create mode 100644 src/api-types/models/UpdateCategoryRequest.ts create mode 100644 src/api-types/models/UpdateConcurrentStreamRequest.ts create mode 100644 src/api-types/models/UpdateConcurrentStreamResponse.ts create mode 100644 src/api-types/models/Version.ts create mode 100644 src/api-types/models/VersionInfoResponse.ts diff --git a/Public API v1.yaml b/Public API v1.yaml index 01cdfcd..35eaa47 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -33,6 +33,27 @@ paths: description: Server download error security: - Auth query parameter: [] + /api/generateArgs: + post: + tags: + - downloader + summary: Download video file + description: Generates args, used for checking what args would run if you ran downloadFile + operationId: post-generateArgs + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DownloadRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GenerateArgsResponse' + security: + - Auth query parameter: [] /api/getMp3s: get: tags: @@ -148,6 +169,27 @@ paths: $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] + /api/incrementViewCount: + post: + summary: Increments a file's view count + tags: + - files + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncrementViewCountRequest' + operationId: post-api-incrementViewCount + description: Increments a file's view count + security: + - Auth query parameter: [] /api/subscribe: post: tags: @@ -359,6 +401,27 @@ paths: $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] + /api/addFileToPlaylist: + post: + tags: + - playlists + summary: Adds a file to a playlist + description: Adds a file to a playlist + operationId: post-api-addFileToPlaylist + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AddFileToPlaylistRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' + security: + - Auth query parameter: [] /api/deleteMp4: post: tags: @@ -487,48 +550,6 @@ paths: $ref: '#/components/schemas/inline_response_200_15' security: - Auth query parameter: [] - /api/checkPin: - post: - tags: - - security - summary: Check if pin is correct - description: Checks the pin against an inputted one. Will return true if they match - operationId: post-api-checkPin - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/body_19' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/SuccessObject' - security: - - Auth query parameter: [] - /api/setPin: - post: - tags: - - security - summary: Set pin - operationId: post-api-setPin - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/body_20' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/SuccessObject' - security: - - Auth query parameter: [] - description: '' /api/generateNewAPIKey: post: tags: @@ -604,7 +625,7 @@ paths: security: - Auth query parameter: [] /api/downloads: - get: + post: summary: Get info for all downloads tags: - downloader @@ -615,7 +636,12 @@ paths: application/json: schema: $ref: '#/components/schemas/GetAllDownloadsResponse' - operationId: get-api-downloads + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetAllDownloadsRequest' + operationId: post-api-downloads description: Retrieves all downloads recorded by the server and their status. security: - Auth query parameter: [] @@ -799,6 +825,299 @@ paths: - Auth query parameter: [] tags: - multi-user mode + /api/versionInfo: + get: + tags: + - server + summary: Gets server version info + operationId: get-api-versionInfo + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/VersionInfoResponse' + security: + - Auth query parameter: [] + /api/getLogs: + post: + summary: Gets logs from server + tags: + - server + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetLogsResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetLogsRequest' + operationId: post-api-getLogs + description: Gets logs from server + security: + - Auth query parameter: [] + /api/clearAllLogs: + post: + summary: Clears the log file + tags: + - server + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' + operationId: post-api-clearAllLogs + description: Clears the log file + security: + - Auth query parameter: [] + /api/getDBInfo: + get: + tags: + - db + summary: Gets information on the DB + operationId: get-api-getDBInfo + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DBInfoResponse' + security: + - Auth query parameter: [] + /api/transferDB: + post: + summary: Transfers DB between Local and MongoDB + tags: + - db + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TransferDBResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TransferDBRequest' + operationId: post-api-transferDB + description: Initiates a transfer between Local and MongoDB. Connection string must be set. + security: + - Auth query parameter: [] + /api/testConnectionString: + post: + summary: Tests a MongoDB connection string + tags: + - db + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TestConnectionStringResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TestConnectionStringRequest' + operationId: post-api-testConnectionString + description: Tests a MongoDB connection string and returns an error if one exists. + security: + - Auth query parameter: [] + /api/getFullTwitchChat: + post: + summary: Gets the downloaded Twitch Chat (VODs only) + tags: + - twitch + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetFullTwitchChatResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetFullTwitchChatRequest' + operationId: post-api-getFullTwitchChat + description: Gets the downloaded Twitch Chat (VODs only) + security: + - Auth query parameter: [] + /api/downloadTwitchChatByVODID: + post: + summary: Downloads Twitch Chat for a VOD + tags: + - twitch + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DownloadTwitchChatByVODIDResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DownloadTwitchChatByVODIDRequest' + operationId: post-api-downloadTwitchChatByVODID + description: Downloads Twitch Chat for a VOD + security: + - Auth query parameter: [] + /api/checkConcurrentStream: + post: + summary: Checks status of a concurrent stream + tags: + - player + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CheckConcurrentStreamResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CheckConcurrentStreamRequest' + operationId: post-api-checkConcurrentStream + description: Checks status of a concurrent stream + security: + - Auth query parameter: [] + /api/updateConcurrentStream: + post: + summary: Updates a concurrent stream + tags: + - player + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConcurrentStreamResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateConcurrentStreamRequest' + operationId: post-api-updateConcurrentStream + description: Updates a concurrent stream + security: + - Auth query parameter: [] + /api/getAllCategories: + post: + summary: Gets all categories + tags: + - categories + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetAllCategoriesResponse' + operationId: post-api-getAllCategories + description: Gets all categories + security: + - Auth query parameter: [] + /api/createCategory: + post: + summary: Creates a category + tags: + - categories + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCategoryResponse' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCategoryRequest' + operationId: post-api-createCategory + description: Creates a category + security: + - Auth query parameter: [] + /api/deleteCategory: + post: + summary: Deletes a category + tags: + - categories + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteCategoryRequest' + operationId: post-api-deleteCategory + description: Deletes a category + security: + - Auth query parameter: [] + /api/updateCategory: + post: + summary: Updates a category + tags: + - categories + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateCategoryRequest' + operationId: post-api-updateCategory + description: Updates a category + security: + - Auth query parameter: [] + /api/updateCategories: + post: + summary: Updates all categories + tags: + - categories + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateCategoriesRequest' + operationId: post-api-updateCategories + description: Updates all categories + security: + - Auth query parameter: [] components: schemas: SuccessObject: @@ -874,6 +1193,13 @@ components: download: $ref: '#/components/schemas/Download' nullable: true + GenerateArgsResponse: + type: object + properties: + args: + type: array + items: + type: string GetDownloadRequest: type: object properties: @@ -887,6 +1213,15 @@ components: download: $ref: '#/components/schemas/Download' nullable: true + GetAllDownloadsRequest: + type: object + properties: + uids: + type: array + items: + type: string + description: Filters downloads with the array + nullable: true GetAllDownloadsResponse: type: object properties: @@ -1159,8 +1494,6 @@ components: type: $ref: '#/components/schemas/FileType' DownloadFileRequest: - required: - - uid type: object properties: uid: @@ -1169,9 +1502,8 @@ components: type: string sub_id: type: string - is_playlist: - type: boolean - description: Only used for subscriptions + playlist_id: + type: string DownloadArchiveRequest: required: - sub @@ -1203,6 +1535,264 @@ components: properties: tag: type: string + DBInfoResponse: + required: + - db_info + type: object + properties: + using_local_db: + type: boolean + stats_by_table: + type: object + properties: + files: + $ref: '#/components/schemas/TableInfo' + playlists: + $ref: '#/components/schemas/TableInfo' + categories: + $ref: '#/components/schemas/TableInfo' + subscriptions: + $ref: '#/components/schemas/TableInfo' + users: + $ref: '#/components/schemas/TableInfo' + roles: + $ref: '#/components/schemas/TableInfo' + download_queue: + $ref: '#/components/schemas/TableInfo' + TransferDBResponse: + required: + - success + type: object + properties: + success: + type: boolean + error: + type: string + TransferDBRequest: + required: + - local_to_remote + type: object + properties: + local_to_remote: + description: True if transfering DB from Local to MongoDB, false if transferring DB from MongoDB to Local + type: boolean + TestConnectionStringResponse: + required: + - success + type: object + properties: + success: + type: boolean + error: + type: string + TestConnectionStringRequest: + required: + - connection_string + type: object + properties: + connection_string: + description: MongoDB connection string + type: string + GetFullTwitchChatResponse: + required: + - success + type: object + properties: + success: + type: boolean + error: + type: string + GetFullTwitchChatRequest: + required: + - id + - type + type: object + properties: + id: + description: File ID + type: string + type: + $ref: '#/components/schemas/FileType' + uuid: + description: User UID + type: string + sub: + description: Subscription + $ref: '#/components/schemas/Subscription' + DownloadTwitchChatByVODIDResponse: + required: + - chat + type: object + properties: + chat: + type: array + items: + $ref: '#/components/schemas/TwitchChatMessage' + DownloadTwitchChatByVODIDRequest: + required: + - id + - type + - vodId + type: object + properties: + id: + description: File ID + type: string + vodId: + description: ID of the VOD + type: string + type: + $ref: '#/components/schemas/FileType' + uuid: + description: User UID + type: string + sub: + description: Subscription + $ref: '#/components/schemas/Subscription' + CheckConcurrentStreamResponse: + required: + - stream + type: object + properties: + stream: + $ref: '#/components/schemas/ConcurrentStream' + CheckConcurrentStreamRequest: + required: + - uid + type: object + properties: + uid: + description: UID of the concurrent stream + type: string + UpdateConcurrentStreamResponse: + required: + - stream + type: object + properties: + stream: + $ref: '#/components/schemas/ConcurrentStream' + UpdateConcurrentStreamRequest: + allOf: + - $ref: '#/components/schemas/ConcurrentStream' + - type: object + properties: + uid: + type: string + description: Concurrent stream UID + required: + - uid + GetLogsResponse: + type: object + properties: + logs: + type: string + description: Number of lines to retrieve from the bottom + success: + type: boolean + GetLogsRequest: + required: + - connection_string + type: object + properties: + lines: + type: number + GetFileFormatsRequest: + type: object + properties: + url: + type: string + GetFileFormatsResponse: + required: + - result + - success + type: object + properties: + success: + type: boolean + result: + allOf: + - $ref: '#/components/schemas/file' + - type: object + properties: + formats: + type: array + items: + type: object + IncrementViewCountRequest: + required: + - file_uid + type: object + properties: + file_uid: + type: string + sub_id: + type: string + uuid: + type: string + description: User UID + AddFileToPlaylistRequest: + required: + - playlist_id + - file_uid + type: object + properties: + file_uid: + type: string + playlist_id: + type: string + GetAllCategoriesResponse: + required: + - categories + type: object + properties: + categories: + type: array + items: + $ref: '#/components/schemas/Category' + CreateCategoryResponse: + type: object + properties: + new_category: + $ref: '#/components/schemas/Category' + success: + type: boolean + CreateCategoryRequest: + required: + - name + type: object + properties: + name: + type: string + DeleteCategoryRequest: + required: + - category_uid + type: object + properties: + category_uid: + type: string + UpdateCategoryRequest: + required: + - category + type: object + properties: + category: + $ref: '#/components/schemas/Category' + UpdateCategoriesRequest: + required: + - categories + type: object + properties: + categories: + type: array + items: + $ref: '#/components/schemas/Category' + VersionInfoResponse: + required: + - version_info + type: object + properties: + version_info: + $ref: '#/components/schemas/Version' inline_response_200_15: required: - is_set @@ -1495,6 +2085,83 @@ components: enum: - 'yes' - 'no' + TableInfo: + type: object + properties: + records_count: + type: number + TwitchChatMessage: + type: object + properties: + created_at: + type: string + content_offset_seconds: + type: number + commenter: + type: object + properties: + name: + type: string + _id: + type: string + created_at: + type: string + message: + type: object + properties: + body: + type: string + user_color: + type: string + ConcurrentStream: + type: object + properties: + playback_timestamp: + type: number + unix_timestamp: + type: number + playing: + type: boolean + Category: + type: object + properties: + name: + type: string + uid: + type: string + rules: + type: array + items: + $ref: '#/components/schemas/CategoryRule' + custom_output: + type: string + description: Overrides file output for downloaded files in category + CategoryRule: + type: object + properties: + preceding_operator: + type: string + enum: + - 'or' + - 'and' + comparator: + type: string + enum: + - 'includes' + - 'not_includes' + - 'equals' + - 'not_equals' + Version: + type: object + properties: + type: + type: string + tag: + type: string + commit: + type: string + date: + type: string BaseChangePermissionsRequest: required: - permission diff --git a/backend/app.js b/backend/app.js index 6b2ca95..b12d502 100644 --- a/backend/app.js +++ b/backend/app.js @@ -950,7 +950,7 @@ app.post('/api/restartServer', optionalJwt, (req, res) => { res.send({success: true}); }); -app.post('/api/getDBInfo', optionalJwt, async (req, res) => { +app.get('/api/getDBInfo', optionalJwt, async (req, res) => { const db_info = await db_api.getDBStats(); res.send({db_info: db_info}); }); diff --git a/package-lock.json b/package-lock.json index 998567e..10f4d52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13767,6 +13767,13 @@ "integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ==", "dev": true }, + "uglify-js": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.2.tgz", + "integrity": "sha512-rtPMlmcO4agTUfz10CbgJ1k6UAoXM2gWb3GoMPPZB/+/Ackf8lNWk11K4rYi2D0apgoFRLtQOZhb+/iGNJq26A==", + "dev": true, + "optional": true + }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/src/api-types/index.ts b/src/api-types/index.ts index 83c73a8..c08044a 100644 --- a/src/api-types/index.ts +++ b/src/api-types/index.ts @@ -2,17 +2,27 @@ /* tslint:disable */ /* eslint-disable */ +export type { AddFileToPlaylistRequest } from './models/AddFileToPlaylistRequest'; export type { BaseChangePermissionsRequest } from './models/BaseChangePermissionsRequest'; export type { body_19 } from './models/body_19'; export type { body_20 } from './models/body_20'; +export type { Category } from './models/Category'; +export { CategoryRule } from './models/CategoryRule'; export type { ChangeRolePermissionsRequest } from './models/ChangeRolePermissionsRequest'; export type { ChangeUserPermissionsRequest } from './models/ChangeUserPermissionsRequest'; +export type { CheckConcurrentStreamRequest } from './models/CheckConcurrentStreamRequest'; +export type { CheckConcurrentStreamResponse } from './models/CheckConcurrentStreamResponse'; +export type { ConcurrentStream } from './models/ConcurrentStream'; export type { Config } from './models/Config'; export type { ConfigResponse } from './models/ConfigResponse'; +export type { CreateCategoryRequest } from './models/CreateCategoryRequest'; +export type { CreateCategoryResponse } from './models/CreateCategoryResponse'; export type { CreatePlaylistRequest } from './models/CreatePlaylistRequest'; export type { CreatePlaylistResponse } from './models/CreatePlaylistResponse'; export type { CropFileSettings } from './models/CropFileSettings'; export type { DatabaseFile } from './models/DatabaseFile'; +export type { DBInfoResponse } from './models/DBInfoResponse'; +export type { DeleteCategoryRequest } from './models/DeleteCategoryRequest'; export type { DeleteMp3Mp4Request } from './models/DeleteMp3Mp4Request'; export type { DeletePlaylistRequest } from './models/DeletePlaylistRequest'; export type { DeleteSubscriptionFileRequest } from './models/DeleteSubscriptionFileRequest'; @@ -22,17 +32,28 @@ export type { DownloadArchiveRequest } from './models/DownloadArchiveRequest'; export type { DownloadFileRequest } from './models/DownloadFileRequest'; export type { DownloadRequest } from './models/DownloadRequest'; export type { DownloadResponse } from './models/DownloadResponse'; +export type { DownloadTwitchChatByVODIDRequest } from './models/DownloadTwitchChatByVODIDRequest'; +export type { DownloadTwitchChatByVODIDResponse } from './models/DownloadTwitchChatByVODIDResponse'; export type { DownloadVideosForSubscriptionRequest } from './models/DownloadVideosForSubscriptionRequest'; export type { File } from './models/File'; export { FileType } from './models/FileType'; +export type { GenerateArgsResponse } from './models/GenerateArgsResponse'; export type { GenerateNewApiKeyResponse } from './models/GenerateNewApiKeyResponse'; +export type { GetAllCategoriesResponse } from './models/GetAllCategoriesResponse'; +export type { GetAllDownloadsRequest } from './models/GetAllDownloadsRequest'; export type { GetAllDownloadsResponse } from './models/GetAllDownloadsResponse'; export type { GetAllFilesResponse } from './models/GetAllFilesResponse'; export type { GetAllSubscriptionsResponse } from './models/GetAllSubscriptionsResponse'; export type { GetDownloadRequest } from './models/GetDownloadRequest'; export type { GetDownloadResponse } from './models/GetDownloadResponse'; +export type { GetFileFormatsRequest } from './models/GetFileFormatsRequest'; +export type { GetFileFormatsResponse } from './models/GetFileFormatsResponse'; export type { GetFileRequest } from './models/GetFileRequest'; export type { GetFileResponse } from './models/GetFileResponse'; +export type { GetFullTwitchChatRequest } from './models/GetFullTwitchChatRequest'; +export type { GetFullTwitchChatResponse } from './models/GetFullTwitchChatResponse'; +export type { GetLogsRequest } from './models/GetLogsRequest'; +export type { GetLogsResponse } from './models/GetLogsResponse'; export type { GetMp3sResponse } from './models/GetMp3sResponse'; export type { GetMp4sResponse } from './models/GetMp4sResponse'; export type { GetPlaylistRequest } from './models/GetPlaylistRequest'; @@ -43,6 +64,7 @@ export type { GetRolesResponse } from './models/GetRolesResponse'; export type { GetSubscriptionRequest } from './models/GetSubscriptionRequest'; export type { GetSubscriptionResponse } from './models/GetSubscriptionResponse'; export type { GetUsersResponse } from './models/GetUsersResponse'; +export type { IncrementViewCountRequest } from './models/IncrementViewCountRequest'; export type { inline_response_200_15 } from './models/inline_response_200_15'; export type { LoginRequest } from './models/LoginRequest'; export type { LoginResponse } from './models/LoginResponse'; @@ -56,12 +78,24 @@ export type { SubscribeResponse } from './models/SubscribeResponse'; export type { Subscription } from './models/Subscription'; export type { SubscriptionRequestData } from './models/SubscriptionRequestData'; export type { SuccessObject } from './models/SuccessObject'; +export type { TableInfo } from './models/TableInfo'; +export type { TestConnectionStringRequest } from './models/TestConnectionStringRequest'; +export type { TestConnectionStringResponse } from './models/TestConnectionStringResponse'; +export type { TransferDBRequest } from './models/TransferDBRequest'; +export type { TransferDBResponse } from './models/TransferDBResponse'; +export type { TwitchChatMessage } from './models/TwitchChatMessage'; export type { UnsubscribeRequest } from './models/UnsubscribeRequest'; export type { UnsubscribeResponse } from './models/UnsubscribeResponse'; +export type { UpdateCategoriesRequest } from './models/UpdateCategoriesRequest'; +export type { UpdateCategoryRequest } from './models/UpdateCategoryRequest'; +export type { UpdateConcurrentStreamRequest } from './models/UpdateConcurrentStreamRequest'; +export type { UpdateConcurrentStreamResponse } from './models/UpdateConcurrentStreamResponse'; export type { UpdatePlaylistRequest } from './models/UpdatePlaylistRequest'; export type { UpdaterStatus } from './models/UpdaterStatus'; export type { UpdateServerRequest } from './models/UpdateServerRequest'; export type { UpdateUserRequest } from './models/UpdateUserRequest'; export type { User } from './models/User'; export { UserPermission } from './models/UserPermission'; +export type { Version } from './models/Version'; +export type { VersionInfoResponse } from './models/VersionInfoResponse'; export { YesNo } from './models/YesNo'; diff --git a/src/api-types/models/AddFileToPlaylistRequest.ts b/src/api-types/models/AddFileToPlaylistRequest.ts new file mode 100644 index 0000000..b701175 --- /dev/null +++ b/src/api-types/models/AddFileToPlaylistRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface AddFileToPlaylistRequest { + file_uid: string; + playlist_id: string; +} \ No newline at end of file diff --git a/src/api-types/models/Category.ts b/src/api-types/models/Category.ts new file mode 100644 index 0000000..055a3d7 --- /dev/null +++ b/src/api-types/models/Category.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { CategoryRule } from './CategoryRule'; + +export interface Category { + name?: string; + uid?: string; + rules?: Array; + /** + * Overrides file output for downloaded files in category + */ + custom_output?: string; +} \ No newline at end of file diff --git a/src/api-types/models/CategoryRule.ts b/src/api-types/models/CategoryRule.ts new file mode 100644 index 0000000..9a8acb9 --- /dev/null +++ b/src/api-types/models/CategoryRule.ts @@ -0,0 +1,26 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface CategoryRule { + preceding_operator?: CategoryRule.preceding_operator; + comparator?: CategoryRule.comparator; +} + +export namespace CategoryRule { + + export enum preceding_operator { + OR = 'or', + AND = 'and', + } + + export enum comparator { + INCLUDES = 'includes', + NOT_INCLUDES = 'not_includes', + EQUALS = 'equals', + NOT_EQUALS = 'not_equals', + } + + +} \ No newline at end of file diff --git a/src/api-types/models/CheckConcurrentStreamRequest.ts b/src/api-types/models/CheckConcurrentStreamRequest.ts new file mode 100644 index 0000000..416ab37 --- /dev/null +++ b/src/api-types/models/CheckConcurrentStreamRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface CheckConcurrentStreamRequest { + /** + * UID of the concurrent stream + */ + uid: string; +} \ No newline at end of file diff --git a/src/api-types/models/CheckConcurrentStreamResponse.ts b/src/api-types/models/CheckConcurrentStreamResponse.ts new file mode 100644 index 0000000..bd4c70d --- /dev/null +++ b/src/api-types/models/CheckConcurrentStreamResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { ConcurrentStream } from './ConcurrentStream'; + +export interface CheckConcurrentStreamResponse { + stream: ConcurrentStream; +} \ No newline at end of file diff --git a/src/api-types/models/ConcurrentStream.ts b/src/api-types/models/ConcurrentStream.ts new file mode 100644 index 0000000..19eab7d --- /dev/null +++ b/src/api-types/models/ConcurrentStream.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface ConcurrentStream { + playback_timestamp?: number; + unix_timestamp?: number; + playing?: boolean; +} \ No newline at end of file diff --git a/src/api-types/models/CreateCategoryRequest.ts b/src/api-types/models/CreateCategoryRequest.ts new file mode 100644 index 0000000..0871041 --- /dev/null +++ b/src/api-types/models/CreateCategoryRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface CreateCategoryRequest { + name: string; +} \ No newline at end of file diff --git a/src/api-types/models/CreateCategoryResponse.ts b/src/api-types/models/CreateCategoryResponse.ts new file mode 100644 index 0000000..16efded --- /dev/null +++ b/src/api-types/models/CreateCategoryResponse.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Category } from './Category'; + +export interface CreateCategoryResponse { + new_category?: Category; + success?: boolean; +} \ No newline at end of file diff --git a/src/api-types/models/DBInfoResponse.ts b/src/api-types/models/DBInfoResponse.ts new file mode 100644 index 0000000..543f12b --- /dev/null +++ b/src/api-types/models/DBInfoResponse.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { TableInfo } from './TableInfo'; + +export interface DBInfoResponse { + using_local_db?: boolean; + stats_by_table?: { +files?: TableInfo, +playlists?: TableInfo, +categories?: TableInfo, +subscriptions?: TableInfo, +users?: TableInfo, +roles?: TableInfo, +download_queue?: TableInfo, +}; +} \ No newline at end of file diff --git a/src/api-types/models/DeleteCategoryRequest.ts b/src/api-types/models/DeleteCategoryRequest.ts new file mode 100644 index 0000000..37db8d5 --- /dev/null +++ b/src/api-types/models/DeleteCategoryRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface DeleteCategoryRequest { + category_uid: string; +} \ No newline at end of file diff --git a/src/api-types/models/DownloadFileRequest.ts b/src/api-types/models/DownloadFileRequest.ts index 0bee9d2..0986e59 100644 --- a/src/api-types/models/DownloadFileRequest.ts +++ b/src/api-types/models/DownloadFileRequest.ts @@ -4,11 +4,8 @@ export interface DownloadFileRequest { - uid: string; + uid?: string; uuid?: string; sub_id?: string; - /** - * Only used for subscriptions - */ - is_playlist?: boolean; + playlist_id?: string; } \ No newline at end of file diff --git a/src/api-types/models/DownloadTwitchChatByVODIDRequest.ts b/src/api-types/models/DownloadTwitchChatByVODIDRequest.ts new file mode 100644 index 0000000..01ff2c5 --- /dev/null +++ b/src/api-types/models/DownloadTwitchChatByVODIDRequest.ts @@ -0,0 +1,26 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; +import { Subscription } from './Subscription'; + +export interface DownloadTwitchChatByVODIDRequest { + /** + * File ID + */ + id: string; + /** + * ID of the VOD + */ + vodId: string; + type: FileType; + /** + * User UID + */ + uuid?: string; + /** + * Subscription + */ + sub?: Subscription; +} \ No newline at end of file diff --git a/src/api-types/models/DownloadTwitchChatByVODIDResponse.ts b/src/api-types/models/DownloadTwitchChatByVODIDResponse.ts new file mode 100644 index 0000000..9771759 --- /dev/null +++ b/src/api-types/models/DownloadTwitchChatByVODIDResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { TwitchChatMessage } from './TwitchChatMessage'; + +export interface DownloadTwitchChatByVODIDResponse { + chat: Array; +} \ No newline at end of file diff --git a/src/api-types/models/GenerateArgsResponse.ts b/src/api-types/models/GenerateArgsResponse.ts new file mode 100644 index 0000000..953a57c --- /dev/null +++ b/src/api-types/models/GenerateArgsResponse.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GenerateArgsResponse { + args?: Array; +} \ No newline at end of file diff --git a/src/api-types/models/GetAllCategoriesResponse.ts b/src/api-types/models/GetAllCategoriesResponse.ts new file mode 100644 index 0000000..e34671d --- /dev/null +++ b/src/api-types/models/GetAllCategoriesResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Category } from './Category'; + +export interface GetAllCategoriesResponse { + categories: Array; +} \ No newline at end of file diff --git a/src/api-types/models/GetAllDownloadsRequest.ts b/src/api-types/models/GetAllDownloadsRequest.ts new file mode 100644 index 0000000..5d26f57 --- /dev/null +++ b/src/api-types/models/GetAllDownloadsRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetAllDownloadsRequest { + /** + * Filters downloads with the array + */ + uids?: Array | null; +} \ No newline at end of file diff --git a/src/api-types/models/GetFileFormatsRequest.ts b/src/api-types/models/GetFileFormatsRequest.ts new file mode 100644 index 0000000..1ea3502 --- /dev/null +++ b/src/api-types/models/GetFileFormatsRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetFileFormatsRequest { + url?: string; +} \ No newline at end of file diff --git a/src/api-types/models/GetFileFormatsResponse.ts b/src/api-types/models/GetFileFormatsResponse.ts new file mode 100644 index 0000000..dc0f859 --- /dev/null +++ b/src/api-types/models/GetFileFormatsResponse.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { File } from './File'; + +export interface GetFileFormatsResponse { + success: boolean; + result: { +formats?: Array, +}; +} \ No newline at end of file diff --git a/src/api-types/models/GetFullTwitchChatRequest.ts b/src/api-types/models/GetFullTwitchChatRequest.ts new file mode 100644 index 0000000..6d6a3a6 --- /dev/null +++ b/src/api-types/models/GetFullTwitchChatRequest.ts @@ -0,0 +1,22 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; +import { Subscription } from './Subscription'; + +export interface GetFullTwitchChatRequest { + /** + * File ID + */ + id: string; + type: FileType; + /** + * User UID + */ + uuid?: string; + /** + * Subscription + */ + sub?: Subscription; +} \ No newline at end of file diff --git a/src/api-types/models/GetFullTwitchChatResponse.ts b/src/api-types/models/GetFullTwitchChatResponse.ts new file mode 100644 index 0000000..3bd27f7 --- /dev/null +++ b/src/api-types/models/GetFullTwitchChatResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetFullTwitchChatResponse { + success: boolean; + error?: string; +} \ No newline at end of file diff --git a/src/api-types/models/GetLogsRequest.ts b/src/api-types/models/GetLogsRequest.ts new file mode 100644 index 0000000..170ce8b --- /dev/null +++ b/src/api-types/models/GetLogsRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetLogsRequest { + lines?: number; +} \ No newline at end of file diff --git a/src/api-types/models/GetLogsResponse.ts b/src/api-types/models/GetLogsResponse.ts new file mode 100644 index 0000000..2acf83a --- /dev/null +++ b/src/api-types/models/GetLogsResponse.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetLogsResponse { + /** + * Number of lines to retrieve from the bottom + */ + logs?: string; + success?: boolean; +} \ No newline at end of file diff --git a/src/api-types/models/IncrementViewCountRequest.ts b/src/api-types/models/IncrementViewCountRequest.ts new file mode 100644 index 0000000..1294d10 --- /dev/null +++ b/src/api-types/models/IncrementViewCountRequest.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface IncrementViewCountRequest { + file_uid: string; + sub_id?: string; + /** + * User UID + */ + uuid?: string; +} \ No newline at end of file diff --git a/src/api-types/models/TableInfo.ts b/src/api-types/models/TableInfo.ts new file mode 100644 index 0000000..244c1a9 --- /dev/null +++ b/src/api-types/models/TableInfo.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface TableInfo { + records_count?: number; +} \ No newline at end of file diff --git a/src/api-types/models/TestConnectionStringRequest.ts b/src/api-types/models/TestConnectionStringRequest.ts new file mode 100644 index 0000000..156c01f --- /dev/null +++ b/src/api-types/models/TestConnectionStringRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface TestConnectionStringRequest { + /** + * MongoDB connection string + */ + connection_string: string; +} \ No newline at end of file diff --git a/src/api-types/models/TestConnectionStringResponse.ts b/src/api-types/models/TestConnectionStringResponse.ts new file mode 100644 index 0000000..0cd0573 --- /dev/null +++ b/src/api-types/models/TestConnectionStringResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface TestConnectionStringResponse { + success: boolean; + error?: string; +} \ No newline at end of file diff --git a/src/api-types/models/TransferDBRequest.ts b/src/api-types/models/TransferDBRequest.ts new file mode 100644 index 0000000..fd14f56 --- /dev/null +++ b/src/api-types/models/TransferDBRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface TransferDBRequest { + /** + * True if transfering DB from Local to MongoDB, false if transferring DB from MongoDB to Local + */ + local_to_remote: boolean; +} \ No newline at end of file diff --git a/src/api-types/models/TransferDBResponse.ts b/src/api-types/models/TransferDBResponse.ts new file mode 100644 index 0000000..d8cc1c5 --- /dev/null +++ b/src/api-types/models/TransferDBResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface TransferDBResponse { + success: boolean; + error?: string; +} \ No newline at end of file diff --git a/src/api-types/models/TwitchChatMessage.ts b/src/api-types/models/TwitchChatMessage.ts new file mode 100644 index 0000000..76da85f --- /dev/null +++ b/src/api-types/models/TwitchChatMessage.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface TwitchChatMessage { + created_at?: string; + content_offset_seconds?: number; + commenter?: { +name?: string, +_id?: string, +created_at?: string, +}; + message?: { +body?: string, +user_color?: string, +}; +} \ No newline at end of file diff --git a/src/api-types/models/UpdateCategoriesRequest.ts b/src/api-types/models/UpdateCategoriesRequest.ts new file mode 100644 index 0000000..cbb3436 --- /dev/null +++ b/src/api-types/models/UpdateCategoriesRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Category } from './Category'; + +export interface UpdateCategoriesRequest { + categories: Array; +} \ No newline at end of file diff --git a/src/api-types/models/UpdateCategoryRequest.ts b/src/api-types/models/UpdateCategoryRequest.ts new file mode 100644 index 0000000..273bde1 --- /dev/null +++ b/src/api-types/models/UpdateCategoryRequest.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Category } from './Category'; + +export interface UpdateCategoryRequest { + category: Category; +} \ No newline at end of file diff --git a/src/api-types/models/UpdateConcurrentStreamRequest.ts b/src/api-types/models/UpdateConcurrentStreamRequest.ts new file mode 100644 index 0000000..2a8f9e4 --- /dev/null +++ b/src/api-types/models/UpdateConcurrentStreamRequest.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { ConcurrentStream } from './ConcurrentStream'; + +export interface UpdateConcurrentStreamRequest extends ConcurrentStream { + /** + * Concurrent stream UID + */ + uid: string; +} \ No newline at end of file diff --git a/src/api-types/models/UpdateConcurrentStreamResponse.ts b/src/api-types/models/UpdateConcurrentStreamResponse.ts new file mode 100644 index 0000000..b1d32e8 --- /dev/null +++ b/src/api-types/models/UpdateConcurrentStreamResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { ConcurrentStream } from './ConcurrentStream'; + +export interface UpdateConcurrentStreamResponse { + stream: ConcurrentStream; +} \ No newline at end of file diff --git a/src/api-types/models/Version.ts b/src/api-types/models/Version.ts new file mode 100644 index 0000000..5049571 --- /dev/null +++ b/src/api-types/models/Version.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface Version { + type?: string; + tag?: string; + commit?: string; + date?: string; +} \ No newline at end of file diff --git a/src/api-types/models/VersionInfoResponse.ts b/src/api-types/models/VersionInfoResponse.ts new file mode 100644 index 0000000..369927b --- /dev/null +++ b/src/api-types/models/VersionInfoResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Version } from './Version'; + +export interface VersionInfoResponse { + version_info: Version; +} \ No newline at end of file diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 08906bd..69e5eb7 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -597,7 +597,7 @@ export class MainComponent implements OnInit { } } - this.postsService.generateArgs(this.url, type, (this.selectedQuality === '' ? null : this.selectedQuality), + this.postsService.generateArgs(this.url, type as FileType, (this.selectedQuality === '' ? null : this.selectedQuality), customQualityConfiguration, customArgs, additionalArgs, customOutput, youtubeUsername, youtubePassword, cropFileSettings).subscribe(res => { const simulated_args = res['args']; if (simulated_args) { diff --git a/src/app/posts.services.ts b/src/app/posts.services.ts index 56cc403..df2f069 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -61,6 +61,35 @@ import { UpdateUserRequest, UserPermission, YesNo, + GenerateArgsResponse, + GetPlaylistsRequest, + UpdateCategoryRequest, + UpdateCategoriesRequest, + DeleteCategoryRequest, + CreateCategoryRequest, + CreateCategoryResponse, + GetAllCategoriesResponse, + AddFileToPlaylistRequest, + IncrementViewCountRequest, + GetLogsRequest, + GetLogsResponse, + UpdateConcurrentStreamResponse, + UpdateConcurrentStreamRequest, + CheckConcurrentStreamRequest, + CheckConcurrentStreamResponse, + DownloadTwitchChatByVODIDRequest, + DownloadTwitchChatByVODIDResponse, + GetFullTwitchChatRequest, + GetFullTwitchChatResponse, + GetAllDownloadsRequest, + TestConnectionStringRequest, + TestConnectionStringResponse, + TransferDBRequest, + TransferDBResponse, + VersionInfoResponse, + DBInfoResponse, + GetFileFormatsRequest, + GetFileFormatsResponse, } from '../api-types'; import { isoLangs } from './settings/locales_list'; import { Title } from '@angular/platform-browser'; @@ -243,37 +272,40 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'downloadFile', body, this.httpOptions); } - generateArgs(url: string, type: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, additionalArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, cropFileSettings = null) { - return this.http.post(this.path + 'generateArgs', {url: url, - selectedHeight: selectedQuality, - customQualityConfiguration: customQualityConfiguration, - customArgs: customArgs, - additionalArgs: additionalArgs, - customOutput: customOutput, - youtubeUsername: youtubeUsername, - youtubePassword: youtubePassword, - type: type, - cropFileSettings: cropFileSettings}, this.httpOptions); + generateArgs(url: string, type: FileType, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, additionalArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, cropFileSettings = null) { + const body: DownloadRequest = {url: url, + selectedHeight: selectedQuality, + customQualityConfiguration: customQualityConfiguration, + customArgs: customArgs, + additionalArgs: additionalArgs, + customOutput: customOutput, + youtubeUsername: youtubeUsername, + youtubePassword: youtubePassword, + type: type, + cropFileSettings: cropFileSettings} + return this.http.post(this.path + 'generateArgs', body, this.httpOptions); } getDBInfo() { - return this.http.post(this.path + 'getDBInfo', {}, this.httpOptions); + return this.http.get(this.path + 'getDBInfo', this.httpOptions); } transferDB(local_to_remote) { - return this.http.post(this.path + 'transferDB', {local_to_remote: local_to_remote}, this.httpOptions); + const body: TransferDBRequest = {local_to_remote: local_to_remote}; + return this.http.post(this.path + 'transferDB', body, this.httpOptions); } - testConnectionString(connection_string) { - return this.http.post(this.path + 'testConnectionString', {connection_string: connection_string}, this.httpOptions); + testConnectionString(connection_string: string) { + const body: TestConnectionStringRequest = {connection_string: connection_string}; + return this.http.post(this.path + 'testConnectionString', body, this.httpOptions); } killAllDownloads() { - return this.http.post(this.path + 'killAllDownloads', {}, this.httpOptions); + return this.http.post(this.path + 'killAllDownloads', {}, this.httpOptions); } restartServer() { - return this.http.post(this.path + 'restartServer', {}, this.httpOptions); + return this.http.post(this.path + 'restartServer', {}, this.httpOptions); } loadNavItems() { @@ -319,54 +351,51 @@ export class PostsService implements CanActivate { return this.http.post(this.path + 'getAllFiles', {sort: sort, range: range, text_search: text_search, file_type_filter: file_type_filter}, this.httpOptions); } - downloadFileFromServer(uid: string, uuid: string = null, sub_id: string = null, is_playlist: boolean = null) { + downloadFileFromServer(uid: string, uuid: string = null, sub_id: string = null) { const body: DownloadFileRequest = { uid: uid, uuid: uuid, - sub_id: sub_id, - is_playlist: is_playlist + sub_id: sub_id }; return this.http.post(this.path + 'downloadFile', body, {responseType: 'blob', params: this.httpOptions.params}); } getFullTwitchChat(id, type, uuid = null, sub = null) { - return this.http.post(this.path + 'getFullTwitchChat', {id: id, type: type, uuid: uuid, sub: sub}, this.httpOptions); + const body: GetFullTwitchChatRequest = {id: id, type: type, uuid: uuid, sub: sub}; + return this.http.post(this.path + 'getFullTwitchChat', body, this.httpOptions); } downloadTwitchChat(id, type, vodId, uuid = null, sub = null) { - return this.http.post(this.path + 'downloadTwitchChatByVODID', {id: id, type: type, vodId: vodId, uuid: uuid, sub: sub}, this.httpOptions); + const body: DownloadTwitchChatByVODIDRequest = {id: id, type: type, vodId: vodId, uuid: uuid, sub: sub}; + return this.http.post(this.path + 'downloadTwitchChatByVODID', body, this.httpOptions); } downloadPlaylistFromServer(playlist_id, uuid = null) { - return this.http.post(this.path + 'downloadFileFromServer', { - uuid: uuid, - playlist_id: playlist_id - }, - {responseType: 'blob', params: this.httpOptions.params}); + const body: DownloadFileRequest = {uuid: uuid, playlist_id: playlist_id}; + return this.http.post(this.path + 'downloadFileFromServer', body, {responseType: 'blob', params: this.httpOptions.params}); } downloadSubFromServer(sub_id, uuid = null) { - return this.http.post(this.path + 'downloadFileFromServer', { - uuid: uuid, - sub_id: sub_id - }, - {responseType: 'blob', params: this.httpOptions.params}); + const body: DownloadFileRequest = {uuid: uuid, sub_id: sub_id}; + return this.http.post(this.path + 'downloadFileFromServer', body, {responseType: 'blob', params: this.httpOptions.params}); } checkConcurrentStream(uid) { - return this.http.post(this.path + 'checkConcurrentStream', {uid: uid}, this.httpOptions); + const body: CheckConcurrentStreamRequest = {uid: uid}; + return this.http.post(this.path + 'checkConcurrentStream', body, this.httpOptions); } updateConcurrentStream(uid, playback_timestamp, unix_timestamp, playing) { - return this.http.post(this.path + 'updateConcurrentStream', {uid: uid, - playback_timestamp: playback_timestamp, - unix_timestamp: unix_timestamp, - playing: playing}, this.httpOptions); + const body: UpdateConcurrentStreamRequest = {uid: uid, + playback_timestamp: playback_timestamp, + unix_timestamp: unix_timestamp, + playing: playing}; + return this.http.post(this.path + 'updateConcurrentStream', body, this.httpOptions); } uploadCookiesFile(fileFormData) { - return this.http.post(this.path + 'uploadCookies', fileFormData, this.httpOptions); + return this.http.post(this.path + 'uploadCookies', fileFormData, this.httpOptions); } downloadArchive(sub) { @@ -375,15 +404,17 @@ export class PostsService implements CanActivate { } getFileFormats(url) { - return this.http.post(this.path + 'getFileFormats', {url: url}, this.httpOptions); + const body: GetFileFormatsRequest = {url: url}; + return this.http.post(this.path + 'getFileFormats', body, this.httpOptions); } getLogs(lines = 50) { - return this.http.post(this.path + 'logs', {lines: lines}, this.httpOptions); + const body: GetLogsRequest = {lines: lines}; + return this.http.post(this.path + 'logs', body, this.httpOptions); } clearAllLogs() { - return this.http.post(this.path + 'clearAllLogs', {}, this.httpOptions); + return this.http.post(this.path + 'clearAllLogs', {}, this.httpOptions); } generateNewAPIKey() { @@ -415,11 +446,12 @@ export class PostsService implements CanActivate { } incrementViewCount(file_uid, sub_id, uuid) { - return this.http.post(this.path + 'incrementViewCount', {file_uid: file_uid, sub_id: sub_id, uuid: uuid}, this.httpOptions); + const body: IncrementViewCountRequest = {file_uid: file_uid, sub_id: sub_id, uuid: uuid}; + return this.http.post(this.path + 'incrementViewCount', body, this.httpOptions); } getPlaylists() { - return this.http.post(this.path + 'getPlaylists', {}, this.httpOptions); + return this.http.post(this.path + 'getPlaylists', {}, this.httpOptions); } updatePlaylist(playlist: Playlist) { @@ -439,31 +471,34 @@ export class PostsService implements CanActivate { } addFileToPlaylist(playlist_id, file_uid) { - return this.http.post(this.path + 'addFileToPlaylist', {playlist_id: playlist_id, - file_uid: file_uid}, - this.httpOptions); + const body: AddFileToPlaylistRequest = {playlist_id: playlist_id, file_uid: file_uid} + return this.http.post(this.path + 'addFileToPlaylist', body, this.httpOptions); } // categories getAllCategories() { - return this.http.post(this.path + 'getAllCategories', {}, this.httpOptions); + return this.http.post(this.path + 'getAllCategories', {}, this.httpOptions); } createCategory(name) { - return this.http.post(this.path + 'createCategory', {name: name}, this.httpOptions); + const body: CreateCategoryRequest = {name: name}; + return this.http.post(this.path + 'createCategory', body, this.httpOptions); } deleteCategory(category_uid) { - return this.http.post(this.path + 'deleteCategory', {category_uid: category_uid}, this.httpOptions); + const body: DeleteCategoryRequest = {category_uid: category_uid}; + return this.http.post(this.path + 'deleteCategory', body, this.httpOptions); } updateCategory(category) { - return this.http.post(this.path + 'updateCategory', {category: category}, this.httpOptions); + const body: UpdateCategoryRequest = {category: category}; + return this.http.post(this.path + 'updateCategory', body, this.httpOptions); } updateCategories(categories) { - return this.http.post(this.path + 'updateCategories', {categories: categories}, this.httpOptions); + const body: UpdateCategoriesRequest = {categories: categories}; + return this.http.post(this.path + 'updateCategories', body, this.httpOptions); } reloadCategories() { @@ -474,7 +509,7 @@ export class PostsService implements CanActivate { updateSubscription(subscription) { delete subscription['videos']; - return this.http.post(this.path + 'updateSubscription', {subscription: subscription}, this.httpOptions); + return this.http.post(this.path + 'updateSubscription', {subscription: subscription}, this.httpOptions); } unsubscribe(sub: SubscriptionRequestData, deleteMode = false) { @@ -498,7 +533,8 @@ export class PostsService implements CanActivate { } getCurrentDownloads(uids: Array = null) { - return this.http.post(this.path + 'downloads', {uids: uids}, this.httpOptions); + const body: GetAllDownloadsRequest = {uids: uids}; + return this.http.post(this.path + 'downloads', body, this.httpOptions); } getCurrentDownload(download_uid: string) { @@ -507,39 +543,39 @@ export class PostsService implements CanActivate { } pauseDownload(download_uid) { - return this.http.post(this.path + 'pauseDownload', {download_uid: download_uid}, this.httpOptions); + return this.http.post(this.path + 'pauseDownload', {download_uid: download_uid}, this.httpOptions); } pauseAllDownloads() { - return this.http.post(this.path + 'pauseAllDownloads', {}, this.httpOptions); + return this.http.post(this.path + 'pauseAllDownloads', {}, this.httpOptions); } resumeDownload(download_uid) { - return this.http.post(this.path + 'resumeDownload', {download_uid: download_uid}, this.httpOptions); + return this.http.post(this.path + 'resumeDownload', {download_uid: download_uid}, this.httpOptions); } resumeAllDownloads() { - return this.http.post(this.path + 'resumeAllDownloads', {}, this.httpOptions); + return this.http.post(this.path + 'resumeAllDownloads', {}, this.httpOptions); } restartDownload(download_uid) { - return this.http.post(this.path + 'restartDownload', {download_uid: download_uid}, this.httpOptions); + return this.http.post(this.path + 'restartDownload', {download_uid: download_uid}, this.httpOptions); } cancelDownload(download_uid) { - return this.http.post(this.path + 'cancelDownload', {download_uid: download_uid}, this.httpOptions); + return this.http.post(this.path + 'cancelDownload', {download_uid: download_uid}, this.httpOptions); } clearDownload(download_uid) { - return this.http.post(this.path + 'clearDownload', {download_uid: download_uid}, this.httpOptions); + return this.http.post(this.path + 'clearDownload', {download_uid: download_uid}, this.httpOptions); } clearFinishedDownloads() { - return this.http.post(this.path + 'clearFinishedDownloads', {}, this.httpOptions); + return this.http.post(this.path + 'clearFinishedDownloads', {}, this.httpOptions); } getVersionInfo() { - return this.http.get(this.path + 'versionInfo', this.httpOptions); + return this.http.get(this.path + 'versionInfo', this.httpOptions); } updateServer(tag: string) {