temp favicon, updated scrapper and .env changes
This commit is contained in:
parent
574ae51582
commit
ebe5941fa2
|
@ -2,8 +2,8 @@
|
||||||
# LATTE_CACHE=/tmp/proxitok_api # Path for Latte cache, leave commented for ./cache/latte
|
# LATTE_CACHE=/tmp/proxitok_api # Path for Latte cache, leave commented for ./cache/latte
|
||||||
|
|
||||||
# API CONFIG
|
# API CONFIG
|
||||||
# API_SIGNER_URL="https://example.com" # External signing service
|
# API_SIGNER="remote"
|
||||||
# API_BROWSER_URL="http://localhost:4444" # chromedriver url
|
# API_SIGNER_URL="http://localhost:8080"
|
||||||
# API_TEST_ENDPOINTS=true # Uncomment for usage of testing TikTok endpoints, may help sometimes
|
# API_TEST_ENDPOINTS=true # Uncomment for usage of testing TikTok endpoints, may help sometimes
|
||||||
# API_CACHE=redis
|
# API_CACHE=redis
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM php:8-apache
|
FROM php:8.1-apache
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
||||||
RUN apt update -y && apt upgrade -y \
|
RUN apt update -y && apt upgrade -y \
|
||||||
|
|
|
@ -33,6 +33,7 @@ Apply to: Main window (address bar)
|
||||||
```
|
```
|
||||||
|
|
||||||
## TODO / Known issues
|
## TODO / Known issues
|
||||||
|
* Replace placeholder favicon
|
||||||
* Make video on /video fit screen and don't overflow
|
* Make video on /video fit screen and don't overflow
|
||||||
* Fix embed styling
|
* Fix embed styling
|
||||||
* Fix crash when invalid vm.tiktok.com/CODE or www.tiktok.com/t/CODE is provided
|
* Fix crash when invalid vm.tiktok.com/CODE or www.tiktok.com/t/CODE is provided
|
||||||
|
|
BIN
android-chrome-192x192.png
Normal file
BIN
android-chrome-192x192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
android-chrome-512x512.png
Normal file
BIN
android-chrome-512x512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Cache;
|
namespace App\Cache;
|
||||||
|
|
||||||
class JSONCache {
|
use TikScraper\CacheInterface;
|
||||||
|
|
||||||
|
class JSONCache implements CacheInterface {
|
||||||
private string $cache_path = __DIR__ . '/../../cache/api';
|
private string $cache_path = __DIR__ . '/../../cache/api';
|
||||||
|
|
||||||
function __construct() {
|
function __construct() {
|
||||||
|
@ -24,7 +26,7 @@ class JSONCache {
|
||||||
return is_file($filename);
|
return is_file($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set(string $cache_key, mixed $data, $timeout = 3600) {
|
public function set(string $cache_key, string $data, $timeout = 3600) {
|
||||||
file_put_contents($this->cache_path . '/' . $cache_key . '.json', $data);
|
file_put_contents($this->cache_path . '/' . $cache_key . '.json', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Cache;
|
namespace App\Cache;
|
||||||
|
|
||||||
class RedisCache {
|
use TikScraper\CacheInterface;
|
||||||
|
|
||||||
|
class RedisCache implements CacheInterface {
|
||||||
private \Redis $client;
|
private \Redis $client;
|
||||||
function __construct(string $host, int $port, ?string $password) {
|
function __construct(string $host, int $port, ?string $password) {
|
||||||
$this->client = new \Redis();
|
$this->client = new \Redis();
|
||||||
|
@ -21,10 +23,7 @@ class RedisCache {
|
||||||
|
|
||||||
public function get(string $cache_key): ?object {
|
public function get(string $cache_key): ?object {
|
||||||
$data = $this->client->get($cache_key);
|
$data = $this->client->get($cache_key);
|
||||||
if ($data) {
|
return $data ? json_decode($data) : null;
|
||||||
return json_decode($data);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function exists(string $cache_key): bool {
|
public function exists(string $cache_key): bool {
|
||||||
|
|
7
app/Constants/CacheMethods.php
Normal file
7
app/Constants/CacheMethods.php
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Constants;
|
||||||
|
|
||||||
|
class CacheMethods {
|
||||||
|
const JSON = 'json';
|
||||||
|
const REDIS = 'redis';
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ namespace App\Helpers;
|
||||||
|
|
||||||
use App\Cache\JSONCache;
|
use App\Cache\JSONCache;
|
||||||
use App\Cache\RedisCache;
|
use App\Cache\RedisCache;
|
||||||
|
use App\Constants\CacheMethods;
|
||||||
|
|
||||||
class Wrappers {
|
class Wrappers {
|
||||||
/**
|
/**
|
||||||
|
@ -49,22 +50,35 @@ class Wrappers {
|
||||||
* Setup of TikTok Api wrapper
|
* Setup of TikTok Api wrapper
|
||||||
*/
|
*/
|
||||||
static public function api(): \TikScraper\Api {
|
static public function api(): \TikScraper\Api {
|
||||||
|
$method = Misc::env('API_SIGNER', '');
|
||||||
|
$url = Misc::env('API_SIGNER_URL', '');
|
||||||
|
if (!$method) {
|
||||||
|
// Legacy support
|
||||||
|
$browser_url = Misc::env('API_BROWSER_URL', '');
|
||||||
|
if ($url) {
|
||||||
|
$method = 'remote';
|
||||||
|
} elseif ($browser_url) {
|
||||||
|
$url = $browser_url;
|
||||||
|
$method = 'browser';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'use_test_endpoints' => Misc::env('API_TEST_ENDPOINTS', false) || isset($_COOKIE['api-test_endpoints']) && $_COOKIE['api-test_endpoints'] === 'yes',
|
'use_test_endpoints' => Misc::env('API_TEST_ENDPOINTS', false) || isset($_COOKIE['api-test_endpoints']) && $_COOKIE['api-test_endpoints'] === 'yes',
|
||||||
'signer' => [
|
'signer' => [
|
||||||
'remote_url' => Misc::env('API_SIGNER_URL', ''),
|
'method' => $method,
|
||||||
'browser_url' => Misc::env('API_BROWSER_URL', ''),
|
'url' => $url,
|
||||||
'close_when_done' => false
|
'close_when_done' => false
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
// Cache config
|
// Cache config
|
||||||
$cacheEngine = false;
|
$cacheEngine = null;
|
||||||
if (isset($_ENV['API_CACHE'])) {
|
if (isset($_ENV['API_CACHE'])) {
|
||||||
switch ($_ENV['API_CACHE']) {
|
switch ($_ENV['API_CACHE']) {
|
||||||
case 'json':
|
case CacheMethods::JSON:
|
||||||
$cacheEngine = new JSONCache();
|
$cacheEngine = new JSONCache();
|
||||||
break;
|
break;
|
||||||
case 'redis':
|
case CacheMethods::REDIS:
|
||||||
if (!(isset($_ENV['REDIS_URL']) || isset($_ENV['REDIS_HOST'], $_ENV['REDIS_PORT']))) {
|
if (!(isset($_ENV['REDIS_URL']) || isset($_ENV['REDIS_HOST'], $_ENV['REDIS_PORT']))) {
|
||||||
throw new \Exception('You need to set REDIS_URL or REDIS_HOST and REDIS_PORT to use Redis Cache!');
|
throw new \Exception('You need to set REDIS_URL or REDIS_HOST and REDIS_PORT to use Redis Cache!');
|
||||||
}
|
}
|
||||||
|
|
BIN
apple-touch-icon.png
Normal file
BIN
apple-touch-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
|
@ -2,6 +2,10 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="{path('/apple-touch-icon.png')}">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="{path('/favicon-32x32.png')}">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="{path('/favicon-16x16.png')}">
|
||||||
|
<link rel="manifest" href="{path('/site.webmanifest')}">
|
||||||
<meta property="og:title" content="ProxiTok" />
|
<meta property="og:title" content="ProxiTok" />
|
||||||
<meta property="og:description" content="Alternative frontend for TikTok" />
|
<meta property="og:description" content="Alternative frontend for TikTok" />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "pablouser1/proxitok",
|
"name": "pablouser1/proxitok",
|
||||||
"description": "An alternative frontend for TikTok",
|
"description": "An alternative frontend for TikTok",
|
||||||
"version": "2.3.2.2",
|
"version": "2.4.0.0",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
"latte/latte": "^2.11",
|
"latte/latte": "^2.11",
|
||||||
"bramus/router": "^1.6",
|
"bramus/router": "^1.6",
|
||||||
"josegonzalez/dotenv": "dev-master",
|
"josegonzalez/dotenv": "dev-master",
|
||||||
"pablouser1/tikscraper": "^2.1"
|
"pablouser1/tikscraper": "^2.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
14
composer.lock
generated
14
composer.lock
generated
|
@ -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": "15ff00ea59afbf0d6d064d4cbefb05fb",
|
"content-hash": "4e398680c8c683b157043558c21a25ad",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "bramus/router",
|
"name": "bramus/router",
|
||||||
|
@ -263,16 +263,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pablouser1/tikscraper",
|
"name": "pablouser1/tikscraper",
|
||||||
"version": "v2.1.2.0",
|
"version": "v2.2.0.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pablouser1/TikScraperPHP.git",
|
"url": "https://github.com/pablouser1/TikScraperPHP.git",
|
||||||
"reference": "96326226e54de2d1feedcc708200ba023a0553e5"
|
"reference": "5561b82442caf4968f0c4f408ee5847a97cd8940"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/96326226e54de2d1feedcc708200ba023a0553e5",
|
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/5561b82442caf4968f0c4f408ee5847a97cd8940",
|
||||||
"reference": "96326226e54de2d1feedcc708200ba023a0553e5",
|
"reference": "5561b82442caf4968f0c4f408ee5847a97cd8940",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -304,9 +304,9 @@
|
||||||
"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/v2.1.2.0"
|
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.2.0.0"
|
||||||
},
|
},
|
||||||
"time": "2022-08-11T21:32:02+00:00"
|
"time": "2022-08-13T10:17:31+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "php-webdriver/webdriver",
|
"name": "php-webdriver/webdriver",
|
||||||
|
|
|
@ -11,6 +11,7 @@ services:
|
||||||
- API_CACHE=redis
|
- API_CACHE=redis
|
||||||
- REDIS_HOST=proxitok-redis
|
- REDIS_HOST=proxitok-redis
|
||||||
- REDIS_PORT=6379
|
- REDIS_PORT=6379
|
||||||
|
- API_SIGNER=remote
|
||||||
- API_SIGNER_URL=http://proxitok-signer:8080/signature
|
- API_SIGNER_URL=http://proxitok-signer:8080/signature
|
||||||
volumes:
|
volumes:
|
||||||
- proxitok-cache:/cache
|
- proxitok-cache:/cache
|
||||||
|
|
BIN
favicon-16x16.png
Normal file
BIN
favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 B |
BIN
favicon-32x32.png
Normal file
BIN
favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
23
site.webmanifest
Normal file
23
site.webmanifest
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"name": "ProxiTok",
|
||||||
|
"short_name": "ProxiTok",
|
||||||
|
"description": "Use TikTok with a privacy-friendly alternative frontend",
|
||||||
|
"orientation": "portrait-primary",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "./android-chrome-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "./android-chrome-512x512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "./",
|
||||||
|
"start_url": "./",
|
||||||
|
"theme_color": "#4040ff",
|
||||||
|
"background_color": "#ffffff",
|
||||||
|
"display": "standalone"
|
||||||
|
}
|
Loading…
Reference in a new issue