Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit b28c006

Browse files
committed
Support isolated_storage and tor_proxy
requires brave/muon#473
1 parent fe64a2a commit b28c006

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

app/browser/tabs.js

+5
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,11 @@ const api = {
914914
if (isSessionPartition(createProperties.partition)) {
915915
createProperties.parent_partition = ''
916916
}
917+
if (createProperties.isTor) {
918+
createProperties.isolated_storage = true
919+
createProperties.parent_partition = ''
920+
createProperties.tor_proxy = 'socks5://127.0.0.1:9050'
921+
}
917922
}
918923
if (!isAutoDiscardable(createProperties)) {
919924
createProperties.discarded = false

app/common/commonMenu.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ module.exports.newTorIdentityMenuItem = () => {
108108
label: locale.translation('newTorIdentity'),
109109
click: function (item, focusedWindow) {
110110
// XXX new tor circuits
111-
let torSession = electron.session.fromPartition('tor')
111+
let torSession = electron.session.fromPartition('persist:tor')
112112
torSession.clearCache(() => { console.log('cleared tor cache') })
113113
torSession.clearStorageData({}, () => {
114114
console.log('cleared tor storage')

app/filtering.js

+6
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ function initTor (ses, partition) {
659659
let proxyconfig = {
660660
proxyRules: 'socks5://127.0.0.1:9050,direct://'
661661
}
662+
// darkdh to diracdeltas: this can be deleted because it is covered by "tor_proxy"
662663
ses.setProxy(proxyconfig, () => {
663664
// Make a request to check.torproject.org to ensure that proxying works
664665
console.log('checking for Tor proxy')
@@ -720,6 +721,11 @@ const initPartition = (partition) => {
720721
if (isSessionPartition(partition)) {
721722
options.parent_partition = ''
722723
}
724+
if (partition === 'persist:tor') {
725+
options.isolated_storage = true
726+
options.parent_partition = ''
727+
options.tor_proxy = 'socks5://127.0.0.1:9050'
728+
}
723729

724730
let ses = session.fromPartition(partition, options)
725731
fns.forEach((fn) => {

0 commit comments

Comments
 (0)