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

Commit dcfa949

Browse files
darkdhdiracdeltas
authored andcommitted
Support isolated_storage and tor_proxy
requires brave/muon#473
1 parent 6bbf6ab commit dcfa949

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
@@ -1004,6 +1004,11 @@ const api = {
10041004
if (isSessionPartition(createProperties.partition)) {
10051005
createProperties.parent_partition = ''
10061006
}
1007+
if (createProperties.isTor) {
1008+
createProperties.isolated_storage = true
1009+
createProperties.parent_partition = ''
1010+
createProperties.tor_proxy = 'socks5://127.0.0.1:9050'
1011+
}
10071012
}
10081013

10091014
// Tabs are allowed to be initially discarded (unloaded) if they are regular tabs

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
@@ -662,6 +662,7 @@ function initTor (ses, partition) {
662662
let proxyconfig = {
663663
proxyRules: 'socks5://127.0.0.1:9050,direct://'
664664
}
665+
// darkdh to diracdeltas: this can be deleted because it is covered by "tor_proxy"
665666
ses.setProxy(proxyconfig, () => {
666667
// Make a request to check.torproject.org to ensure that proxying works
667668
console.log('checking for Tor proxy')
@@ -723,6 +724,11 @@ const initPartition = (partition) => {
723724
if (isSessionPartition(partition)) {
724725
options.parent_partition = ''
725726
}
727+
if (partition === 'persist:tor') {
728+
options.isolated_storage = true
729+
options.parent_partition = ''
730+
options.tor_proxy = 'socks5://127.0.0.1:9050'
731+
}
726732

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

0 commit comments

Comments
 (0)