4 Commits

Author SHA1 Message Date
Sunshine
73c0ceebd4 bump version number (2.8.0 -> 2.8.1) 2024-01-13 16:02:39 -10:00
Sunshine
727eae2e35 get rid of warnings related to new API of base64 crate 2024-01-13 15:57:26 -10:00
Sunshine
b7a38c9f4a Update README.md 2024-01-13 15:44:39 -10:00
vladislav doster
aa556094a4 fix: bump CD workflow runner to ubuntu-20.04
ubuntu-18.04 runners have been deprecated

https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job#choosing-github-hosted-runners
2024-01-13 15:10:23 -10:00
6 changed files with 21 additions and 12 deletions

View File

@@ -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
View File

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

View File

@@ -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>",

View File

@@ -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

View File

@@ -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
}

View File

@@ -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()
};