Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cody-music

Package Overview
Dependencies
Maintainers
1
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cody-music - npm Package Compare versions

Comparing version 2.8.9 to 2.9.0

15

dist/lib/profile.js

@@ -7,5 +7,7 @@ "use strict";

const models_1 = require("./models");
const cache_1 = require("./cache");
const musicClient = client_1.MusicClient.getInstance();
const musicPlayerCtr = playerstate_1.MusicPlayerState.getInstance();
const musicStore = store_1.MusicStore.getInstance();
const cacheMgr = cache_1.CacheManager.getInstance();
class SpotifyUser {

@@ -41,3 +43,7 @@ constructor() {

async getUserProfile() {
let spotifyUser = new SpotifyUser();
let userProfile = cacheMgr.get("user-profile");
if (userProfile) {
return userProfile;
}
userProfile = new SpotifyUser();
let api = "/v1/me";

@@ -53,6 +59,7 @@ let response = await musicClient.spotifyApiGet(api);

if (response && response.status === 200 && response.data) {
spotifyUser = response.data;
musicStore.spotifyUserId = spotifyUser.id;
userProfile = response.data;
cacheMgr.set("user-profile", userProfile, 60 * 10);
musicStore.spotifyUserId = userProfile.id;
}
return spotifyUser;
return userProfile;
}

@@ -59,0 +66,0 @@ async spotifyAuthState() {

@@ -5,2 +5,3 @@ import { MusicClient } from "./client";

import { SpotifyAuthState } from "./models";
import { CacheManager } from "./cache";

@@ -10,2 +11,3 @@ const musicClient = MusicClient.getInstance();

const musicStore = MusicStore.getInstance();
const cacheMgr = CacheManager.getInstance();

@@ -43,3 +45,7 @@ export class SpotifyUser {

async getUserProfile(): Promise<SpotifyUser> {
let spotifyUser: SpotifyUser = new SpotifyUser();
let userProfile: SpotifyUser = cacheMgr.get("user-profile");
if (userProfile) {
return userProfile;
}
userProfile = new SpotifyUser();
let api = "/v1/me";

@@ -57,7 +63,8 @@ let response = await musicClient.spotifyApiGet(api);

if (response && response.status === 200 && response.data) {
spotifyUser = response.data;
musicStore.spotifyUserId = spotifyUser.id;
userProfile = response.data;
cacheMgr.set("user-profile", userProfile, 60 * 10);
musicStore.spotifyUserId = userProfile.id;
}
return spotifyUser;
return userProfile;
}

@@ -64,0 +71,0 @@

{
"name": "cody-music",
"version": "2.8.9",
"version": "2.9.0",
"description": "mac osx spotify and itunes music player controller, spotify audio features, itunes and spotify genre, and playlist control",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc