From 50a258d45e851a865801da9d888037b5869a3489 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 4 Aug 2016 19:04:09 +0200 Subject: [feat] add web/js core API Implements http REST API for the core and bitmask.js generic library to use this API. For events it uses long polling. - Resolves: #8265 --- src/leap/bitmask/core/service.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/leap/bitmask/core/service.py') diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py index 79465a8..ee918d4 100644 --- a/src/leap/bitmask/core/service.py +++ b/src/leap/bitmask/core/service.py @@ -26,6 +26,7 @@ from twisted.python import log from leap.bitmask import __version__ from leap.bitmask.core import configurable from leap.bitmask.core import _zmq +from leap.bitmask.core import _web from leap.bitmask.core import flags from leap.common.events import server as event_server # from leap.vpn import EIPService @@ -72,6 +73,9 @@ class BitmaskBackend(configurable.ConfigurableService): if enabled('web'): on_start(self.init_web) + if enabled('websockets'): + on_start(self.init_websockets) + def init_events(self): event_server.ensure_server() @@ -115,6 +119,10 @@ class BitmaskBackend(configurable.ConfigurableService): zs.setServiceParent(self) def init_web(self): + http = _web.HTTPDispatcherService(self) + http.setServiceParent(self) + + def init_websockets(self): from leap.bitmask.core import websocket ws = websocket.WebSocketsDispatcherService(self) ws.setServiceParent(self) @@ -160,6 +168,8 @@ class BitmaskBackend(configurable.ConfigurableService): elif service == 'web': self.init_web() + self.init_http() + return 'ok' def do_disable_service(self, service): -- cgit v1.2.3