diff options
author | Floren Munteanu <fmunteanu@users.noreply.github.com> | 2023-02-19 15:18:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-19 12:18:56 -0800 |
commit | d362add383b622c4b941e8bdd02b741393c65bd0 (patch) | |
tree | 44d2e18100e760f3637d62aac2bb0fbddb0c0310 | |
parent | dfde8ea89d02f59f5408585702c0f2cf3f94eac1 (diff) | |
download | homer-23.02.2.tar.gz homer-23.02.2.tar.zst homer-23.02.2.zip |
Implement PiHole API token (#580)v23.02.2
Implement PiHole API token
-rw-r--r-- | docs/customservices.md | 4 | ||||
-rw-r--r-- | src/components/services/PiHole.vue | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/docs/customservices.md b/docs/customservices.md index b28f399..31d302b 100644 --- a/docs/customservices.md +++ b/docs/customservices.md | |||
@@ -58,9 +58,13 @@ The following configuration is available for the PiHole service. | |||
58 | logo: "assets/tools/sample.png" | 58 | logo: "assets/tools/sample.png" |
59 | # subtitle: "Network-wide Ad Blocking" # optional, if no subtitle is defined, PiHole statistics will be shown | 59 | # subtitle: "Network-wide Ad Blocking" # optional, if no subtitle is defined, PiHole statistics will be shown |
60 | url: "http://192.168.0.151/admin" | 60 | url: "http://192.168.0.151/admin" |
61 | apikey: "<---insert-api-key-here--->" # optional, needed if web interface is password protected | ||
61 | type: "PiHole" | 62 | type: "PiHole" |
62 | ``` | 63 | ``` |
63 | 64 | ||
65 | **Remarks:** | ||
66 | If PiHole web interface is password protected, obtain the `apikey` from Settings > API/Web interface > Show API token. | ||
67 | |||
64 | ## OpenWeatherMap | 68 | ## OpenWeatherMap |
65 | 69 | ||
66 | Using the OpenWeatherMap service you can display weather information about a given location. | 70 | Using the OpenWeatherMap service you can display weather information about a given location. |
diff --git a/src/components/services/PiHole.vue b/src/components/services/PiHole.vue index 9aac016..237cb12 100644 --- a/src/components/services/PiHole.vue +++ b/src/components/services/PiHole.vue | |||
@@ -49,7 +49,11 @@ export default { | |||
49 | }, | 49 | }, |
50 | methods: { | 50 | methods: { |
51 | fetchStatus: async function () { | 51 | fetchStatus: async function () { |
52 | const result = await this.fetch("/api.php").catch((e) => console.log(e)); | 52 | const authQueryParams = this.item.apikey |
53 | ? `?summaryRaw&auth=${this.item.apikey}` | ||
54 | : ""; | ||
55 | const result = await this.fetch(`/api.php${authQueryParams}`) | ||
56 | .catch((e) => console.log(e)); | ||
53 | 57 | ||
54 | this.status = result.status; | 58 | this.status = result.status; |
55 | this.ads_percentage_today = result.ads_percentage_today; | 59 | this.ads_percentage_today = result.ads_percentage_today; |