mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-11 18:32:24 +02:00
hls reverse proxy random token generation to avoid clashes
This commit is contained in:
Generated
+10
@@ -1503,6 +1503,7 @@ dependencies = [
|
||||
"tower-http",
|
||||
"unidecode",
|
||||
"url",
|
||||
"uuid",
|
||||
"vergen",
|
||||
"winapi",
|
||||
]
|
||||
@@ -2840,6 +2841,15 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
|
||||
dependencies = [
|
||||
"getrandom 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
|
||||
@@ -53,6 +53,7 @@ paste = "1.0"
|
||||
tempfile = "3.16"
|
||||
ruzstd = "0"
|
||||
filetime = "0.2"
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
#[cfg(target_os = "macos")]
|
||||
libc = "0"
|
||||
#[cfg(target_os = "windows")]
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
use crate::model::api_proxy::ProxyUserCredentials;
|
||||
use crate::model::config::TargetType;
|
||||
use crate::model::hls::HlsEntry;
|
||||
use crate::repository::storage::hash_string_as_hex;
|
||||
use std::collections::HashMap;
|
||||
use std::str;
|
||||
use tokio::time::Instant;
|
||||
use crate::utils::hash_utils::uuid_v4;
|
||||
use crate::utils::string_utils::replace_after_last_slash;
|
||||
|
||||
pub const HLS_PREFIX: &str = "hls";
|
||||
|
||||
pub fn rewrite_hls(base_url: &str, content: &str, hls_url: &str, virtual_id: u32, user: &ProxyUserCredentials,
|
||||
target_type: &TargetType, input_name: &str) -> (HlsEntry, String) {
|
||||
let token = hash_string_as_hex(hls_url);
|
||||
let token = uuid_v4();
|
||||
let username = &user.username;
|
||||
let password = &user.password;
|
||||
let mut chunk: u32 = 1;
|
||||
|
||||
@@ -21,4 +21,9 @@ pub fn generate_playlist_uuid(key: &str, provider_id: &str, item_type: PlaylistI
|
||||
}
|
||||
}
|
||||
hash_string(url)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn uuid_v4() -> String {
|
||||
uuid::Uuid::new_v4().to_string().replace("-", "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user