mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2026-01-07 07:21:28 +00:00
Extract API routes from invidious.cr (1/?)
This commit is contained in:
13
src/invidious/routes/API/v1/misc.cr
Normal file
13
src/invidious/routes/API/v1/misc.cr
Normal 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
|
||||
Reference in New Issue
Block a user