mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-04-03 10:55:50 +00:00
Compare commits
2 Commits
jade/loggi
...
v0.5.0-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0870c8d647 | ||
|
|
d0f00e6f5c |
20
Cargo.lock
generated
20
Cargo.lock
generated
@@ -771,7 +771,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"conduwuit_admin",
|
||||
@@ -800,7 +800,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_admin"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"conduwuit_api",
|
||||
@@ -821,7 +821,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_api"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
@@ -853,14 +853,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_build_metadata"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"built 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_core"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"argon2",
|
||||
"arrayvec",
|
||||
@@ -919,7 +919,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_database"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"conduwuit_core",
|
||||
@@ -937,7 +937,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_macros"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"proc-macro2",
|
||||
@@ -947,7 +947,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_router"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"axum-client-ip",
|
||||
@@ -981,7 +981,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_service"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64 0.22.1",
|
||||
@@ -1018,7 +1018,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "conduwuit_web"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
dependencies = [
|
||||
"askama",
|
||||
"axum",
|
||||
|
||||
@@ -21,7 +21,7 @@ license = "Apache-2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://forgejo.ellis.link/continuwuation/continuwuity"
|
||||
rust-version = "1.86.0"
|
||||
version = "0.5.0-rc.5"
|
||||
version = "0.5.0-rc.6"
|
||||
|
||||
[workspace.metadata.crane]
|
||||
name = "conduwuit"
|
||||
|
||||
8
docs/static/announcements.schema.json
vendored
8
docs/static/announcements.schema.json
vendored
@@ -3,7 +3,7 @@
|
||||
"$id": "https://continwuity.org/schema/announcements.schema.json",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"updates": {
|
||||
"announcements": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
@@ -16,6 +16,10 @@
|
||||
},
|
||||
"date": {
|
||||
"type": "string"
|
||||
},
|
||||
"mention_room": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to mention the room (@room) when posting this announcement"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -26,6 +30,6 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"updates"
|
||||
"announcements"
|
||||
]
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
use async_trait::async_trait;
|
||||
use conduwuit::{Result, Server, debug, info, warn};
|
||||
use database::{Deserialized, Map};
|
||||
use ruma::events::room::message::RoomMessageEventContent;
|
||||
use ruma::events::{Mentions, room::message::RoomMessageEventContent};
|
||||
use serde::Deserialize;
|
||||
use tokio::{
|
||||
sync::Notify,
|
||||
@@ -53,6 +53,8 @@ struct CheckForAnnouncementsResponseEntry {
|
||||
id: u64,
|
||||
date: Option<String>,
|
||||
message: String,
|
||||
#[serde(default, skip_serializing_if = "bool::not")]
|
||||
mention_room: bool,
|
||||
}
|
||||
|
||||
const CHECK_FOR_ANNOUNCEMENTS_URL: &str =
|
||||
@@ -139,19 +141,20 @@ async fn handle(&self, announcement: &CheckForAnnouncementsResponseEntry) {
|
||||
} else {
|
||||
info!("[announcements] {:#}", announcement.message);
|
||||
}
|
||||
let mut message = RoomMessageEventContent::text_markdown(format!(
|
||||
"### New announcement{}\n\n{}",
|
||||
announcement
|
||||
.date
|
||||
.as_ref()
|
||||
.map_or_else(String::new, |date| format!(" - `{date}`")),
|
||||
announcement.message
|
||||
));
|
||||
|
||||
self.services
|
||||
.admin
|
||||
.send_message(RoomMessageEventContent::text_markdown(format!(
|
||||
"### New announcement{}\n\n{}",
|
||||
announcement
|
||||
.date
|
||||
.as_ref()
|
||||
.map_or_else(String::new, |date| format!(" - `{date}`")),
|
||||
announcement.message
|
||||
)))
|
||||
.await
|
||||
.ok();
|
||||
if announcement.mention_room {
|
||||
message = message.add_mentions(Mentions::with_room_mention());
|
||||
}
|
||||
|
||||
self.services.admin.send_message(message).await.ok();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user