chore: update deps (#694)

This commit is contained in:
sigoden
2026-04-25 21:31:44 +08:00
committed by GitHub
parent 53ea692dd1
commit 30b2979d0a
4 changed files with 678 additions and 351 deletions
+5 -1
View File
@@ -9,6 +9,7 @@ use indexmap::IndexMap;
use lazy_static::lazy_static;
use md5::Context;
use sha2::{Digest, Sha256};
use sha_crypt::PasswordVerifier;
use std::{
collections::HashMap,
path::{Path, PathBuf},
@@ -427,7 +428,10 @@ pub fn check_auth(
}
if auth_pass.starts_with("$6$") {
if let Ok(()) = sha_crypt::sha512_check(pass, auth_pass) {
if sha_crypt::ShaCrypt::SHA512
.verify_password(pass.as_bytes(), auth_pass)
.is_ok()
{
return Some(());
}
} else if pass == auth_pass {
+4 -8
View File
@@ -1883,14 +1883,10 @@ async fn get_content_type(path: &Path) -> Result<String> {
let mime = mime_guess::from_path(path).first();
let is_text = content_inspector::inspect(&buffer).is_text();
let content_type = if is_text {
let mut detector = chardetng::EncodingDetector::new();
let mut detector = chardetng::EncodingDetector::new(chardetng::Iso2022JpDetection::Allow);
detector.feed(&buffer, buffer.len() < 1024);
let (enc, confident) = detector.guess_assess(None, true);
let charset = if confident {
format!("; charset={}", enc.name())
} else {
"".into()
};
let enc = detector.guess(None, chardetng::Utf8Detection::Allow);
let charset = format!("; charset={}", enc.name());
match mime {
Some(m) => format!("{m}{charset}"),
None => format!("text/plain{charset}"),
@@ -1934,7 +1930,7 @@ async fn sha256_file(path: &Path) -> Result<String> {
}
let result = hasher.finalize();
Ok(format!("{result:x}"))
Ok(hex::encode(result))
}
fn has_query_flag(query_params: &HashMap<String, String>, name: &str) -> bool {