Now that we have cookies, persistant config file, we can log

and stay logged between run (or I hope so) so add a delog command,
and make the cookie monster happy.
This commit is contained in:
Godzil 2018-08-01 00:52:23 +01:00
parent a582b15103
commit 9fb85d4376
2 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import commander = require('commander');
import fs = require('fs');
import path = require('path');
import log = require('./log');
import my_request = require('./my_request');
import cfg = require('./config');
import series from './series';
@ -27,6 +28,17 @@ export default function(args: string[], done: (err?: Error) => void)
// Update the config file with new parameters
cfg.save(config);
if (config.unlog)
{
config.crDeviceId = undefined;
config.user = undefined;
config.pass = undefined;
my_request.eatCookies(config);
cfg.save(config);
log.info("Unlogged!");
process.exit(0);
}
// set resolution
if (config.resolution)
{
@ -307,6 +319,7 @@ function parse(args: string[]): IConfigLine
// Authentication
.option('-p, --pass <s>', 'The password.')
.option('-u, --user <s>', 'The e-mail address or username.')
.option('-d, --unlog', 'Unlog')
// Disables
.option('-c, --cache', 'Disables the cache.')
.option('-m, --merge', 'Disables merging subtitles and videos.')

View File

@ -19,6 +19,7 @@ interface IConfig {
batch?: string;
verbose?: boolean;
debug?: boolean;
unlog?: boolean;
retry?: number;
// Login options
logUsingApi?: boolean;