From fb826d6de294f23387b1fb4ef90ad20889779113 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Wed, 27 Mar 2024 14:34:17 +0200 Subject: [PATCH] fix(api): Added query argument `includeDisabled` to /zones API endpoint. If `true` returns all zones --- lib/api-server.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/api-server.js b/lib/api-server.js index 94ebbd8..9746c63 100644 --- a/lib/api-server.js +++ b/lib/api-server.js @@ -277,9 +277,12 @@ class APIServer { }); }); + // `/zones` – list enabled zones + // `/zones?includeDisabled=true` – list all zones, including disabled zones this.server.get('/zones', (req, res, next) => { + let includeDisabledZones = /^(true|yes|1)/i.test(req.query.includeDisabled); let zones = Object.keys(config.zones) - .filter(zone => config.zones[zone] && !config.zones[zone].disabled) + .filter(zone => config.zones[zone] && (includeDisabledZones || !config.zones[zone].disabled)) .map(zone => ({ name: zone }))