removed crate uuid

This commit is contained in:
euzu
2024-11-04 16:13:46 +01:00
parent 47f13b6e14
commit 09f3143189
4 changed files with 14 additions and 33 deletions
Generated
-30
View File
@@ -1469,7 +1469,6 @@ dependencies = [
"time",
"unidecode",
"url",
"uuid",
]
[[package]]
@@ -2288,12 +2287,6 @@ dependencies = [
"digest",
]
[[package]]
name = "sha1_smol"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
[[package]]
name = "sha2"
version = "0.10.8"
@@ -2685,29 +2678,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
dependencies = [
"getrandom",
"rand",
"sha1_smol",
"uuid-macro-internal",
]
[[package]]
name = "uuid-macro-internal"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b91f57fe13a38d0ce9e28a03463d8d3c2468ed03d75375110ec71d93b449a08"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "v_htmlescape"
version = "0.15.8"
-1
View File
@@ -43,7 +43,6 @@ log = "0.4"
env_logger = "0.11"
rustelebot = "0.3"
bincode = "1.3"
uuid = { version = "1", features = ["v4", "v5", "fast-rng", "macro-diagnostics"] }
rand = "0.8"
rpassword = "7.3"
flate2 = "1"
+2 -1
View File
@@ -11,6 +11,7 @@ use unidecode::unidecode;
use crate::model::api_proxy::{ApiProxyConfig, ApiProxyServerInfo, ProxyUserCredentials};
use crate::model::config::{Config, ConfigApi, ConfigRename, ConfigSort, ConfigTargetOptions, InputType, MessagingConfig, ProcessTargets, TargetOutput, VideoConfig, VideoDownloadConfig};
use crate::model::config::ProcessingOrder;
use crate::repository::storage::{hash_string_as_hex};
/// File-Download information.
#[derive(Clone)]
@@ -100,7 +101,7 @@ impl FileDownload {
file_path.to_str()?;
Some(FileDownload {
uuid: uuid::Uuid::new_v4().to_string(),
uuid: hash_string_as_hex(req_url),
file_dir,
file_path,
filename,
+12 -1
View File
@@ -1,5 +1,5 @@
use std::path::{Path, PathBuf};
use std::fmt::Write;
use crate::m3u_filter_error::{M3uFilterError, M3uFilterErrorKind};
use crate::model::config::{Config, ConfigInput};
use crate::utils::file_utils;
@@ -14,6 +14,17 @@ pub(crate) fn hash_string(url: &str) -> [u8; 32] {
hash.into() // convert to hash array
}
fn hex_encode(bytes: &[u8]) -> String {
bytes.iter().fold(String::new(), |mut output, b| {
let _ = write!(output, "{b:02X}");
output
})
}
pub(crate) fn hash_string_as_hex(url: &str) -> String {
hex_encode(&hash_string(url))
}
pub(in crate::repository) fn get_target_id_mapping_file(target_path: &Path) -> PathBuf {
target_path.join(PathBuf::from(FILE_ID_MAPPING))
}