mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-12-01 04:47:32 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
317eabc4eb |
No files matched your search
Generated
+7
@@ -1123,6 +1123,7 @@ dependencies = [
|
|||||||
"ctor",
|
"ctor",
|
||||||
"cyborgtime",
|
"cyborgtime",
|
||||||
"either",
|
"either",
|
||||||
|
"fastrand",
|
||||||
"figment",
|
"figment",
|
||||||
"futures",
|
"futures",
|
||||||
"hardened_malloc-rs",
|
"hardened_malloc-rs",
|
||||||
@@ -1921,6 +1922,12 @@ dependencies = [
|
|||||||
"zune-inflate",
|
"zune-inflate",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fastrand"
|
||||||
|
version = "2.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fax"
|
name = "fax"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ version = "0.1.3"
|
|||||||
[workspace.dependencies.rand]
|
[workspace.dependencies.rand]
|
||||||
version = "0.8.5"
|
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
|
# Used for the http request / response body type for Ruma endpoints used with reqwest
|
||||||
[workspace.dependencies.bytes]
|
[workspace.dependencies.bytes]
|
||||||
version = "1.10.1"
|
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 @@ Query the destinations cache
|
|||||||
|
|
||||||
Query the 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`
|
## `!admin query pusher`
|
||||||
|
|
||||||
pusher service
|
pusher service
|
||||||
|
|||||||
@@ -20,16 +20,6 @@ log into the server account (`@conduit`) from a web client
|
|||||||
|
|
||||||
## General potential issues
|
## 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
|
### Potential DNS issues when using Docker
|
||||||
|
|
||||||
Docker's DNS setup for containers in a non-default network intercepts queries to
|
Docker's DNS setup for containers in a non-default network intercepts queries to
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use clap::Subcommand;
|
use clap::Subcommand;
|
||||||
use conduwuit::{Err, Result, utils::time};
|
use conduwuit::{Result, utils::time};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::OwnedServerName;
|
use ruma::OwnedServerName;
|
||||||
|
|
||||||
@@ -7,7 +7,6 @@ use crate::{admin_command, admin_command_dispatch};
|
|||||||
|
|
||||||
#[admin_command_dispatch]
|
#[admin_command_dispatch]
|
||||||
#[derive(Debug, Subcommand)]
|
#[derive(Debug, Subcommand)]
|
||||||
#[allow(clippy::enum_variant_names)]
|
|
||||||
/// Resolver service and caches
|
/// Resolver service and caches
|
||||||
pub enum ResolverCommand {
|
pub enum ResolverCommand {
|
||||||
/// Query the destinations cache
|
/// Query the destinations cache
|
||||||
@@ -19,14 +18,6 @@ pub enum ResolverCommand {
|
|||||||
OverridesCache {
|
OverridesCache {
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Flush a specific server from the resolver caches or everything
|
|
||||||
FlushCache {
|
|
||||||
name: Option<OwnedServerName>,
|
|
||||||
|
|
||||||
#[arg(short, long)]
|
|
||||||
all: bool,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[admin_command]
|
#[admin_command]
|
||||||
@@ -78,18 +69,3 @@ async fn overrides_cache(&self, server_name: Option<String>) -> Result {
|
|||||||
|
|
||||||
Ok(())
|
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
|
ctor.workspace = true
|
||||||
cyborgtime.workspace = true
|
cyborgtime.workspace = true
|
||||||
either.workspace = true
|
either.workspace = true
|
||||||
|
fastrand.workspace = true
|
||||||
figment.workspace = true
|
figment.workspace = true
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
http-body-util.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 arrayvec;
|
||||||
pub mod bool;
|
pub mod bool;
|
||||||
pub mod bytes;
|
pub mod bytes;
|
||||||
|
|||||||
@@ -406,10 +406,6 @@ impl Service {
|
|||||||
|
|
||||||
/// Checks whether a given user is an admin of this server
|
/// Checks whether a given user is an admin of this server
|
||||||
pub async fn user_is_admin(&self, user_id: &UserId) -> bool {
|
pub async fn user_is_admin(&self, user_id: &UserId) -> bool {
|
||||||
if self.services.globals.server_user == user_id {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self
|
if self
|
||||||
.services
|
.services
|
||||||
.server
|
.server
|
||||||
|
|||||||
Reference in new issue
Block a user