Skip to content
Snippets Groups Projects
Commit de99682d authored by Richard Pospesel's avatar Richard Pospesel
Browse files

Bug 40597: Implement TorSettings module

- migrated in-page settings read/write implementation from about:preferences#tor
  to the TorSettings module
- TorSettings initially loads settings from the tor daemon, and saves them to
  firefox prefs
- TorSettings notifies observers when a setting has changed; currently only
  QuickStart notification is implemented for parity with previous preference
  notify logic in about:torconnect and about:preferences#tor
- about:preferences#tor, and about:torconnect now read and write settings
  thorugh the TorSettings module
- all tor settings live in the torbrowser.settings.* preference branch
- removed unused pref modify permission for about:torconnect content page from
  AsyncPrefs.jsm

Bug 40645: Migrate Moat APIs to Moat.jsm module
parent b5babfee
No related branches found
No related tags found
1 merge request!545Rebase tor-browser to esr102.8
"use strict";
var EXPORTED_SYMBOLS = ["BridgeDB"];
const { MoatRPC } = ChromeUtils.import("resource:///modules/Moat.jsm");
var BridgeDB = {
_moatRPC: null,
_challenge: null,
_image: null,
_bridges: null,
get currentCaptchaImage() {
return this._image;
},
get currentBridges() {
return this._bridges;
},
async submitCaptchaGuess(solution) {
if (!this._moatRPC) {
this._moatRPC = new MoatRPC();
await this._moatRPC.init();
}
const response = await this._moatRPC.check(
"obfs4",
this._challenge,
solution,
false
);
this._bridges = response?.bridges;
return this._bridges;
},
async requestNewCaptchaImage() {
try {
if (!this._moatRPC) {
this._moatRPC = new MoatRPC();
await this._moatRPC.init();
}
const response = await this._moatRPC.fetch(["obfs4"]);
this._challenge = response.challenge;
this._image =
"data:image/jpeg;base64," + encodeURIComponent(response.image);
} catch (err) {
console.error("Could not request a captcha image", err);
}
return this._image;
},
close() {
this._moatRPC?.uninit();
this._moatRPC = null;
this._challenge = null;
this._image = null;
this._bridges = null;
},
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -121,6 +121,7 @@ EXTRA_JS_MODULES += [
"AboutNewTab.jsm",
"AppUpdater.jsm",
"AsyncTabSwitcher.jsm",
"BridgeDB.jsm",
"BrowserUIUtils.jsm",
"BrowserUsageTelemetry.jsm",
"BrowserWindowTracker.jsm",
......@@ -131,6 +132,7 @@ EXTRA_JS_MODULES += [
"FaviconLoader.jsm",
"HomePage.jsm",
"LaterRun.jsm",
'Moat.jsm',
"NewTabPagePreloading.jsm",
"OpenInTabsUtils.jsm",
"PageActions.jsm",
......@@ -144,6 +146,8 @@ EXTRA_JS_MODULES += [
"SitePermissions.jsm",
"TabsList.jsm",
"TabUnloader.jsm",
"TorConnect.jsm",
"TorSettings.jsm",
"TransientPrefs.jsm",
"webrtcUI.jsm",
"ZoomUI.jsm",
......
......@@ -22,6 +22,17 @@ ChromeUtils.defineModuleGetter(
"resource://gre/modules/TorProtocolService.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"TorConnect",
"resource:///modules/TorConnect.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"TorSettings",
"resource:///modules/TorSettings.jsm"
);
/* Browser observer topis */
const BrowserTopics = Object.freeze({
ProfileAfterChange: "profile-after-change",
......@@ -53,6 +64,9 @@ class TorStartupService {
await TorProtocolService.init();
TorMonitorService.init();
TorSettings.init();
TorConnect.init();
gInited = true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment