commit cadb8010cd190626dbe28100943990c3e2036d74 Author: Arturo Filastò arturo@filasto.net Date: Fri Oct 14 10:35:11 2016 +0200
Point to the correct web UI URL when calling ooniprobe -w (#625)
This fixes #623 --- ooni/scripts/ooniprobe.py | 12 ++++++------ ooni/scripts/ooniprobe_agent.py | 4 +--- ooni/settings.py | 7 +++++++ 3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/ooni/scripts/ooniprobe.py b/ooni/scripts/ooniprobe.py index c8ffee2..e8b9af4 100644 --- a/ooni/scripts/ooniprobe.py +++ b/ooni/scripts/ooniprobe.py @@ -13,19 +13,19 @@ def ooniprobe(reactor): if global_options['queue']: return runWithDaemonDirector(global_options)
- if global_options['initialize']: - initializeOoniprobe(global_options) - return defer.succeed(None) - if global_options['web-ui']: - from ooni.scripts.ooniprobe_agent import WEB_UI_URL + from ooni.settings import config from ooni.scripts.ooniprobe_agent import status_agent, start_agent if status_agent() != 0: p = Process(target=start_agent) p.start() p.join() print("Started ooniprobe-agent") - webbrowser.open_new(WEB_UI_URL) + webbrowser.open_new(config.web_ui_url) + return defer.succeed(None) + + if global_options['initialize']: + initializeOoniprobe(global_options) return defer.succeed(None)
return runWithDirector(global_options) diff --git a/ooni/scripts/ooniprobe_agent.py b/ooni/scripts/ooniprobe_agent.py index d7f4750..c7987d0 100644 --- a/ooni/scripts/ooniprobe_agent.py +++ b/ooni/scripts/ooniprobe_agent.py @@ -94,9 +94,7 @@ def start_agent(options=None): pass
print("Starting ooniprobe agent.") - WEB_UI_URL = "http://%7B0%7D:%7B1%7D%22.format( - config.advanced.webui_address, config.advanced.webui_port) - print("To view the GUI go to %s" % WEB_UI_URL) + print("To view the GUI go to %s" % config.web_ui_url) log.start() twistd.runApp(twistd_config) return 0 diff --git a/ooni/settings.py b/ooni/settings.py index b4bb594..44bd8dc 100644 --- a/ooni/settings.py +++ b/ooni/settings.py @@ -318,6 +318,13 @@ class OConfig(object): else: return os.path.join(home, '.ooni')
+ @property + def web_ui_url(self): + return "http://%7B0%7D:%7B1%7D%22.format( + self.advanced.webui_address, + self.advanced.webui_port + ) + def get_data_file_path(self, file_name): for target_dir in self.data_directory_candidates: file_path = os.path.join(target_dir, file_name)
tor-commits@lists.torproject.org