asluihd
This commit is contained in:
parent
dd9cf9b16c
commit
0f5d8615f4
|
@ -104,7 +104,7 @@ impl Token {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const TOKEN_CHARSET: &'static [char] = &['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '_', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
const TOKEN_CHARSET: &'static [char] = &['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||||
|
|
||||||
fn generate_token(len: u8) -> String {
|
fn generate_token(len: u8) -> String {
|
||||||
let mut token = String::new();
|
let mut token = String::new();
|
||||||
|
|
|
@ -24,18 +24,22 @@ pub async fn handler(req: HttpRequest, token: web::Path<String>, body: Bytes, db
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(event_type) = req.headers().get("X-GitHub-Event") else {
|
let Some(event_type) = req.headers().get("X-GitHub-Event") else {
|
||||||
|
log::debug!("No X-GitHub-Event header");
|
||||||
return Ok(HttpResponse::BadRequest());
|
return Ok(HttpResponse::BadRequest());
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(event_type) = event_type.to_str() else {
|
let Ok(event_type) = event_type.to_str() else {
|
||||||
|
log::debug!("Bad X-GitHub-Event header");
|
||||||
return Ok(HttpResponse::BadRequest());
|
return Ok(HttpResponse::BadRequest());
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(json) = String::from_utf8(body.to_vec()) else {
|
let Ok(json) = String::from_utf8(body.to_vec()) else {
|
||||||
|
log::debug!("Bad request body");
|
||||||
return Ok(HttpResponse::BadRequest());
|
return Ok(HttpResponse::BadRequest());
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(event) = types::Event::from_raw_json(event_type, json.clone()) else {
|
let Ok(event) = types::Event::from_raw_json(event_type, json.clone()) else {
|
||||||
|
log::debug!("Bad request body json");
|
||||||
return Ok(HttpResponse::BadRequest());
|
return Ok(HttpResponse::BadRequest());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user