mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
add features endpoint
This commit is contained in:
@@ -22,6 +22,7 @@ use crate::common::log::Tracing;
|
||||
use crate::common::tls::rustls_config;
|
||||
use crate::common::timeout::{Timeout, TIMEOUT_HEADER};
|
||||
use crate::error::handler::error_handler;
|
||||
use crate::rest::public::features::get_features;
|
||||
use crate::rest::public::login::login;
|
||||
use crate::rest::public::status::get_status;
|
||||
use bichon_core::common::signal::SIGNAL_MANAGER;
|
||||
@@ -110,6 +111,7 @@ pub fn build_routes() -> impl Endpoint {
|
||||
.nest("/api-docs/spec.json", spec_json)
|
||||
.nest("/api-docs/spec.yaml", spec_yaml)
|
||||
.nest("/oauth2/callback", get(oauth2_callback))
|
||||
.nest("/api/v1/features", get(get_features))
|
||||
.nest("/api/status", get(get_status))
|
||||
.nest("/api/login", post(login))
|
||||
.nest_no_strip("/api/v1", open_api_route);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Copyright (c) 2025-2026 rustmailer.com (https://rustmailer.com)
|
||||
//
|
||||
// This file is part of the Bichon Email Archiving Project
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use poem::{handler, web::Json, IntoResponse};
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct FeaturesResponse {
|
||||
features: Vec<String>,
|
||||
edition: &'static str,
|
||||
version: String,
|
||||
}
|
||||
|
||||
#[handler]
|
||||
pub async fn get_features() -> impl IntoResponse {
|
||||
Json(FeaturesResponse {
|
||||
features: vec![],
|
||||
edition: "community",
|
||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
})
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
pub mod features;
|
||||
pub mod login;
|
||||
pub mod oauth2;
|
||||
pub mod status;
|
||||
|
||||
Reference in New Issue
Block a user