mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-12-03 13:53:21 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b09176163 | ||
|
|
aabdb5003c | ||
|
|
d5cf029135 | ||
|
|
34fb1dfb15 | ||
|
|
032e5ce65b | ||
|
|
c316d8f969 | ||
|
|
134211d0ec | ||
|
|
924e70c1e1 |
No files matched your search
@@ -5,8 +5,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ repos:
|
|||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
|
|
||||||
- repo: https://github.com/crate-ci/typos
|
- repo: https://github.com/crate-ci/typos
|
||||||
rev: v1.52.2
|
rev: v1.53.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: typos
|
- id: typos
|
||||||
- id: typos
|
- id: typos
|
||||||
@@ -62,3 +62,11 @@ repos:
|
|||||||
types: [ rust ]
|
types: [ rust ]
|
||||||
stages:
|
stages:
|
||||||
- pre-push
|
- pre-push
|
||||||
|
|
||||||
|
- repo: https://code.forgejo.org/forgejo/runner
|
||||||
|
rev: v13.2.1
|
||||||
|
hooks:
|
||||||
|
- id: forgejo-runner-validate
|
||||||
|
stages:
|
||||||
|
- pre-commit
|
||||||
|
files: ".forgejo/*"
|
||||||
@@ -398,6 +398,7 @@ features = [
|
|||||||
"unstable-msc4484",
|
"unstable-msc4484",
|
||||||
"unstable-msc4540",
|
"unstable-msc4540",
|
||||||
"unstable-msc4560",
|
"unstable-msc4560",
|
||||||
|
"unstable-msc4563",
|
||||||
"unstable-extensible-events",
|
"unstable-extensible-events",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Added server-side support for [MSC4563: direct_message push rule](https://github.com/matrix-org/matrix-spec-proposals/pull/4563). Contributed by @nex.
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Errors while sending push notifications will now appear in the server log under more conditions, and will be registered as failures in Prometheus metrics.
|
||||||
@@ -2808,6 +2808,18 @@
|
|||||||
# env: CONTINUWUITY_EXPERIMENTS__MSC4560
|
# env: CONTINUWUITY_EXPERIMENTS__MSC4560
|
||||||
#msc4560 = false
|
#msc4560 = false
|
||||||
|
|
||||||
|
# MSC4563: `direct_message` push rule
|
||||||
|
#
|
||||||
|
# Creates a new kind of push rule that creates a notification if a message
|
||||||
|
# is received in a room that is in the user's direct message list. This
|
||||||
|
# more accurately identifies direct messages, rather than relying on a "DM
|
||||||
|
# room" only consisting of two members.
|
||||||
|
#
|
||||||
|
# https://github.com/matrix-org/matrix-spec-proposals/pull/4563
|
||||||
|
#
|
||||||
|
# env: CONTINUWUITY_EXPERIMENTS__MSC4563
|
||||||
|
#msc4563 = false
|
||||||
|
|
||||||
#[global.experiments.msc2815]
|
#[global.experiments.msc2815]
|
||||||
# MSC2815: Proposal to allow room moderators to view redacted event content
|
# MSC2815: Proposal to allow room moderators to view redacted event content
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
"message": "Welcome to Continuwuity! Important announcements about the project will appear here."
|
"message": "Welcome to Continuwuity! Important announcements about the project will appear here."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 21,
|
"id": 22,
|
||||||
"mention_room": true,
|
"mention_room": true,
|
||||||
"date": "2026-09-29",
|
"date": "2026-11-30",
|
||||||
"message": "[Continuwuity 26.9.1](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.9.1) has just been released - this update features a fix for a **critical** security issue, please read the release notes for more information."
|
"message": "[Continuwuity v26.11.0](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.11.0) is out, and it's massively jam-packed with so much goodness I don't know where to start. It's time to get upgrading! If you're not already convinced, here are a couple key highlights:\n\n* Appservices now receive typing indicators and read receipts. Suddenly bridges feel more alive.\n* Continuwuity can now **export metrics** via OTLP or Prometheus! There's even a Grafana dashboard included in the repo to save you the hassle of having to build you own. How thoughtful.\n* Continuwuity is more decentralised than ever, because it's now able to function as a **key notary server** for other Matrix servers. Add your friends as trusted servers!\n* **QR code login**! As client support grows, you will have the option of skipping the password and emoji verification dance when adding a new device.\n* Jump to timestamp, less retries on gone servers, no more unauthenticated media at all, better performance and so so much more.\n* Also, security fixes. That makes it pretty important you get this.\n\nGo [read the changelog](https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.11.0) - and upgrade right now"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,8 @@ async fn create_invite(
|
|||||||
.expect("must be able to create PDU object");
|
.expect("must be able to create PDU object");
|
||||||
invite_state.push(RawStrippedState::Pdu(serde_json::value::to_raw_value(&signed_event)?));
|
invite_state.push(RawStrippedState::Pdu(serde_json::value::to_raw_value(&signed_event)?));
|
||||||
|
|
||||||
// We always mark the room as invited, because we don't act on invites through /send
|
// We always mark the room as invited, because we don't act on invites
|
||||||
|
// through /send
|
||||||
services
|
services
|
||||||
.rooms
|
.rooms
|
||||||
.state_cache
|
.state_cache
|
||||||
|
|||||||
@@ -146,6 +146,19 @@ pub struct Experiments {
|
|||||||
/// default: false
|
/// default: false
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub msc4560: SimpleExperiment,
|
pub msc4560: SimpleExperiment,
|
||||||
|
|
||||||
|
/// MSC4563: `direct_message` push rule
|
||||||
|
///
|
||||||
|
/// Creates a new kind of push rule that creates a notification if a message
|
||||||
|
/// is received in a room that is in the user's direct message list. This
|
||||||
|
/// more accurately identifies direct messages, rather than relying on a "DM
|
||||||
|
/// room" only consisting of two members.
|
||||||
|
///
|
||||||
|
/// https://github.com/matrix-org/matrix-spec-proposals/pull/4563
|
||||||
|
///
|
||||||
|
/// default: false
|
||||||
|
#[serde(default)]
|
||||||
|
pub msc4563: SimpleExperiment,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a "simple" experiment, which is either disabled or enabled.
|
/// Represents a "simple" experiment, which is either disabled or enabled.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ mod webpush;
|
|||||||
|
|
||||||
use std::{fmt::Debug, mem, net::IpAddr, sync::Arc};
|
use std::{fmt::Debug, mem, net::IpAddr, sync::Arc};
|
||||||
|
|
||||||
|
use assign::assign;
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
use conduwuit::{config::experiments::ToggledExperiment, utils::response::LimitReadExt};
|
use conduwuit::{config::experiments::ToggledExperiment, utils::response::LimitReadExt};
|
||||||
use conduwuit_core::{
|
use conduwuit_core::{
|
||||||
@@ -23,7 +24,10 @@ use ruma::{
|
|||||||
v1::{Device, Notification, NotificationCounts, NotificationPriority},
|
v1::{Device, Notification, NotificationCounts, NotificationPriority},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
events::{AnySyncTimelineEvent, TimelineEventType, room::power_levels::RoomPowerLevels},
|
events::{
|
||||||
|
AnySyncTimelineEvent, GlobalAccountDataEvent, GlobalAccountDataEventType,
|
||||||
|
TimelineEventType, direct::DirectEventContent, room::power_levels::RoomPowerLevels,
|
||||||
|
},
|
||||||
push::{
|
push::{
|
||||||
Action, HighlightTweakValue, PushConditionPowerLevelsCtx, PushConditionRoomCtx,
|
Action, HighlightTweakValue, PushConditionPowerLevelsCtx, PushConditionRoomCtx,
|
||||||
PushFormat, Ruleset, Tweak,
|
PushFormat, Ruleset, Tweak,
|
||||||
@@ -36,7 +40,7 @@ use url::Host;
|
|||||||
|
|
||||||
pub use self::webpush::ActivationOutcome;
|
pub use self::webpush::ActivationOutcome;
|
||||||
use self::webpush::Vapid;
|
use self::webpush::Vapid;
|
||||||
use crate::{Dep, client, config, globals, rooms, sending, users};
|
use crate::{Dep, account_data, client, config, globals, rooms, sending, users};
|
||||||
|
|
||||||
const PUSH_GATEWAY_SCHEMES: &[&str] = &["http", "https"];
|
const PUSH_GATEWAY_SCHEMES: &[&str] = &["http", "https"];
|
||||||
const WEBPUSH_SCHEMES: &[&str] = &["https"];
|
const WEBPUSH_SCHEMES: &[&str] = &["https"];
|
||||||
@@ -57,6 +61,7 @@ pub struct Service {
|
|||||||
struct Services {
|
struct Services {
|
||||||
server: Arc<Server>,
|
server: Arc<Server>,
|
||||||
globals: Dep<globals::Service>,
|
globals: Dep<globals::Service>,
|
||||||
|
account_data: Dep<account_data::Service>,
|
||||||
config: Dep<config::Service>,
|
config: Dep<config::Service>,
|
||||||
client: Dep<client::Service>,
|
client: Dep<client::Service>,
|
||||||
state_accessor: Dep<rooms::state_accessor::Service>,
|
state_accessor: Dep<rooms::state_accessor::Service>,
|
||||||
@@ -86,6 +91,7 @@ impl crate::Service for Service {
|
|||||||
services: Services {
|
services: Services {
|
||||||
server: args.server.clone(),
|
server: args.server.clone(),
|
||||||
globals: args.depend::<globals::Service>("globals"),
|
globals: args.depend::<globals::Service>("globals"),
|
||||||
|
account_data: args.depend::<account_data::Service>("account_data"),
|
||||||
client: args.depend::<client::Service>("client"),
|
client: args.depend::<client::Service>("client"),
|
||||||
config: args.depend::<config::Service>("config"),
|
config: args.depend::<config::Service>("config"),
|
||||||
state_accessor: args
|
state_accessor: args
|
||||||
@@ -488,11 +494,34 @@ impl Service {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_else(|_| user.localpart().to_owned());
|
.unwrap_or_else(|_| user.localpart().to_owned());
|
||||||
|
|
||||||
PushConditionRoomCtx::new(
|
let is_direct = self.services.config.experiments.msc4563.is_enabled()
|
||||||
room_id.to_owned(),
|
&& self
|
||||||
room_joined_count,
|
.services
|
||||||
user.to_owned(),
|
.account_data
|
||||||
user_display_name,
|
.get_global::<GlobalAccountDataEvent<DirectEventContent>>(
|
||||||
|
user,
|
||||||
|
GlobalAccountDataEventType::Direct,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.ok()
|
||||||
|
.and_then(|direct| {
|
||||||
|
direct
|
||||||
|
.content
|
||||||
|
.values()
|
||||||
|
.flatten()
|
||||||
|
.any(|dm_room_id| dm_room_id == room_id)
|
||||||
|
.then_some(())
|
||||||
|
})
|
||||||
|
.is_some();
|
||||||
|
|
||||||
|
assign!(
|
||||||
|
PushConditionRoomCtx::new(
|
||||||
|
room_id.to_owned(),
|
||||||
|
room_joined_count,
|
||||||
|
user.to_owned(),
|
||||||
|
user_display_name,
|
||||||
|
),
|
||||||
|
{ is_direct }
|
||||||
)
|
)
|
||||||
.with_power_levels(power_levels)
|
.with_power_levels(power_levels)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -970,6 +970,8 @@ impl Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut first_push_error = None;
|
||||||
|
|
||||||
for pdu in pdus {
|
for pdu in pdus {
|
||||||
// Redacted events are not notification targets (we don't send push
|
// Redacted events are not notification targets (we don't send push
|
||||||
// for them)
|
// for them)
|
||||||
@@ -995,15 +997,27 @@ impl Service {
|
|||||||
.try_into()
|
.try_into()
|
||||||
.expect("notification count can't go that high");
|
.expect("notification count can't go that high");
|
||||||
|
|
||||||
let _response = self
|
let response = self
|
||||||
.services
|
.services
|
||||||
.pusher
|
.pusher
|
||||||
.send_push_notice(&user_id, unread, &pusher, rules_for_user, &pdu)
|
.send_push_notice(&user_id, unread, &pusher, rules_for_user, &pdu)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| (Destination::Push(user_id.clone(), pushkey.clone()), e));
|
.map_err(|e| (Destination::Push(user_id.clone(), pushkey.clone()), Box::new(e)));
|
||||||
|
|
||||||
|
if let Err(err) = response {
|
||||||
|
error!(event = %pdu.event_id, pusher = %pusher.app_display_name, "Failed to deliver push notification: {err:?}");
|
||||||
|
|
||||||
|
if first_push_error.is_none() {
|
||||||
|
first_push_error = Some(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Destination::Push(user_id, pushkey))
|
if let Some(err) = first_push_error {
|
||||||
|
Err(err)
|
||||||
|
} else {
|
||||||
|
Ok(Destination::Push(user_id, pushkey))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn send_events_dest_federation(
|
async fn send_events_dest_federation(
|
||||||
|
|||||||
Reference in new issue
Block a user