update rocket to 0.5.1

This commit is contained in:
c2m 2024-09-29 21:27:39 -04:00
parent 4248cdbfb6
commit 2e06f0f4cd
9 changed files with 15 additions and 14 deletions

1
.gitignore vendored
View file

@ -30,3 +30,4 @@ peerProfiles/*
opt-backup/j4-i2p-rs/jassets/addressbook.war opt-backup/j4-i2p-rs/jassets/addressbook.war
**/i2p/* **/i2p/*
neveko-x86_64-linux-gnu-* neveko-x86_64-linux-gnu-*
*.lock

View file

@ -13,4 +13,4 @@ neveko_core = { path = "./neveko-core" }
neveko_gui = { path = "./neveko-gui" } neveko_gui = { path = "./neveko-gui" }
neveko_market = { path = "./neveko-market" } neveko_market = { path = "./neveko-market" }
neveko_message = { path = "./neveko-message" } neveko_message = { path = "./neveko-message" }
rocket = { version = "0.5.0-rc.3", features = ["json"] } rocket = { version = "0.5.1", features = ["json"] }

View file

@ -9,4 +9,4 @@ edition = "2021"
env_logger = "0.11.0" env_logger = "0.11.0"
neveko_core = { path = "../neveko-core" } neveko_core = { path = "../neveko-core" }
log = "0.4" log = "0.4"
rocket = { version = "0.5.0-rc.3", features = ["json"] } rocket = { version = "0.5.1", features = ["json"] }

View file

@ -9,4 +9,4 @@ edition = "2021"
env_logger = "0.11.0" env_logger = "0.11.0"
neveko_core = { path = "../neveko-core" } neveko_core = { path = "../neveko-core" }
log = "0.4" log = "0.4"
rocket = { version = "0.5.0-rc.3", features = ["json"] } rocket = { version = "0.5.1", features = ["json"] }

View file

@ -23,7 +23,7 @@ num = "0.4.1"
rand = "0.8.5" rand = "0.8.5"
rand_core = "0.6.4" rand_core = "0.6.4"
reqwest = { version = "0.11.12", features = ["json"] } reqwest = { version = "0.11.12", features = ["json"] }
rocket = { version = "0.5.0-rc.3", features = ["json"] } rocket = { version = "0.5.1", features = ["json"] }
rpassword = "0.0.4" rpassword = "0.0.4"
schedule_recv = "0.1.0" schedule_recv = "0.1.0"
sha2 = "0.10.6" sha2 = "0.10.6"

View file

@ -251,7 +251,7 @@ impl<'r> FromRequest<'r> for BearerToken {
debug!("claim address: {}", claims["address"]); debug!("claim address: {}", claims["address"]);
// verify address // verify address
if claims["address"] != address { if claims["address"] != address {
return Outcome::Failure(( return Outcome::Error((
Status::Unauthorized, Status::Unauthorized,
BearerTokenError::Invalid, BearerTokenError::Invalid,
)); ));
@ -260,17 +260,17 @@ impl<'r> FromRequest<'r> for BearerToken {
let now: i64 = chrono::offset::Utc::now().timestamp(); let now: i64 = chrono::offset::Utc::now().timestamp();
let expire = claims["expiration"].parse::<i64>().unwrap_or(0); let expire = claims["expiration"].parse::<i64>().unwrap_or(0);
if now > expire { if now > expire {
return Outcome::Failure(( return Outcome::Error((
Status::Unauthorized, Status::Unauthorized,
BearerTokenError::Expired, BearerTokenError::Expired,
)); ));
} }
Outcome::Success(BearerToken(String::from(token))) Outcome::Success(BearerToken(String::from(token)))
} }
Err(_) => Outcome::Failure((Status::Unauthorized, BearerTokenError::Invalid)), Err(_) => Outcome::Error((Status::Unauthorized, BearerTokenError::Invalid)),
}; };
} }
None => Outcome::Failure((Status::Unauthorized, BearerTokenError::Missing)), None => Outcome::Error((Status::Unauthorized, BearerTokenError::Missing)),
} }
} }
} }

View file

@ -203,7 +203,7 @@ impl<'r> FromRequest<'r> for PaymentProof {
let subaddress = &claims["subaddress"]; let subaddress = &claims["subaddress"];
let is_valid_subaddress = validate_subaddress(subaddress).await; let is_valid_subaddress = validate_subaddress(subaddress).await;
if !is_valid_subaddress { if !is_valid_subaddress {
return Outcome::Failure(( return Outcome::Error((
Status::PaymentRequired, Status::PaymentRequired,
PaymentProofError::Invalid, PaymentProofError::Invalid,
)); ));
@ -224,7 +224,7 @@ impl<'r> FromRequest<'r> for PaymentProof {
let expire = utils::get_conf_threshold(); let expire = utils::get_conf_threshold();
// TODO(c2m): offline verification from created and expire fields // TODO(c2m): offline verification from created and expire fields
if c_txp.confirmations > expire { if c_txp.confirmations > expire {
return Outcome::Failure(( return Outcome::Error((
Status::Unauthorized, Status::Unauthorized,
PaymentProofError::Expired, PaymentProofError::Expired,
)); ));
@ -233,14 +233,14 @@ impl<'r> FromRequest<'r> for PaymentProof {
} }
Err(e) => { Err(e) => {
error!("jwp error: {:?}", e); error!("jwp error: {:?}", e);
return Outcome::Failure(( return Outcome::Error((
Status::PaymentRequired, Status::PaymentRequired,
PaymentProofError::Invalid, PaymentProofError::Invalid,
)); ));
} }
}; };
} }
None => Outcome::Failure((Status::PaymentRequired, PaymentProofError::Missing)), None => Outcome::Error((Status::PaymentRequired, PaymentProofError::Missing)),
} }
} }
} }

View file

@ -9,4 +9,4 @@ chrono = "0.4.38"
env_logger = "0.11.0" env_logger = "0.11.0"
neveko_core = { path = "../neveko-core" } neveko_core = { path = "../neveko-core" }
log = "0.4" log = "0.4"
rocket = { version = "0.5.0-rc.3", features = ["json"] } rocket = { version = "0.5.1", features = ["json"] }

View file

@ -9,4 +9,4 @@ edition = "2021"
env_logger = "0.11.0" env_logger = "0.11.0"
neveko_core = { path = "../neveko-core" } neveko_core = { path = "../neveko-core" }
log = "0.4" log = "0.4"
rocket = { version = "0.5.0-rc.3", features = ["json"] } rocket = { version = "0.5.1", features = ["json"] }