Feature/censored videos (#65)

* Creating api endpoint to find censored videos.

* Videos can be filtered by censored status.

* Not deleting when there has not been a successful download.

* Search now has a different param order.

* Displaying correct header for videos page.

* Reworking FilterModal to be more universal.

* Using merge_output_format for preparing filename.

* Resetting attempts when user requests a download be started.

* Displaying video stem as title if no title is available.

Signed-off-by: Roland <roland@learningselfreliance.com>
This commit is contained in:
lrnselfreliance 2021-12-23 09:38:12 -07:00 • committed by Roland
parent ea2bf8530b
commit 02116bf2bc
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
15 changed files with 451 additions and 121 deletions

View file

@ -36,7 +36,7 @@ async function apiCall(url, method, body, ms = 10000) {
if (response.status === 403 && (await response.json())['code'] === 17) {
toast({
type: 'error',
title: 'WROL Mode is enabled!',
header: 'WROL Mode is enabled!',
description: 'This functionality is not enabled while WROL Mode is enabled!',
time: 5000,
});
@ -47,14 +47,14 @@ async function apiCall(url, method, body, ms = 10000) {
if (e.message === 'promise timeout') {
toast({
type: 'error',
title: 'Server failed to respond!',
header: 'Server failed to respond!',
description: 'Timeout while waiting for server response. See server logs.',
time: 5000,
});
} else {
toast({
type: 'error',
title: 'Error!',
header: 'Error!',
description: 'See client logs',
time: 5000,
});
@ -103,11 +103,11 @@ export async function getChannel(link) {
return (await response.json())['channel'];
}
export async function searchVideos(offset, limit, channel_link, searchStr, favorites, order_by) {
export async function searchVideos(offset, limit, channel_link, searchStr, order_by, filters) {
// Build a search query to retrieve a list of videos from the API
offset = offset || 0;
limit = limit || DEFAULT_LIMIT;
let body = {offset, limit, favorites: favorites};
let body = {offset, limit, filters};
if (searchStr) {
body.search_str = searchStr;
@ -138,7 +138,7 @@ export async function deleteVideo(video_id) {
if (data.code === 17) {
toast({
type: 'warning',
title: 'WROL Mode Enabled',
header: 'WROL Mode Enabled',
description: 'This cannot be done while WROL Mode is enabled.',
time: 5000,
});
@ -147,7 +147,7 @@ export async function deleteVideo(video_id) {
if (response.status !== 204) {
toast({
type: 'error',
title: 'Unexpected server response',
header: 'Unexpected server response',
description: 'Failed to delete video. See server logs.',
time: 5000,
});
@ -223,7 +223,7 @@ export async function encryptOTP(otp, plaintext) {
if (response.status !== 200) {
toast({
type: 'error',
title: 'Error!',
header: 'Error!',
description: 'Failed to encrypt OTP',
time: 5000,
});
@ -238,7 +238,7 @@ export async function decryptOTP(otp, ciphertext) {
if (response.status !== 200) {
toast({
type: 'error',
title: 'Error!',
header: 'Error!',
description: 'Failed to decrypt OTP',
time: 5000,
});