Skip to main content

max / makenotwork

1.5 KB · 51 lines History Blame Raw
1 //! Multithreaded: MNW-integrated forum software.
2 //!
3 //! # Design
4 //!
5 //! The competitive positioning, moderation policy, and rollback runbook live in
6 //! the maintainer wiki; audit and fuzz findings are tracked as problems in
7 //! GoingsOn.
8 //! <!-- wiki: mt-overview -->
9
10 pub mod auth;
11 pub mod chat;
12 pub mod config;
13 pub mod csrf;
14 pub mod error_page;
15 pub mod internal_auth;
16 pub mod link_preview;
17 pub mod maintenance;
18 pub mod routes;
19 pub mod seed;
20 pub mod static_assets;
21 pub mod storage;
22 pub mod templates;
23 pub mod tls;
24 pub mod trust_store;
25 pub mod trusted_proxy;
26
27 use config::Config;
28 use sqlx::PgPool;
29 use std::sync::Arc;
30
31 /// Shared application state available to all handlers.
32 #[derive(Clone)]
33 pub struct AppState {
34 pub db: PgPool,
35 pub config: Config,
36 pub http: reqwest::Client,
37 /// Link preview fetcher. `LinkPreviewFetcher::Http` in production with an
38 /// SSRF-safe redirect policy; `LinkPreviewFetcher::Noop` in tests.
39 pub link_preview: link_preview::LinkPreviewFetcher,
40 pub s3: Option<Arc<storage::S3Storage>>,
41 /// Live chat: the fan-out hub and the per-(user, room) send budgets.
42 ///
43 /// One per process. Rooms are created lazily when someone listens and
44 /// pruned when the last listener leaves, so a deployment where no community
45 /// has chat enabled carries an empty map and nothing else.
46 pub chat: Arc<livechat::Chat>,
47 /// Display names and avatars for chat, cached with a TTL and a hard cap.
48 /// Shared with the profile-update path, which invalidates on rename.
49 pub chat_identities: chat::IdentityCache,
50 }
51