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

Commit 9ead2f1

Browse files
darkdhdiracdeltas
authored andcommitted
Set Tor new identify
fix #12997 requires brave/muon@7e052dd Auditors: @bridiver, @diracdeltas
1 parent 55dace2 commit 9ead2f1

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

app/common/commonMenu.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ module.exports.newTorIdentityMenuItem = () => {
108108
return {
109109
label: locale.translation('newTorIdentity'),
110110
click: function (item, focusedWindow) {
111-
// TODO
112-
},
113-
enabled: false
111+
appActions.setTorNewIdentity()
112+
}
114113
}
115114
}
116115

app/filtering.js

+9
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,15 @@ module.exports.checkTorAvailable = () => {
698698
}, 500)
699699
}
700700

701+
module.exports.setTorNewIdentity = (url) => {
702+
const origin = getOrigin(url)
703+
const ses = session.fromPartition('persist:tor')
704+
if (!ses || !origin) {
705+
return
706+
}
707+
ses.setTorNewIdentity(origin)
708+
}
709+
701710
function initSession (ses, partition) {
702711
registeredSessions[partition] = ses
703712
ses.setEnableBrotli(true)

js/actions/appActions.js

+6
Original file line numberDiff line numberDiff line change
@@ -1920,6 +1920,12 @@ const appActions = {
19201920
dispatch({
19211921
actionType: appConstants.APP_CHECK_TOR_AVAILABLE
19221922
})
1923+
},
1924+
1925+
setTorNewIdentity: function () {
1926+
dispatch({
1927+
actionType: appConstants.APP_SET_TOR_NEW_IDENTITY
1928+
})
19231929
}
19241930
}
19251931

js/constants/appConstants.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ const appConstants = {
193193
APP_ON_PRUNE_SYNOPSIS: _,
194194
APP_ON_HISTORY_LIMIT: _,
195195
APP_ON_LEDGER_MEDIA_PUBLISHER: _,
196-
APP_CHECK_TOR_AVAILABLE: _
196+
APP_CHECK_TOR_AVAILABLE: _,
197+
APP_SET_TOR_NEW_IDENTITY: _
197198
}
198199

199200
module.exports = mapValuesByKeys(appConstants)

js/stores/appStore.js

+6
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ const handleAppAction = (action) => {
368368
case appConstants.APP_CHECK_TOR_AVAILABLE:
369369
filtering.checkTorAvailable()
370370
break
371+
case appConstants.APP_SET_TOR_NEW_IDENTITY:
372+
const activeTab = tabState.getActiveTab(appState)
373+
if (activeTab) {
374+
filtering.setTorNewIdentity(activeTab.get('url'))
375+
}
376+
break
371377
case appConstants.APP_ON_CLEAR_BROWSING_DATA:
372378
const defaults = appState.get('clearBrowsingDataDefaults')
373379
const temp = appState.get('tempClearBrowsingData', Immutable.Map())

0 commit comments

Comments
 (0)