mirror of
https://github.com/redlib-org/redlib.git
synced 2025-04-05 05:57:40 +03:00
fix: fix clippy + tests
This commit is contained in:
parent
257871b56c
commit
7930b19809
3 changed files with 5 additions and 23 deletions
|
@ -544,12 +544,6 @@ async fn test_obfuscated_share_link() {
|
|||
assert_eq!(canonical_path(share_link, 3).await, Ok(Some(canonical_link)));
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_share_link_strip_json() {
|
||||
let link = "/17krzvz".into();
|
||||
let canonical_link = "/comments/17krzvz".into();
|
||||
assert_eq!(canonical_path(link, 3).await, Ok(Some(canonical_link)));
|
||||
}
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn test_private_sub() {
|
||||
let link = json("/r/suicide/about.json?raw_json=1".into(), true).await;
|
||||
|
|
18
src/main.rs
18
src/main.rs
|
@ -108,20 +108,8 @@ async fn main() {
|
|||
let matches = Command::new("Redlib")
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.about("Private front-end for Reddit written in Rust ")
|
||||
.arg(
|
||||
Arg::new("ipv4-only")
|
||||
.short('4')
|
||||
.long("ipv4-only")
|
||||
.help("Listen on IPv4 only")
|
||||
.num_args(0),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("ipv6-only")
|
||||
.short('6')
|
||||
.long("ipv6-only")
|
||||
.help("Listen on IPv6 only")
|
||||
.num_args(0),
|
||||
)
|
||||
.arg(Arg::new("ipv4-only").short('4').long("ipv4-only").help("Listen on IPv4 only").num_args(0))
|
||||
.arg(Arg::new("ipv6-only").short('6').long("ipv6-only").help("Listen on IPv6 only").num_args(0))
|
||||
.arg(
|
||||
Arg::new("redirect-https")
|
||||
.short('r')
|
||||
|
@ -392,7 +380,7 @@ async fn main() {
|
|||
Some("best" | "hot" | "new" | "top" | "rising" | "controversial") => subreddit::community(req).await,
|
||||
|
||||
// Short link for post
|
||||
Some(id) if (5..8).contains(&id.len()) => match canonical_path(format!("/{id}"), 3).await {
|
||||
Some(id) if (5..8).contains(&id.len()) => match canonical_path(format!("/comments/{id}"), 3).await {
|
||||
Ok(path_opt) => match path_opt {
|
||||
Some(path) => Ok(redirect(&path)),
|
||||
None => error(req, "Post ID is invalid. It may point to a post on a community that has been banned.").await,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue