mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Don't allow autoplay of embedded video, and explicitly turn autoplay off on invideous sites
							parent
							
								
									47edfad98d
								
							
						
					
					
						commit
						0ec0e0460b
					
				| 
						 | 
				
			
			@ -44,7 +44,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
 | 
			
		|||
                "src=\"https://player.vimeo.com/video/" + \
 | 
			
		||||
                url + "\" width=\"" + str(width) + \
 | 
			
		||||
                "\" height=\"" + str(height) + \
 | 
			
		||||
                "\" frameborder=\"0\" allow=\"autoplay; " + \
 | 
			
		||||
                "\" frameborder=\"0\" allow=\"" + \
 | 
			
		||||
                "fullscreen\" allowfullscreen></iframe>\n</center>\n"
 | 
			
		||||
            return content
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
 | 
			
		|||
                    "decoding=\"async\" src=\"" + \
 | 
			
		||||
                    video_site + url + "\" width=\"" + str(width) + \
 | 
			
		||||
                    "\" height=\"" + str(height) + \
 | 
			
		||||
                    "\" frameborder=\"0\" allow=\"autoplay; fullscreen\" " + \
 | 
			
		||||
                    "\" frameborder=\"0\" allow=\"fullscreen\" " + \
 | 
			
		||||
                    "allowfullscreen></iframe>\n</center>\n"
 | 
			
		||||
                return content
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +87,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
 | 
			
		|||
                    "decoding=\"async\" src=\"" + \
 | 
			
		||||
                    video_site + url + "\" width=\"" + str(width) + \
 | 
			
		||||
                    "\" height=\"" + str(height) + \
 | 
			
		||||
                    "\" frameborder=\"0\" allow=\"autoplay; fullscreen\" " + \
 | 
			
		||||
                    "\" frameborder=\"0\" allow=\"fullscreen\" " + \
 | 
			
		||||
                    "allowfullscreen></iframe>\n</center>\n"
 | 
			
		||||
                return content
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -114,12 +114,17 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
 | 
			
		|||
                    url = url.split('&')[0]
 | 
			
		||||
                if '?utm_' in url:
 | 
			
		||||
                    url = url.split('?utm_')[0]
 | 
			
		||||
                # explicitly turn off autoplay
 | 
			
		||||
                if '&autoplay=' not in url:
 | 
			
		||||
                    url += '&autoplay=0'
 | 
			
		||||
                else:
 | 
			
		||||
                    url = url.replace('&autoplay=1', '&autoplay=0')
 | 
			
		||||
                content += \
 | 
			
		||||
                    "<center>\n<iframe loading=\"lazy\" " + \
 | 
			
		||||
                    "decoding=\"async\" src=\"" + \
 | 
			
		||||
                    video_site + url + "\" width=\"" + \
 | 
			
		||||
                    str(width) + "\" height=\"" + str(height) + \
 | 
			
		||||
                    "\" frameborder=\"0\" allow=\"autoplay; fullscreen\" " + \
 | 
			
		||||
                    "\" frameborder=\"0\" allow=\"fullscreen\" " + \
 | 
			
		||||
                    "allowfullscreen></iframe>\n</center>\n"
 | 
			
		||||
                return content
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -204,7 +209,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
 | 
			
		|||
                "allow-scripts\" src=\"https://" + \
 | 
			
		||||
                site + url + "\" width=\"" + str(width) + \
 | 
			
		||||
                "\" height=\"" + str(height) + \
 | 
			
		||||
                "\" frameborder=\"0\" allow=\"autoplay; " + \
 | 
			
		||||
                "\" frameborder=\"0\" allow=\"" + \
 | 
			
		||||
                "fullscreen\" allowfullscreen></iframe>\n</center>\n"
 | 
			
		||||
            return content
 | 
			
		||||
    return content
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue