mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-09-11 03:05:58 +03:00
Add /api/{alive,now,version}
endpoints
The added endpoints work the same as in their upstream implementations. Upstream also implements `/api/ip`. This seems to include the server's public IP address (the one that should be hidden behind Cloudflare), which doesn't seem like a great idea.
This commit is contained in:
@@ -5,6 +5,7 @@ use rocket::{fs::NamedFile, http::ContentType, Route};
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::{
|
||||
api::core::now,
|
||||
error::Error,
|
||||
util::{Cached, SafeString},
|
||||
CONFIG,
|
||||
@@ -71,10 +72,7 @@ async fn attachments(uuid: SafeString, file_id: SafeString) -> Option<NamedFile>
|
||||
use crate::db::DbConn;
|
||||
#[get("/alive")]
|
||||
fn alive(_conn: DbConn) -> Json<String> {
|
||||
use crate::util::format_date;
|
||||
use chrono::Utc;
|
||||
|
||||
Json(format_date(&Utc::now().naive_utc()))
|
||||
now()
|
||||
}
|
||||
|
||||
#[get("/vw_static/<filename>")]
|
||||
|
Reference in New Issue
Block a user