Fixed approving new users

master
nannal 3 years ago
parent c1709d8c1f
commit 6078577ca1

@ -9,15 +9,16 @@ program
.option('-l,--list <black>', 'Which list to add the target to', "black")
.option('-a,--approve <nannal>', 'Expand the list of approved list editors')
.option('-r,--reason <piracy>', 'Justify why a user should be added to the provided list')
.option('-t,--target <coviddoubter2020>', 'Which user will be added to the list')
.requiredOption('-k,--key <key>', 'Any valid private key for your DTube user')
.requiredOption('-u,--user <myUser>', 'Your DTube username')
.requiredOption('-t,--target <coviddoubter2020>', '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'}

Loading…
Cancel
Save