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

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

@ -22,7 +22,6 @@
<!ENTITY password.label "Password:"> <!ENTITY password.label "Password:">
<!ENTITY passphrase.label "Passphrase:"> <!ENTITY passphrase.label "Passphrase:">
<!ENTITY reminder.label "Forgot your password? "> <!ENTITY reminder.label "Forgot your password? ">
<!ENTITY unverified.label "Unverified">
<!ENTITY recovery.link "https://sm-labs01.mozilla.org:81/client/forgot.php"> <!ENTITY recovery.link "https://sm-labs01.mozilla.org:81/client/forgot.php">
<!ENTITY create.title "Create Account (Step 1 of 5)"> <!ENTITY create.title "Create Account (Step 1 of 5)">
@ -44,8 +43,9 @@
<!ENTITY moreInfo.label "More information on choosing a phrase."> <!ENTITY moreInfo.label "More information on choosing a phrase.">
<!ENTITY create3.title "Create Account (Step 3 of 5)"> <!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 for Weave"> <!ENTITY instanceName.description "Choose a name for this device">
<!ENTITY instanceName.label "Device name:"> <!ENTITY instanceName.label "Device name:">
<!ENTITY examples.label "Examples: &quot;Home computer&quot;, &quot;Mobile phone&quot;, &quot;Work laptop&quot;"> <!ENTITY examples.label "Examples: &quot;Home computer&quot;, &quot;Mobile phone&quot;, &quot;Work laptop&quot;">
@ -58,12 +58,12 @@
<!ENTITY formdata.label "Saved Form Data"> <!ENTITY formdata.label "Saved Form Data">
<!ENTITY captcha.label "Type the characters you see in the image below:"> <!ENTITY captcha.label "Type the characters you see in the image below:">
<!ENTITY captchaDirections.label "">
<!ENTITY reloadCaptcha.text "Reload"> <!ENTITY reloadCaptcha.text "Reload">
<!ENTITY captchaHint.label "Letters are not case-sensitive."> <!ENTITY captchaHint.label "Letters are not case-sensitive.">
<!ENTITY terms.label "Terms of Service"> <!ENTITY terms.label "Terms of Service">
<!ENTITY acceptTerms.label "I have read and accept the 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 final.description "Weave perform an initial synchronization with the following settings. Continue to the next wizard page to accept.">
@ -75,6 +75,7 @@
<!ENTITY finalStep2.label "Synchronizing data..."> <!ENTITY finalStep2.label "Synchronizing data...">
<!ENTITY finalStep3Finished.label "Data synchronized."> <!ENTITY finalStep3Finished.label "Data synchronized.">
<!ENTITY thankyou.title "Thank you!"> <!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. "> <!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 serverError.label = Server Error
serverTimeoutError.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. 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-progress.label = Creating your account
create-uid-inuse.label = Username in use 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/trackers.js");
Cu.import("resource://weave/identity.js"); Cu.import("resource://weave/identity.js");
Cu.import("resource://weave/xmpp/xmppClient.js"); Cu.import("resource://weave/xmpp/xmppClient.js");
Cu.import("resource://weave/notifications.js");
Function.prototype.async = Async.sugar; Function.prototype.async = Async.sugar;
@ -82,7 +83,7 @@ BookmarksSharingManager.prototype = {
this._engine = engine; this._engine = engine;
this._log = Log4Moz.Service.getLogger("Bookmark Share"); this._log = Log4Moz.Service.getLogger("Bookmark Share");
if ( Utils.prefs.getBoolPref( "xmpp.enabled" ) ) { 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); this._startXmppClient.async(this);
} }
}, },
@ -95,7 +96,7 @@ BookmarksSharingManager.prototype = {
let serverUrl = Utils.prefs.getCharPref( "xmpp.server.url" ); let serverUrl = Utils.prefs.getCharPref( "xmpp.server.url" );
let realm = Utils.prefs.getCharPref( "xmpp.server.realm" ); 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: */ so read them from the weave identity: */
let clientName = ID.get('WeaveID').username; let clientName = ID.get('WeaveID').username;
let clientPassword = ID.get('WeaveID').password; let clientPassword = ID.get('WeaveID').password;
@ -161,7 +162,7 @@ BookmarksSharingManager.prototype = {
this._log.info("User " + user + " offered to share folder " + folderName); this._log.info("User " + user + " offered to share folder " + folderName);
let bmkSharing = this; let bmkSharing = this;
let acceptButton = new Weave.NotificationButton( let acceptButton = new NotificationButton(
"Accept Share", "Accept Share",
"a", "a",
function() { function() {
@ -172,7 +173,7 @@ BookmarksSharingManager.prototype = {
return false; return false;
} }
); );
let rejectButton = new Weave.NotificationButton( let rejectButton = new NotificationButton(
"No Thanks", "No Thanks",
"n", "n",
function() {return false;} function() {return false;}
@ -182,13 +183,13 @@ BookmarksSharingManager.prototype = {
let description ="Weave user " + user + let description ="Weave user " + user +
" is offering to share a bookmark folder called " + folderName + " is offering to share a bookmark folder called " + folderName +
" with you. Do you want to accept it?"; " with you. Do you want to accept it?";
let notification = Weave.Notification(title, let notification = new Notification(title,
description, description,
null, null,
Weave.Notifications.PRIORITY_INFO, Notifications.PRIORITY_INFO,
[acceptButton, rejectButton] [acceptButton, rejectButton]
); );
Weave.Notifications.add(notification); Notifications.add(notification);
}, },
_share: function BmkSharing__share( selectedFolder, username ) { _share: function BmkSharing__share( selectedFolder, username ) {
@ -237,8 +238,10 @@ BookmarksSharingManager.prototype = {
_stopSharing: function BmkSharing__stopSharing( selectedFolder, username ) { _stopSharing: function BmkSharing__stopSharing( selectedFolder, username ) {
let self = yield; let self = yield;
// TODO FIXME the next line says getAttribute is not a function...
let folderName = selectedFolder.getAttribute( "label" ); 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); SERVER_PATH_ANNO);
/* LONGTERM TODO: when we move to being able to share one folder with /* LONGTERM TODO: when we move to being able to share one folder with
@ -327,7 +330,7 @@ BookmarksSharingManager.prototype = {
let folderGuid = Utils.makeGUID(); let folderGuid = Utils.makeGUID();
/* Create the directory on the server if it does not exist already. */ /* 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); DAV.MKCOL(serverPath, self.cb);
let ret = yield; let ret = yield;
if (!ret) { if (!ret) {
@ -359,8 +362,8 @@ BookmarksSharingManager.prototype = {
/* Get public keys for me and the user I'm sharing with. /* Get public keys for me and the user I'm sharing with.
Each user's public key is stored in /user/username/public/pubkey. */ Each user's public key is stored in /user/username/public/pubkey. */
let idRSA = ID.get('WeaveCryptoID'); let idRSA = ID.get('WeaveCryptoID'); // TODO Can get error "Resource not defined"
let userPubKeyFile = new Resource("/user/" + username + "/public/pubkey"); let userPubKeyFile = new Resource("/0.2/user/" + username + "/public/pubkey");
userPubKeyFile.get(self.cb); userPubKeyFile.get(self.cb);
let userPubKey = yield; let userPubKey = yield;
@ -447,6 +450,7 @@ BookmarksSharingManager.prototype = {
OUTGOING_SHARED_ANNO ); OUTGOING_SHARED_ANNO );
// Delete the share from the server: // 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); let keyringFile = new Resource(serverPath + "/" + KEYRING_FILE_NAME);
keyringFile.delete(self.cb); keyringFile.delete(self.cb);
yield; yield;
@ -663,8 +667,21 @@ BookmarksEngine.prototype = {
this._sharing.updateAllIncomingShares(self.cb); this._sharing.updateAllIncomingShares(self.cb);
yield; yield;
self.done(); 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(); BookmarksEngine.prototype.__proto__ = new Engine();
@ -1105,11 +1122,12 @@ BookmarksStore.prototype = {
node.containerOpen = true; node.containerOpen = true;
// If folder is an outgoing share, wrap its annotations: // If folder is an outgoing share, wrap its annotations:
if (this._ans.itemHasAnnotation(node.itemId, OUTGOING_SHARED_ANNO)) { if (this._ans.itemHasAnnotation(node.itemId, OUTGOING_SHARED_ANNO)) {
item.serverPathAnno = this._ans.getItemAnnotation(node.itemId, item.serverPathAnno = this._ans.getItemAnnotation(node.itemId,
SERVER_PATH_ANNO); SERVER_PATH_ANNO);
item.outgoingSharedAnno = this._ans.getItemAnnotation(node.itemId, item.outgoingSharedAnno = this._ans.getItemAnnotation(node.itemId,
OUTGOING_SHARED_ANNO); 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++) { for (var i = 0; i < node.childCount; i++) {

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

@ -42,76 +42,6 @@ var Cu = Components.utils;
Cu.import("resource://weave/log4moz.js"); 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: /* Two implementations of SASL authentication:
one using MD5-DIGEST, the other using PLAIN. one using MD5-DIGEST, the other using PLAIN.

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

@ -96,7 +96,11 @@ function run_test() {
bms.setItemGUID(binkBm2, "bink-bookmark-guid-2"); bms.setItemGUID(binkBm2, "bink-bookmark-guid-2");
syncTesting.doSync("Manually add same bookmark 'bink', but with " + 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 // Teardown

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

@ -314,7 +314,7 @@ Service.BStore TRACE Processing command: {"action":"create","GUID":"zoogle-bookm
Service.BStore DEBUG -> creating bookmark "Zoogle" Service.BStore DEBUG -> creating bookmark "Zoogle"
Testing INFO Step 'restore client state of second computer' succeeded. Testing INFO Step 'restore client state of second computer' succeeded.
Testing INFO ----------------------------------------- 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 -----------------------------------------
Testing INFO Opening 'weave/snapshots/bookmarks.json' for reading. Testing INFO Opening 'weave/snapshots/bookmarks.json' for reading.
Testing INFO Reading from stream. 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 INFO Actual changes for server: 0
Service.BmkEngine DEBUG Actual changes for server: [] Service.BmkEngine DEBUG Actual changes for server: []
Service.BmkEngine INFO Sync complete 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 *** test finished
*** exiting *** exiting
*** PASS *** *** PASS ***