forked from LBRYCommunity/lbry-sdk
fix switching between --branch and --ui
This commit is contained in:
parent
da68bcf952
commit
f9c644b964
4 changed files with 16 additions and 11 deletions
|
@ -382,7 +382,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
log.error(failure)
|
||||
return jsonrpclib.Fault(self.FAILURE, "error")
|
||||
|
||||
def setup(self, branch=DEFAULT_UI_BRANCH, user_specified=False):
|
||||
def setup(self, branch=DEFAULT_UI_BRANCH, user_specified=False, branch_specified=False):
|
||||
def _log_starting_vals():
|
||||
d = self._get_lbry_files()
|
||||
d.addCallback(lambda r: json.dumps([d[1] for d in r]))
|
||||
|
@ -427,7 +427,9 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
self.connection_problem_checker.start(1)
|
||||
|
||||
d = defer.Deferred()
|
||||
d.addCallback(lambda _: self.lbry_ui_manager.setup(branch=branch, user_specified=user_specified))
|
||||
d.addCallback(lambda _: self.lbry_ui_manager.setup(branch=branch,
|
||||
user_specified=user_specified,
|
||||
branch_specified=branch_specified))
|
||||
d.addCallback(lambda _: self._initial_setup())
|
||||
d.addCallback(lambda _: threads.deferToThread(self._setup_data_directory))
|
||||
d.addCallback(lambda _: self._check_db_migration())
|
||||
|
|
|
@ -13,7 +13,8 @@ from twisted.internet import reactor, defer
|
|||
from jsonrpc.proxy import JSONRPCProxy
|
||||
|
||||
from lbrynet.lbrynet_daemon.LBRYDaemonServer import LBRYDaemonServer
|
||||
from lbrynet.conf import API_CONNECTION_STRING, API_INTERFACE, API_ADDRESS, API_PORT, DEFAULT_WALLET, UI_ADDRESS
|
||||
from lbrynet.conf import API_CONNECTION_STRING, API_INTERFACE, API_ADDRESS, API_PORT, \
|
||||
DEFAULT_WALLET, UI_ADDRESS, DEFAULT_UI_BRANCH
|
||||
|
||||
|
||||
if sys.platform != "darwin":
|
||||
|
@ -68,12 +69,11 @@ def start():
|
|||
help="path to custom UI folder",
|
||||
default=None)
|
||||
parser.add_argument("--branch",
|
||||
help="Branch of lbry-web-ui repo to use, defaults on master",
|
||||
default="master")
|
||||
help="Branch of lbry-web-ui repo to use, defaults on master")
|
||||
parser.add_argument('--no-launch', dest='launchui', action="store_false")
|
||||
parser.add_argument('--log-to-console', dest='logtoconsole', action="store_true")
|
||||
parser.add_argument('--quiet', dest='quiet', action="store_true")
|
||||
parser.set_defaults(launchui=True, logtoconsole=False, quiet=False)
|
||||
parser.set_defaults(branch=False, launchui=True, logtoconsole=False, quiet=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.logtoconsole:
|
||||
|
@ -104,7 +104,10 @@ def start():
|
|||
if test_internet_connection():
|
||||
lbry = LBRYDaemonServer()
|
||||
|
||||
d = lbry.start(branch=args.branch, user_specified=args.ui, wallet=args.wallet)
|
||||
d = lbry.start(branch=args.branch if args.branch else DEFAULT_UI_BRANCH,
|
||||
user_specified=args.ui,
|
||||
wallet=args.wallet,
|
||||
branch_specified=True if args.branch else False)
|
||||
if args.launchui:
|
||||
d.addCallback(lambda _: webbrowser.open(UI_ADDRESS))
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ class LBRYDaemonServer(object):
|
|||
self.root.putChild(API_ADDRESS, self._api)
|
||||
return defer.succeed(True)
|
||||
|
||||
def start(self, branch=DEFAULT_UI_BRANCH, user_specified=False, wallet=DEFAULT_WALLET):
|
||||
def start(self, branch=DEFAULT_UI_BRANCH, user_specified=False, branch_specified=False, wallet=DEFAULT_WALLET):
|
||||
d = self._setup_server(self._setup_server(wallet))
|
||||
d.addCallback(lambda _: self._api.setup(branch, user_specified))
|
||||
d.addCallback(lambda _: self._api.setup(branch, user_specified, branch_specified))
|
||||
return d
|
||||
|
|
|
@ -70,7 +70,7 @@ class LBRYUIManager(object):
|
|||
self.loaded_branch = None
|
||||
self.loaded_requirements = None
|
||||
|
||||
def setup(self, branch=DEFAULT_UI_BRANCH, user_specified=None):
|
||||
def setup(self, branch=DEFAULT_UI_BRANCH, user_specified=None, branch_specified=False):
|
||||
self.branch = branch
|
||||
if user_specified:
|
||||
if os.path.isdir(user_specified):
|
||||
|
@ -82,7 +82,7 @@ class LBRYUIManager(object):
|
|||
return d
|
||||
else:
|
||||
log.info("User specified UI directory doesn't exist, using " + branch)
|
||||
elif self.loaded_branch == "user-specified":
|
||||
elif self.loaded_branch == "user-specified" and not branch_specified:
|
||||
log.info("Loading user provided UI")
|
||||
d = self._load_ui()
|
||||
return d
|
||||
|
|
Loading…
Reference in a new issue