示例#1
0
 def _setup_server(self):
     ui_path = os.path.join(settings.ensure_data_dir(), "lbry-ui", "active")
     self.root = LBRYindex(ui_path)
     self._api = Daemon(self.root, self.analytics_manager)
     self.root.putChild("view", HostedEncryptedFile(self._api))
     self.root.putChild("upload", EncryptedFileUpload(self._api))
     self.root.putChild(settings.API_ADDRESS, self._api)
     return defer.succeed(True)
示例#2
0
 def _setup_server(self, wallet):
     self.root = LBRYindex(
         os.path.join(os.path.join(data_dir, "lbry-ui"), "active"))
     self._api = Daemon(self.root, wallet_type=wallet)
     self.root.putChild("view", HostedEncryptedFile(self._api))
     self.root.putChild("upload", EncryptedFileUpload(self._api))
     self.root.putChild(API_ADDRESS, self._api)
     return defer.succeed(True)
示例#3
0
    def _setup_server(self, use_auth):
        ui_path = os.path.join(conf.settings.ensure_data_dir(), "lbry-ui", "active")
        self.root = LBRYindex(ui_path)
        self._api = Daemon(self.root, self.analytics_manager)
        self.root.putChild("view", HostedEncryptedFile(self._api))
        self.root.putChild("upload", EncryptedFileUpload(self._api))
        self.root.putChild(conf.settings['API_ADDRESS'], self._api)

        lbrynet_server = server.Site(get_site_base(use_auth, self.root))
        lbrynet_server.requestFactory = DaemonRequest

        try:
            self.server_port = reactor.listenTCP(
                conf.settings['api_port'], lbrynet_server, interface=conf.settings['api_host'])
        except error.CannotListenError:
            log.info('Daemon already running, exiting app')
            raise

        return defer.succeed(True)