[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] r25163: {check} apply patch from https://trac.torproject.org/projects/tor/at (check/trunk/cgi-bin)



Author: phobos
Date: 2011-10-12 03:27:20 +0000 (Wed, 12 Oct 2011)
New Revision: 25163

Modified:
   check/trunk/cgi-bin/TorCheck.py
Log:
apply patch from https://trac.torproject.org/projects/tor/attachment/ticket/2285/2285-tbb-updates-on-check-tpo_patch2.patch



Modified: check/trunk/cgi-bin/TorCheck.py
===================================================================
--- check/trunk/cgi-bin/TorCheck.py	2011-10-12 02:22:04 UTC (rev 25162)
+++ check/trunk/cgi-bin/TorCheck.py	2011-10-12 03:27:20 UTC (rev 25163)
@@ -88,6 +88,23 @@
         # If we're here, we've had a positive exit answer
         return 0
 
+
+def isUpToDate(queryString):
+    """
+    determine if TBB is aware of newer versions
+    """
+    if 'uptodate=1' in queryString.lower():
+        return True
+    if 'uptodate=0' in queryString.lower():
+        return False
+    # This will be true until Torbutton 1.4.4 is released
+    if 'small=1' in queryString.lower():
+        return False
+    
+    # The default case; No update information to provide
+    return True
+
+
 def getLocales():
     locale_descriptions = {
     'ar' : 'عربية (Arabiya)',
@@ -193,6 +210,10 @@
     if UsingTor != 0:
         UsingTor = isUsingTor(environ['REMOTE_ADDR'], "443")
 
+    # figure out if the client passed uptodate=0 or uptodate=1
+    # defaults to 1 if uptodate was not present in the query string
+    UpToDate = isUpToDate(environ['QUERY_STRING'])
+
     response_headers = [('Content-type', 'text/html; charset=utf-8')]
     start_response('200 OK', response_headers)
 
@@ -228,16 +249,34 @@
     req.write('<center>\n')
 
     if UsingTor == 0:
-        req.write('\n')
-        if hideLogo:
-            req.write('<img alt="' + _("Congratulations. Your browser is configured to use Tor.") + \
-            '" src="/images/tor-on.png">\n<br>')
-        req.write('<h1 style="color: #0A0">\n')
-        req.write(_('Congratulations. Your browser is configured to use Tor.'))
-        req.write('<br>\n<br>\n')
-        req.write('</h1>\n')
-        req.write(_('Please refer to the <a href="https://www.torproject.org/";>Tor website</a> for further information about using Tor safely.  You are now free to browse the Internet anonymously.'))
-        req.write('<br>\n<br>\n')
+        if UpToDate:
+            req.write('\n')
+            if hideLogo:
+                req.write('<img alt="' + _("Congratulations. Your browser is configured to use Tor.") + \
+                '" src="/images/tor-on.png">\n<br>')
+            req.write('<h1 style="color: #0A0">\n')
+            req.write(_('Congratulations. Your browser is configured to use Tor.'))
+            req.write('<br>\n<br>\n')
+            req.write('</h1>\n')
+            req.write(_('Please refer to the <a href="https://www.torproject.org/";>Tor website</a> for further information about using Tor safely.  You are now free to browse the Internet anonymously.'))
+            req.write('<br>\n<br>\n')
+        else:
+            req.write('\n')
+            if hideLogo:
+                req.write('<img alt="' + _("Congratulations. Your browser is configured to use Tor.") + \
+                '" src="/images/tor-on.png">\n<br>')
+            req.write('<h1 style="color: #0A0">\n')
+            req.write(_('Congratulations. Your browser is configured to use Tor.'))
+            req.write('<br>\n<br>\n')
+            req.write('</h1>\n')
+            req.write('<h1 style="color: #FA0">\n')
+            req.write(_('There is an update available for the Tor Browser Bundle.'))
+            req.write('<br>\n<br>\n')
+            req.write(_('<a href="https://www.torproject.org/download/download-easy.html";>Click here to go to the download page</a>'))
+            req.write('<br>\n<br>\n')
+            req.write('</h1>\n')  
+            req.write(_('Please refer to the <a href="https://www.torproject.org/";>Tor website</a> for further information about using Tor safely.  You are now free to browse the Internet anonymously.'))
+            req.write('<br>\n<br>\n') 
     
     # This is the case where we have an NXDOMAIN and they aren't using Tor
     elif UsingTor == 1:

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits