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

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

@ -33,7 +33,7 @@
{#{{ 'Torrent' | trans }} #{{ torrent.id }}#} {#{{ 'Torrent' | trans }} #{{ torrent.id }}#}
</h1> </h1>
<div class="text-center"> <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 %} {% 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"> <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"/> <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 @@
<small class="cursor-default" title="{{ 'Total' | trans }}"> <small class="cursor-default" title="{{ 'Total' | trans }}">
{{ torrent.download.magnet.total }} {{ torrent.download.magnet.total }}
</small> </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 %} {% 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"> <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"/> <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 @@
</small> </small>
</span> </span>
<div class="float-right"> <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 %} {% 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"> <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"/> <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 @@
<small class="cursor-default" title="{{ 'Total' | trans }}"> <small class="cursor-default" title="{{ 'Total' | trans }}">
{{ torrent.download.magnet.total }} {{ torrent.download.magnet.total }}
</small> </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 %} {% 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"> <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"/> <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