diff --git a/cli/onionshare_cli/onion.py b/cli/onionshare_cli/onion.py index c3ee4fac..d52af9f3 100644 --- a/cli/onionshare_cli/onion.py +++ b/cli/onionshare_cli/onion.py @@ -333,9 +333,19 @@ class Onion(object): for line in o: f.write(line) - if self.settings.get("tor_bridges_use_custom_bridges"): - f.write(self.settings.get("tor_bridges_use_custom_bridges") + "\n") - f.write("\nUseBridges 1") + elif self.settings.get("tor_bridges_use_moat"): + for line in self.settings.get("tor_bridges_use_moat_bridges").split( + "\n" + ): + f.write(f"Bridge {line}\n") + f.write("\nUseBridges 1\n") + + elif self.settings.get("tor_bridges_use_custom_bridges"): + for line in self.settings.get( + "tor_bridges_use_custom_bridges" + ).split("\n"): + f.write(f"Bridge {line}\n") + f.write("\nUseBridges 1\n") # Execute a tor subprocess start_ts = time.time() diff --git a/desktop/src/onionshare/moat_dialog.py b/desktop/src/onionshare/moat_dialog.py index 3cb6519b..ea58898b 100644 --- a/desktop/src/onionshare/moat_dialog.py +++ b/desktop/src/onionshare/moat_dialog.py @@ -172,6 +172,7 @@ class MoatDialog(QtWidgets.QDialog): self.label.setText(strings._("moat_captcha_label")) self.captcha.show() + self.solution_lineedit.setText("") self.solution_lineedit.show() self.reload_button.show() self.submit_button.show() diff --git a/desktop/src/onionshare/resources/locale/en.json b/desktop/src/onionshare/resources/locale/en.json index 63bfd48c..a9fb562a 100644 --- a/desktop/src/onionshare/resources/locale/en.json +++ b/desktop/src/onionshare/resources/locale/en.json @@ -67,9 +67,10 @@ "gui_settings_bridge_none_radio_option": "Don't use a bridge", "gui_settings_meek_lite_expensive_warning": "Warning: The meek-azure bridges are very costly for the Tor Project to run.

Only use them if unable to connect to Tor directly, via obfs4 transports, or other normal bridges.", "gui_settings_bridge_moat_radio_option": "Request a bridge from torproject.org", - "gui_settings_bridge_moat_button": "Request a New Bridge...", + "gui_settings_bridge_moat_button": "Request a New Bridge", "gui_settings_bridge_custom_radio_option": "Provide a bridge you learned about from a trusted source", "gui_settings_bridge_custom_placeholder": "type address:port (one per line)", + "gui_settings_moat_bridges_invalid": "You have not requested a bridge from torproject.org yet.", "gui_settings_tor_bridges_invalid": "None of the bridges you added work.\nDouble-check them or add others.", "gui_settings_button_save": "Save", "gui_settings_button_cancel": "Cancel", diff --git a/desktop/src/onionshare/tor_settings_dialog.py b/desktop/src/onionshare/tor_settings_dialog.py index 6fa4dda1..adad6931 100644 --- a/desktop/src/onionshare/tor_settings_dialog.py +++ b/desktop/src/onionshare/tor_settings_dialog.py @@ -775,9 +775,15 @@ class TorSettingsDialog(QtWidgets.QDialog): settings.set("tor_bridges_use_snowflake", False) settings.set("tor_bridges_use_moat", True) + + moat_bridges = self.bridge_moat_textbox.toPlainText() + if moat_bridges.strip() == "": + Alert(self.common, strings._("gui_settings_moat_bridges_invalid")) + return False + settings.set( "tor_bridges_use_moat_bridges", - self.bridge_moat_textbox.toPlainText(), + moat_bridges, ) settings.set("tor_bridges_use_custom_bridges", "")