mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 17:36:18 -05:00
Only fetching headlines if requested to speed up RPi responses.g
This commit is contained in:
parent
8faac3f3a1
commit
bba6a341b7
12 changed files with 80 additions and 38 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import {API_URI, ARCHIVES_API, DEFAULT_LIMIT, emptyToNull, OTP_API, VIDEOS_API} from "./components/Common";
|
||||
import {toast} from "react-semantic-toasts-2";
|
||||
import {computeHeadingLevel} from "@testing-library/react";
|
||||
|
||||
function timeoutPromise(ms, promise) {
|
||||
// Create a timeout wrapper around a promise. If the timeout is reached, throw an error. Otherwise, return
|
||||
|
|
@ -103,7 +104,7 @@ export async function getChannel(id) {
|
|||
return (await response.json())['channel'];
|
||||
}
|
||||
|
||||
export async function searchVideos(offset, limit, channelId, searchStr, order_by, tagNames) {
|
||||
export async function searchVideos(offset, limit, channelId, searchStr, order_by, tagNames, headline) {
|
||||
// Build a search query to retrieve a list of videos from the API
|
||||
offset = parseInt(offset || 0);
|
||||
limit = parseInt(limit || DEFAULT_LIMIT);
|
||||
|
|
@ -118,6 +119,9 @@ export async function searchVideos(offset, limit, channelId, searchStr, order_by
|
|||
if (tagNames) {
|
||||
body['tag_names'] = tagNames;
|
||||
}
|
||||
if (headline) {
|
||||
body['headline'] = true;
|
||||
}
|
||||
|
||||
console.debug('searching videos', body);
|
||||
|
||||
|
|
@ -350,7 +354,7 @@ export async function deleteArchives(archiveIds) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function searchArchives(offset, limit, domain, searchStr, order, tagNames) {
|
||||
export async function searchArchives(offset, limit, domain, searchStr, order, tagNames, headline) {
|
||||
// Build a search query to retrieve a list of videos from the API
|
||||
offset = parseInt(offset || 0);
|
||||
limit = parseInt(limit || DEFAULT_LIMIT);
|
||||
|
|
@ -367,6 +371,9 @@ export async function searchArchives(offset, limit, domain, searchStr, order, ta
|
|||
if (tagNames) {
|
||||
body['tag_names'] = tagNames;
|
||||
}
|
||||
if (headline) {
|
||||
body['headline'] = true;
|
||||
}
|
||||
|
||||
console.debug('searching archives', body);
|
||||
let response = await apiPost(`${ARCHIVES_API}/search`, body);
|
||||
|
|
@ -479,7 +486,7 @@ export async function deleteDownload(downloadId) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function filesSearch(offset, limit, searchStr, mimetypes, model, tagNames) {
|
||||
export async function filesSearch(offset, limit, searchStr, mimetypes, model, tagNames, headline) {
|
||||
const body = {search_str: searchStr, offset: parseInt(offset), limit: parseInt(limit)};
|
||||
if (mimetypes) {
|
||||
body['mimetypes'] = mimetypes;
|
||||
|
|
@ -490,6 +497,9 @@ export async function filesSearch(offset, limit, searchStr, mimetypes, model, ta
|
|||
if (tagNames) {
|
||||
body['tag_names'] = tagNames;
|
||||
}
|
||||
if (headline) {
|
||||
body['headline'] = true;
|
||||
}
|
||||
console.debug('searching files', body);
|
||||
const response = await apiPost(`${API_URI}/files/search`, body);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue