Bump everything

This commit is contained in:
Sandro - 2024-05-24 00:13:45 +02:00
parent c109783e2d
commit bf57e842ae
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
4 changed files with 528 additions and 514 deletions

1017
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,11 +10,12 @@ edition = "2021"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
futures = "0.3"
jid = { version = "0.10", features = ["serde"]}
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio-xmpp = "3"
xmpp-parsers = "0.19"
axum = "0.6"
xmpp-parsers = "0.20"
axum = "0.7"
systemd = "0.10"
askama = "0.11"
askama = "0.12"

View File

@ -1,9 +1,9 @@
use std::str::FromStr;
use std::convert::TryFrom;
use futures::{SinkExt, StreamExt};
use jid::{BareJid, FullJid, Jid};
use tokio::sync::mpsc;
use tokio_xmpp::{AsyncClient, Packet, Event};
use xmpp_parsers::{Jid, BareJid, FullJid, Element};
use tokio_xmpp::{AsyncClient, Element, Event, Packet};
use xmpp_parsers::message::{Body, Message, MessageType};
use xmpp_parsers::presence::{Presence, Show as PresenceShow, Type as PresenceType};
use xmpp_parsers::muc::Muc;
@ -21,18 +21,18 @@ impl Handle {
}
}
pub async fn run(jid: String, password: String, muc_jid: String) -> Handle {
pub async fn run(jid: FullJid, password: String, muc_jid: String) -> Handle {
let muc_jid: FullJid = match FullJid::from_str(&muc_jid) {
Ok(jid) => jid,
Err(err) => panic!("MUC Jid invalid: {err:?}"),
};
let (tx, mut rx) = mpsc::channel(1);
let handle = Handle {
room_jid: muc_jid.clone().into(),
room_jid: muc_jid.clone().into_bare(),
tx: tx.clone(),
};
let mut client = AsyncClient::new(&jid, &password).unwrap();
let mut client = AsyncClient::new(jid.clone(), &password);
loop {
match client.next().await {
Some(Event::Online { .. }) => {

View File

@ -7,6 +7,7 @@ use axum::{
response::{IntoResponse, Response},
Json, Router,
};
use jid::FullJid;
use serde::Deserialize;
mod jabber;
@ -76,7 +77,7 @@ async fn apprise_ok(
#[derive(Deserialize)]
struct Config {
listen_port: u16,
jid: String,
jid: FullJid,
password: String,
muc: String,
}
@ -103,8 +104,9 @@ async fn main() {
let addr = SocketAddr::from(([127, 0, 0, 1], config.listen_port));
tracing::debug!("listening on {}", addr);
let server = axum::Server::bind(&addr)
.serve(app.into_make_service());
let listener = tokio::net::TcpListener::bind(&addr).await
.unwrap();
let server = axum::serve(listener, app);
systemd::daemon::notify(false, [(systemd::daemon::STATE_READY, "1")].iter())
.unwrap();
server.await