mirror of
https://github.com/mCaptcha/cache.git
synced 2024-11-24 17:35:31 +03:00
bump redis module version and address clippy lints
This commit is contained in:
parent
8559ddcbe2
commit
d0c9de8829
6 changed files with 84 additions and 46 deletions
106
Cargo.lock
generated
106
Cargo.lock
generated
|
@ -4,9 +4,9 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
version = "0.7.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -39,9 +39,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
|||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.58.1"
|
||||
version = "0.59.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f8523b410d7187a43085e7e064416ea32ded16bd0a4e6fc025e21616d01258f"
|
||||
checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cexpr",
|
||||
|
@ -66,6 +66,18 @@ version = "1.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "0.19.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321"
|
||||
dependencies = [
|
||||
"funty",
|
||||
"radium",
|
||||
"tap",
|
||||
"wyz",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.69"
|
||||
|
@ -74,9 +86,9 @@ checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2"
|
|||
|
||||
[[package]]
|
||||
name = "cexpr"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
|
||||
checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89"
|
||||
dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
@ -140,7 +152,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
"strsim 0.10.0",
|
||||
"syn 1.0.73",
|
||||
"syn 1.0.74",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -151,7 +163,7 @@ checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a"
|
|||
dependencies = [
|
||||
"darling_core",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.73",
|
||||
"syn 1.0.74",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -172,7 +184,7 @@ dependencies = [
|
|||
"darling",
|
||||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.73",
|
||||
"syn 1.0.74",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -182,7 +194,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "58a94ace95092c5acb1e97a7e846b310cfbd499652f72297da7493f618a98d73"
|
||||
dependencies = [
|
||||
"derive_builder_core",
|
||||
"syn 1.0.73",
|
||||
"syn 1.0.74",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -195,7 +207,7 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
"rustc_version",
|
||||
"syn 1.0.73",
|
||||
"syn 1.0.74",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -228,6 +240,12 @@ version = "1.0.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.3"
|
||||
|
@ -312,7 +330,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "libmcaptcha"
|
||||
version = "0.1.4"
|
||||
source = "git+https://github.com/mCaptcha/libmcaptcha?branch=master#510606895a86285e7a70786b4c4d31e544c81aaa"
|
||||
source = "git+https://github.com/mCaptcha/libmcaptcha?branch=master#1d4f97f511ad851a58359ecd1737b381b61cf22e"
|
||||
dependencies = [
|
||||
"derive_builder",
|
||||
"derive_more",
|
||||
|
@ -346,16 +364,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.0"
|
||||
version = "2.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
||||
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "5.1.2"
|
||||
version = "6.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
|
||||
checksum = "9c5c51b9083a3c620fa67a2a635d1ce7d95b897e957d6b28ff9a5da960a103a6"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"funty",
|
||||
"memchr",
|
||||
"version_check",
|
||||
]
|
||||
|
@ -407,9 +427,9 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.27"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
|
||||
checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.2",
|
||||
]
|
||||
|
@ -429,6 +449,12 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "radium"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.4"
|
||||
|
@ -471,9 +497,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redis-module"
|
||||
version = "0.21.0"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b9ca0e81e4f57537140e45fe0723264a4f4b1f13beb6fffa313ea67783c01e3"
|
||||
checksum = "8c4db88768c836e229778864160139dbd906301532806909836675d81f66b6e2"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"bitflags",
|
||||
|
@ -486,9 +512,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
version = "1.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -542,29 +568,29 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.126"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
|
||||
checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.126"
|
||||
version = "1.0.127"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
|
||||
checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.73",
|
||||
"syn 1.0.74",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.64"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -598,7 +624,7 @@ dependencies = [
|
|||
"heck",
|
||||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.73",
|
||||
"syn 1.0.74",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -614,9 +640,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.73"
|
||||
version = "1.0.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7"
|
||||
checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
|
@ -632,6 +658,12 @@ dependencies = [
|
|||
"unicode-xid 0.0.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tap"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.2"
|
||||
|
@ -652,9 +684,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.8.1"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98c8b05dc14c75ea83d63dd391100353789f5f24b8b3866542a5e85c8be8e985"
|
||||
checksum = "4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"pin-project-lite",
|
||||
|
@ -747,3 +779,9 @@ name = "winapi-x86_64-pc-windows-gnu"
|
|||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "wyz"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
|
||||
|
|
|
@ -13,7 +13,7 @@ crate-type = ["cdylib"]
|
|||
name = "cache"
|
||||
|
||||
[dependencies]
|
||||
redis-module = { version="0.21", features = ["experimental-api"]}
|
||||
redis-module = { version="0.22", features = ["experimental-api"]}
|
||||
libc = "0.2"
|
||||
serde_json = "1.0.64"
|
||||
serde = {version = "1.0.126", features = ["derive"]}
|
||||
|
|
|
@ -78,9 +78,9 @@ impl Bucket {
|
|||
|
||||
let bucket_name = bucket_name.unwrap();
|
||||
|
||||
let bucket = ctx.open_key_writable(&RedisString::create(ctx.ctx, &bucket_name));
|
||||
let bucket = ctx.open_key_writable(&RedisString::create(ctx.ctx, bucket_name));
|
||||
if bucket.key_type() == KeyType::Empty {
|
||||
ctx.log_debug(&format!("Bucket doesn't exist: {}", &key_name));
|
||||
ctx.log_debug(&format!("Bucket doesn't exist: {}", key_name));
|
||||
} else {
|
||||
Bucket::decrement_runner(ctx, &bucket);
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ pub mod type_methods {
|
|||
pub unsafe extern "C" fn rdb_save(rdb: *mut raw::RedisModuleIO, value: *mut c_void) {
|
||||
let bucket = &*(value as *mut Bucket);
|
||||
match &serde_json::to_string(bucket) {
|
||||
Ok(string) => raw::save_string(rdb, &string),
|
||||
Ok(string) => raw::save_string(rdb, string),
|
||||
Err(e) => eprintln!("error while rdb_save: {}", e),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ pub mod type_methods {
|
|||
pub unsafe extern "C" fn rdb_save(rdb: *mut raw::RedisModuleIO, value: *mut c_void) {
|
||||
let challenge = &*(value as *mut Challenge);
|
||||
match &serde_json::to_string(&challenge.0) {
|
||||
Ok(string) => raw::save_string(rdb, &string),
|
||||
Ok(string) => raw::save_string(rdb, string),
|
||||
Err(e) => panic!("error while rdb_save: {}", e),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,11 +147,11 @@ impl MCaptcha {
|
|||
#[inline]
|
||||
fn add_captcha_runner(ctx: &Context, key_name: &str, mcaptcha: MCaptcha) -> RedisResult {
|
||||
let duration = mcaptcha.get_duration();
|
||||
let key = ctx.open_key_writable(&RedisString::create(ctx.ctx, &key_name));
|
||||
let key = ctx.open_key_writable(&RedisString::create(ctx.ctx, key_name));
|
||||
if key.key_type() == KeyType::Empty {
|
||||
key.set_value(&MCAPTCHA_MCAPTCHA_TYPE, mcaptcha)?;
|
||||
ctx.log_debug(&format!("mcaptcha {} created", key_name));
|
||||
MCaptchaSafety::new(ctx, duration, &key_name)?;
|
||||
MCaptchaSafety::new(ctx, duration, key_name)?;
|
||||
REDIS_OK
|
||||
} else {
|
||||
let msg = format!("mcaptcha {} exists", key_name);
|
||||
|
@ -212,7 +212,7 @@ impl MCaptcha {
|
|||
|
||||
#[inline]
|
||||
fn delete_captcha_runner(ctx: &Context, key_name: &str) -> RedisResult {
|
||||
let key = ctx.open_key_writable(&RedisString::create(ctx.ctx, &key_name));
|
||||
let key = ctx.open_key_writable(&RedisString::create(ctx.ctx, key_name));
|
||||
if key.key_type() == KeyType::Empty {
|
||||
Err(RedisError::nonexistent_key())
|
||||
} else {
|
||||
|
@ -285,7 +285,7 @@ pub mod type_methods {
|
|||
pub unsafe extern "C" fn rdb_save(rdb: *mut raw::RedisModuleIO, value: *mut c_void) {
|
||||
let mcaptcha = &*(value as *mut MCaptcha);
|
||||
match &serde_json::to_string(mcaptcha) {
|
||||
Ok(string) => raw::save_string(rdb, &string),
|
||||
Ok(string) => raw::save_string(rdb, string),
|
||||
Err(e) => panic!("error while rdb_save: {}", e),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ impl MCaptchaSafety {
|
|||
return;
|
||||
}
|
||||
let mcaptcha_name = mcaptcha_name.unwrap();
|
||||
let mcaptcha = ctx.open_key(&RedisString::create(ctx.ctx, &mcaptcha_name));
|
||||
let mcaptcha = ctx.open_key(&RedisString::create(ctx.ctx, mcaptcha_name));
|
||||
if mcaptcha.key_type() == KeyType::Empty {
|
||||
ctx.log_warning(&format!("mcaptcha {} is empty", mcaptcha_name));
|
||||
return;
|
||||
|
@ -139,7 +139,7 @@ impl MCaptchaSafety {
|
|||
return;
|
||||
}
|
||||
let mcaptcha_name = mcaptcha_name.unwrap();
|
||||
let mcaptcha = ctx.open_key(&RedisString::create(ctx.ctx, &mcaptcha_name));
|
||||
let mcaptcha = ctx.open_key(&RedisString::create(ctx.ctx, mcaptcha_name));
|
||||
if mcaptcha.key_type() == KeyType::Empty {
|
||||
return;
|
||||
}
|
||||
|
@ -221,6 +221,6 @@ pub mod type_methods {
|
|||
|
||||
#[allow(non_snake_case, unused)]
|
||||
pub unsafe extern "C" fn rdb_save(rdb: *mut raw::RedisModuleIO, value: *mut c_void) {
|
||||
raw::save_string(rdb, &SAFETY_RDB_VAL)
|
||||
raw::save_string(rdb, SAFETY_RDB_VAL)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue