def __init__(self, session, wcommon, read_only_dbs, writable_db): SlashedResource.__init__(self) # UI entry point self.putChild( '', ElementRenderingResource(_RadioIndexHtmlElement(wcommon))) # Exported radio control objects self.putChild(CAP_OBJECT_PATH_ELEMENT, BlockResource(session, wcommon, _not_deletable)) # Frequency DB self.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs)) self.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db)) # Debug graph self.putChild( 'flow-graph', FlowgraphVizResource(wcommon.reactor, session.flowgraph_for_debug())) # Ephemeris self.putChild('ephemeris', EphemerisResource()) # Standard audio-file-over-HTTP audio stream (the ShinySDR web client uses WebSockets instead, but both have the same path modulo protocol) self.putChild(AUDIO_STREAM_PATH_ELEMENT, AudioStreamResource(session))
def _put_root_static(wcommon, container_resource): """Place all the simple resources, that are not necessarily sourced from files but at least are unchanging and public.""" for name in ['', 'client', 'test', 'manual', 'tools']: container_resource.putChild(name, _make_static_resource(os.path.join(static_resource_path, name if name != '' else 'index.html'))) # Link deps into /client/. client = container_resource.children['client'] for name in ['require.js', 'text.js']: client.putChild(name, _make_static_resource(os.path.join(deps_path, name))) for name in ['measviz.js', 'measviz.css']: client.putChild(name, _make_static_resource(os.path.join(deps_path, 'measviz/src', name))) # Link deps into /test/. test = container_resource.children['test'] jasmine = SlashedResource() test.putChild('jasmine', jasmine) for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']: jasmine.putChild(name, _make_static_resource(os.path.join( deps_path, 'jasmine/lib/jasmine-core/', name))) # Special resources container_resource.putChild('favicon.ico', _make_static_resource(os.path.join(static_resource_path, 'client/icon/icon-32.png'))) client.putChild('web-app-manifest.json', WebAppManifestResource(wcommon)) _put_plugin_resources(client)
def _put_root_static(container_resource): """Place all the simple static files.""" for name in ['', 'client', 'test', 'manual', 'tools']: container_resource.putChild( name, _make_static_resource( os.path.join(static_resource_path, name if name != '' else 'index.html'))) # Link deps into /client/. client = container_resource.children['client'] for name in ['require.js', 'text.js']: client.putChild(name, _make_static_resource(os.path.join(deps_path, name))) for name in ['measviz.js', 'measviz.css']: client.putChild( name, _make_static_resource(os.path.join(deps_path, 'measviz/src', name))) # Link deps into /test/. test = container_resource.children['test'] jasmine = SlashedResource() test.putChild('jasmine', jasmine) for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']: jasmine.putChild( name, _make_static_resource( os.path.join(deps_path, 'jasmine/lib/jasmine-core/', name))) _put_plugin_resources(client)
def __init__(self, reactor, root_object, read_only_dbs, writable_db, http_endpoint, ws_endpoint, root_cap, title, flowgraph_for_debug): # Constants self.__http_port = http_endpoint self.__ws_port = ws_endpoint wcommon = WebServiceCommon(ws_endpoint=ws_endpoint) # Roots of resource trees # - app_root is everything stateful/authority-bearing # - server_root is the HTTP '/' and static resources are placed there server_root = Resource() if root_cap is None: app_root = server_root self.__visit_path = '/' ws_caps = {None: root_object} else: app_root = SlashedResource() server_root.putChild(root_cap, app_root) self.__visit_path = '/' + urllib.quote(root_cap, safe='') + '/' ws_caps = {root_cap: root_object} # Note: in the root_cap = None case, it matters that the session is done second as it overwrites the definition of /. _put_root_static(server_root) _put_session(app_root, root_object, wcommon, reactor, title, read_only_dbs, writable_db, flowgraph_for_debug) self.__ws_protocol = txws.WebSocketFactory( FactoryWithArgs.forProtocol(OurStreamProtocol, ws_caps)) self.__site = server.Site(server_root) self.__ws_port_obj = None self.__http_port_obj = None
def __init__(self, session, wcommon, reactor, title, read_only_dbs, writable_db, flowgraph_for_debug): SlashedResource.__init__(self) # UI entry point self.putChild('', _RadioIndexHtmlResource(wcommon=wcommon, title=title)) # Exported radio control objects self.putChild(CAP_OBJECT_PATH_ELEMENT, BlockResource(session, wcommon, not_deletable)) # Frequency DB self.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs)) self.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db)) # Debug graph self.putChild('flow-graph', FlowgraphVizResource(reactor, flowgraph_for_debug)) # Ephemeris self.putChild('ephemeris', EphemerisResource())
def __init__(self, session, wcommon, read_only_dbs, writable_db): SlashedResource.__init__(self) # UI entry point self.putChild('', _RadioIndexHtmlResource(wcommon=wcommon)) # Exported radio control objects self.putChild(CAP_OBJECT_PATH_ELEMENT, BlockResource(session, wcommon, _not_deletable)) # Frequency DB self.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs)) self.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db)) # Debug graph self.putChild('flow-graph', FlowgraphVizResource(wcommon.reactor, session.flowgraph_for_debug())) # Ephemeris self.putChild('ephemeris', EphemerisResource())
def _put_root_static(container_resource): """Place all the simple static files.""" for name in ['', 'client', 'test', 'manual', 'tools']: container_resource.putChild(name, _make_static_resource(os.path.join(static_resource_path, name if name != '' else 'index.html'))) # Link deps into /client/. client = container_resource.children['client'] client.putChild('require.js', _make_static_resource(os.path.join(deps_path, 'require.js'))) client.putChild('text.js', _make_static_resource(os.path.join(deps_path, 'text.js'))) # Link deps into /test/. test = container_resource.children['test'] jasmine = SlashedResource() test.putChild('jasmine', jasmine) for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']: jasmine.putChild(name, _make_static_resource(os.path.join( deps_path, 'jasmine/lib/jasmine-core/', name))) _put_plugin_resources(client)
def __init__(self, session, wcommon, read_only_dbs, writable_db): SlashedResource.__init__(self) # UI entry point self.putChild('', ElementRenderingResource(_RadioIndexHtmlElement(wcommon))) # Exported radio control objects self.putChild(CAP_OBJECT_PATH_ELEMENT, BlockResource(session, wcommon, _not_deletable)) # Frequency DB self.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs)) self.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db)) # Debug graph self.putChild('flow-graph', FlowgraphVizResource(wcommon.reactor, session.flowgraph_for_debug())) # Ephemeris self.putChild('ephemeris', EphemerisResource()) # Standard audio-file-over-HTTP audio stream (the ShinySDR web client uses WebSockets instead, but both have the same path modulo protocol) self.putChild(AUDIO_STREAM_PATH_ELEMENT, AudioStreamResource(session))
def __init__(self, reactor, root_object, note_dirty, read_only_dbs, writable_db, http_endpoint, ws_endpoint, root_cap, title, flowgraph_for_debug): self.__http_port = http_endpoint self.__ws_port = ws_endpoint wcommon = WebServiceCommon(note_dirty=note_dirty, ws_endpoint=ws_endpoint) # Roots of resource trees # - appRoot is everything stateful/authority-bearing # - serverRoot is the HTTP '/' and static resources are placed there serverRoot = _make_static(static_resource_path) if root_cap is None: appRoot = serverRoot self.__visit_path = '/' ws_caps = {None: root_object} else: serverRoot = _make_static(static_resource_path) appRoot = SlashedResource() serverRoot.putChild(root_cap, appRoot) self.__visit_path = '/' + urllib.quote(root_cap, safe='') + '/' ws_caps = {root_cap: root_object} self.__ws_protocol = txws.WebSocketFactory( FactoryWithArgs.forProtocol(OurStreamProtocol, ws_caps, note_dirty)) # UI entry point appRoot.putChild('', _RadioIndexHtmlResource(wcommon=wcommon, title=title)) # Exported radio control objects appRoot.putChild('radio', BlockResource(root_object, wcommon, not_deletable)) # Frequency DB appRoot.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs)) appRoot.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db)) # Debug graph appRoot.putChild('flow-graph', FlowgraphVizResource(reactor, flowgraph_for_debug)) # Ephemeris appRoot.putChild('ephemeris', EphemerisResource()) # Construct explicit resources for merge. test = _reify(serverRoot, 'test') jasmine = _reify(test, 'jasmine') for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']: jasmine.putChild(name, static.File(os.path.join( deps_path, 'jasmine/lib/jasmine-core/', name))) client = _reify(serverRoot, 'client') client.putChild('require.js', static.File(os.path.join(deps_path, 'require.js'))) client.putChild('text.js', static.File(os.path.join(deps_path, 'text.js'))) _add_plugin_resources(client) self.__site = server.Site(serverRoot) self.__ws_port_obj = None self.__http_port_obj = None