commit 8d9d6c3aab4dd3aa2b7de6addbdcf6fb9a8716a9 Author: Sukhbir Singh sukhbir@torproject.org Date: Sun May 10 14:34:24 2015 -0400
Improve the patch for #13855 (known onions for XMPP servers)
- Separate the patches for JS, XUL and locale files - Be more verbose that we are are forcing the use of onion addresses for known XMPP servers in accountWizard.js --- projects/instantbird/config | 6 +- projects/instantbird/xmpp-onion-js.patch | 85 ++++++++++++++++++++ projects/instantbird/xmpp-onion-locale.patch | 10 +++ projects/instantbird/xmpp-onion-xul.patch | 31 ++++++++ projects/instantbird/xmpp-onion.patch | 107 -------------------------- 5 files changed, 130 insertions(+), 109 deletions(-)
diff --git a/projects/instantbird/config b/projects/instantbird/config index 38a3deb..af90ba1 100644 --- a/projects/instantbird/config +++ b/projects/instantbird/config @@ -69,9 +69,11 @@ input_files: - filename: cert_override.txt - filename: ctcp-time.patch - filename: ctcp-ping.patch - - filename: xmpp-onion.patch - - filename: xmpp-resource.patch - filename: xmpp-domain.patch + - filename: xmpp-resource.patch + - filename: xmpp-onion-js.patch + - filename: xmpp-onion-xul.patch + - filename: xmpp-onion-locale.patch - filename: xmpp-username-split.patch - filename: version.patch - filename: branding/name.patch diff --git a/projects/instantbird/xmpp-onion-js.patch b/projects/instantbird/xmpp-onion-js.patch new file mode 100644 index 0000000..54339ac --- /dev/null +++ b/projects/instantbird/xmpp-onion-js.patch @@ -0,0 +1,85 @@ +diff --git a/im/content/accountWizard.js b/im/content/accountWizard.js +index 707f1c7..2ca929a 100644 +--- a/im/content/accountWizard.js ++++ b/im/content/accountWizard.js +@@ -7,6 +7,14 @@ Cu.import("resource:///modules/imServices.jsm"); + + const PREF_EXTENSIONS_GETMOREPROTOCOLSURL = "extensions.getMoreProtocolsURL"; + ++// Borrowed and inspired by xmpp-client. ++const kServerOnions = { ++ "riseup.net": "4cjw6cwpeaeppfqz.onion", ++ "jabber.ccc.de": "okj7xc6j2szr2y75.onion", ++ "jabber.otr.im": "5rgdtlawqkcplz75.onion", ++ "jabber.calyxinstitute.org": "ijeeynrc6x2uy5ob.onion", ++} ++ + var accountWizard = { + onload: function aw_onload() { + let topProtoList = document.getElementById("topprotolist"); +@@ -105,6 +113,21 @@ var accountWizard = { + return textbox; + }, + ++ insertOnionAddress: function aw_insertOnionAddress() { ++ // Currently, we only use onion addresses for XMPP. ++ if (this.proto.id == "prpl-jabber") { ++ // If the value of the domain is one for which there exists a ++ // hidden service, replace the address with the onion address. ++ this.jabberDomain = document.getElementById("username-split-0"); ++ if (this.jabberDomain.value in kServerOnions) { ++ this.onionAddress = kServerOnions[this.jabberDomain.value]; ++ } ++ else { ++ this.onionAddress = ""; ++ } ++ } ++ }, ++ + showUsernamePage: function aw_showUsernamePage() { + let proto = this.proto.id; + if ("userNameBoxes" in this && this.userNameProto == proto) { +@@ -160,11 +183,20 @@ var accountWizard = { + document.getElementById("accountusername").next = next; + }, + ++ setOnionAddress: function aw_setOnionAddress() { ++ if (this.proto.id == "prpl-jabber") { ++ document.getElementById("prpl-jabber-server").value = this.onionAddress; ++ } ++ }, ++ + showAdvanced: function aw_showAdvanced() { + // ensure we don't destroy user data if it's not necessary + let id = this.proto.id; +- if ("protoSpecOptId" in this && this.protoSpecOptId == id) ++ if ("protoSpecOptId" in this && this.protoSpecOptId == id) { ++ // But we should still set the onion address, if it exists. ++ this.setOnionAddress(); + return; ++ } + this.protoSpecOptId = id; + + /* FIXME +@@ -172,6 +204,7 @@ var accountWizard = { + !this.proto.newMailNotification; + */ + this.populateProtoSpecificBox(); ++ this.setOnionAddress(); + + let proxyVisible = this.proto.usePurpleProxy; + if (proxyVisible) { +@@ -407,6 +440,13 @@ var accountWizard = { + let label = bundle.getFormattedString("accountColon", [opt.opt.label]); + rows.appendChild(this.createSummaryRow(label, opt.value)); + } ++ ++ if (this.onionAddress) { ++ let onionLabel = document.getElementById("topProtocolsBundle"); ++ let onion = document.getElementById("onionAddress"); ++ onion.value = onionLabel.getFormattedString("onionAddress.label", ++ [this.jabberDomain.value, this.onionAddress]); ++ } + }, + + createAccount: function aw_createAccount() { diff --git a/projects/instantbird/xmpp-onion-locale.patch b/projects/instantbird/xmpp-onion-locale.patch new file mode 100644 index 0000000..a04fe94 --- /dev/null +++ b/projects/instantbird/xmpp-onion-locale.patch @@ -0,0 +1,10 @@ +diff --git a/im/locales/en-US/chrome/instantbird/accountWizard.properties b/im/locales/en-US/chrome/instantbird/accountWizard.properties +index 77dd6dd..7ee9bce 100644 +--- a/im/locales/en-US/chrome/instantbird/accountWizard.properties ++++ b/im/locales/en-US/chrome/instantbird/accountWizard.properties +@@ -19,3 +19,5 @@ topProtocol.prpl-twitter.description=Stay up to date with your Twitter timeline + topProtocol.prpl-aim.description=Chat with your buddies on AOL Instant Messenger + topProtocol.prpl-msn.description=Microsoft Windows Live Messenger (formerly MSN) + topProtocol.prpl-yahoo.description=Chat with friends using Yahoo! Messenger ++ ++onionAddress.label=We will secure your connection to %S by connecting to %S. diff --git a/projects/instantbird/xmpp-onion-xul.patch b/projects/instantbird/xmpp-onion-xul.patch new file mode 100644 index 0000000..9547d75 --- /dev/null +++ b/projects/instantbird/xmpp-onion-xul.patch @@ -0,0 +1,31 @@ +diff --git a/im/content/accountWizard.xul b/im/content/accountWizard.xul +index 5fa5b82..d9ce335 100644 +--- a/im/content/accountWizard.xul ++++ b/im/content/accountWizard.xul +@@ -59,7 +59,8 @@ + label="&accountUsernameTitle.label;" + onpageshow="accountWizard.showUsernamePage();" + onpagehide="accountWizard.hideUsernamePage();" +- onpagerewound="return accountWizard.rewindFromUsernamePage();"> ++ onpagerewound="return accountWizard.rewindFromUsernamePage();" ++ onpageadvanced="return accountWizard.insertOnionAddress();"> + <description id="usernameInfo"/> + <separator/> + <vbox id="userNameBox"/> +@@ -98,7 +99,7 @@ + <checkbox id="newMailNotification" + label="&accountAdvanced.newMailNotification.label;" hidden="true"/> + +- <groupbox id="protoSpecificGroupbox" class="collapsable" closed="true" ++ <groupbox id="protoSpecificGroupbox" class="collapsable" closed="false" + onkeypress="accountWizard.onGroupboxKeypress(event)"> + <caption id="protoSpecificCaption" + onclick="accountWizard.toggleGroupbox('protoSpecificGroupbox')"/> +@@ -137,6 +138,7 @@ + </columns> + <rows id="summaryRows"/> + </grid> ++ <description id="onionAddress" /> + <separator/> + <checkbox id="connectAutomatically" label= "&accountSummary.connectAutomatically.label;" checked="true"/> + </wizardpage> diff --git a/projects/instantbird/xmpp-onion.patch b/projects/instantbird/xmpp-onion.patch deleted file mode 100644 index 46a1a76..0000000 --- a/projects/instantbird/xmpp-onion.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 6bd2fc6cbc618e8fcd38411854da2527556e0114 Mon Sep 17 00:00:00 2001 -From: Sukhbir Singh sukhbir@torproject.org -Date: Fri, 8 May 2015 10:19:31 -0400 -Subject: [PATCH] Use onion addresses for known XMPP servers (#13855) - ---- - im/content/accountWizard.js | 35 ++++++++++++++++++++++++++++++++++- - im/content/accountWizard.xul | 5 +++-- - 2 files changed, 37 insertions(+), 3 deletions(-) - -diff --git a/im/content/accountWizard.js b/im/content/accountWizard.js -index 707f1c7..e763165 100644 ---- a/im/content/accountWizard.js -+++ b/im/content/accountWizard.js -@@ -7,6 +7,14 @@ Cu.import("resource:///modules/imServices.jsm"); - - const PREF_EXTENSIONS_GETMOREPROTOCOLSURL = "extensions.getMoreProtocolsURL"; - -+// Borrowed and inspired by xmpp-client. -+const kServerOnions = { -+ "riseup.net": "4cjw6cwpeaeppfqz.onion", -+ "jabber.ccc.de": "okj7xc6j2szr2y75.onion", -+ "jabber.otr.im": "5rgdtlawqkcplz75.onion", -+ "jabber.calyxinstitute.org": "ijeeynrc6x2uy5ob.onion", -+} -+ - var accountWizard = { - onload: function aw_onload() { - let topProtoList = document.getElementById("topprotolist"); -@@ -105,6 +113,21 @@ var accountWizard = { - return textbox; - }, - -+ insertOnionAddress: function aw_insertOnionAddress() { -+ // Currently, we only use onion addresses for XMPP. -+ if (this.proto.id == "prpl-jabber") { -+ // If the value of the domain is one for which there exists a -+ // hidden service, replace the address with the onion address. -+ let jabberDomain = document.getElementById("username-split-0"); -+ if (jabberDomain.value in kServerOnions) { -+ this.onionAddress = kServerOnions[jabberDomain.value]; -+ } -+ else { -+ this.onionAddress = ""; -+ } -+ } -+ }, -+ - showUsernamePage: function aw_showUsernamePage() { - let proto = this.proto.id; - if ("userNameBoxes" in this && this.userNameProto == proto) { -@@ -160,11 +183,20 @@ var accountWizard = { - document.getElementById("accountusername").next = next; - }, - -+ setOnionAddress: function aw_setOnionAddress() { -+ if (this.proto.id == "prpl-jabber") { -+ document.getElementById("prpl-jabber-server").value = this.onionAddress; -+ } -+ }, -+ - showAdvanced: function aw_showAdvanced() { - // ensure we don't destroy user data if it's not necessary - let id = this.proto.id; -- if ("protoSpecOptId" in this && this.protoSpecOptId == id) -+ if ("protoSpecOptId" in this && this.protoSpecOptId == id) { -+ // But we should still set the onion address, if it exists. -+ this.setOnionAddress(); - return; -+ } - this.protoSpecOptId = id; - - /* FIXME -@@ -172,6 +204,7 @@ var accountWizard = { - !this.proto.newMailNotification; - */ - this.populateProtoSpecificBox(); -+ this.setOnionAddress(); - - let proxyVisible = this.proto.usePurpleProxy; - if (proxyVisible) { -diff --git a/im/content/accountWizard.xul b/im/content/accountWizard.xul -index 5fa5b82..89f88fe 100644 ---- a/im/content/accountWizard.xul -+++ b/im/content/accountWizard.xul -@@ -59,7 +59,8 @@ - label="&accountUsernameTitle.label;" - onpageshow="accountWizard.showUsernamePage();" - onpagehide="accountWizard.hideUsernamePage();" -- onpagerewound="return accountWizard.rewindFromUsernamePage();"> -+ onpagerewound="return accountWizard.rewindFromUsernamePage();" -+ onpageadvanced="return accountWizard.insertOnionAddress();"> - <description id="usernameInfo"/> - <separator/> - <vbox id="userNameBox"/> -@@ -98,7 +99,7 @@ - <checkbox id="newMailNotification" - label="&accountAdvanced.newMailNotification.label;" hidden="true"/> - -- <groupbox id="protoSpecificGroupbox" class="collapsable" closed="true" -+ <groupbox id="protoSpecificGroupbox" class="collapsable" closed="false" - onkeypress="accountWizard.onGroupboxKeypress(event)"> - <caption id="protoSpecificCaption" - onclick="accountWizard.toggleGroupbox('protoSpecificGroupbox')"/> --- -2.1.4 -
tor-commits@lists.torproject.org