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

Commit dbf844e

Browse files
darkdhdiracdeltas
authored andcommitted
Support isolated_storage and tor_proxy
requires brave/muon#473
1 parent 8094e1d commit dbf844e

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
@@ -908,6 +908,11 @@ const api = {
908908
if (isSessionPartition(createProperties.partition)) {
909909
createProperties.parent_partition = ''
910910
}
911+
if (createProperties.isTor) {
912+
createProperties.isolated_storage = true
913+
createProperties.parent_partition = ''
914+
createProperties.tor_proxy = 'socks5://127.0.0.1:9050'
915+
}
911916
}
912917

913918
// 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
@@ -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)