summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorus2019-05-14 12:06:00 +0200
committerhorus2019-05-14 12:06:00 +0200
commit1f192bc0ea6a41fe2702dac0386390225188b127 (patch)
tree4a29a16c6b477b6145a542fe8fc2c8f0186358f5
parent53e398f69ead13feaf26cdd5ae0449fa6174e753 (diff)
downloadkategorischeraperitif-1f192bc0ea6a41fe2702dac0386390225188b127.tar.gz
Rewrites images through a reverse proxy (camo) to increase privacy and prevent mixed contents warnings.
-rw-r--r--app/Libraries/TemplateFunction.php12
-rw-r--r--composer.json3
-rw-r--r--composer.lock53
-rw-r--r--resources/views/offers.blade.php2
4 files changed, 67 insertions, 3 deletions
diff --git a/app/Libraries/TemplateFunction.php b/app/Libraries/TemplateFunction.php
index 54a36de..c84b127 100644
--- a/app/Libraries/TemplateFunction.php
+++ b/app/Libraries/TemplateFunction.php
@@ -20,4 +20,16 @@ class TemplateFunction {
public static function T($timestamp) {
return gmdate("d.m.Y.", $timestamp);
}
+
+ public static function Camo($url) {
+ if ( "" != env("GOCAMO_HMAC") && "" != env("GOCAMO_URL") ) {
+ $phpamo = new \WillWashburn\Phpamo\Phpamo(
+ env("GOCAMO_HMAC"),
+ env("GOCAMO_URL")
+ );
+ return $phpamo->camo($url);
+ }
+
+ return $url;
+ }
}
diff --git a/composer.json b/composer.json
index 44e1e2c..4163507 100644
--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,8 @@
"laravel/framework": "5.6.*",
"laravel/tinker": "~1.0",
"piwik/piwik-php-tracker": "^1.4",
- "roumen/feed": "^2.12"
+ "roumen/feed": "^2.12",
+ "willwashburn/phpamo": "^1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
diff --git a/composer.lock b/composer.lock
index f1064d7..8fd302e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "9e4429f37916161d55b6c32191b012fc",
+ "content-hash": "067d134054f1e68f6e91eb5ae953a7d6",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@@ -1361,6 +1361,7 @@
"laravel",
"rss"
],
+ "abandoned": "laravelium/feed",
"time": "2018-02-07T20:50:19+00:00"
},
{
@@ -2320,6 +2321,55 @@
"environment"
],
"time": "2016-09-01T10:05:43+00:00"
+ },
+ {
+ "name": "willwashburn/phpamo",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/willwashburn/phpamo.git",
+ "reference": "4c8e579bc9be5d8eabc06ed4de22235386b2dbf1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/willwashburn/phpamo/zipball/4c8e579bc9be5d8eabc06ed4de22235386b2dbf1",
+ "reference": "4c8e579bc9be5d8eabc06ed4de22235386b2dbf1",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "WillWashburn\\Phpamo\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Will Washburn",
+ "email": "will.washburn@gmail.com"
+ }
+ ],
+ "description": "A PHP library to create urls for Camo - the SSL image proxy",
+ "homepage": "https://github.com/willwashburn/phpamo",
+ "keywords": [
+ "atmos camo",
+ "camo",
+ "proxy",
+ "ssl",
+ "ssl proxy",
+ "tls",
+ "tls proxy"
+ ],
+ "time": "2017-01-30T13:21:01+00:00"
}
],
"packages-dev": [
@@ -3407,6 +3457,7 @@
"mock",
"xunit"
],
+ "abandoned": true,
"time": "2018-02-01T13:11:13+00:00"
},
{
diff --git a/resources/views/offers.blade.php b/resources/views/offers.blade.php
index acf507a..ffbe7ce 100644
--- a/resources/views/offers.blade.php
+++ b/resources/views/offers.blade.php
@@ -14,7 +14,7 @@ foreach( $data as $offer) {
<div class="card-img-overlay card-img-overlay-badge" >
<p class="card-text float-right rounded off-badge" >{{ $offer->procent}} %</p>
</div>
- <img src="{{ $offer->image_url }}" class="card-img img-fluid mx-auto d-block" >
+ <img src="{{ TF::Camo($offer->image_url) }}" class="card-img img-fluid mx-auto d-block" >
</div>
<div class="col-md-8 px-10">
<div class="card-header">