From dbba9d76872a463c8f2a60e42a973e9591c4fc1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Fri, 18 Feb 2022 17:23:16 +0100 Subject: [PATCH 1/2] Expose version in /api/v1/stats with statistic disabled --- docker-compose.yml | 1 + src/invidious/routes/api/v1/misc.cr | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c76c314c..1c853a08 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: dbname: invidious full_refresh: false https_only: false + statistics_enabled: false domain: healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1 diff --git a/src/invidious/routes/api/v1/misc.cr b/src/invidious/routes/api/v1/misc.cr index a1ce0cbc..844fedb8 100644 --- a/src/invidious/routes/api/v1/misc.cr +++ b/src/invidious/routes/api/v1/misc.cr @@ -4,10 +4,10 @@ module Invidious::Routes::API::V1::Misc env.response.content_type = "application/json" if !CONFIG.statistics_enabled - return error_json(400, "Statistics are not enabled.") + return {"software" => SOFTWARE}.to_json + else + return Invidious::Jobs::StatisticsRefreshJob::STATISTICS.to_json end - - Invidious::Jobs::StatisticsRefreshJob::STATISTICS.to_json end # APIv1 currently uses the same logic for both From d0d8ba00683b61f85edf5712afb67f1e22efb72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 00:09:15 +0100 Subject: [PATCH 2/2] Remove useless config inside docker-compose Follow lint indications : https://github.com/iv-org/invidious/pull/2910#discussion_r811367959 --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1c853a08..c76c314c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,6 @@ services: dbname: invidious full_refresh: false https_only: false - statistics_enabled: false domain: healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1