Fixed approving new users
This commit is contained in:
parent
c1709d8c1f
commit
6078577ca1
11
index.js
11
index.js
@ -9,15 +9,16 @@ program
|
|||||||
.option('-l,--list <black>', 'Which list to add the target to', "black")
|
.option('-l,--list <black>', 'Which list to add the target to', "black")
|
||||||
.option('-a,--approve <nannal>', 'Expand the list of approved list editors')
|
.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('-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('-k,--key <key>', 'Any valid private key for your DTube user')
|
||||||
.requiredOption('-u,--user <myUser>', 'Your DTube username')
|
.requiredOption('-u,--user <myUser>', 'Your DTube username')
|
||||||
.requiredOption('-t,--target <coviddoubter2020>', 'Which user will be added to the list')
|
|
||||||
|
|
||||||
program.parse(process.argv)
|
program.parse(process.argv)
|
||||||
|
|
||||||
if (!program.list=="black" && program.approve){
|
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")
|
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")
|
console.log("Please inform other users why you put the user on the chosen list")
|
||||||
} else {
|
} else {
|
||||||
if (program.approve){
|
if (program.approve){
|
||||||
@ -30,9 +31,9 @@ if (!program.list=="black" && program.approve){
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function approve() {
|
async function approve() {
|
||||||
body = javalon.sign(program.key, program.user, {user:program.target})
|
body = javalon.sign(program.key, program.user, {user:program.approve})
|
||||||
|
console.log(body)
|
||||||
const response = await fetch(program.url+'submit', {
|
const response = await fetch(program.url+'approve', {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
headers: {'Content-Type': 'application/json'}
|
headers: {'Content-Type': 'application/json'}
|
||||||
|
Loading…
Reference in New Issue
Block a user