mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Merge pull request #1552 from azhao-squareup/master
do not proxy hls livestrem on supported browser
This commit is contained in:
commit
28ca5b2b57
3 changed files with 10 additions and 1 deletions
|
@ -41,8 +41,16 @@ var shareOptions = {
|
||||||
embedCode: "<iframe id='ivplayer' width='640' height='360' src='" + embed_url + "' style='border:none;'></iframe>"
|
embedCode: "<iframe id='ivplayer' width='640' height='360' src='" + embed_url + "' style='border:none;'></iframe>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
videojs.Hls.xhr.beforeRequest = function(options) {
|
||||||
|
if (options.uri.indexOf('local=true') === -1) {
|
||||||
|
options.uri = options.uri + '?local=true';
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
};
|
||||||
|
|
||||||
var player = videojs('player', options);
|
var player = videojs('player', options);
|
||||||
|
|
||||||
|
|
||||||
if (location.pathname.startsWith('/embed/')) {
|
if (location.pathname.startsWith('/embed/')) {
|
||||||
player.overlay({
|
player.overlay({
|
||||||
overlays: [{
|
overlays: [{
|
||||||
|
|
|
@ -197,6 +197,7 @@ before_all do |env|
|
||||||
extra_media_csp = ""
|
extra_media_csp = ""
|
||||||
if CONFIG.disabled?("local") || !preferences.local
|
if CONFIG.disabled?("local") || !preferences.local
|
||||||
extra_media_csp += " https://*.googlevideo.com:443"
|
extra_media_csp += " https://*.googlevideo.com:443"
|
||||||
|
extra_media_csp += " https://*.youtube.com:443"
|
||||||
end
|
end
|
||||||
# TODO: Remove style-src's 'unsafe-inline', requires to remove all inline styles (<style> [..] </style>, style=" [..] ")
|
# TODO: Remove style-src's 'unsafe-inline', requires to remove all inline styles (<style> [..] </style>, style=" [..] ")
|
||||||
env.response.headers["Content-Security-Policy"] = "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; manifest-src 'self'; media-src 'self' blob:#{extra_media_csp}"
|
env.response.headers["Content-Security-Policy"] = "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; manifest-src 'self'; media-src 'self' blob:#{extra_media_csp}"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<% if params.video_loop %>loop<% end %>
|
<% if params.video_loop %>loop<% end %>
|
||||||
<% if params.controls %>controls<% end %>>
|
<% if params.controls %>controls<% end %>>
|
||||||
<% if (hlsvp = video.hls_manifest_url) && !CONFIG.disabled?("livestreams") %>
|
<% if (hlsvp = video.hls_manifest_url) && !CONFIG.disabled?("livestreams") %>
|
||||||
<source src="<%= URI.parse(hlsvp).full_path %>?local=true" type="application/x-mpegURL" label="livestream">
|
<source src="<%= URI.parse(hlsvp).full_path %><% if params.local %>?local=true<% end %>" type="application/x-mpegURL" label="livestream">
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if params.listen %>
|
<% if params.listen %>
|
||||||
<% audio_streams.each_with_index do |fmt, i| %>
|
<% audio_streams.each_with_index do |fmt, i| %>
|
||||||
|
|
Loading…
Reference in a new issue