diff --git a/files/__main__.py b/files/__main__.py index 7aa87735f1..d9dbd4b2d7 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -54,7 +54,6 @@ app.config["SPAM_SIMILAR_COUNT_THRESHOLD"] = int(environ.get("SPAM_SIMILAR_COUNT app.config["SPAM_URL_SIMILARITY_THRESHOLD"] = float(environ.get("SPAM_URL_SIMILARITY_THRESHOLD", 0.5)) app.config["COMMENT_SPAM_SIMILAR_THRESHOLD"] = float(environ.get("COMMENT_SPAM_SIMILAR_THRESHOLD", 0.5)) app.config["COMMENT_SPAM_COUNT_THRESHOLD"] = int(environ.get("COMMENT_SPAM_COUNT_THRESHOLD", 0.5)) -app.config["VIDEO_COIN_REQUIREMENT"] = int(environ.get("VIDEO_COIN_REQUIREMENT", 0)) app.config["READ_ONLY"]=bool(int(environ.get("READ_ONLY", "0"))) app.config["BOT_DISABLE"]=bool(int(environ.get("BOT_DISABLE", False))) app.config["RATELIMIT_KEY_PREFIX"] = "flask_limiting_" diff --git a/files/classes/submission.py b/files/classes/submission.py index 69cd36ce74..7460e03a5b 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -397,6 +397,11 @@ class Submission(Base): return title + @property + @lazy + def is_video(self): + return self.url and any((self.url.lower().endswith(x) for x in ('.mp4','.webm','.mov'))) + @property @lazy def is_image(self): diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 529475fabc..7e221c7ff7 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -198,7 +198,7 @@ def sanitize(sanitized, noimages=False): elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'): sanitized = re.sub(f'(?', sanitized, flags=re.I) - sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("https://m.wikipedia", "https://wikipedia").replace("https://m.youtube", "https://youtube") + sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube") if "https://youtube.com/watch?v=" in sanitized: sanitized = sanitized.replace("?t=", "&t=") @@ -216,8 +216,8 @@ def sanitize(sanitized, noimages=False): htmlsource += '">' sanitized = sanitized.replace(replacing, htmlsource) - for i in re.finditer('

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

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

') + for i in re.finditer('>(https://.*?\.(mp4|webm|mov))

', sanitized): + sanitized = sanitized.replace(f'

{i.group(1)}

', 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/helpers/wrappers.py b/files/helpers/wrappers.py index fe7c3073bc..2dece7a26d 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -18,8 +18,7 @@ def get_logged_in_user(): nonce = session.get("login_nonce", 0) logged_in = session.get("logged_in") - if not uid: return None - # if not uid or not logged_in or uid != logged_in: return None + if not uid or not logged_in or uid != logged_in: return None try: if g.db: v = g.db.query(User).filter_by(id=uid).first() diff --git a/files/routes/comments.py b/files/routes/comments.py index fd17f19340..f6866813fc 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -10,10 +10,12 @@ from pusher_push_notifications import PushNotifications from flask import * from files.__main__ import app, limiter from files.helpers.sanitize import filter_emojis_only +import requests site = environ.get("DOMAIN").strip() if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" else: cc = "COUNTRY CLUB" +CATBOX_KEY = environ.get("CATBOX_KEY").strip() beams_client = PushNotifications( instance_id=PUSHER_INSTANCE_ID, @@ -190,13 +192,17 @@ def api_comment(v): if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] - if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 - - name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' - file.save(name) - url = process_image(name) - - body += f"\n\n![]({url})" + if file.content_type.startswith('image/'): + name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' + file.save(name) + url = process_image(name) + body += f"\n\n![]({url})" + elif file.content_type.startswith('video/'): + file.save("video.mp4") + with open("video.mp4", 'rb') as f: + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + body += f"\n\n{url}" + else: return {"error": f"Image/Video files only"}, 400 if v.agendaposter and not v.marseyawarded: for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l) @@ -720,13 +726,18 @@ def edit_comment(cid, v): if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] - if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 + if file.content_type.startswith('image/'): + name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' + file.save(name) + url = process_image(name) + body += f"\n\n![]({url})" + elif file.content_type.startswith('video/'): + file.save("video.mp4") + with open("video.mp4", 'rb') as f: + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + body += f"\n\n{url}" + else: return {"error": f"Image/Video files only"}, 400 - name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' - file.save(name) - url = process_image(name) - - body += f"\n\n![]({url})" body_md = CustomRenderer().render(mistletoe.Document(body)) body_html = sanitize(body_md) diff --git a/files/routes/front.py b/files/routes/front.py index 48a77c3c0a..8700fe6181 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -123,9 +123,6 @@ def notifications(v): @auth_desired def front_all(v): - if request.host == 'old.rdrama.net' and not (v and (v.admin_level or v.patron)): - return render_template("home.html", v=v, listing=[], next_exists=False, sort='hot', t='all', page=1) - if not v and request.path == "/" and not request.headers.get("Authorization"): return redirect(f"/logged_out{request.full_path}") if v and v.is_banned and not v.unban_utc: return render_template('errors/500.html', error=True, v=v), 500 diff --git a/files/routes/posts.py b/files/routes/posts.py index 5e9a49afa7..6d51ecc918 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -18,6 +18,7 @@ from PIL import Image as PILimage from .front import frontlist, changeloglist from urllib.parse import ParseResult, urlunparse, urlparse, quote from os import path +import requests site = environ.get("DOMAIN").strip() site_name = environ.get("SITE_NAME").strip() @@ -420,13 +421,17 @@ def edit_post(pid, v): if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] - if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 - - name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' - file.save(name) - url = process_image(name) - - body += f"\n\n![]({url})" + if file.content_type.startswith('image/'): + name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' + file.save(name) + url = process_image(name) + body += f"\n\n![]({url})" + elif file.content_type.startswith('video/'): + file.save("video.mp4") + with open("video.mp4", 'rb') as f: + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + body += f"\n\n{url}" + else: return {"error": f"Image/Video files only"}, 400 if body != p.body: for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): @@ -743,7 +748,7 @@ def submit_post(v): for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]: url = url.replace(rd, "https://old.reddit.com/") - url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("https://m.wikipedia", "https://wikipedia").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube") + url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube") if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/") @@ -916,13 +921,18 @@ def submit_post(v): if request.files.get("file2") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file2"] - if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 - - name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' - file.save(name) - url = process_image(name) - - body += f"\n\n![]({url})" + if file.content_type.startswith('image/'): + name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' + file.save(name) + body += f"\n\n![]({url})" + elif file.content_type.startswith('video/'): + file.save("video.mp4") + with open("video.mp4", 'rb') as f: + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + body += f"\n\n{url}" + else: + if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 + else: return render_template("submit.html", v=v, error=f"Image/Video files only."), 400 body_html = sanitize(CustomRenderer().render(mistletoe.Document(body))) @@ -1003,20 +1013,6 @@ def submit_post(v): if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400 else: return render_template("submit.html", v=v, error=f"File type not allowed.", title=title, body=request.values.get("body", "")), 400 - if file.content_type.startswith('video/') and v.truecoins < app.config["VIDEO_COIN_REQUIREMENT"] and v.admin_level < 1: - if request.headers.get("Authorization"): - return { - "error": f"You need at least {app.config['VIDEO_COIN_REQUIREMENT']} coins to upload videos" - }, 403 - else: - return render_template( - "submit.html", - v=v, - error=f"You need at least {app.config['VIDEO_COIN_REQUIREMENT']} coins to upload videos.", - title=title, - body=request.values.get("body", "") - ), 403 - if file.content_type.startswith('image/'): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' file.save(name) @@ -1025,7 +1021,7 @@ def submit_post(v): elif file.content_type.startswith('video/'): file.save("video.mp4") with open("video.mp4", 'rb') as f: - new_post.url = requests.post('https://catbox.moe/user/api.php', timeout=5, data={'userhash':CATBOX_KEY, 'reqtype':'fileupload'}, files={'fileToUpload':f}).text + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] g.db.add(new_post) diff --git a/files/routes/settings.py b/files/routes/settings.py index e8a4caac7e..f57adcbaac 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -22,6 +22,7 @@ YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip() COINS_NAME = environ.get("COINS_NAME").strip() GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip() SITE_NAME = environ.get("SITE_NAME", "").strip() +CATBOX_KEY = environ.get("CATBOX_KEY").strip() tiers={ "(Paypig)": 1, @@ -116,50 +117,6 @@ def settings_profile_post(v): updated = True v.is_nofollow = request.values.get("nofollow", None) == 'true' - elif request.values.get("bio") or request.files.get('file') and request.headers.get("cf-ipcountry") != "T1": - bio = request.values.get("bio")[:1500] - - for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE): - if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'![]({i.group(1)})') - - if request.files.get('file'): - file = request.files['file'] - if not file.content_type.startswith('image/'): - if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400 - else: return render_template("settings_profile.html", v=v, error=f"Image files only."), 400 - - name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' - file.save(name) - url = process_image(name) - - bio += f"\n\n![]({url})" - - bio_html = CustomRenderer().render(mistletoe.Document(bio)) - bio_html = sanitize(bio_html) - bans = filter_comment_html(bio_html) - - if bans: - ban = bans[0] - reason = f"Remove the {ban.domain} link from your bio and try again." - if ban.reason: - reason += f" {ban.reason}" - - return {"error": reason}, 401 - - if len(bio_html) > 10000: - return render_template("settings_profile.html", - v=v, - error="Your bio is too long") - - v.bio = bio[:1500] - v.bio_html=bio_html - g.db.add(v) - g.db.commit() - return render_template("settings_profile.html", - v=v, - msg="Your bio has been updated.") - - elif request.values.get("bio") == "": v.bio = None v.bio_html = None @@ -314,15 +271,19 @@ def settings_profile_post(v): if request.files.get('file'): file = request.files['file'] - if not file.content_type.startswith('image/'): - if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400 - else: return render_template("settings_profile.html", v=v, error=f"Image files only."), 400 - - name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' - file.save(name) - url = process_image(name) - - bio += f"\n\n![]({url})" + if file.content_type.startswith('image/'): + name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' + file.save(name) + url = process_image(name) + bio += f"\n\n![]({url})" + elif file.content_type.startswith('video/'): + file.save("video.mp4") + with open("video.mp4", 'rb') as f: + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + bio += f"\n\n{url}" + else: + if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 + else: return render_template("settings_profile.html", v=v, error=f"Image/Video files only."), 400 bio_html = CustomRenderer().render(mistletoe.Document(bio)) bio_html = sanitize(bio_html) diff --git a/files/templates/CHRISTMAS/authforms.html b/files/templates/CHRISTMAS/authforms.html index 22ef91814b..4ee91c18f5 100644 --- a/files/templates/CHRISTMAS/authforms.html +++ b/files/templates/CHRISTMAS/authforms.html @@ -14,11 +14,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/CHRISTMAS/comments.html b/files/templates/CHRISTMAS/comments.html index 2db8849a9a..89d4aa3df5 100644 --- a/files/templates/CHRISTMAS/comments.html +++ b/files/templates/CHRISTMAS/comments.html @@ -1,6 +1,6 @@ {% if v %} {% include "award_modal.html" %} - + {% endif %} diff --git a/files/templates/CHRISTMAS/comments/CommentEditForm.html b/files/templates/CHRISTMAS/comments/CommentEditForm.html index bfbfcecf54..1be38ccac4 100644 --- a/files/templates/CHRISTMAS/comments/CommentEditForm.html +++ b/files/templates/CHRISTMAS/comments/CommentEditForm.html @@ -34,7 +34,7 @@

- + {% endif %} @@ -60,7 +60,7 @@   diff --git a/files/templates/CHRISTMAS/comments/CommentForm.html b/files/templates/CHRISTMAS/comments/CommentForm.html index 2728c9826e..60bc6562a4 100644 --- a/files/templates/CHRISTMAS/comments/CommentForm.html +++ b/files/templates/CHRISTMAS/comments/CommentForm.html @@ -35,7 +35,7 @@
- + {% endif %} diff --git a/files/templates/CHRISTMAS/comments/CommentReplyForm.html b/files/templates/CHRISTMAS/comments/CommentReplyForm.html index c613ec0a01..aa8960f531 100644 --- a/files/templates/CHRISTMAS/comments/CommentReplyForm.html +++ b/files/templates/CHRISTMAS/comments/CommentReplyForm.html @@ -36,7 +36,7 @@
- + {% endif %} @@ -67,7 +67,7 @@   diff --git a/files/templates/CHRISTMAS/default.html b/files/templates/CHRISTMAS/default.html index f342611737..0e41b539de 100644 --- a/files/templates/CHRISTMAS/default.html +++ b/files/templates/CHRISTMAS/default.html @@ -186,9 +186,9 @@ {% block stylesheets %} - + - + @@ -338,7 +338,7 @@ - + @@ -346,8 +346,8 @@ {% if v %} - {% endif %} + diff --git a/files/templates/CHRISTMAS/dropdowns/NavbarExtraLinks.html b/files/templates/CHRISTMAS/dropdowns/NavbarExtraLinks.html index c98f66a6a2..98d22c3823 100644 --- a/files/templates/CHRISTMAS/dropdowns/NavbarExtraLinks.html +++ b/files/templates/CHRISTMAS/dropdowns/NavbarExtraLinks.html @@ -41,7 +41,7 @@
  • - + Android App
  • diff --git a/files/templates/CHRISTMAS/formatting.html b/files/templates/CHRISTMAS/formatting.html index 6333c49d09..595ed99fe8 100644 --- a/files/templates/CHRISTMAS/formatting.html +++ b/files/templates/CHRISTMAS/formatting.html @@ -62,15 +62,10 @@ You can use Markdown formatting: - MP4 Files + Video Files https://files.catbox.moe/v4om92.mp4 - - WEBM Files - https://files.catbox.moe/v4om92.mp4 - - Emojis :marseylove: diff --git a/files/templates/CHRISTMAS/header-tw.html b/files/templates/CHRISTMAS/header-tw.html index 97b1b338e4..d6b5e77aff 100644 --- a/files/templates/CHRISTMAS/header-tw.html +++ b/files/templates/CHRISTMAS/header-tw.html @@ -16,7 +16,7 @@ Menu open: "hidden", Menu closed: "block" --> - Invite friends
    - Android app + Android app Rules @@ -175,7 +175,7 @@ - Android app + Android app Rules diff --git a/files/templates/CHRISTMAS/login.html b/files/templates/CHRISTMAS/login.html index 5b36e23ca6..8a335a116e 100644 --- a/files/templates/CHRISTMAS/login.html +++ b/files/templates/CHRISTMAS/login.html @@ -13,9 +13,9 @@ Login - {{'SITE_NAME' | app_config}} {% endblock %} - + - + diff --git a/files/templates/CHRISTMAS/login_2fa.html b/files/templates/CHRISTMAS/login_2fa.html index 9da94605df..8cd8af8f54 100644 --- a/files/templates/CHRISTMAS/login_2fa.html +++ b/files/templates/CHRISTMAS/login_2fa.html @@ -13,7 +13,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/CHRISTMAS/settings.html b/files/templates/CHRISTMAS/settings.html index 11f24f2c6e..f148c1cf5f 100644 --- a/files/templates/CHRISTMAS/settings.html +++ b/files/templates/CHRISTMAS/settings.html @@ -29,9 +29,9 @@ {% block stylesheets %} - + - + diff --git a/files/templates/CHRISTMAS/settings_profile.html b/files/templates/CHRISTMAS/settings_profile.html index 13c80f9c34..4d0fb95ec0 100644 --- a/files/templates/CHRISTMAS/settings_profile.html +++ b/files/templates/CHRISTMAS/settings_profile.html @@ -96,7 +96,7 @@
    @@ -409,7 +409,7 @@ - + {% if hcaptcha %} - + {% endif %} diff --git a/files/templates/CHRISTMAS/sign_up_failed_ref.html b/files/templates/CHRISTMAS/sign_up_failed_ref.html index a0a64badc9..d39d19f665 100644 --- a/files/templates/CHRISTMAS/sign_up_failed_ref.html +++ b/files/templates/CHRISTMAS/sign_up_failed_ref.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/CHRISTMAS/submission.html b/files/templates/CHRISTMAS/submission.html index bc857a5180..399ce55003 100644 --- a/files/templates/CHRISTMAS/submission.html +++ b/files/templates/CHRISTMAS/submission.html @@ -304,6 +304,8 @@ {% if p.is_image %} (image post) + {% elif p.is_video %} + (video post) {% elif p.realurl(v) %} ({{p.domain}}) @@ -352,13 +354,13 @@ {% endif %}
    {% if p.is_image %} - - Unable to load image - - {% elif p.url and p.url.lower().endswith('.mp4') %} - + + Unable to load image + + {% elif p.is_video %} + {% endif %} {{p.realbody(v) | safe}} diff --git a/files/templates/CHRISTMAS/submission_listing.html b/files/templates/CHRISTMAS/submission_listing.html index 7275847fdf..726a039a57 100644 --- a/files/templates/CHRISTMAS/submission_listing.html +++ b/files/templates/CHRISTMAS/submission_listing.html @@ -149,6 +149,8 @@ {% if p.is_image %} (image post) + {% elif p.is_video %} + (video post) {% elif p.realurl(v) %} ({{p.domain}}) @@ -285,7 +287,7 @@ {% endif %} {% if not p.club or v and (v.paid_dues or v.id == p.author_id) %} - {% if p.url and p.url.lower().endswith('.mp4') %} + {% if p.is_video %}
    @@ -205,7 +205,7 @@ {% if c.author.verified %} {% endif %} - {{c.author.username}} + {{c.author.username}} {% if c.author.customtitle %}  {% if c.author.quadrant %}{% endif %}{{c.author.customtitle | safe}}{% endif %} {% if c.parent_comment_id and not standalone and level != 1 %}{{ c.parent_comment.author.username }}{% endif %} @@ -231,7 +231,7 @@
    removed by @{{c.ban_reason}}
    {% endif %} -
    +
    {{c.realbody(v) | safe}} {% if c.options %} {{c.options_html(v) | safe}} @@ -252,7 +252,7 @@
    -
    @@ -274,21 +274,21 @@
    - +   - +   - +   - +   - +   -
    Save Edit @@ -299,139 +299,154 @@
    {% endif %}
    -
      + +
        {% if v and v.admin_level > 1 %} - - {% endif %} + + {% endif %} + +
      • + {% if v %} + + {% endif %} + + + + {% if v and request.path.startswith('/@') and v.admin_level == 0 %} + {% if voted==1 %} + + {% endif %} + {% elif v %} + + {% else %} + + {% endif %} + + + {% if v and request.path.startswith('/@') and v.admin_level == 0 %} + {% if voted==-1 %} + + {% endif %} + {% elif v %} + + {% else %} + + {% endif %} +
      • +
      + + + +
      • {% if v and request.path.startswith('/@') and v.admin_level == 0%} - {% if voted==1 %} - - {% endif %} + {% if voted==1 %} + + {% endif %} {% elif v %} - + {% else %} - + {% endif %} - {% if v and request.path.startswith('/@') and v.admin_level == 0 %} - {% if voted==-1 %} -
      • - {% endif %} + {% if voted==-1 %} +
      • + {% endif %} {% elif v %} - + {% else %} - + {% endif %} - Votes + Votes {% if v %} - - - - - - - + + + + + + + {% endif %} - Context + Context - + {% if v %} - + {% endif %} {% if v and c.parent_submission and c.author_id==v.id %} - + {% if c.deleted_utc > 0 %} - + {% else %} - + {% endif %} {% endif %} {% if v and v.admin_level > 0 and v.id==c.author_id %} - - + + {% endif %} {% if v and not v.id==c.author_id %} - - - - - + + + + + {% endif %} {% if v and c.post and (v.admin_level > 1 or v.id == c.post.author_id) %} - - - + + + {% endif %} {% if v and v.admin_level > 1 %} - {% if "/reported/" in request.path %} - - - {% else %} - - - {% endif %} + {% if "/reported/" in request.path %} + + + {% else %} + + + {% endif %} {% endif %} {% if v and c.parent_submission and (c.author_id==v.id or v.admin_level > 0) %} - - + + {% endif %} {% if v and v.admin_level > 1 and v.id != c.author_id %} - - + + {% endif %} {% if v and v.admin_level > 1 and c.oauth_app %} - API App + API App {% endif %} - - - - {% if v and request.path.startswith('/@') and v.admin_level == 0 %} - {% if voted==1 %}{% endif %} - {% elif v %} - - {% else %} - - {% endif %} - - {% if v and request.path.startswith('/@') and v.admin_level == 0 %} - {% if voted==-1 %} - - {% endif %} - {% elif v %} - - {% else %} - - {% endif %} -
      +
    {% endif %}
    @@ -447,24 +462,24 @@
    - +   - +   - +   -
    Comment @@ -788,7 +803,7 @@ {% if v %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 5d94d4319b..ba52211849 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -6,12 +6,12 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index f2e2eeebd7..b4d6781e37 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -81,7 +81,7 @@
    - + - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
    diff --git a/files/templates/login.html b/files/templates/login.html index 9c9c5a8058..44cd052659 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -17,7 +17,7 @@ {% endblock %} - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index eab0352920..ae602be2a5 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -13,7 +13,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index ef3e3211b9..98df69b043 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -33,7 +33,7 @@ - + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 40d3257f83..cebacdd536 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -38,10 +38,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/settings_profile.html b/files/templates/settings_profile.html index 46c1bd6709..20228ad53f 100644 --- a/files/templates/settings_profile.html +++ b/files/templates/settings_profile.html @@ -544,7 +544,7 @@  
    
    diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html
    index b0e483a581..de973ecd8f 100644
    --- a/files/templates/sign_up.html
    +++ b/files/templates/sign_up.html
    @@ -30,7 +30,7 @@
     		{% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %}
     
     		
    -		
    +		
     
     
     
    @@ -151,7 +151,7 @@
     
     
     {% if hcaptcha %}
    -	
    +	
     {% endif %}
     
     
    diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html
    index 2e2387b64f..5b6f6eca62 100644
    --- a/files/templates/sign_up_failed_ref.html
    +++ b/files/templates/sign_up_failed_ref.html
    @@ -31,7 +31,7 @@
     		{% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %}
     
     		
    -		
    +		
     
     
     
    diff --git a/files/templates/submission.html b/files/templates/submission.html
    index 4fd25dc694..a07056a5f3 100644
    --- a/files/templates/submission.html
    +++ b/files/templates/submission.html
    @@ -339,7 +339,7 @@
     						{% endif %}
     						{{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %}
     						 {{p.age_string}}
    -						({% if p.is_image %}image post{% elif p.realurl(v) %}{{p.domain}}{% else %}text post{% endif %})
    +						({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.realurl(v) %}{{p.domain}}{% else %}text post{% endif %})
     
     						{% if p.edited_utc %}
     							  Edited {{p.edited_string}}
    @@ -408,7 +408,7 @@
     									
     								
     								
    
    -							{% elif p.url and p.url.lower().endswith('.mp4') %}
    +							{% elif p.is_video %}
     								
    
    -							{% elif p.url and p.url.lower().endswith('.webm') %}
    -								
    -
    - -
    -
    -
    
     							{% endif %}
     							{{p.realbody(v) | safe}}
     
    @@ -477,7 +468,7 @@
     
     										
     						
     										 
    @@ -751,7 +742,7 @@
     				 
     				
     			
     			Comment
    diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html
    index 3338aac2e6..390dd8c48a 100644
    --- a/files/templates/submission_listing.html
    +++ b/files/templates/submission_listing.html
    @@ -185,7 +185,7 @@
     				{{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %}
     				 {{p.age_string}}
     				 
    -				({% if p.is_image %}image post{% elif p.realurl(v) %}{{p.domain}}{% else %}text post{% endif %})
    +				({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.realurl(v) %}{{p.domain}}{% else %}text post{% endif %})
     				{% if p.edited_utc %}
     					  Edited {{p.edited_string}}
     				{% endif %}
    @@ -506,20 +506,12 @@
     				Unable to load image
     			
     		
    -	{% endif %}
    -
    -	{% if p.url and p.url.lower().endswith('.mp4') %}
    +	{% elif p.is_video %}
     		
    - {% 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}} diff --git a/files/templates/submit.html b/files/templates/submit.html index 213786b26f..2405a10189 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -25,11 +25,11 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} @@ -122,7 +122,7 @@
    
    @@ -175,7 +175,7 @@
     		
     		{% endblock %}
     
    -		
    +