Merge pull request #1413 from mig5/cli_allow_persistent_mode_as_only_arg

Don't force mode to be sent in CLI if --persistent is in use. Store the persistent mode only the first time the persistent file is created
This commit is contained in:
Micah Lee 2021-09-03 13:27:53 -07:00 committed by GitHub
commit 3d698d0fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,15 +201,6 @@ def main(cwd=None):
disable_csp = bool(args.disable_csp)
verbose = bool(args.verbose)
if receive:
mode = "receive"
elif website:
mode = "website"
elif chat:
mode = "chat"
else:
mode = "share"
# Verbose mode?
common.verbose = verbose
@ -223,16 +214,26 @@ def main(cwd=None):
if persistent_filename:
mode_settings = ModeSettings(common, persistent_filename)
mode_settings.set("persistent", "enabled", True)
mode_settings.set("persistent", "mode", mode)
else:
mode_settings = ModeSettings(common)
if receive:
mode = "receive"
elif website:
mode = "website"
elif chat:
mode = "chat"
else:
mode = "share"
if mode_settings.just_created:
# This means the mode settings were just created, not loaded from disk
mode_settings.set("general", "title", title)
mode_settings.set("general", "public", public)
mode_settings.set("general", "autostart_timer", autostart_timer)
mode_settings.set("general", "autostop_timer", autostop_timer)
if persistent_filename:
mode_settings.set("persistent", "mode", mode)
if mode == "share":
mode_settings.set("share", "autostop_sharing", autostop_sharing)
if mode == "receive":