commit bdf192de48baf2a67f47833358ec970c0bc3b5fd Author: Philipp Winter phw@nymity.ch Date: Tue Mar 10 15:34:26 2020 -0700
Add an info page to BridgeDB.
This commit adds an info page to BridgeDB. Tor's Relay Search for bridges will link to this info page because it explains BridgeDB's bridge distribution mechanisms.
This fixes https://bugs.torproject.org/33008. --- CHANGELOG | 5 + bridgedb/distributors/https/server.py | 13 ++- bridgedb/distributors/https/templates/base.html | 4 +- bridgedb/distributors/https/templates/info.html | 40 ++++++++ bridgedb/i18n/templates/bridgedb.pot | 128 ++++++++++++++++++++---- bridgedb/strings.py | 41 ++++++++ 6 files changed, 207 insertions(+), 24 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG index 163fc6c..b0e8275 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ + * FIXES https://bugs.torproject.org/33008 + Add an info page, available at bridges.torproject.org/info. Relay + Search links to this info page to explain to bridge operators what their + bridge distribution mechanism means. + Changes in version 0.9.4 - 2020-02-19
* FIXES https://bugs.torproject.org/30946 diff --git a/bridgedb/distributors/https/server.py b/bridgedb/distributors/https/server.py index 503744e..be99262 100644 --- a/bridgedb/distributors/https/server.py +++ b/bridgedb/distributors/https/server.py @@ -389,13 +389,14 @@ class TranslatedTemplateResource(CustomErrorHandlingResource, CSPResource): """ isLeaf = True
- def __init__(self, template=None): + def __init__(self, template=None, showFaq=True): """Create a new :api:`Resource <twisted.web.resource.Resource>` for a Mako-templated webpage. """ gettext.install("bridgedb") CSPResource.__init__(self) self.template = template + self.showFaq = showFaq
def render_GET(self, request): self.setCSPHeader(request) @@ -409,7 +410,8 @@ class TranslatedTemplateResource(CustomErrorHandlingResource, CSPResource): getSortedLangList(), rtl=rtl, lang=langs[0], - langOverride=translations.isLangOverridden(request)) + langOverride=translations.isLangOverridden(request), + showFaq=self.showFaq) except Exception as err: # pragma: no cover rendered = replaceErrorPage(request, err) request.setHeader("Content-Type", "text/html; charset=utf-8") @@ -435,6 +437,11 @@ class OptionsResource(TranslatedTemplateResource): TranslatedTemplateResource.__init__(self, 'options.html')
+class InfoResource(TranslatedTemplateResource): + def __init__(self): + TranslatedTemplateResource.__init__(self, 'info.html', showFaq=False) + + class HowtoResource(TranslatedTemplateResource): """A resource which explains how to use bridges."""
@@ -1133,6 +1140,7 @@ def addWebServer(config, distributor): index = IndexResource() options = OptionsResource() howto = HowtoResource() + info = InfoResource() robots = static.File(os.path.join(TEMPLATE_DIR, 'robots.txt')) assets = static.File(os.path.join(TEMPLATE_DIR, 'assets/')) keys = static.Data(strings.BRIDGEDB_OPENPGP_KEY.encode('utf-8'), 'text/plain') @@ -1148,6 +1156,7 @@ def addWebServer(config, distributor): root.putChild(b'assets', assets) root.putChild(b'options', options) root.putChild(b'howto', howto) + root.putChild(b'info', info) root.putChild(b'maintenance', maintenance) root.putChild(b'error', resource500) root.putChild(CSPResource.reportURI, csp) diff --git a/bridgedb/distributors/https/templates/base.html b/bridgedb/distributors/https/templates/base.html index fb54e81..b42d252 100644 --- a/bridgedb/distributors/https/templates/base.html +++ b/bridgedb/distributors/https/templates/base.html @@ -1,7 +1,7 @@ ## -*- coding: utf-8 -*-
<%namespace name="base" file="base.html" inheritable="True"/> -<%page args="strings, langs, rtl=False, lang='en', langOverride=False, **kwargs"/> +<%page args="strings, langs, rtl=False, lang='en', langOverride=False, showFaq=True, **kwargs"/>
<!DOCTYPE html> <html lang="${lang}"> @@ -59,6 +59,7 @@
${next.body(strings, langs, rtl=rtl, lang=lang, langOverride=langOverride, **kwargs)}
+ % if showFaq: <div class="faq"> <div class="row-fluid marketing">
@@ -84,6 +85,7 @@ ${next.body(strings, langs, rtl=rtl, lang=lang, langOverride=langOverride, **kwa </p> </div> </div> <!-- end faq --> + % endif
<div class="footer footer-small"> <hr> diff --git a/bridgedb/distributors/https/templates/info.html b/bridgedb/distributors/https/templates/info.html new file mode 100644 index 0000000..32f9e0a --- /dev/null +++ b/bridgedb/distributors/https/templates/info.html @@ -0,0 +1,40 @@ +## -*- coding: utf-8 -*- + +<%inherit file="base.html"/> +<%page args="strings, langs, rtl=False, lang='en', langOverride=False, **kwargs"/> + +<div class="container-fluid container-fluid-outer-96"> + <div class="container-fluid container-fluid-inner"> + <p> + <h3>${_(strings.BRIDGEDB_INFO[0])}</h3> + <p>${_(strings.BRIDGEDB_INFO[1]) % \ + ("""<a href="https://metrics.torproject.org/bridgedb-distributor.html">""", + """</a>""")}</p> + + <div class="row-fluid marketing"> + <h4><a name="https">HTTPS</a></h4> + <p>${_(strings.BRIDGEDB_INFO[2]) % \ + ("""<a href="https://bridges.torproject.org/options">""", + """</a>""")}</p> + + <h4><a name="moat">Moat</a></h4> + <p>${_(strings.BRIDGEDB_INFO[3]) % \ + ("""<a href="about:preferences#tor">""", + """</a>""")}</p> + + <h4><a name="email">Email</a></h4> + <p>${_(strings.BRIDGEDB_INFO[4]) % \ + ("""<a href="mailto:bridges@torproject.org">""", + """</a>""")}</p> + + <h4><a name="reserved">${_(strings.BRIDGEDB_INFO[5])}</a></h4> + <p>${_(strings.BRIDGEDB_INFO[6]) % \ + ("""<a href="https://collector.torproject.org/archive/bridge-pool-assignments/">""", + """</a>""")}</p> + + <h4><a name="none">${_(strings.BRIDGEDB_INFO[7])}</a></h4> + <p>${_(strings.BRIDGEDB_INFO[8])}</p> + </div> + </p> + </div> +</div> diff --git a/bridgedb/i18n/templates/bridgedb.pot b/bridgedb/i18n/templates/bridgedb.pot index be57a8b..8d442df 100644 --- a/bridgedb/i18n/templates/bridgedb.pot +++ b/bridgedb/i18n/templates/bridgedb.pot @@ -5,11 +5,11 @@ # msgid "" msgstr "" -"Project-Id-Version: bridgedb 0.9.2+5.gfd960bd.dirty\n" +"Project-Id-Version: bridgedb 0.9.4+6.g963ce80.dirty\n" "Report-Msgid-Bugs-To: " "'https://trac.torproject.org/projects/tor/newticket?component=BridgeDB&ke..." "=bridgedb-reported,msgid&cc=isis,sysrqb&owner=isis'\n" -"POT-Creation-Date: 2020-02-18 13:39-0800\n" +"POT-Creation-Date: 2020-03-18 09:23-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME EMAIL@ADDRESS\n" "Language-Team: LANGUAGE LL@li.org\n" @@ -37,6 +37,7 @@ msgstr "" #. variable. #. We use our metrics singleton to keep track of BridgeDB metrics such as #. "number of failed HTTPS bridge requests." +#. Convert all key/value pairs from bytes to str. #. TRANSLATORS: Please DO NOT translate the following words and/or phrases in #. any string (regardless of capitalization and/or punctuation): #. "BridgeDB" @@ -45,7 +46,7 @@ msgstr "" #. "obfs4" #. "Tor" #. "Tor Browser" -#: bridgedb/distributors/https/server.py:135 +#: bridgedb/distributors/https/server.py:154 msgid "Sorry! Something went wrong with your request." msgstr ""
@@ -53,15 +54,15 @@ msgstr "" msgid "Language" msgstr ""
-#: bridgedb/distributors/https/templates/base.html:92 +#: bridgedb/distributors/https/templates/base.html:94 msgid "Report a Bug" msgstr ""
-#: bridgedb/distributors/https/templates/base.html:95 +#: bridgedb/distributors/https/templates/base.html:97 msgid "Source Code" msgstr ""
-#: bridgedb/distributors/https/templates/base.html:98 +#: bridgedb/distributors/https/templates/base.html:100 msgid "Changelog" msgstr ""
@@ -214,7 +215,7 @@ msgstr "" msgid "Hello, friend!" msgstr ""
-#: bridgedb/distributors/https/templates/base.html:100 bridgedb/strings.py:58 +#: bridgedb/distributors/https/templates/base.html:102 bridgedb/strings.py:58 msgid "Public Keys" msgstr ""
@@ -314,32 +315,117 @@ msgid "Get Bridges!" msgstr ""
#: bridgedb/strings.py:130 +msgid "Bridge distribution mechanisms" +msgstr "" + +#. TRANSLATORS: Please DO NOT translate "BridgeDB", "HTTPS", and "Moat". +#: bridgedb/strings.py:132 +#, python-format +msgid "" +"BridgeDB implements four mechanisms to distribute bridges: "HTTPS", " +""Moat",\n" +""Email", and "Reserved". Bridges that are not distributed over BridgeDB " +"use\n" +"the pseudo-mechanism "None". The following list briefly explains how these" +"\n" +"mechanisms work and our %sBridgeDB metrics%s visualize how popular each of " +"the\n" +"mechanisms is." +msgstr "" + +#: bridgedb/strings.py:138 +#, python-format +msgid "" +"The "HTTPS" distribution mechanism hands out bridges over this website. To" +" get\n" +"bridges, go to %sbridges.torproject.org%s, select your preferred options, and" +"\n" +"solve the subsequent CAPTCHA." +msgstr "" + +#: bridgedb/strings.py:142 +#, python-format +msgid "" +"The "Moat" distribution mechanism is part of Tor Browser, allowing users to" +"\n" +"request bridges from inside their Tor Browser settings. To get bridges, go " +"to\n" +"your Tor Browser's %sTor settings%s, click on "request a new bridge", solve" +" the\n" +"subsequent CAPTCHA, and Tor Browser will automatically add your new\n" +"bridges." +msgstr "" + +#: bridgedb/strings.py:148 +#, python-format +msgid "" +"Users can request bridges from the "Email" distribution mechanism by " +"sending an\n" +"email to %sbridges@torproject.org%s and writing "get transport obfs4" in " +"the\n" +"email body." +msgstr "" + +#: bridgedb/strings.py:152 +msgid "Reserved" +msgstr "" + +#: bridgedb/strings.py:153 +#, python-format +msgid "" +"BridgeDB maintains a small number of bridges that are not distributed\n" +"automatically. Instead, we reserve these bridges for manual distribution and" +"\n" +"hand them out to NGOs and other organizations and individuals that need\n" +"bridges. Bridges that are distributed over the "Reserved" mechanism may " +"not\n" +"see users for a long time. Note that the "Reserved" distribution mechanism" +" is\n" +"called "Unallocated" in %sbridge pool assignment%s files." +msgstr "" + +#: bridgedb/strings.py:160 +msgid "None" +msgstr "" + +#: bridgedb/strings.py:161 +msgid "" +"Bridges whose distribution mechanism is "None" are not distributed by " +"BridgeDB.\n" +"It is the bridge operator's responsibility to distribute their bridges to\n" +"users. Note that on Relay Search, a freshly set up bridge's distribution\n" +"mechanism says "None" for up to approximately one day. Be a bit patient, " +"and\n" +"it will then change to the bridge's actual distribution mechanism.\n" +msgstr "" + +#: bridgedb/strings.py:171 msgid "Please select options for bridge type:" msgstr ""
-#: bridgedb/strings.py:131 +#: bridgedb/strings.py:172 msgid "Do you need IPv6 addresses?" msgstr ""
-#: bridgedb/strings.py:132 +#: bridgedb/strings.py:173 #, python-format msgid "Do you need a %s?" msgstr ""
-#: bridgedb/strings.py:136 +#: bridgedb/strings.py:177 msgid "Your browser is not displaying images properly." msgstr ""
-#: bridgedb/strings.py:137 +#: bridgedb/strings.py:178 msgid "Enter the characters from the image above..." msgstr ""
-#: bridgedb/strings.py:141 +#: bridgedb/strings.py:182 msgid "How to start using your bridges" msgstr ""
#. TRANSLATORS: Please DO NOT translate "Tor Browser". -#: bridgedb/strings.py:143 +#: bridgedb/strings.py:184 #, python-format msgid "" "To enter bridges into Tor Browser, first go to the %s Tor Browser download\n" @@ -348,7 +434,7 @@ msgid "" msgstr ""
#. TRANSLATORS: Please DO NOT translate "Tor". -#: bridgedb/strings.py:148 +#: bridgedb/strings.py:189 msgid "" "When the 'Tor Network Settings' dialogue pops up, click 'Configure' and " "follow\n" @@ -356,7 +442,7 @@ msgid "" msgstr ""
#. TRANSLATORS: Please DO NOT translate "Tor". -#: bridgedb/strings.py:152 +#: bridgedb/strings.py:193 msgid "" "Does your Internet Service Provider (ISP) block or otherwise censor " "connections\n" @@ -364,7 +450,7 @@ msgid "" msgstr ""
#. TRANSLATORS: Please DO NOT translate "Tor". -#: bridgedb/strings.py:156 +#: bridgedb/strings.py:197 msgid "" "Select 'Yes' and then click 'Next'. To configure your new bridges, copy and\n" "paste the bridge lines into the text input box. Finally, click 'Connect', and" @@ -373,29 +459,29 @@ msgid "" "button in the 'Tor Network Settings' wizard for further assistance." msgstr ""
-#: bridgedb/strings.py:164 +#: bridgedb/strings.py:205 msgid "Displays this message." msgstr ""
#. TRANSLATORS: Please try to make it clear that "vanilla" here refers to the #. same non-Pluggable Transport bridges described above as being #. "plain-ol'-vanilla" bridges. -#: bridgedb/strings.py:168 +#: bridgedb/strings.py:209 msgid "Request vanilla bridges." msgstr ""
-#: bridgedb/strings.py:169 +#: bridgedb/strings.py:210 msgid "Request IPv6 bridges." msgstr ""
#. TRANSLATORS: Please DO NOT translate the word the word "TYPE". -#: bridgedb/strings.py:171 +#: bridgedb/strings.py:212 msgid "Request a Pluggable Transport by TYPE." msgstr ""
#. TRANSLATORS: Please DO NOT translate "BridgeDB". #. TRANSLATORS: Please DO NOT translate "GnuPG". -#: bridgedb/strings.py:174 +#: bridgedb/strings.py:215 msgid "Get a copy of BridgeDB's public GnuPG key." msgstr ""
diff --git a/bridgedb/strings.py b/bridgedb/strings.py index e97c68a..ca2feaa 100644 --- a/bridgedb/strings.py +++ b/bridgedb/strings.py @@ -126,6 +126,47 @@ BRIDGES = { 1: _("Get Bridges!"), }
+BRIDGEDB_INFO = { + 0: _("Bridge distribution mechanisms"), + # TRANSLATORS: Please DO NOT translate "BridgeDB", "HTTPS", and "Moat". + 1: _("""\ +BridgeDB implements four mechanisms to distribute bridges: "HTTPS", "Moat", +"Email", and "Reserved". Bridges that are not distributed over BridgeDB use +the pseudo-mechanism "None". The following list briefly explains how these +mechanisms work and our %sBridgeDB metrics%s visualize how popular each of the +mechanisms is."""), + 2: _("""\ +The "HTTPS" distribution mechanism hands out bridges over this website. To get +bridges, go to %sbridges.torproject.org%s, select your preferred options, and +solve the subsequent CAPTCHA."""), + 3: _("""\ +The "Moat" distribution mechanism is part of Tor Browser, allowing users to +request bridges from inside their Tor Browser settings. To get bridges, go to +your Tor Browser's %sTor settings%s, click on "request a new bridge", solve the +subsequent CAPTCHA, and Tor Browser will automatically add your new +bridges."""), + 4: _("""\ +Users can request bridges from the "Email" distribution mechanism by sending an +email to %sbridges@torproject.org%s and writing "get transport obfs4" in the +email body."""), + 5: _("Reserved"), + 6: _("""\ +BridgeDB maintains a small number of bridges that are not distributed +automatically. Instead, we reserve these bridges for manual distribution and +hand them out to NGOs and other organizations and individuals that need +bridges. Bridges that are distributed over the "Reserved" mechanism may not +see users for a long time. Note that the "Reserved" distribution mechanism is +called "Unallocated" in %sbridge pool assignment%s files."""), + 7: _("None"), + 8: _("""\ +Bridges whose distribution mechanism is "None" are not distributed by BridgeDB. +It is the bridge operator's responsibility to distribute their bridges to +users. Note that on Relay Search, a freshly set up bridge's distribution +mechanism says "None" for up to approximately one day. Be a bit patient, and +it will then change to the bridge's actual distribution mechanism. +"""), +} + OPTIONS = { 0: _("Please select options for bridge type:"), 1: _("Do you need IPv6 addresses?"),