1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00

ci: check for typos

This commit is contained in:
Matthias Ahouansou 2025-03-24 01:28:42 +00:00
parent 063d13a0e1
commit 2dce87546a
No known key found for this signature in database
20 changed files with 50 additions and 32 deletions

View file

@ -61,7 +61,7 @@ If you have any questions, feel free to
If you believe you have found a security issue, please send a message to [Timo](https://matrix.to/#/@timo:conduit.rs) If you believe you have found a security issue, please send a message to [Timo](https://matrix.to/#/@timo:conduit.rs)
and/or [Matthias](https://matrix.to/#/@matthias:ahouansou.cz) on Matrix, or send an email to and/or [Matthias](https://matrix.to/#/@matthias:ahouansou.cz) on Matrix, or send an email to
[conduit@koesters.xyz](mailto:conduit@koesters.xyz). Please do not disclose details about the issue to anyone else before [conduit@koesters.xyz](mailto:conduit@koesters.xyz). Please do not disclose details about the issue to anyone else before
a fix is released publically. a fix is released publicly.
#### Thanks to #### Thanks to

View file

@ -184,7 +184,7 @@ These same values need to be set in conduit. You can either modify conduit.toml
turn_uris = ["turn:<your server domain>?transport=udp", "turn:<your server domain>?transport=tcp"] turn_uris = ["turn:<your server domain>?transport=udp", "turn:<your server domain>?transport=tcp"]
turn_secret = "<secret key from coturn configuration>" turn_secret = "<secret key from coturn configuration>"
``` ```
or append the following to the docker environment variables dependig on which configuration method you used earlier: or append the following to the docker environment variables depending on which configuration method you used earlier:
```yml ```yml
CONDUIT_TURN_URIS: '["turn:<your server domain>?transport=udp", "turn:<your server domain>?transport=tcp"]' CONDUIT_TURN_URIS: '["turn:<your server domain>?transport=udp", "turn:<your server domain>?transport=tcp"]'
CONDUIT_TURN_SECRET: "<secret key from coturn configuration>" CONDUIT_TURN_SECRET: "<secret key from coturn configuration>"

View file

@ -35,6 +35,11 @@ group = "versions"
name = "lychee" name = "lychee"
script = "lychee --version" script = "lychee --version"
[[task]]
group = "versions"
name = "typos"
script = "typos --version"
[[task]] [[task]]
group = "lints" group = "lints"
name = "cargo-fmt" name = "cargo-fmt"
@ -66,6 +71,11 @@ group = "lints"
name = "lychee" name = "lychee"
script = "lychee --offline docs" script = "lychee --offline docs"
[[task]]
group = "lints"
name = "typos"
script = "typos"
[[task]] [[task]]
group = "tests" group = "tests"
name = "cargo" name = "cargo"

View file

@ -12,6 +12,7 @@
, system , system
, taplo , taplo
, toolchain , toolchain
, typos
}: }:
mkShell { mkShell {
@ -55,6 +56,9 @@ mkShell {
# Needed for finding broken markdown links # Needed for finding broken markdown links
lychee lychee
# Needed for checking for typos
typos
# Useful for editing the book locally # Useful for editing the book locally
mdbook mdbook
] ++ default.nativeBuildInputs ; ] ++ default.nativeBuildInputs ;

View file

@ -64,7 +64,7 @@ pub async fn ping_appservice_route(
} }
Error::BadServerResponse(_) => Error::BadRequest( Error::BadServerResponse(_) => Error::BadRequest(
ErrorKind::ConnectionFailed, ErrorKind::ConnectionFailed,
"Recieved invalid response from appservice", "Received invalid response from appservice",
), ),
e => e, e => e,
}) })

View file

@ -6,7 +6,7 @@ use std::collections::BTreeMap;
/// # `GET /_matrix/client/r0/capabilities` /// # `GET /_matrix/client/r0/capabilities`
/// ///
/// Get information on the supported feature set and other relevent capabilities of this server. /// Get information on the supported feature set and other relevant capabilities of this server.
pub async fn get_capabilities_route( pub async fn get_capabilities_route(
_body: Ruma<get_capabilities::v3::Request>, _body: Ruma<get_capabilities::v3::Request>,
) -> Result<get_capabilities::v3::Response> { ) -> Result<get_capabilities::v3::Response> {

View file

@ -507,7 +507,7 @@ async fn find_actual_destination(
} }
} }
None => { None => {
debug!("4: No .well-known or an error occured"); debug!("4: No .well-known or an error occurred");
let (dest, expires) = get_srv_destination(destination_str).await; let (dest, expires) = get_srv_destination(destination_str).await;
let well_known_retry = Instant::now() let well_known_retry = Instant::now()
+ Duration::from_secs((60 * next_backoff_mins).into()); + Duration::from_secs((60 * next_backoff_mins).into());

View file

@ -111,7 +111,7 @@ pub struct KeyValueDatabase {
pub(super) lazyloadedids: Arc<dyn KvTree>, // LazyLoadedIds = UserId + DeviceId + RoomId + LazyLoadedUserId pub(super) lazyloadedids: Arc<dyn KvTree>, // LazyLoadedIds = UserId + DeviceId + RoomId + LazyLoadedUserId
pub(super) userroomid_notificationcount: Arc<dyn KvTree>, // NotifyCount = u64 pub(super) userroomid_notificationcount: Arc<dyn KvTree>, // NotifyCount = u64
pub(super) userroomid_highlightcount: Arc<dyn KvTree>, // HightlightCount = u64 pub(super) userroomid_highlightcount: Arc<dyn KvTree>, // HighlightCount = u64
pub(super) roomuserid_lastnotificationread: Arc<dyn KvTree>, // LastNotificationRead = u64 pub(super) roomuserid_lastnotificationread: Arc<dyn KvTree>, // LastNotificationRead = u64
/// Remember the current state hash of a room. /// Remember the current state hash of a room.

View file

@ -6,7 +6,7 @@ mod service;
mod utils; mod utils;
// Not async due to services() being used in many closures, and async closures are not stable as of writing // Not async due to services() being used in many closures, and async closures are not stable as of writing
// This is the case for every other occurence of sync Mutex/RwLock, except for database related ones, where // This is the case for every other occurrence of sync Mutex/RwLock, except for database related ones, where
// the current maintainer (Timo) has asked to not modify those // the current maintainer (Timo) has asked to not modify those
use std::sync::RwLock; use std::sync::RwLock;

View file

@ -126,7 +126,7 @@ async fn main() {
let filter_layer = match EnvFilter::try_new(&config.log) { let filter_layer = match EnvFilter::try_new(&config.log) {
Ok(s) => s, Ok(s) => s,
Err(e) => { Err(e) => {
eprintln!("It looks like your config is invalid. The following error occured while parsing it: {e}"); eprintln!("It looks like your config is invalid. The following error occurred while parsing it: {e}");
EnvFilter::try_new("warn").unwrap() EnvFilter::try_new("warn").unwrap()
} }
}; };

View file

@ -723,7 +723,7 @@ impl Service {
let mut user_ids = Vec::new(); let mut user_ids = Vec::new();
let mut remote_ids = Vec::new(); let mut remote_ids = Vec::new();
let mut non_existant_ids = Vec::new(); let mut non_existent_ids = Vec::new();
let mut invalid_users = Vec::new(); let mut invalid_users = Vec::new();
for &user in &users { for &user in &users {
@ -732,7 +732,7 @@ impl Service {
if user_id.server_name() != services().globals.server_name() { if user_id.server_name() != services().globals.server_name() {
remote_ids.push(user_id) remote_ids.push(user_id)
} else if !services().users.exists(user_id)? { } else if !services().users.exists(user_id)? {
non_existant_ids.push(user_id) non_existent_ids.push(user_id)
} else { } else {
user_ids.push(user_id) user_ids.push(user_id)
} }
@ -767,12 +767,12 @@ impl Service {
markdown_message.push_str("```\n\n"); markdown_message.push_str("```\n\n");
html_message.push_str("</pre>\n\n"); html_message.push_str("</pre>\n\n");
} }
if !non_existant_ids.is_empty() { if !non_existent_ids.is_empty() {
markdown_message.push_str("The following users do not exist:\n```\n"); markdown_message.push_str("The following users do not exist:\n```\n");
html_message.push_str("The following users do not exist:\n<pre>\n"); html_message.push_str("The following users do not exist:\n<pre>\n");
for non_existant_id in non_existant_ids { for non_existent_id in non_existent_ids {
markdown_message.push_str(&format!("{non_existant_id}\n")); markdown_message.push_str(&format!("{non_existent_id}\n"));
html_message.push_str(&format!("{non_existant_id}\n")); html_message.push_str(&format!("{non_existent_id}\n"));
} }
markdown_message.push_str("```\n\n"); markdown_message.push_str("```\n\n");
html_message.push_str("</pre>\n\n"); html_message.push_str("</pre>\n\n");
@ -962,7 +962,7 @@ impl Service {
.rooms .rooms
.alias .alias
.remove_alias(&alias, services().globals.server_user())?; .remove_alias(&alias, services().globals.server_user())?;
RoomMessageEventContent::text_plain("Alias removed sucessfully") RoomMessageEventContent::text_plain("Alias removed successfully")
} }
} }
}; };

View file

@ -36,7 +36,7 @@ impl NamespaceRegex {
false false
} }
/// Checks if this namespace has exlusive rights to a namespace /// Checks if this namespace has exclusive rights to a namespace
pub fn is_exclusive_match(&self, heystack: &str) -> bool { pub fn is_exclusive_match(&self, heystack: &str) -> bool {
if let Some(exclusive) = &self.exclusive { if let Some(exclusive) = &self.exclusive {
if exclusive.is_match(heystack) { if exclusive.is_match(heystack) {

View file

@ -80,14 +80,14 @@ pub trait Data: Send + Sync {
fn load_keypair(&self) -> Result<Ed25519KeyPair>; fn load_keypair(&self) -> Result<Ed25519KeyPair>;
fn remove_keypair(&self) -> Result<()>; fn remove_keypair(&self) -> Result<()>;
/// Only extends the cached keys, not moving any verify_keys to old_verify_keys, as if we suddenly /// Only extends the cached keys, not moving any verify_keys to old_verify_keys, as if we suddenly
/// recieve requests from the origin server, we want to be able to accept requests from them /// receive requests from the origin server, we want to be able to accept requests from them
fn add_signing_key_from_trusted_server( fn add_signing_key_from_trusted_server(
&self, &self,
origin: &ServerName, origin: &ServerName,
new_keys: ServerSigningKeys, new_keys: ServerSigningKeys,
) -> Result<SigningKeys>; ) -> Result<SigningKeys>;
/// Extends cached keys, as well as moving verify_keys that are not present in these new keys to /// Extends cached keys, as well as moving verify_keys that are not present in these new keys to
/// old_verify_keys, so that potnetially comprimised keys cannot be used to make requests /// old_verify_keys, so that potnetially compromised keys cannot be used to make requests
fn add_signing_key_from_origin( fn add_signing_key_from_origin(
&self, &self,
origin: &ServerName, origin: &ServerName,

View file

@ -305,7 +305,7 @@ impl Service {
self.config.max_fetch_prev_events self.config.max_fetch_prev_events
} }
/// Allows for the temporary (non-persistant) toggling of registration /// Allows for the temporary (non-persistent) toggling of registration
pub async fn set_registration(&self, status: bool) { pub async fn set_registration(&self, status: bool) {
let mut lock = self.allow_registration.write().await; let mut lock = self.allow_registration.write().await;
*lock = status; *lock = status;
@ -404,7 +404,7 @@ impl Service {
} }
/// Filters the key map of multiple servers down to keys that should be accepted given the expiry time, /// Filters the key map of multiple servers down to keys that should be accepted given the expiry time,
/// room version, and timestamp of the paramters /// room version, and timestamp of the parameters
pub fn filter_keys_server_map( pub fn filter_keys_server_map(
&self, &self,
keys: BTreeMap<String, SigningKeys>, keys: BTreeMap<String, SigningKeys>,
@ -420,7 +420,7 @@ impl Service {
} }
/// Filters the keys of a single server down to keys that should be accepted given the expiry time, /// Filters the keys of a single server down to keys that should be accepted given the expiry time,
/// room version, and timestamp of the paramters /// room version, and timestamp of the parameters
pub fn filter_keys_single_server( pub fn filter_keys_single_server(
&self, &self,
keys: SigningKeys, keys: SigningKeys,

View file

@ -69,7 +69,7 @@ impl Service {
/// trust a set of state we got from a remote) /// trust a set of state we got from a remote)
/// 13. Use state resolution to find new room state /// 13. Use state resolution to find new room state
/// 14. Check if the event passes auth based on the "current state" of the room, if not soft fail it /// 14. Check if the event passes auth based on the "current state" of the room, if not soft fail it
// We use some AsyncRecursiveType hacks here so we can call this async funtion recursively // We use some AsyncRecursiveType hacks here so we can call this async function recursively
#[tracing::instrument(skip(self, value, is_timeline_event, pub_key_map))] #[tracing::instrument(skip(self, value, is_timeline_event, pub_key_map))]
pub(crate) async fn handle_incoming_pdu<'a>( pub(crate) async fn handle_incoming_pdu<'a>(
&self, &self,
@ -1786,7 +1786,7 @@ impl Service {
.expect("Should be valid until year 500,000,000"); .expect("Should be valid until year 500,000,000");
debug!( debug!(
"The treshhold is {:?}, found time is {:?} for server {}", "The threshold is {:?}, found time is {:?} for server {}",
ts_threshold, result.valid_until_ts, origin ts_threshold, result.valid_until_ts, origin
); );

View file

@ -39,7 +39,7 @@ pub struct Service;
impl Service { impl Service {
/// Attempts to join a room. /// Attempts to join a room.
/// If the room cannot be joined locally, it attempts to join over federation, soley using the /// If the room cannot be joined locally, it attempts to join over federation, solely using the
/// specified servers /// specified servers
#[tracing::instrument(skip(self, reason, servers, _third_party_signed))] #[tracing::instrument(skip(self, reason, servers, _third_party_signed))]
pub async fn join_room_by_id( pub async fn join_room_by_id(

View file

@ -227,7 +227,7 @@ impl Service {
.as_ref() .as_ref()
{ {
return Ok(if let Some(cached) = cached { return Ok(if let Some(cached) = cached {
if is_accessable_child( if is_accessible_child(
current_room, current_room,
&cached.summary.join_rule, &cached.summary.join_rule,
&identifier, &identifier,
@ -338,7 +338,7 @@ impl Service {
); );
} }
} }
if is_accessable_child( if is_accessible_child(
current_room, current_room,
&response.room.join_rule, &response.room.join_rule,
&Identifier::UserId(user_id), &Identifier::UserId(user_id),
@ -408,7 +408,7 @@ impl Service {
.state_accessor .state_accessor
.allowed_room_ids(join_rule.clone()); .allowed_room_ids(join_rule.clone());
if !is_accessable_child( if !is_accessible_child(
current_room, current_room,
&join_rule.clone().into(), &join_rule.clone().into(),
&identifier, &identifier,
@ -678,8 +678,8 @@ async fn get_stripped_space_child_events(
} }
} }
/// With the given identifier, checks if a room is accessable /// With the given identifier, checks if a room is accessible
fn is_accessable_child( fn is_accessible_child(
current_room: &OwnedRoomId, current_room: &OwnedRoomId,
join_rule: &SpaceRoomJoinRule, join_rule: &SpaceRoomJoinRule,
identifier: &Identifier<'_>, identifier: &Identifier<'_>,

View file

@ -463,7 +463,7 @@ impl Service {
// Here we don't attempt to join if the previous membership was knock and the // Here we don't attempt to join if the previous membership was knock and the
// new one is join, like we do for `/federation/*/invite`, as not only are there // new one is join, like we do for `/federation/*/invite`, as not only are there
// implementation difficulties due to callers not implementing `Send`, but // implementation difficulties due to callers not implementing `Send`, but
// invites we recieve which aren't over `/invite` must have been due to a // invites we receive which aren't over `/invite` must have been due to a
// database reset or switching server implementations, which means we probably // database reset or switching server implementations, which means we probably
// shouldn't be joining automatically anyways, since it may surprise users to // shouldn't be joining automatically anyways, since it may surprise users to
// suddenly join rooms which clients didn't even show as being knocked on before. // suddenly join rooms which clients didn't even show as being knocked on before.

View file

@ -537,7 +537,7 @@ impl Service {
( (
kind.clone(), kind.clone(),
Error::bad_database( Error::bad_database(
"[Push] Event in servernamevent_datas not found in db.", "[Push] Event in servernamevent_data not found in db.",
), ),
) )
})?, })?,
@ -621,7 +621,7 @@ impl Service {
( (
OutgoingKind::Normal(server.clone()), OutgoingKind::Normal(server.clone()),
Error::bad_database( Error::bad_database(
"[Normal] Event in servernamevent_datas not found in db.", "[Normal] Event in servernamevent_data not found in db.",
), ),
) )
})?, })?,

4
typos.toml Normal file
View file

@ -0,0 +1,4 @@
[files]
# From my understanding, they are automatically generated
# Plus, systest hasn't been used in who knows how long
extend-exclude = ["tests/**"]