Add two new receive mode settings: receive_allow_receiver_shutdown and receive_public_mode

This commit is contained in:
Micah Lee 2018-04-28 21:08:53 -07:00
parent 2a7f6e0d5a
commit 6632a4b426
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 32 additions and 2 deletions

View File

@ -72,7 +72,9 @@ class Settings(object):
'private_key': '',
'slug': '',
'hidservauth_string': '',
'downloads_dir': self.build_default_downloads_dir()
'downloads_dir': self.build_default_downloads_dir(),
'receive_allow_receiver_shutdown': True,
'receive_public_mode': False
}
self._settings = {}
self.fill_in_defaults()

View File

@ -88,9 +88,21 @@ class SettingsDialog(QtWidgets.QDialog):
downloads_layout.addWidget(self.downloads_dir_lineedit)
downloads_layout.addWidget(downloads_button)
# Allow the receiver to shutdown the server
self.receive_allow_receiver_shutdown_checkbox = QtWidgets.QCheckBox()
self.receive_allow_receiver_shutdown_checkbox.setCheckState(QtCore.Qt.Checked)
self.receive_allow_receiver_shutdown_checkbox.setText(strings._("gui_settings_receive_allow_receiver_shutdown_checkbox", True))
# Use a slug
self.receive_public_mode_checkbox = QtWidgets.QCheckBox()
self.receive_public_mode_checkbox.setCheckState(QtCore.Qt.Checked)
self.receive_public_mode_checkbox.setText(strings._("gui_settings_receive_public_mode_checkbox", True))
# Receiving options layout
receiving_group_layout = QtWidgets.QVBoxLayout()
receiving_group_layout.addLayout(downloads_layout)
receiving_group_layout.addWidget(self.receive_allow_receiver_shutdown_checkbox)
receiving_group_layout.addWidget(self.receive_public_mode_checkbox)
receiving_group = QtWidgets.QGroupBox(strings._("gui_settings_receiving_label", True))
receiving_group.setLayout(receiving_group_layout)
@ -413,6 +425,18 @@ class SettingsDialog(QtWidgets.QDialog):
downloads_dir = self.old_settings.get('downloads_dir')
self.downloads_dir_lineedit.setText(downloads_dir)
receive_allow_receiver_shutdown = self.old_settings.get('receive_allow_receiver_shutdown')
if receive_allow_receiver_shutdown:
self.receive_allow_receiver_shutdown_checkbox.setCheckState(QtCore.Qt.Checked)
else:
self.receive_allow_receiver_shutdown_checkbox.setCheckState(QtCore.Qt.Unchecked)
receive_public_mode = self.old_settings.get('receive_public_mode')
if receive_public_mode:
self.receive_public_mode_checkbox.setCheckState(QtCore.Qt.Checked)
else:
self.receive_public_mode_checkbox.setCheckState(QtCore.Qt.Unchecked)
use_stealth = self.old_settings.get('use_stealth')
if use_stealth:
self.stealth_checkbox.setCheckState(QtCore.Qt.Checked)
@ -794,6 +818,8 @@ class SettingsDialog(QtWidgets.QDialog):
# Also unset the HidServAuth if we are removing our reusable private key
settings.set('hidservauth_string', '')
settings.set('downloads_dir', self.downloads_dir_lineedit.text())
settings.set('receive_allow_receiver_shutdown', self.receive_allow_receiver_shutdown_checkbox.isChecked())
settings.set('receive_public_mode', self.receive_public_mode_checkbox.isChecked())
settings.set('use_stealth', self.stealth_checkbox.isChecked())
# Always unset the HidServAuth if Stealth mode is unset
if not self.stealth_checkbox.isChecked():

View File

@ -177,5 +177,7 @@
"gui_mode_receive_button": "Receive Files",
"gui_settings_receiving_label": "Receiving options",
"gui_settings_downloads_label": "Save files to",
"gui_settings_downloads_button": "Browse"
"gui_settings_downloads_button": "Browse",
"gui_settings_receive_allow_receiver_shutdown_checkbox": "Allow people who upload files to you to stop Receive Mode for you",
"gui_settings_receive_public_mode_checkbox": "Receive Mode is open to the public\n(don't try to prevent people from guessing the OnionShare address)"
}