This commit is contained in:
parent
cc8fcd682b
commit
91db5861c8
21 changed files with 1263 additions and 79 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue