aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2021-11-12 11:43:09 +1100
committerMiguel Jacq <mig@mig5.net>2021-11-12 11:43:09 +1100
commitf5e4d70731274be3f4cc3c8ad4c9e1b65ffa0ccc (patch)
treecd5da12915b4e9aa940bc033f23a1eb12bcc79e4 /cli
parentda94b92d1807fd2126f748836c79bcbf38a4c0a4 (diff)
downloadonionshare-f5e4d70731274be3f4cc3c8ad4c9e1b65ffa0ccc.tar.gz
onionshare-f5e4d70731274be3f4cc3c8ad4c9e1b65ffa0ccc.zip
Remove unnecessary censorship class invocation, which breaks CLI mode right now.
Fix Website and Chat modes with auto-stop timer in CLI mode. Add 'poetry run onionshare-cli' tests to CircleCI to catch CLI runtime bugs.
Diffstat (limited to 'cli')
-rw-r--r--cli/onionshare_cli/__init__.py28
1 files changed, 11 insertions, 17 deletions
diff --git a/cli/onionshare_cli/__init__.py b/cli/onionshare_cli/__init__.py
index 4e34a508..1c26b050 100644
--- a/cli/onionshare_cli/__init__.py
+++ b/cli/onionshare_cli/__init__.py
@@ -27,8 +27,6 @@ from datetime import datetime
from datetime import timedelta
from .common import Common, CannotFindTor
-from .censorship import CensorshipCircumvention
-from .meek import Meek, MeekNotRunning
from .web import Web
from .onion import TorErrorProtocolError, TorTooOldEphemeral, TorTooOldStealth, Onion
from .onionshare import OnionShare
@@ -285,20 +283,6 @@ def main(cwd=None):
# Create the Web object
web = Web(common, False, mode_settings, mode)
- # Create the Meek object and start the meek client
- # meek = Meek(common)
- # meek.start()
-
- # Create the CensorshipCircumvention object to make
- # API calls to Tor over Meek
- censorship = CensorshipCircumvention(common, meek)
- # Example: request recommended bridges, pretending to be from China, using
- # domain fronting.
- # censorship_recommended_settings = censorship.request_settings(country="cn")
- # print(censorship_recommended_settings)
- # Clean up the meek subprocess once we're done working with the censorship circumvention API
- # meek.cleanup()
-
# Start the Onion object
try:
onion = Onion(common, use_tmp_dir=True)
@@ -474,12 +458,18 @@ def main(cwd=None):
if app.autostop_timer > 0:
# if the auto-stop timer was set and has run out, stop the server
if not app.autostop_timer_thread.is_alive():
- if mode == "share" or (mode == "website"):
+ if mode == "share":
# If there were no attempts to download the share, or all downloads are done, we can stop
if web.share_mode.cur_history_id == 0 or web.done:
print("Stopped because auto-stop timer ran out")
web.stop(app.port)
break
+ if mode == "website":
+ # If there were no attempts to visit the website, or all downloads are done, we can stop
+ if web.website_mode.cur_history_id == 0 or web.done:
+ print("Stopped because auto-stop timer ran out")
+ web.stop(app.port)
+ break
if mode == "receive":
if (
web.receive_mode.cur_history_id == 0
@@ -489,6 +479,10 @@ def main(cwd=None):
web.stop(app.port)
break
web.receive_mode.can_upload = False
+ if mode == "chat":
+ print("Stopped because auto-stop timer ran out")
+ web.stop(app.port)
+ break
# Allow KeyboardInterrupt exception to be handled with threads
# https://stackoverflow.com/questions/3788208/python-threading-ignores-keyboardinterrupt-exception
time.sleep(0.2)