remotes/1693045480750635534/spooky-22
Aevann1 2021-12-09 22:12:21 +02:00
parent ef31a38de0
commit a60b658a90
7 changed files with 58 additions and 41 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
image.*
chart.png
video.mp4
video.webm
cache/
__pycache__/
disablesignups

View File

@ -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",

View File

@ -228,8 +228,8 @@ def sanitize(sanitized, noimages=False):
htmlsource += '"></lite-youtube>'
sanitized = sanitized.replace(replacing, htmlsource)
for i in re.finditer('<p>(https:.*?\.mp4)</p>', sanitized):
sanitized = sanitized.replace(i.group(0), f'<p><video controls preload="none" class="embedvid"><source src="{i.group(1)}" type="video/mp4"></video>')
for i in re.finditer('<p>(https:.*?\.(mp4|webm))</p>', sanitized):
sanitized = sanitized.replace(i.group(0), f'<p><video controls preload="none" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>')
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/")

View File

@ -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

View File

@ -64,7 +64,7 @@
{% set kind = a['kind'] %}
<td style="font-weight: bold">
<a class="d-flex btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}')"><span class="m-auto">Buy</span></a>
{% if v.procoins and a['price'] < 3600 %}<a class="d-flex marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}?mb=true')"><span class="m-auto">Buy with Marseybux</span></a>{% endif %}
{% if v.procoins and a['kind'] not in ("grass","alt") %}<a class="d-flex marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}?mb=true')"><span class="m-auto">Buy with Marseybux</span></a>{% endif %}
</td>
</tr>
{% endfor %}

View File

@ -123,7 +123,7 @@
<meta property="og:author" name="author" content="{{'@'+comment_info.author.username}}" >
<meta property="og:title" content="{{'@'+comment_info.author.username}} comments on {{p.plaintitle(v)}} - {{'SITE_NAME' | app_config}}" >
<meta property="og:image" content="{% if p.is_image %}{{p.realurl(v)}}{% elif p.has_thumb%}{{p.thumb_url}}{% else %}{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.gif{% 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')) %}
<meta property="og:video" content="{{ p.realurl(v) }}" >
{% endif %}
<meta property="og:url" content="{{comment_info.permalink | full_link}}" >
@ -152,7 +152,7 @@
{% if p.author %}<meta property="og:author" name="author" content="{{'@'+p.author.username}}" >{% endif %}
<meta property="og:title" content="{{p.plaintitle(v)}} - {{'SITE_NAME' | app_config}}" >
<meta property="og:image" content="{% if p.is_image %}{{p.realurl(v)}}{% elif p.has_thumb%}{{p.thumb_url}}{% else %}{{'SITE_NAME' | app_config}}/assets/images/{{'SITE_NAME' | app_config}}/preview.gif{% 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')) %}
<meta property="og:video" content="{{ p.realurl(v) }}" >
{% endif %}
<meta property="og:url" content="{{p.permalink | full_link}}" >
@ -402,7 +402,7 @@
<div id="post-body" class="post-body mt-3">
{% 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'))) %}
<a rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}" {% if not v or v.newtabexternal %}target="_blank"{% endif %}>
<div class="d-flex d-md-none justify-content-between align-items-center border rounded p-2{% if p.realbody(v) %} mb-3{% endif %}">
<span>{{p.domain|truncate(30, True)}}</span>
@ -446,6 +446,15 @@
</div>
</div>
<pre></pre>
{% elif p.url and p.url.lower().endswith('.webm') %}
<div class="row no-gutters">
<div class="col">
<video controls preload="none" class="embedvid">
<source src="{{p.realurl(v)}}" type="video/webm">
</video>
</div>
</div>
<pre></pre>
{% endif %}
{{p.realbody(v) | safe}}
@ -651,7 +660,7 @@
</div>
{% 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'))) %}
<div class="row no-gutters d-md-none">
<div class="col">
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}"></a>

View File

@ -148,7 +148,7 @@
<a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target="#expandImageModal" data-bs-url="{{p.realurl(v)}}" onclick="expandDesktopImage('{{ p.realurl(v) }}')">
<img loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
{% 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) %}
<a href="javascript:void(0)" onclick="document.getElementById('video-{{p.id}}').classList.toggle('d-none')">
<img loading="lazy" src="{{p.thumb_url}}" class="post-img">
</a>
@ -491,6 +491,12 @@
<source src="{{p.realurl(v)}}" type="video/mp4">
</video>
</div>
{% elif p.url and p.url.lower().endswith('.webm') %}
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}d-none{% endif %} mt-4">
<video controls preload="none" class="embedvid">
<source src="{{p.realurl(v)}}" type="video/webm">
</video>
</div>
{% elif p.embed_url and p.domain in ['youtu.be','youtube.com'] and p.embed_url.startswith('<lite-youtube') %}
<div id="video-{{p.id}}" class="{% if p.over_18 or not ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}d-none{% endif %} mt-3 mb-4">
{{p.embed_url | safe}}