/video follows TikTok schema
This commit is contained in:
parent
c682432920
commit
6eee156541
|
@ -15,7 +15,9 @@ class RedirectController {
|
|||
} else if (isset($_GET['music'])) {
|
||||
$endpoint = '/music/' . $_GET['music'];
|
||||
} else if (isset($_GET['video'])) {
|
||||
$endpoint = '/video/' . $_GET['video'];
|
||||
// The @username part is not used, but
|
||||
// it is the schema that TikTok follows
|
||||
$endpoint = '/@placeholder/video/' . $_GET['video'];
|
||||
}
|
||||
|
||||
$url = Misc::url($endpoint);
|
||||
|
|
|
@ -24,6 +24,17 @@ class UserController {
|
|||
}
|
||||
}
|
||||
|
||||
static public function video(string $username, 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);
|
||||
}
|
||||
}
|
||||
|
||||
static public function rss(string $username) {
|
||||
$api = Misc::api();
|
||||
$feed = $api->getUserFeed($username);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "pablouser1/proxitok",
|
||||
"description": "An alternative frontend for TikTok",
|
||||
"version": "2.1.0.0",
|
||||
"version": "2.1.0.1",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"type": "project",
|
||||
"homepage": "https://github.com/pablouser1/ProxiTok",
|
||||
|
|
2
composer.lock
generated
2
composer.lock
generated
|
@ -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": "f6b066c447574f88ad9255a88892659e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bramus/router",
|
||||
|
|
|
@ -30,9 +30,13 @@ $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) {
|
||||
|
|
Loading…
Reference in a new issue