summaryrefslogtreecommitdiff
path: root/src/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 36f3d31..971d1f9 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -13,13 +13,13 @@ use axum::{
use clap::{CommandFactory, Parser, Subcommand};
use sqlx::sqlite::SqlitePool;
use tokio::net;
-use web_push::{IsahcWebPushClient, WebPushClient};
pub use crate::exit::Exit;
use crate::{
app::App,
clock, db,
error::failed::{Failed, ResultExt as _},
+ push::Publisher,
routes,
umask::Umask,
};
@@ -101,8 +101,8 @@ impl Args {
self.umask.set();
let pool = self.pool().await.fail("Failed to create database pool")?;
- let webpush = IsahcWebPushClient::new().fail("Failed to create web push publisher")?;
- let app = App::from(pool, webpush);
+ let publisher = Publisher::new().fail("Failed to create web push publisher")?;
+ let app = App::from(pool, publisher);
match self.command {
None => self.serve(app).await?,
@@ -116,10 +116,7 @@ impl Args {
Result::<_, Failed>::Ok(())
}
- async fn serve<P>(self, app: App<P>) -> Result<(), Failed>
- where
- P: WebPushClient + Clone + Send + Sync + 'static,
- {
+ async fn serve(self, app: App<Publisher>) -> Result<(), Failed> {
let app = routes::routes(&app)
.route_layer(middleware::from_fn(clock::middleware))
.route_layer(middleware::map_response(Self::server_info()))