add custom index
This commit is contained in:
parent
e4005b38ce
commit
0f35d34bcb
7 changed files with 291 additions and 268 deletions
15
src/proxy.rs
15
src/proxy.rs
|
@ -203,6 +203,21 @@ impl Mirror {
|
|||
None
|
||||
}
|
||||
|
||||
pub fn index_page(&self) -> Option<HttpResponse> {
|
||||
if let Some(index) = &self.config.index {
|
||||
return match index.as_str() {
|
||||
"no" => None,
|
||||
file => Some(
|
||||
HttpResponse::Ok()
|
||||
.content_type("text/html")
|
||||
.body(std::fs::read_to_string(file).unwrap()),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
/// Asynchronously fetches content from the specified URL and saves it to the provided file path.
|
||||
///
|
||||
/// This function sends an HTTP GET request to the URL specified by `path`, retrieves the response,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue