mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-07-10 08:51:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 317eabc4eb |
Generated
+7
@@ -1123,6 +1123,7 @@ dependencies = [
|
||||
"ctor",
|
||||
"cyborgtime",
|
||||
"either",
|
||||
"fastrand",
|
||||
"figment",
|
||||
"futures",
|
||||
"hardened_malloc-rs",
|
||||
@@ -1921,6 +1922,12 @@ dependencies = [
|
||||
"zune-inflate",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||
|
||||
[[package]]
|
||||
name = "fax"
|
||||
version = "0.2.6"
|
||||
|
||||
@@ -70,6 +70,10 @@ version = "0.1.3"
|
||||
[workspace.dependencies.rand]
|
||||
version = "0.8.5"
|
||||
|
||||
# used for stamps
|
||||
[workspace.dependencies.fastrand]
|
||||
version = "2.3.0"
|
||||
|
||||
# Used for the http request / response body type for Ruma endpoints used with reqwest
|
||||
[workspace.dependencies.bytes]
|
||||
version = "1.10.1"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Introduce a resolver command to allow flushing a server from the cache or to flush the complete cache. Contributed by @Omar007
|
||||
@@ -112,19 +112,6 @@ ### `!admin query resolver overrides-cache`
|
||||
|
||||
Query the overrides cache
|
||||
|
||||
### `!admin query resolver flush-cache`
|
||||
|
||||
Flush a given server from the resolver caches or flush them completely
|
||||
|
||||
* Examples:
|
||||
* Flush a specific server:
|
||||
|
||||
`!admin query resolver flush-cache matrix.example.com`
|
||||
|
||||
* Flush all resolver caches completely:
|
||||
|
||||
`!admin query resolver flush-cache --all`
|
||||
|
||||
## `!admin query pusher`
|
||||
|
||||
pusher service
|
||||
|
||||
@@ -20,16 +20,6 @@ ### Lost access to admin room
|
||||
|
||||
## General potential issues
|
||||
|
||||
### Configuration not working as expected
|
||||
|
||||
Sometimes you can make a mistake in your configuration that
|
||||
means things don't get passed to Continuwuity correctly.
|
||||
This is particularly easy to do with environment variables.
|
||||
To check what configuration Continuwuity actually sees, you can
|
||||
use the `!admin server show-config` command in your admin room.
|
||||
Beware that this prints out any secrets in your configuration,
|
||||
so you might want to delete the result afterwards!
|
||||
|
||||
### Potential DNS issues when using Docker
|
||||
|
||||
Docker's DNS setup for containers in a non-default network intercepts queries to
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use clap::Subcommand;
|
||||
use conduwuit::{Err, Result, utils::time};
|
||||
use conduwuit::{Result, utils::time};
|
||||
use futures::StreamExt;
|
||||
use ruma::OwnedServerName;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
/// Resolver service and caches
|
||||
pub enum ResolverCommand {
|
||||
/// Query the destinations cache
|
||||
@@ -19,14 +18,6 @@ pub enum ResolverCommand {
|
||||
OverridesCache {
|
||||
name: Option<String>,
|
||||
},
|
||||
|
||||
/// Flush a specific server from the resolver caches or everything
|
||||
FlushCache {
|
||||
name: Option<OwnedServerName>,
|
||||
|
||||
#[arg(short, long)]
|
||||
all: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[admin_command]
|
||||
@@ -78,18 +69,3 @@ async fn overrides_cache(&self, server_name: Option<String>) -> Result {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[admin_command]
|
||||
async fn flush_cache(&self, name: Option<OwnedServerName>, all: bool) -> Result {
|
||||
if all {
|
||||
self.services.resolver.cache.clear().await;
|
||||
writeln!(self, "Resolver caches cleared!").await
|
||||
} else if let Some(name) = name {
|
||||
self.services.resolver.cache.del_destination(&name);
|
||||
self.services.resolver.cache.del_override(&name);
|
||||
self.write_str(&format!("Cleared {name} from resolver caches!"))
|
||||
.await
|
||||
} else {
|
||||
Err!("Missing name. Supply a name or use --all to flush the whole cache.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ core_affinity.workspace = true
|
||||
ctor.workspace = true
|
||||
cyborgtime.workspace = true
|
||||
either.workspace = true
|
||||
fastrand.workspace = true
|
||||
figment.workspace = true
|
||||
futures.workspace = true
|
||||
http-body-util.workspace = true
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
pub const ARBIT_LENGTH: usize = 32;
|
||||
/// An arbit is an opaque, random 32-byte identifier.
|
||||
/// They are useful as unique, unordered database keys with no particular
|
||||
/// semantics except uniqueness.
|
||||
pub type Arbit = [u8; ARBIT_LENGTH];
|
||||
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn arbit() -> Arbit {
|
||||
let mut arbit = [0; ARBIT_LENGTH];
|
||||
fastrand::fill(&mut arbit);
|
||||
arbit
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
pub mod arbit;
|
||||
pub mod arrayvec;
|
||||
pub mod bool;
|
||||
pub mod bytes;
|
||||
|
||||
@@ -406,10 +406,6 @@ pub async fn get_admins(&self) -> Vec<OwnedUserId> {
|
||||
|
||||
/// Checks whether a given user is an admin of this server
|
||||
pub async fn user_is_admin(&self, user_id: &UserId) -> bool {
|
||||
if self.services.globals.server_user == user_id {
|
||||
return true;
|
||||
}
|
||||
|
||||
if self
|
||||
.services
|
||||
.server
|
||||
|
||||
Reference in New Issue
Block a user