1 use crate::websocket::chat_server::ChatServer;
2 use lemmy_db_schema::{source::secret::Secret, utils::DbPool};
4 rate_limit::RateLimitCell,
5 settings::{structs::Settings, SETTINGS},
7 use reqwest_middleware::ClientWithMiddleware;
10 pub struct LemmyContext {
12 chat_server: Arc<ChatServer>,
13 client: ClientWithMiddleware,
16 rate_limit_cell: RateLimitCell,
22 chat_server: Arc<ChatServer>,
23 client: ClientWithMiddleware,
26 rate_limit_cell: RateLimitCell,
37 pub fn pool(&self) -> &DbPool {
40 pub fn chat_server(&self) -> &Arc<ChatServer> {
43 pub fn client(&self) -> &ClientWithMiddleware {
46 pub fn settings(&self) -> &'static Settings {
49 pub fn secret(&self) -> &Secret {
52 pub fn settings_updated_channel(&self) -> &RateLimitCell {
57 impl Clone for LemmyContext {
58 fn clone(&self) -> Self {
60 pool: self.pool.clone(),
61 chat_server: self.chat_server.clone(),
62 client: self.client.clone(),
63 settings: self.settings.clone(),
64 secret: self.secret.clone(),
65 rate_limit_cell: self.rate_limit_cell.clone(),