From ca155b4e16d15d5ffd62d20ce42a7516c1f9c49c Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 4 Sep 2011 02:02:36 +0200 Subject: Fix passwords and XML-RPC logins. Make switching off XML-RPC per-domain not per-user (fixes #107). Login just once per session and domain (fixes #113). --- data/lib/bzpage.js | 2 +- data/lib/collectingMetadata.js | 3 ++- data/lib/rpcutils.js | 22 ---------------------- data/rhlib/addAttachmentRow.js | 4 ++-- 4 files changed, 5 insertions(+), 26 deletions(-) (limited to 'data') diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js index 43cf5cb..f3f5e27 100644 --- a/data/lib/bzpage.js +++ b/data/lib/bzpage.js @@ -39,7 +39,7 @@ self.on('message', function onMessage(msg) { equivalentComponents = ("equivalentComponents" in constantData) ? constantData.equivalentComponents : null; generateButtons(msg.data.instPkgs, msg.data.kNodes); - JSONRPCLogin(completeInit); + completeInit(); break; case "Error": alert("Error " + msg.data); diff --git a/data/lib/collectingMetadata.js b/data/lib/collectingMetadata.js index 00b973d..47407e8 100644 --- a/data/lib/collectingMetadata.js +++ b/data/lib/collectingMetadata.js @@ -157,7 +157,8 @@ AttachList.prototype.addCheckXorgLogLink = function addCheckXorgLogLink() { */ AttachList.prototype.markBadAttachments = function markBadAttachments() { if (!constantData.passwordState.passAvailable) { - console.log("markBadAttachments : No password, no XML-RPC calls; sorry"); + console.log("markBadAttachments : No XML-RPC calls for " + + location.protocol + "//" + location.hostname); return null; } diff --git a/data/lib/rpcutils.js b/data/lib/rpcutils.js index d29fd68..ee8804a 100644 --- a/data/lib/rpcutils.js +++ b/data/lib/rpcutils.js @@ -2,28 +2,6 @@ //http://www.opensource.org/licenses/mit-license.php "use strict"; -/* -We should first login and then we shouldn't bother with it. -It could be interesting to know how many logins per second are bad. - */ - -function JSONRPCLogin(callback) { - if (!constantData.passwordState.password) { - return; - } - - console.myDebug("JSONRPCLogin: passObj = " + - constantData.passwordState.toSource()); - makeJSONRPCCall("User.login", { - login: getLogin(), - password: constantData.passwordState.password, - remember: false - }, function(logResult) { - callback(); - }); -}; - - // Make a JSONL-RPC call ... most of the business logic should stay in the // content script // http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html diff --git a/data/rhlib/addAttachmentRow.js b/data/rhlib/addAttachmentRow.js index 6fab1bd..20541dc 100644 --- a/data/rhlib/addAttachmentRow.js +++ b/data/rhlib/addAttachmentRow.js @@ -37,8 +37,8 @@ function addAttachment(data, callback, param) { var params = []; if (!constantData.passwordState.passAvailable) { - console - .error("addAttachment : No password, no XML-RPC calls; sorry"); + console.log("addAttachment: No XML-RPC calls for " + + location.protocol + "//" + location.hostname); return null; } -- cgit