From 1f9d40348abd5ca6a58ec938250b2c6d5bd4081d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Sat, 23 Mar 2019 10:32:55 +0100 Subject: [PATCH] Open additional URLs with the same TorBrowser instance When we looked at the history of issues about opening links with TorBrowser, we found #103 where initially the feature to open links from other applications was added. Then some months later, the feature was removed again, as it was not working because of #157 and #175. The issues was back then (~4years ago), that when users had a normal Firefox running, urls got opened in the normal firefox insead of TorBrowser. That was because TorBrowser had the --no-remote flag set deep down in their code. In the meanwhile TorBrowser removed the explicit --no-remote flag, so we are able to use --allow-remote again. On top of that there is another issue when we want open urls with TorBrowser: If the LOGNAME is the same as the LOGNAME of the opened firefox, urls are still opened in the open firefox. But if we set the LOGNAME envrionment variable explicitly, we can make sure, that the url opens in the TorBrowser instead of a running Firefox. Should fix: #245, #259, #380 --- torbrowser_launcher/launcher.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/torbrowser_launcher/launcher.py b/torbrowser_launcher/launcher.py index efcd1c84..1bbe0193 100644 --- a/torbrowser_launcher/launcher.py +++ b/torbrowser_launcher/launcher.py @@ -433,7 +433,9 @@ def run(self): return # Run Tor Browser - subprocess.call([self.common.paths['tbb']['start']], cwd=self.common.paths['tbb']['dir_tbb']) + my_env = os.environ.copy() + my_env['LOGNAME'] = "torbrowserbundleuser" + subprocess.call([self.common.paths['tbb']['start'], '--allow-remote', self.url_list], cwd=self.common.paths['tbb']['dir_tbb'], env=my_env) sys.exit(0) # Start over and download TBB again