diff --git a/.gitignore b/.gitignore index 1bded4b7b..5162f3b32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ image.* chart.png video.mp4 +video.webm cache/ __pycache__/ disablesignups diff --git a/files/helpers/const.py b/files/helpers/const.py index 8156c2f4b..9a69eee7f 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -618,6 +618,14 @@ AWARDS = { "color": "text-silver", "price": 10000 }, + "unblockable": { + "kind": "unblockable", + "title": "Unblockable", + "description": "Makes the recipient unblockable and removes all blocks on them.", + "icon": "far fa-laugh-squint", + "color": "text-lightgreen", + "price": 10000 + }, "pause": { "kind": "pause", "title": "Pause", @@ -626,14 +634,6 @@ AWARDS = { "color": "text-danger", "price": 20000 }, - "unblockable": { - "kind": "unblockable", - "title": "Unblockable", - "description": "Makes the recipient unblockable and removes all blocks on them.", - "icon": "far fa-laugh-squint", - "color": "text-lightgreen", - "price": 25000 - }, "unpausable": { "kind": "unpausable", "title": "Unpausable", @@ -766,6 +766,14 @@ AWARDS2 = { "color": "text-silver", "price": 10000 }, + "unblockable": { + "kind": "unblockable", + "title": "Unblockable", + "description": "Makes the recipient unblockable and removes all blocks on them.", + "icon": "far fa-laugh-squint", + "color": "text-lightgreen", + "price": 10000 + }, "pause": { "kind": "pause", "title": "Pause", @@ -774,14 +782,6 @@ AWARDS2 = { "color": "text-danger", "price": 20000 }, - "unblockable": { - "kind": "unblockable", - "title": "Unblockable", - "description": "Makes the recipient unblockable and removes all blocks on them.", - "icon": "far fa-laugh-squint", - "color": "text-lightgreen", - "price": 25000 - }, "unpausable": { "kind": "unpausable", "title": "Unpausable", diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 8f1cc692f..b25a1e5ee 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -228,8 +228,8 @@ def sanitize(sanitized, noimages=False): htmlsource += '">' sanitized = sanitized.replace(replacing, htmlsource) - for i in re.finditer('

(https:.*?\.mp4)

', sanitized): - sanitized = sanitized.replace(i.group(0), f'

') + for i in re.finditer('

(https:.*?\.(mp4|webm))

', sanitized): + sanitized = sanitized.replace(i.group(0), f'

') for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]: sanitized = sanitized.replace(rd, "https://old.reddit.com/") diff --git a/files/routes/awards.py b/files/routes/awards.py index bc045936b..5d9bf980e 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -174,6 +174,15 @@ def shop(v): "owned": 0, "price": 10000 }, + "unblockable": { + "kind": "unblockable", + "title": "Unblockable", + "description": "Makes the recipient unblockable and removes all blocks on them.", + "icon": "far fa-laugh-squint", + "color": "text-lightgreen", + "owned": 0, + "price": 10000 + }, "pause": { "kind": "pause", "title": "Pause", @@ -183,15 +192,6 @@ def shop(v): "owned": 0, "price": 20000 }, - "unblockable": { - "kind": "unblockable", - "title": "Unblockable", - "description": "Makes the recipient unblockable and removes all blocks on them.", - "icon": "far fa-laugh-squint", - "color": "text-lightgreen", - "owned": 0, - "price": 25000 - }, "unpausable": { "kind": "unpausable", "title": "Unpausable", @@ -348,6 +348,14 @@ def buy(v, award): "color": "text-silver", "price": 10000 }, + "unblockable": { + "kind": "unblockable", + "title": "Unblockable", + "description": "Makes the recipient unblockable and removes all blocks on them.", + "icon": "far fa-laugh-squint", + "color": "text-lightgreen", + "price": 10000 + }, "pause": { "kind": "pause", "title": "Pause", @@ -356,14 +364,6 @@ def buy(v, award): "color": "text-danger", "price": 20000 }, - "unblockable": { - "kind": "unblockable", - "title": "Unblockable", - "description": "Makes the recipient unblockable and removes all blocks on them.", - "icon": "far fa-laugh-squint", - "color": "text-lightgreen", - "price": 25000 - }, "unpausable": { "kind": "unpausable", "title": "Unpausable", @@ -399,6 +399,7 @@ def buy(v, award): if request.values.get("mb"): if v.procoins < price: return {"error": "Not enough marseybux."}, 400 + if award in ["grass","alt"]: return {"error": "You can't buy those awards with marseybux."}, 403 v.procoins -= price else: if v.coins < price: return {"error": "Not enough coins."}, 400 diff --git a/files/templates/shop.html b/files/templates/shop.html index 24e777b6c..66afdf22f 100644 --- a/files/templates/shop.html +++ b/files/templates/shop.html @@ -64,7 +64,7 @@ {% set kind = a['kind'] %} Buy - {% if v.procoins and a['price'] < 3600 %}Buy with Marseybux{% endif %} + {% if v.procoins and a['kind'] not in ("grass","alt") %}Buy with Marseybux{% endif %} {% endfor %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 9727e328b..3b4aaa3d2 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -123,7 +123,7 @@ -{% if p.url and p.url.lower().endswith('.mp4') %} +{% if p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm')) %} {% endif %} @@ -152,7 +152,7 @@ {% if p.author %}{% endif %} -{% if p.url and p.url.lower().endswith('.mp4') %} +{% if p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm')) %} {% endif %} @@ -402,7 +402,7 @@

{% if p.realurl(v) %} - {% if not p.embed_url and not p.is_image and not (p.url and p.url.lower().endswith('.mp4')) %} + {% if not p.embed_url and not p.is_image and not (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm'))) %}
{{p.domain|truncate(30, True)}} @@ -446,6 +446,15 @@

+							{% elif p.url and p.url.lower().endswith('.webm') %}
+								
+
+ +
+
+

 							{% endif %}
 							{{p.realbody(v) | safe}}
 
@@ -651,7 +660,7 @@
 
 		
 
-		{% if not p.is_image and not (p.url and p.url.lower().endswith('.mp4')) %}
+		{% if not p.is_image and not (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm'))) %}
 			
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 027e2c44a..1a11b4c85 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -148,7 +148,7 @@ - {% elif (p.url and p.url.lower().endswith('.mp4')) or (p.embed_url and "youtu" in p.domain) or (p.url and "streamable.com/e/" in p.url) %} + {% elif (p.url and (p.url.lower().endswith('.mp4') or p.url.lower().endswith('.webm'))) or (p.embed_url and "youtu" in p.domain) or (p.url and "streamable.com/e/" in p.url) %} @@ -491,6 +491,12 @@
+ {% elif p.url and p.url.lower().endswith('.webm') %} +
+ +
{% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] and p.embed_url.startswith(' {{p.embed_url | safe}}