forked from rDrama/rDrama
1
0
Fork 0

fix runtime compatability with old videos

master
Aevann 2024-02-21 17:47:01 +02:00
parent c9a86a554c
commit ee643f8d78
2 changed files with 5 additions and 2 deletions

View File

@ -6,7 +6,7 @@ from functools import partial
from files.helpers.regex import sanitize_url_regex
from files.helpers.config.const import *
allowed_tags = ('a','audio','b','big','blink','blockquote','br','center','code','del','details','em','g','gl','h1','h2','h3','h4','h5','h6','hr','i','img','li','lite-youtube','marquee','ol','p','pre','rp','rt','ruby','small','span','spoiler','strike','strong','sub','summary','sup','table','tbody','td','th','thead','tr','u','ul','video')
allowed_tags = ('a','audio','b','big','blink','blockquote','br','center','code','del','details','em','g','gl','h1','h2','h3','h4','h5','h6','hr','i','img','li','lite-youtube','marquee','ol','p','pre','rp','rt','ruby','small','source','span','spoiler','strike','strong','sub','summary','sup','table','tbody','td','th','thead','tr','u','ul','video')
allowed_tags_runtime = ('div', 'input', 'label', 'score', 'button', 'd')
allowed_css_properties = ('background-color', 'color', 'filter', 'font-weight', 'text-align', 'transform')
@ -48,6 +48,9 @@ def allowed_attributes(tag, name, value):
if name == 'preload' and value == 'none': return True
if name == 'src': return is_safe_url(value)
if tag == 'source':
if name == 'src': return is_safe_url(value)
if tag == 'audio':
if name == 'src': return is_safe_url(value)
if name == 'controls' and value == '': return True

View File

@ -833,7 +833,7 @@ def complies_with_chud(obj):
#check for chud_phrase in body_html
if old_body_html:
excluded_tags = {'del','sub','sup','marquee','spoiler','lite-youtube','video','audio'}
excluded_tags = {'del','sub','sup','marquee','spoiler','lite-youtube','video','source','audio'}
soup = BeautifulSoup(old_body_html, 'lxml')
tags = soup.html.body.find_all(lambda tag: tag.name not in excluded_tags and not tag.attrs, recursive=False)
for tag in tags: