Extract API routes from invidious.cr (1/?)

This commit is contained in:
syeopite
2021-07-21 21:34:16 -07:00
parent 0b0036813f
commit cbf3d75087
6 changed files with 744 additions and 711 deletions

View File

@@ -0,0 +1,13 @@
class Invidious::Routes::V1Api < Invidious::Routes::BaseRoute
# Stats API endpoint for Invidious
def stats(env)
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