Make lint happy (sorry cookie monster, nothing for you here :( )

This commit is contained in:
Godzil 2018-08-01 19:57:29 +01:00
parent 9c3aaf220a
commit 2e8de8c5c2
3 changed files with 13 additions and 8 deletions

View File

@ -35,7 +35,8 @@ export default function(args: string[], done: (err?: Error) => void)
config.pass = undefined; config.pass = undefined;
my_request.eatCookies(config); my_request.eatCookies(config);
cfg.save(config); cfg.save(config);
log.info("Unlogged!"); log.info('Unlogged!');
process.exit(0); process.exit(0);
} }

View File

@ -3,7 +3,7 @@ import os = require('os');
import fs = require('fs-extra'); import fs = require('fs-extra');
import path = require('path'); import path = require('path');
const configFile = path.join(process.cwd(), "config.json"); const configFile = path.join(process.cwd(), 'config.json');
function fileExist(path: string) function fileExist(path: string)
{ {
@ -24,7 +24,7 @@ export function load(): IConfigLine
const data = fs.readFileSync(configFile, 'utf8'); const data = fs.readFileSync(configFile, 'utf8');
return JSON.parse(data); return JSON.parse(data);
} }
return {args: undefined}; return {args: undefined};
} }

View File

@ -152,10 +152,12 @@ function checkIfUserIsAuth(config: IConfig, done: (err: Error) => void): void
function loadCookies(config: IConfig) function loadCookies(config: IConfig)
{ {
const cookiePath = path.join(config.output || process.cwd(), '.cookies.json'); const cookiePath = path.join(config.output || process.cwd(), '.cookies.json');
if(!fs.existsSync(cookiePath))
if (!fs.existsSync(cookiePath))
{ {
fs.closeSync(fs.openSync(cookiePath, 'w')); fs.closeSync(fs.openSync(cookiePath, 'w'));
} }
j = request.jar(new cookieStore(cookiePath)); j = request.jar(new cookieStore(cookiePath));
} }
@ -163,10 +165,11 @@ export function eatCookies(config: IConfig)
{ {
const cookiePath = path.join(config.output || process.cwd(), '.cookies.json'); const cookiePath = path.join(config.output || process.cwd(), '.cookies.json');
if(fs.existsSync(cookiePath)) if (fs.existsSync(cookiePath))
{ {
fs.removeSync(cookiePath); fs.removeSync(cookiePath);
} }
j = undefined; j = undefined;
} }
@ -190,6 +193,7 @@ export function get(config: IConfig, options: string|request.Options, done: (err
cloudscraper.request(modify(options, 'GET'), (error: any, response: any, body: any) => cloudscraper.request(modify(options, 'GET'), (error: any, response: any, body: any) =>
{ {
if (error) return done(error); if (error) return done(error);
done(null, typeof body === 'string' ? body : String(body)); done(null, typeof body === 'string' ? body : String(body));
}); });
}); });
@ -209,14 +213,14 @@ export function post(config: IConfig, options: request.Options, done: (err: Erro
{ {
if (err) if (err)
{ {
return done(err); return done(err);
} }
cloudscraper.request(modify(options, 'POST'), (error: Error, response: any, body: any) => cloudscraper.request(modify(options, 'POST'), (error: Error, response: any, body: any) =>
{ {
if (error) if (error)
{ {
return done(error); return done(error);
} }
done(null, typeof body === 'string' ? body : String(body)); done(null, typeof body === 'string' ? body : String(body));
}); });