Compare commits
2 Commits
bb0ac7a874
...
c1709d8c1f
Author | SHA1 | Date | |
---|---|---|---|
|
c1709d8c1f | ||
|
199dc4eb15 |
12
index.js
12
index.js
@ -2,11 +2,11 @@ const { program } = require('commander')
|
|||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const javalon = require('javalon')
|
const javalon = require('javalon')
|
||||||
|
|
||||||
url="https://avalonblacklist.nannal.com/"
|
|
||||||
program
|
program
|
||||||
.option('-d, --debug', 'Output extra debugging')
|
.option('-d, --debug', 'Output extra debugging')
|
||||||
.option('-U, --url <url>', 'Talk to an alternate blacklist service', url)
|
.option('-U, --url <url>', 'Talk to an alternate blacklist service', "https://avalonblacklist.nannal.com/")
|
||||||
.option('-l,--list <black>', 'Which list to add the target to')
|
.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')
|
||||||
.requiredOption('-k,--key <key>', 'Any valid private key for your DTube user')
|
.requiredOption('-k,--key <key>', 'Any valid private key for your DTube user')
|
||||||
@ -15,7 +15,7 @@ program
|
|||||||
|
|
||||||
program.parse(process.argv)
|
program.parse(process.argv)
|
||||||
|
|
||||||
if (!program.list && 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.option && !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")
|
||||||
@ -32,7 +32,7 @@ if (!program.list && 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.target})
|
||||||
|
|
||||||
const response = await fetch(url+'submit', {
|
const response = await fetch(program.url+'submit', {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
headers: {'Content-Type': 'application/json'}
|
headers: {'Content-Type': 'application/json'}
|
||||||
@ -45,7 +45,7 @@ async function approve() {
|
|||||||
async function addToList() {
|
async function addToList() {
|
||||||
body = javalon.sign(program.key, program.user, {user: program.target, status: program.list, reason: program.reason})
|
body = javalon.sign(program.key, program.user, {user: program.target, status: program.list, reason: program.reason})
|
||||||
|
|
||||||
const response = await fetch(url+'submit', {
|
const response = await fetch(program.url+'submit', {
|
||||||
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