From fdafbb9aaac5ab85cfc1084c2e94bcc542617340 Mon Sep 17 00:00:00 2001 From: Danyal Date: Tue, 11 Jul 2023 23:28:56 +0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=20fix=20pi-hole=20integra?= =?UTF-8?q?tion=20field=20from=20password=20to=20apiKey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/modules/dns-hole/control.ts | 2 +- src/pages/api/modules/dns-hole/summary.spec.ts | 6 +++--- src/pages/api/modules/dns-hole/summary.ts | 2 +- src/server/api/routers/dns-hole.ts | 4 ++-- src/types/app.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/api/modules/dns-hole/control.ts b/src/pages/api/modules/dns-hole/control.ts index c3a3424dc..4dfe4b522 100644 --- a/src/pages/api/modules/dns-hole/control.ts +++ b/src/pages/api/modules/dns-hole/control.ts @@ -57,7 +57,7 @@ const processAdGuard = async (app: ConfigAppType, enable: boolean) => { }; const processPiHole = async (app: ConfigAppType, enable: boolean) => { - const pihole = new PiHoleClient(app.url, findAppProperty(app, 'password')); + const pihole = new PiHoleClient(app.url, findAppProperty(app, 'apiKey')); if (enable) { await pihole.enable(); diff --git a/src/pages/api/modules/dns-hole/summary.spec.ts b/src/pages/api/modules/dns-hole/summary.spec.ts index e80999a3e..05470be69 100644 --- a/src/pages/api/modules/dns-hole/summary.spec.ts +++ b/src/pages/api/modules/dns-hole/summary.spec.ts @@ -28,7 +28,7 @@ describe('DNS hole', () => { type: 'pihole', properties: [ { - field: 'password', + field: 'apiKey', type: 'private', value: 'hf3829fj238g8', }, @@ -130,7 +130,7 @@ describe('DNS hole', () => { type: 'pihole', properties: [ { - field: 'password', + field: 'apiKey', type: 'private', value: 'hf3829fj238g8', }, @@ -144,7 +144,7 @@ describe('DNS hole', () => { type: 'pihole', properties: [ { - field: 'password', + field: 'apiKey', type: 'private', value: 'ayaka', }, diff --git a/src/pages/api/modules/dns-hole/summary.ts b/src/pages/api/modules/dns-hole/summary.ts index 8970f0851..2807b711b 100644 --- a/src/pages/api/modules/dns-hole/summary.ts +++ b/src/pages/api/modules/dns-hole/summary.ts @@ -32,7 +32,7 @@ export const Get = async (request: NextApiRequest, response: NextApiResponse) => try { switch (app.integration?.type) { case 'pihole': { - const piHole = new PiHoleClient(app.url, findAppProperty(app, 'password')); + const piHole = new PiHoleClient(app.url, findAppProperty(app, 'apiKey')); const summary = await piHole.getSummary(); data.domainsBeingBlocked += summary.domains_being_blocked; diff --git a/src/server/api/routers/dns-hole.ts b/src/server/api/routers/dns-hole.ts index 13d98e962..19d903c84 100644 --- a/src/server/api/routers/dns-hole.ts +++ b/src/server/api/routers/dns-hole.ts @@ -97,7 +97,7 @@ const processAdGuard = async (app: ConfigAppType, enable: boolean) => { }; const processPiHole = async (app: ConfigAppType, enable: boolean) => { - const pihole = new PiHoleClient(app.url, findAppProperty(app, 'password')); + const pihole = new PiHoleClient(app.url, findAppProperty(app, 'apiKey')); if (enable) { await pihole.enable(); @@ -108,7 +108,7 @@ const processPiHole = async (app: ConfigAppType, enable: boolean) => { }; const collectPiHoleSummary = async (app: ConfigAppType) => { - const piHole = new PiHoleClient(app.url, findAppProperty(app, 'password')); + const piHole = new PiHoleClient(app.url, findAppProperty(app, 'apiKey')); const summary = await piHole.getSummary(); return { diff --git a/src/types/app.ts b/src/types/app.ts index 847ef8353..7d4f481f9 100644 --- a/src/types/app.ts +++ b/src/types/app.ts @@ -86,7 +86,7 @@ export const integrationFieldProperties: { transmission: ['username', 'password'], jellyfin: ['username', 'password'], plex: ['apiKey'], - pihole: ['password'], + pihole: ['apiKey'], adGuardHome: ['username', 'password'], };