This commit is contained in:
Simon
2025-06-04 07:35:55 +00:00
parent 8d5da3a4dc
commit 3150e57411
7 changed files with 105 additions and 12 deletions

View File

@@ -3,6 +3,7 @@ use ntex::web;
use ntex::web::HttpRequest;
use crate::providers::perverzija::PerverzijaProvider;
use crate::util::cache::VideoCache;
use crate::{providers::*, status::*, videos::*};
pub fn config(cfg: &mut web::ServiceConfig) {
@@ -163,6 +164,7 @@ async fn status(req: HttpRequest) -> Result<impl web::Responder, web::Error> {
async fn videos_post(
video_request: web::types::Json<Videos_Request>,
cache: web::types::State<VideoCache>
) -> Result<impl web::Responder, web::Error> {
let mut videos = Videos {
pageInfo: PageInfo {
@@ -198,7 +200,7 @@ async fn videos_post(
let featured = video_request.featured.as_deref().unwrap_or("all").to_string();
let provider = PerverzijaProvider::new();
let video_items = provider
.get_videos(channel, sort, query, page.to_string(), perPage.to_string(), featured)
.get_videos(cache.get_ref().clone(), channel, sort, query, page.to_string(), perPage.to_string(), featured)
.await;
videos.items = video_items.clone();
Ok(web::HttpResponse::Ok().json(&videos))