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

discotify

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discotify - npm Package Compare versions

Comparing version 0.2.20 to 0.2.21

app/index.js

77

index.ts

@@ -1,10 +0,14 @@

#!/usr/bin/env ts-node
#!/usr/bin/env node
const DiscordRPC = require('discord-rpc');
const logger = require('winston');
const axios = require('axios');
const { platform } = require('os');
const nodeSpotifyWebhelper = require('./spotify-webhelper/spotify');
import * as DiscordRPC from 'discord-rpc';
import * as logger from 'winston';
import axios, { AxiosError, AxiosResponse } from 'axios';
import { platform } from 'os';
const [, , ...args] = process.argv;
let nodeSpotifyWebhelper;
if (platform().toString() === "win32") {
nodeSpotifyWebhelper = require('./spotify-webhelper/windows');
} else {
nodeSpotifyWebhelper = require('./spotify-webhelper/linux');
}

@@ -14,4 +18,4 @@ const spotify = new nodeSpotifyWebhelper.SpotifyWebHelper();

const clientID = '383639700994523137';
let compareURI;
let compare;
let compareURI: string;
let compare: boolean;

@@ -29,3 +33,3 @@ logger.configure({

spotify.getStatus((err, res) => {
spotify.getStatus((err: Error, res: any) => {
if (err) return logger.error(err.stack ? err.stack : err.toString());

@@ -76,21 +80,19 @@ if (!res.track || !res.track.track_resource) return logger.warn(`(${new Date().toLocaleTimeString()}) No track data, make sure Spotify is opened and a song is selected!`);

function checkVersion() {
let sVersion = require('./package.json').version;
let version = ~~(require('./package.json').version.split('.').join(''));
axios.get('https://raw.githubusercontent.com/KurozeroPB/discotify/cli/package.json')
.then((res) => {
if (res.status !== 200) {
return logger.error(`Failed to check for updates: ${res.data}`);
} else {
let latest = ~~(res.data.version.split('.').join(''));
if (latest > version) {
logger.error(`A new version of Discotify is avalible\nPlease get the latest version from: https://www.npmjs.com/package/discotify\nOr run npm install -g discotify@${res.data.version}`);
return kill();
function checkVersion(): Promise<any> {
return new Promise((resolve, reject) => {
let sVersion: string = require('../package.json').version;
let version = ~~(require('../package.json').version.split('.').join(''));
axios.get('https://raw.githubusercontent.com/KurozeroPB/discotify/master/package.json')
.then((res: AxiosResponse) => {
if (res.status !== 200) {
return reject(new Error(`Failed to check for updates: ${res.data}`));
} else {
let latest = ~~(res.data.version.split('.').join(''));
if (latest > version) return reject(new Error(`A new version of Discotify is avalible\nPlease get the latest version from: https://www.npmjs.com/package/discotify\nOr run npm install -g discotify@${res.data.version}`));
return resolve(`Discotify is up-to-date using v${sVersion}`);
}
return logger.info(`Discotify is up-to-date using v${sVersion}`);
}
}).catch((err) => {
logger.error(err.stack ? err.stack : err.message ? err.message : err.toString());
kill();
});
}).catch((err: AxiosError) => {
return reject(new Error(err.stack ? err.stack : err.message ? err.message : err.toString()));
});
});
};

@@ -102,8 +104,19 @@

process.exit(0);
setTimeout(() => {
process.exit(0);
}, 5000);
}).catch((err) => logger.error(err.stack ? err.stack : err.toString()));
};
if (args[0] && args[0].toLocaleLowerCase() === "start") {
checkVersion();
rpc.on('ready', () => {
const [, , ...args] = process.argv;
if (args[0] && args[0].toLowerCase() === "start") {
rpc.on('ready', async () => {
try {
const resp = await checkVersion();
logger.info(resp);
} catch (e) {
return logger.error(e.message ? e.message : e);
}
logger.info(`Connected with ID: ${clientID}`);

@@ -117,3 +130,3 @@ updateRichPresence();

rpc.login(clientID)
.catch((err) => logger.error(err.stack ? err.stack : err.toString()));
.catch((err: Error) => logger.error(err.stack ? err.stack : err.toString()));
} else {

@@ -120,0 +133,0 @@ console.log(`

{
"name": "discotify",
"version": "0.2.20",
"version": "0.2.21",
"description": "Discord Rich Presence for spotify in TypeScript",

@@ -10,5 +10,5 @@ "homepage": "https://kurozero.xyz",

},
"main": "index.ts",
"main": "./app/index.js",
"scripts": {
"start": "ts-node index.ts"
"start": "node ./app/index.js"
},

@@ -31,7 +31,7 @@ "author": "KurozeroPB <pepijn.vanden.broek@gmail.com>",

"bin": {
"discotify": "./index.ts"
"discotify-test": "./app/index.js"
},
"dependencies": {
"axios": "^0.17.1",
"discord-rpc": "3.0.0-beta.3",
"discord-rpc": "github:devsnek/discord-rpc#master",
"request": "^2.83.0",

@@ -38,0 +38,0 @@ "winston": "^2.4.0"

@@ -15,3 +15,3 @@ <div align="center">

# discotify `0.2.20`
# discotify `0.2.21`
Spotify Rich Presence for Discord in TypeScript<br/>

@@ -21,3 +21,3 @@ *shows your currently playing song as a fancy rich presence in Discord*

Install globally with:<br/>
`npm install -g discotify@0.2.20`
`npm install -g discotify@0.2.21`

@@ -24,0 +24,0 @@ ## Requirements

{
"compilerOptions": {
"target": "es3",
"target": "es2017",
"module": "commonjs",
"allowJs": true,
"moduleResolution": "node",
"lib": ["es5"],
"lib": ["es6", "es7", "esnext"],
"noUnusedLocals": true,
"noUnusedParameters": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": false
},
"files": [
"typings.d.ts"
]
"outDir": "./app"
}
}
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