2021-11-07 08:52:57 +00:00
|
|
|
use actix_web::{get, web, HttpResponse, Scope};
|
2021-04-09 00:22:17 +00:00
|
|
|
|
|
|
|
use crate::config::Config;
|
|
|
|
use crate::errors::HttpError;
|
|
|
|
use super::types::Instance;
|
|
|
|
|
2021-11-07 08:52:57 +00:00
|
|
|
#[get("")]
|
|
|
|
async fn instance_view(
|
|
|
|
config: web::Data<Config>,
|
2021-04-09 00:22:17 +00:00
|
|
|
) -> Result<HttpResponse, HttpError> {
|
2021-11-07 08:52:57 +00:00
|
|
|
let instance = Instance::from(config.as_ref());
|
2021-04-09 00:22:17 +00:00
|
|
|
Ok(HttpResponse::Ok().json(instance))
|
|
|
|
}
|
2021-11-07 08:52:57 +00:00
|
|
|
|
|
|
|
pub fn instance_api_scope() -> Scope {
|
|
|
|
web::scope("/api/v1/instance")
|
|
|
|
.service(instance_view)
|
|
|
|
}
|