Skip to content
Snippets Groups Projects
Verified Commit 2cde9fc3 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Bug 30237: Add v3 onion services client authentication prompt

Bug 41844: Stop using the control port directly
parent 66229717
No related branches found
No related tags found
1 merge request!699Bug 41844&40982: Stop using the control port directly and draft a backend for the circuit display and bridge settings
......@@ -7,6 +7,7 @@
XPCOMUtils.defineLazyModuleGetters(this, {
OnionAuthUtil: "chrome://browser/content/onionservices/authUtil.jsm",
CommonUtils: "resource://services-common/utils.js",
TorProtocolService: "resource://gre/modules/TorProtocolService.jsm",
TorStrings: "resource:///modules/TorStrings.jsm",
});
......@@ -192,10 +193,6 @@ const OnionAuthPrompt = (function () {
let controllerFailureMsg =
TorStrings.onionServices.authPrompt.failedToSetKey;
try {
let { controller } = ChromeUtils.import(
"resource://torbutton/modules/tor-control-port.js"
);
let torController = await controller();
// ^(subdomain.)*onionserviceid.onion$ (case-insensitive)
const onionServiceIdRegExp =
/^(.*\.)*(?<onionServiceId>[a-z2-7]{56})\.onion$/i;
......@@ -206,8 +203,7 @@ const OnionAuthPrompt = (function () {
let checkboxElem = this._getCheckboxElement();
let isPermanent = checkboxElem && checkboxElem.checked;
torController
.onionAuthAdd(onionServiceId, base64key, isPermanent)
TorProtocolService.onionAuthAdd(onionServiceId, base64key, isPermanent)
.then(aResponse => {
// Success! Reload the page.
this._browser.sendMessageToActor(
......
......@@ -10,8 +10,8 @@ ChromeUtils.defineModuleGetter(
ChromeUtils.defineModuleGetter(
this,
"controller",
"resource://torbutton/modules/tor-control-port.js"
"TorProtocolService",
"resource://gre/modules/TorProtocolService.jsm"
);
var gOnionServicesSavedKeysDialog = {
......@@ -49,11 +49,9 @@ var gOnionServicesSavedKeysDialog = {
const controllerFailureMsg =
TorStrings.onionServices.authPreferences.failedToRemoveKey;
try {
const torController = await controller();
// Remove in reverse index order to avoid issues caused by index changes.
for (let i = indexesToDelete.length - 1; i >= 0; --i) {
await this._deleteOneKey(torController, indexesToDelete[i]);
await this._deleteOneKey(indexesToDelete[i]);
}
} catch (e) {
if (e.torMessage) {
......@@ -127,8 +125,7 @@ var gOnionServicesSavedKeysDialog = {
try {
this._tree.view = this;
const torController = await controller();
const keyInfoList = await torController.onionAuthViewKeys();
const keyInfoList = await TorProtocolService.onionAuthViewKeys();
if (keyInfoList) {
// Filter out temporary keys.
this._keyInfoList = keyInfoList.filter(aKeyInfo => {
......@@ -165,9 +162,9 @@ var gOnionServicesSavedKeysDialog = {
},
// This method may throw; callers should catch errors.
async _deleteOneKey(aTorController, aIndex) {
async _deleteOneKey(aIndex) {
const keyInfoObj = this._keyInfoList[aIndex];
await aTorController.onionAuthRemove(keyInfoObj.hsAddress);
await TorProtocolService.onionAuthRemove(keyInfoObj.hsAddress);
this._tree.view.selection.clearRange(aIndex, aIndex);
this._keyInfoList.splice(aIndex, 1);
this._tree.rowCountChanged(aIndex + 1, -1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment