lohr: upgrade to latest Rocket master
This commit is contained in:
parent
fd50523f11
commit
1f6fe74d03
4 changed files with 175 additions and 123 deletions
|
|
@ -30,8 +30,8 @@ struct Secret(String);
|
|||
#[post("/", data = "<payload>")]
|
||||
fn gitea_webhook(
|
||||
payload: SignedJson<GiteaWebHook>,
|
||||
sender: State<JobSender>,
|
||||
config: State<GlobalSettings>,
|
||||
sender: &State<JobSender>,
|
||||
config: &State<GlobalSettings>,
|
||||
) -> Status {
|
||||
if config
|
||||
.blacklist
|
||||
|
|
@ -121,7 +121,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
repo_updater(receiver, homedir, config);
|
||||
});
|
||||
|
||||
rocket::ignite()
|
||||
rocket::build()
|
||||
.mount("/", routes![gitea_webhook])
|
||||
.manage(JobSender(Mutex::new(sender)))
|
||||
.manage(Secret(secret))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use rocket::{
|
|||
http::ContentType,
|
||||
State,
|
||||
};
|
||||
use rocket::{http::Status, local_cache};
|
||||
use rocket::{http::Status, request::local_cache};
|
||||
use rocket::{Data, Request};
|
||||
|
||||
use anyhow::{anyhow, Context};
|
||||
|
|
@ -100,7 +100,7 @@ where
|
|||
};
|
||||
|
||||
let signature = signatures[0];
|
||||
let secret = request.guard::<State<Secret>>().await.unwrap();
|
||||
let secret = request.guard::<&State<Secret>>().await.unwrap();
|
||||
|
||||
if !validate_signature(&secret.0, &signature, &content) {
|
||||
return Outcome::Failure((Status::BadRequest, anyhow!("couldn't verify signature")));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue