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

Commit

Permalink
Support isolated_storage and tor_proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh authored and diracdeltas committed Feb 6, 2018
1 parent 8094e1d commit dbf844e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/browser/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,11 @@ const api = {
if (isSessionPartition(createProperties.partition)) {
createProperties.parent_partition = ''
}
if (createProperties.isTor) {
createProperties.isolated_storage = true
createProperties.parent_partition = ''
createProperties.tor_proxy = 'socks5://127.0.0.1:9050'
}
}

// Tabs are allowed to be initially discarded (unloaded) if they are regular tabs
Expand Down
2 changes: 1 addition & 1 deletion app/common/commonMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module.exports.newTorIdentityMenuItem = () => {
label: locale.translation('newTorIdentity'),
click: function (item, focusedWindow) {
// XXX new tor circuits
let torSession = electron.session.fromPartition('tor')
let torSession = electron.session.fromPartition('persist:tor')
torSession.clearCache(() => { console.log('cleared tor cache') })
torSession.clearStorageData({}, () => {
console.log('cleared tor storage')
Expand Down
6 changes: 6 additions & 0 deletions app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ function initTor (ses, partition) {
let proxyconfig = {
proxyRules: 'socks5://127.0.0.1:9050,direct://'
}
// darkdh to diracdeltas: this can be deleted because it is covered by "tor_proxy"
ses.setProxy(proxyconfig, () => {
// Make a request to check.torproject.org to ensure that proxying works
console.log('checking for Tor proxy')
Expand Down Expand Up @@ -720,6 +721,11 @@ const initPartition = (partition) => {
if (isSessionPartition(partition)) {
options.parent_partition = ''
}
if (partition === 'persist:tor') {
options.isolated_storage = true
options.parent_partition = ''
options.tor_proxy = 'socks5://127.0.0.1:9050'
}

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

0 comments on commit dbf844e

Please sign in to comment.