From c6edcb97eb7451b9a6922561711eaf2a69ef0d42 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 8 Aug 2021 20:32:18 +0200 Subject: [PATCH] fd --- files/__main__.py | 2 +- files/classes/images.py | 2 +- files/helpers/sanitize.py | 2 - files/templates/default.html | 60 ++++++++++++++++++------- files/templates/formatting.html | 1 + files/templates/submission_listing.html | 4 ++ 6 files changed, 52 insertions(+), 19 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index cd92903c9..ffc6bd4f3 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -263,7 +263,7 @@ def after_request(response): response.headers.add("Strict-Transport-Security", "max-age=31536000") response.headers.add("Referrer-Policy", "same-origin") response.headers.add("Feature-Policy", - "geolocation 'none'; midi 'none'; notifications 'none'; push 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; vibrate 'none'; fullscreen 'none'; payment 'none';") + "geolocation 'none'; midi 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; fullscreen 'none'; payment 'none';") if not request.path.startswith("/embed/"): response.headers.add("X-Frame-Options", "deny") diff --git a/files/classes/images.py b/files/classes/images.py index 5840c350a..9f635cc10 100644 --- a/files/classes/images.py +++ b/files/classes/images.py @@ -13,7 +13,7 @@ class Image(Base): @property def path(self): - return f"/assets/images/platy.jpg" + return f"/assets/images/cover.png" diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index eb53d4b37..1df907645 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -124,8 +124,6 @@ def sanitize(text, linkgen=False, flair=False): if not url: continue netloc = urlparse(url).netloc - domain = get_domain(netloc) - if "profile-pic-20" not in tag.get("class", ""): #print(tag.get('class')) # set classes and wrap in link diff --git a/files/templates/default.html b/files/templates/default.html index 870a61503..b1be4ede6 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -362,21 +362,6 @@ }); - - - - $('.expandable-image').click( function(event) { - - if (event.which != 1) { - return - } - event.preventDefault(); - - var url= $(this).data('url'); - - expandDesktopImage(url,url); - }) - $('.text-expand').click(function(event){ if (event.which != 1) { return @@ -468,6 +453,18 @@ // Expand Images on Desktop + $('.expandable-image').click( function(event) { + + if (event.which != 1) { + return + } + event.preventDefault(); + + var url= $(this).data('url'); + + expandDesktopImage(url,url); + }) + function expandDesktopImage(image, link) { // Link text @@ -484,6 +481,38 @@ linkText.textContent = 'View original'; }; + + // Expand Videos on Desktop + + $('.expandable-video').click( function(event) { + + if (event.which != 1) { + return + } + event.preventDefault(); + + var url= $(this).data('url'); + + expandDesktopVideo(url,url); + }) + + function expandDesktopVideo(video, link) { + + // Link text + + var linkText = document.getElementById("desktop-expanded-video-link"); + var imgLink = document.getElementById("desktop-expanded-video-wrap-link"); + + var inlineVideo = document.getElementById("desktop-expanded-video"); + + inlineVideo.src = Video.replace("100w.gif", "giphy.gif"); + linkText.href = Video; + imgLink.href=Video; + + linkText.textContent = 'View original'; + }; + + post_comment=function(fullname){ @@ -1096,6 +1125,7 @@ {% endif %} {% include "expanded_image_modal.html" %} +{% include "expanded_video_modal.html" %} diff --git a/files/templates/formatting.html b/files/templates/formatting.html index 522cea2ae..89113f59d 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -143,6 +143,7 @@ We also have some custom hooks for mentioning users and subreddits. Note that th {% include "expanded_image_modal.html" %} +{% include "expanded_video_modal.html" %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index ed021aead..5abdc16e2 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -72,6 +72,10 @@ + {% elif "streamable.com" in p.url %} + + + {% else %}