mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-29 09:16:24 -05:00
Merge pull request #1017 from micahflee/1014_hide_tor_settings
Hide Tor settings with ONIONSHARE_HIDE_TOR_SETTINGS
This commit is contained in:
commit
0c9fd8f7b6
@ -18,7 +18,11 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||
import sys, platform, datetime, re
|
||||
import sys
|
||||
import platform
|
||||
import datetime
|
||||
import re
|
||||
import os
|
||||
|
||||
from onionshare import strings, common
|
||||
from onionshare.settings import Settings
|
||||
@ -28,6 +32,7 @@ from .widgets import Alert
|
||||
from .update_checker import *
|
||||
from .tor_connection_dialog import TorConnectionDialog
|
||||
|
||||
|
||||
class SettingsDialog(QtWidgets.QDialog):
|
||||
"""
|
||||
Settings dialog.
|
||||
@ -52,6 +57,9 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
|
||||
self.system = platform.system()
|
||||
|
||||
# If ONIONSHARE_HIDE_TOR_SETTINGS=1, hide Tor settings in the dialog
|
||||
self.hide_tor_settings = os.environ.get('ONIONSHARE_HIDE_TOR_SETTINGS') == "1"
|
||||
|
||||
# General settings
|
||||
|
||||
# Use a password or not ('public mode')
|
||||
@ -484,7 +492,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
|
||||
col_layout = QtWidgets.QHBoxLayout()
|
||||
col_layout.addLayout(left_col_layout)
|
||||
col_layout.addLayout(right_col_layout)
|
||||
if not self.hide_tor_settings:
|
||||
col_layout.addLayout(right_col_layout)
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addLayout(col_layout)
|
||||
@ -635,6 +644,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
Connection type bundled was toggled. If checked, hide authentication fields.
|
||||
"""
|
||||
self.common.log('SettingsDialog', 'connection_type_bundled_toggled')
|
||||
if self.hide_tor_settings:
|
||||
return
|
||||
if checked:
|
||||
self.authenticate_group.hide()
|
||||
self.connection_type_socks.hide()
|
||||
@ -644,6 +655,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
"""
|
||||
'No bridges' option was toggled. If checked, enable other bridge options.
|
||||
"""
|
||||
if self.hide_tor_settings:
|
||||
return
|
||||
if checked:
|
||||
self.tor_bridges_use_custom_textbox_options.hide()
|
||||
|
||||
@ -651,6 +664,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
"""
|
||||
obfs4 bridges option was toggled. If checked, disable custom bridge options.
|
||||
"""
|
||||
if self.hide_tor_settings:
|
||||
return
|
||||
if checked:
|
||||
self.tor_bridges_use_custom_textbox_options.hide()
|
||||
|
||||
@ -658,6 +673,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
"""
|
||||
meek_lite_azure bridges option was toggled. If checked, disable custom bridge options.
|
||||
"""
|
||||
if self.hide_tor_settings:
|
||||
return
|
||||
if checked:
|
||||
self.tor_bridges_use_custom_textbox_options.hide()
|
||||
# Alert the user about meek's costliness if it looks like they're turning it on
|
||||
@ -668,6 +685,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
"""
|
||||
Custom bridges option was toggled. If checked, show custom bridge options.
|
||||
"""
|
||||
if self.hide_tor_settings:
|
||||
return
|
||||
if checked:
|
||||
self.tor_bridges_use_custom_textbox_options.show()
|
||||
|
||||
@ -676,6 +695,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
Connection type automatic was toggled. If checked, hide authentication fields.
|
||||
"""
|
||||
self.common.log('SettingsDialog', 'connection_type_automatic_toggled')
|
||||
if self.hide_tor_settings:
|
||||
return
|
||||
if checked:
|
||||
self.authenticate_group.hide()
|
||||
self.connection_type_socks.hide()
|
||||
@ -687,6 +708,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
for Tor control address and port. If unchecked, hide those extra fields.
|
||||
"""
|
||||
self.common.log('SettingsDialog', 'connection_type_control_port_toggled')
|
||||
if self.hide_tor_settings:
|
||||
return
|
||||
if checked:
|
||||
self.authenticate_group.show()
|
||||
self.connection_type_control_port_extras.show()
|
||||
@ -702,6 +725,8 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
for socket file. If unchecked, hide those extra fields.
|
||||
"""
|
||||
self.common.log('SettingsDialog', 'connection_type_socket_file_toggled')
|
||||
if self.hide_tor_settings:
|
||||
return
|
||||
if checked:
|
||||
self.authenticate_group.show()
|
||||
self.connection_type_socket_file_extras.show()
|
||||
|
Loading…
Reference in New Issue
Block a user