add config for max views, expiration and advanced

This commit is contained in:
2022-03-01 15:24:17 +01:00
parent ef39f9ec0b
commit d112eba8fe
9 changed files with 220 additions and 133 deletions

View File

@@ -1,25 +1,12 @@
use actix_web::{get, web, HttpResponse, Responder};
use serde::{Deserialize, Serialize};
use actix_web::web;
use crate::note;
use crate::size::LIMIT;
#[derive(Serialize, Deserialize)]
struct Status {
version: String,
max_size: usize,
}
#[get("/status")]
async fn status() -> impl Responder {
return HttpResponse::Ok().json(Status {
version: option_env!("CARGO_PKG_VERSION")
.unwrap_or("Unknown")
.to_string(),
max_size: *LIMIT,
});
}
use crate::status;
pub fn init(cfg: &mut web::ServiceConfig) {
cfg.service(web::scope("/api").service(note::service()).service(status));
cfg.service(
web::scope("/api")
.service(note::init())
.service(status::init()),
);
}