diff --git a/.gitignore b/.gitignore index c68b0f6..44fa9c2 100644 --- a/.gitignore +++ b/.gitignore @@ -66,4 +66,4 @@ backend/appdata/users.json backend/users/* backend/appdata/cookies.txt backend/public -src/assets/i18n/*.json \ No newline at end of file +src/assets/i18n/*.json diff --git a/Public API v1.yaml b/Public API v1.yaml index b57c386..35eaa47 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -6,32 +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/body' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/inline_response_200' - security: - - Auth query parameter: [] - /api/tomp4: + /api/downloadFile: post: tags: - downloader @@ -46,14 +21,37 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_1' + $ref: '#/components/schemas/DownloadRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_1' + $ref: '#/components/schemas/DownloadResponse' + '500': + 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: @@ -69,8 +67,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 +83,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 +113,16 @@ 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' + '401': + description: User is not authorized to view the file. security: - Auth query parameter: [] /api/enableSharing: @@ -122,14 +137,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_3' + $ref: '#/components/schemas/SharingToggle' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/disableSharing: @@ -144,14 +159,35 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_4' + $ref: '#/components/schemas/SharingToggle' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $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: @@ -165,14 +201,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: @@ -186,14 +222,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: @@ -207,14 +243,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: @@ -230,14 +266,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: @@ -251,14 +287,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/getSubscriptions: @@ -278,7 +314,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_11' + $ref: '#/components/schemas/GetAllSubscriptionsResponse' security: - Auth query parameter: [] /api/createPlaylist: @@ -292,14 +328,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: @@ -313,35 +349,35 @@ 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/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/deletePlaylist: @@ -355,14 +391,35 @@ 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/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: @@ -376,7 +433,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_14' + $ref: '#/components/schemas/DeleteMp3Mp4Request' responses: '200': description: OK @@ -387,7 +444,7 @@ paths: description: Whether the operation succeeded security: - Auth query parameter: [] - /api/downloadFile: + /api/downloadFileFromServer: post: tags: - files @@ -397,27 +454,25 @@ 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.' + '401': + description: User is not authorized to view the file. security: - Auth query parameter: [] /api/deleteFile: post: tags: - files - summary: Delete downloaded file (unused) + summary: Delete downloaded file operationId: post-api-deleteFile requestBody: content: application/json: schema: - $ref: '#/components/schemas/body_16' + $ref: '#/components/schemas/DeleteMp3Mp4Request' responses: '200': description: OK @@ -434,10 +489,12 @@ 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 + '404': + description: If the archive dir is not found, 404 is sent as a response security: - Auth query parameter: [] /api/updaterStatus: @@ -453,7 +510,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_14' + $ref: '#/components/schemas/UpdaterStatus' security: - Auth query parameter: [] /api/updateServer: @@ -467,14 +524,14 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_18' + $ref: '#/components/schemas/UpdateServerRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' security: - Auth query parameter: [] /api/isPinSet: @@ -493,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/inline_response_200_5' - 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/inline_response_200_5' - security: - - Auth query parameter: [] - description: '' /api/generateNewAPIKey: post: tags: @@ -548,7 +563,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_16' + $ref: '#/components/schemas/GenerateNewApiKeyResponse' security: - Auth query parameter: [] /api/deleteMp3: @@ -562,7 +577,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_21' + $ref: '#/components/schemas/DeleteMp3Mp4Request' responses: '200': description: OK @@ -585,7 +600,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_17' + $ref: '#/components/schemas/ConfigResponse' security: - Auth query parameter: [] /api/setConfig: @@ -597,18 +612,20 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/body_22' + $ref: '#/components/schemas/SetConfigRequest' responses: '200': description: OK content: application/json: schema: - $ref: '#/components/schemas/inline_response_200_5' + $ref: '#/components/schemas/SuccessObject' + '404': + description: Tried to save invalid config file. security: - Auth query parameter: [] /api/downloads: - get: + post: summary: Get info for all downloads tags: - downloader @@ -618,34 +635,13 @@ 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 - operationId: get-api-downloads + $ref: '#/components/schemas/GetAllDownloadsResponse' + 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: [] @@ -659,46 +655,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: @@ -715,35 +677,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: @@ -758,27 +698,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: @@ -790,21 +716,15 @@ paths: responses: '200': description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SuccessObject' requestBody: content: application/json: schema: - type: object - properties: - change_object: - type: object - properties: - 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: [] @@ -820,21 +740,13 @@ paths: content: application/json: schema: - type: object - properties: - success: - type: boolean + $ref: '#/components/schemas/SuccessObject' description: Deletes a user by its uid. requestBody: content: application/json: schema: - type: object - properties: - uid: - type: string - required: - - uid + $ref: '#/components/schemas/DeleteUserRequest' security: - Auth query parameter: [] tags: @@ -849,25 +761,7 @@ paths: content: application/json: schema: - type: object - properties: - roles: - type: object - properties: - admin: - type: object - properties: - permissions: - type: array - items: - type: string - user: - type: object - properties: - permissions: - type: array - items: - type: string + $ref: '#/components/schemas/GetRolesResponse' description: Gets the available roles and their permissions security: - Auth query parameter: [] @@ -883,10 +777,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: [] @@ -894,18 +785,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: @@ -918,26 +798,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: [] @@ -953,20 +819,337 @@ 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: [] 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: - body: + SuccessObject: + required: + - success + type: object + properties: + success: + type: boolean + FileType: + type: string + enum: + - audio + - video + CropFileSettings: + type: object + required: + - cropFileStart + - cropFileEnd + properties: + cropFileStart: + type: number + cropFileEnd: + type: number + Config: + required: + - YoutubeDLMaterial + type: object + properties: + YoutubeDLMaterial: + type: object + DownloadRequest: required: - url type: object @@ -975,64 +1158,78 @@ 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 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. youtubeUsername: type: string + description: Login with this account ID youtubePassword: type: string - inline_response_200: - 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 + description: Account password selectedHeight: type: string + description: Height of the video, if known example: '1080' - customArgs: + maxBitrate: type: string - customOutput: - type: string - youtubeUsername: - type: string - youtubePassword: - type: string - inline_response_200_1: - required: - - uid - - videopathEncoded + description: Specify ffmpeg/avconv audio quality + example: '160' + type: + $ref: '#/components/schemas/FileType' + cropFileSettings: + $ref: '#/components/schemas/CropFileSettings' + DownloadResponse: type: object properties: - uid: + download: + $ref: '#/components/schemas/Download' + nullable: true + GenerateArgsResponse: + type: object + properties: + args: + type: array + items: + type: string + GetDownloadRequest: + type: object + properties: + download_uid: type: string - file_names: - type: string - videopathEncoded: - type: string - inline_response_200_2: + required: + - download_uid + GetDownloadResponse: + type: object + properties: + 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: + downloads: + type: array + items: + $ref: '#/components/schemas/Download' + GetMp3sResponse: required: - mp3s - playlists @@ -1041,81 +1238,78 @@ 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 properties: uid: type: string - type: - type: string is_playlist: type: boolean - inline_response_200_5: - required: - - success - type: object - 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: + SubscribeRequest: required: + - name - url + - streamingOnly type: object properties: name: @@ -1124,48 +1318,34 @@ components: type: string timerange: type: string - streamingOnly: + audioOnly: type: boolean - inline_response_200_6: + customArgs: + type: string + customFileOutput: + type: string + maxQuality: + 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 @@ -1174,30 +1354,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 @@ -1205,50 +1362,44 @@ 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 + name: + type: string + description: Subscription name + 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 @@ -1256,10 +1407,10 @@ components: subscriptions: type: array items: - $ref: '#/components/schemas/inline_response_200_11_subscriptions' - body_10: + $ref: '#/components/schemas/Subscription' + CreatePlaylistRequest: required: - - fileNames + - uids - playlistName - thumbnailURL - type @@ -1267,35 +1418,38 @@ components: properties: playlistName: type: string - fileNames: + uids: type: array items: type: string type: - type: string + $ref: '#/components/schemas/FileType' thumbnailURL: type: string - inline_response_200_12: + 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 + - playlist_id type: object properties: - playlistID: + playlist_id: type: string type: + $ref: '#/components/schemas/FileType' + uuid: type: string - inline_response_200_13: + include_file_metadata: + type: boolean + GetPlaylistResponse: required: - playlist - success @@ -1303,93 +1457,66 @@ components: type: object properties: playlist: - $ref: '#/components/schemas/inline_response_200_2_playlists' + $ref: '#/components/schemas/Playlist' type: - type: string + $ref: '#/components/schemas/FileType' success: type: boolean - body_12: - required: - - fileNames - - playlistID - - type + GetPlaylistsRequest: type: object properties: - playlistID: - type: string - fileNames: + include_categories: + type: boolean + GetPlaylistsResponse: + required: + - playlists + type: object + properties: + playlists: type: array items: - type: string - type: - type: string - body_13: + $ref: '#/components/schemas/Playlist' + UpdatePlaylistRequest: required: - - playlistID + - playlist + type: object + properties: + playlist: + $ref: '#/components/schemas/Playlist' + DeletePlaylistRequest: + required: + - playlist_id - type type: object properties: - playlistID: + playlist_id: type: string type: - type: string - body_14: - required: - - uid + $ref: '#/components/schemas/FileType' + DownloadFileRequest: type: object properties: uid: type: string - body_15: - required: - - fileNames - - type - type: object - properties: - fileNames: - type: array - description: Array of 1 or more files to download - items: - type: string - zip_mode: - type: boolean - type: + uuid: type: string - outputName: + sub_id: type: string - fullPathProvided: + playlist_id: type: string - subscriptionName: - type: boolean - description: Only used for subscriptions - subscriptionPlaylist: - type: boolean - description: Only used for subscriptions - body_16: - required: - - fileName - - type - type: object - properties: - fileName: - type: string - type: - type: string - 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' - inline_response_200_14: + required: + - archive_dir + type: object + properties: + archive_dir: + type: string + UpdaterStatus: required: - details - updating @@ -1399,11 +1526,273 @@ components: type: boolean details: type: string - body_18: + error: + type: boolean + UpdateServerRequest: + required: + - tag type: object 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 @@ -1425,7 +1814,7 @@ components: properties: unhashed_pin: type: string - inline_response_200_16: + GenerateNewApiKeyResponse: required: - new_api_key type: object @@ -1433,31 +1822,33 @@ components: new_api_key: type: string example: 4241b401-7236-493e-92b5-b72696b9d853 - body_21: + DeleteMp3Mp4Request: required: - uid type: object properties: uid: type: string - inline_response_200_17: + blacklistMode: + type: boolean + 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 - inline_response_200_2_mp3s: + $ref: '#/components/schemas/Config' + DatabaseFile: required: - duration - id @@ -1497,17 +1888,20 @@ components: type: string sharingEnabled: type: boolean - inline_response_200_2_playlists: + Playlist: required: - - fileNames + - uids - id - name - thumbnailURL + - type + - registered + - duration type: object properties: name: type: string - fileNames: + uids: type: array items: type: string @@ -1515,125 +1909,121 @@ 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 + type: + $ref: '#/components/schemas/FileType' + registered: + type: number duration: type: number - url: - type: string - uploader: - type: string - size: - type: number - path: - type: string - upload_date: + user_uid: type: string + Download: + required: + - url + - type + - title + - type + - options + - uid + - step_index + - paused + - running + - finished_step + - percent_complete + - finished + - timestamp_start + type: object + properties: uid: type: string - sharingEnabled: - type: boolean - inline_response_200_6_new_sub: - required: - - id - - name - - url - type: object - properties: - name: + ui_uid: type: string + running: + type: boolean + finished: + type: boolean + paused: + type: boolean + finished_step: + type: boolean url: type: string - id: - type: string - streamingOnly: - type: boolean - timerange: - type: string - inline_response_200_9_subscription: - required: - - archive - - id - - isPlaylist - - name - - url - type: object - properties: - name: - 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: - type: string - 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: + type: string + step_index: + type: number + percent_complete: + type: number + timestamp_start: + type: number + error: + type: string + description: Error text, set if download fails. + nullable: true + user_uid: + type: string + sub_id: + type: string + sub_name: + type: string + 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: + type: string + url: + 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 + custom_args: + type: string + custom_output: + type: string + videos: + type: array + items: + type: object + User: title: user type: object properties: @@ -1668,7 +2058,7 @@ components: subscriptions: type: array items: - $ref: '#/components/schemas/inline_response_200_9_subscription' + $ref: '#/components/schemas/Subscription' created: type: number role: @@ -1676,17 +2066,233 @@ 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 + YesNo: + type: string + 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 + - new_value + type: object + properties: + permission: + $ref: '#/components/schemas/UserPermission' + new_value: + $ref: '#/components/schemas/YesNo' + 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 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/backend/app.js b/backend/app.js index 97a29df..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}); }); @@ -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/package-lock.json b/package-lock.json index eb800a3..10f4d52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9380,6 +9380,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", @@ -9885,6 +9955,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", @@ -13670,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/package.json b/package.json index d53043b..995c239 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,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", @@ -74,6 +76,7 @@ "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", + "openapi-typescript-codegen": "^0.4.11", "protractor": "~7.0.0", "ts-node": "~3.0.4", "tslint": "~6.1.0" diff --git a/src/api-types/index.ts b/src/api-types/index.ts new file mode 100644 index 0000000..c08044a --- /dev/null +++ b/src/api-types/index.ts @@ -0,0 +1,101 @@ +/* istanbul ignore file */ +/* 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'; +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 { 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'; +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'; +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'; +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 { 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/BaseChangePermissionsRequest.ts b/src/api-types/models/BaseChangePermissionsRequest.ts new file mode 100644 index 0000000..d548225 --- /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; +} \ 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/ChangeRolePermissionsRequest.ts b/src/api-types/models/ChangeRolePermissionsRequest.ts new file mode 100644 index 0000000..417c8ef --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/ChangeUserPermissionsRequest.ts b/src/api-types/models/ChangeUserPermissionsRequest.ts new file mode 100644 index 0000000..c74dc09 --- /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; +} \ 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/Config.ts b/src/api-types/models/Config.ts new file mode 100644 index 0000000..855217a --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/ConfigResponse.ts b/src/api-types/models/ConfigResponse.ts new file mode 100644 index 0000000..d3ff49a --- /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; +} \ 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/CreatePlaylistRequest.ts b/src/api-types/models/CreatePlaylistRequest.ts new file mode 100644 index 0000000..2fef41b --- /dev/null +++ b/src/api-types/models/CreatePlaylistRequest.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface CreatePlaylistRequest { + playlistName: string; + uids: Array; + type: FileType; + thumbnailURL: string; +} \ No newline at end of file diff --git a/src/api-types/models/CreatePlaylistResponse.ts b/src/api-types/models/CreatePlaylistResponse.ts new file mode 100644 index 0000000..4cac9cf --- /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; +} \ 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/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/DatabaseFile.ts b/src/api-types/models/DatabaseFile.ts new file mode 100644 index 0000000..b1a17c0 --- /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; +} \ 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/DeleteMp3Mp4Request.ts b/src/api-types/models/DeleteMp3Mp4Request.ts new file mode 100644 index 0000000..3202c4f --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/DeletePlaylistRequest.ts b/src/api-types/models/DeletePlaylistRequest.ts new file mode 100644 index 0000000..76f2f81 --- /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 { + 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 new file mode 100644 index 0000000..7a166a9 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/DeleteUserRequest.ts b/src/api-types/models/DeleteUserRequest.ts new file mode 100644 index 0000000..15a1d09 --- /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; +} \ No newline at end of file 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..d91dd00 --- /dev/null +++ b/src/api-types/models/Download.ts @@ -0,0 +1,26 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface Download { + uid: string; + ui_uid?: string; + running: boolean; + finished: boolean; + paused: boolean; + finished_step: boolean; + url: string; + type: string; + title: string; + step_index: number; + percent_complete: number; + timestamp_start: number; + /** + * Error text, set if download fails. + */ + 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 new file mode 100644 index 0000000..857910c --- /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, +}; +} \ No newline at end of file diff --git a/src/api-types/models/DownloadFileRequest.ts b/src/api-types/models/DownloadFileRequest.ts new file mode 100644 index 0000000..0986e59 --- /dev/null +++ b/src/api-types/models/DownloadFileRequest.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface DownloadFileRequest { + uid?: string; + uuid?: string; + sub_id?: string; + playlist_id?: string; +} \ 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/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/DownloadVideosForSubscriptionRequest.ts b/src/api-types/models/DownloadVideosForSubscriptionRequest.ts new file mode 100644 index 0000000..31d0c6d --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/File.ts b/src/api-types/models/File.ts new file mode 100644 index 0000000..5114e53 --- /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; +} \ No newline at end of file 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/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/GenerateNewApiKeyResponse.ts b/src/api-types/models/GenerateNewApiKeyResponse.ts new file mode 100644 index 0000000..378a642 --- /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; +} \ 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/GetAllDownloadsResponse.ts b/src/api-types/models/GetAllDownloadsResponse.ts new file mode 100644 index 0000000..5367f56 --- /dev/null +++ b/src/api-types/models/GetAllDownloadsResponse.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { Download } from './Download'; + +export interface GetAllDownloadsResponse { + downloads?: Array; +} \ No newline at end of file diff --git a/src/api-types/models/GetAllFilesResponse.ts b/src/api-types/models/GetAllFilesResponse.ts new file mode 100644 index 0000000..d067555 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/GetAllSubscriptionsResponse.ts b/src/api-types/models/GetAllSubscriptionsResponse.ts new file mode 100644 index 0000000..485d0cd --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/GetDownloadRequest.ts b/src/api-types/models/GetDownloadRequest.ts new file mode 100644 index 0000000..49f102a --- /dev/null +++ b/src/api-types/models/GetDownloadRequest.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface GetDownloadRequest { + 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 new file mode 100644 index 0000000..029e21f --- /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; +} \ 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/GetFileRequest.ts b/src/api-types/models/GetFileRequest.ts new file mode 100644 index 0000000..3bb14b1 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/GetFileResponse.ts b/src/api-types/models/GetFileResponse.ts new file mode 100644 index 0000000..df78e28 --- /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; +} \ 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/GetMp3sResponse.ts b/src/api-types/models/GetMp3sResponse.ts new file mode 100644 index 0000000..23a80d7 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/GetMp4sResponse.ts b/src/api-types/models/GetMp4sResponse.ts new file mode 100644 index 0000000..06e1f98 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/GetPlaylistRequest.ts b/src/api-types/models/GetPlaylistRequest.ts new file mode 100644 index 0000000..9a48a9b --- /dev/null +++ b/src/api-types/models/GetPlaylistRequest.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface GetPlaylistRequest { + 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 new file mode 100644 index 0000000..afe4184 --- /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; +} \ 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 new file mode 100644 index 0000000..2209ec4 --- /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, +}, +}; +} \ No newline at end of file diff --git a/src/api-types/models/GetSubscriptionRequest.ts b/src/api-types/models/GetSubscriptionRequest.ts new file mode 100644 index 0000000..c11c5fa --- /dev/null +++ b/src/api-types/models/GetSubscriptionRequest.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +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 new file mode 100644 index 0000000..0efb102 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/GetUsersResponse.ts b/src/api-types/models/GetUsersResponse.ts new file mode 100644 index 0000000..2f17953 --- /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; +} \ 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/LoginRequest.ts b/src/api-types/models/LoginRequest.ts new file mode 100644 index 0000000..2e99447 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/LoginResponse.ts b/src/api-types/models/LoginResponse.ts new file mode 100644 index 0000000..7f5c42d --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/Playlist.ts b/src/api-types/models/Playlist.ts new file mode 100644 index 0000000..7741f41 --- /dev/null +++ b/src/api-types/models/Playlist.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import { FileType } from './FileType'; + +export interface Playlist { + name: string; + 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 new file mode 100644 index 0000000..87b7f0f --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/RegisterResponse.ts b/src/api-types/models/RegisterResponse.ts new file mode 100644 index 0000000..5aaa76a --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/SetConfigRequest.ts b/src/api-types/models/SetConfigRequest.ts new file mode 100644 index 0000000..f307009 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/SharingToggle.ts b/src/api-types/models/SharingToggle.ts new file mode 100644 index 0000000..5acba30 --- /dev/null +++ b/src/api-types/models/SharingToggle.ts @@ -0,0 +1,9 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + + +export interface SharingToggle { + uid: string; + 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 new file mode 100644 index 0000000..2cca0df --- /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; + 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 new file mode 100644 index 0000000..a1f1331 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/Subscription.ts b/src/api-types/models/Subscription.ts new file mode 100644 index 0000000..1184827 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/SubscriptionRequestData.ts b/src/api-types/models/SubscriptionRequestData.ts new file mode 100644 index 0000000..056ff28 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/SuccessObject.ts b/src/api-types/models/SuccessObject.ts new file mode 100644 index 0000000..f59e3fa --- /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; +} \ 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/UnsubscribeRequest.ts b/src/api-types/models/UnsubscribeRequest.ts new file mode 100644 index 0000000..1ee72e3 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/UnsubscribeResponse.ts b/src/api-types/models/UnsubscribeResponse.ts new file mode 100644 index 0000000..1d43b7b --- /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; +} \ 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/UpdatePlaylistRequest.ts b/src/api-types/models/UpdatePlaylistRequest.ts new file mode 100644 index 0000000..38f98ac --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/UpdateServerRequest.ts b/src/api-types/models/UpdateServerRequest.ts new file mode 100644 index 0000000..8c616f6 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/UpdateUserRequest.ts b/src/api-types/models/UpdateUserRequest.ts new file mode 100644 index 0000000..19e32c8 --- /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, +}; +} \ No newline at end of file diff --git a/src/api-types/models/UpdaterStatus.ts b/src/api-types/models/UpdaterStatus.ts new file mode 100644 index 0000000..8db6a17 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/User.ts b/src/api-types/models/User.ts new file mode 100644 index 0000000..0568e06 --- /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; +} \ No newline at end of file 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/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/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..c7f8fb8 --- /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; +} \ No newline at end of file diff --git a/src/api-types/models/body_20.ts b/src/api-types/models/body_20.ts new file mode 100644 index 0000000..559ea14 --- /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; +} \ 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 new file mode 100644 index 0000000..7147a1e --- /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; +} \ 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/components/custom-playlists/custom-playlists.component.ts b/src/app/components/custom-playlists/custom-playlists.component.ts index 7193123..9654013 100644 --- a/src/app/components/custom-playlists/custom-playlists.component.ts +++ b/src/app/components/custom-playlists/custom-playlists.component.ts @@ -98,7 +98,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 2645424..76e297f 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, ViewChild } from '@angular/core'; import { PostsService } from 'app/posts.services'; import { Router } from '@angular/router'; +import { FileType } from '../../../api-types'; import { MatPaginator } from '@angular/material/paginator'; import { Subject } from 'rxjs'; import { distinctUntilChanged } from 'rxjs/operators'; @@ -227,7 +228,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.uid).subscribe(res => { @@ -239,7 +240,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; 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/dialogs/update-progress-dialog/update-progress-dialog.component.ts b/src/app/dialogs/update-progress-dialog/update-progress-dialog.component.ts index fe1fbf4..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,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { PostsService } from 'app/posts.services'; import { MatSnackBar } from '@angular/material/snack-bar'; +import { 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/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 6d57250..69e5eb7 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', @@ -57,7 +44,7 @@ export class MainComponent implements OnInit { cropFileStart = null; cropFileEnd = null; urlError = false; - path = ''; + path: string | string[] = ''; url = ''; exists = ''; percentDownloaded: number; @@ -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; } @@ -621,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/player/player.component.ts b/src/app/player/player.component.ts index 9be73f8..fb40ed1 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -6,6 +6,7 @@ import { MatDialog } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { ShareMediaDialogComponent } from '../dialogs/share-media-dialog/share-media-dialog.component'; +import { FileType } from '../../api-types'; import { TwitchChatComponent } from 'app/components/twitch-chat/twitch-chat.component'; import { VideoInfoDialogComponent } from 'app/dialogs/video-info-dialog/video-info-dialog.component'; @@ -37,7 +38,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { // params uids: string[]; - type: string; + type: FileType; playlist_id = null; // used for playlists (not subscription) uid = null; // used for non-subscription files (audio, video, playlist) subscription = null; @@ -156,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'; + 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 046db8e..df2f069 100644 --- a/src/app/posts.services.ts +++ b/src/app/posts.services.ts @@ -8,9 +8,89 @@ 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 { + ChangeRolePermissionsRequest, + ChangeUserPermissionsRequest, + ConfigResponse, + CreatePlaylistRequest, + CreatePlaylistResponse, + CropFileSettings, + DeleteMp3Mp4Request, + DeletePlaylistRequest, + DeleteSubscriptionFileRequest, + DeleteUserRequest, + DownloadArchiveRequest, + DownloadFileRequest, + FileType, + GenerateNewApiKeyResponse, + GetAllDownloadsResponse, + GetAllFilesResponse, + GetAllSubscriptionsResponse, + GetDownloadResponse, + GetDownloadRequest, + GetFileRequest, + GetFileResponse, + GetMp3sResponse, + GetMp4sResponse, + GetPlaylistRequest, + GetPlaylistResponse, + GetRolesResponse, + GetSubscriptionRequest, + GetSubscriptionResponse, + GetUsersResponse, + LoginRequest, + LoginResponse, + DownloadRequest, + DownloadResponse, + Playlist, + RegisterRequest, + RegisterResponse, + SetConfigRequest, + SharingToggle, + SubscribeRequest, + SubscribeResponse, + SubscriptionRequestData, + SuccessObject, + UpdaterStatus, + UnsubscribeRequest, + UnsubscribeResponse, + UpdatePlaylistRequest, + UpdateServerRequest, + 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'; @@ -27,7 +107,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; @@ -175,57 +257,62 @@ export class PostsService implements CanActivate { } // 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 = null) { - return this.http.post(this.path + 'downloadFile', {url: url, - selectedHeight: selectedQuality, - customQualityConfiguration: customQualityConfiguration, - customArgs: customArgs, - additionalArgs: additionalArgs, - customOutput: customOutput, - youtubeUsername: youtubeUsername, - youtubePassword: youtubePassword, - type: type, - cropFileSettings: cropFileSettings}, this.httpOptions); + // tslint:disable-next-line: max-line-length + 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, + customArgs: customArgs, + additionalArgs: additionalArgs, + customOutput: customOutput, + youtubeUsername: youtubeUsername, + youtubePassword: youtubePassword, + type: type, + cropFileSettings: cropFileSettings} + 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() { 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); } } @@ -238,161 +325,180 @@ 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, blacklistMode = false) { - return this.http.post(this.path + 'deleteFile', {uid: uid, blacklistMode: blacklistMode}, this.httpOptions); + const body: DeleteMp3Mp4Request = {uid: uid, blacklistMode: blacklistMode} + return this.http.post(this.path + 'deleteFile', body, this.httpOptions); } 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(sort, range, text_search, file_type_filter) { - return this.http.post(this.path + 'getAllFiles', {sort: sort, range: range, text_search: text_search, file_type_filter: file_type_filter}, this.httpOptions); + 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) { + const body: DownloadFileRequest = { + uid: uid, + uuid: uuid, + 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); - } - - downloadFileFromServer(uid, uuid = null, sub_id = null, is_playlist = null) { - return this.http.post(this.path + 'downloadFileFromServer', { - uid: uid, - uuid: uuid, - sub_id: sub_id, - is_playlist: is_playlist - }, - {responseType: 'blob', params: this.httpOptions.params}); + 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) { - 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}); } 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() { - return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions); + return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions); } - enableSharing(uid, is_playlist) { - return this.http.post(this.path + 'enableSharing', {uid: uid, is_playlist: is_playlist}, this.httpOptions); + 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, is_playlist) { - return this.http.post(this.path + 'disableSharing', {uid: uid, is_playlist: is_playlist}, this.httpOptions); + 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); + } + + createPlaylist(playlistName: string, uids: string[], type: FileType, thumbnailURL: string) { + const body: CreatePlaylistRequest = {playlistName: playlistName, + uids: uids, + type: type, + thumbnailURL: thumbnailURL}; + return this.http.post(this.path + 'createPlaylist', body, this.httpOptions); + } + + getPlaylist(playlist_id: string, uuid: string = null, include_file_metadata: boolean = false) { + const body: GetPlaylistRequest = {playlist_id: playlist_id, + include_file_metadata: include_file_metadata, uuid: uuid}; + return this.http.post(this.path + 'getPlaylist', body, this.httpOptions); } 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); - } - - createPlaylist(playlistName, uids, type, thumbnailURL) { - return this.http.post(this.path + 'createPlaylist', {playlistName: playlistName, - uids: uids, - type: type, - thumbnailURL: thumbnailURL}, this.httpOptions); - } - - getPlaylist(playlist_id, uuid = null, include_file_metadata = false) { - return this.http.post(this.path + 'getPlaylist', {playlist_id: playlist_id, - uuid: uuid, - include_file_metadata: include_file_metadata}, 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) { - 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); } + removePlaylist(playlist_id: string, type: FileType) { + const body: DeletePlaylistRequest = {playlist_id: playlist_id, type: type}; + return this.http.post(this.path + 'deletePlaylist', body, this.httpOptions); + } + + 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, + audioOnly: audioOnly, customArgs: customArgs, customFileOutput: customFileOutput}; + return this.http.post(this.path + 'subscribe', body, this.httpOptions); + } + addFileToPlaylist(playlist_id, file_uid) { - return this.http.post(this.path + 'addFileToPlaylist', {playlist_id: playlist_id, - file_uid: file_uid}, - this.httpOptions); - } - - removePlaylist(playlist_id, type) { - return this.http.post(this.path + 'deletePlaylist', {playlist_id: playlist_id, type: type}, 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() { @@ -401,87 +507,84 @@ export class PostsService implements CanActivate { }); } - createSubscription(url, name, timerange = null, streamingOnly = false, maxQuality = 'best', audioOnly = false, - customArgs = null, customFileOutput = null) { - return this.http.post(this.path + 'subscribe', {url: url, name: name, timerange: timerange, maxQuality: maxQuality, - streamingOnly: streamingOnly, audioOnly: audioOnly, customArgs: customArgs, - customFileOutput: customFileOutput}, this.httpOptions); - } - 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, deleteMode = false) { - delete sub['videos']; - 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) { - delete sub['videos']; - 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, name = null) { - return this.http.post(this.path + 'getSubscription', {id: id, name: name}, this.httpOptions); + getSubscription(id: string, name: string = null) { + const body: GetSubscriptionRequest = {id: id, name: name}; + return this.http.post(this.path + 'getSubscription', body, this.httpOptions); } getAllSubscriptions() { - return this.http.post(this.path + 'getSubscriptions', {}, this.httpOptions); + return this.http.post(this.path + 'getAllSubscriptions', {}, this.httpOptions); } - getCurrentDownloads(uids = null) { - return this.http.post(this.path + 'downloads', {uids: uids}, this.httpOptions); + getCurrentDownloads(uids: Array = null) { + const body: GetAllDownloadsRequest = {uids: uids}; + return this.http.post(this.path + 'downloads', body, this.httpOptions); } - getCurrentDownload(download_uid) { - return this.http.post(this.path + 'download', {download_uid: download_uid}, this.httpOptions); + getCurrentDownload(download_uid: string) { + const body: GetDownloadRequest = {download_uid: download_uid}; + return this.http.post(this.path + 'download', body, this.httpOptions); } 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) { - 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 @@ -513,9 +616,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 @@ -556,10 +659,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; } @@ -604,10 +708,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) { @@ -622,12 +727,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) { @@ -635,20 +742,22 @@ 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, 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); }