Skip to content

Commit

Permalink
add torrent / magnet download links, remove locale references #25
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost committed Oct 19, 2023
1 parent d794e48 commit 4c519a5
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/Controller/TorrentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,23 @@ public function jsonRecent(
[
'name' => $file->getName(),
'size' => $file->getSize(),
'url' => $this->generateUrl(
'torrent_download_file',
[
'torrentId' => $torrent->getId()
],
false
)
],
'magnet' =>
[
'url' => $this->generateUrl(
'torrent_download_magnet',
[
'torrentId' => $torrent->getId()
],
false
)
],
'scrape' =>
[
Expand Down Expand Up @@ -1730,12 +1747,11 @@ public function toggleStar(

// Torrent download file
#[Route(
'/{_locale}/torrent/{torrentId}/download/file',
'/torrent/{torrentId}/download/file',
name: 'torrent_download_file',
requirements:
[
'_locale' => '%app.locales%',
'torrentId' => '\d+',
'torrentId' => '\d+'
],
methods:
[
Expand Down Expand Up @@ -1857,12 +1873,11 @@ public function downloadFile(

// Torrent download magnet
#[Route(
'/{_locale}/torrent/{torrentId}/download/magnet',
'/torrent/{torrentId}/download/magnet',
name: 'torrent_download_magnet',
requirements:
[
'_locale' => '%app.locales%',
'torrentId' => '\d+',
'torrentId' => '\d+'
],
methods:
[
Expand Down

0 comments on commit 4c519a5

Please sign in to comment.