pmvhaven fix
This commit is contained in:
@@ -26,6 +26,7 @@ struct PmvhavenRequest {
|
|||||||
other: bool, // false,
|
other: bool, // false,
|
||||||
explicitContent: Option<bool>, //null,
|
explicitContent: Option<bool>, //null,
|
||||||
sameSexContent: Option<bool>, //null,
|
sameSexContent: Option<bool>, //null,
|
||||||
|
transContent: Option<String>, //null
|
||||||
seizureWarning: Option<bool>, //null,
|
seizureWarning: Option<bool>, //null,
|
||||||
tags: Vec<String>, //[],
|
tags: Vec<String>, //[],
|
||||||
music: Vec<String>, //[],
|
music: Vec<String>, //[],
|
||||||
@@ -37,7 +38,6 @@ struct PmvhavenRequest {
|
|||||||
aspectRatio: String, //"Aspect Ratio",
|
aspectRatio: String, //"Aspect Ratio",
|
||||||
activeView: String, //"Newest",
|
activeView: String, //"Newest",
|
||||||
index: u32, //2,
|
index: u32, //2,
|
||||||
hideUntagged: bool, //true,
|
|
||||||
showSubscriptionsOnly: bool, //false,
|
showSubscriptionsOnly: bool, //false,
|
||||||
query: String, //"no",
|
query: String, //"no",
|
||||||
profile: Option<String>, //null
|
profile: Option<String>, //null
|
||||||
@@ -55,6 +55,7 @@ impl PmvhavenRequest {
|
|||||||
other: false,
|
other: false,
|
||||||
explicitContent: None,
|
explicitContent: None,
|
||||||
sameSexContent: None,
|
sameSexContent: None,
|
||||||
|
transContent: None,
|
||||||
seizureWarning: None,
|
seizureWarning: None,
|
||||||
tags: vec![],
|
tags: vec![],
|
||||||
music: vec![],
|
music: vec![],
|
||||||
@@ -66,7 +67,6 @@ impl PmvhavenRequest {
|
|||||||
aspectRatio: "Aspect Ratio".to_string(),
|
aspectRatio: "Aspect Ratio".to_string(),
|
||||||
activeView: "Newest".to_string(),
|
activeView: "Newest".to_string(),
|
||||||
index: page,
|
index: page,
|
||||||
hideUntagged: true,
|
|
||||||
showSubscriptionsOnly: false,
|
showSubscriptionsOnly: false,
|
||||||
query: "no".to_string(),
|
query: "no".to_string(),
|
||||||
profile: None,
|
profile: None,
|
||||||
@@ -210,32 +210,8 @@ impl PmvhavenVideo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define a percent-encoding set that encodes all non-ASCII characters
|
|
||||||
// const EMOJI_ENCODE_SET: &AsciiSet = &CONTROLS
|
|
||||||
// .add(b' ')
|
|
||||||
// .add(b'"')
|
|
||||||
// .add(b'#')
|
|
||||||
// .add(b'%')
|
|
||||||
// .add(b'<')
|
|
||||||
// .add(b'>')
|
|
||||||
// .add(b'?')
|
|
||||||
// .add(b'[')
|
|
||||||
// .add(b'\\')
|
|
||||||
// .add(b']')
|
|
||||||
// .add(b'^')
|
|
||||||
// .add(b'`')
|
|
||||||
// .add(b'{')
|
|
||||||
// .add(b'|')
|
|
||||||
// .add(b'}');
|
|
||||||
//
|
|
||||||
// Helper function to percent-encode emojis and other non-ASCII chars
|
|
||||||
// fn percent_encode_emojis(s: &str) -> String {
|
|
||||||
// utf8_percent_encode(s, EMOJI_ENCODE_SET).to_string()
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
struct PmvhavenResponse {
|
struct PmvhavenResponse {
|
||||||
_httpStatusCode: Option<u32>,
|
|
||||||
data: Vec<PmvhavenVideo>,
|
data: Vec<PmvhavenVideo>,
|
||||||
_count: Option<u32>,
|
_count: Option<u32>,
|
||||||
}
|
}
|
||||||
@@ -311,7 +287,7 @@ impl PmvhavenProvider {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut requester = options.requester.clone().unwrap();
|
let mut requester = options.requester.clone().unwrap();
|
||||||
let response = requester.post(&url, &request).await.unwrap();
|
let response = requester.post(&url, &request, vec![("Content-Type".to_string(),"text/plain;charset=UTF-8".to_string())]).await.unwrap();
|
||||||
let videos = match response.json::<PmvhavenResponse>().await {
|
let videos = match response.json::<PmvhavenResponse>().await {
|
||||||
Ok(resp) => resp,
|
Ok(resp) => resp,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@@ -355,7 +331,7 @@ impl PmvhavenProvider {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut requester = options.requester.clone().unwrap();
|
let mut requester = options.requester.clone().unwrap();
|
||||||
let response = requester.post(&url, &request).await.unwrap();
|
let response = requester.post(&url, &request, vec![("Content-Type".to_string(),"text/plain;charset=UTF-8".to_string())]).await.unwrap();
|
||||||
let videos = match response.json::<PmvhavenResponse>().await {
|
let videos = match response.json::<PmvhavenResponse>().await {
|
||||||
Ok(resp) => resp,
|
Ok(resp) => resp,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ impl Requester {
|
|||||||
request.send().await
|
request.send().await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn post<S>(&mut self, url: &str, data: &S) -> Result<Response, wreq::Error>
|
pub async fn post<S>(&mut self, url: &str, data: &S, headers: Vec<(String, String)>) -> Result<Response, wreq::Error>
|
||||||
where
|
where
|
||||||
S: Serialize + ?Sized,
|
S: Serialize + ?Sized,
|
||||||
{
|
{
|
||||||
@@ -96,6 +96,11 @@ impl Requester {
|
|||||||
|
|
||||||
let mut request = client.post(url).version(Version::HTTP_11).json(data);
|
let mut request = client.post(url).version(Version::HTTP_11).json(data);
|
||||||
|
|
||||||
|
// Set custom headers
|
||||||
|
for (key, value) in headers.iter() {
|
||||||
|
request = request.header(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
if self.proxy {
|
if self.proxy {
|
||||||
if let Ok(proxy_url) = env::var("BURP_URL") {
|
if let Ok(proxy_url) = env::var("BURP_URL") {
|
||||||
let proxy = Proxy::all(&proxy_url).unwrap();
|
let proxy = Proxy::all(&proxy_url).unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user