[tor-commits] [gettor/master] Added direct link to downloads section in http(s) mirrors

ilv at torproject.org ilv at torproject.org
Tue Nov 3 19:31:30 UTC 2015


commit 87758bd0ec34a52a995d0e5973ca81ebf61203d6
Author: ilv <ilv at users.noreply.github.com>
Date:   Thu Aug 27 15:13:44 2015 -0300

    Added direct link to downloads section in http(s) mirrors
---
 get_mirrors.py |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/get_mirrors.py b/get_mirrors.py
index 9c4b0c4..afa4cc9 100644
--- a/get_mirrors.py
+++ b/get_mirrors.py
@@ -158,6 +158,15 @@ def is_json(my_json):
     return True
 
 
+def add_tpo_link(url):
+    """Add the download link for Tor Browser."""
+    uri = 'projects/torbrowser.html.en#downloads'
+    if url.endswith('/'):
+        return "%s%s" % (url, uri)
+    else:
+        return "%s/%s" % (url, uri)
+
+
 def add_entry(mirrors, columns, elements):
     """Add entry to mirrors list."""
     entry = {}
@@ -172,9 +181,15 @@ def add_entry(mirrors, columns, elements):
 
 def add_mirror(file, entry, proto):
     """Add mirror to mirrors list."""
+    # if proto requested is http(s), we add link to download section
+    if PROTOS[proto] == 'http' or PROTOS[proto] == 'https':
+        uri = add_tpo_link(entry[proto])
+    else:
+        uri = entry[proto]
+    
     file.write(
         "%s - by %s (%s)\n" % (
-            entry[proto],
+            uri,
             entry['orgName'],
             entry['subRegion'],
         )





More information about the tor-commits mailing list