From 03a10aa2314ccc85b5f50883ba2322d07d086841 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 29 Jan 2019 20:32:16 +0300 Subject: [PATCH] MagnetRedirectController added (for working magnet-links in the Telegram bot). --- config/routes.yaml | 9 +++++++++ src/Controller/MagnetRedirectController.php | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/Controller/MagnetRedirectController.php diff --git a/config/routes.yaml b/config/routes.yaml index 15131fa..6b1edf1 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -16,6 +16,15 @@ torrents_show: method: GET id: '\d+' +# Mainly for Telegram bot +magnet_redirect: + path: /magnet/{infoHash} + controller: App\Controller\MagnetRedirectController::redirect + requirements: + method: GET + # SHA-1 hash + infoHash: '[0-9a-fA-F]{40}' + user_register: path: /register/{inviteCode} controller: App\Controller\UserController::register diff --git a/src/Controller/MagnetRedirectController.php b/src/Controller/MagnetRedirectController.php new file mode 100644 index 0000000..d3d0117 --- /dev/null +++ b/src/Controller/MagnetRedirectController.php @@ -0,0 +1,14 @@ +generate($infoHash), RedirectResponse::HTTP_TEMPORARY_REDIRECT); + } +}