Compare commits

..

6 commits

Author SHA1 Message Date
72e409f952 WIP
All checks were successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
2024-07-23 08:15:32 +01:00
ab2af2596e WIP: feat: post webhook to user 2024-07-22 14:22:42 +01:00
988da49567 WIP: feat: dispatch NotifyUser messages to server actor (2/2) 2024-07-22 14:21:37 +01:00
03f4f6e000 refactor: use Option<&T> over &Option<T> 2024-07-22 14:21:37 +01:00
4764aee800 WIP: feat: dispatch NotifyUser messages to server actor (1/2) 2024-07-22 14:21:34 +01:00
3644ce33b3 WIP: feat: support sending messages to a notification webhook 2024-07-22 10:20:39 +01:00

View file

@ -1,7 +1,5 @@
use actix::prelude::*;
use git_next_config::server::NotificationType;
use git_next_webhook_actor::{AddWebhookRecipient, ShutdownWebhook, WebhookActor, WebhookRouter};
use standardwebhooks::Webhook;
use crate::{
messages::{ReceiveValidServerConfig, ValidServerConfig},
@ -21,26 +19,6 @@ impl Handler<ReceiveValidServerConfig> for ServerActor {
if let Some(webhook_actor_addr) = self.webhook_actor_addr.take() {
webhook_actor_addr.do_send(ShutdownWebhook);
}
match server_config.notification().r#type() {
NotificationType::None => { /* do nothing */ }
NotificationType::Webhook => {
// Create webhook signer
use secrecy::ExposeSecret;
let webhook = server_config
.notification()
.webhook_secret()
.map(|secret| Webhook::new(secret.expose_secret()))
.transpose()
.map_err(|e| {
tracing::error!(
"Invalid notification webhook secret (will not send notifications): {e}"
)
})
.ok()
.flatten();
self.webhook = webhook;
}
}
self.generation.inc();
// Webhook Server
tracing::info!("Starting Webhook Server...");