From 1bc516f5694c02da6118ee414d8d4db4a10292a6 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sat, 2 Nov 2019 17:06:13 -0700 Subject: [PATCH] Remove mode settings from global settings object --- onionshare/mode_settings.py | 4 ++-- onionshare/settings.py | 12 ------------ tests/test_onionshare_settings.py | 14 -------------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/onionshare/mode_settings.py b/onionshare/mode_settings.py index dfc0b939..9caf6345 100644 --- a/onionshare/mode_settings.py +++ b/onionshare/mode_settings.py @@ -45,7 +45,7 @@ class ModeSettings: "client_auth": False, }, "share": {"autostop_sharing": True}, - "receive": {"data_dir": self.build_default_data_dir()}, + "receive": {"data_dir": self.build_default_receive_data_dir()}, "website": {"disable_csp": False}, } @@ -55,7 +55,7 @@ class ModeSettings: def set(self, group, key, val): self.settings[group][key] = val - def build_default_data_dir(self): + def build_default_receive_data_dir(self): """ Returns the path of the default Downloads directory for receive mode. """ diff --git a/onionshare/settings.py b/onionshare/settings.py index 6d6528a4..11227817 100644 --- a/onionshare/settings.py +++ b/onionshare/settings.py @@ -106,24 +106,12 @@ class Settings(object): "socket_file_path": "/var/run/tor/control", "auth_type": "no_auth", "auth_password": "", - "close_after_first_download": True, - "autostop_timer": False, - "autostart_timer": False, - "use_stealth": False, "use_autoupdate": True, "autoupdate_timestamp": None, "no_bridges": True, "tor_bridges_use_obfs4": False, "tor_bridges_use_meek_lite_azure": False, "tor_bridges_use_custom_bridges": "", - "use_legacy_v2_onions": False, - "save_private_key": False, - "private_key": "", - "public_mode": False, - "password": "", - "hidservauth_string": "", - "data_dir": "", - "csp_header_disabled": False, "locale": None, # this gets defined in fill_in_defaults() } self._settings = {} diff --git a/tests/test_onionshare_settings.py b/tests/test_onionshare_settings.py index 0bce2f94..9c81642f 100644 --- a/tests/test_onionshare_settings.py +++ b/tests/test_onionshare_settings.py @@ -50,24 +50,12 @@ class TestSettings: "socket_file_path": "/var/run/tor/control", "auth_type": "no_auth", "auth_password": "", - "close_after_first_download": True, - "autostop_timer": False, - "autostart_timer": False, - "use_stealth": False, "use_autoupdate": True, "autoupdate_timestamp": None, "no_bridges": True, "tor_bridges_use_obfs4": False, "tor_bridges_use_meek_lite_azure": False, "tor_bridges_use_custom_bridges": "", - "use_legacy_v2_onions": False, - "save_private_key": False, - "private_key": "", - "password": "", - "hidservauth_string": "", - "data_dir": os.path.expanduser("~/OnionShare"), - "public_mode": False, - "csp_header_disabled": False, } for key in settings_obj._settings: # Skip locale, it will not always default to the same thing @@ -125,8 +113,6 @@ class TestSettings: assert settings_obj.get("socket_file_path") == "/var/run/tor/control" assert settings_obj.get("auth_type") == "no_auth" assert settings_obj.get("auth_password") == "" - assert settings_obj.get("close_after_first_download") is True - assert settings_obj.get("use_stealth") is False assert settings_obj.get("use_autoupdate") is True assert settings_obj.get("autoupdate_timestamp") is None assert settings_obj.get("autoupdate_timestamp") is None