From 8e6c5c4b8f59e9874aa99bb5db5de8f521de0ab3 Mon Sep 17 00:00:00 2001 From: horus Date: Fri, 18 Sep 2020 21:27:29 +0200 Subject: camo the images --- app/helpers.php | 12 +++++++++ composer.json | 3 ++- composer.lock | 51 +++++++++++++++++++++++++++++++++++- resources/views/anime.blade.php | 2 +- resources/views/list_anime.blade.php | 2 +- 5 files changed, 66 insertions(+), 4 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 9d1586c..4c946f7 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -116,3 +116,15 @@ function getSeasonFromDate($aired_at) { return array("name" => getSeason($aired_from->month), "year" => $aired_from->year); } + +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 ebb752b..fd0e35c 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "jikan-me/jikan": "^2.16", "laravel/framework": "^7.28", "laravel/tinker": "^2.0", - "nesbot/carbon": "^2.30" + "nesbot/carbon": "^2.30", + "willwashburn/phpamo": "^1.0" }, "require-dev": { "facade/ignition": "^2.0", diff --git a/composer.lock b/composer.lock index c0193d3..8f32b9b 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": "e56307c7101f2d40e5733f67cd1c7659", + "content-hash": "436dc9f95ba32317f801635bff204772", "packages": [ { "name": "brick/math", @@ -4126,6 +4126,55 @@ "php" ], "time": "2020-07-22T23:32:04+00:00" + }, + { + "name": "willwashburn/phpamo", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/willwashburn/phpamo.git", + "reference": "026e44648c7e4154ef50763a3f0feed81b259054" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/willwashburn/phpamo/zipball/026e44648c7e4154ef50763a3f0feed81b259054", + "reference": "026e44648c7e4154ef50763a3f0feed81b259054", + "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": "2020-04-21T12:28:46+00:00" } ], "packages-dev": [ diff --git a/resources/views/anime.blade.php b/resources/views/anime.blade.php index 0e9da1e..66d9373 100644 --- a/resources/views/anime.blade.php +++ b/resources/views/anime.blade.php @@ -6,7 +6,7 @@