Merge remote-tracking branch 'upstream/main' into conduwuit-changes

This commit is contained in:
strawberry 2024-05-01 15:25:44 -04:00
commit b10df150a2
16 changed files with 114 additions and 11 deletions

View File

@ -11,7 +11,7 @@ rust-version = "1.75"
as_variant = "1.2.0"
assert_matches2 = "0.1.0"
assign = "1.1.1"
base64 = "0.21.0"
base64 = "0.22.0"
criterion = "0.5.0"
http = "1.1.0"
js_int = "0.2.2"

View File

@ -47,6 +47,7 @@ Improvements:
- Add unstable support for moderator server support discovery, according to MSC4121
- Add unstable support for the room summary endpoint from MSC3266 behind the
`unstable-msc3266` feature.
- Add unstable support for animated thumbnails, according to MSC2705
# 0.17.4

View File

@ -41,6 +41,7 @@ unstable-exhaustive-types = ["ruma-common/unstable-exhaustive-types"]
unstable-msc2666 = []
unstable-msc2448 = []
unstable-msc2654 = []
unstable-msc2705 = []
unstable-msc2965 = []
unstable-msc2967 = []
unstable-msc3266 = []

View File

@ -87,6 +87,21 @@ pub mod v3 {
#[ruma_api(query)]
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub allow_redirect: bool,
/// Whether the server should return an animated thumbnail.
///
/// When `true`, the server should return an animated thumbnail if possible and supported.
/// Otherwise it must not return an animated thumbnail.
///
/// Defaults to `false`.
#[cfg(feature = "unstable-msc2705")]
#[ruma_api(query)]
#[serde(
rename = "org.matrix.msc2705.animated",
default,
skip_serializing_if = "ruma_common::serde::is_default"
)]
pub animated: bool,
}
/// Response type for the `get_content_thumbnail` endpoint.
@ -135,6 +150,8 @@ pub mod v3 {
allow_remote: true,
timeout_ms: crate::media::default_download_timeout(),
allow_redirect: false,
#[cfg(feature = "unstable-msc2705")]
animated: false,
}
}

View File

@ -13,6 +13,7 @@ Breaking changes:
- Add support for endpoints that require authentication for appservices
- `deserialize_as_f64_or_string` has been extended to also support parsing integers, and renamed to
`deserialize_as_number_or_string` to reflect that.
- The http crate had a major version bump to version 1.1
Improvements:

View File

@ -32,6 +32,7 @@ Improvements:
- Add `filename` and `formatted` fields to media event contents to support media captions
as per [MSC2530](https://github.com/matrix-org/matrix-spec-proposals/pull/2530) / Matrix 1.10
- Add support for multi-stream VoIP, according to MSC3077 / Matrix 1.10
- Add unstable support for muting in VoIP calls, according to MSC3291
# 0.27.11

View File

@ -30,6 +30,7 @@ unstable-msc3245 = ["unstable-msc3246"]
# https://github.com/matrix-org/matrix-spec-proposals/blob/83f6c5b469c1d78f714e335dcaa25354b255ffa5/proposals/3245-voice-messages.md
unstable-msc3245-v1-compat = []
unstable-msc3246 = ["unstable-msc3927"]
unstable-msc3291 = []
unstable-msc3381 = ["unstable-msc1767"]
unstable-msc3401 = []
unstable-msc3488 = ["unstable-msc1767"]
@ -61,7 +62,7 @@ indexmap = { version = "2.0.0", features = ["serde"] }
js_int = { workspace = true, features = ["serde"] }
js_option = "0.1.0"
percent-encoding = "2.1.0"
pulldown-cmark = { version = "0.9.1", default-features = false, optional = true }
pulldown-cmark = { version = "0.10.3", optional = true, default-features = false, features = ["html"] }
regex = { version = "1.5.6", default-features = false, features = ["std", "perf"] }
ruma-common = { workspace = true }
ruma-html = { workspace = true, optional = true }

View File

@ -12,6 +12,8 @@ pub mod negotiate;
#[cfg(feature = "unstable-msc4075")]
pub mod notify;
pub mod reject;
#[cfg(feature = "unstable-msc3291")]
pub mod sdp_stream_metadata_changed;
pub mod select_answer;
use ruma_macros::StringEnum;
@ -53,12 +55,32 @@ impl SessionDescription {
pub struct StreamMetadata {
/// The purpose of the stream.
pub purpose: StreamPurpose,
/// Whether the audio track of the stream is muted.
///
/// Defaults to `false`.
#[cfg(feature = "unstable-msc3291")]
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub audio_muted: bool,
/// Whether the video track of the stream is muted.
///
/// Defaults to `false`.
#[cfg(feature = "unstable-msc3291")]
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub video_muted: bool,
}
impl StreamMetadata {
/// Creates a new `StreamMetadata` with the given purpose.
pub fn new(purpose: StreamPurpose) -> Self {
Self { purpose }
Self {
purpose,
#[cfg(feature = "unstable-msc3291")]
audio_muted: false,
#[cfg(feature = "unstable-msc3291")]
video_muted: false,
}
}
}

View File

@ -0,0 +1,49 @@
//! Types for the [`m.call.sdp_stream_metadata_changed`] event.
//!
//! [`m.call.sdp_stream_metadata_changed`]: https://github.com/matrix-org/matrix-spec-proposals/pull/3291
use std::collections::BTreeMap;
use ruma_common::{OwnedVoipId, VoipVersionId};
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};
use super::StreamMetadata;
/// The content of an `m.call.sdp_stream_metadata_changed` event.
///
/// This event is sent by any party when a stream metadata changes but no negotiation is required.
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_event(type = "org.matrix.call.sdp_stream_metadata_changed", kind = MessageLike)]
pub struct CallSdpStreamMetadataChangedEventContent {
/// A unique identifier for the call.
pub call_id: OwnedVoipId,
/// A unique ID for this session for the duration of the call.
pub party_id: OwnedVoipId,
/// The version of the VoIP specification this messages adheres to.
///
/// Must be at least [`VoipVersionId::V1`].
pub version: VoipVersionId,
/// Metadata describing the streams that will be sent.
///
/// This is a map of stream ID to metadata about the stream.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub sdp_stream_metadata: BTreeMap<String, StreamMetadata>,
}
impl CallSdpStreamMetadataChangedEventContent {
/// Creates a new `SdpStreamMetadataChangedEventContent` with the given call ID, party ID, VoIP
/// version and stream metadata.
pub fn new(
call_id: OwnedVoipId,
party_id: OwnedVoipId,
version: VoipVersionId,
sdp_stream_metadata: BTreeMap<String, StreamMetadata>,
) -> Self {
Self { call_id, party_id, version, sdp_stream_metadata }
}
}

View File

@ -45,6 +45,9 @@ event_enum! {
"m.call.candidates" => super::call::candidates,
"m.call.negotiate" => super::call::negotiate,
"m.call.reject" => super::call::reject,
#[cfg(feature = "unstable-msc3291")]
#[ruma_enum(alias = "m.call.sdp_stream_metadata_changed")]
"org.matrix.call.sdp_stream_metadata_changed" => super::call::sdp_stream_metadata_changed,
"m.call.select_answer" => super::call::select_answer,
#[cfg(feature = "unstable-msc3954")]
#[ruma_enum(alias = "m.emote")]
@ -360,6 +363,8 @@ impl AnyMessageLikeEventContent {
Self::PollStart(_) | Self::UnstablePollStart(_) => None,
#[cfg(feature = "unstable-msc4075")]
Self::CallNotify(_) => None,
#[cfg(feature = "unstable-msc3291")]
Self::CallSdpStreamMetadataChanged(_) => None,
Self::CallNegotiate(_)
| Self::CallReject(_)
| Self::CallSelectAnswer(_)

View File

@ -894,7 +894,7 @@ pub struct CustomEventContent {
#[cfg(feature = "markdown")]
pub(crate) fn parse_markdown(text: &str) -> Option<String> {
use pulldown_cmark::{Event, Options, Parser, Tag};
use pulldown_cmark::{Event, Options, Parser, Tag, TagEnd};
const OPTIONS: Options = Options::ENABLE_TABLES.union(Options::ENABLE_STRIKETHROUGH);
@ -919,7 +919,7 @@ pub(crate) fn parse_markdown(text: &str) -> Option<String> {
} else {
false
};
let is_paragraph_end = matches!(event, Event::End(Tag::Paragraph));
let is_paragraph_end = matches!(event, Event::End(TagEnd::Paragraph));
!is_text && !is_break && !is_first_paragraph_start && !is_paragraph_end
});

View File

@ -16,7 +16,7 @@ proc-macro = true
[dependencies]
once_cell = "1.13.0"
proc-macro-crate = "2.0.0"
proc-macro-crate = "3.1.0"
proc-macro2 = "1.0.24"
quote = "1.0.8"
ruma-identifiers-validation = { workspace = true }

View File

@ -19,7 +19,7 @@ rustdoc-args = ["--cfg", "docsrs"]
headers = "0.4.0"
ruma-common = { workspace = true }
tracing = { workspace = true }
yap = "0.11.0"
yap = "0.12.0"
[dev-dependencies]
tracing-subscriber = "0.3.16"

View File

@ -41,7 +41,7 @@ impl XMatrix {
fn parse_token<'a>(tokens: &mut impl Tokens<Item = &'a u8>) -> Option<Vec<u8>> {
tokens.optional(|t| {
let token: Vec<u8> = t.tokens_while(|c| is_tchar(**c)).copied().collect();
let token: Vec<u8> = t.take_while(|c| is_tchar(**c)).as_iter().copied().collect();
if !token.is_empty() {
Some(token)
} else {
@ -53,7 +53,8 @@ fn parse_token<'a>(tokens: &mut impl Tokens<Item = &'a u8>) -> Option<Vec<u8>> {
fn parse_token_with_colons<'a>(tokens: &mut impl Tokens<Item = &'a u8>) -> Option<Vec<u8>> {
tokens.optional(|t| {
let token: Vec<u8> = t.tokens_while(|c| is_tchar(**c) || **c == b':').copied().collect();
let token: Vec<u8> =
t.take_while(|c| is_tchar(**c) || **c == b':').as_iter().copied().collect();
if !token.is_empty() {
Some(token)
} else {
@ -144,7 +145,7 @@ fn parse_xmatrix<'a>(tokens: &mut impl Tokens<Item = &'a u8>) -> Option<XMatrix>
let mut key = None;
let mut sig = None;
for (name, value) in t.sep_by(|t| parse_xmatrix_field(t), |t| t.token(&b',')) {
for (name, value) in t.sep_by(|t| parse_xmatrix_field(t), |t| t.token(&b',')).as_iter() {
match name.as_str() {
"origin" => {
if origin.is_some() {

View File

@ -18,7 +18,7 @@ all-features = true
unstable-exhaustive-types = []
[dependencies]
itertools = "0.11.0"
itertools = "0.12.1"
js_int = { workspace = true }
ruma-common = { workspace = true }
ruma-events = { workspace = true }

View File

@ -231,6 +231,7 @@ unstable-msc2448 = [
]
unstable-msc2654 = ["ruma-client-api?/unstable-msc2654"]
unstable-msc2666 = ["ruma-client-api?/unstable-msc2666"]
unstable-msc2705 = ["ruma-client-api?/unstable-msc2705"]
unstable-msc2747 = ["ruma-events?/unstable-msc2747"]
unstable-msc2867 = ["ruma-events?/unstable-msc2867"]
unstable-msc2870 = ["ruma-common/unstable-msc2870"]
@ -246,6 +247,7 @@ unstable-msc3245 = ["ruma-events?/unstable-msc3245"]
unstable-msc3245-v1-compat = ["ruma-events?/unstable-msc3245-v1-compat"]
unstable-msc3246 = ["ruma-events?/unstable-msc3246"]
unstable-msc3266 = ["ruma-client-api?/unstable-msc3266"]
unstable-msc3291 = ["ruma-events?/unstable-msc3291"]
unstable-msc3381 = ["ruma-events?/unstable-msc3381"]
unstable-msc3401 = ["ruma-events?/unstable-msc3401"]
unstable-msc3488 = [
@ -289,6 +291,7 @@ __ci = [
"unstable-msc2448",
"unstable-msc2654",
"unstable-msc2666",
"unstable-msc2705",
"unstable-msc2747",
"unstable-msc2867",
"unstable-msc2870",
@ -300,6 +303,7 @@ __ci = [
"unstable-msc3245-v1-compat",
"unstable-msc3246",
"unstable-msc3266",
"unstable-msc3291",
"unstable-msc3381",
"unstable-msc3401",
"unstable-msc3488",