2021-08-13 03:46:03 +09:00
|
|
|
module Invidious::Routes::APIv1
|
2021-07-22 13:34:16 +09:00
|
|
|
# Stats API endpoint for Invidious
|
2021-08-13 03:46:03 +09:00
|
|
|
def self.stats(env)
|
2021-07-22 13:34:16 +09:00
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
env.response.content_type = "application/json"
|
|
|
|
|
|
|
|
if !CONFIG.statistics_enabled
|
|
|
|
return error_json(400, "Statistics are not enabled.")
|
|
|
|
end
|
|
|
|
|
|
|
|
Invidious::Jobs::StatisticsRefreshJob::STATISTICS.to_json
|
|
|
|
end
|
|
|
|
end
|