Compare commits

...

11 Commits

Author SHA1 Message Date
Pablo Ferreiro 44ee065ec6 Icons, themes, removed instance proxy and more 2022-03-29 19:30:31 +02:00
Pablo Ferreiro 9a35c61023 Update Wrapper, fixes MIME issues 2022-03-28 18:07:50 +02:00
Pablo Ferreiro 9f43caa3c4 Added public instances section on README 2022-03-18 16:01:10 +01:00
Pablo Ferreiro 44429cb7e4 bump wrapper 2022-03-18 15:02:26 +01:00
Pablo Ferreiro ade2b3c01a hotfix 2022-03-16 00:33:59 +01:00
Pablo Ferreiro e4e6f05362 upstream from PussTheCat-org/docker-proxitok-quay 2022-03-16 00:26:45 +01:00
Pablo Ferreiro eb69e8a22e Added Credits for Dockerfile 2022-03-15 23:57:48 +01:00
Pablo Ferreiro 5fffc7ae08 hotfix 2022-03-15 23:05:04 +01:00
Pablo Ferreiro f0765e266c Working Docker 2022-03-15 22:52:54 +01:00
Pablo Ferreiro c26e027c01 Redirect to Wiki for Self-Hosting 2022-03-15 17:23:03 +01:00
Pablo Ferreiro 6eee156541 /video follows TikTok schema 2022-03-14 11:50:47 +01:00
60 changed files with 590 additions and 576 deletions
+8
View File
@@ -0,0 +1,8 @@
node_modules
/.env
/.vscode
/vendor
/cache/latte/*
!/cache/latte/.gitkeep
/cache/api/*
!/cache/api/.gitkeep
+1 -7
View File
@@ -1,4 +1,4 @@
# APP_URL="http://localhost:8000" # Full url path, PLEASE REPLACE TO YOUR OWN ONE
# APP_PATH="/proxitok" # Relative path, PLEASE LEAVE EMPTY IF /
# LATTE_CACHE=/tmp/proxitok_api # Path for Latte cache, leave commented for ./cache/latte
# API CONFIG
@@ -8,12 +8,6 @@
# API_TEST_ENDPOINTS=1 # Discomment for usage of testing TikTok endpoints, may help sometimes
# API_CACHE=redis
# Proxy Config, will be used to make TikTok requests, useful if having VERIFY_CODE issues
# PROXY_HOST=HOSTNAME
# PROXY_PORT=8080
# PROXY_USERNAME=USERNAME
# PROXY_PASSWORD=PASSWORD
# 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
+24
View File
@@ -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
+11 -40
View File
@@ -4,12 +4,18 @@ 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
* Themes
* RSS Feed for user, trending and tag (just add /rss to the url)
## 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)
@@ -26,50 +32,15 @@ Pattern type: Regular Expression
Apply to: Main window (address bar)
```
## Installation
Clone the repository and fetch the requiered external packages with:
```bash
composer install
```
Move the .env.example file to .env and modify it.
Then you can run it using for example the PHP Development Server with:
```bash
php -S localhost:8080
```
## Configuration
### 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
```
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /.env {
deny all;
return 404;
}
```
## TODO / Known issues
* Docker
* Full installation instructions
* Add a NoJS version / Make the whole program without required JS
* Make video on /video fit screen and don't overflow
* i18n
* Search
## Credits
[@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)
+3 -2
View File
@@ -3,14 +3,15 @@ namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
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 = Wrappers::latte();
$latte->render(Misc::getView('discover'), new FeedTemplate('Discover', $feed));
} else {
ErrorHandler::show($feed->meta);
+3 -2
View File
@@ -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);
+19 -9
View File
@@ -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);
+9 -11
View File
@@ -3,12 +3,13 @@ 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 private function redirect() {
@@ -16,19 +17,16 @@ class SettingsController {
header("Location: {$url}");
}
static public function proxy() {
if (in_array(Cookies::PROXY, $_POST)) {
foreach (Cookies::PROXY as $proxy_element) {
Cookies::set($proxy_element, $_POST[$proxy_element]);
}
static public function general() {
if (isset($_POST['theme'])) {
$theme = $_POST['theme'];
Cookies::set('theme', $theme);
}
self::redirect();
}
static public function api() {
$legacy = 'off';
if (isset($_POST['api-legacy'])) {
$legacy = 'on';
$legacy = $_POST['api-legacy'];
}
Cookies::set('api-legacy', $legacy);
self::redirect();
+7 -8
View File
@@ -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));
}
}
}
+7 -9
View File
@@ -4,12 +4,12 @@ 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::getTtwid();
$api = Misc::api();
$api = Wrappers::api();
// Ttwid if normal, cursor if legacy
if ($api::class === 'TikScraper\Api') {
@@ -19,7 +19,7 @@ class TrendingController {
}
$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);
@@ -27,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));
}
}
}
+18 -8
View File
@@ -3,13 +3,14 @@ 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 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) {
@@ -17,21 +18,30 @@ class UserController {
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 FeedTemplate('Video', $feed));
} 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));
}
}
}
+4 -12
View File
@@ -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();
$feed = $api->getVideoByID($video_id);
if ($feed->meta->success) {
$latte = Misc::latte();
$latte->render(Misc::getView('video'), new FeedTemplate('Video', $feed));
} else {
ErrorHandler::show($feed->meta);
}
UserController::video('placeholder', $video_id);
}
}
+11 -3
View File
@@ -2,13 +2,21 @@
namespace App\Helpers;
class Cookies {
const PROXY = ['host', 'port', 'user', '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 null;
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 {
+1 -1
View File
@@ -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));
}
}
+5 -99
View File
@@ -1,20 +1,19 @@
<?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 getTtwid(): string {
return $_GET['cursor'] ?? '';
return isset($_GET['cursor']) ? $_GET['cursor'] : '';
}
static public function url(string $endpoint = '') {
return self::env('APP_URL', '') . $endpoint;
static public function url(string $endpoint = ''): string {
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http";
$root = $protocol . '://' . $_SERVER['HTTP_HOST'];
return $root . self::env('APP_PATH', '') . $endpoint;
}
static public function env(string $key, $default_value) {
@@ -27,97 +26,4 @@ class Misc {
static public function getView(string $template): string {
return __DIR__ . "/../../views/{$template}.latte";
}
/**
* Setup of TikTok Api wrapper
* @return \TikScraper\Api|\TikScraper\Legacy
*/
static public function api() {
$options = [
'use_test_endpoints' => self::env('API_TEST_ENDPOINTS', false),
// Instance level proxy config
'proxy' => [
'host' => self::env('PROXY_HOST', null),
'port' => self::env('PROXY_PORT', null),
'user' => self::env('PROXY_USER', null),
'password' => self::env('PROXY_PASSWORD', null)
],
'signer' => [
'remote_url' => self::env('API_SIGNER_URL', ''),
'browser_url' => self::env('API_BROWSER_URL', ''),
'close_when_done' => false
]
];
// User level proxy config, will overwrite instance config
foreach(Cookies::PROXY as $proxy_element) {
if (isset($_COOKIE[$proxy_element])) {
$options['proxy'][$proxy_element] = $_COOKIE[$proxy_element];
}
}
// 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 = self::env('API_FORCE_LEGACY', false) || isset($_COOKIE['api-legacy']) && $_COOKIE['api-legacy'] === 'on';
return $legacy === false ? new \TikScraper\Api($options, $cacheEngine) : new \TikScraper\Legacy($options, $cacheEngine);
}
/**
* 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;
}
}
-34
View File
@@ -1,34 +0,0 @@
<?php
namespace App\Helpers;
use \FeedWriter\RSS2;
use \TikScraper\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 . '"');
}
}
+90
View File
@@ -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);
}
}
-34
View File
@@ -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');
}
}
+19
View File
@@ -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;
}
}
-16
View File
@@ -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;
}
}
+1 -71
View File
@@ -1,71 +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('/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}
</div>
<div n:ifset="$feed->info" 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 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/feed.js')}"></script>
{include './themes/' . theme() . '.latte'}
+10
View File
@@ -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>
+1 -1
View File
@@ -5,7 +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/vendor/fontawesome.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>
+14
View File
@@ -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}
+6 -2
View File
@@ -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>
+3
View File
@@ -0,0 +1,3 @@
<a href="{path($_SERVER['REQUEST_URI'] . '/rss')}">
{include './icon.latte', icon: 'feed', text: 'RSS Feed'}
</a>
+12 -12
View File
@@ -1,14 +1,14 @@
<form action="{path('/settings/api')}" method="POST">
{embed '../form.latte', path: '/settings/api', method: 'POST', submit: true}
{block fields}
<div class="field">
<label class="checkbox">
<input name="api-legacy" type="checkbox"
checked="{isset($_COOKIE['api-legacy']) && $_COOKIE['api-legacy'] === 'on' ? 'true' : 'false'}"
value="{isset($_COOKIE['api-legacy']) ? $_COOKIE['api-legacy'] : 'off'}">Enable legacy mode
</label>
<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>
<div class="field">
<div class="control">
<button class="button is-success" type="submit">Submit</button>
</div>
</div>
</form>
{/block}
{/embed}
+14
View File
@@ -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}
-15
View File
@@ -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|firstUpper}</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>
+68
View File
@@ -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>
+8
View File
@@ -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>
+13
View File
@@ -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=' . $item->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>
+5
View File
@@ -0,0 +1,5 @@
{do $endpoint = '/@' . $uniqueId . '/video/' . $id}
<div class="buttons is-centered">
<a class="button is-success is-small" href="{path($endpoint)}">Instace Link</a>
<a class="button is-danger is-small" href="https://www.tiktok.com{$endpoint}">Original Link</a>
</div>
+6
View File
@@ -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>
+5
View File
@@ -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>
+36
View File
@@ -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'}
+1 -2
View File
@@ -1,7 +1,7 @@
{
"name": "pablouser1/proxitok",
"description": "An alternative frontend for TikTok",
"version": "2.1.0.0",
"version": "2.2.0.0",
"license": "AGPL-3.0-or-later",
"type": "project",
"homepage": "https://github.com/pablouser1/ProxiTok",
@@ -17,7 +17,6 @@
"latte/latte": "^2.10",
"vlucas/phpdotenv": "^5.4",
"bramus/router": "^1.6",
"mibe/feedwriter": "^1.1",
"pablouser1/tikscraper": "^1.3"
},
"autoload": {
Generated
+7 -108
View File
@@ -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": "dcd701a81d130026c44b63870c9a9f73",
"content-hash": "def7d3d4bbdae6916d99e50b33b3595a",
"packages": [
{
"name": "bramus/router",
@@ -203,119 +203,18 @@
},
"time": "2022-02-22T18:39:58+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"
},
{
"name": "pablouser1/tikscraper",
"version": "v1.3.0.3",
"version": "v1.3.2.0",
"source": {
"type": "git",
"url": "https://github.com/pablouser1/TikScraperPHP.git",
"reference": "793dde26e17362af304b9f50890c7fc178387629"
"reference": "8aa4524d3f11c4087dcae565a874b9440b1468c7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/793dde26e17362af304b9f50890c7fc178387629",
"reference": "793dde26e17362af304b9f50890c7fc178387629",
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/8aa4524d3f11c4087dcae565a874b9440b1468c7",
"reference": "8aa4524d3f11c4087dcae565a874b9440b1468c7",
"shasum": ""
},
"require": {
@@ -341,9 +240,9 @@
"description": "Get data from TikTok API",
"support": {
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.3.0.3"
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.3.2.0"
},
"time": "2022-03-13T20:53:27+00:00"
"time": "2022-03-29T17:10:36+00:00"
},
{
"name": "php-webdriver/webdriver",
+33
View File
@@ -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:
+12 -8
View File
@@ -1,21 +1,21 @@
<?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 = Misc::latte();
$latte = Wrappers::latte();
$latte->render(Misc::getView('verify'), new BaseTemplate('Verify'));
});
@@ -30,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');
});
@@ -45,7 +49,7 @@ $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');
});
+4 -2
View File
@@ -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,14 +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";
+15
View File
@@ -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";
-2
View File
@@ -1,2 +0,0 @@
@import "./node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss";
@import "./node_modules/@fortawesome/fontawesome-free/scss/solid.scss";
+3 -3
View File
@@ -2,13 +2,13 @@
"name": "proxitok-scss",
"private": true,
"scripts": {
"bulma": "sass --style=compressed bulma.scss ./styles/vendor/bulma.min.css",
"fa": "sass --style=compressed fontawesome.scss ./styles/vendor/fontawesome.min.css"
"bulma": "sass --style=compressed bulma.scss ../styles/vendor/bulma.min.css",
"cssgg": "sass --style=compressed cssgg.scss ../styles/vendor/cssgg.min.css"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.0.0",
"bulma": "^0.9.3",
"bulmaswatch": "^0.8.1",
"css.gg": "^2.0.0",
"sass": "^1.46.0"
}
}
+5 -5
View File
@@ -2,11 +2,6 @@
# yarn lockfile v1
"@fortawesome/fontawesome-free@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.0.0.tgz#6f3bd8e42997c7d536a1246877ed8bcd4f005a54"
integrity sha512-6LB4PYBST1Rx40klypw1SmSDArjFOcfBf2LeX9Zg5EKJT2eXiyiJq+CyBYKeXyK0sXS2FsCJWSPr/luyhuvh0Q==
anymatch@~3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"
@@ -52,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"
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -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"}
+1 -3
View File
@@ -8,7 +8,6 @@
{block content}
<p class="title">About this instance</p>
<p>Forcing Legacy mode: {isset($_ENV['API_FORCE_LEGACY']) ? 'yes' : 'no'}</p>
<p>Instance-level Proxy: {isset($_ENV['PROXY_HOST']) ? 'yes' : 'no'}</p>
<hr />
<p class="title">Why would I want to use ProxiTok?</p>
<p>
@@ -24,12 +23,11 @@
<p>
This project wouldn't be possible without the help of the following projects:
<ul>
<li><a rel="nofollow" href="https://github.com/ssovit/TikTok-API-PHP">TikTok-API-PHP</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}
+1 -1
View File
@@ -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}
+23 -21
View File
@@ -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>
+23
View File
@@ -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>
+2 -3
View File
@@ -5,9 +5,8 @@
{/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'}
+6 -2
View File
@@ -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}
+1 -1
View File
@@ -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
View File
@@ -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}
+4 -14
View File
@@ -4,7 +4,7 @@
{do $item = $feed->items[0]}
<div class="columns is-centered is-vcentered">
<div class="column">
<video controls poster="{path('/stream?url=' . urlencode($item->video->originCover))}">
<video width="{$item->video->width}" height="{$item->video->height}" controls poster="{path('/stream?url=' . urlencode($item->video->originCover))}">
<source src="{path('/stream?url=' . urlencode($item->video->playAddr))}" type="video/mp4" />
</video>
</div>
@@ -12,20 +12,10 @@
<div class="box">
<p class="title">Video by <a href="{path('/@'.$feed->info->detail->uniqueId)}">{$feed->info->detail->uniqueId}</a></p>
<p class="subtitle">{$item->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>
{include '../components/themes/common/stats.latte', playCount: $item->stats->playCount, diggCount: $item->stats->diggCount, commentCount: $item->stats->commentCount, shareCount: $item->stats->shareCount}
<hr />
<div class="dropdown is-hoverable">
<div class="dropdown-trigger">
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">Download</button>
</div>
<div class="dropdown-menu" role="menu">
<div class="dropdown-content">
<a href="{path('/download?url=' . urlencode($item->video->playAddr) . '&id=' . $item->id . '&user=' . $item->author->uniqueId) . '&watermark='}" class="dropdown-item">Watermark</a>
<a href="{path('/download?id=' . $item->id . '&user=' . $feed->info->detail->uniqueId)}" class="dropdown-item">No watermark</a>
</div>
</div>
</div>
{include '../components/themes/common/share.latte', uniqueId: $feed->info->detail->uniqueId, id: $item->id}
{include '../components/themes/common/download.latte', playAddr: $item->video->playAddr, id: $item->id, uniqueId: $feed->info->detail->uniqueId}
<p>{$item->music->title}</p>
<audio src="{path('/stream?url=' . urlencode($item->music->playUrl))}" controls preload="none"></audio>
</div>