From c17590ccb3e0d75c2543c16f55c8db6a04121972 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 9 Sep 2025 05:33:12 +0000 Subject: [PATCH] adapted cache duration --- src/api.rs | 40 ++++++++++++++++++++-------------------- src/status.rs | 3 ++- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/api.rs b/src/api.rs index e0fad08..d3802a4 100644 --- a/src/api.rs +++ b/src/api.rs @@ -160,7 +160,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); if clientversion >= ClientVersion::new(22, 101, "22e".to_string()) { // pmvhaven @@ -235,7 +235,7 @@ async fn status(req: HttpRequest) -> Result { }, ], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); } if clientversion >= ClientVersion::new(22, 97, "22a".to_string()) { @@ -306,7 +306,7 @@ async fn status(req: HttpRequest) -> Result { // }, ], nsfw: true, - cacheDuration: 1800, + cacheDuration: None, }); } @@ -369,7 +369,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: None, }); // status.add_channel(Channel { @@ -403,7 +403,7 @@ async fn status(req: HttpRequest) -> Result { // multiSelect: false, // }], // nsfw: true, - //cacheDuration: 1800, + //cacheDuration: Some(1800), // }); status.add_channel(Channel { @@ -445,7 +445,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); let files = fs::read_dir("./src/providers").unwrap(); @@ -481,7 +481,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: true, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // Redtube @@ -495,7 +495,7 @@ async fn status(req: HttpRequest) -> Result { categories: vec![], options: vec![], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // ok.porn @@ -530,7 +530,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // pornhat @@ -565,7 +565,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); //perfectgirls @@ -600,7 +600,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // okxxx @@ -635,7 +635,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // homoxxx @@ -670,7 +670,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // // hentaimoon @@ -705,7 +705,7 @@ async fn status(req: HttpRequest) -> Result { // multiSelect: false, // }], // nsfw: true, - // cacheDuration: 1800, + // cacheDuration: Some(1800), // }); // xxthots @@ -740,7 +740,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // porn00 @@ -775,7 +775,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // freshporno @@ -810,7 +810,7 @@ async fn status(req: HttpRequest) -> Result { multiSelect: false, }], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); // porn00 @@ -824,7 +824,7 @@ async fn status(req: HttpRequest) -> Result { // categories: vec![], // options: vec![], // nsfw: true, - // cacheDuration: 1800, + // cacheDuration: Some(1800), // }); //missav @@ -957,7 +957,7 @@ async fn status(req: HttpRequest) -> Result { }, ], nsfw: true, - cacheDuration: 1800, + cacheDuration: None, }); if clientversion >= ClientVersion::new(22, 105, "22i".to_string()) { @@ -1021,7 +1021,7 @@ async fn status(req: HttpRequest) -> Result { }, ], nsfw: true, - cacheDuration: 1800, + cacheDuration: Some(1800), }); } status.iconUrl = format!("http://{}/favicon.ico", host).to_string(); diff --git a/src/status.rs b/src/status.rs index 558a6c0..6247b82 100644 --- a/src/status.rs +++ b/src/status.rs @@ -18,7 +18,8 @@ pub struct Channel { pub categories: Vec, //[], pub options: Vec, pub nsfw: bool, //true - pub cacheDuration: u32, //Some(86400) + #[serde(skip_serializing_if = "Option::is_none")] + pub cacheDuration: Option, //Some(86400) } #[derive(serde::Serialize)]