summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--Makefile1
-rw-r--r--setup.py2
-rw-r--r--src/leap/bitmask/core/_web.py9
-rw-r--r--src/leap/bitmask/core/service.py1
-rw-r--r--src/leap/bitmask/core/web/README9
-rw-r--r--src/leap/bitmask/core/websocket.py4
-rw-r--r--www/Makefile12
-rw-r--r--www/leap/bitmask_www/__init__.py0
-rw-r--r--www/setup.py18
10 files changed, 51 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index c0dd1db..6357f2a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,7 @@ ENV/
www/node_modules
www/public
www/npm-debug.log
+www/leap/bitmask_www/public/
+
+# vim
+*.swp
diff --git a/Makefile b/Makefile
index 43df370..bcf4cf0 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ clean:
dev-mail:
pip install -e '.[mail]'
+ pip install -e www
dev-all:
pip install -e '.[all]'
diff --git a/setup.py b/setup.py
index c49f062..19d30e7 100644
--- a/setup.py
+++ b/setup.py
@@ -27,9 +27,11 @@ extras = {
],
'gui': [
'vext.pyqt5',
+ # 'bitmask_www' # when it's published in pypi
],
'all': [
'vext.pyqt5',
+ # 'bitmask_www' # when it's published in pypi
'leap.soledad.client',
'gnupg',
]
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)
diff --git a/www/Makefile b/www/Makefile
index 1e21b9a..e3a791d 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -2,11 +2,16 @@ build:
npm install
npm run build:production
+build-dev:
+ npm run watch
+
clean:
rm -rf public
rm -rf node_modules
-pydist-wheel:
+pydist: pydist-clean build
+ touch leap/bitmask_www/__init__.py
+ cp -r public/ leap/bitmask_www
python setup.py bdist_wheel
pydist-dev:
@@ -14,3 +19,8 @@ pydist-dev:
pydist-clean:
rm -rf build dist
+ rm -rf leap/bitmask_www/*
+
+all: clean build pydist
+
+.PHONY: clean build install all
diff --git a/www/leap/bitmask_www/__init__.py b/www/leap/bitmask_www/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/www/leap/bitmask_www/__init__.py
diff --git a/www/setup.py b/www/setup.py
index 860d0aa..b5473d1 100644
--- a/www/setup.py
+++ b/www/setup.py
@@ -15,19 +15,26 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
"""
Setup file for leap.bitmask-www
"""
+
from setuptools import setup
import datetime
import time
+
+# TODO add all the node steps in this setup too.
+# Right now it's expected that you run the node commands by hand
+# i.e., 'make build'
+
now = datetime.datetime.now()
timestamp = time.strftime('%Y%m%d', now.timetuple())
setup(
- name='leap.bitmask-www',
+ name='leap.bitmask_www',
version='0.1.%s' % timestamp,
description='Bitmask html/js UI',
long_description=open('notes-python.txt').read(),
@@ -35,8 +42,13 @@ setup(
author_email='info@leap.se',
url='http://leap.se',
namespace_packages=['leap'],
- packages=['leap.bitmask-www'],
+ packages=['leap.bitmask_www'],
package_data={
- '': ['public/*', ]
+ '': ['public/*',
+ 'public/css/*',
+ 'public/fonts/*',
+ 'public/img/*',
+ 'publlic/js/*',
+ ]
}
)