Accept chromedriver url for sign and .env cleanup

This commit is contained in:
Pablo Ferreiro 2022-03-13 23:18:10 +01:00
parent d061c210a2
commit c682432920
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
7 changed files with 195 additions and 36 deletions

View file

@ -1,17 +1,18 @@
# APP_URL="http://localhost:8000" # Full url path, PLEASE REPLACE TO YOUR OWN ONE # APP_URL="http://localhost:8000" # Full url path, PLEASE REPLACE TO YOUR OWN ONE
# LATTE_CACHE=/tmp/proxitok_api # Path for Latte cache, leave commented for ./cache/latte
# API CONFIG # API CONFIG
# USE_TEST_ENDPOINTS=1 # Discomment for usage of testing TikTok endpoints, may help sometimes # API_FORCE_LEGACY=1 # Force legacy mode for wrapper
# SIGNER_URL="https://example.com" # External signing service # API_SIGNER_URL="https://example.com" # External signing service
# FORCE_LEGACY=1 # Force legacy mode for wrapper # API_BROWSER_URL="http://localhost:4444" # chromedriver url
# API_TEST_ENDPOINTS=1 # Discomment for usage of testing TikTok endpoints, may help sometimes
# API_CACHE=redis
# Proxy Config, will be used to make TikTok requests, useful if having VERIFY_CODE issues # Proxy Config, will be used to make TikTok requests, useful if having VERIFY_CODE issues
# PROXY_HOST=HOSTNAME # PROXY_HOST=HOSTNAME
# PROXY_PORT=8080 # PROXY_PORT=8080
# PROXY_USERNAME=USERNAME # PROXY_USERNAME=USERNAME
# PROXY_PASSWORD=PASSWORD # PROXY_PASSWORD=PASSWORD
# LATTE_CACHE=/tmp/proxitok_api # Path for Latte cache, leave commented for ./cache/latte
# API_CACHE=redis # Cache engine for TikTok Api, (more info on README)
# Redis cache, used on Helpers\CacheEngines\RedisCache (CHOOSE ONE) # Redis cache, used on Helpers\CacheEngines\RedisCache (CHOOSE ONE)
# REDIS_HOST=localhost # Host or path to unix socket # REDIS_HOST=localhost # Host or path to unix socket

View file

@ -48,11 +48,21 @@ Available cache engines:
You don't have to do anything more You don't have to do anything more
### Nginx ### Nginx
You can get a config example on /setup/nginx.conf ```
location / {
try_files $uri $uri/ /index.php?$query_string;
}
## TODO location /.env {
deny all;
return 404;
}
```
## TODO / Known issues
* Docker
* Full installation instructions
* Add a NoJS version / Make the whole program without required JS * Add a NoJS version / Make the whole program without required JS
* Better error handling
* Make video on /video fit screen and don't overflow * Make video on /video fit screen and don't overflow
* i18n * i18n

View file

@ -34,14 +34,18 @@ class Misc {
*/ */
static public function api() { static public function api() {
$options = [ $options = [
'remote_signer' => self::env('SIGNER_URL', 'http://localhost:8080/signature'), 'use_test_endpoints' => self::env('API_TEST_ENDPOINTS', false),
'use_test_endpoints' => self::env('USE_TEST_ENDPOINTS', false),
// Instance level proxy config // Instance level proxy config
'proxy' => [ 'proxy' => [
'host' => self::env('PROXY_HOST', null), 'host' => self::env('PROXY_HOST', null),
'port' => self::env('PROXY_PORT', null), 'port' => self::env('PROXY_PORT', null),
'user' => self::env('PROXY_USER', null), 'user' => self::env('PROXY_USER', null),
'password' => self::env('PROXY_PASSWORD', null) 'password' => self::env('PROXY_PASSWORD', null)
],
'signer' => [
'remote_url' => self::env('API_SIGNER_URL', ''),
'browser_url' => self::env('API_BROWSER_URL', ''),
'close_when_done' => false
] ]
]; ];
// User level proxy config, will overwrite instance config // User level proxy config, will overwrite instance config
@ -78,7 +82,7 @@ class Misc {
} }
// Legacy mode // Legacy mode
$legacy = self::env('FORCE_LEGACY', false) || isset($_COOKIE['api-legacy']) && $_COOKIE['api-legacy'] === 'on'; $legacy = self::env('API_FORCE_LEGACY', false) || isset($_COOKIE['api-legacy']) && $_COOKIE['api-legacy'] === 'on';
return $legacy === false ? new \TikScraper\Api($options, $cacheEngine) : new \TikScraper\Legacy($options, $cacheEngine); return $legacy === false ? new \TikScraper\Api($options, $cacheEngine) : new \TikScraper\Legacy($options, $cacheEngine);
} }

View file

@ -1,7 +1,7 @@
{ {
"name": "pablouser1/proxitok", "name": "pablouser1/proxitok",
"description": "An alternative frontend for TikTok", "description": "An alternative frontend for TikTok",
"version": "2.0.0.3", "version": "2.1.0.0",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"type": "project", "type": "project",
"homepage": "https://github.com/pablouser1/ProxiTok", "homepage": "https://github.com/pablouser1/ProxiTok",
@ -11,12 +11,6 @@
"homepage": "https://github.com/pablouser1" "homepage": "https://github.com/pablouser1"
} }
], ],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/pablouser1/TikTok-API-PHP"
}
],
"require": { "require": {
"ext-redis": "^5.3.2", "ext-redis": "^5.3.2",
"ext-mbstring": "*", "ext-mbstring": "*",
@ -24,7 +18,7 @@
"vlucas/phpdotenv": "^5.4", "vlucas/phpdotenv": "^5.4",
"bramus/router": "^1.6", "bramus/router": "^1.6",
"mibe/feedwriter": "^1.1", "mibe/feedwriter": "^1.1",
"pablouser1/tikscraper": "^1.2" "pablouser1/tikscraper": "^1.3"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

174
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "cadd5f76328389373f21a069e55f8aae", "content-hash": "dcd701a81d130026c44b63870c9a9f73",
"packages": [ "packages": [
{ {
"name": "bramus/router", "name": "bramus/router",
@ -306,20 +306,22 @@
}, },
{ {
"name": "pablouser1/tikscraper", "name": "pablouser1/tikscraper",
"version": "v1.2.7.6", "version": "v1.3.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/pablouser1/TikScraperPHP.git", "url": "https://github.com/pablouser1/TikScraperPHP.git",
"reference": "e7e682726e76541dc47d14dd259a29b3c0364790" "reference": "793dde26e17362af304b9f50890c7fc178387629"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/e7e682726e76541dc47d14dd259a29b3c0364790", "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/793dde26e17362af304b9f50890c7fc178387629",
"reference": "e7e682726e76541dc47d14dd259a29b3c0364790", "reference": "793dde26e17362af304b9f50890c7fc178387629",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.3|^8.0" "php": ">=7.3|^8.0",
"php-webdriver/webdriver": "^1.12",
"sapistudio/seleniumstealth": "^1.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -339,9 +341,74 @@
"description": "Get data from TikTok API", "description": "Get data from TikTok API",
"support": { "support": {
"issues": "https://github.com/pablouser1/TikScraperPHP/issues", "issues": "https://github.com/pablouser1/TikScraperPHP/issues",
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.2.7.6" "source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.3.0.3"
}, },
"time": "2022-03-12T18:27:40+00:00" "time": "2022-03-13T20:53:27+00:00"
},
{
"name": "php-webdriver/webdriver",
"version": "1.12.0",
"source": {
"type": "git",
"url": "https://github.com/php-webdriver/php-webdriver.git",
"reference": "99d4856ed7dffcdf6a52eccd6551e83d8d557ceb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/99d4856ed7dffcdf6a52eccd6551e83d8d557ceb",
"reference": "99d4856ed7dffcdf6a52eccd6551e83d8d557ceb",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-zip": "*",
"php": "^5.6 || ~7.0 || ^8.0",
"symfony/polyfill-mbstring": "^1.12",
"symfony/process": "^2.8 || ^3.1 || ^4.0 || ^5.0 || ^6.0"
},
"replace": {
"facebook/webdriver": "*"
},
"require-dev": {
"ondram/ci-detector": "^2.1 || ^3.5 || ^4.0",
"php-coveralls/php-coveralls": "^2.4",
"php-mock/php-mock-phpunit": "^1.1 || ^2.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpunit/phpunit": "^5.7 || ^7 || ^8 || ^9",
"squizlabs/php_codesniffer": "^3.5",
"symfony/var-dumper": "^3.3 || ^4.0 || ^5.0 || ^6.0"
},
"suggest": {
"ext-SimpleXML": "For Firefox profile creation"
},
"type": "library",
"autoload": {
"files": [
"lib/Exception/TimeoutException.php"
],
"psr-4": {
"Facebook\\WebDriver\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A PHP client for Selenium WebDriver. Previously facebook/webdriver.",
"homepage": "https://github.com/php-webdriver/php-webdriver",
"keywords": [
"Chromedriver",
"geckodriver",
"php",
"selenium",
"webdriver"
],
"support": {
"issues": "https://github.com/php-webdriver/php-webdriver/issues",
"source": "https://github.com/php-webdriver/php-webdriver/tree/1.12.0"
},
"time": "2021-10-14T09:30:02+00:00"
}, },
{ {
"name": "phpoption/phpoption", "name": "phpoption/phpoption",
@ -414,6 +481,36 @@
], ],
"time": "2021-12-04T23:24:31+00:00" "time": "2021-12-04T23:24:31+00:00"
}, },
{
"name": "sapistudio/seleniumstealth",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/Sapistudio/SeleniumStealth.git",
"reference": "4b392077e3d609fed564b78ae2e8becb98f01957"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Sapistudio/SeleniumStealth/zipball/4b392077e3d609fed564b78ae2e8becb98f01957",
"reference": "4b392077e3d609fed564b78ae2e8becb98f01957",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"SapiStudio\\SeleniumStealth\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"support": {
"issues": "https://github.com/Sapistudio/SeleniumStealth/issues",
"source": "https://github.com/Sapistudio/SeleniumStealth/tree/1.0.3"
},
"time": "2022-01-10T20:04:41+00:00"
},
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.25.0", "version": "v1.25.0",
@ -662,6 +759,67 @@
], ],
"time": "2022-03-04T08:16:47+00:00" "time": "2022-03-04T08:16:47+00:00"
}, },
{
"name": "symfony/process",
"version": "v6.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "1ccceccc6497e96f4f646218f04b97ae7d9fa7a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/1ccceccc6497e96f4f646218f04b97ae7d9fa7a1",
"reference": "1ccceccc6497e96f4f646218f04b97ae7d9fa7a1",
"shasum": ""
},
"require": {
"php": ">=8.0.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v6.0.5"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-01-30T18:19:12+00:00"
},
{ {
"name": "vlucas/phpdotenv", "name": "vlucas/phpdotenv",
"version": "v5.4.1", "version": "v5.4.1",

View file

@ -1,8 +0,0 @@
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /.env {
deny all;
return 404;
}

View file

@ -7,7 +7,7 @@
{block content} {block content}
<p class="title">About this instance</p> <p class="title">About this instance</p>
<p>Forcing Legacy mode: {isset($_ENV['FORCE_LEGACY']) ? 'yes' : 'no'}</p> <p>Forcing Legacy mode: {isset($_ENV['API_FORCE_LEGACY']) ? 'yes' : 'no'}</p>
<p>Instance-level Proxy: {isset($_ENV['PROXY_HOST']) ? 'yes' : 'no'}</p> <p>Instance-level Proxy: {isset($_ENV['PROXY_HOST']) ? 'yes' : 'no'}</p>
<hr /> <hr />
<p class="title">Why would I want to use ProxiTok?</p> <p class="title">Why would I want to use ProxiTok?</p>