From b8b6180609d182c12bfc7e2be8fd0adc420bb49a Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 4 Aug 2018 15:46:49 +0200 Subject: [PATCH] feat: Allow Youtube-like URLs Fixes #184 --- controllers/FrontController.php | 5 +++++ index.php | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 36f4fa9..a778650 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -343,6 +343,11 @@ class FrontController public function video(Request $request, Response $response) { $params = $request->getQueryParams(); + + if (!isset($params['url']) && isset($params['v'])) { + $params['url'] = $params['v']; + } + if (isset($params['url'])) { $password = $request->getParam('password'); if (isset($password)) { diff --git a/index.php b/index.php index e59b357..a3d4a27 100644 --- a/index.php +++ b/index.php @@ -47,6 +47,10 @@ $app->any( '/video', [$controller, 'video'] )->setName('video'); +$app->any( + '/watch', + [$controller, 'video'] +); $app->get( '/redirect', [$controller, 'redirect']