forked from LBRYCommunity/lbry-sdk
open the ui as soon as UIManager finishes setting itself up
This commit is contained in:
parent
5233dc303e
commit
5f8a06443c
4 changed files with 9 additions and 11 deletions
|
@ -291,7 +291,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
self.lbry_file_manager = None
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def setup(self):
|
||||
def setup(self, launch_ui):
|
||||
self._modify_loggly_formatter()
|
||||
|
||||
def _announce_startup():
|
||||
|
@ -329,7 +329,7 @@ class Daemon(AuthJSONRPCServer):
|
|||
|
||||
if conf.settings.host_ui:
|
||||
self.lbry_ui_manager.update_checker.start(1800, now=False)
|
||||
yield self.lbry_ui_manager.setup()
|
||||
yield self.lbry_ui_manager.setup(launch=launch_ui)
|
||||
yield self._initial_setup()
|
||||
yield threads.deferToThread(self._setup_data_directory)
|
||||
yield self._check_db_migration()
|
||||
|
|
|
@ -2,7 +2,6 @@ from lbrynet.core import log_support
|
|||
|
||||
import argparse
|
||||
import logging.handlers
|
||||
import webbrowser
|
||||
|
||||
from twisted.internet import defer, reactor
|
||||
from jsonrpc.proxy import JSONRPCProxy
|
||||
|
@ -129,9 +128,7 @@ def start_server_and_listen(launchui, use_auth, analytics_manager):
|
|||
log_support.configure_analytics_handler(analytics_manager)
|
||||
try:
|
||||
daemon_server = DaemonServer(analytics_manager)
|
||||
yield daemon_server.start(use_auth)
|
||||
if launchui:
|
||||
yield webbrowser.open(conf.settings.UI_ADDRESS)
|
||||
yield daemon_server.start(use_auth, launchui)
|
||||
analytics_manager.send_server_startup_success()
|
||||
except Exception as e:
|
||||
log.exception('Failed to startup')
|
||||
|
|
|
@ -43,9 +43,9 @@ class DaemonServer(object):
|
|||
return defer.succeed(True)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def start(self, use_auth):
|
||||
def start(self, use_auth, launch_ui=False):
|
||||
yield self._setup_server(use_auth)
|
||||
yield self._api.setup()
|
||||
yield self._api.setup(launch_ui)
|
||||
|
||||
|
||||
def get_site_base(use_auth, root):
|
||||
|
|
|
@ -2,6 +2,7 @@ import os
|
|||
import logging
|
||||
import shutil
|
||||
import json
|
||||
import webbrowser
|
||||
from urllib2 import urlopen
|
||||
from StringIO import StringIO
|
||||
from zipfile import ZipFile
|
||||
|
@ -15,8 +16,6 @@ from lbrynet.lbrynet_daemon.Resources import NoCacheStaticFile
|
|||
from lbrynet import __version__ as lbrynet_version
|
||||
from lbryum.version import LBRYUM_VERSION as lbryum_version
|
||||
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -60,7 +59,7 @@ class UIManager(object):
|
|||
self.loaded_branch = None
|
||||
self.loaded_requirements = None
|
||||
|
||||
def setup(self, branch=None, check_requirements=None, user_specified=None):
|
||||
def setup(self, branch=None, check_requirements=None, user_specified=None, launch=False):
|
||||
local_ui_path = user_specified or conf.settings.local_ui_path
|
||||
|
||||
self.branch = branch or conf.settings.ui_branch
|
||||
|
@ -95,6 +94,8 @@ class UIManager(object):
|
|||
|
||||
d = self._up_to_date()
|
||||
d.addCallback(lambda r: self._download_ui() if not r else self._load_ui())
|
||||
if launch:
|
||||
d.addCallback(lambda _: webbrowser.open(conf.settings.UI_ADDRESS))
|
||||
return d
|
||||
|
||||
def _check_for_bundled_ui(self):
|
||||
|
|
Loading…
Reference in a new issue