This commit is contained in:
Dan Mills 2008-06-26 17:28:46 -07:00
Родитель 78b08a1f36 e8b81ae67e
Коммит 0c712a5965
6 изменённых файлов: 127 добавлений и 172 удалений

Просмотреть файл

@ -2,78 +2,79 @@
<!ENTITY intro.title "Welcome to Weave">
<!ENTITY intro-weave.description "Weave is an experimental prototype from Mozilla Labs that integrates online services with Firefox. ">
<!ENTITY intro-more.label "Learn more about the Weave project">
<!ENTITY intro-more.link "http://labs.mozilla.com">
<!ENTITY intro-warning.description "Warning: Use at your own risk! Backup Firefox data before continuing with installation.">
<!ENTITY intro-more.label "Learn more about the Weave project">
<!ENTITY intro-more.link "http://labs.mozilla.com">
<!ENTITY intro-warning.description "Warning: Use at your own risk! Backup Firefox data before continuing with installation.">
<!ENTITY eula.title "Software License Agreement">
<!ENTITY eula.description "Terms and conditions for using this software.">
<!ENTITY eula.accept "I accept the terms of the License Agreement">
<!ENTITY eula.decline "I do NOT accept the terms of the License Agreement">
<!ENTITY welcome.title "Installation Type">
<!ENTITY curUser-title.label "Sign In">
<!ENTITY curUser.description "Sign into your existing account to set up Weave on this computer.">
<!ENTITY newUser-title.label "Get Started">
<!ENTITY newUser.description "Create a new account and upload your Weave data to the server.">
<!ENTITY verify.title "Account Verification (Step 1 of 3)">
<!ENTITY username.label "User name:">
<!ENTITY password.label "Password:">
<!ENTITY passphrase.label "Passphrase:">
<!ENTITY reminder.label "Forgot your password? ">
<!ENTITY recovery.link "https://sm-labs01.mozilla.org:81/client/forgot.php">
<!ENTITY create.title "Create Account (Step 1 of 5)">
<!ENTITY createUsername.label "Desired login name:">
<!ENTITY createUsernameHint.label "Examples: Maria, Maria.Emerson">
<!ENTITY createPassword.label "Choose a password:">
<!ENTITY createPasswordHint.label "Minimum of 5 characters in length.">
<!ENTITY createReenterPassword.label "Re-enter password:">
<!ENTITY createEmail.label "Current email address:">
<!ENTITY createEmailHint.label "e.g. yourname@domain.com">
<!ENTITY create2.title "Create Account (Step 2 of 5)">
<!ENTITY passphrase.description "You must also now choose an encryption passphrase that is different from your password. This will be used to protect your data on the server.">
<!ENTITY passphrase-more.label "Learn More">
<!ENTITY passphrase-more.link "http://labs.mozilla.com">
<!ENTITY reenterPassphrase.label "Re-enter passphrase:">
<!ENTITY moreInfo.label "More information on choosing a phrase.">
<!ENTITY create3.title "Create Account (Step 3 of 5)">
<!ENTITY create3.description "Continuing past this screen will create your Weave account.">
<!ENTITY instanceName.description "Choose a name for this device">
<!ENTITY instanceName.label "Device name:">
<!ENTITY examples.label "Examples: &quot;Home computer&quot;, &quot;Mobile phone&quot;, &quot;Work laptop&quot;">
<!ENTITY data.description "Choose the data that you would like Weave to store for you.">
<!ENTITY bookmarks.label "Bookmarks">
<!ENTITY history.label "Browsing History">
<!ENTITY cookies.label "Cookies">
<!ENTITY passwords.label "Saved Passwords">
<!ENTITY tabs.label "Tabs">
<!ENTITY formdata.label "Saved Form Data">
<!ENTITY captcha.label "Type the characters you see in the image below:">
<!ENTITY reloadCaptcha.text "Reload">
<!ENTITY captchaHint.label "Letters are not case-sensitive.">
<!ENTITY terms.label "Terms of Service">
<!ENTITY acceptTerms.label "I agree to the ">
<!ENTITY acceptTerms.link "Weave Terms of Service">
<!ENTITY final.description "Weave perform an initial synchronization with the following settings. Continue to the next wizard page to accept.">
<!ENTITY initialLogin.label "Signing you in.">
<!ENTITY initialPrefs.label "Setting your preferences.">
<!ENTITY initialReset.label "Clearing your default bookmarks.">
<!ENTITY initialSync.label "Synchronizing your data.">
<!ENTITY finalStep1Finished.label "Signed in.">
<!ENTITY finalStep2.label "Synchronizing data...">
<!ENTITY finalStep3Finished.label "Data synchronized.">
<!ENTITY welcome.title "Installation Type">
<!ENTITY curUser-title.label "Sign In">
<!ENTITY curUser.description "Sign into your existing account to set up Weave on this computer.">
<!ENTITY newUser-title.label "Get Started">
<!ENTITY newUser.description "Create a new account and upload your Weave data to the server.">
<!ENTITY verify.title "Account Verification (Step 1 of 3)">
<!ENTITY username.label "User name:">
<!ENTITY password.label "Password:">
<!ENTITY passphrase.label "Passphrase:">
<!ENTITY reminder.label "Forgot your password? ">
<!ENTITY unverified.label "Unverified">
<!ENTITY recovery.link "https://sm-labs01.mozilla.org:81/client/forgot.php">
<!ENTITY create.title "Create Account (Step 1 of 5)">
<!ENTITY createUsername.label "Desired login name:">
<!ENTITY createUsernameHint.label "Examples: Maria, Maria.Emerson">
<!ENTITY createPassword.label "Choose a password:">
<!ENTITY createPasswordHint.label "Minimum of 5 characters in length.">
<!ENTITY createReenterPassword.label "Re-enter password:">
<!ENTITY createEmail.label "Current email address:">
<!ENTITY createEmailHint.label "e.g. yourname@domain.com">
<!ENTITY create2.title "Create Account (Step 2 of 5)">
<!ENTITY passphrase.description "You must also now choose an encryption passphrase that is different from your password. This will be used to protect your data on the server.">
<!ENTITY passphrase-more.label "Learn More">
<!ENTITY passphrase-more.link "http://labs.mozilla.com">
<!ENTITY reenterPassphrase.label "Re-enter passphrase:">
<!ENTITY moreInfo.label "More information on choosing a phrase.">
<!ENTITY create3.title "Create Account (Step 3 of 5)">
<!ENTITY instanceName.description "Choose a name for this device for Weave">
<!ENTITY instanceName.label "Device name:">
<!ENTITY examples.label "Examples: &quot;Home computer&quot;, &quot;Mobile phone&quot;, &quot;Work laptop&quot;">
<!ENTITY data.description "Choose the data that you would like Weave to store for you.">
<!ENTITY bookmarks.label "Bookmarks">
<!ENTITY history.label "Browsing History">
<!ENTITY cookies.label "Cookies">
<!ENTITY passwords.label "Saved Passwords">
<!ENTITY tabs.label "Tabs">
<!ENTITY formdata.label "Saved Form Data">
<!ENTITY captcha.label "Type the characters you see in the image below:">
<!ENTITY captchaDirections.label "">
<!ENTITY reloadCaptcha.text "Reload">
<!ENTITY captchaHint.label "Letters are not case-sensitive.">
<!ENTITY terms.label "Terms of Service">
<!ENTITY acceptTerms.label "I have read and accept the Terms of Service.">
<!ENTITY final.description "Weave perform an initial synchronization with the following settings. Continue to the next wizard page to accept.">
<!ENTITY initialLogin.label "Signing you in.">
<!ENTITY initialPrefs.label "Setting your preferences.">
<!ENTITY initialReset.label "Clearing your default bookmarks.">
<!ENTITY initialSync.label "Synchronizing your data.">
<!ENTITY finalStep1Finished.label "Signed in.">
<!ENTITY finalStep2.label "Synchronizing data...">
<!ENTITY finalStep3Finished.label "Data synchronized.">
<!ENTITY thankyou.title "Thank you!">
<!ENTITY thankyou.description "Weave has been installed on this device and your data has been synchronized. To change your Weave preferences, use the Weave tab of your browser preferences. ">

Просмотреть файл

@ -1,3 +1,8 @@
verify-progress.label = Verifying username and password
verify-error.label = Invalid username and password
verify-success.label = Username and password verified
serverError.label = Server Error
serverTimeoutError.label = Server Error
@ -22,9 +27,6 @@ missingCaptchaResponse.label = Please enter the words in the Captcha box.
incorrectCaptcha.label = Incorrect Captcha response. Try again.
verify-progress.label = Verifying username and password
verify-error.label = Invalid username and password
verify-success.label = Username and password verified
create-progress.label = Creating your account
create-uid-inuse.label = Username in use

Просмотреть файл

@ -63,6 +63,7 @@ Cu.import("resource://weave/stores.js");
Cu.import("resource://weave/trackers.js");
Cu.import("resource://weave/identity.js");
Cu.import("resource://weave/xmpp/xmppClient.js");
Cu.import("resource://weave/notifications.js");
Function.prototype.async = Async.sugar;
@ -82,7 +83,7 @@ BookmarksSharingManager.prototype = {
this._engine = engine;
this._log = Log4Moz.Service.getLogger("Bookmark Share");
if ( Utils.prefs.getBoolPref( "xmpp.enabled" ) ) {
dump( "Starting XMPP client for bookmark engine..." );
this._log.info( "Starting XMPP client for bookmark engine..." );
this._startXmppClient.async(this);
}
},
@ -95,7 +96,7 @@ BookmarksSharingManager.prototype = {
let serverUrl = Utils.prefs.getCharPref( "xmpp.server.url" );
let realm = Utils.prefs.getCharPref( "xmpp.server.realm" );
/* Username/password for XMPP are the same; as the ones for Weave,
/* Username/password for XMPP are the same as the ones for Weave,
so read them from the weave identity: */
let clientName = ID.get('WeaveID').username;
let clientPassword = ID.get('WeaveID').password;
@ -161,7 +162,7 @@ BookmarksSharingManager.prototype = {
this._log.info("User " + user + " offered to share folder " + folderName);
let bmkSharing = this;
let acceptButton = new Weave.NotificationButton(
let acceptButton = new NotificationButton(
"Accept Share",
"a",
function() {
@ -172,7 +173,7 @@ BookmarksSharingManager.prototype = {
return false;
}
);
let rejectButton = new Weave.NotificationButton(
let rejectButton = new NotificationButton(
"No Thanks",
"n",
function() {return false;}
@ -182,13 +183,13 @@ BookmarksSharingManager.prototype = {
let description ="Weave user " + user +
" is offering to share a bookmark folder called " + folderName +
" with you. Do you want to accept it?";
let notification = Weave.Notification(title,
description,
null,
Weave.Notifications.PRIORITY_INFO,
[acceptButton, rejectButton]
);
Weave.Notifications.add(notification);
let notification = new Notification(title,
description,
null,
Notifications.PRIORITY_INFO,
[acceptButton, rejectButton]
);
Notifications.add(notification);
},
_share: function BmkSharing__share( selectedFolder, username ) {
@ -237,8 +238,10 @@ BookmarksSharingManager.prototype = {
_stopSharing: function BmkSharing__stopSharing( selectedFolder, username ) {
let self = yield;
// TODO FIXME the next line says getAttribute is not a function...
let folderName = selectedFolder.getAttribute( "label" );
let serverPath = this._annoSvc.getItemAnnotation(folderNode,
let folderNode = selectedFolder.node;
let serverPath = this._annoSvc.getItemAnnotation(folderNode.itemId,
SERVER_PATH_ANNO);
/* LONGTERM TODO: when we move to being able to share one folder with
@ -327,7 +330,7 @@ BookmarksSharingManager.prototype = {
let folderGuid = Utils.makeGUID();
/* Create the directory on the server if it does not exist already. */
let serverPath = "/user/" + myUserName + "/share/" + folderGuid;
let serverPath = "/0.2/user/" + myUserName + "/share/" + folderGuid;
DAV.MKCOL(serverPath, self.cb);
let ret = yield;
if (!ret) {
@ -359,8 +362,8 @@ BookmarksSharingManager.prototype = {
/* Get public keys for me and the user I'm sharing with.
Each user's public key is stored in /user/username/public/pubkey. */
let idRSA = ID.get('WeaveCryptoID');
let userPubKeyFile = new Resource("/user/" + username + "/public/pubkey");
let idRSA = ID.get('WeaveCryptoID'); // TODO Can get error "Resource not defined"
let userPubKeyFile = new Resource("/0.2/user/" + username + "/public/pubkey");
userPubKeyFile.get(self.cb);
let userPubKey = yield;
@ -447,6 +450,7 @@ BookmarksSharingManager.prototype = {
OUTGOING_SHARED_ANNO );
// Delete the share from the server:
// TODO handle error that can happen if these resources do not exist.
let keyringFile = new Resource(serverPath + "/" + KEYRING_FILE_NAME);
keyringFile.delete(self.cb);
yield;
@ -663,8 +667,21 @@ BookmarksEngine.prototype = {
this._sharing.updateAllIncomingShares(self.cb);
yield;
self.done();
}
},
_share: function BmkEngine__share(guid, username) {
let self = yield;
this._sharing.share.async( this._sharing, self.cb, guid, username);
yield;
self.done(true);
},
_stopSharing: function BmkEngine__stopSharing(guid, username) {
let self = yield;
this._sharing._stopSharing.async( this._sharing, self.cb, guid, username);
yield;
self.done();
}
};
BookmarksEngine.prototype.__proto__ = new Engine();
@ -1105,11 +1122,12 @@ BookmarksStore.prototype = {
node.containerOpen = true;
// If folder is an outgoing share, wrap its annotations:
if (this._ans.itemHasAnnotation(node.itemId, OUTGOING_SHARED_ANNO)) {
item.serverPathAnno = this._ans.getItemAnnotation(node.itemId,
SERVER_PATH_ANNO);
item.outgoingSharedAnno = this._ans.getItemAnnotation(node.itemId,
OUTGOING_SHARED_ANNO);
// TODO this can throw an error if SERVER_PATH_ANNO doesn't exist
// (which it always should)
}
for (var i = 0; i < node.childCount; i++) {

Просмотреть файл

@ -42,78 +42,8 @@ var Cu = Components.utils;
Cu.import("resource://weave/log4moz.js");
if (typeof(atob) == 'undefined') {
// This code was written by Tyler Akins and has been placed in the
// public domain. It would be nice if you left this header intact.
// Base64 code from Tyler Akins -- http://rumkin.com
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function btoa(input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
do {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
keyStr.charAt(enc3) + keyStr.charAt(enc4);
} while (i < input.length);
return output;
}
function atob(input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
do {
enc1 = keyStr.indexOf(input.charAt(i++));
enc2 = keyStr.indexOf(input.charAt(i++));
enc3 = keyStr.indexOf(input.charAt(i++));
enc4 = keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
} while (i < input.length);
return output;
}
}
/* Two implementations of SASL authentication:
one using MD5-DIGEST, the other using PLAIN.
one using MD5-DIGEST, the other using PLAIN.
Here's the interface that each implementation must obey:
@ -160,7 +90,7 @@ BaseAuthenticator.prototype = {
this._errorMsg = "generateResponse() should be overridden by subclass.";
return false;
},
verifyProtocolSupport: function( rootElem, protocolName ) {
/* Parses the incoming stream from the server to check whether the
server supports the type of authentication we want to do
@ -171,7 +101,7 @@ BaseAuthenticator.prototype = {
this._errorMsg = "Expected stream:stream but got " + rootElem.nodeName;
return false;
}
dump( "Got response from server...\n" );
dump( "ID is " + rootElem.getAttribute( "id" ) + "\n" );
// TODO: Do I need to do anything with this ID value???
@ -193,7 +123,7 @@ BaseAuthenticator.prototype = {
this._errorMsg = "Expected stream:features but got " + child.nodeName;
return false;
}
var protocolSupported = false;
var mechanisms = child.getElementsByTagName( "mechanism" );
for ( var x = 0; x < mechanisms.length; x++ ) {
@ -201,7 +131,7 @@ BaseAuthenticator.prototype = {
protocolSupported = true;
}
}
if ( !protocolSupported ) {
this._errorMsg = protocolName + " not supported by server!";
return false;
@ -216,7 +146,7 @@ function Md5DigestAuthenticator( ) {
Uses complicated hash of password
with nonce and cnonce to obscure password while preventing replay
attacks.
See http://www.faqs.org/rfcs/rfc2831.html
"Using Digest Authentication as a SASL mechanism"
@ -241,8 +171,8 @@ Md5DigestAuthenticator.prototype = {
return "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/>";
} else if ( this._stepNumber == 1 ) {
// proceed to SASL step 2: are you asking for a CHALLENGE?!?
// proceed to SASL step 2: are you asking for a CHALLENGE?!?
var challenge = this._unpackChallenge( rootElem.firstChild.nodeValue );
dump( "Nonce is " + challenge.nonce + "\n" );
// eg:
@ -295,7 +225,7 @@ Md5DigestAuthenticator.prototype = {
} else if ( this._stepNumber = 2 ) {
dump( "Got to step 3!" );
// At this point the server might reject us with a
// At this point the server might reject us with a
// <failure><not-authorized/></failure>
if ( rootElem.nodeName == "failure" ) {
this._errorMsg = rootElem.firstChild.nodeName;
@ -337,7 +267,7 @@ function PlainAuthenticator( ) {
/* SASL using PLAIN authentication, which sends password in the clear. */
}
PlainAuthenticator.prototype = {
generateResponse: function( rootElem ) {
if ( this._stepNumber == 0 ) {
if ( this.verifyProtocolSupport( rootElem, "PLAIN" ) == false ) {
@ -385,14 +315,14 @@ PlainAuthenticator.prototype = {
// Server hasn't requested either: we're done.
return this.COMPLETION_CODE;
}
if ( this._needBinding ) {
// Do resource binding:
// Tell the server to generate the resource ID for us.
this._stepNumber = 3;
return "<iq type='set' id='bind_1'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq>";
}
}
this._errorMsg = "Server requested session not binding: can't happen?";
return false;
} else if ( this._stepNumber == 3 ) {

Просмотреть файл

@ -96,7 +96,11 @@ function run_test() {
bms.setItemGUID(binkBm2, "bink-bookmark-guid-2");
syncTesting.doSync("Manually add same bookmark 'bink', but with " +
+ "different GUID, to second computer and resync");
"different GUID, to second computer and resync");
binkBm2 = bms.getBookmarkIdsForURI(uri("http://www.bink.com"), {})[0];
do_check_eq(bms.getItemGUID(binkBm2), "bink-bookmark-guid-1");
// --------
// Teardown

Просмотреть файл

@ -314,7 +314,7 @@ Service.BStore TRACE Processing command: {"action":"create","GUID":"zoogle-bookm
Service.BStore DEBUG -> creating bookmark "Zoogle"
Testing INFO Step 'restore client state of second computer' succeeded.
Testing INFO -----------------------------------------
Testing INFO Step 'Manually add same bookmark 'bink', but with NaN' starting.
Testing INFO Step 'Manually add same bookmark 'bink', but with different GUID, to second computer and resync' starting.
Testing INFO -----------------------------------------
Testing INFO Opening 'weave/snapshots/bookmarks.json' for reading.
Testing INFO Reading from stream.
@ -351,7 +351,7 @@ Testing INFO Writing data to local file 'weave/snapshots/bookmarks.json': {"vers
Service.BmkEngine INFO Actual changes for server: 0
Service.BmkEngine DEBUG Actual changes for server: []
Service.BmkEngine INFO Sync complete
Testing INFO Step 'Manually add same bookmark 'bink', but with NaN' succeeded.
Testing INFO Step 'Manually add same bookmark 'bink', but with different GUID, to second computer and resync' succeeded.
*** test finished
*** exiting
*** PASS ***