Merge remote-tracking branch 'upstream/main' into conduwuit-changes
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
commit
0738b7f72d
@ -36,6 +36,7 @@ Improvements:
|
|||||||
- This is a breaking change, but only for users of `unstable-msc3575`
|
- This is a breaking change, but only for users of `unstable-msc3575`
|
||||||
- Add the `get_login_token` field to `Capabilities`, according to a
|
- Add the `get_login_token` field to `Capabilities`, according to a
|
||||||
clarification in the spec.
|
clarification in the spec.
|
||||||
|
- Add support for account locking, according to MSC3939.
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
|
@ -207,6 +207,9 @@ pub enum ErrorKind {
|
|||||||
#[cfg(feature = "unstable-msc3843")]
|
#[cfg(feature = "unstable-msc3843")]
|
||||||
Unactionable,
|
Unactionable,
|
||||||
|
|
||||||
|
/// M_USER_LOCKED
|
||||||
|
UserLocked,
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
_Custom { errcode: PrivOwnedStr, extra: Extra },
|
_Custom { errcode: PrivOwnedStr, extra: Extra },
|
||||||
}
|
}
|
||||||
@ -284,6 +287,7 @@ impl AsRef<str> for ErrorKind {
|
|||||||
Self::WrongRoomKeysVersion { .. } => "M_WRONG_ROOM_KEYS_VERSION",
|
Self::WrongRoomKeysVersion { .. } => "M_WRONG_ROOM_KEYS_VERSION",
|
||||||
#[cfg(feature = "unstable-msc3843")]
|
#[cfg(feature = "unstable-msc3843")]
|
||||||
Self::Unactionable => "M_UNACTIONABLE",
|
Self::Unactionable => "M_UNACTIONABLE",
|
||||||
|
Self::UserLocked => "M_USER_LOCKED",
|
||||||
Self::_Custom { errcode, .. } => &errcode.0,
|
Self::_Custom { errcode, .. } => &errcode.0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -931,4 +935,28 @@ mod tests {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn serialize_user_locked() {
|
||||||
|
let error = Error::new(
|
||||||
|
http::StatusCode::UNAUTHORIZED,
|
||||||
|
ErrorBody::Standard {
|
||||||
|
kind: ErrorKind::UserLocked,
|
||||||
|
message: "This account has been locked".to_owned(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
let response = error.try_into_http_response::<Vec<u8>>().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(response.status(), http::StatusCode::UNAUTHORIZED);
|
||||||
|
let json_body: JsonValue = from_json_slice(response.body()).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
json_body,
|
||||||
|
json!({
|
||||||
|
"errcode": "M_USER_LOCKED",
|
||||||
|
"error": "This account has been locked",
|
||||||
|
"soft_logout": true,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,6 +253,7 @@ impl<'de> Visitor<'de> for ErrorKindVisitor {
|
|||||||
},
|
},
|
||||||
#[cfg(feature = "unstable-msc3843")]
|
#[cfg(feature = "unstable-msc3843")]
|
||||||
ErrCode::Unactionable => ErrorKind::Unactionable,
|
ErrCode::Unactionable => ErrorKind::Unactionable,
|
||||||
|
ErrCode::UserLocked => ErrorKind::UserLocked,
|
||||||
ErrCode::_Custom(errcode) => ErrorKind::_Custom { errcode, extra },
|
ErrCode::_Custom(errcode) => ErrorKind::_Custom { errcode, extra },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -312,6 +313,7 @@ enum ErrCode {
|
|||||||
WrongRoomKeysVersion,
|
WrongRoomKeysVersion,
|
||||||
#[cfg(feature = "unstable-msc3843")]
|
#[cfg(feature = "unstable-msc3843")]
|
||||||
Unactionable,
|
Unactionable,
|
||||||
|
UserLocked,
|
||||||
_Custom(PrivOwnedStr),
|
_Custom(PrivOwnedStr),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +334,7 @@ impl Serialize for ErrorKind {
|
|||||||
let mut st = serializer.serialize_map(None)?;
|
let mut st = serializer.serialize_map(None)?;
|
||||||
st.serialize_entry("errcode", self.as_ref())?;
|
st.serialize_entry("errcode", self.as_ref())?;
|
||||||
match self {
|
match self {
|
||||||
Self::UnknownToken { soft_logout: true } => {
|
Self::UnknownToken { soft_logout: true } | Self::UserLocked => {
|
||||||
st.serialize_entry("soft_logout", &true)?;
|
st.serialize_entry("soft_logout", &true)?;
|
||||||
}
|
}
|
||||||
Self::LimitExceeded { retry_after: Some(RetryAfter::Delay(duration)) } => {
|
Self::LimitExceeded { retry_after: Some(RetryAfter::Delay(duration)) } => {
|
||||||
|
@ -18,7 +18,7 @@ matrix = ["dep:ruma-common"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
as_variant = { workspace = true }
|
as_variant = { workspace = true }
|
||||||
html5ever = "0.28.0"
|
html5ever = "0.29.0"
|
||||||
phf = { version = "0.11.1", features = ["macros"] }
|
phf = { version = "0.11.1", features = ["macros"] }
|
||||||
ruma-common = { workspace = true, optional = true }
|
ruma-common = { workspace = true, optional = true }
|
||||||
tracing = { workspace = true, features = ["attributes"] }
|
tracing = { workspace = true, features = ["attributes"] }
|
||||||
|
@ -100,6 +100,7 @@ impl Default for Html {
|
|||||||
impl TreeSink for Html {
|
impl TreeSink for Html {
|
||||||
type Handle = NodeRef;
|
type Handle = NodeRef;
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
type ElemName<'a> = html5ever::ExpandedName<'a>;
|
||||||
|
|
||||||
fn finish(self) -> Self::Output {
|
fn finish(self) -> Self::Output {
|
||||||
self
|
self
|
||||||
|
@ -19,7 +19,7 @@ unstable-exhaustive-types = []
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
itertools = "0.12.1"
|
itertools = "0.13.0"
|
||||||
js_int = { workspace = true }
|
js_int = { workspace = true }
|
||||||
ruma-common = { workspace = true, features = ["api"] }
|
ruma-common = { workspace = true, features = ["api"] }
|
||||||
ruma-events = { workspace = true }
|
ruma-events = { workspace = true }
|
||||||
|
@ -15,7 +15,7 @@ semver = { version = "1.0.6", features = ["serde"], optional = true }
|
|||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
toml = { version = "0.8.2", default-features = false, features = ["parse"] }
|
toml = { version = "0.8.2", default-features = false, features = ["parse"] }
|
||||||
toml_edit = { version = "0.20.2", optional = true }
|
toml_edit = { version = "0.22.22", optional = true }
|
||||||
xshell = "0.1.17"
|
xshell = "0.1.17"
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
|
@ -7,7 +7,7 @@ use reqwest::blocking::Client;
|
|||||||
use semver::Version;
|
use semver::Version;
|
||||||
use serde::{de::IgnoredAny, Deserialize};
|
use serde::{de::IgnoredAny, Deserialize};
|
||||||
#[cfg(feature = "default")]
|
#[cfg(feature = "default")]
|
||||||
use toml_edit::{value, Document};
|
use toml_edit::{value, DocumentMut};
|
||||||
#[cfg(feature = "default")]
|
#[cfg(feature = "default")]
|
||||||
use xshell::{cmd, pushd, read_file, write_file};
|
use xshell::{cmd, pushd, read_file, write_file};
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ impl Package {
|
|||||||
println!("Updating {} to version {version}…", self.name);
|
println!("Updating {} to version {version}…", self.name);
|
||||||
|
|
||||||
if !dry_run {
|
if !dry_run {
|
||||||
let mut document = read_file(&self.manifest_path)?.parse::<Document>()?;
|
let mut document = read_file(&self.manifest_path)?.parse::<DocumentMut>()?;
|
||||||
|
|
||||||
document["package"]["version"] = value(version.to_string());
|
document["package"]["version"] = value(version.to_string());
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ impl Package {
|
|||||||
println!("Updating dependency in {} crate…", package.name);
|
println!("Updating dependency in {} crate…", package.name);
|
||||||
|
|
||||||
if !dry_run {
|
if !dry_run {
|
||||||
let mut document = read_file(&package.manifest_path)?.parse::<Document>()?;
|
let mut document = read_file(&package.manifest_path)?.parse::<DocumentMut>()?;
|
||||||
|
|
||||||
let version = if !self.version.pre.is_empty() {
|
let version = if !self.version.pre.is_empty() {
|
||||||
format!("={}", self.version)
|
format!("={}", self.version)
|
||||||
@ -124,7 +124,7 @@ impl Package {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let workspace_manifest_path = metadata.workspace_root.join("Cargo.toml");
|
let workspace_manifest_path = metadata.workspace_root.join("Cargo.toml");
|
||||||
let mut document = read_file(&workspace_manifest_path)?.parse::<Document>()?;
|
let mut document = read_file(&workspace_manifest_path)?.parse::<DocumentMut>()?;
|
||||||
let workspace_deps = &mut document["workspace"]["dependencies"];
|
let workspace_deps = &mut document["workspace"]["dependencies"];
|
||||||
|
|
||||||
println!("Updating workspace dependency…");
|
println!("Updating workspace dependency…");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user