summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/leap/bitmask/core/_web.py17
-rw-r--r--src/leap/bitmask/core/web/index.html2
2 files changed, 16 insertions, 3 deletions
diff --git a/src/leap/bitmask/core/_web.py b/src/leap/bitmask/core/_web.py
index 1a32fed..3f39e43 100644
--- a/src/leap/bitmask/core/_web.py
+++ b/src/leap/bitmask/core/_web.py
@@ -29,9 +29,17 @@ from twisted.application import service
from twisted.web.resource import Resource
from twisted.web.server import Site, NOT_DONE_YET
from twisted.web.static import File
+from twisted.python import log
from leap.bitmask.core.dispatcher import CommandDispatcher
+try:
+ import leap.bitmask_www
+ HAS_WEB_UI = True
+except ImportError:
+ HAS_WEB_UI = False
+
+
class HTTPDispatcherService(service.Service):
@@ -45,8 +53,13 @@ class HTTPDispatcherService(service.Service):
self.debug = debug
def startService(self):
- webdir = os.path.abspath(
- pkg_resources.resource_filename('leap.bitmask_www', 'public'))
+ if HAS_WEB_UI:
+ webdir = os.path.abspath(
+ pkg_resources.resource_filename('leap.bitmask_www', 'public'))
+ else:
+ log.msg('leap.bitmask_www not found, serving bitmask.core web ui')
+ webdir = os.path.abspath(
+ pkg_resources.resource_filename('leap.bitmask.core', 'web'))
root = File(webdir)
api = Api(CommandDispatcher(self._core))
diff --git a/src/leap/bitmask/core/web/index.html b/src/leap/bitmask/core/web/index.html
index 6ac9b29..7ffbb3f 100644
--- a/src/leap/bitmask/core/web/index.html
+++ b/src/leap/bitmask/core/web/index.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>Bitmask WebSockets Endpoint</title>
+ <title>Bitmask.js example</title>
<script src="bitmask.js"></script>
<script type="text/javascript">
var ellog = null;