From c1709d8c1ff76c790bae5ddb880e51f6e7fb378e Mon Sep 17 00:00:00 2001 From: nannal Date: Wed, 18 Nov 2020 23:27:12 +0200 Subject: [PATCH] Fixed to allow custom url option --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 02ed3f2..f95497d 100644 --- a/index.js +++ b/index.js @@ -2,10 +2,10 @@ const { program } = require('commander') const fetch = require('node-fetch'); const javalon = require('javalon') -url="https://avalonblacklist.nannal.com/" + program .option('-d, --debug', 'Output extra debugging') - .option('-U, --url ', 'Talk to an alternate blacklist service', url) + .option('-U, --url ', 'Talk to an alternate blacklist service', "https://avalonblacklist.nannal.com/") .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') @@ -32,7 +32,7 @@ if (!program.list=="black" && program.approve){ async function approve() { 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', body: JSON.stringify(body), headers: {'Content-Type': 'application/json'} @@ -45,7 +45,7 @@ async function approve() { async function addToList() { 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', body: JSON.stringify(body), headers: {'Content-Type': 'application/json'}