Skip to content

Commit f491ce6

Browse files
committed
0.4.13
1 parent 8a51b9a commit f491ce6

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.4.13
2+
## Changes
3+
1. Default feature change.
4+
2. Dependency update.
5+
16
# 0.4.12
27
## Changes
38
1. Memory database support `ttl` function.

actix-cloud/Cargo.toml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "actix-cloud"
3-
version = "0.4.12"
3+
version = "0.4.13"
44
edition = "2021"
55
authors = ["MXWXZ <matrixwxz@gmail.com>"]
66
description = "Actix Cloud is an all-in-one web framework based on Actix Web."
@@ -23,15 +23,13 @@ default = [
2323
"config-yaml",
2424
"logger",
2525
"i18n",
26-
"redis",
2726
"request",
2827
"traceid",
2928
"state",
3029
"session",
3130
"csrf",
3231
"security",
3332
"response-json",
34-
"seaorm",
3533
]
3634
all = [
3735
"utils",
@@ -63,7 +61,7 @@ logger = [
6361
"dep:tracing",
6462
"dep:tracing-subscriber",
6563
"dep:colored",
66-
"serde_dep",
64+
"serde",
6765
"anyhow",
6866
"dep:futures",
6967
"tokio",
@@ -74,7 +72,7 @@ redis = ["dep:redis", "memorydb"]
7472
request = ["actix-web", "dep:futures", "chrono"]
7573
traceid = ["dep:tracing-actix-web"]
7674
state = ["anyhow", "actix-web", "chrono", "dep:parking_lot"]
77-
session = ["dep:actix-utils", "serde_dep", "memorydb", "actix-web", "dep:rand"]
75+
session = ["dep:actix-utils", "serde", "memorydb", "actix-web", "dep:rand"]
7876
csrf = [
7977
"dep:qstring",
8078
"dep:enum-as-inner",
@@ -92,15 +90,14 @@ response-build = [
9290
"dep:syn",
9391
"dep:prettyplease",
9492
]
95-
response-json = ["response", "serde_dep"]
93+
response-json = ["response", "serde"]
9694
seaorm = ["actix-cloud-codegen/seaorm"]
97-
serde = []
9895

9996
response = ["actix-web", "dep:futures", "anyhow"]
10097
router = ["actix-web", "anyhow", "async-trait", "dep:futures"]
10198
memorydb = ["dep:glob", "async-trait", "dep:parking_lot", "chrono", "anyhow"]
10299
config = ["dep:config"]
103-
serde_dep = ["dep:serde", "dep:serde_json", "dep:serde_with"]
100+
serde = ["dep:serde", "dep:serde_json", "dep:serde_with"]
104101
anyhow = ["dep:anyhow"]
105102
async-trait = ["dep:async-trait"]
106103
chrono = ["dep:chrono"]
@@ -109,7 +106,7 @@ actix-web = ["dep:actix-web"]
109106

110107
[dependencies]
111108
# utils
112-
rand = { version = "0.8", optional = true }
109+
rand = { version = "0.9", optional = true }
113110
anyhow = { version = "1.0", optional = true }
114111
hex = { version = "0.4", optional = true }
115112

@@ -129,7 +126,7 @@ tracing-subscriber = { version = "0.3", features = [
129126
"json",
130127
"parking_lot",
131128
], optional = true }
132-
colored = { version = "2.1", optional = true }
129+
colored = { version = "3.0", optional = true }
133130
futures = { version = "0.3", optional = true }
134131

135132
# tokio
@@ -151,10 +148,10 @@ async-trait = { version = "0.1", optional = true }
151148
# serde
152149
serde = { version = "1.0", features = ["derive"], optional = true }
153150
serde_json = { version = "1.0", optional = true }
154-
serde_with = { version = "3.11", optional = true }
151+
serde_with = { version = "3.12", optional = true }
155152

156153
# redis
157-
redis = { version = "0.27", features = [
154+
redis = { version = "0.31", features = [
158155
"tokio-rustls-comp",
159156
"connection-manager",
160157
], optional = true }
@@ -164,7 +161,7 @@ actix-utils = { version = "3.0", optional = true }
164161

165162
# build
166163
walkdir = { version = "2.5", optional = true }
167-
yaml-rust2 = { version = "0.9", optional = true }
164+
yaml-rust2 = { version = "0.10", optional = true }
168165
quote = { version = "1.0", optional = true }
169166
syn = { version = "2.0", optional = true }
170167
prettyplease = { version = "0.2", optional = true }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rand::distributions::{Alphanumeric, DistString as _};
1+
use rand::distr::{Alphanumeric, SampleString as _};
22

33
use super::SessionKey;
44

@@ -7,7 +7,7 @@ use super::SessionKey;
77
/// [OWASP recommendations]: https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#session-id-entropy
88
pub fn generate_session_key() -> SessionKey {
99
Alphanumeric
10-
.sample_string(&mut rand::thread_rng(), 64)
10+
.sample_string(&mut rand::rng(), 64)
1111
.try_into()
1212
.expect("generated string should be within size range for a session key")
1313
}

actix-cloud/src/utils.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use std::{
66
};
77

88
use rand::{
9-
distributions::{Alphanumeric, Uniform},
10-
thread_rng, Rng,
9+
distr::{Alphanumeric, Uniform},
10+
rng, Rng,
1111
};
1212

1313
use crate::Result;
@@ -30,7 +30,7 @@ pub fn is_default<T: Default + PartialEq>(t: &T) -> bool {
3030
/// Get `n` bytes random string.
3131
/// `[a-zA-Z0-9]+`
3232
pub fn rand_string(n: usize) -> String {
33-
thread_rng()
33+
rng()
3434
.sample_iter(&Alphanumeric)
3535
.take(n)
3636
.map(char::from)
@@ -40,17 +40,16 @@ pub fn rand_string(n: usize) -> String {
4040
/// Get `n` bytes random hex string.
4141
/// `[a-f0-9]+`
4242
pub fn rand_string_hex(n: usize) -> String {
43-
let mut rng = thread_rng();
44-
let bytes: Vec<u8> = (0..n / 2).map(|_| rng.gen()).collect();
43+
let mut rng = rng();
44+
let bytes: Vec<u8> = (0..n / 2).map(|_| rng.random()).collect();
4545
hex::encode(bytes)
4646
}
4747

4848
/// Get `n` bytes random string (all printable ascii).
4949
pub fn rand_string_all(n: usize) -> String {
50-
thread_rng()
51-
.sample_iter(Uniform::new(char::from(33), char::from(126)))
50+
rng()
51+
.sample_iter(Uniform::new(char::from(33), char::from(126)).unwrap())
5252
.take(n)
53-
.map(char::from)
5453
.collect()
5554
}
5655

0 commit comments

Comments
 (0)