YoutubeAPI: Add thirdParty/embedUrl to client context

This commit is contained in:
Samantaz Fox 2021-08-02 10:43:44 +02:00
parent 2dc141de64
commit 9f616a53b0
No known key found for this signature in database
GPG Key ID: F42821059186176E

View File

@ -156,14 +156,27 @@ module YoutubeAPI
"gl" => client_config.region || "US", # Can't be empty! "gl" => client_config.region || "US", # Can't be empty!
"clientName" => client_config.name, "clientName" => client_config.name,
"clientVersion" => client_config.version, "clientVersion" => client_config.version,
"thirdParty" => {
"embedUrl" => "", # Placeholder
},
}, },
} }
# Add some more context if it exists in the client definitions # Add some more context if it exists in the client definitions
if client_config.screen != "" if !client_config.screen.empty?
client_context["client"]["clientScreen"] = client_config.screen client_context["client"]["clientScreen"] = client_config.screen
end end
# Replacing/removing the placeholder is easier than trying to
# merge two different Hash structures.
if client_config.screen == "EMBED"
client_context["client"]["thirdParty"] = {
"embedUrl" => "https://www.youtube.com/embed/dQw4w9WgXcQ",
}
else
client_context["client"].delete("thirdParty")
end
return client_context return client_context
end end