parent
4ce2a0ceaf
commit
847008825f
4 changed files with 7 additions and 11 deletions
|
@ -202,7 +202,7 @@ impl WebsiteArchive {
|
||||||
|
|
||||||
let path = parsed_url.path();
|
let path = parsed_url.path();
|
||||||
|
|
||||||
let mut folder_name = self.dir.join(&domain);
|
let mut folder_name = self.dir.join(domain);
|
||||||
|
|
||||||
if !std::fs::exists(&folder_name).unwrap() {
|
if !std::fs::exists(&folder_name).unwrap() {
|
||||||
download_fav_for(domain).await;
|
download_fav_for(domain).await;
|
||||||
|
@ -217,11 +217,11 @@ impl WebsiteArchive {
|
||||||
std::fs::create_dir_all(&folder_name).unwrap();
|
std::fs::create_dir_all(&folder_name).unwrap();
|
||||||
|
|
||||||
let timestamp = chrono::Utc::now().format("%Y-%m-%d").to_string();
|
let timestamp = chrono::Utc::now().format("%Y-%m-%d").to_string();
|
||||||
let filename = folder_name.join(&format!("index_{timestamp}.html"));
|
let filename = folder_name.join(format!("index_{timestamp}.html"));
|
||||||
|
|
||||||
log::info!("Archiving {url} to {}", filename.to_str().unwrap());
|
log::info!("Archiving {url} to {}", filename.to_str().unwrap());
|
||||||
|
|
||||||
run_command(&vec![
|
run_command(&[
|
||||||
"monolith",
|
"monolith",
|
||||||
"-I",
|
"-I",
|
||||||
"-o",
|
"-o",
|
||||||
|
@ -239,7 +239,7 @@ impl WebsiteArchive {
|
||||||
fn run_command(cmd: &[&str]) {
|
fn run_command(cmd: &[&str]) {
|
||||||
let mut cmd_setup = std::process::Command::new(cmd[0]);
|
let mut cmd_setup = std::process::Command::new(cmd[0]);
|
||||||
let cmd_setup = cmd_setup
|
let cmd_setup = cmd_setup
|
||||||
.args(cmd.into_iter().skip(1).collect::<Vec<_>>())
|
.args(cmd.iter().skip(1).collect::<Vec<_>>())
|
||||||
.stdout(std::process::Stdio::inherit())
|
.stdout(std::process::Stdio::inherit())
|
||||||
.stderr(std::process::Stdio::inherit());
|
.stderr(std::process::Stdio::inherit());
|
||||||
|
|
||||||
|
|
|
@ -14,5 +14,5 @@ pub fn check_blacklist(domain: &str) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ pub async fn download_favicon(domain: &str) -> Option<Vec<u8>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn download_fav_for(site: &str) {
|
pub async fn download_fav_for(site: &str) {
|
||||||
if let Some(fav) = download_favicon(&site).await {
|
if let Some(fav) = download_favicon(site).await {
|
||||||
std::fs::write(std::path::Path::new("./favicon").join(site), fav).unwrap();
|
std::fs::write(std::path::Path::new("./favicon").join(site), fav).unwrap();
|
||||||
log::info!("Writting favicon for {site}");
|
log::info!("Writting favicon for {site}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,11 +114,7 @@ pub async fn render_website(
|
||||||
let document = arc.get_domain(domain).path(path.to_str().unwrap());
|
let document = arc.get_domain(domain).path(path.to_str().unwrap());
|
||||||
|
|
||||||
let content = document
|
let content = document
|
||||||
.render_local(if time.is_some() {
|
.render_local(time.map(|time| time.to_string()))
|
||||||
Some(time.unwrap().to_string())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
})
|
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
if let Some(content) = content {
|
if let Some(content) = content {
|
||||||
|
|
Loading…
Add table
Reference in a new issue