diff --git a/index.js b/index.js index f95497d..520d267 100644 --- a/index.js +++ b/index.js @@ -9,15 +9,16 @@ program .option('-l,--list ', 'Which list to add the target to', "black") .option('-a,--approve ', 'Expand the list of approved list editors') .option('-r,--reason ', 'Justify why a user should be added to the provided list') + .option('-t,--target ', 'Which user will be added to the list') .requiredOption('-k,--key ', 'Any valid private key for your DTube user') .requiredOption('-u,--user ', 'Your DTube username') - .requiredOption('-t,--target ', 'Which user will be added to the list') + program.parse(process.argv) if (!program.list=="black" && program.approve){ console.log("Please choose either -a or -l, you can't approve and add someone to a list at the same time") -} else if (program.option && !program.reason) { +} else if (program.target && !program.reason) { console.log("Please inform other users why you put the user on the chosen list") } else { if (program.approve){ @@ -30,9 +31,9 @@ if (!program.list=="black" && program.approve){ } async function approve() { - body = javalon.sign(program.key, program.user, {user:program.target}) - - const response = await fetch(program.url+'submit', { + body = javalon.sign(program.key, program.user, {user:program.approve}) + console.log(body) + const response = await fetch(program.url+'approve', { method: 'post', body: JSON.stringify(body), headers: {'Content-Type': 'application/json'}