[Tor] Treat .onion sites whose protocol is HTTP as if it was HTTPS.

This commit is contained in:
hackademix 2019-10-27 21:33:21 +00:00
parent b1733d4392
commit ad5f6b1786
3 changed files with 12 additions and 3 deletions

View File

@ -92,6 +92,8 @@ var Settings = {
// Tor Browser-specific settings // Tor Browser-specific settings
ns.defaults.local.isTorBrowser = true; // prevents reset from forgetting ns.defaults.local.isTorBrowser = true; // prevents reset from forgetting
ns.defaults.sync.cascadeRestrictions = true; // we want this to be the default even on reset ns.defaults.sync.cascadeRestrictions = true; // we want this to be the default even on reset
Sites.onionSecure = true;
if (!this.gotTorBrowserInit) { if (!this.gotTorBrowserInit) {
// First initialization message from the Tor Browser // First initialization message from the Tor Browser
this.gotTorBrowserInit = true; this.gotTorBrowserInit = true;

View File

@ -65,6 +65,9 @@ var {Permissions, Policy, Sites} = (() => {
} }
} }
if (url) { if (url) {
if (Sites.onionSecure && url.protocol === "http:" && url.hostname.endsWith(".onion")) {
url.protocol = "https:";
}
let path = url.pathname; let path = url.pathname;
siteKey = url.origin; siteKey = url.origin;
if (siteKey === "null") { if (siteKey === "null") {

View File

@ -38,11 +38,15 @@ var UI = (() => {
UI.xssUserChoices = m.xssUserChoices; UI.xssUserChoices = m.xssUserChoices;
UI.local = m.local; UI.local = m.local;
UI.sync = m.sync; UI.sync = m.sync;
if (UI.local && !UI.local.debug) {
if (UI.local) {
if (!UI.local.debug) {
debug = () => {}; // be quiet! debug = () => {}; // be quiet!
} }
if (UI.local) {
document.documentElement.classList.toggle("tor", !!UI.local.isTorBrowser); document.documentElement.classList.toggle("tor", !!UI.local.isTorBrowser);
if (UI.local.isTorBrowser) {
Sites.onionSecure = true;
}
} }
resolve(); resolve();
if (UI.onSettings) UI.onSettings(); if (UI.onSettings) UI.onSettings();