diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-09-24 14:41:07 -0700 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-09-24 17:15:10 -0700 |
commit | 9fad8958df671c0e894506ef59b4c781c3dfb349 (patch) | |
tree | 4db7643b40c4ffd726fb27fb4aa276d420b3bfd8 /deps/npm/node_modules/npm-registry-client/lib/star.js | |
parent | b26dd4e5ab9192bad72b9dc61fa4ad2d8f215da2 (diff) | |
download | android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.tar.gz android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.tar.bz2 android-node-v8-9fad8958df671c0e894506ef59b4c781c3dfb349.zip |
deps: upgrade npm to 2.0.0
Diffstat (limited to 'deps/npm/node_modules/npm-registry-client/lib/star.js')
-rw-r--r-- | deps/npm/node_modules/npm-registry-client/lib/star.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/deps/npm/node_modules/npm-registry-client/lib/star.js b/deps/npm/node_modules/npm-registry-client/lib/star.js index c0590f1e2e..97745851ea 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/star.js +++ b/deps/npm/node_modules/npm-registry-client/lib/star.js @@ -2,10 +2,15 @@ module.exports = star function star (uri, starred, cb) { - if (!this.conf.get('username')) return cb(new Error( - "Must be logged in to star/unstar packages")) + var c = this.conf.getCredentialsByURI(uri) + if (c.token) { + return cb(new Error("This operation is unsupported for token-based auth")) + } + else if (!c.auth) { + return cb(new Error("Must be logged in to star/unstar packages")) + } - this.request("GET", uri+"?write=true", null, function (er, fullData) { + this.request("GET", uri + "?write=true", null, function (er, fullData) { if (er) return cb(er) fullData = { _id: fullData._id @@ -14,10 +19,10 @@ function star (uri, starred, cb) { if (starred) { this.log.info("starring", fullData._id) - fullData.users[this.conf.get('username')] = true + fullData.users[c.username] = true this.log.verbose("starring", fullData) } else { - delete fullData.users[this.conf.get('username')] + delete fullData.users[c.username] this.log.info("unstarring", fullData._id) this.log.verbose("unstarring", fullData) } |