spotify-local-control
Advanced tools
Comparing version 1.0.1 to 1.0.2
17
index.js
@@ -59,5 +59,5 @@ const https = require('https') | ||
csrfAndOuathAndEndpoints = csrfAndOuathAndEndpoints || Promise.all([ | ||
getOauthToken(), | ||
findPort() | ||
]) | ||
getOauthToken(), | ||
findPort() | ||
]) | ||
.then(function ([oauth, port]) { | ||
@@ -73,3 +73,2 @@ const endpoint = `https://${randomString({length: 10})}.spotilocal.com:${port}` | ||
return csrfAndOuathAndEndpoints.then(([oauth, csrf, endpoint]) => get(endpoint + path, { | ||
@@ -88,3 +87,3 @@ headers: { | ||
return new Promise(function (resolve, reject) { | ||
portscanner.findAPortInUse(4370, 4380, '127.0.0.1', function(error, port) { | ||
portscanner.findAPortInUse(4370, 4380, '127.0.0.1', function (error, port) { | ||
error ? reject(error) : resolve(port) | ||
@@ -97,3 +96,3 @@ }) | ||
// null -> promise | ||
function getCsrfToken ({endpoint: endpoint}) { | ||
function getCsrfToken ({endpoint}) { | ||
return get(endpoint + '/simplecsrf/token.json', { | ||
@@ -110,3 +109,7 @@ headers: { | ||
function getOauthToken () { | ||
return get('https://open.spotify.com/token') | ||
return get('https://open.spotify.com/token', { | ||
headers: { | ||
'User-Agent': 'spotify-local-control' | ||
} | ||
}) | ||
.then((res) => res.body['t']) | ||
@@ -113,0 +116,0 @@ } |
{ | ||
"name": "spotify-local-control", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Control a local spotify client via spotify-webhelper", | ||
"main": "index.js", | ||
"scripts": { | ||
"deps": "dependency-check . && dependency-check . --extra --no-dev", | ||
"test": "standard && npm run deps" | ||
}, | ||
"repository": "f-mer/spotify-local-control", | ||
@@ -7,0 +11,0 @@ "keywords": [ |
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
7336
6
139