diff --git a/src/invidious/jobs/statistics_refresh_job.cr b/src/invidious/jobs/statistics_refresh_job.cr index 2b273f5e..a2b62fbe 100644 --- a/src/invidious/jobs/statistics_refresh_job.cr +++ b/src/invidious/jobs/statistics_refresh_job.cr @@ -1,4 +1,22 @@ class Invidious::Jobs::StatisticsRefreshJob < Invidious::Jobs::BaseJob + STATISTICS_DISABLED = { + "version" => "3.0", + "software" => SOFTWARE, + "statisticsEnabled" => false, + "openRegistrations" => nil, + "usage" => { + "users" => { + "total" => nil, + "activeHalfyear" => nil, + "activeMonth" => nil, + }, + }, + "metadata" => { + "updatedAt" => nil, + "lastChannelRefreshedAt" => nil, + }, + } + STATISTICS = { "version" => "3.0", "software" => SOFTWARE, diff --git a/src/invidious/routes/api/v1/misc.cr b/src/invidious/routes/api/v1/misc.cr index f326bbfc..f69f2438 100644 --- a/src/invidious/routes/api/v1/misc.cr +++ b/src/invidious/routes/api/v1/misc.cr @@ -5,23 +5,7 @@ module Invidious::Routes::API::V1::Misc env.response.content_type = "application/json" if !CONFIG.statistics_enabled - return { - "version" => "3.0", - "software" => SOFTWARE, - "statisticsEnabled" => false, - "openRegistrations" => nil, - "usage" => { - "users" => { - "total" => nil, - "activeHalfyear" => nil, - "activeMonth" => nil, - }, - }, - "metadata" => { - "updatedAt" => nil, - "lastChannelRefreshedAt" => nil, - }, - }.to_json + return Invidious::Jobs::StatisticsRefreshJob::STATISTICS_DISABLED.to_json end Invidious::Jobs::StatisticsRefreshJob::STATISTICS.to_json