Mercurial > libervia-web
diff src/browser/libervia_main.py @ 549:cd56f2b0e85b
browser_side: disable OTR if the browser is too old to offer crypto.getRandomValues (CSPRNG)
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 17 Sep 2014 17:15:03 +0200 |
parents | 530f3fc3e3d7 |
children | 7a823c6568e2 |
line wrap: on
line diff
--- a/src/browser/libervia_main.py Thu Sep 11 12:59:13 2014 +0200 +++ b/src/browser/libervia_main.py Wed Sep 17 17:15:03 2014 +0200 @@ -49,8 +49,11 @@ from sat_browser.constants import Const as C -# FIXME: import plugin dynamically -from sat_browser import plugin_sec_otr +try: + # FIXME: import plugin dynamically + from sat_browser import plugin_sec_otr +except ImportError: + pass MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories @@ -203,8 +206,18 @@ def importPlugins(self): self.plugins = {} + inhibited_menus = [] # FIXME: plugins import should be dynamic and generic like in sat - self.plugins['otr'] = plugin_sec_otr.OTR(self) + try: + self.plugins['otr'] = plugin_sec_otr.OTR(self) + except TypeError: # plugin_sec_otr has not been imported + inhibited_menus.append('OTR') + + class DummyPlugin(object): + def inhibitMenus(self): + return inhibited_menus + + self.plugins['dummy_plugin'] = DummyPlugin() def addSelectedListener(self, callback): self._selected_listeners.add(callback)