mirror of
https://github.com/iv-org/invidious.git
synced 2025-11-23 09:55:29 +00:00
Move remaining routes to new structure
This commit is contained in:
@@ -397,4 +397,22 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
|
||||
env.response.status_code = 204
|
||||
end
|
||||
|
||||
def self.notifications_get(env)
|
||||
env.response.content_type = "text/event-stream"
|
||||
|
||||
topics = env.params.query["topics"]?.try &.split(",").uniq.first(1000)
|
||||
topics ||= [] of String
|
||||
|
||||
create_notification_stream(env, topics, CONNECTION_CHANNEL)
|
||||
end
|
||||
|
||||
def self.notifications_post(env)
|
||||
env.response.content_type = "text/event-stream"
|
||||
|
||||
topics = env.params.body["topics"]?.try &.split(",").uniq.first(1000)
|
||||
topics ||= [] of String
|
||||
|
||||
create_notification_stream(env, topics, CONNECTION_CHANNEL)
|
||||
end
|
||||
end
|
||||
|
||||
8
src/invidious/routes/captcha.cr
Normal file
8
src/invidious/routes/captcha.cr
Normal file
@@ -0,0 +1,8 @@
|
||||
module Invidious::Routes::Captcha
|
||||
def self.get(env)
|
||||
headers = HTTP::Headers{":authority" => "accounts.google.com"}
|
||||
response = YT_POOL.client &.get(env.request.resource, headers)
|
||||
env.response.headers["Content-Type"] = response.headers["Content-Type"]
|
||||
response.body
|
||||
end
|
||||
end
|
||||
@@ -443,4 +443,15 @@ module Invidious::Routes::Playlists
|
||||
|
||||
templated "mix"
|
||||
end
|
||||
|
||||
# Undocumented, creates anonymous playlist with specified 'video_ids', max 50 videos
|
||||
def self.watch_videos(env)
|
||||
response = YT_POOL.client &.get(env.request.resource)
|
||||
if url = response.headers["Location"]?
|
||||
url = URI.parse(url).request_target
|
||||
return env.redirect url
|
||||
end
|
||||
|
||||
env.response.status_code = response.status_code
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user