add server version to /api response

Fixes #171
This commit is contained in:
Scott Lamb
2021-10-27 13:09:20 -07:00
parent 46ac812d3e
commit 4aab6baebb
3 changed files with 4 additions and 0 deletions

View File

@@ -15,6 +15,8 @@ use uuid::Uuid;
pub struct TopLevel<'a> {
pub time_zone_name: &'a str,
pub server_version: &'static str,
// Use a custom serializer which presents the map's values as a sequence and includes the
// "days" and "camera_configs" attributes or not, according to the respective bools.
#[serde(serialize_with = "TopLevel::serialize_cameras")]

View File

@@ -679,6 +679,7 @@ impl Service {
req,
&json::TopLevel {
time_zone_name: &self.time_zone_name,
server_version: env!("CARGO_PKG_VERSION"),
cameras: (&db, days, camera_configs),
user: caller.user,
signals: (&db, days),