mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Add two new receive mode settings: receive_allow_receiver_shutdown and receive_public_mode
This commit is contained in:
parent
2a7f6e0d5a
commit
6632a4b426
@ -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()
|
||||
|
@ -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():
|
||||
|
@ -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)"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user