mirror of
https://github.com/pablouser1/ProxiTok.git
synced 2024-12-06 19:27:30 +01:00
Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0d36c26f3 | |||
| 5368c08039 | |||
| bed4ef9d3a | |||
| fdcb33fb18 | |||
| bc4468c5ab | |||
| 1a86abeb2d | |||
| 44ee065ec6 | |||
| 9a35c61023 | |||
| 9f43caa3c4 | |||
| 44429cb7e4 | |||
| ade2b3c01a | |||
| e4e6f05362 | |||
| eb69e8a22e | |||
| 5fffc7ae08 | |||
| f0765e266c | |||
| c26e027c01 | |||
| 6eee156541 | |||
| c682432920 | |||
| d061c210a2 | |||
| 3b5c3cd96c | |||
| 1b29950d89 | |||
| 8ece2c2b25 | |||
| 7ba324c935 | |||
| 9c95620384 | |||
| 7b5ec2211e | |||
| 2bdd433a17 | |||
| b8f8eb710f | |||
| c62df9d631 | |||
| 605e204453 | |||
| 7011867fd8 | |||
| a4a4b0497c | |||
| f1de8e979b | |||
| 1e1376506c | |||
| 198c88a1d7 | |||
| 73dd93420f | |||
| db3799c344 | |||
| 1eb6626153 | |||
| c413017b00 | |||
| 669c0d29d4 | |||
| 58170665ed | |||
| d60e4400a2 | |||
| c47d6cd6d4 | |||
| 279a4f50c6 | |||
| 9711bb903c | |||
| a11a17f9d2 | |||
| c690adab63 | |||
| 1d37d8c417 | |||
| 90cf0bfb56 |
@@ -0,0 +1,8 @@
|
||||
node_modules
|
||||
/.env
|
||||
/.vscode
|
||||
/vendor
|
||||
/cache/latte/*
|
||||
!/cache/latte/.gitkeep
|
||||
/cache/api/*
|
||||
!/cache/api/.gitkeep
|
||||
+9
-4
@@ -1,9 +1,14 @@
|
||||
# APP_URL="http://localhost:8000" # Full url path, PLEASE REPLACE TO YOUR OWN ONE
|
||||
# SIGNER_URL="https://tiktok-sign.herokuapp.com/signature" # External signing service
|
||||
# APP_PATH="/proxitok" # Relative path, PLEASE LEAVE EMPTY IF /
|
||||
# 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
|
||||
# API CONFIG
|
||||
# API_FORCE_LEGACY=1 # Force legacy mode for wrapper
|
||||
# API_SIGNER_URL="https://example.com" # External signing service
|
||||
# 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
|
||||
|
||||
# Redis cache, used on Helpers\CacheEngines\RedisCache (CHOOSE ONE)
|
||||
# REDIS_HOST=localhost # Host or path to unix socket
|
||||
# REDIS_PORT=6379 # Set to -1 to use unix socket
|
||||
# REDIS_PASSWORD=example # Leave commented for no password
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
RewriteEngine on
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule . index.php [L]
|
||||
RewriteRule ^ index.php [QSA,L]
|
||||
|
||||
# Disable index view
|
||||
Options -Indexes
|
||||
|
||||
# Hide a specific file
|
||||
<Files .env>
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
FROM php:8-apache
|
||||
WORKDIR /var/www/html
|
||||
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
||||
RUN apt update -y && apt upgrade -y \
|
||||
&& apt install -y --no-install-recommends libzip-dev \
|
||||
&& pecl install redis zip \
|
||||
&& docker-php-ext-enable redis zip \
|
||||
&& a2enmod rewrite headers \
|
||||
&& mkdir /cache \
|
||||
&& chown -R www-data:www-data /cache \
|
||||
&& rm -rf /var/www/html/*
|
||||
|
||||
# Copy project to /var/www/html
|
||||
COPY . .
|
||||
|
||||
# Run composer and clean
|
||||
RUN composer update --no-cache \
|
||||
&& composer install --no-interaction --optimize-autoloader --no-dev --no-cache \
|
||||
&& apt autoclean -y \
|
||||
&& apt autoremove -y \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /usr/bin/composer
|
||||
|
||||
EXPOSE 80
|
||||
@@ -1 +1 @@
|
||||
web: vendor/bin/heroku-php-apache2
|
||||
web: vendor/bin/heroku-php-nginx -C setup/nginx_heroku.conf
|
||||
|
||||
@@ -4,65 +4,43 @@ Use Tiktok with an alternative frontend, inspired by Nitter.
|
||||
## Features
|
||||
* Privacy: All requests made to TikTok are server-side, so you will never connect to their servers
|
||||
* See user's feed
|
||||
* See trending
|
||||
* See trending and discovery tab
|
||||
* See tags
|
||||
* See video by id
|
||||
* Discovery
|
||||
* Create a following list, which you can later use to see all the feeds from those users
|
||||
* Themes
|
||||
* RSS Feed for user, trending and tag (just add /rss to the url)
|
||||
|
||||
## Installation
|
||||
Clone the repository and fetch the requiered external packages with:
|
||||
```bash
|
||||
composer install
|
||||
## Self-hosting
|
||||
Please check [this](https://github.com/pablouser1/ProxiTok/wiki/Self-hosting) wiki article for info on how to self-host your own instance
|
||||
|
||||
## Public instances
|
||||
[This](https://github.com/pablouser1/ProxiTok/wiki/Public-instances) wiki article contains a list with all the known public instances.
|
||||
|
||||
## Extensions
|
||||
If you want to automatically redirect Tiktok links to ProxiTok you can use:
|
||||
* [Libredirect](https://github.com/libredirect/libredirect)
|
||||
* [Redirector](https://github.com/einaregilsson/Redirector)
|
||||
|
||||
You can use the following config if you want to use Redirector (you can change https://proxitok.herokuapp.com with whatever instance you want to use):
|
||||
```
|
||||
Description: TikTok to ProxiTok
|
||||
Example URL: https://www.tiktok.com/@tiktok
|
||||
Include pattern: (.*//.*)(tiktok.com)(.*)
|
||||
Redirect to: https://proxitok.herokuapp.com$3
|
||||
Example result: https://proxitok.herokuapp.com/@tiktok
|
||||
Pattern type: Regular Expression
|
||||
Apply to: Main window (address bar)
|
||||
```
|
||||
|
||||
WARNING: You'll need a personal Github token for composer.
|
||||
|
||||
Then you can run it using for example the PHP Development Server with:
|
||||
```bash
|
||||
php -S localhost:8080
|
||||
```
|
||||
|
||||
## Configuration
|
||||
### .env
|
||||
Move the .env.example file to .env and modify it.
|
||||
|
||||
### Cache engines
|
||||
Available cache engines:
|
||||
* redis: Writes response to Redis
|
||||
* json: Writes response to JSON file
|
||||
|
||||
### Apache
|
||||
You don't have to do anything more
|
||||
|
||||
### Nginx
|
||||
Add the following to your config (you can modify the proxitok part if you have or not a subdir):
|
||||
```
|
||||
location /proxitok {
|
||||
return 302 $scheme://$host/proxitok/;
|
||||
}
|
||||
|
||||
location /proxitok/ {
|
||||
try_files $uri $uri/ /proxitok/index.php?$query_string;
|
||||
}
|
||||
|
||||
location /proxitok/.env {
|
||||
deny all;
|
||||
return 404;
|
||||
}
|
||||
```
|
||||
|
||||
## TODO
|
||||
* Add a NoJS version / Make the whole program without required JS
|
||||
* Better error handling
|
||||
## TODO / Known issues
|
||||
* Make video on /video fit screen and don't overflow
|
||||
* i18n
|
||||
* Fix embed styling
|
||||
|
||||
## Credits
|
||||
* [TikScraper](https://github.com/pablouser1/TikScraperPHP)
|
||||
[@TheFrenchGhosty](https://github.com/TheFrenchGhosty): Initial Dockerfile and fixes to a usable state. You can check his Docker image [here](https://github.com/PussTheCat-org/docker-proxitok-quay) on Github or [here](https://quay.io/repository/pussthecatorg/proxitok) on Quay
|
||||
### External libraries
|
||||
* [TikScraperPHP](https://github.com/pablouser1/TikScraperPHP)
|
||||
* [Latte](https://github.com/nette/latte)
|
||||
* [bramus/router](https://github.com/bramus/router)
|
||||
* [PHP dotenv](https://github.com/vlucas/phpdotenv)
|
||||
* [Bulma](https://github.com/jgthms/bulma) and [Bulmaswatch](https://github.com/jenil/bulmaswatch)
|
||||
* [FeedWriter](https://github.com/mibe/FeedWriter)
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<?php
|
||||
namespace App\Cache;
|
||||
|
||||
use App\Helpers\Misc;
|
||||
|
||||
class JSONCache {
|
||||
private string $cache_path = '';
|
||||
private string $cache_path = __DIR__ . '/../../cache/api';
|
||||
|
||||
function __construct() {
|
||||
$this->cache_path = Misc::env('API_CACHE_JSON', __DIR__ . '/../../cache/api');
|
||||
if (isset($_ENV['API_CACHE_JSON']) && !empty($_ENV['API_CACHE_JSON'])) {
|
||||
$this->cache_path = $_ENV['API_CACHE_JSON'];
|
||||
}
|
||||
}
|
||||
|
||||
public function get(string $cache_key): ?object {
|
||||
$filename = $this->cache_path . '/' . $cache_key . '.json';
|
||||
if (is_file($filename)) {
|
||||
@@ -25,7 +24,7 @@ class JSONCache {
|
||||
return is_file($filename);
|
||||
}
|
||||
|
||||
public function set(string $cache_key, string $data, $timeout = 3600) {
|
||||
public function set(string $cache_key, mixed $data, $timeout = 3600) {
|
||||
file_put_contents($this->cache_path . '/' . $cache_key . '.json', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class RedisCache {
|
||||
return $this->client->exists($cache_key);
|
||||
}
|
||||
|
||||
public function set(string $cache_key, array $data, $timeout = 3600) {
|
||||
$this->client->set($cache_key, json_encode($data), $timeout);
|
||||
public function set(string $cache_key, string $data, $timeout = 3600) {
|
||||
$this->client->set($cache_key, $data, $timeout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,16 @@ namespace App\Controllers;
|
||||
|
||||
use App\Helpers\ErrorHandler;
|
||||
use App\Helpers\Misc;
|
||||
use App\Models\DiscoverTemplate;
|
||||
use App\Helpers\Wrappers;
|
||||
use App\Models\FeedTemplate;
|
||||
|
||||
class DiscoverController {
|
||||
static public function get() {
|
||||
$api = Misc::api();
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getDiscover();
|
||||
if ($feed->meta->success) {
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('discover'), new DiscoverTemplate($feed));
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('discover'), new FeedTemplate('Discover', $feed));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Helpers\ErrorHandler;
|
||||
use App\Helpers\Misc;
|
||||
use App\Helpers\Wrappers;
|
||||
use App\Models\VideoTemplate;
|
||||
|
||||
class EmbedController {
|
||||
static public function v2(int $id) {
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getVideoByID($id);
|
||||
if ($feed->meta->success) {
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('video'), new VideoTemplate($feed->items[0], $feed->info->detail, true));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,17 @@ namespace App\Controllers;
|
||||
|
||||
use App\Helpers\ErrorHandler;
|
||||
use App\Helpers\Misc;
|
||||
use App\Helpers\Wrappers;
|
||||
use App\Models\FeedTemplate;
|
||||
|
||||
class MusicController {
|
||||
static public function get(string $music_id) {
|
||||
$cursor = Misc::getCursor();
|
||||
|
||||
$api = Misc::api();
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getMusicFeed($music_id, $cursor);
|
||||
if ($feed->meta->success) {
|
||||
$latte = Misc::latte();
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('music'), new FeedTemplate('Music', $feed));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
|
||||
@@ -39,25 +39,25 @@ class ProxyController {
|
||||
}
|
||||
|
||||
static public function stream() {
|
||||
if (isset($_GET['download'])) {
|
||||
$downloader = new \TikScraper\Download();
|
||||
$watermark = isset($_GET['watermark']);
|
||||
if ($watermark) {
|
||||
self::checkUrl();
|
||||
$filename = self::getFileName();
|
||||
$downloader->url($_GET['url'], $filename, true);
|
||||
} else {
|
||||
if (!isset($_GET['id'])) {
|
||||
die('You need to send an ID!');
|
||||
}
|
||||
$filename = self::getFileName();
|
||||
$downloader->url($_GET['id'], $filename, false);
|
||||
}
|
||||
} else {
|
||||
self::checkUrl();
|
||||
$url = $_GET['url'];
|
||||
$streamer = new \TikScraper\Stream();
|
||||
$streamer->url($url);
|
||||
}
|
||||
|
||||
static public function download() {
|
||||
$downloader = new \TikScraper\Download();
|
||||
$watermark = isset($_GET['watermark']);
|
||||
if ($watermark) {
|
||||
self::checkUrl();
|
||||
$url = $_GET['url'];
|
||||
$streamer = new \TikScraper\Stream();
|
||||
$streamer->url($url);
|
||||
$filename = self::getFileName();
|
||||
$downloader->url($_GET['url'], $filename, true);
|
||||
} else {
|
||||
if (!isset($_GET['id'])) {
|
||||
die('You need to send an ID!');
|
||||
}
|
||||
$filename = self::getFileName();
|
||||
$downloader->url($_GET['id'], $filename, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,15 +7,25 @@ use App\Helpers\Misc;
|
||||
*/
|
||||
class RedirectController {
|
||||
static public function redirect() {
|
||||
$endpoint = '';
|
||||
if (isset($_GET['user'])) {
|
||||
$endpoint = '/@' . $_GET['user'];
|
||||
} else if (isset($_GET['tag'])) {
|
||||
$endpoint = '/tag/' . $_GET['tag'];
|
||||
} else if (isset($_GET['music'])) {
|
||||
$endpoint = '/music/' . $_GET['music'];
|
||||
} else if (isset($_GET['video'])) {
|
||||
$endpoint = '/video/' . $_GET['video'];
|
||||
$endpoint = '/';
|
||||
if (isset($_GET['type'], $_GET['term'])) {
|
||||
$term = $_GET['term'];
|
||||
switch ($_GET['type']) {
|
||||
case 'user':
|
||||
$endpoint = '/@' . $term;
|
||||
break;
|
||||
case 'tag':
|
||||
$endpoint = '/tag/' . $term;
|
||||
break;
|
||||
case 'music':
|
||||
$endpoint = '/music/' . $term;
|
||||
break;
|
||||
case 'video':
|
||||
// The @username part is not used, but
|
||||
// it is the schema that TikTok follows
|
||||
$endpoint = '/@placeholder/video/' . $term;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$url = Misc::url($endpoint);
|
||||
|
||||
@@ -3,21 +3,32 @@ namespace App\Controllers;
|
||||
|
||||
use App\Helpers\Misc;
|
||||
use App\Helpers\Cookies;
|
||||
use App\Models\SettingsTemplate;
|
||||
use App\Helpers\Wrappers;
|
||||
use App\Models\BaseTemplate;
|
||||
|
||||
class SettingsController {
|
||||
static public function index() {
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('settings'), new SettingsTemplate());
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('settings'), new BaseTemplate('Settings'));
|
||||
}
|
||||
|
||||
static public function proxy() {
|
||||
if (in_array(Cookies::PROXY, $_POST)) {
|
||||
foreach (Cookies::PROXY as $proxy_element) {
|
||||
Cookies::set($proxy_element, $_POST[$proxy_element]);
|
||||
}
|
||||
}
|
||||
static private function redirect() {
|
||||
$url = Misc::url('/settings');
|
||||
header("Location: {$url}");
|
||||
}
|
||||
|
||||
static public function general() {
|
||||
if (isset($_POST['theme'])) {
|
||||
$theme = $_POST['theme'];
|
||||
Cookies::set('theme', $theme);
|
||||
}
|
||||
self::redirect();
|
||||
}
|
||||
static public function api() {
|
||||
if (isset($_POST['api-legacy'])) {
|
||||
$legacy = $_POST['api-legacy'];
|
||||
}
|
||||
Cookies::set('api-legacy', $legacy);
|
||||
self::redirect();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,17 @@ namespace App\Controllers;
|
||||
|
||||
use App\Helpers\ErrorHandler;
|
||||
use App\Helpers\Misc;
|
||||
use App\Helpers\RSS;
|
||||
use App\Helpers\Wrappers;
|
||||
use App\Models\FeedTemplate;
|
||||
use App\Models\RSSTemplate;
|
||||
|
||||
class TagController {
|
||||
static public function get(string $name) {
|
||||
$cursor = Misc::getCursor();
|
||||
$api = Misc::api();
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getHashtagFeed($name, $cursor);
|
||||
if ($feed->meta->success) {
|
||||
$latte = Misc::latte();
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('tag'), new FeedTemplate('Tag', $feed));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
@@ -20,13 +21,11 @@ class TagController {
|
||||
}
|
||||
|
||||
static public function rss(string $name) {
|
||||
$api = Misc::api();
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getHashtagFeed($name);
|
||||
if ($feed->meta->success) {
|
||||
$feed = RSS::build("/tag/{$name}", "{$name} Tag", $feed->info->detail->desc, $feed->items);
|
||||
// Setup headers
|
||||
RSS::setHeaders('tag.rss');
|
||||
echo $feed;
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('rss'), new RSSTemplate($name, $feed->info->detail->desc, "/tag/{$name}", $feed->items));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,22 @@ namespace App\Controllers;
|
||||
use App\Helpers\Misc;
|
||||
use App\Models\FeedTemplate;
|
||||
use App\Helpers\ErrorHandler;
|
||||
use App\Helpers\RSS;
|
||||
use App\Helpers\Wrappers;
|
||||
use App\Models\RSSTemplate;
|
||||
|
||||
class TrendingController {
|
||||
static public function get() {
|
||||
$cursor = Misc::getCursor();
|
||||
$page = $_GET['page'] ?? 0;
|
||||
$api = Misc::api();
|
||||
$feed = $api->getTrending($cursor, $page);
|
||||
$api = Wrappers::api();
|
||||
|
||||
// Ttwid if normal, cursor if legacy
|
||||
if ($api::class === 'TikScraper\Api') {
|
||||
$cursor = Misc::getTtwid();
|
||||
} else {
|
||||
$cursor = Misc::getCursor();
|
||||
}
|
||||
$feed = $api->getTrending($cursor);
|
||||
if ($feed->meta->success) {
|
||||
$latte = Misc::latte();
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('trending'), new FeedTemplate('Trending', $feed));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
@@ -21,13 +27,11 @@ class TrendingController {
|
||||
}
|
||||
|
||||
static public function rss() {
|
||||
$api = Misc::api();
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getTrending();
|
||||
if ($feed->meta->success) {
|
||||
$feed = RSS::build('/trending', 'Trending', 'Tiktok trending', $feed->items);
|
||||
// Setup headers
|
||||
RSS::setHeaders('trending.rss');
|
||||
echo $feed;
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('rss'), new RSSTemplate('Trending', 'Trending on TikTok', '/trending', $feed->items));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,34 +3,46 @@ namespace App\Controllers;
|
||||
|
||||
use App\Helpers\ErrorHandler;
|
||||
use App\Helpers\Misc;
|
||||
use App\Helpers\RSS;
|
||||
use App\Helpers\Wrappers;
|
||||
use App\Models\FeedTemplate;
|
||||
use App\Models\RSSTemplate;
|
||||
use App\Models\VideoTemplate;
|
||||
|
||||
class UserController {
|
||||
static public function get(string $username) {
|
||||
$cursor = Misc::getCursor();
|
||||
$api = Misc::api();
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getUserFeed($username, $cursor);
|
||||
if ($feed->meta->success) {
|
||||
if ($feed->info->detail->privateAccount) {
|
||||
http_response_code(400);
|
||||
http_response_code(403);
|
||||
echo 'Private account detected! Not supported';
|
||||
exit;
|
||||
}
|
||||
$latte = Misc::latte();
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('user'), new FeedTemplate($feed->info->detail->nickname, $feed));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
}
|
||||
}
|
||||
|
||||
static public function video(string $username, string $video_id) {
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getVideoByID($video_id);
|
||||
if ($feed->meta->success) {
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('video'), new VideoTemplate($feed->items[0], $feed->info->detail));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
}
|
||||
}
|
||||
|
||||
static public function rss(string $username) {
|
||||
$api = Misc::api();
|
||||
$api = Wrappers::api();
|
||||
$feed = $api->getUserFeed($username);
|
||||
if ($feed->meta->success) {
|
||||
$feed = RSS::build('/@'.$username, $feed->info->detail->nickname, $feed->info->detail->signature, $feed->items);
|
||||
// Setup headers
|
||||
RSS::setHeaders('user.rss');
|
||||
echo $feed;
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('rss'), new RSSTemplate($username, $feed->info->detail->signature, '/@' . $username, $feed->items));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
<?php
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Helpers\ErrorHandler;
|
||||
use App\Helpers\Misc;
|
||||
use App\Models\FeedTemplate;
|
||||
|
||||
/**
|
||||
* @deprecated Please use UserController::video instead
|
||||
*/
|
||||
class VideoController {
|
||||
static public function get(string $video_id) {
|
||||
$api = Misc::api();
|
||||
$item = $api->getVideoByID($video_id);
|
||||
if ($item->meta->success) {
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('video'), new FeedTemplate($item->info->detail->nickname, $item));
|
||||
} else {
|
||||
ErrorHandler::show($item->meta);
|
||||
}
|
||||
UserController::video('placeholder', $video_id);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-3
@@ -2,13 +2,21 @@
|
||||
namespace App\Helpers;
|
||||
|
||||
class Cookies {
|
||||
const PROXY = ['proxy-host', 'proxy-port', 'proxy-username', 'proxy-password'];
|
||||
const ALLOWED_THEMES = ['default', 'card'];
|
||||
|
||||
static public function get(string $name): string {
|
||||
static public function get(string $name, string $default_value = ''): string {
|
||||
if (isset($_COOKIE[$name]) && !empty($_COOKIE[$name])) {
|
||||
return $_COOKIE[$name];
|
||||
}
|
||||
return '';
|
||||
return $default_value;
|
||||
}
|
||||
|
||||
static public function theme(): string {
|
||||
$theme = self::get('theme');
|
||||
if ($theme && in_array($theme, self::ALLOWED_THEMES)) {
|
||||
return $theme;
|
||||
}
|
||||
return 'default';
|
||||
}
|
||||
|
||||
static public function exists(string $name): bool {
|
||||
|
||||
@@ -6,7 +6,7 @@ use App\Models\ErrorTemplate;
|
||||
class ErrorHandler {
|
||||
static public function show(object $meta) {
|
||||
http_response_code($meta->http_code);
|
||||
$latte = Misc::latte();
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('error'), new ErrorTemplate($meta));
|
||||
}
|
||||
}
|
||||
|
||||
+7
-83
@@ -1,20 +1,21 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Cache\JSONCache;
|
||||
use App\Cache\RedisCache;
|
||||
|
||||
class Misc {
|
||||
static public function getCursor(): int {
|
||||
return isset($_GET['cursor']) && is_numeric($_GET['cursor']) ? (int) $_GET['cursor'] : 0;
|
||||
}
|
||||
|
||||
static public function url(string $endpoint = '') {
|
||||
static public function getTtwid(): string {
|
||||
return isset($_GET['cursor']) ? $_GET['cursor'] : '';
|
||||
}
|
||||
|
||||
static public function url(string $endpoint = ''): string {
|
||||
return self::env('APP_URL', '') . $endpoint;
|
||||
}
|
||||
|
||||
static public function env(string $key, string $default_value): string {
|
||||
return isset($_ENV[$key]) && !empty($_ENV[$key]) ? $_ENV[$key] : $default_value;
|
||||
static public function env(string $key, $default_value) {
|
||||
return $_ENV[$key] ?? $default_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,81 +24,4 @@ class Misc {
|
||||
static public function getView(string $template): string {
|
||||
return __DIR__ . "/../../views/{$template}.latte";
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup of TikTok Api wrapper
|
||||
*/
|
||||
static public function api(): \TikScraper\Api {
|
||||
$options = [
|
||||
'remote_signer' => self::env('SIGNER_URL', 'http://localhost:8080/signature')
|
||||
];
|
||||
$cacheEngine = false;
|
||||
// Proxy config
|
||||
foreach(Cookies::PROXY as $proxy_element) {
|
||||
if (isset($_COOKIE[$proxy_element])) {
|
||||
$options['proxy'][$proxy_element] = $_COOKIE[$proxy_element];
|
||||
}
|
||||
}
|
||||
// Cache config
|
||||
if (isset($_ENV['API_CACHE'])) {
|
||||
switch ($_ENV['API_CACHE']) {
|
||||
case 'json':
|
||||
$cacheEngine = new JSONCache();
|
||||
break;
|
||||
case 'redis':
|
||||
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!');
|
||||
}
|
||||
|
||||
if (isset($_ENV['REDIS_URL'])) {
|
||||
$url = parse_url($_ENV['REDIS_URL']);
|
||||
$host = $url['host'];
|
||||
$port = $url['port'];
|
||||
$password = $url['pass'] ?? null;
|
||||
} else {
|
||||
$host = $_ENV['REDIS_HOST'];
|
||||
$port = (int) $_ENV['REDIS_PORT'];
|
||||
$password = $_ENV['REDIS_PASSWORD'] ?? null;
|
||||
}
|
||||
$cacheEngine = new RedisCache($host, $port, $password);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$api = new \TikScraper\Api($options, $cacheEngine);
|
||||
return $api;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup of Latte template engine
|
||||
*/
|
||||
static public function latte(): \Latte\Engine {
|
||||
$latte = new \Latte\Engine;
|
||||
$cache_path = self::env('LATTE_CACHE', __DIR__ . '/../../cache/latte');
|
||||
$latte->setTempDirectory($cache_path);
|
||||
|
||||
// -- CUSTOM FUNCTIONS -- //
|
||||
// Get URL with optional endpoint
|
||||
$latte->addFunction('path', function (string $endpoint = ''): string {
|
||||
return self::url($endpoint);
|
||||
});
|
||||
// Version being used
|
||||
$latte->addFunction('version', function (): string {
|
||||
return \Composer\InstalledVersions::getVersion('pablouser1/proxitok');
|
||||
});
|
||||
// https://stackoverflow.com/a/36365553
|
||||
$latte->addFunction('number', function (float $x) {
|
||||
if($x > 1000) {
|
||||
$x_number_format = number_format($x);
|
||||
$x_array = explode(',', $x_number_format);
|
||||
$x_parts = array('K', 'M', 'B', 'T');
|
||||
$x_count_parts = count($x_array) - 1;
|
||||
$x_display = $x;
|
||||
$x_display = $x_array[0] . ((int) $x_array[1][0] !== 0 ? '.' . $x_array[1][0] : '');
|
||||
$x_display .= $x_parts[$x_count_parts - 1];
|
||||
return $x_display;
|
||||
}
|
||||
return $x;
|
||||
});
|
||||
return $latte;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use \FeedWriter\RSS2;
|
||||
use \Sovit\TikTok\Download;
|
||||
|
||||
class RSS {
|
||||
static public function build(string $endpoint, string $title, string $description, array $items): string {
|
||||
$url = Misc::env('APP_URL', '');
|
||||
$download = new Download();
|
||||
$rss = new RSS2();
|
||||
$rss->setTitle($title);
|
||||
$rss->setDescription($description);
|
||||
$rss->setLink($url . $endpoint);
|
||||
$rss->setSelfLink($url . $endpoint . '/rss');
|
||||
foreach ($items as $item) {
|
||||
$item_rss = $rss->createNewItem();
|
||||
$video = $item->video->playAddr;
|
||||
$item_rss->setTitle($item->desc);
|
||||
$item_rss->setDescription($item->desc);
|
||||
$item_rss->setLink($url . '/video/' . $item->id);
|
||||
$item_rss->setDate((int) $item->createTime);
|
||||
$item_rss->setId($item->id, false);
|
||||
$item_rss->addEnclosure($url . '/stream?url=' . urlencode($video), $download->file_size($video), 'video/mp4');
|
||||
$rss->addItem($item_rss);
|
||||
}
|
||||
return $rss->generateFeed();
|
||||
}
|
||||
|
||||
static public function setHeaders (string $filename) {
|
||||
header('Content-Type: application/rss+xml');
|
||||
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Cache\JSONCache;
|
||||
use App\Cache\RedisCache;
|
||||
|
||||
class Wrappers {
|
||||
/**
|
||||
* Setup of Latte template engine
|
||||
*/
|
||||
static public function latte(): \Latte\Engine {
|
||||
$latte = new \Latte\Engine;
|
||||
$cache_path = Misc::env('LATTE_CACHE', __DIR__ . '/../../cache/latte');
|
||||
$latte->setTempDirectory($cache_path);
|
||||
|
||||
// -- CUSTOM FUNCTIONS -- //
|
||||
// Get URL with optional endpoint
|
||||
$latte->addFunction('path', function (string $endpoint = ''): string {
|
||||
return Misc::url($endpoint);
|
||||
});
|
||||
// Version being used
|
||||
$latte->addFunction('version', function (): string {
|
||||
return \Composer\InstalledVersions::getVersion('pablouser1/proxitok');
|
||||
});
|
||||
$latte->addFunction('theme', function(): string {
|
||||
return Cookies::theme();
|
||||
});
|
||||
// https://stackoverflow.com/a/36365553
|
||||
$latte->addFunction('number', function (float $x) {
|
||||
if($x > 1000) {
|
||||
$x_number_format = number_format($x);
|
||||
$x_array = explode(',', $x_number_format);
|
||||
$x_parts = array('K', 'M', 'B', 'T');
|
||||
$x_count_parts = count($x_array) - 1;
|
||||
$x_display = $x;
|
||||
$x_display = $x_array[0] . ((int) $x_array[1][0] !== 0 ? '.' . $x_array[1][0] : '');
|
||||
$x_display .= $x_parts[$x_count_parts - 1];
|
||||
return $x_display;
|
||||
}
|
||||
return $x;
|
||||
});
|
||||
return $latte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup of TikTok Api wrapper
|
||||
* @return \TikScraper\Api|\TikScraper\Legacy
|
||||
*/
|
||||
static public function api() {
|
||||
$options = [
|
||||
'use_test_endpoints' => Misc::env('API_TEST_ENDPOINTS', false),
|
||||
'signer' => [
|
||||
'remote_url' => Misc::env('API_SIGNER_URL', ''),
|
||||
'browser_url' => Misc::env('API_BROWSER_URL', ''),
|
||||
'close_when_done' => false
|
||||
]
|
||||
];
|
||||
// Cache config
|
||||
$cacheEngine = false;
|
||||
if (isset($_ENV['API_CACHE'])) {
|
||||
switch ($_ENV['API_CACHE']) {
|
||||
case 'json':
|
||||
$cacheEngine = new JSONCache();
|
||||
break;
|
||||
case 'redis':
|
||||
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!');
|
||||
}
|
||||
|
||||
if (isset($_ENV['REDIS_URL'])) {
|
||||
$url = parse_url($_ENV['REDIS_URL']);
|
||||
$host = $url['host'];
|
||||
$port = $url['port'];
|
||||
$password = $url['pass'] ?? null;
|
||||
} else {
|
||||
$host = $_ENV['REDIS_HOST'];
|
||||
$port = (int) $_ENV['REDIS_PORT'];
|
||||
$password = isset($_ENV['REDIS_PASSWORD']) ? $_ENV['REDIS_PASSWORD'] : null;
|
||||
}
|
||||
$cacheEngine = new RedisCache($host, $port, $password);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy mode
|
||||
$legacy = Misc::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);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use TikScraper\Models\Discover;
|
||||
|
||||
/**
|
||||
* Base for templates with a feed
|
||||
*/
|
||||
class DiscoverTemplate extends BaseTemplate {
|
||||
public Discover $feed;
|
||||
|
||||
function __construct(Discover $feed) {
|
||||
parent::__construct('Discover');
|
||||
$this->feed = $feed;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,13 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use TikScraper\Models\Feed;
|
||||
|
||||
/**
|
||||
* Base for templates with a feed
|
||||
*/
|
||||
class FeedTemplate extends BaseTemplate {
|
||||
public Feed $feed;
|
||||
public object $feed;
|
||||
|
||||
function __construct(string $title, Feed $feed) {
|
||||
function __construct(string $title, object $feed) {
|
||||
parent::__construct($title);
|
||||
$this->feed = $feed;
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
/**
|
||||
* Exclusive for /
|
||||
*/
|
||||
class HomeTemplate extends BaseTemplate {
|
||||
public array $forms = [
|
||||
[
|
||||
'title' => 'Search by user',
|
||||
'input' => 'user',
|
||||
'placeholder' => 'Type username'
|
||||
],
|
||||
[
|
||||
'title' => 'Search by video ID',
|
||||
'input' => 'video',
|
||||
'placeholder' => 'Type video ID'
|
||||
],
|
||||
[
|
||||
'title' => 'Search by tag',
|
||||
'input' => 'tag',
|
||||
'placeholder' => 'Type tag'
|
||||
],
|
||||
[
|
||||
'title' => 'Search by music ID',
|
||||
'input' => 'music',
|
||||
'placeholder' => 'Type music'
|
||||
]
|
||||
];
|
||||
|
||||
function __construct() {
|
||||
parent::__construct('Home');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
/**
|
||||
* Base for templates with a feed
|
||||
*/
|
||||
class RSSTemplate {
|
||||
public string $title;
|
||||
public string $desc;
|
||||
public string $link;
|
||||
public array $items;
|
||||
|
||||
function __construct(string $title, string $desc, string $link, array $items) {
|
||||
$this->title = $title;
|
||||
$this->desc = $desc;
|
||||
$this->link = $link;
|
||||
$this->items = $items;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\Cookies;
|
||||
|
||||
/**
|
||||
* Exclusive for /settings
|
||||
*/
|
||||
class SettingsTemplate extends BaseTemplate {
|
||||
public array $proxy_elements = [];
|
||||
|
||||
function __construct() {
|
||||
parent::__construct('Settings');
|
||||
$this->proxy_elements = Cookies::PROXY;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
/**
|
||||
* Base for templates with a feed
|
||||
*/
|
||||
class VideoTemplate extends BaseTemplate {
|
||||
public object $item;
|
||||
public object $detail;
|
||||
public string $layout = 'hero';
|
||||
|
||||
function __construct(object $item, object $detail, bool $isEmbed = false) {
|
||||
parent::__construct('Video');
|
||||
$this->item = $item;
|
||||
$this->detail = $detail;
|
||||
if ($isEmbed) {
|
||||
$this->layout = 'embed';
|
||||
} else {
|
||||
$this->layout = 'hero';
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-64
@@ -1,64 +1 @@
|
||||
<link rel="stylesheet" href="{path('/styles/feed.css')}">
|
||||
<noscript>JavaScript is required for this section to work!</noscript>
|
||||
<section class="section">
|
||||
<div class="columns is-multiline is-vcentered">
|
||||
{foreach $feed->items as $item}
|
||||
{do $share_url = 'https://tiktok.com/@' . $item->author->uniqueId . '/video/' . $item->id}
|
||||
<div class="column is-one-quarter clickable-img" id="{$item->id}" onclick="openVideo(this.id)"
|
||||
data-video_url="{path('/stream?url=' . urlencode($item->video->playAddr))}"
|
||||
data-video_download_watermark="{path('/stream?url=' . urlencode($item->video->playAddr) . '&download=1&id=' . $item->id . '&user=' . $item->author->uniqueId) . '&watermark='}"
|
||||
data-video_download_nowatermark="{path('/stream?download=1&id=' . $item->id . '&user=' . $item->author->uniqueId)}"
|
||||
data-video_share_url="{$share_url}"
|
||||
data-desc="{$item->desc}"
|
||||
data-music_title="{$item->music->title}"
|
||||
data-music_url="{path('/stream?url=' . urlencode($item->music->playUrl))}">
|
||||
<img loading="lazy" src="{path('/stream?url=' . urlencode($item->video->originCover))}" />
|
||||
<img class="hidden" loading="lazy" data-src="{path('/stream?url=' . urlencode($item->video->dynamicCover))}" />
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
<div class="buttons">
|
||||
{if isset($_GET['cursor']) && $_GET['cursor'] != 0 }
|
||||
<a class="button is-danger" href="?">First</a>
|
||||
<button class="button is-danger" onclick="history.back()">Back</button>
|
||||
{/if}
|
||||
<a n:attr="disabled => !$feed->hasMore" class="button is-success" href="?cursor={$feed->maxCursor}">Next</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- MODAL -->
|
||||
<div id="modal" class="modal">
|
||||
<div id="modal-background" class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<button id="modal-close" class="delete" aria-label="close"></button>
|
||||
<p class="modal-card-title" id="item_title"></p>
|
||||
</header>
|
||||
<section class="modal-card-body has-text-centered" style="overflow: hidden;">
|
||||
<video id="video" autoplay controls></video>
|
||||
</section>
|
||||
<footer class="modal-card-foot has-text-centered">
|
||||
<div class="container">
|
||||
<div class="field has-addons has-addons-centered">
|
||||
<div class="control">
|
||||
<input id="share_input" class="input" readonly />
|
||||
</div>
|
||||
<div class="control">
|
||||
<button class="button is-primary" onclick="copyShare()">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons is-centered">
|
||||
<a target="_blank" id="download_watermark" class="button is-info">Download with watermark</a>
|
||||
<a target="_blank" id="download_nowatermark" class="button is-info">Download without watermark</a>
|
||||
</div>
|
||||
<p id="audio_title"></p>
|
||||
<audio id="audio" controls preload="none"></audio>
|
||||
<div class="buttons is-centered">
|
||||
<button id="back-button" class="button is-danger">Back</button>
|
||||
<button id="next-button" class="button is-success">Next</button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{path('/scripts/feed.js')}"></script>
|
||||
{include './themes/' . theme() . '.latte'}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<div class="tags">
|
||||
{if !empty($following)}
|
||||
{foreach $following as $user}
|
||||
<span class="tag">{$user}</span>
|
||||
{/foreach}
|
||||
{else}
|
||||
<p>None</p>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1,8 +0,0 @@
|
||||
<footer class="footer">
|
||||
<div class="content has-text-centered">
|
||||
<p>
|
||||
Made with <span style="color: #e25555;">♥</span> in <a href="https://github.com/pablouser1/ProxiTok">Github</a>
|
||||
</p>
|
||||
<p>Version: {version()}</p>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -0,0 +1,10 @@
|
||||
<form action="{path($path)}" method="{$method}">
|
||||
{block fields}{/block}
|
||||
{ifset $submit}
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<button class="button is-success" type="submit">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
{/ifset}
|
||||
</form>
|
||||
@@ -5,6 +5,7 @@
|
||||
<meta property="og:title" content="ProxiTok" />
|
||||
<meta property="og:description" content="Alternative frontend for TikTok" />
|
||||
<meta property="og:type" content="website" />
|
||||
<link rel="stylesheet" href="{path('/styles/bulma.min.css')}">
|
||||
<link rel="stylesheet" href="{path('/styles/vendor/cssgg.min.css')}">
|
||||
<link rel="stylesheet" href="{path('/styles/vendor/bulma.min.css')}">
|
||||
<title>{$title} - ProxiTok</title>
|
||||
</head>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{define icon_common, $icon}
|
||||
<span class="icon">
|
||||
<i class="gg-{$icon}"></i>
|
||||
</span>
|
||||
{/define}
|
||||
|
||||
{if isset($text)}
|
||||
<span class="icon-text">
|
||||
{include icon_common, icon: $icon}
|
||||
<span>{$text}</span>
|
||||
</span>
|
||||
{else}
|
||||
{include icon_common, icon: $icon}
|
||||
{/if}
|
||||
@@ -9,9 +9,13 @@
|
||||
|
||||
<div id="navbar-menu" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a href="{path('/')}" class="navbar-item">Home</a>
|
||||
<a href="{path('/')}" class="navbar-item">
|
||||
{include './icon.latte', icon: 'home', text: 'Home'}
|
||||
</a>
|
||||
<a href="{path('/settings')}" class="navbar-item">Settings</a>
|
||||
<a href="{path('/about')}" class="navbar-item">About</a>
|
||||
<a href="{path('/about')}" class="navbar-item">
|
||||
{include './icon.latte', icon: 'info', text: 'About'}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<a href="{path($_SERVER['REQUEST_URI'] . '/rss')}">
|
||||
{include './icon.latte', icon: 'feed', text: 'RSS Feed'}
|
||||
</a>
|
||||
@@ -0,0 +1,14 @@
|
||||
{embed '../form.latte', path: '/settings/api', method: 'POST', submit: true}
|
||||
{block fields}
|
||||
<div class="field">
|
||||
<label class="label">Legacy mode</label>
|
||||
<div class="select">
|
||||
<select name="api-legacy">
|
||||
<option hidden disabled selected value> -- Select an option -- </option>
|
||||
<option value="on">On</option>
|
||||
<option value="off">Off</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{/embed}
|
||||
@@ -0,0 +1,14 @@
|
||||
{embed '../form.latte', path: '/settings/general', method: 'POST', submit: true}
|
||||
{block fields}
|
||||
<div class="field">
|
||||
<label class="label">Theme</label>
|
||||
<div class="select">
|
||||
<select name="theme">
|
||||
<option hidden disabled selected value> -- Select an option -- </option>
|
||||
<option value="default">Default</option>
|
||||
<option value="card">Card</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{/embed}
|
||||
@@ -1,15 +0,0 @@
|
||||
<form action="{path('/settings/proxy')}" method="POST">
|
||||
{foreach $proxy_elements as $proxy_element}
|
||||
<div class="field">
|
||||
<label class="label">{$proxy_element}</label>
|
||||
<div class="control">
|
||||
<input name="{$proxy_element}" class="input" value="{isset($_COOKIE[$proxy_element]) ? $_COOKIE[$proxy_element] : ''}" required />
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<button class="button is-success" type="submit">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,68 @@
|
||||
<link rel="stylesheet" href="{path('/styles/themes/card.css')}">
|
||||
<noscript>JavaScript is required for this section to work!</noscript>
|
||||
<section class="section">
|
||||
<div class="columns is-multiline is-vcentered">
|
||||
{foreach $feed->items as $item}
|
||||
{do $share_url = 'https://tiktok.com/@' . $item->author->uniqueId . '/video/' . $item->id}
|
||||
<div class="column is-one-quarter clickable-img" id="{$item->id}" onclick="openVideo(this.id)"
|
||||
data-video_url="{path('/stream?url=' . urlencode($item->video->playAddr))}"
|
||||
data-video_download_watermark="{path('/download?url=' . urlencode($item->video->playAddr) . '&id=' . $item->id . '&user=' . $item->author->uniqueId) . '&watermark='}"
|
||||
data-video_download_nowatermark="{path('/download?id=' . $item->id . '&user=' . $item->author->uniqueId)}"
|
||||
data-video_share_url="{$share_url}"
|
||||
data-desc="{$item->desc}"
|
||||
data-music_title="{$item->music->title}"
|
||||
data-music_url="{path('/stream?url=' . urlencode($item->music->playUrl))}">
|
||||
<img loading="lazy" src="{path('/stream?url=' . urlencode($item->video->originCover))}" />
|
||||
<img class="hidden" loading="lazy" data-src="{path('/stream?url=' . urlencode($item->video->dynamicCover))}" />
|
||||
</div>
|
||||
{/foreach}
|
||||
{if empty($feed->items)}
|
||||
<p class="title">No items sent by TikTok!</p>
|
||||
{/if}
|
||||
</div>
|
||||
{include './common/controls.latte'}
|
||||
</section>
|
||||
|
||||
<!-- MODAL -->
|
||||
<div id="modal" class="modal">
|
||||
<div id="modal-background" class="modal-background"></div>
|
||||
<div class="modal-card">
|
||||
<header class="modal-card-head">
|
||||
<button id="modal-close" class="delete" aria-label="close"></button>
|
||||
<p class="modal-card-title" id="item_title"></p>
|
||||
</header>
|
||||
<section class="modal-card-body has-text-centered" style="overflow: hidden;">
|
||||
<video id="video" autoplay controls></video>
|
||||
</section>
|
||||
<footer class="modal-card-foot has-text-centered">
|
||||
<div class="container">
|
||||
<div class="field has-addons has-addons-centered">
|
||||
<div class="control">
|
||||
<input id="share_input" class="input" readonly />
|
||||
</div>
|
||||
<div class="control">
|
||||
<button class="button is-primary" onclick="copyShare()">Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="download_dropdown" class="dropdown is-hoverable">
|
||||
<div class="dropdown-trigger">
|
||||
<button id="download_button" class="button" aria-haspopup="true" aria-controls="dropdown-menu">Download</button>
|
||||
</div>
|
||||
<div class="dropdown-menu" role="menu">
|
||||
<div class="dropdown-content">
|
||||
<a id="download_watermark" target="_blank" class="dropdown-item">With watermark</a>
|
||||
<a id="download_nowatermark" target="_blank" class="dropdown-item">Without watermark</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="audio_title"></p>
|
||||
<audio id="audio" controls preload="none"></audio>
|
||||
<div class="buttons is-centered">
|
||||
<button id="back-button" class="button is-danger">Back</button>
|
||||
<button id="next-button" class="button is-success">Next</button>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{path('/scripts/themes/card.js')}"></script>
|
||||
@@ -0,0 +1,8 @@
|
||||
<div n:ifset="$feed->info" class="buttons">
|
||||
{* is_numeric is used to avoid having a back button with ttwid cursors *}
|
||||
{if isset($_GET['cursor']) && is_numeric($_GET['cursor']) && $_GET['cursor'] != 0 }
|
||||
<a class="button is-danger" href="?cursor=0">First</a>
|
||||
<a class="button is-danger" href="?cursor={$feed->minCursor}">Back</a>
|
||||
{/if}
|
||||
<a n:attr="disabled => !$feed->hasMore" class="button is-success" href="?cursor={$feed->maxCursor}">Next</a>
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
<div class="dropdown is-hoverable">
|
||||
<div class="dropdown-trigger">
|
||||
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
|
||||
{include '../../icon.latte', icon: 'software-download', text: 'Download'}
|
||||
</button>
|
||||
</div>
|
||||
<div class="dropdown-menu" role="menu">
|
||||
<div class="dropdown-content">
|
||||
<a target="_blank" href="{path('/download?url=' . urlencode($playAddr) . '&id=' . $id . '&user=' . $uniqueId) . '&watermark=1'}" class="dropdown-item">Watermark</a>
|
||||
<a target="_blank" href="{path('/download?id=' . $id . '&user=' . $uniqueId)}" class="dropdown-item">No watermark</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
{do $endpoint = '/@' . $uniqueId . '/video/' . $id}
|
||||
<div class="buttons is-centered">
|
||||
<a class="button is-success is-small" href="{path($endpoint)}">Instance Link</a>
|
||||
<a class="button is-danger is-small" href="https://www.tiktok.com{$endpoint}">Original Link</a>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<p>
|
||||
{include '../../icon.latte', icon: 'eye', text: number($playCount)}
|
||||
{include '../../icon.latte', icon: 'heart', text: number($diggCount)}
|
||||
{include '../../icon.latte', icon: 'comment', text: number($commentCount)}
|
||||
{include '../../icon.latte', icon: 'share', text: number($shareCount)}
|
||||
</p>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="tags">
|
||||
{foreach $challenges as $challenge}
|
||||
<a class="tag is-rounded is-info" href="{path('/tag/' . $challenge->title)}">{$challenge->title}</a>
|
||||
{/foreach}
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
<div class="container">
|
||||
{foreach $feed->items as $item}
|
||||
<article class="media">
|
||||
<figure class="media-left">
|
||||
<p class="image is-64x64">
|
||||
<img src="{path('/stream?url=' . urlencode($item->author->avatarThumb))}" />
|
||||
</p>
|
||||
</figure>
|
||||
<div class="media-content">
|
||||
<div class="content">
|
||||
<p>
|
||||
<strong>{$item->author->nickname}</strong> <small><a href="{path('/@' . $item->author->uniqueId)}">@{$item->author->uniqueId}</a></small>
|
||||
</p>
|
||||
{if !empty($item->challenges)}
|
||||
<p>{include './common/tags.latte', challenges: $item->challenges}</p>
|
||||
{/if}
|
||||
<p n:ifcontent>{$item->desc}</p>
|
||||
{include './common/stats.latte', playCount: $item->stats->playCount, diggCount: $item->stats->diggCount, commentCount: $item->stats->commentCount, shareCount: $item->stats->shareCount}
|
||||
</div>
|
||||
<div class="has-text-centered">
|
||||
<video width="{$item->video->width}" height="{$item->video->height}" controls preload="none" poster="{path('/stream?url=' . urlencode($item->video->originCover))}">
|
||||
<source src="{path('/stream?url=' . $item->video->playAddr)}" type="video/mp4" />
|
||||
</video>
|
||||
</div>
|
||||
<div class="has-text-centered">
|
||||
{include './common/share.latte', uniqueId: $item->author->uniqueId, id: $item->id}
|
||||
{include './common/download.latte', playAddr: $item->video->playAddr, id: $item->id, uniqueId: $item->author->uniqueId}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
{/foreach}
|
||||
{if empty($feed->items)}
|
||||
<p class="title">No items sent by TikTok!</p>
|
||||
{/if}
|
||||
</div>
|
||||
{include './common/controls.latte'}
|
||||
+2
-3
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "pablouser1/proxitok",
|
||||
"description": "An alternative frontend for TikTok",
|
||||
"version": "1.5.0",
|
||||
"version": "2.2.1.0",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"type": "project",
|
||||
"homepage": "https://github.com/pablouser1/ProxiTok",
|
||||
@@ -14,11 +14,10 @@
|
||||
"require": {
|
||||
"ext-redis": "^5.3.2",
|
||||
"ext-mbstring": "*",
|
||||
"pablouser1/tikscraper": "^1.0",
|
||||
"latte/latte": "^2.10",
|
||||
"vlucas/phpdotenv": "^5.4",
|
||||
"bramus/router": "^1.6",
|
||||
"mibe/feedwriter": "^1.1"
|
||||
"pablouser1/tikscraper": "^1.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
Generated
+188
-131
@@ -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": "f5e451a254a58bf7d512421237641801",
|
||||
"content-hash": "417e49088860de4bd40099b5cef1e215",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bramus/router",
|
||||
@@ -121,16 +121,16 @@
|
||||
},
|
||||
{
|
||||
"name": "latte/latte",
|
||||
"version": "v2.10.8",
|
||||
"version": "v2.11.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nette/latte.git",
|
||||
"reference": "596b28bf098ebb852732d60b00538139a009c4db"
|
||||
"reference": "21316b42fb0a4e43df01f73c55d52bd531823fda"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nette/latte/zipball/596b28bf098ebb852732d60b00538139a009c4db",
|
||||
"reference": "596b28bf098ebb852732d60b00538139a009c4db",
|
||||
"url": "https://api.github.com/repos/nette/latte/zipball/21316b42fb0a4e43df01f73c55d52bd531823fda",
|
||||
"reference": "21316b42fb0a4e43df01f73c55d52bd531823fda",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -161,7 +161,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.10-dev"
|
||||
"dev-master": "2.11-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -199,127 +199,28 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nette/latte/issues",
|
||||
"source": "https://github.com/nette/latte/tree/v2.10.8"
|
||||
"source": "https://github.com/nette/latte/tree/v2.11.1"
|
||||
},
|
||||
"time": "2022-01-04T14:13:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mibe/feedwriter",
|
||||
"version": "v1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mibe/FeedWriter.git",
|
||||
"reference": "f4cc748ad8700e36663f08cfeebe7fd39b00eea2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mibe/FeedWriter/zipball/f4cc748ad8700e36663f08cfeebe7fd39b00eea2",
|
||||
"reference": "f4cc748ad8700e36663f08cfeebe7fd39b00eea2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"FeedWriter\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-3.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Bemmerl",
|
||||
"email": "mail@mx-server.de"
|
||||
},
|
||||
{
|
||||
"name": "Phil Freo"
|
||||
},
|
||||
{
|
||||
"name": "Paul Ferrett"
|
||||
},
|
||||
{
|
||||
"name": "Brennen Bearnes"
|
||||
},
|
||||
{
|
||||
"name": "Michael Robinson",
|
||||
"email": "mike@pagesofinterest.net"
|
||||
},
|
||||
{
|
||||
"name": "Baptiste Fontaine"
|
||||
},
|
||||
{
|
||||
"name": "Kristián Valentín"
|
||||
},
|
||||
{
|
||||
"name": "Brandtley McMinn"
|
||||
},
|
||||
{
|
||||
"name": "Julian Bogdani"
|
||||
},
|
||||
{
|
||||
"name": "Anis Uddin Ahmad",
|
||||
"email": "anis.programmer@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Cedric Gampert"
|
||||
},
|
||||
{
|
||||
"name": "Yamek"
|
||||
},
|
||||
{
|
||||
"name": "thielj"
|
||||
},
|
||||
{
|
||||
"name": "Pavel Khakhlou"
|
||||
},
|
||||
{
|
||||
"name": "Daniel"
|
||||
},
|
||||
{
|
||||
"name": "Tino Goratsch"
|
||||
}
|
||||
],
|
||||
"description": "Generate feeds in either RSS 1.0, RSS 2.0 or ATOM formats",
|
||||
"homepage": "https://github.com/mibe/FeedWriter",
|
||||
"keywords": [
|
||||
"RSS 1.0",
|
||||
"atom",
|
||||
"feed",
|
||||
"rss",
|
||||
"rss 2.0",
|
||||
"rss2"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/mibe/FeedWriter/issues",
|
||||
"source": "https://github.com/mibe/FeedWriter/tree/master"
|
||||
},
|
||||
"time": "2016-11-19T20:47:44+00:00"
|
||||
"time": "2022-04-07T13:21:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pablouser1/tikscraper",
|
||||
"version": "v1.2.1",
|
||||
"version": "v1.3.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pablouser1/TikScraperPHP.git",
|
||||
"reference": "2022b2c2d661383d09c4727091df7fae345844a5"
|
||||
"reference": "412bbbe5415e13207fe24b8e8274c527c82f01d6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/2022b2c2d661383d09c4727091df7fae345844a5",
|
||||
"reference": "2022b2c2d661383d09c4727091df7fae345844a5",
|
||||
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/412bbbe5415e13207fe24b8e8274c527c82f01d6",
|
||||
"reference": "412bbbe5415e13207fe24b8e8274c527c82f01d6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.3|^8.0"
|
||||
"php": ">=7.3|^8.0",
|
||||
"php-webdriver/webdriver": "^1.12",
|
||||
"sapistudio/seleniumstealth": "^1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@@ -339,9 +240,74 @@
|
||||
"description": "Get data from TikTok API",
|
||||
"support": {
|
||||
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
|
||||
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.2.1"
|
||||
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.3.3.0"
|
||||
},
|
||||
"time": "2022-02-13T20:28:38+00:00"
|
||||
"time": "2022-04-10T10:08:40+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",
|
||||
@@ -414,9 +380,39 @@
|
||||
],
|
||||
"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",
|
||||
"version": "v1.24.0",
|
||||
"version": "v1.25.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
@@ -448,12 +444,12 @@
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
@@ -478,7 +474,7 @@
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0"
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -498,7 +494,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.24.0",
|
||||
"version": "v1.25.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
@@ -561,7 +557,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0"
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -581,16 +577,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.24.0",
|
||||
"version": "v1.25.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9"
|
||||
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9",
|
||||
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c",
|
||||
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -644,7 +640,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0"
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -660,7 +656,68 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-09-13T13:58:33+00:00"
|
||||
"time": "2022-03-04T08:16:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v6.0.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "e13f6757e267d687e20ec5b26ccfcbbe511cd8f4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/e13f6757e267d687e20ec5b26ccfcbbe511cd8f4",
|
||||
"reference": "e13f6757e267d687e20ec5b26ccfcbbe511cd8f4",
|
||||
"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.7"
|
||||
},
|
||||
"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-03-18T16:21:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
@@ -754,5 +811,5 @@
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.2.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
web:
|
||||
container_name: proxitok-web
|
||||
build: .
|
||||
ports:
|
||||
- 8080:80
|
||||
environment:
|
||||
- LATTE_CACHE=/cache
|
||||
- API_CACHE=redis
|
||||
- REDIS_HOST=proxitok-redis
|
||||
- REDIS_PORT=6379
|
||||
- API_BROWSER_URL=http://proxitok-chrome:9515
|
||||
volumes:
|
||||
- proxitok-cache:/cache
|
||||
depends_on:
|
||||
- redis
|
||||
- chrome
|
||||
redis:
|
||||
container_name: proxitok-redis
|
||||
image: redis:6-alpine
|
||||
command: redis-server --save 60 1 --loglevel warning
|
||||
restart: unless-stopped
|
||||
|
||||
chrome:
|
||||
container_name: proxitok-chrome
|
||||
image: zenika/alpine-chrome:with-chromedriver
|
||||
shm_size: 1g
|
||||
ports:
|
||||
- "9515:9515"
|
||||
volumes:
|
||||
proxitok-cache:
|
||||
@@ -0,0 +1,15 @@
|
||||
// Workaround to allow TikTok embed
|
||||
|
||||
const blockquotes = document.getElementsByClassName('tiktok-embed')
|
||||
for (let i = 0; i < blockquotes.length; i++) {
|
||||
const blockquote = blockquotes[i]
|
||||
if (blockquote.children.length > 0 && blockquote.children[0].tagName !== 'iframe') {
|
||||
const iframe = document.createElement('iframe')
|
||||
iframe.style = 'width: 100%; height: 710px; display: block; visibility: unset; max-height: 710px;'
|
||||
iframe.src = 'https://www.tiktok.com/embed/v2/' + blockquote.dataset.videoId // This url will get redirected
|
||||
// Remove placeholder section
|
||||
blockquote.children[0].remove()
|
||||
// Add iframe
|
||||
blockquote.appendChild(iframe)
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@
|
||||
<section class="section">
|
||||
{block content}{/block}
|
||||
</section>
|
||||
{include '../components/footer.latte'}
|
||||
{block extra}{/block}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
{include '../components/head.latte'}
|
||||
|
||||
<body>
|
||||
{block content}{/block}
|
||||
{block extra}{/block}
|
||||
</body>
|
||||
</html>
|
||||
@@ -12,9 +12,6 @@
|
||||
<div class="container has-text-centered">
|
||||
{block content}{/block}
|
||||
</div>
|
||||
</div>
|
||||
<div class="hero-foot">
|
||||
{include '../components/footer.latte'}
|
||||
</div>
|
||||
</section>
|
||||
{block extra}{/block}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
User-agent: *
|
||||
Allow: /$
|
||||
Disallow: /
|
||||
+22
-7
@@ -1,19 +1,26 @@
|
||||
<?php
|
||||
/** @var \Bramus\Router\Router $router */
|
||||
use App\Helpers\Misc;
|
||||
use App\Helpers\Wrappers;
|
||||
use App\Models\BaseTemplate;
|
||||
use App\Models\HomeTemplate;
|
||||
|
||||
$router->get('/', function () {
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('home'), new HomeTemplate);
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('home'), new BaseTemplate('Home'));
|
||||
});
|
||||
|
||||
$router->get('/about', function () {
|
||||
$latte = Misc::latte();
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('about'), new BaseTemplate('About'));
|
||||
});
|
||||
|
||||
$router->get('/verify', function () {
|
||||
$latte = Wrappers::latte();
|
||||
$latte->render(Misc::getView('verify'), new BaseTemplate('Verify'));
|
||||
});
|
||||
|
||||
$router->get('/stream', 'ProxyController@stream');
|
||||
$router->get('/download', 'ProxyController@download');
|
||||
$router->get('/redirect', 'RedirectController@redirect');
|
||||
|
||||
$router->mount('/trending', function () use ($router) {
|
||||
@@ -23,13 +30,17 @@ $router->mount('/trending', function () use ($router) {
|
||||
|
||||
$router->mount('/@([^/]+)', function () use ($router) {
|
||||
$router->get('/', 'UserController@get');
|
||||
$router->get('/video/(\w+)', 'UserController@video');
|
||||
$router->get('/rss', 'UserController@rss');
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated Please use /@username/video/id instead
|
||||
*/
|
||||
$router->get('/video/(\w+)', 'VideoController@get');
|
||||
|
||||
$router->mount('/tag', function () use ($router) {
|
||||
$router->get('/([^/]+)', 'TagController@get');
|
||||
$router->mount('/tag/([^/]+)', function () use ($router) {
|
||||
$router->get('/', 'TagController@get');
|
||||
$router->get('/rss', 'TagController@rss');
|
||||
});
|
||||
|
||||
@@ -38,7 +49,11 @@ $router->get('/music/([^/]+)', 'MusicController@get');
|
||||
// -- Settings -- //
|
||||
$router->mount('/settings', function () use ($router) {
|
||||
$router->get('/', 'SettingsController@index');
|
||||
$router->post('/proxy', 'SettingsController@proxy');
|
||||
$router->post('/general', 'SettingsController@general');
|
||||
$router->post('/api', 'SettingsController@api');
|
||||
});
|
||||
|
||||
$router->get('/discover', 'DiscoverController@get');
|
||||
|
||||
// -- EMBED -- //
|
||||
$router->get('/embed/v2/(\d+)', 'EmbedController@v2');
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
This facilities making the bulma.min.css and fontawesome.min.css files, install all dependencies using:
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
And then use:
|
||||
```
|
||||
yarn bulma && yarn fa
|
||||
```
|
||||
|
||||
This compiles bulma.scss and fontawesome.scss to a css file and helps lowering the size of the css that will be sent to the user.
|
||||
+5
-2
@@ -11,8 +11,9 @@ $bulmaswatch-import-font: false;
|
||||
|
||||
// Elements
|
||||
@import "./node_modules/bulma/sass/elements/button.sass";
|
||||
@import "./node_modules/bulma/sass/elements/box.sass";
|
||||
@import "./node_modules/bulma/sass/elements/container.sass";
|
||||
@import "./node_modules/bulma/sass/elements/icon.sass";
|
||||
@import "./node_modules/bulma/sass/elements/image.sass";
|
||||
@import "./node_modules/bulma/sass/elements/other.sass";
|
||||
@import "./node_modules/bulma/sass/elements/tag.sass";
|
||||
@import "./node_modules/bulma/sass/elements/title.sass";
|
||||
@@ -21,13 +22,15 @@ $bulmaswatch-import-font: false;
|
||||
@import "./node_modules/bulma/sass/form/shared.sass";
|
||||
@import "./node_modules/bulma/sass/form/input-textarea.sass";
|
||||
@import "./node_modules/bulma/sass/form/checkbox-radio.sass";
|
||||
@import "./node_modules/bulma/sass/form/select.sass";
|
||||
@import "./node_modules/bulma/sass/form/tools.sass";
|
||||
|
||||
// Components
|
||||
@import "./node_modules/bulma/sass/components/card.sass";
|
||||
@import "./node_modules/bulma/sass/components/dropdown.sass";
|
||||
@import "./node_modules/bulma/sass/components/media.sass";
|
||||
@import "./node_modules/bulma/sass/components/modal.sass";
|
||||
@import "./node_modules/bulma/sass/components/navbar.sass";
|
||||
@import "./node_modules/bulma/sass/components/media.sass";
|
||||
|
||||
// Grids
|
||||
@import "./node_modules/bulma/sass/grid/columns.sass";
|
||||
@@ -0,0 +1,15 @@
|
||||
@charset "utf-8";
|
||||
// Common
|
||||
@import "./node_modules/css.gg/icons/scss/home.scss";
|
||||
@import "./node_modules/css.gg/icons/scss/info.scss";
|
||||
|
||||
// Home
|
||||
@import "./node_modules/css.gg/icons/scss/search.scss";
|
||||
|
||||
// Feed
|
||||
@import "./node_modules/css.gg/icons/scss/feed.scss";
|
||||
@import "./node_modules/css.gg/icons/scss/eye.scss";
|
||||
@import "./node_modules/css.gg/icons/scss/heart.scss";
|
||||
@import "./node_modules/css.gg/icons/scss/comment.scss";
|
||||
@import "./node_modules/css.gg/icons/scss/share.scss";
|
||||
@import "./node_modules/css.gg/icons/scss/software-download.scss";
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "proxitok-scss",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"bulma": "sass --style=compressed bulma.scss ../styles/vendor/bulma.min.css",
|
||||
"cssgg": "sass --style=compressed cssgg.scss ../styles/vendor/cssgg.min.css"
|
||||
},
|
||||
"dependencies": {
|
||||
"bulma": "^0.9.3",
|
||||
"bulmaswatch": "^0.8.1",
|
||||
"css.gg": "^2.0.0",
|
||||
"sass": "^1.46.0"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,11 @@ bulmaswatch@^0.8.1:
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
css.gg@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/css.gg/-/css.gg-2.0.0.tgz#1ba891092ceac58a2550540171c2d469a86b27b2"
|
||||
integrity sha512-8qO59kSXLbewo7xaUM4eC8328MTdGmb8atpmw6PRzeDGsZrCkAVjJzKeFDIntagl1/aCee+NG1OQtIvWAjgG/A==
|
||||
|
||||
fill-range@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
|
||||
@@ -113,9 +118,9 @@ readdirp@~3.6.0:
|
||||
picomatch "^2.2.1"
|
||||
|
||||
sass@^1.46.0:
|
||||
version "1.49.7"
|
||||
resolved "https://registry.yarnpkg.com/sass/-/sass-1.49.7.tgz#22a86a50552b9b11f71404dfad1b9ff44c6b0c49"
|
||||
integrity sha512-13dml55EMIR2rS4d/RDHHP0sXMY3+30e1TKsyXaSz3iLWVoDWEoboY8WzJd5JMnxrRHffKO3wq2mpJ0jxRJiEQ==
|
||||
version "1.49.9"
|
||||
resolved "https://registry.yarnpkg.com/sass/-/sass-1.49.9.tgz#b15a189ecb0ca9e24634bae5d1ebc191809712f9"
|
||||
integrity sha512-YlYWkkHP9fbwaFRZQRXgDi3mXZShslVmmo+FVK3kHLUELHHEYrCmL1x6IUjC7wLS6VuJSAFXRQS/DxdsC4xL1A==
|
||||
dependencies:
|
||||
chokidar ">=3.0.0 <4.0.0"
|
||||
immutable "^4.0.0"
|
||||
@@ -0,0 +1,15 @@
|
||||
location / {
|
||||
# try to serve file directly, fallback to rewrite
|
||||
try_files $uri @rewriteapp;
|
||||
}
|
||||
|
||||
location @rewriteapp {
|
||||
# rewrite all to index.php
|
||||
rewrite ^(.*)$ /index.php/$1 last;
|
||||
}
|
||||
|
||||
location ~ ^/index\.php(/|$) {
|
||||
try_files @heroku-fcgi @heroku-fcgi;
|
||||
# ensure that /index.php isn't accessible directly, but only through a rewrite
|
||||
internal;
|
||||
}
|
||||
Vendored
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,11 +0,0 @@
|
||||
This facilities making the bulma.min.css file, install all dependencies using:
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
And then use:
|
||||
```
|
||||
yarn bulma
|
||||
```
|
||||
|
||||
This compiles bulma.scss to a css file and helps lowering the size of the css that will be sent to the user.
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "proxitok-scss",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"bulma": "sass --style=compressed bulma.scss ../bulma.min.css"
|
||||
},
|
||||
"dependencies": {
|
||||
"bulma": "^0.9.3",
|
||||
"bulmaswatch": "^0.8.1",
|
||||
"sass": "^1.46.0"
|
||||
}
|
||||
}
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sourceRoot":"","sources":["../../scss/node_modules/css.gg/icons/scss/home.scss","../../scss/node_modules/css.gg/icons/scss/info.scss","../../scss/node_modules/css.gg/icons/scss/search.scss","../../scss/node_modules/css.gg/icons/scss/feed.scss","../../scss/node_modules/css.gg/icons/scss/eye.scss","../../scss/node_modules/css.gg/icons/scss/heart.scss","../../scss/node_modules/css.gg/icons/scss/comment.scss","../../scss/node_modules/css.gg/icons/scss/share.scss","../../scss/node_modules/css.gg/icons/scss/software-download.scss"],"names":[],"mappings":"AAAA,SACE,yLACA,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,aACA,gBACA,4BACA,2BACA,6BACA,4BACA,mBAEA,gBACE,WACA,cACA,sBACA,kBAGF,iBACE,WACA,cACA,sBACA,kBACA,qBACA,sBACA,2BACA,wBACA,SACA,kBACA,WACA,YACA,OAGF,gBACE,UACA,YACA,iBACA,oBACA,4BACA,6BACA,gBACA,SACA,SCjDJ,SACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,mBAEA,iCACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,wBACA,SAGF,gBACE,WACA,WAGF,iBACE,WACA,QC5BN,WACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,mBACA,iBACA,gBAEA,kBACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,WACA,wBACA,yBACA,SACA,UCvBN,SACI,cACA,sBACA,wBACA,sBASA,iBACA,gBACA,kBACA,+BACA,UACA,WACA,kBAbA,iCACE,cACA,sBACA,wBACA,sBAWF,iCACE,WACA,kBACA,kBACA,WACA,WACA,QACA,SACA,WAGF,gBACE,UACA,QACA,WCnCN,QACI,kBACA,cACA,+BACA,WACA,YACA,iCACA,gCACA,gBACA,sBAEA,+BACE,WACA,cACA,oBACA,kBACA,sBAGF,eACE,QACA,8CACA,WACA,YAGF,gBACE,UACA,WACA,iBACA,WACA,SC/BN,UACI,iBACA,6BACA,8BACA,WACA,WACA,gBAeA,sBACA,kBACA,gHACA,cAhBA,iBACE,iBACA,6BACA,8BACA,WACA,WACA,gBACA,WACA,cACA,sBACA,kBAQF,kBACE,WACA,cACA,sBACA,kBAGF,iBACE,WACA,wBACA,QAGF,kBACE,WACA,YACA,sBACA,wBACA,UACA,QC7CN,YACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,gBACA,0CAEA,mBACE,WACA,cACA,sBACA,kBACA,UAGF,oBACE,WACA,cACA,sBACA,kBACA,UACA,iBACA,6BACA,+BACA,UACA,YACA,WAGF,mBACE,WACA,wBACA,qBACA,SACA,QCtCN,UACI,sBACA,kBACA,cACA,+BACA,UACA,WACA,wBACA,oBACA,kCAEA,iBACE,WACA,cACA,sBACA,kBACA,kBACA,WACA,WACA,wBACA,SAGF,kBACE,WACA,cACA,sBACA,kBACA,kBACA,WACA,WACA,wBACA,SACA,MACA,yBAGF,iBACE,SACA,wBCvCN,sBACI,sBACA,kBACA,cACA,+BACA,WACA,WACA,iBACA,aACA,8BACA,+BACA,eAEA,6BACE,WACA,cACA,sBACA,kBACA,UACA,WACA,sBACA,wBACA,yBACA,SACA,WAGF,8BACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,YACA,wBACA,SACA","file":"cssgg.min.css"}
|
||||
+9
-4
@@ -2,11 +2,17 @@
|
||||
|
||||
{block header}
|
||||
<p class="title">Welcome to Proxitok!</p>
|
||||
<p class="subtitle">An alternative frontend for TikTok</p>
|
||||
<p class="subtitle">
|
||||
Made with <span style="color: #e25555;">♥</span> in <a href="https://github.com/pablouser1/ProxiTok">Github</a>
|
||||
</p>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
<p class="title">Why?</p>
|
||||
<p class="title">About this instance</p>
|
||||
<p>Version: {version()}</p>
|
||||
<p>Forcing Legacy mode: {isset($_ENV['API_FORCE_LEGACY']) ? 'yes' : 'no'}</p>
|
||||
<hr />
|
||||
<p class="title">Why would I want to use ProxiTok?</p>
|
||||
<p>
|
||||
There are already
|
||||
<a rel="nofollow" href="https://penetrum.com/tiktok/Penetrum_TikTok_Security_Analysis_whitepaper.pdf">multiple</a>
|
||||
@@ -20,12 +26,11 @@
|
||||
<p>
|
||||
This project wouldn't be possible without the help of the following projects:
|
||||
<ul>
|
||||
<li><a rel="nofollow" href="https://github.com/pablouser1/TikScraperPHP">TikScraper</a></li>
|
||||
<li><a rel="nofollow" href="https://github.com/pablouser1/TikScraperPHP">TikScraperPHP</a></li>
|
||||
<li><a rel="nofollow" href="https://github.com/nette/latte">Latte</a></li>
|
||||
<li><a rel="nofollow" href="https://github.com/bramus/router">bramus/router</a></li>
|
||||
<li><a rel="nofollow" href="https://github.com/vlucas/phpdotenv">PHP dotenv</a></li>
|
||||
<li><a rel="nofollow" href="https://github.com/jgthms/bulma">Bulma</a> and <a href="https://github.com/jenil/bulmaswatch">Bulmaswatch</a></li>
|
||||
<li><a rel="nofollow" href="https://github.com/mibe/FeedWriter">FeedWriter</a></li>
|
||||
</ul>
|
||||
</p>
|
||||
{/block}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{if !empty($item->cardItem->cover)}
|
||||
<div class="media-left">
|
||||
<figure class="image is-96x96">
|
||||
<img width="96" height="96" src="{path('/stream?url=' . urlencode($item->cardItem->cover))}" />
|
||||
<img loading="lazy" width="96" height="96" src="{path('/stream?url=' . urlencode($item->cardItem->cover))}" />
|
||||
</figure>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -5,5 +5,8 @@
|
||||
<p class="subtitle">HTTP Code: {$error->http_code}</p>
|
||||
{if $error->tiktok_code}
|
||||
<p class="subtitle">API error code {$error->tiktok_code} ({$error->tiktok_msg})</p>
|
||||
{if $error->tiktok_code === 10000}
|
||||
<a href="{path('/verify')}">What does this mean?</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
+23
-21
@@ -3,28 +3,30 @@
|
||||
{block content}
|
||||
<p class="title">Welcome to ProxiTok!</p>
|
||||
<p class="subtitle">An alternative open source frontend for TikTok</p>
|
||||
<!-- Create forms from App\Models\HomeTemplate -->
|
||||
<div class="columns is-centered is-vcentered is-multiline">
|
||||
{foreach $forms as $form}
|
||||
<div class="column is-narrow">
|
||||
{embed '../components/card.latte'}
|
||||
{block title}{$form['title']}{/block}
|
||||
{block content}
|
||||
<form action="{path('/redirect')}">
|
||||
<div class="field has-addons has-addons-centered">
|
||||
<div class="control">
|
||||
<input name="{$form['input']}" class="input" type="text" placeholder="{$form['placeholder']}" required />
|
||||
</div>
|
||||
<div class="control">
|
||||
<button class="button is-success" type="submit">Search</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
{/embed}
|
||||
{embed '../components/form.latte', path: '/redirect', method: 'GET'}
|
||||
{block fields}
|
||||
<div class="field has-addons has-addons-centered">
|
||||
<div class="control">
|
||||
<input class="input" name="term" placeholder="Search" required>
|
||||
</div>
|
||||
<div class="control">
|
||||
<div class="select">
|
||||
<select name="type">
|
||||
<option value="user">Username</option>
|
||||
<option value="tag">Tag</option>
|
||||
<option value="music">Music ID</option>
|
||||
<option value="video">Video ID</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button type="submit" class="button is-success">
|
||||
{include '../components/icon.latte', icon: 'search', text: 'Search'}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/block}
|
||||
{/embed}
|
||||
<div class="columns is-centered is-mobile">
|
||||
<div class="column is-narrow">
|
||||
<p>Discover</p>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{contentType application/rss+xml}
|
||||
{do header('Content-Disposition: attachment; filename="' . $title . '.rss' . '"')}
|
||||
{do $full_link = path($link)}
|
||||
{var $download = new \TikScraper\Download}
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{$title}</title>
|
||||
<description><![CDATA[{$desc}]]></description>
|
||||
<link>{$full_link}</link>
|
||||
<atom:link href="{$full_link . '/rss'}" rel="self" type="application/rss+xml"></atom:link>
|
||||
{foreach $items as $item}
|
||||
<item>
|
||||
<title>{$item->desc}</title>
|
||||
<description><![CDATA[{$item->desc}]]></description>
|
||||
<link>{path('/@' . $item->author->uniqueId . '/video/' . $item->id)}</link>
|
||||
<pubDate>{(int) $item->createTime}</pubDate>
|
||||
<guid isPermaLink="false">{$item->id}</guid>
|
||||
<enclosure length="{$download->file_size($item->video->playAddr)}" type="video/mp4" url="{path('/stream?url=' . urlencode($item->video->playAddr))}"></enclosure>
|
||||
</item>
|
||||
{/foreach}
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -5,7 +5,9 @@
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
<!-- Proxy settings -->
|
||||
<p class="title">Proxy</p>
|
||||
{include '../components/settings/proxy.latte'}
|
||||
<p class="title">General</p>
|
||||
{include '../components/settings/general.latte'}
|
||||
<hr />
|
||||
<p class="title">Api</p>
|
||||
{include '../components/settings/api.latte'}
|
||||
{/block}
|
||||
|
||||
+6
-2
@@ -1,10 +1,14 @@
|
||||
{layout '../layouts/default.latte'}
|
||||
|
||||
{block header}
|
||||
{if $feed->info->detail->profileThumb !== ''}
|
||||
<figure class="figure is-96x96">
|
||||
<img src="{path('/stream?url=' . urlencode($feed->info->detail->profileThumb))}" />
|
||||
</figure>
|
||||
{/if}
|
||||
<p class="title">{$feed->info->detail->title}</p>
|
||||
<p class="subtitle">{$feed->info->detail->desc}</p>
|
||||
<p class="subtitle">{include '../components/rss.latte'}</p>
|
||||
<p>Videos: {number($feed->info->stats->videoCount)} / Views: {number($feed->info->stats->viewCount)}</p>
|
||||
<a href="{path('tag/' . $feed->info->detail->title . '/rss')}">RSS</a>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
{block header}
|
||||
<p class="title">Trending</p>
|
||||
<a href="{path('trending/rss')}">RSS</a>
|
||||
<p class="subtitle">{include '../components/rss.latte'}</p>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
|
||||
+3
-3
@@ -4,11 +4,11 @@
|
||||
<figure class="figure is-96x96">
|
||||
<img src="{path('/stream?url=' . urlencode($feed->info->detail->avatarThumb))}" />
|
||||
</figure>
|
||||
<p class="title">{$feed->info->detail->uniqueId}'s profile</p>
|
||||
<p class="subtitle">{$feed->info->detail->signature}</p>
|
||||
<p class="title">{$feed->info->detail->uniqueId}</p>
|
||||
<p class="subtitle">{include '../components/rss.latte'}</p>
|
||||
<p>{$feed->info->detail->signature}</p>
|
||||
<p>Following: {number($feed->info->stats->followingCount)} / Followers: {number($feed->info->stats->followerCount)}</p>
|
||||
<p>Hearts: {number($feed->info->stats->heartCount)} / Videos: {$feed->info->stats->videoCount}</p>
|
||||
<a href="{path('/@' . $feed->info->detail->uniqueId . '/rss')}">RSS</a>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
{layout '../layouts/default.latte'}
|
||||
|
||||
{block header}
|
||||
<p class="title">VERIFY_CODE</p>
|
||||
<p class="subtitle">What can I do?</p>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
<p>TL;DR You probably have to search for another instance or wait some hours (or even better, have your own self-hosted instance)</p>
|
||||
<p>TikTok has some mecanisms in order to stop scraping on their latest api (/api/...):</p>
|
||||
<hr />
|
||||
<div class="block">
|
||||
<p class="is-size-4">Rate limits</p>
|
||||
<p>
|
||||
This is pretty standard stuff,
|
||||
it blocks ips temporarly if you send too many requests to an endpoint and unbans you after some hours.
|
||||
</p>
|
||||
</div>
|
||||
<div class="block">
|
||||
<p class="is-size-4">IP Blacklist</p>
|
||||
<p>
|
||||
It is a list with IPs from popular Hosters (AWS, Heroku...). This IPs are banned <i>(I think) permanently</i> and
|
||||
can barely make requests.
|
||||
</p>
|
||||
<p>
|
||||
This makes hosting a public instance really hard. Even if you use a hosting platform that is not banned by TikTok, it is only a matter of time
|
||||
that it inevitably gets banned.
|
||||
</p>
|
||||
<p class="is-size-5">(For webmasters) How can I know if my server is not blacklisted?</p>
|
||||
<p>Run this command on your instance:</p>
|
||||
<code>
|
||||
curl \
|
||||
--url 'https://www.tiktok.com/@tiktok/?lang=en' \
|
||||
--header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36'
|
||||
</code>
|
||||
<p>If you don't get an empty response or a captcha, you are good to go</p>
|
||||
</div>
|
||||
{/block}
|
||||
+12
-12
@@ -1,22 +1,22 @@
|
||||
{layout '../layouts/hero.latte'}
|
||||
{layout "../layouts/{$layout}.latte"}
|
||||
|
||||
{block content}
|
||||
<div class="columns is-centered is-vcentered">
|
||||
<div class="column">
|
||||
<video controls poster="{path('/stream?url=' . urlencode($feed->items[0]->video->originCover))}">
|
||||
<source src="{path('/stream?url=' . urlencode($feed->items[0]->video->playAddr))}" type="video/mp4" />
|
||||
<div class="columns is-centered is-vcentered is-gapless">
|
||||
<div class="column is-three-quarters">
|
||||
<video controls autoplay playsinline poster="{path('/stream?url=' . urlencode($item->video->originCover))}">
|
||||
<source src="{path('/stream?url=' . urlencode($item->video->playAddr))}" type="video/mp4" />
|
||||
</video>
|
||||
</div>
|
||||
<div class="column has-text-centered">
|
||||
<div class="box">
|
||||
<p class="title">Video by <a href="{path('/@'.$feed->info->detail->uniqueId)}">{$feed->info->detail->uniqueId}</a></p>
|
||||
<p class="subtitle">{$feed->items[0]->desc}</p>
|
||||
<p>Played {number($feed->info->stats->playCount)} times</p>
|
||||
<p>Shared {number($feed->info->stats->shareCount)} times / {number($feed->info->stats->commentCount)} comments</p>
|
||||
<p class="title">Video by <a href="{path('/@'.$detail->uniqueId)}">{$detail->uniqueId}</a></p>
|
||||
<p class="subtitle">{$item->desc}</p>
|
||||
{include '../components/themes/common/stats.latte', playCount: $item->stats->playCount, diggCount: $item->stats->diggCount, commentCount: $item->stats->commentCount, shareCount: $item->stats->shareCount}
|
||||
<hr />
|
||||
<a href="{path('/stream?url=' . urlencode($feed->items[0]->video->playAddr) . '&download=1')}" class="button is-info">Download video</a>
|
||||
<p>{$feed->items[0]->music->title}</p>
|
||||
<audio src="{path('/stream?url=' . urlencode($feed->items[0]->music->playUrl))}" controls preload="none"></audio>
|
||||
{include '../components/themes/common/share.latte', uniqueId: $detail->uniqueId, id: $item->id}
|
||||
{include '../components/themes/common/download.latte', playAddr: $item->video->playAddr, id: $item->id, uniqueId: $detail->uniqueId}
|
||||
<p>{$item->music->title}</p>
|
||||
<audio src="{path('/stream?url=' . urlencode($item->music->playUrl))}" controls preload="none"></audio>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user