forked from jmug/stoatchat
chore: update es code to lapin
Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use std::{borrow::Cow, collections::BTreeMap, io::Cursor, sync::Arc};
|
||||
|
||||
use crate::utils::Consumer;
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use base64::{
|
||||
@@ -15,7 +14,7 @@ use revolt_a2::{
|
||||
},
|
||||
Client, ClientConfig, Endpoint, Error, ErrorBody, ErrorReason, Priority, PushType, Response,
|
||||
};
|
||||
use revolt_database::{events::rabbit::*, Database};
|
||||
use revolt_database::{amqp::consumer::Consumer, events::rabbit::*, Database};
|
||||
use revolt_models::v0::{Channel, Message, PushNotification};
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -123,11 +122,7 @@ impl ApnsOutboundConsumer {
|
||||
|
||||
#[async_trait]
|
||||
impl Consumer for ApnsOutboundConsumer {
|
||||
async fn create(
|
||||
db: Database,
|
||||
connection: Arc<Connection>,
|
||||
channel: Arc<AMQPChannel>,
|
||||
) -> Self {
|
||||
async fn create(db: Database, connection: Arc<Connection>, channel: Arc<AMQPChannel>, _: ()) -> Self {
|
||||
let config = revolt_config::config().await;
|
||||
|
||||
if config.pushd.apn.pkcs8.is_empty()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use std::{collections::HashMap, sync::Arc, time::Duration};
|
||||
|
||||
use crate::utils::Consumer;
|
||||
use anyhow::{bail, Result};
|
||||
use async_trait::async_trait;
|
||||
use fcm_v1::{
|
||||
@@ -10,7 +9,7 @@ use fcm_v1::{
|
||||
};
|
||||
use lapin::{message::Delivery, Channel as AMQPChannel, Connection};
|
||||
use revolt_config::config;
|
||||
use revolt_database::{events::rabbit::*, Database};
|
||||
use revolt_database::{amqp::consumer::Consumer, events::rabbit::*, Database};
|
||||
use serde_json::Value;
|
||||
|
||||
/// Custom notification data
|
||||
@@ -126,11 +125,7 @@ pub struct FcmOutboundConsumer {
|
||||
|
||||
#[async_trait]
|
||||
impl Consumer for FcmOutboundConsumer {
|
||||
async fn create(
|
||||
db: Database,
|
||||
connection: Arc<Connection>,
|
||||
channel: Arc<AMQPChannel>,
|
||||
) -> Self {
|
||||
async fn create(db: Database, connection: Arc<Connection>, channel: Arc<AMQPChannel>, _: ()) -> Self {
|
||||
let config = revolt_config::config().await;
|
||||
|
||||
Self {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use crate::utils::Consumer;
|
||||
|
||||
use anyhow::{anyhow, bail, Result};
|
||||
use async_trait::async_trait;
|
||||
use base64::{
|
||||
@@ -9,7 +7,9 @@ use base64::{
|
||||
Engine as _,
|
||||
};
|
||||
use lapin::{message::Delivery, Channel as AMQPChannel, Connection};
|
||||
use revolt_database::{events::rabbit::*, util::format_display_name, Database};
|
||||
use revolt_database::{
|
||||
amqp::consumer::Consumer, events::rabbit::*, util::format_display_name, Database,
|
||||
};
|
||||
use web_push::{
|
||||
ContentEncoding, IsahcWebPushClient, SubscriptionInfo, SubscriptionKeys, VapidSignatureBuilder,
|
||||
WebPushClient, WebPushError, WebPushMessageBuilder,
|
||||
@@ -27,11 +27,7 @@ pub struct VapidOutboundConsumer {
|
||||
|
||||
#[async_trait]
|
||||
impl Consumer for VapidOutboundConsumer {
|
||||
async fn create(
|
||||
db: Database,
|
||||
connection: Arc<Connection>,
|
||||
channel: Arc<AMQPChannel>,
|
||||
) -> Self {
|
||||
async fn create(db: Database, connection: Arc<Connection>, channel: Arc<AMQPChannel>, _: ()) -> Self {
|
||||
let config = revolt_config::config().await;
|
||||
|
||||
if config.pushd.vapid.private_key.is_empty() || config.pushd.vapid.public_key.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user