mcaptcha/api/v1/
mod.rs

1// Copyright (C) 2022  Aravinth Manivannan <realaravinth@batsense.net>
2// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
3//
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6use actix_auth_middleware::Authentication;
7use actix_web::web::ServiceConfig;
8use serde::Deserialize;
9
10pub mod account;
11pub mod auth;
12pub mod mcaptcha;
13pub mod meta;
14pub mod notifications;
15pub mod pow;
16mod routes;
17pub mod stats;
18pub mod survey;
19
20pub use routes::ROUTES;
21
22pub fn services(cfg: &mut ServiceConfig) {
23    meta::services(cfg);
24    pow::services(cfg);
25    auth::services(cfg);
26    account::services(cfg);
27    mcaptcha::services(cfg);
28    notifications::services(cfg);
29    survey::services(cfg);
30    stats::services(cfg);
31}
32
33#[derive(Deserialize)]
34pub struct RedirectQuery {
35    pub redirect_to: Option<String>,
36}
37
38pub fn get_middleware() -> Authentication<routes::Routes> {
39    Authentication::with_identity(ROUTES)
40}
41
42#[cfg(test)]
43mod tests;