From c5b9b8ac465b430361d253fe558ffb505b27e182 Mon Sep 17 00:00:00 2001 From: rain Date: Fri, 18 Aug 2023 13:11:42 -0500 Subject: Implemented #1 --- snappy.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/snappy.js b/snappy.js index 59ced51..96fd5a6 100755 --- a/snappy.js +++ b/snappy.js @@ -26,7 +26,8 @@ if(argv.h){ ["-w", ""], ["-v", ""], ["-t", "Add additional delay to screenshots (Seconds)"], - ["-p", ""] + ["-p", ""], + ["-o", ""] ]; process.stdout.write(colors.green(`Possible Arguments:\n`)); @@ -71,6 +72,13 @@ if(argv.p){ process.stdout.write(colors.yellow(`\r${emotes['ck']} Traffic will use SOCKS5 proxy on port `) + colors.green(`${argv.p}\n`)); } +// Check if there is a custom output directory +if(argv.o){ + process.stdout.write(colors.yellow(`\r${emotes['ck']} Set output directory to `) + colors.green(`${argv.o}\n`)); +} else { + argv.o = "./"; +} + // MODULE LOADING SECTION DONE console.log(colors.cyan(" ..................... ")); @@ -137,7 +145,7 @@ async function run() { await page.goto(site, { waitUntil: 'networkidle2' }).then(async () => { let userTimeout = parseInt(argv.t); await timeout(isNaN(userTimeout)?0:userTimeout*1000); - await page.screenshot({path: imageName}).then(async () => { + await page.screenshot({path: argv.o + imageName}).then(async () => { if(!argv.v) return; const res = await verifyImage(imageName); -- cgit v1.2.3