From 5092659a215fe90e3930b351d987f7d3d5e6602c Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Sun, 7 Jun 2020 22:39:23 +0200 Subject: [PATCH] check if ad enabled --- go.mod | 4 ++-- go.sum | 5 +++++ res/include/script/file_viewer/Viewer.js | 3 +++ webcontroller/file_preview.go | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a1d25c2..78a6770 100644 --- a/go.mod +++ b/go.mod @@ -10,13 +10,13 @@ replace ( ) require ( - fornaxian.com/pixeldrain-api v0.0.0-20200224165550-54483c862cd0 + fornaxian.com/pixeldrain-api v0.0.0-20200607143707-5b697aff6c1e github.com/Fornaxian/config v0.0.0-20180915150834-ac41cf746a70 github.com/Fornaxian/log v0.0.0-20190617093801-1c7ce9a7c9b3 github.com/Fornaxian/pd_mime_type v0.0.0-20200204165508-2815edf3a145 github.com/google/uuid v1.1.1 github.com/julienschmidt/httprouter v1.3.0 github.com/microcosm-cc/bluemonday v1.0.2 + github.com/russross/blackfriday/v2 v2.0.1 github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect - gopkg.in/russross/blackfriday.v2 v2.0.0 ) diff --git a/go.sum b/go.sum index 5a0e0f2..f99fbed 100644 --- a/go.sum +++ b/go.sum @@ -47,7 +47,12 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= +github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday v2.0.0+incompatible h1:cBXrhZNUf9C+La9/YpS+UHpUT8YD6Td9ZMSU9APFcsk= +github.com/russross/blackfriday v2.0.0+incompatible/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= diff --git a/res/include/script/file_viewer/Viewer.js b/res/include/script/file_viewer/Viewer.js index 7b868c5..f0d7860 100644 --- a/res/include/script/file_viewer/Viewer.js +++ b/res/include/script/file_viewer/Viewer.js @@ -133,6 +133,9 @@ Viewer.prototype.setFile = function(file) { } Viewer.prototype.renderSponsors = function() { + // Check if the ad is enabled + if (document.querySelector(".sponsors_banner") == null) { return } + let scaleWidth = 1 let scaleHeight = 1 let minWindowHeight = 800 diff --git a/webcontroller/file_preview.go b/webcontroller/file_preview.go index bd8ebab..8b2255e 100644 --- a/webcontroller/file_preview.go +++ b/webcontroller/file_preview.go @@ -11,7 +11,7 @@ import ( "github.com/Fornaxian/log" "github.com/julienschmidt/httprouter" "github.com/microcosm-cc/bluemonday" - "gopkg.in/russross/blackfriday.v2" + blackfriday "github.com/russross/blackfriday/v2" ) // ServeFilePreview controller for GET /u/:id/preview