Skip to content

Commit

Permalink
update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jb-alvarado committed Jan 29, 2025
1 parent 6b0d72a commit e084b4a
Show file tree
Hide file tree
Showing 10 changed files with 348 additions and 385 deletions.
179 changes: 130 additions & 49 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ notify = "8.0"
notify-debouncer-full = { version = "*", default-features = false }
paris = "1.5"
path-clean = "1.0"
rand = "0.8"
rand = "0.9"
regex = "1"
relative-path = "1.8"
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
Expand Down
4 changes: 2 additions & 2 deletions engine/src/db/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use argon2::{
password_hash::{rand_core::OsRng, SaltString},
Argon2, PasswordHasher,
};
use rand::{distributions::Alphanumeric, Rng};
use rand::{distr::Alphanumeric, Rng};
use sqlx::{sqlite::SqliteQueryResult, Pool, Row, Sqlite};

use super::models::{AdvancedConfiguration, Configuration};
Expand All @@ -19,7 +19,7 @@ pub async fn db_migrate(conn: &Pool<Sqlite>) -> Result<(), ProcessError> {
sqlx::migrate!("../migrations").run(conn).await?;

if select_global(conn).await.is_err() {
let secret: String = rand::thread_rng()
let secret: String = rand::rng()
.sample_iter(&Alphanumeric)
.take(80)
.map(char::from)
Expand Down
4 changes: 2 additions & 2 deletions engine/src/file/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use actix_multipart::Multipart;
use futures_util::TryStreamExt as _;
use lexical_sort::{natural_lexical_cmp, PathSort};
use log::*;
use rand::{distributions::Alphanumeric, Rng};
use rand::{distr::Alphanumeric, Rng};
use tokio::{fs, io::AsyncWriteExt, sync::Mutex, task::JoinHandle};

use crate::file::{norm_abs_path, watcher::watch, MoveObject, PathObject, Storage, VideoFile};
Expand Down Expand Up @@ -229,7 +229,7 @@ impl Storage for LocalStorage {
while let Some(mut field) = data.try_next().await? {
let content_disposition = field.content_disposition().ok_or("No content")?;
debug!("{content_disposition}");
let rand_string: String = rand::thread_rng()
let rand_string: String = rand::rng()
.sample_iter(&Alphanumeric)
.take(20)
.map(char::from)
Expand Down
6 changes: 3 additions & 3 deletions engine/src/player/input/folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl FolderSource {

if config.storage.shuffle {
info!(target: Target::file_mail(), channel = id; "Shuffle files");
let mut rng = StdRng::from_entropy();
let mut rng = StdRng::from_os_rng();
media_list.shuffle(&mut rng);
} else {
media_list.sort_by(|d1, d2| d1.source.cmp(&d2.source));
Expand Down Expand Up @@ -95,7 +95,7 @@ impl FolderSource {
}

async fn shuffle(&mut self) {
let mut rng = StdRng::from_entropy();
let mut rng = StdRng::from_os_rng();
let mut nodes = self.manager.current_list.lock().await;

nodes.shuffle(&mut rng);
Expand Down Expand Up @@ -193,7 +193,7 @@ pub async fn fill_filler_list(
}

if config.storage.shuffle {
let mut rng = StdRng::from_entropy();
let mut rng = StdRng::from_os_rng();

filler_list.shuffle(&mut rng);
} else {
Expand Down
2 changes: 1 addition & 1 deletion engine/src/player/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ pub async fn validate_ffmpeg(config: &mut PlayoutConfig) -> Result<(), String> {
/// get a free tcp socket
pub fn gen_tcp_socket(exclude_socket: String) -> Option<String> {
for _ in 0..100 {
let port = rand::thread_rng().gen_range(45321..54268);
let port = rand::rng().random_range(45321..54268);
let socket = format!("127.0.0.1:{port}");

if socket != exclude_socket && TcpListener::bind(("127.0.0.1", port)).is_ok() {
Expand Down
6 changes: 3 additions & 3 deletions engine/src/utils/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use async_walkdir::WalkDir;
use chrono::Timelike;
use lexical_sort::{natural_lexical_cmp, StringSort};
use log::*;
use rand::{seq::SliceRandom, thread_rng, Rng};
use rand::{rng, seq::SliceRandom, Rng};
use tokio::fs;
use tokio_stream::StreamExt;

Expand All @@ -36,7 +36,7 @@ pub fn random_list(clip_list: Vec<Media>, total_length: f64) -> Vec<Media> {
let mut last_clip = Media::default();

while target_duration < total_length && max_attempts > 0 {
let index = rand::thread_rng().gen_range(0..clip_list_length);
let index = rand::rng().random_range(0..clip_list_length);
let selected_clip = clip_list[index].clone();
let selected_clip_count = randomized_clip_list
.iter()
Expand Down Expand Up @@ -126,7 +126,7 @@ pub async fn generate_from_template(
template: Template,
) -> FolderSource {
let mut media_list = vec![];
let mut rng = thread_rng();
let mut rng = rng();
let mut index: usize = 0;
let id = config.general.channel_id;

Expand Down
2 changes: 1 addition & 1 deletion engine/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ where
/// get a free tcp socket
pub async fn gen_tcp_socket(exclude_socket: &str) -> Option<String> {
for _ in 0..100 {
let port = rand::thread_rng().gen_range(45321..54268);
let port = rand::rng().random_range(45321..54268);
let socket = format!("127.0.0.1:{port}");

if socket != exclude_socket && TcpListener::bind(("127.0.0.1", port)).await.is_ok() {
Expand Down
Loading

0 comments on commit e084b4a

Please sign in to comment.