From 47a44fd6047714bde36dbd982d11daf2cf9de9c7 Mon Sep 17 00:00:00 2001 From: Dominik Pfennig <dominik@suma-ev.de> Date: Thu, 1 Feb 2018 13:02:17 +0100 Subject: [PATCH] Automatisches Update sollte nun funktionieren MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Außerdem werden die href attribute von area tags nun korrekt proxifiziert. --- .gitlab-ci.yml | 1 + app/HtmlDocument.php | 9 +++++++++ app/Http/Controllers/ProxyController.php | 1 + 3 files changed, 11 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d6765c..4f03838 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,6 +19,7 @@ update(proxy.suma-ev.de): - npm install - npm run production - cp ~/.env . + - touch storage/logs/laravel.log - chmod -R 777 storage - chmod -R 777 bootstrap/cache - if [ -f ~/Proxy/artisan ]; then php ~/Proxy/artisan down;fi diff --git a/app/HtmlDocument.php b/app/HtmlDocument.php index e8132b8..09dc186 100644 --- a/app/HtmlDocument.php +++ b/app/HtmlDocument.php @@ -97,6 +97,15 @@ class HtmlDocument extends Document foreach ($dom->getElementsByTagName('area') as $area) { # All Links within a "a" Tag need to target the top level because they change the site on click $this->convertTargetAttribute($area, "_top"); + if ($area->hasAttribute("href")) { + $href = $area->getAttribute("href"); + # Rel to abs + $href = $this->convertRelativeToAbsoluteLink($href); + # Abs to proxified + $href = $this->proxifyUrl($href, true); + # And replace + $area->setAttribute("href", $href); + } } foreach ($dom->getElementsByTagName('form') as $form) { diff --git a/app/Http/Controllers/ProxyController.php b/app/Http/Controllers/ProxyController.php index ab4ebca..0803fd3 100644 --- a/app/Http/Controllers/ProxyController.php +++ b/app/Http/Controllers/ProxyController.php @@ -191,6 +191,7 @@ class ProxyController extends Controller case 'image/vnd.microsoft.icon': case 'application/vnd.ms-fontobject': case 'application/x-font-ttf': + case 'application/x-www-form-urlencoded': # Nothing to do with Images: Just return them break; case 'text/css': -- GitLab