lavender.software/build_src/webring.rs

24 lines
637 B
Rust

use crate::*;
use ssri::{Algorithm, IntegrityOpts};
pub fn copy_webring(ctx: &BuildContext) -> Result<()> {
log_info("Copying webring…");
copy_dir_recursive(
ctx.source_dir.join("webring"),
ctx.output_dir.join("webring"),
)?;
log_info("Calculating webring integrity…");
let webring_content = ctx.read_bin("webring/webring-0.2.0.js")?;
let integrity = IntegrityOpts::new()
.algorithm(Algorithm::Sha512)
.algorithm(Algorithm::Sha1)
.chain(&webring_content)
.result();
ctx.write("webring/webring-0.2.0.js.integ.txt", integrity.to_string())?;
Ok(())
}