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:
Miguel Jacq 2021-08-31 17:53:50 +10:00
parent 3a07bbe161
commit 686e5abd0e
No known key found for this signature in database
GPG key ID: EEA4341C6D97A0B6

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":