Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #538 from brave/tor_path
Browse files Browse the repository at this point in the history
Custom tor-path, to be set from browser-laptop
  • Loading branch information
darkdh authored Mar 15, 2018
2 parents a7e7661 + a51d137 commit 9775ca9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions atom/browser/api/atom_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ mate::Handle<api::Session> SessionFromOptions(v8::Isolate* isolate,
if (options.Get("tor_proxy", &tor_proxy)) {
session_options.SetString("tor_proxy", tor_proxy);
}
std::string tor_path;
if (options.Get("tor_path", &tor_path)) {
session_options.SetString("tor_path", tor_path);
}
session = Session::FromPartition(isolate, partition, session_options);
} else {
// Use the default session if not specified.
Expand Down
10 changes: 6 additions & 4 deletions brave/browser/brave_browser_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,15 @@ BraveBrowserContext::BraveBrowserContext(
}

std::string tor_proxy;
std::string tor_path;
if (options.GetString("tor_proxy", &tor_proxy)) {
tor_proxy_ = GURL(tor_proxy);
if (!tor_process_.IsValid()) {
base::FilePath tor("/usr/local/bin/tor");
base::CommandLine cmdline(tor);
tor_process_ = base::LaunchProcess(cmdline, base::LaunchOptions());
if (options.GetString("tor_path", &tor_path)) {
base::FilePath tor(tor_path);
base::CommandLine cmdline(tor);
tor_process_ = base::LaunchProcess(cmdline, base::LaunchOptions());
}
}
}

Expand Down Expand Up @@ -858,4 +861,3 @@ AtomBrowserContext* AtomBrowserContext::From(
}

} // namespace atom

3 changes: 2 additions & 1 deletion lib/browser/api/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ const createTab = function (createProperties, cb) {
ses = session.fromPartition(createProperties.partition, {
parent_partition: createProperties.parent_partition,
isolated_storage: createProperties.isolated_storage,
tor_proxy: createProperties.tor_proxy
tor_proxy: createProperties.tor_proxy,
tor_path: createProperties.tor_path
})
// don't pass the partition info through
delete createProperties.partition
Expand Down

0 comments on commit 9775ca9

Please sign in to comment.