diff options
-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; |