From 5b544dbbf644b5282741c216a436e334f32583c3 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 10 Aug 2025 15:41:57 +0000 Subject: [PATCH] sort upgrade for okporn --- src/api.rs | 23 ++++++++++++++++++++++- src/providers/okporn.rs | 7 ++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/api.rs b/src/api.rs index 7dcbe84..0136ecf 100644 --- a/src/api.rs +++ b/src/api.rs @@ -502,7 +502,28 @@ async fn status(req: HttpRequest) -> Result { favicon: "https://www.google.com/s2/favicons?sz=64&domain=ok.porn".to_string(), status: "active".to_string(), categories: vec![], - options: vec![], + options: vec![ChannelOption { + id: "sort".to_string(), + title: "Sort".to_string(), + description: "Sort the Videos".to_string(), //"Sort the videos by Date or Name.".to_string(), + systemImage: "list.number".to_string(), + colorName: "blue".to_string(), + options: vec![ + FilterOption { + id: "new".to_string(), + title: "New".to_string(), + }, + FilterOption { + id: "popular".to_string(), + title: "Popular".to_string(), + }, + FilterOption { + id: "trending".to_string(), + title: "Trending".to_string(), + }, + ], + multiSelect: false, + }], nsfw: true, }); diff --git a/src/providers/okporn.rs b/src/providers/okporn.rs index 354bca0..0ad075c 100644 --- a/src/providers/okporn.rs +++ b/src/providers/okporn.rs @@ -37,7 +37,12 @@ impl OkpornProvider { page: u8, sort: &str, ) -> Result> { - let video_url = format!("{}/{}/", self.url, page); + let sort_string = match sort { + "trending" => "/trending", + "popular" => "/popular", + _ => "", + }; + let video_url = format!("{}{}/{}/", self.url, sort_string, page); let old_items = match cache.get(&video_url) { Some((time, items)) => { if time.elapsed().unwrap_or_default().as_secs() < 60 * 5 {