Patching system, video by id

This commit is contained in:
Pablo Ferreiro 2022-01-08 16:03:57 +01:00
parent 38fa75402b
commit c6b0f1e812
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
19 changed files with 305 additions and 60 deletions

View file

@ -10,6 +10,11 @@ Route::add('/', function () {
$latte->render(Misc::getView('home'));
});
Route::add('/about', function () {
$latte = Misc::latte();
$latte->render(Misc::getView('about'));
});
Route::add("/trending", function () {
$cursor = 0;
if (isset($_GET['cursor']) && is_numeric($_GET['cursor'])) {
@ -44,6 +49,17 @@ Route::add("/@([^/]+)", function (string $username) {
}
});
Route::add('/video/(\d+)', function (string $video_id) {
$latte = Misc::latte();
$api = Misc::api();
$item = $api->getVideoByID($video_id);
if ($item) {
$latte->render(Misc::getView('video'), ['item' => $item]);
} else {
return 'ERROR!';
}
});
Route::add('/tag/(\w+)', function (string $name) {
$cursor = 0;
if (isset($_GET['cursor']) && is_numeric($_GET['cursor'])) {