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

downloadstation-cli

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

downloadstation-cli - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

lib/error-codes.js

5

bin/sds.js

@@ -49,3 +49,3 @@ #!/usr/bin/env node

.command('list', { desc: 'List your tasks', run: list })
.command('new', { desc: 'Add new download task', run: create })
.command('add', { desc: 'Add new download task', run: create })
.command('config', {

@@ -61,6 +61,5 @@ desc: 'Setup your Synology Download Station',

async function main() {
const argv = await cli.parseAndExit();
console.log(JSON.stringify(argv, null, 2));
await cli.parseAndExit();
}
if (require.main === module) main();
const inquirer = require('inquirer');
const chalk = require('chalk');
const ora = require('ora');

@@ -21,5 +22,9 @@ const initialize = require('./init');

const spinner = ora('Adding new task ...').start();
// create new task
const task = await synology.create(answers.url);
spinner.stop();
if (task.success === true) {

@@ -26,0 +31,0 @@ console.log(chalk.green('Download task successfully created'));

4

commands/config.js
const inquirer = require('inquirer');
const validator = require('validator');
const Configstore = require('configstore');
const keytar = require('keytar');

@@ -54,6 +53,5 @@ const packageJson = require('../package.json');

config.set('username', answers.username);
keytar.setPassword(packageJson.name, answers.username, answers.password);
config.set('password', answers.password);
};
module.exports = { setup };
const Table = require('cli-table');
const chalk = require('chalk');
const pretty = require('prettysize');
const ora = require('ora');
const { handleError } = require('../lib/helpers');
const { getError } = require('../lib/error-codes');
const initialize = require('./init');
const list = async () => {
const spinner = ora('Retrieving tasks ...').start();
// initialize synology connection

@@ -16,3 +22,5 @@ const synology = await initialize();

// no tasks found, terminate here
if (ids.length === 0) {
spinner.stop();
console.log(chalk.green('No downloads tasks found'));

@@ -24,5 +32,13 @@ process.exit();

const tasksInfo = await synology.tasksInfo(ids.join(','));
// check for valid response
if (tasksInfo.success === false) {
spinner.stop();
const errorMessage = getError(tasksInfo.error.code);
handleError(errorMessage);
}
const tasksDetails = tasksInfo.data.tasks;
const width = process.stdout.columns - 67;
const width = process.stdout.columns - 70;

@@ -32,3 +48,3 @@ // build output table

style: { head: ['green'] },
colWidths: [width, 12, 12, 12, 12, 12],
colWidths: [width, 12, 12, 12, 13, 12],
head: [

@@ -55,2 +71,4 @@ 'File name',

spinner.stop();
console.log(table.toString());

@@ -57,0 +75,0 @@ };

const Configstore = require('configstore');
const keytar = require('keytar');

@@ -15,15 +14,9 @@ const packageJson = require('../package.json');

async getCredentials() {
const { url, username, token } = this.config.all;
const { url, username, password, token } = this.config.all;
if (!url || !username || !token) {
if (!url || !username || !password || !token) {
return null;
}
const password = await keytar.getPassword(packageJson.name, username);
if (password === null) {
return null;
}
return { url, username, token, password };
return { url, username, password, token };
}

@@ -30,0 +23,0 @@

@@ -0,1 +1,3 @@

const chalk = require('chalk');
const packageJson = require('../package.json');

@@ -5,4 +7,10 @@

const handleError = message => {
console.error(chalk.white.bgRed(message));
process.exit(1);
};
module.exports = {
getCommandName,
handleError,
};
{
"name": "downloadstation-cli",
"description": "Manage your Synology Download Station from your terminal",
"version": "0.3.1",
"version": "0.4.0",
"author": "Martín M.",

@@ -29,4 +29,4 @@ "license": "MIT",

"inquirer": "^7.1.0",
"keytar": "^5.5.0",
"node-fetch": "^2.6.0",
"ora": "^4.0.4",
"prettysize": "^2.0.0",

@@ -33,0 +33,0 @@ "sywac": "^1.3.0",

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