Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonjchen committed Jul 8, 2023
1 parent b5211c3 commit e7ba350
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use std::time::Duration;
use reqwest::Client;
use retrieval::{retrieve_wiki_sitemap_index, Content};
use rocket::futures::TryFutureExt;
use rocket::http::{ContentType, Status, Method};
use rocket::http::{ContentType, Method, Status};
use rocket::response::{content, status};
use rocket::response::{Redirect, Responder};
use rocket::{State, Route};
use rocket::route::{Handler, Outcome};
use rocket::{Route, State};

use crate::scraper::process_html;
use askama::Template;
Expand Down Expand Up @@ -163,7 +163,6 @@ async fn mirror_home<'a>(
repository: &'a str,
client: &State<Client>,
) -> Result<MirrorTemplate, MirrorError> {

mirror_page(account, repository, "Home", client).await
}

Expand Down Expand Up @@ -442,25 +441,24 @@ static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_P
fn rocket() -> _ {
// Mount front Page


let mut mirror_routes = routes![
mirror_home,
mirror_page_redirect_home,
mirror_page,
mirror_page_index
];
// Strip off trailing slashes on this route
mirror_routes.push(
Route::ranked(-20, Method::Get, "/<account>/<repository>/wiki/", RemoveSlashes)
);
mirror_routes.push(Route::ranked(
-20,
Method::Get,
"/<account>/<repository>/wiki/",
RemoveSlashes,
));

// Mount Mirror
rocket::build()
.register("/", catchers![not_found])
.mount(
"/m",
mirror_routes,
)
.mount("/m", mirror_routes)
.mount(
"/",
routes![
Expand Down

0 comments on commit e7ba350

Please sign in to comment.