mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-12-03 13:53:21 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84b5316117 | ||
|
|
d59ae90fc9 | ||
|
|
d5cf029135 | ||
|
|
34fb1dfb15 | ||
|
|
032e5ce65b |
No files matched your search
@@ -24,7 +24,7 @@ repos:
|
||||
- id: check-added-large-files
|
||||
|
||||
- repo: https://github.com/crate-ci/typos
|
||||
rev: v1.52.2
|
||||
rev: v1.53.0
|
||||
hooks:
|
||||
- id: typos
|
||||
- id: typos
|
||||
@@ -64,7 +64,7 @@ repos:
|
||||
- pre-push
|
||||
|
||||
- repo: https://code.forgejo.org/forgejo/runner
|
||||
rev: v13.3.0
|
||||
rev: v13.2.1
|
||||
hooks:
|
||||
- id: forgejo-runner-validate
|
||||
stages:
|
||||
|
||||
@@ -398,6 +398,7 @@ features = [
|
||||
"unstable-msc4484",
|
||||
"unstable-msc4540",
|
||||
"unstable-msc4560",
|
||||
"unstable-msc4563",
|
||||
"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 @@
|
||||
The `element_hacks` build feature, which has done almost nothing for many versions, has been removed completely. Contributed by @ginger.
|
||||
@@ -2808,6 +2808,18 @@
|
||||
# env: CONTINUWUITY_EXPERIMENTS__MSC4560
|
||||
#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]
|
||||
# MSC2815: Proposal to allow room moderators to view redacted event content
|
||||
#
|
||||
|
||||
@@ -102,7 +102,7 @@ look like this:
|
||||
RUSTFLAGS="--cfg tokio_unstable" cargo +nightly build \
|
||||
--release \
|
||||
--no-default-features \
|
||||
--features=systemd,element_hacks,gzip_compression,brotli_compression,zstd_compression,tokio_console
|
||||
--features=systemd,gzip_compression,brotli_compression,zstd_compression,tokio_console
|
||||
```
|
||||
|
||||
You will also need to enable the `tokio_console` config option in Continuwuity
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ cargo clippy \
|
||||
--locked \
|
||||
--profile test \
|
||||
--no-default-features \
|
||||
--features=console,systemd,element_hacks,direct_tls,perf_measurements,brotli_compression \
|
||||
--features=console,systemd,direct_tls,perf_measurements,brotli_compression \
|
||||
--color=always \
|
||||
-- \
|
||||
-D warnings
|
||||
|
||||
@@ -21,9 +21,6 @@ brotli_compression = [
|
||||
"conduwuit-service/brotli_compression",
|
||||
"reqwest/brotli",
|
||||
]
|
||||
element_hacks = [
|
||||
"conduwuit-service/element_hacks",
|
||||
]
|
||||
gzip_compression = [
|
||||
"conduwuit-core/gzip_compression",
|
||||
"conduwuit-service/gzip_compression",
|
||||
|
||||
@@ -146,6 +146,19 @@ pub struct Experiments {
|
||||
/// default: false
|
||||
#[serde(default)]
|
||||
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.
|
||||
|
||||
@@ -55,7 +55,6 @@ default = [
|
||||
standard = [
|
||||
"brotli_compression",
|
||||
"direct_tls",
|
||||
"element_hacks",
|
||||
"gzip_compression",
|
||||
"io_uring",
|
||||
"jemalloc_conf",
|
||||
@@ -86,10 +85,6 @@ console = [
|
||||
direct_tls = [
|
||||
"conduwuit-router/direct_tls"
|
||||
]
|
||||
element_hacks = [
|
||||
"conduwuit-service/element_hacks",
|
||||
"conduwuit-router/element_hacks",
|
||||
]
|
||||
gzip_compression = [
|
||||
"conduwuit-core/gzip_compression",
|
||||
"conduwuit-router/gzip_compression",
|
||||
|
||||
@@ -27,9 +27,6 @@ direct_tls = [
|
||||
"axum-server/tls-rustls-no-provider",
|
||||
"dep:axum-server-dual-protocol",
|
||||
]
|
||||
element_hacks = [
|
||||
"conduwuit-api/element_hacks",
|
||||
]
|
||||
gzip_compression = [
|
||||
"conduwuit-admin/gzip_compression",
|
||||
"conduwuit-api/gzip_compression",
|
||||
|
||||
@@ -30,7 +30,6 @@ console = [
|
||||
"dep:rustyline-async",
|
||||
"dep:termimad",
|
||||
]
|
||||
element_hacks = []
|
||||
gzip_compression = [
|
||||
"conduwuit-core/gzip_compression",
|
||||
"reqwest/gzip",
|
||||
|
||||
@@ -2,6 +2,7 @@ mod webpush;
|
||||
|
||||
use std::{fmt::Debug, mem, net::IpAddr, sync::Arc};
|
||||
|
||||
use assign::assign;
|
||||
use bytes::BytesMut;
|
||||
use conduwuit::{config::experiments::ToggledExperiment, utils::response::LimitReadExt};
|
||||
use conduwuit_core::{
|
||||
@@ -23,7 +24,10 @@ use ruma::{
|
||||
v1::{Device, Notification, NotificationCounts, NotificationPriority},
|
||||
},
|
||||
},
|
||||
events::{AnySyncTimelineEvent, TimelineEventType, room::power_levels::RoomPowerLevels},
|
||||
events::{
|
||||
AnySyncTimelineEvent, GlobalAccountDataEvent, GlobalAccountDataEventType,
|
||||
TimelineEventType, direct::DirectEventContent, room::power_levels::RoomPowerLevels,
|
||||
},
|
||||
push::{
|
||||
Action, HighlightTweakValue, PushConditionPowerLevelsCtx, PushConditionRoomCtx,
|
||||
PushFormat, Ruleset, Tweak,
|
||||
@@ -36,7 +40,7 @@ use url::Host;
|
||||
|
||||
pub use self::webpush::ActivationOutcome;
|
||||
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 WEBPUSH_SCHEMES: &[&str] = &["https"];
|
||||
@@ -57,6 +61,7 @@ pub struct Service {
|
||||
struct Services {
|
||||
server: Arc<Server>,
|
||||
globals: Dep<globals::Service>,
|
||||
account_data: Dep<account_data::Service>,
|
||||
config: Dep<config::Service>,
|
||||
client: Dep<client::Service>,
|
||||
state_accessor: Dep<rooms::state_accessor::Service>,
|
||||
@@ -86,6 +91,7 @@ impl crate::Service for Service {
|
||||
services: Services {
|
||||
server: args.server.clone(),
|
||||
globals: args.depend::<globals::Service>("globals"),
|
||||
account_data: args.depend::<account_data::Service>("account_data"),
|
||||
client: args.depend::<client::Service>("client"),
|
||||
config: args.depend::<config::Service>("config"),
|
||||
state_accessor: args
|
||||
@@ -488,11 +494,34 @@ impl Service {
|
||||
.await
|
||||
.unwrap_or_else(|_| user.localpart().to_owned());
|
||||
|
||||
PushConditionRoomCtx::new(
|
||||
room_id.to_owned(),
|
||||
room_joined_count,
|
||||
user.to_owned(),
|
||||
user_display_name,
|
||||
let is_direct = self.services.config.experiments.msc4563.is_enabled()
|
||||
&& self
|
||||
.services
|
||||
.account_data
|
||||
.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)
|
||||
}
|
||||
|
||||
@@ -75,8 +75,7 @@ impl Service {
|
||||
"lazy loading should be enabled by your options"
|
||||
);
|
||||
|
||||
let include_redundant = cfg!(feature = "element_hacks")
|
||||
|| ctx.options.is_some_and(Options::include_redundant_members);
|
||||
let include_redundant = ctx.options.is_some_and(Options::include_redundant_members);
|
||||
|
||||
let witness = self
|
||||
.witness(ctx, senders.iter().map(AsRef::as_ref))
|
||||
|
||||
Reference in new issue
Block a user