forked from MarseyWorld/MarseyWorld
adjust audio and video embedding
parent
a36c0f9dd3
commit
e9d98e158c
|
@ -61,8 +61,8 @@ torture_regex_exclude = re.compile('^\s*>', flags=re.A)
|
||||||
|
|
||||||
image_check_regex = re.compile(f'!\[\]\(((?!(https:\/\/([a-z0-9-]+\.)*({hosts})\/|\/)).*?)\)', flags=re.A)
|
image_check_regex = re.compile(f'!\[\]\(((?!(https:\/\/([a-z0-9-]+\.)*({hosts})\/|\/)).*?)\)', flags=re.A)
|
||||||
|
|
||||||
video_sub_regex = re.compile(f'(<p>[^<]*)(https:\/\/([a-z0-9-]+\.)*({hosts})\/[\w:~,()\-.#&\/=?@%;+]*?\.(mp4|webm|mov))', flags=re.A)
|
video_sub_regex = re.compile(f'(https:\/\/([a-z0-9-]+\.)*({hosts})\/[\w:~,()\-.#&\/=?@%;+]*?\.(mp4|webm|mov))', flags=re.A)
|
||||||
audio_sub_regex = re.compile(f'(<p>[^<]*)(https:\/\/([a-z0-9-]+\.)*({hosts})\/[\w:~,()\-.#&\/=?@%;+]*?\.(mp3|wav|ogg|aac|m4a|flac))', flags=re.A)
|
audio_sub_regex = re.compile(f'(https:\/\/([a-z0-9-]+\.)*({hosts})\/[\w:~,()\-.#&\/=?@%;+]*?\.(mp3|wav|ogg|aac|m4a|flac))', flags=re.A)
|
||||||
|
|
||||||
imgur_regex = re.compile('(https:\/\/i\.imgur\.com\/[a-z0-9]+)\.(jpg|png|jpeg|webp)', flags=re.I|re.A)
|
imgur_regex = re.compile('(https:\/\/i\.imgur\.com\/[a-z0-9]+)\.(jpg|png|jpeg|webp)', flags=re.I|re.A)
|
||||||
giphy_regex = re.compile('(https:\/\/media\.giphy\.com\/media\/[a-z0-9]+\/giphy)\.gif', flags=re.I|re.A)
|
giphy_regex = re.compile('(https:\/\/media\.giphy\.com\/media\/[a-z0-9]+\/giphy)\.gif', flags=re.I|re.A)
|
||||||
|
|
|
@ -335,8 +335,8 @@ def sanitize(sanitized, edit=False, limit_pings=False, showmore=True):
|
||||||
|
|
||||||
sanitized = sanitized.replace(i.group(0), htmlsource)
|
sanitized = sanitized.replace(i.group(0), htmlsource)
|
||||||
|
|
||||||
sanitized = video_sub_regex.sub(r'\1<video controls preload="none"><source src="\2"></video>', sanitized)
|
sanitized = video_sub_regex.sub(r'<video controls preload="none"><source src="\1"></video>', sanitized)
|
||||||
sanitized = audio_sub_regex.sub(r'\1<audio controls preload="none" src="\2"></audio>', sanitized)
|
sanitized = audio_sub_regex.sub(r'<audio controls preload="none" src="\1"></audio>', sanitized)
|
||||||
|
|
||||||
if not edit:
|
if not edit:
|
||||||
for marsey in g.db.query(Marsey).filter(Marsey.name.in_(marseys_used)).all():
|
for marsey in g.db.query(Marsey).filter(Marsey.name.in_(marseys_used)).all():
|
||||||
|
|
Loading…
Reference in New Issue