From b047beb3e50a541564d2ab6ff17491608a630101 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Tue, 6 Sep 2016 09:25:46 -0400 Subject: [pkg] package bitmask_www --- src/leap/bitmask/core/_web.py | 9 ++++++--- src/leap/bitmask/core/service.py | 1 + src/leap/bitmask/core/web/README | 9 +++++++++ src/leap/bitmask/core/websocket.py | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 src/leap/bitmask/core/web/README (limited to 'src') diff --git a/src/leap/bitmask/core/_web.py b/src/leap/bitmask/core/_web.py index 2c9f279..1a32fed 100644 --- a/src/leap/bitmask/core/_web.py +++ b/src/leap/bitmask/core/_web.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # _web.py -# Copyright (C) 2016 LEAP +# Copyright (C) 2016 LEAP Encryption Access Project # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,14 +46,16 @@ class HTTPDispatcherService(service.Service): def startService(self): webdir = os.path.abspath( - pkg_resources.resource_filename("leap.bitmask_js", "public")) + pkg_resources.resource_filename('leap.bitmask_www', 'public')) root = File(webdir) api = Api(CommandDispatcher(self._core)) - root.putChild(u"API", api) + root.putChild(u'API', api) site = Site(root) self.site = site + + # TODO use endpoints instead self.listener = reactor.listenTCP(self.port, site, interface='127.0.0.1') @@ -63,6 +65,7 @@ class HTTPDispatcherService(service.Service): class Api(Resource): + isLeaf = True def __init__(self, dispatcher): diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py index ee918d4..b473f58 100644 --- a/src/leap/bitmask/core/service.py +++ b/src/leap/bitmask/core/service.py @@ -119,6 +119,7 @@ class BitmaskBackend(configurable.ConfigurableService): zs.setServiceParent(self) def init_web(self): + # FIXME try to import leap.bitmask_www and fail otherwise http = _web.HTTPDispatcherService(self) http.setServiceParent(self) diff --git a/src/leap/bitmask/core/web/README b/src/leap/bitmask/core/web/README new file mode 100644 index 0000000..76a745d --- /dev/null +++ b/src/leap/bitmask/core/web/README @@ -0,0 +1,9 @@ +This is the original implementation of the bitmask.js library, which uses the +REST api exposed by the HTTPRequestDispatcher. + +The development of bitmask_js is in the www/ folder in this bitmask-dev repo. + +A pre-compiled version of the html+js web-ui can be found in the leap.bitmask_www package. + +This remains here to be able to develop against the REST api without the need +of installing the full-fledged bitmask_www package. diff --git a/src/leap/bitmask/core/websocket.py b/src/leap/bitmask/core/websocket.py index 5569c6c..97a2d40 100644 --- a/src/leap/bitmask/core/websocket.py +++ b/src/leap/bitmask/core/websocket.py @@ -61,11 +61,11 @@ class WebSocketsDispatcherService(service.Service): # we server static files under "/" .. webdir = os.path.abspath( - pkg_resources.resource_filename("leap.bitmask.core", "web")) + pkg_resources.resource_filename('leap.bitmask.core', 'web')) root = File(webdir) # and our WebSocket server under "/ws" - root.putChild(u"bitmask", resource) + root.putChild(u'bitmask', resource) # both under one Twisted Web Site site = Site(root) -- cgit v1.2.3