Compare commits

...

No commits in common. "5a65c713bd9455fc53c34e4821c6622e3d9bf87d" and "7c24e2564f45d907041081dc196990c03c6eb59f" have entirely different histories.

View File

@ -154,7 +154,7 @@ async fn run() -> anyhow::Result<()> {
.and(warp::post())
.and(warp::header::<String>("x-gitlab-token"))
.and(warp::body::json())
.and_then(move |token: String, event: event::GitlabEvent| {
.then(move |token: String, event: event::GitlabEvent| {
let config = Arc::clone(&config);
let matrix_client = matrix_client.clone();
@ -164,22 +164,22 @@ async fn run() -> anyhow::Result<()> {
if let Some(repo_config) = config.repo_configs.get(&config_key) {
if !constant_time_eq(token.as_bytes(), repo_config.token.as_bytes()) {
warn!("Invalid token for repo '{}'", config_key);
Err(warp::reject::reject())
warp::reply::with_status("Invalid token", StatusCode::FORBIDDEN)
} else {
debug!("payload: {:?}", event);
if let Some(room) = repo_config.room.as_ref().or(config.default_room.as_ref()) {
if let Err(err) = handle_gitlab_event(event, &room, &matrix_client).await {
warn!("Failed to handle payload: {}", err);
}
Ok(warp::reply::with_status("OK", StatusCode::OK))
warp::reply::with_status("OK", StatusCode::OK)
} else {
info!("Channel not configured for repo '{}'", config_key);
Err(warp::reject::reject())
warp::reply::with_status("Matrix room not configured for repo", StatusCode::NOT_FOUND)
}
}
} else {
info!("Repo '{}' unconfigured", config_key);
Err(warp::reject::reject())
warp::reply::with_status("Repo not configured", StatusCode::NOT_FOUND)
}
}
});