From 96fb2fd4285cb35ddc2b11438726d185621753fd Mon Sep 17 00:00:00 2001 From: Pablo Ferreiro Date: Sat, 3 Sep 2022 13:21:43 +0200 Subject: [PATCH] Proxy support --- .env.example | 6 ++++++ app/Helpers/Wrappers.php | 14 ++++++++++++++ composer.json | 2 +- composer.lock | 14 +++++++------- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index ec0810d..9645185 100644 --- a/.env.example +++ b/.env.example @@ -14,3 +14,9 @@ # JSON cache, used on Helpers\CacheEngines\JSONCache # API_CACHE_JSON=/tmp/proxitok_api # Path for JSON API Cache, leave commented for ./cache/api + +# Proxy Config +# PROXY_HOST=http://EXAMPLE_IP # Host to be used as proxy, make sure to type a valid protocol. Available: http:// | https:// | socks4:// | socks5:// +# PROXY_PORT=8080 +# PROXY_USERNAME=username +# PROXY_PASSWORD=password diff --git a/app/Helpers/Wrappers.php b/app/Helpers/Wrappers.php index 40173d9..cedba05 100644 --- a/app/Helpers/Wrappers.php +++ b/app/Helpers/Wrappers.php @@ -71,6 +71,20 @@ class Wrappers { 'close_when_done' => false ] ]; + + // -- PROXY CONFIG -- // + $proxy_host = Misc::env('PROXY_HOST', ''); + $proxy_port = Misc::env('PROXY_PORT', ''); + + if ($proxy_host && $proxy_port) { + $options['proxy'] = [ + 'host' => $proxy_host, + 'port' => $proxy_port, + 'username' => Misc::env('PROXY_USERNAME', null), + 'password' => Misc::env('PROXY_PASSWORD', null) + ]; + } + // Cache config $cacheEngine = null; if (isset($_ENV['API_CACHE'])) { diff --git a/composer.json b/composer.json index 227bbd9..aa8f39a 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "pablouser1/proxitok", "description": "An alternative frontend for TikTok", - "version": "2.4.0.0", + "version": "2.4.1.0", "license": "AGPL-3.0-or-later", "type": "project", "authors": [ diff --git a/composer.lock b/composer.lock index 39685b0..774c1a5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "521fa35e5864d7a4542823e1f4838018", + "content-hash": "a7e4990ac4c1935a8cdc93939bf26dc9", "packages": [ { "name": "bramus/router", @@ -263,16 +263,16 @@ }, { "name": "pablouser1/tikscraper", - "version": "v2.2.1.0", + "version": "v2.2.1.1", "source": { "type": "git", "url": "https://github.com/pablouser1/TikScraperPHP.git", - "reference": "53024570fe8a0258d911e5a245fe582090739a19" + "reference": "535ed6db108c9a0ec41b271bea8a6a10700cc5d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/53024570fe8a0258d911e5a245fe582090739a19", - "reference": "53024570fe8a0258d911e5a245fe582090739a19", + "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/535ed6db108c9a0ec41b271bea8a6a10700cc5d7", + "reference": "535ed6db108c9a0ec41b271bea8a6a10700cc5d7", "shasum": "" }, "require": { @@ -304,9 +304,9 @@ "description": "Get data from TikTok API", "support": { "issues": "https://github.com/pablouser1/TikScraperPHP/issues", - "source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.2.1.0" + "source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.2.1.1" }, - "time": "2022-08-17T12:43:32+00:00" + "time": "2022-09-03T11:19:59+00:00" }, { "name": "php-webdriver/webdriver",