Browse Source

update announce trackers list

main
ghost 1 year ago
parent
commit
f8e7bd8c44
  1. 21
      src/Controller/TorrentController.php
  2. 33
      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(),

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

@ -107,7 +107,7 @@ @@ -107,7 +107,7 @@
<tr>
<td colspan="2">
<div class="padding-y-8-px border-bottom-default text-right">
{{ 'Common' | trans }}
{{ 'Common' | trans }}
</div>
</td>
</tr>
@ -283,25 +283,22 @@ @@ -283,25 +283,22 @@
<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">
{{ tracker }}
</div>
{% endfor %}
{% for announces in trackers %}
{% for tracker in announces %}
<div class="padding-y-4-px">
{% if tracker not in trackers %}
{% if status %}
{{ tracker }}
{% else %}
<span class="text-color-night">
{{ tracker }}
<span class="float-right" title="{{ 'Blocked'|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>
</span>
{% endif %}
</div>
{% endfor %}
</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>
</span>
{% endif %}
</div>
{% endfor %}
</div>
<div class="text-right">

Loading…
Cancel
Save