Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix rsakey var (thanks XULRunner)

  • Loading branch information...
commit 5953979171a41373532b749e7d9daea94c3701e0 1 parent 0a13adc
@contra contra authored
Showing with 13 additions and 10 deletions.
  1. +11 −8 lib/nodester.js
  2. +1 −1  package.json
  3. +1 −1  src/nodester.coffee
View
19 lib/nodester.js
@@ -13,12 +13,11 @@
var user_delete;
function Nodester(username, password, basehost, secure) {
- var _ref;
this.username = username;
this.password = password;
this.basehost = basehost;
this.secure = secure;
- if ((_ref = this.basehost) == null) this.basehost = 'api.nodester.com';
+ if (this.basehost == null) this.basehost = 'api.nodester.com';
this.protocol = this.secure ? 'https://' : 'http://';
this.baseurl = "" + this.protocol + (encode(username)) + ":" + (encode(this.password)) + "@" + basehost + "/";
}
@@ -71,12 +70,16 @@
Nodester.prototype.user_create = function(user, pass, email, rsakey, coupon, cb) {
var postData, rsadata;
rsadata = fs.readFileSync(rsakey);
- return cb({
- message: !rsadata ? "No RSA key found in " + rsakey : void 0
- });
- return cb({
- message: !(rsadata.length > 40) ? "Invalid SSH key file." : void 0
- });
+ if (!rsadata) {
+ return cb({
+ message: "No RSA key found in " + rsakey
+ });
+ }
+ if (!(rsadata.length > 40)) {
+ return cb({
+ message: "Invalid SSH key file."
+ });
+ }
postData = {
user: user,
password: pass,
View
2  package.json
@@ -1,7 +1,7 @@
{
"name":"nodester-api",
"description":"A library to interact with Nodester",
- "version":"0.1.21",
+ "version":"0.1.22",
"homepage":"http://nodester.com/",
"repository":"git://github.com/nodester/nodester-api.git",
"author":"Contra <contra@nodester.com>",
View
2  src/nodester.coffee
@@ -30,7 +30,7 @@ class Nodester
user_delete = (user, cb) -> @del "user/#{user}", cb
user_create: (user, pass, email, rsakey, coupon, cb) ->
- rsadata = fs.readFileSync rsadata
+ rsadata = fs.readFileSync rsakey
return cb message: "No RSA key found in #{ rsakey }" unless rsadata
return cb message: "Invalid SSH key file." unless rsadata.length > 40
postData =

1 comment on commit 5953979

@XULRunner42

I haven't tested yet, but I think I read the other trick you did was to only register one callback, which is going to get rid of my ERROR: Undefined

Please sign in to comment.
Something went wrong with that request. Please try again.