mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-06 22:36:10 +02:00
Some checks failed
Release Docker Image / define-variables (push) Failing after 1s
Release Docker Image / build-image (linux/amd64, linux-amd64) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, linux-arm64) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Rust Checks / Format (push) Failing after 1s
Rust Checks / Clippy (push) Failing after 9s
Rust Checks / Cargo Test (push) Failing after 10s
The first part of getting admin command docs on the website. Next is is including it in the same way we do the example config or readme. There's also the beginnings of manpage generation here, although it's kinda sus and I'm not sure how it's supposed to work. I'll leave that to anyone who wants to package it. We introduce the beginings of the xtask pattern here - we do a lot of file generation, I thought it would be best to avoid doing that on every compilation. It also helps avoid lots of runtime deps. We'll need to document generating this stuff & probably add pre-commit hooks for it, though.
60 lines
1.4 KiB
Rust
60 lines
1.4 KiB
Rust
#![recursion_limit = "192"]
|
|
#![allow(clippy::wildcard_imports)]
|
|
#![allow(clippy::enum_glob_use)]
|
|
#![allow(clippy::too_many_arguments)]
|
|
|
|
pub(crate) mod admin;
|
|
pub(crate) mod context;
|
|
pub(crate) mod processor;
|
|
mod tests;
|
|
pub(crate) mod utils;
|
|
|
|
pub(crate) mod appservice;
|
|
pub(crate) mod check;
|
|
pub(crate) mod debug;
|
|
pub(crate) mod federation;
|
|
pub(crate) mod media;
|
|
pub(crate) mod query;
|
|
pub(crate) mod room;
|
|
pub(crate) mod server;
|
|
pub(crate) mod user;
|
|
|
|
extern crate conduwuit_api as api;
|
|
extern crate conduwuit_core as conduwuit;
|
|
extern crate conduwuit_service as service;
|
|
|
|
pub(crate) use conduwuit_macros::{admin_command, admin_command_dispatch};
|
|
|
|
pub(crate) use crate::{context::Context, utils::get_room_info};
|
|
|
|
pub(crate) const PAGE_SIZE: usize = 100;
|
|
|
|
conduwuit::mod_ctor! {}
|
|
conduwuit::mod_dtor! {}
|
|
conduwuit::rustc_flags_capture! {}
|
|
|
|
pub use crate::admin::AdminCommand;
|
|
|
|
/// Install the admin command processor
|
|
pub async fn init(admin_service: &service::admin::Service) {
|
|
_ = admin_service
|
|
.complete
|
|
.write()
|
|
.expect("locked for writing")
|
|
.insert(processor::complete);
|
|
_ = admin_service
|
|
.handle
|
|
.write()
|
|
.await
|
|
.insert(processor::dispatch);
|
|
}
|
|
|
|
/// Uninstall the admin command handler
|
|
pub async fn fini(admin_service: &service::admin::Service) {
|
|
_ = admin_service.handle.write().await.take();
|
|
_ = admin_service
|
|
.complete
|
|
.write()
|
|
.expect("locked for writing")
|
|
.take();
|
|
}
|