Compare commits

...

4 Commits

@ -27,7 +27,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
gnu_linux_armhf:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout the repository
uses: actions/checkout@v2
@ -60,7 +60,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
gnu_linux_aarch64:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout the repository
uses: actions/checkout@v2
@ -93,7 +93,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
gnu_linux_x86_64:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout the repository
uses: actions/checkout@v2

2
Cargo.lock generated

@ -830,7 +830,7 @@ dependencies = [
[[package]]
name = "monolith"
version = "2.8.0"
version = "2.8.1"
dependencies = [
"assert_cmd",
"atty",

@ -1,6 +1,6 @@
[package]
name = "monolith"
version = "2.8.0"
version = "2.8.1"
authors = [
"Sunshine <sunshine@uberspace.net>",
"Mahdi Robatipoor <mahdi.robatipoor@gmail.com>",

@ -143,6 +143,7 @@ cat index.html | monolith -aIiFfcMv -b https://original.site/ - > result.html
- `-E`: Save document using custom `encoding`
- `-f`: Omit frames
- `-F`: Exclude web fonts
- `-h`: Print help information
- `-i`: Remove images
- `-I`: Isolate the document
- `-j`: Exclude JavaScript

@ -1,4 +1,4 @@
use base64;
use base64::prelude::*;
use chrono::prelude::*;
use encoding_rs::Encoding;
use html5ever::interface::QualName;
@ -65,15 +65,15 @@ pub fn check_integrity(data: &[u8], integrity: &str) -> bool {
if integrity.starts_with("sha256-") {
let mut hasher = Sha256::new();
hasher.update(data);
base64::encode(hasher.finalize()) == integrity[7..]
BASE64_STANDARD.encode(hasher.finalize()) == integrity[7..]
} else if integrity.starts_with("sha384-") {
let mut hasher = Sha384::new();
hasher.update(data);
base64::encode(hasher.finalize()) == integrity[7..]
BASE64_STANDARD.encode(hasher.finalize()) == integrity[7..]
} else if integrity.starts_with("sha512-") {
let mut hasher = Sha512::new();
hasher.update(data);
base64::encode(hasher.finalize()) == integrity[7..]
BASE64_STANDARD.encode(hasher.finalize()) == integrity[7..]
} else {
false
}

@ -1,4 +1,4 @@
use base64;
use base64::prelude::*;
use percent_encoding::percent_decode_str;
use url::Url;
@ -33,7 +33,15 @@ pub fn create_data_url(media_type: &str, charset: &str, data: &[u8], final_asset
"".to_string()
};
data_url.set_path(format!("{}{};base64,{}", media_type, c, base64::encode(data)).as_str());
data_url.set_path(
format!(
"{}{};base64,{}",
media_type,
c,
BASE64_STANDARD.encode(data)
)
.as_str(),
);
data_url
}
@ -63,7 +71,7 @@ pub fn parse_data_url(url: &Url) -> (String, String, Vec<u8>) {
// Parse raw data into vector of bytes
let text: String = percent_decode_str(&data).decode_utf8_lossy().to_string();
let blob: Vec<u8> = if is_base64 {
base64::decode(&text).unwrap_or(vec![])
BASE64_STANDARD.decode(&text).unwrap_or(vec![])
} else {
text.as_bytes().to_vec()
};

Loading…
Cancel
Save