]> git.ipfire.org Git - ipfire.org.git/commitdiff
Replace .torrent file download URLs
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 12 Oct 2017 13:54:36 +0000 (14:54 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 12 Oct 2017 13:54:36 +0000 (14:54 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
templates/modules/release-item.html
webapp/backend/releases.py

index 9cbaf720f76058220eb3cb4dcf97f568494fcef0..fd3741bb3979adf4b7422a13395463dbfa5e144f 100644 (file)
                                                        <span class="label label-default">{{ format_size(file.size) }}</span>
 
                                                        <div class="btn-group">
-                                                               <a class="btn btn-default btn-xs" href="{{ file.magnet_link }}" title="{{ _("Magnet Link") }}">
-                                                                       <span class="glyphicon glyphicon-magnet"></span>
-                                                               </a>
-                                                               <a class="btn btn-default btn-xs" href="http://tracker.ipfire.org/{{ file.torrent_hash }}/download" title="{{ _("Torrent Download") }}">
-                                                                       <span class="glyphicon glyphicon-download-alt"></span>
-                                                               </a>
+                                                               {% if file.magnet_link %}
+                                                                       <a class="btn btn-default btn-xs" href="{{ file.magnet_link }}" title="{{ _("Magnet Link") }}">
+                                                                               <span class="glyphicon glyphicon-magnet"></span>
+                                                                       </a>
+                                                               {% end %}
+
+                                                               {% if file.torrent_url %}
+                                                                       <a class="btn btn-default btn-xs" href="{{ file.torrent_url }}" title="{{ _("Torrent Download") }}">
+                                                                               <span class="glyphicon glyphicon-download-alt"></span>
+                                                                       </a>
+                                                               {% end %}
                                                        </div>
                                                </div>
                                        {% end %}
index 42c8f75b848052db7e05cc5d3780643eccb095a3..70c846ee503882c78b52be4d755fb331907861e3 100644 (file)
@@ -187,6 +187,11 @@ class File(Object):
        def torrent_hash(self):
                return self.data.get("torrent_hash", None)
 
+        @property
+        def torrent_url(self):
+                if self.torrent_hash:
+                        return "%s.torrent" % self.url
+
        @property
        def magnet_link(self):
                # Don't return anything if we have no torrent hash.