[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r15466: Updated patched from Sebastian Hahn. (check/trunk/cgi-bin)
Author: ioerror
Date: 2008-06-25 18:49:36 -0400 (Wed, 25 Jun 2008)
New Revision: 15466
Modified:
check/trunk/cgi-bin/TorCheck.py
Log:
Updated patched from Sebastian Hahn.
Modified: check/trunk/cgi-bin/TorCheck.py
===================================================================
--- check/trunk/cgi-bin/TorCheck.py 2008-06-25 21:41:59 UTC (rev 15465)
+++ check/trunk/cgi-bin/TorCheck.py 2008-06-25 22:49:36 UTC (rev 15466)
@@ -83,7 +83,7 @@
def getLocales():
locale_descriptions = { 'en_US' : 'English', 'de' : 'Deutsch', 'es' :
- 'español','fa_IR' : 'fa_IR', 'fr', : 'français', 'ja' : '(Nihogo)', 'it_IT' : 'Italiano',
+ 'español', 'fa_IR' : 'fa_IR', 'fr' : 'français', 'ja' : '(Nihogo)', 'it_IT' : 'Italiano',
'pt_BR' : 'Português', 'pl': 'polski', 'ru': 'Русский (Russkij)',
'zh_CN' :'(Simplified Chinese)' }
return locale_descriptions
@@ -136,8 +136,18 @@
# i18n with Unicode!
# Ensure you have properly installed TorCheck.{po,pot,mo} files
lang = gettext.translation('TorCheck', languages=[locale])
- lang.install()
+ lang.install()
+def printTorButton(req, UsingTor):
+ req.write('<html xmlns="http://www.w3.org/1999/xhtml"><body>')
+ if UsingTor == 0:
+ req.write('<a id="TorCheckResult" target="success" href="/"></a>')
+ elif UsingTor == 1:
+ req.write('<a id="TorCheckResult" target="failure" href="/"></a>\n')
+ else:
+ req.write('<a id="TorCheckResult" target="unknown" href="/"></a>\n')
+ req.write('</body></html>')
+
# Now that we know everything we need, lets print the website
def handler(req):
@@ -147,6 +157,13 @@
req.send_http_header()
req.content_type = 'text/html; charset=utf-8'
+ # We want to catch TorButton queries so they don't output overhead
+ # This is to make all the data fit into one cell
+ formSubmission=util.FieldStorage(req)
+ if formSubmission.getfirst("TorButton", None):
+ printTorButton(req, UsingTor)
+ return apache.OK
+
# First lets construct the simple webpage:
req.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" '\
'"http://www.w3.org/TR/REC-html40/loose.dtd">\n')
@@ -174,7 +191,6 @@
req.write('\n')
req.write('<img alt="' + _("Congratulations. You are using Tor.") + \
'" src="https://check.torproject.org/images/tor-on.png">\n<br>')
- req.write('<a id="TorCheckResult" target="success" href="/"></a>\n')
req.write('<h1 style="color: #0A0">\n')
req.write(_('Congratulations. You are using Tor.'))
req.write('<br>\n<br>\n')
@@ -187,7 +203,6 @@
req.write('\n')
req.write('<img alt="' + _("Sorry. You are not using Tor.") + '" '\
'src="https://check.torproject.org/images/tor-off.png">\n<br>')
- req.write('<a id="TorCheckResult" target="failure" href="/"></a>\n')
req.write('<h1 style="color: #A00">')
req.write(_('Sorry. You are not using Tor.'))
req.write('<br>\n<br>\n')