summaryrefslogtreecommitdiff
path: root/onionshare
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2019-03-25 13:43:08 +1100
committerMiguel Jacq <mig@mig5.net>2019-03-25 13:43:08 +1100
commit49285e047c43d97bf9c87a00859ecf74685f9228 (patch)
treef86e3e288bea43a80115f89c2b945e519787067b /onionshare
parentbd774ab448c37cad19f29f69eeb3ae30be1c3f73 (diff)
parentc1023647d1850c64a20514721d4397ff3c360671 (diff)
downloadonionshare-49285e047c43d97bf9c87a00859ecf74685f9228.tar.gz
onionshare-49285e047c43d97bf9c87a00859ecf74685f9228.zip
Fix conflicts
Diffstat (limited to 'onionshare')
-rw-r--r--onionshare/__init__.py4
-rw-r--r--onionshare/onion.py16
-rw-r--r--onionshare/web/receive_mode.py13
3 files changed, 20 insertions, 13 deletions
diff --git a/onionshare/__init__.py b/onionshare/__init__.py
index 8f6ca227..616cf9db 100644
--- a/onionshare/__init__.py
+++ b/onionshare/__init__.py
@@ -57,6 +57,7 @@ def main(cwd=None):
parser.add_argument('--stay-open', action='store_true', dest='stay_open', help=strings._("help_stay_open"))
parser.add_argument('--autostart-timer', metavar='<int>', dest='autostart_timer', default=0, help=strings._("help_autostart_timer"))
parser.add_argument('--autostop-timer', metavar='<int>', dest='autostop_timer', default=0, help=strings._("help_autostop_timer"))
+ parser.add_argument('--connect-timeout', metavar='<int>', dest='connect_timeout', default=120, help=strings._("help_connect_timeout"))
parser.add_argument('--stealth', action='store_true', dest='stealth', help=strings._("help_stealth"))
parser.add_argument('--receive', action='store_true', dest='receive', help=strings._("help_receive"))
parser.add_argument('--config', metavar='config', default=False, help=strings._('help_config'))
@@ -73,6 +74,7 @@ def main(cwd=None):
stay_open = bool(args.stay_open)
autostart_timer = int(args.autostart_timer)
autostop_timer = int(args.autostop_timer)
+ connect_timeout = int(args.connect_timeout)
stealth = bool(args.stealth)
receive = bool(args.receive)
config = args.config
@@ -115,7 +117,7 @@ def main(cwd=None):
# Start the Onion object
onion = Onion(common)
try:
- onion.connect(custom_settings=False, config=config)
+ onion.connect(custom_settings=False, config=config, connect_timeout=connect_timeout)
except KeyboardInterrupt:
print("")
sys.exit()
diff --git a/onionshare/onion.py b/onionshare/onion.py
index 8d4e50a0..51336df9 100644
--- a/onionshare/onion.py
+++ b/onionshare/onion.py
@@ -154,7 +154,7 @@ class Onion(object):
# Start out not connected to Tor
self.connected_to_tor = False
- def connect(self, custom_settings=False, config=False, tor_status_update_func=None):
+ def connect(self, custom_settings=False, config=False, tor_status_update_func=None, connect_timeout=120):
self.common.log('Onion', 'connect')
# Either use settings that are passed in, or use them from common
@@ -285,14 +285,16 @@ class Onion(object):
if self.settings.get('tor_bridges_use_custom_bridges') or \
self.settings.get('tor_bridges_use_obfs4') or \
self.settings.get('tor_bridges_use_meek_lite_azure'):
- connect_timeout = 150
- else:
- # Timeout after 120 seconds
- connect_timeout = 120
+ # Only override timeout if a custom timeout has not been passed in
+ if connect_timeout == 120:
+ connect_timeout = 150
if time.time() - start_ts > connect_timeout:
print("")
- self.tor_proc.terminate()
- raise BundledTorTimeout(strings._('settings_error_bundled_tor_timeout'))
+ try:
+ self.tor_proc.terminate()
+ raise BundledTorTimeout(strings._('settings_error_bundled_tor_timeout'))
+ except FileNotFoundError:
+ pass
elif self.settings.get('connection_type') == 'automatic':
# Automatically try to guess the right way to connect to Tor Browser
diff --git a/onionshare/web/receive_mode.py b/onionshare/web/receive_mode.py
index d6ef86ad..dcf69a96 100644
--- a/onionshare/web/receive_mode.py
+++ b/onionshare/web/receive_mode.py
@@ -112,12 +112,14 @@ class ReceiveModeWeb(object):
else:
flash(msg, 'info')
else:
+ msg = 'Sent '
for filename in filenames:
- msg = 'Sent {}'.format(filename)
- if ajax:
- info_flashes.append(msg)
- else:
- flash(msg, 'info')
+ msg += '{}, '.format(filename)
+ msg = msg.rstrip(', ')
+ if ajax:
+ info_flashes.append(msg)
+ else:
+ flash(msg, 'info')
if self.can_upload:
if ajax:
@@ -297,6 +299,7 @@ class ReceiveModeRequest(Request):
new_receive_mode_dir = '{}-{}'.format(self.receive_mode_dir, i)
try:
os.makedirs(new_receive_mode_dir, 0o700, exist_ok=False)
+ self.receive_mode_dir = new_receive_mode_dir
break
except OSError:
pass