feat: add search filter, refactor params
This commit is contained in:
parent
44e14a4ae0
commit
25de7d678a
24 changed files with 374 additions and 72 deletions
|
|
@ -1,5 +1,9 @@
|
|||
mod protobuf;
|
||||
|
||||
pub mod dictionary;
|
||||
|
||||
pub use protobuf::ProtoBuilder;
|
||||
|
||||
use std::{borrow::Borrow, collections::BTreeMap, str::FromStr};
|
||||
|
||||
use fancy_regex::Regex;
|
||||
|
|
@ -7,7 +11,7 @@ use once_cell::sync::Lazy;
|
|||
use rand::Rng;
|
||||
use url::Url;
|
||||
|
||||
use crate::{error::Error, error::Result, model::Language};
|
||||
use crate::{error::Error, error::Result, param::Language};
|
||||
|
||||
const CONTENT_PLAYBACK_NONCE_ALPHABET: &[u8; 64] =
|
||||
b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
||||
|
|
@ -57,6 +61,12 @@ pub fn url_to_params(url: &str) -> Result<(String, BTreeMap<String, String>)> {
|
|||
Ok((parsed_url.to_string(), url_params))
|
||||
}
|
||||
|
||||
pub fn urlencode(string: &str) -> String {
|
||||
url::form_urlencoded::Serializer::new(String::new())
|
||||
.append_key_only(string)
|
||||
.finish()
|
||||
}
|
||||
|
||||
/// Parse a string after removing all non-numeric characters
|
||||
pub fn parse_numeric<F>(string: &str) -> core::result::Result<F, F::Err>
|
||||
where
|
||||
|
|
|
|||
Reference in a new issue