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 @@ -72,6 +72,23 @@ class TorrentController extends AbstractController
$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
$page = $request->get('page') ? (int) $request->get('page') : 1;
@ -145,14 +162,14 @@ class TorrentController extends AbstractController @@ -145,14 +162,14 @@ class TorrentController extends AbstractController
'source' => $file->getSource(),
'comment' => $file->getComment(),
'tree' => $file->getFileTree(),
'trackers' => $file->getAnnounceList(),
//'trackers' => $file->getAnnounceList(),
'hash' =>
[
'v1' => $file->getInfoHashV1(false),
'v2' => $file->getInfoHashV2(false)
],
],
'trackers' => explode('|', $this->getParameter('app.trackers')),
'trackers' => $allTrackers,
'activities' => $activityService->findLastActivitiesByTorrentId(
$torrent->getId(),
$user->getEvents(),

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

@ -283,18 +283,16 @@ @@ -283,18 +283,16 @@
<div class="padding-y-8-px border-bottom-default text-right">
{{ 'Trackers' | trans }}
</div>
<div class="padding-t-16-px">
{% for tracker in trackers %}
<div class="padding-y-16-px">
{% for tracker, status in trackers %}
<div class="padding-y-4-px">
{% if status %}
{{ tracker }}
</div>
{% endfor %}
{% for announces in trackers %}
{% for tracker in announces %}
<div class="padding-y-4-px">
{% if tracker not in trackers %}
{% else %}
<span class="text-color-night">
{{ 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">
<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>
@ -302,7 +300,6 @@ @@ -302,7 +300,6 @@
{% endif %}
</div>
{% endfor %}
{% endfor %}
</div>
<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 }}">

Loading…
Cancel
Save