jspm-github
Advanced tools
Comparing version 0.13.22 to 0.13.23
@@ -35,3 +35,3 @@ var fs = require('graceful-fs'); | ||
function createRemoteStrings(auth, hostname) { | ||
function createRemoteData(auth, hostname) { | ||
var authString = auth.username ? (encodeURIComponent(auth.username) + ':' + encodeURIComponent(auth.password) + '@') : ''; | ||
@@ -41,5 +41,5 @@ hostname = hostname || 'github.com'; | ||
this.remoteString = 'https://' + authString + hostname + '/'; | ||
this.authSuffix = auth.token ? '?access_token=' + auth.token : ''; | ||
this.authHeader = auth.token ? {'Authorization': 'token ' + auth.token} : {}; | ||
if (hostname == 'github.com') | ||
if (hostname === 'github.com') | ||
this.apiRemoteString = 'https://' + authString + 'api.github.com/'; | ||
@@ -160,3 +160,3 @@ | ||
createRemoteStrings.call(this, this.auth || {}, options.hostname); | ||
createRemoteData.call(this, this.auth || {}, options.hostname); | ||
}; | ||
@@ -222,2 +222,5 @@ | ||
auth.password = password; | ||
if (isGithubToken(password)) { | ||
auth.token = password; | ||
} | ||
if (!auth.username) | ||
@@ -235,9 +238,10 @@ return false; | ||
var remotes = {}; | ||
createRemoteStrings.call(remotes, auth, config.hostname); | ||
createRemoteData.call(remotes, auth, config.hostname); | ||
return asp(request)({ | ||
uri: remotes.apiRemoteString + 'user' + remotes.authSuffix, | ||
uri: remotes.apiRemoteString + 'user', | ||
headers: { | ||
'User-Agent': 'jspm', | ||
'Accept': 'application/vnd.github.v3+json' | ||
'Accept': 'application/vnd.github.v3+json', | ||
...remotes.authHeader | ||
}, | ||
@@ -313,8 +317,3 @@ followRedirect: false, | ||
return str.join("&"); | ||
} | ||
if (this.authSuffix) | ||
{ | ||
return this.authSuffix + "&" + serialize(obj) | ||
} | ||
}; | ||
@@ -363,3 +362,3 @@ return "?" + serialize(obj) | ||
var remoteString = this.remoteString; | ||
var authSuffix = this.authSuffix; | ||
var authHeader = this.authHeader; | ||
@@ -372,5 +371,6 @@ if (repo.split('/').length !== 2) | ||
request(extend({ | ||
uri: remoteString + repo + authSuffix, | ||
uri: remoteString + repo, | ||
headers: { | ||
'User-Agent': 'jspm' | ||
'User-Agent': 'jspm', | ||
...authHeader | ||
}, | ||
@@ -471,6 +471,7 @@ followRedirect: false | ||
return asp(request)(extend({ | ||
uri: this.apiRemoteString + 'repos/' + repo + '/contents/package.json' + this.authSuffix, | ||
uri: this.apiRemoteString + 'repos/' + repo + '/contents/package.json', | ||
headers: { | ||
'User-Agent': 'jspm', | ||
'Accept': 'application/vnd.github.v3.raw' | ||
'Accept': 'application/vnd.github.v3.raw', | ||
...this.authHeader | ||
}, | ||
@@ -577,3 +578,3 @@ qs: { | ||
var remoteString = this.remoteString; | ||
var authSuffix = this.authSuffix; | ||
var authHeader = this.authHeader; | ||
@@ -681,6 +682,7 @@ var self = this; | ||
request(extend({ | ||
uri: release.url + authSuffix, | ||
uri: release.url, | ||
headers: { | ||
'accept': 'application/octet-stream', | ||
'user-agent': 'jspm' | ||
'user-agent': 'jspm', | ||
...authHeader | ||
}, | ||
@@ -731,5 +733,6 @@ followRedirect: false, | ||
request(extend({ | ||
uri: remoteString + repo + '/archive/' + version + '.tar.gz' + authSuffix, | ||
uri: remoteString + repo + '/archive/' + version + '.tar.gz', | ||
headers: { | ||
'accept': 'application/octet-stream' | ||
'accept': 'application/octet-stream', | ||
...authHeader | ||
}, | ||
@@ -775,3 +778,4 @@ }, self.defaultRequestOptions | ||
'User-Agent': 'jspm', | ||
'Accept': 'application/vnd.github.v3+json' | ||
'Accept': 'application/vnd.github.v3+json', | ||
...this.authHeader | ||
}, | ||
@@ -778,0 +782,0 @@ followRedirect: false |
{ | ||
"name": "jspm-github", | ||
"version": "0.13.22", | ||
"version": "0.13.23", | ||
"description": "jspm GitHub endpoint", | ||
@@ -5,0 +5,0 @@ "main": "github.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29881
850