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

Re: [tor-bugs] #11345 [BridgeDB]: BridgeDB should have QR codes for bridge lines



#11345: BridgeDB should have QR codes for bridge lines
-----------------------------+-----------------------------------------
     Reporter:  isis         |      Owner:  isis
         Type:  enhancement  |     Status:  closed
     Priority:  minor        |  Milestone:
    Component:  BridgeDB     |    Version:
   Resolution:  fixed        |   Keywords:  bridgedb-ui, bridgedb-https
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+-----------------------------------------
Changes (by isis):

 * status:  needs_review => closed
 * resolution:   => fixed


Comment:

 Okay, this is merged to `develop` for `0.2.4`. The code lives in my
 `fix/11345-qrcodes_r2`
 [https://gitweb.torproject.org/user/isis/bridgedb.git/log/?h=fix/11345-qrcodes_r2
 branch]. Currently, there is a boolean flag to pass to the
 `bridgedb.qrcodes.generateQR()` function which will decide whether or not
 to make "Orbot-style" QRCodes which have the `"bridge://"` schema prefix:

 {{{
 diff --git a/lib/bridgedb/qrcodes.py b/lib/bridgedb/qrcodes.py
 index a76cf8f..8016262 100644
 --- a/lib/bridgedb/qrcodes.py
 +++ b/lib/bridgedb/qrcodes.py
 @@ -25,13 +25,15 @@ except ImportError:
                     "work. On Debian-based systems, this should be in the
 "
                     "python-qrcode package."))

 -def generateQR(bridgelines, imageFormat=u'JPEG'):
 +
 +def generateQR(bridgelines, imageFormat=u'JPEG', bridgeSchema=False):
      """Generate a QRCode for the client's bridge lines.

      :param str bridgelines: The Bridge Lines which we are distributing to
 the
          client.
 +    :param bool bridgeSchema: If ``True``, prepend ``'bridge://'`` to the
 +        beginning of each bridge line before QR encoding.
      :rtype: str or ``None``
 -
      :returns: The generated QRCode, as a string.
      """
      logging.debug("Attempting to encode bridge lines into a QRCode...")
 @@ -43,16 +45,26 @@ def generateQR(bridgelines, imageFormat=u'JPEG'):
          logging.info("Not creating QRCode for bridgelines; no qrcode
 module.")

      try:
 +        if bridgeSchema:
 +            # See https://bugs.torproject.org/12639 for why bridge:// is
 used.
 +            # (Hopefully, Orbot will pick up the ACTION_VIEW intent.)
 +            schema = 'bridge://'
 +            prefixed = []
 +            for line in bridgelines.strip().split('\n'):
 +                prefixed.append(schema + line)
 +            bridgelines = '\n'.join(prefixed)
 +
 +        logging.debug("QR encoding bridge lines: %s" % bridgelines)

          qr = qrcode.QRCode()
 }}}

 (See
 [https://gitweb.torproject.org/user/isis/bridgedb.git/commit/?h=fix/11345-qrcodes_r2&id=66ef631c51176777da212ab02f7a0d47dff00579
 commit] 66ef631c51176777da212ab02f7a0d47dff00579.) However, the current
 default is to ''not'' add the prefix because it doesn't seem to help Orbot
 pick up the `intent.ACTION_VIEW`, and it definitely makes copy+pasting the
 text from the QRCode much harder to do manually. Also, having the schema
 prefix would mean that TorLauncher in Tails would have to do extra
 processing to get rid of it (if, in the future, we were to support holding
 up QRCodes to the webcam for TorLauncher to extract bridge lines).

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11345#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs