Browse Source

update download routes #25

main
ghost 1 year ago
parent
commit
31bed20b4b
  1. 12
      src/Controller/TorrentController.php
  2. 4
      templates/default/torrent/info.html.twig
  3. 4
      templates/default/torrent/list.html.twig

12
src/Controller/TorrentController.php

@ -683,7 +683,7 @@ class TorrentController extends AbstractController @@ -683,7 +683,7 @@ class TorrentController extends AbstractController
'name' => $file->getName(),
'size' => $file->getSize(),
'url' => $this->generateUrl(
'torrent_download_file',
'torrent_file',
[
'torrentId' => $torrent->getId()
],
@ -693,7 +693,7 @@ class TorrentController extends AbstractController @@ -693,7 +693,7 @@ class TorrentController extends AbstractController
'magnet' =>
[
'url' => $this->generateUrl(
'torrent_download_magnet',
'torrent_magnet',
[
'torrentId' => $torrent->getId()
],
@ -1747,8 +1747,8 @@ class TorrentController extends AbstractController @@ -1747,8 +1747,8 @@ class TorrentController extends AbstractController
// Torrent download file
#[Route(
'/torrent/{torrentId}/download/file',
name: 'torrent_download_file',
'/torrent/{torrentId}/file',
name: 'torrent_file',
requirements:
[
'torrentId' => '\d+'
@ -1873,8 +1873,8 @@ class TorrentController extends AbstractController @@ -1873,8 +1873,8 @@ class TorrentController extends AbstractController
// Torrent download magnet
#[Route(
'/torrent/{torrentId}/download/magnet',
name: 'torrent_download_magnet',
'/torrent/{torrentId}/magnet',
name: 'torrent_magnet',
requirements:
[
'torrentId' => '\d+'

4
templates/default/torrent/info.html.twig

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
{#{{ 'Torrent' | trans }} #{{ torrent.id }}#}
</h1>
<div class="text-center">
<a rel="nofollow" class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_download_magnet', {torrentId : torrent.id}) }}" title="{{ 'Open magnet link' | trans }}">
<a rel="nofollow" class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_magnet', {torrentId : torrent.id}) }}" title="{{ 'Open magnet link' | trans }}">
{% if torrent.download.magnet.exist %}
<svg class="vertical-align-middle" xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
<path d="M15 12h-4v3h4v-3ZM5 12H1v3h4v-3ZM0 8a8 8 0 1 1 16 0v8h-6V8a2 2 0 1 0-4 0v8H0V8Z"/>
@ -47,7 +47,7 @@ @@ -47,7 +47,7 @@
<small class="cursor-default" title="{{ 'Total' | trans }}">
{{ torrent.download.magnet.total }}
</small>
<a rel="nofollow" class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_download_file', {torrentId : torrent.id}) }}" title="{{ 'Download torrent file' | trans }}">
<a rel="nofollow" class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_file', {torrentId : torrent.id}) }}" title="{{ 'Download torrent file' | trans }}">
{% if torrent.download.file.exist %}
<svg class="vertical-align-middle" xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V4.5z"/>

4
templates/default/torrent/list.html.twig

@ -117,7 +117,7 @@ @@ -117,7 +117,7 @@
</small>
</span>
<div class="float-right">
<a rel="nofollow" class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_download_magnet', {torrentId : torrent.id}) }}" title="{{ 'Open magnet link' | trans }}">
<a rel="nofollow" class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_magnet', {torrentId : torrent.id}) }}" title="{{ 'Open magnet link' | trans }}">
{% if torrent.download.magnet.exist %}
<svg class="vertical-align-middle" xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
<path d="M15 12h-4v3h4v-3ZM5 12H1v3h4v-3ZM0 8a8 8 0 1 1 16 0v8h-6V8a2 2 0 1 0-4 0v8H0V8Z"/>
@ -131,7 +131,7 @@ @@ -131,7 +131,7 @@
<small class="cursor-default" title="{{ 'Total' | trans }}">
{{ torrent.download.magnet.total }}
</small>
<a rel="nofollow" class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_download_file', {torrentId : torrent.id}) }}" title="{{ 'Download torrent file' | trans }}">
<a rel="nofollow" class="margin-l-8-px margin-r-4-px" href="{{ path('torrent_file', {torrentId : torrent.id}) }}" title="{{ 'Download torrent file' | trans }}">
{% if torrent.download.file.exist %}
<svg class="vertical-align-middle" xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V4.5z"/>

Loading…
Cancel
Save