MagnetRedirectController added (for working magnet-links in the Telegram bot).
This commit is contained in:
parent
47a671c493
commit
03a10aa231
|
@ -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
|
||||
|
|
14
src/Controller/MagnetRedirectController.php
Normal file
14
src/Controller/MagnetRedirectController.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Magnet\MagnetGenerator;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
class MagnetRedirectController
|
||||
{
|
||||
public function redirect(string $infoHash, MagnetGenerator $magnetGenerator): RedirectResponse
|
||||
{
|
||||
return new RedirectResponse($magnetGenerator->generate($infoHash), RedirectResponse::HTTP_TEMPORARY_REDIRECT);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue