mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-26 07:27:22 +00:00
Add support for '/embed/?list'
This commit is contained in:
parent
607d6125fc
commit
cfe9d47fa0
@ -532,6 +532,30 @@ get "/watch" do |env|
|
|||||||
templated "watch"
|
templated "watch"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get "/embed/" do |env|
|
||||||
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
|
|
||||||
|
if plid = env.params.query["list"]?
|
||||||
|
begin
|
||||||
|
videos = fetch_playlist_videos(plid, 1, 1, locale: locale)
|
||||||
|
rescue ex
|
||||||
|
error_message = ex.message
|
||||||
|
env.response.status_code = 500
|
||||||
|
next templated "error"
|
||||||
|
end
|
||||||
|
|
||||||
|
url = "/embed/#{videos[0].id}?#{env.params.query}"
|
||||||
|
|
||||||
|
if env.params.query.size > 0
|
||||||
|
url += "?#{env.params.query}"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
url = "/"
|
||||||
|
end
|
||||||
|
|
||||||
|
env.redirect url
|
||||||
|
end
|
||||||
|
|
||||||
get "/embed/:id" do |env|
|
get "/embed/:id" do |env|
|
||||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
id = env.params.url["id"]
|
id = env.params.url["id"]
|
||||||
|
Loading…
Reference in New Issue
Block a user