Skip to content

Commit 9804a66

Browse files
committed
update rand
1 parent 436ca17 commit 9804a66

File tree

4 files changed

+72
-21
lines changed

4 files changed

+72
-21
lines changed

Cargo.lock

+68-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ markdown = { version = "1.0.0-alpha.15", features = ["log"] }
5252
password-hash = "0.5.0"
5353
argon2 = "0.5.0"
5454
actix-web-httpauth = "0.8.0"
55-
rand = "0.8.5"
55+
rand = "0.9.0"
5656
actix-multipart = "0.7.2"
5757
base64 = "0.22"
5858
rustls-acme = "0.9.2"

src/webserver/database/sqlpage_functions/functions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ pub(crate) async fn random_string(len: usize) -> anyhow::Result<String> {
356356

357357
/// Returns a random string of the specified length.
358358
pub(crate) fn random_string_sync(len: usize) -> String {
359-
use rand::{distributions::Alphanumeric, Rng};
360-
password_hash::rand_core::OsRng
359+
use rand::{distr::Alphanumeric, Rng};
360+
rand::rng()
361361
.sample_iter(&Alphanumeric)
362362
.take(len)
363363
.map(char::from)

src/webserver/http.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ fn anyhow_err_to_actix_resp(e: &anyhow::Error, env: app_config::DevOrProd) -> Ht
241241
resp.status(StatusCode::TOO_MANY_REQUESTS)
242242
.insert_header((
243243
header::RETRY_AFTER,
244-
header::HeaderValue::from(rand::thread_rng().gen_range(1..=15)),
244+
header::HeaderValue::from(rand::rng().random_range(1..=15)),
245245
))
246246
.body("The database is currently too busy to handle your request. Please try again later.\n\n".to_owned() + &body)
247247
} else {

0 commit comments

Comments
 (0)