push notifications
All checks were successful
/ upload (release) Successful in 1m4s

This commit is contained in:
pavel 2026-02-12 01:28:24 +01:00
commit 91db5861c8
21 changed files with 1263 additions and 79 deletions

View file

@ -35,8 +35,12 @@ pub async fn start(config: crate::config::Config) -> AppResult<()> {
let (tx, _) = tokio::sync::broadcast::channel(100);
let push_sender = Arc::new(crate::domain::notifications::push::PushSender::new(
&config.vapid_private_key.clone(),
)?);
let scheduler = Arc::new(
Scheduler::new(db.clone(), config.clone(), tx.clone())
Scheduler::new(db.clone(), config.clone(), tx.clone(), push_sender.clone())
.await
.map_err(|e| crate::error::AppError::Internal(e.to_string()))?,
);
@ -128,6 +132,10 @@ fn build_app(state: Arc<AppState>, config: &crate::config::Config) -> Router {
.route("/api/auth/logout", post(auth::auth_logout))
.route("/api/chat", post(chat::chat_handler))
.route("/api/ws", get(notifications::ws_handler))
.route("/api/notifications/register", post(notifications::push_handlers::register_push))
.route("/api/notifications/vapid-key", get(notifications::push_handlers::get_vapid_key))
.route("/api/tasks/:id/subscription", get(notifications::push_handlers::get_subscription_status))
.route("/api/tasks/:id/subscribe", post(notifications::push_handlers::subscribe_task).delete(notifications::push_handlers::unsubscribe_task))
.layer(cors)
.layer(tower_http::set_header::SetResponseHeaderLayer::overriding(
axum::http::header::CONTENT_SECURITY_POLICY,