mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
added flag for enabling
This commit is contained in:
parent
2fb1daab99
commit
95c6c0e1e1
@ -2,13 +2,17 @@ const axios = require('axios');
|
|||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
const qs = require('querystring');
|
const qs = require('querystring');
|
||||||
|
|
||||||
|
const PIHOLE_PLUGIN_ENABLED = process.env.PIHOLE_PLUGIN_ENABLED === 'true';
|
||||||
const PIHOLE_PASSWORD = process.env.PIHOLE_PASSWORD;
|
const PIHOLE_PASSWORD = process.env.PIHOLE_PASSWORD;
|
||||||
const PIHOLE_LOGIN_URL = 'http://'+process.env.PIHOLE_IP+'/admin/index.php';
|
const PIHOLE_LOGIN_URL = 'http://'+process.env.PIHOLE_IP+'/admin/index.php';
|
||||||
const PIHOLE_CUSTOMDNS_URL = 'http://'+process.env.PIHOLE_IP+'/admin/scripts/pi-hole/php/customdns.php';
|
const PIHOLE_CUSTOMDNS_URL = 'http://'+process.env.PIHOLE_IP+'/admin/scripts/pi-hole/php/customdns.php';
|
||||||
|
|
||||||
// Function to update Pi-hole with domain and IP
|
// Function to update Pi-hole with domain and IP
|
||||||
async function updatePihole(domain, ip,action) {
|
async function updatePihole(domain, ip,action) {
|
||||||
|
// Check if the Pi-hole plugin is enabled
|
||||||
|
if (!PIHOLE_PLUGIN_ENABLED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// Step 1: Login to Pi-hole to get session cookie
|
// Step 1: Login to Pi-hole to get session cookie
|
||||||
const loginResponse = await axios.post(PIHOLE_LOGIN_URL, qs.stringify({
|
const loginResponse = await axios.post(PIHOLE_LOGIN_URL, qs.stringify({
|
||||||
|
Loading…
Reference in New Issue
Block a user