Browse Source

update announce trackers list

main
ghost 1 year ago
parent
commit
f8e7bd8c44
  1. 21
      src/Controller/TorrentController.php
  2. 17
      templates/default/torrent/info.html.twig

21
src/Controller/TorrentController.php

@ -72,6 +72,23 @@ class TorrentController extends AbstractController
$user->getEvents() $user->getEvents()
); );
// Create trackers list
$appTrackers = explode('|', $this->getParameter('app.trackers'));
$allTrackers = [];
foreach ($appTrackers as $tracker)
{
$allTrackers[$tracker] = true;
}
foreach ($file->getAnnounceList() as $announce)
{
foreach ($announce as $tracker)
{
$allTrackers[$tracker] = $user->isYggdrasil() && !in_array($tracker, $appTrackers);
}
}
// Init page // Init page
$page = $request->get('page') ? (int) $request->get('page') : 1; $page = $request->get('page') ? (int) $request->get('page') : 1;
@ -145,14 +162,14 @@ class TorrentController extends AbstractController
'source' => $file->getSource(), 'source' => $file->getSource(),
'comment' => $file->getComment(), 'comment' => $file->getComment(),
'tree' => $file->getFileTree(), 'tree' => $file->getFileTree(),
'trackers' => $file->getAnnounceList(), //'trackers' => $file->getAnnounceList(),
'hash' => 'hash' =>
[ [
'v1' => $file->getInfoHashV1(false), 'v1' => $file->getInfoHashV1(false),
'v2' => $file->getInfoHashV2(false) 'v2' => $file->getInfoHashV2(false)
], ],
], ],
'trackers' => explode('|', $this->getParameter('app.trackers')), 'trackers' => $allTrackers,
'activities' => $activityService->findLastActivitiesByTorrentId( 'activities' => $activityService->findLastActivitiesByTorrentId(
$torrent->getId(), $torrent->getId(),
$user->getEvents(), $user->getEvents(),

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

@ -283,18 +283,16 @@
<div class="padding-y-8-px border-bottom-default text-right"> <div class="padding-y-8-px border-bottom-default text-right">
{{ 'Trackers' | trans }} {{ 'Trackers' | trans }}
</div> </div>
<div class="padding-t-16-px"> <div class="padding-y-16-px">
{% for tracker in trackers %} {% for tracker, status in trackers %}
<div class="padding-y-4-px"> <div class="padding-y-4-px">
{% if status %}
{{ tracker }} {{ tracker }}
</div> {% else %}
{% endfor %} <span class="text-color-night">
{% for announces in trackers %}
{% for tracker in announces %}
<div class="padding-y-4-px">
{% if tracker not in trackers %}
{{ tracker }} {{ tracker }}
<span class="float-right" title="{{ 'Blocked'|trans }}"> </span>
<span class="float-right" title="{{ 'Filter on download by settings' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2z"/> <path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2z"/>
</svg> </svg>
@ -302,7 +300,6 @@
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}
{% endfor %}
</div> </div>
<div class="text-right"> <div class="text-right">
<a class="margin-r-4-px{#opacity-0 parent-hover-opacity-09#}" href="{{ path('torrent_locales_edit', { torrentId : torrent.id }) }}" title="{{'Edit'|trans }}"> <a class="margin-r-4-px{#opacity-0 parent-hover-opacity-09#}" href="{{ path('torrent_locales_edit', { torrentId : torrent.id }) }}" title="{{'Edit'|trans }}">

Loading…
Cancel
Save