Commit Graph

39 Commits

Author SHA1 Message Date
Adam Warner
24d8754033 Revert "pihole api - use keepalive for curl queries" 2025-07-26 12:35:02 +01:00
Rob Gill
5b4a7b8b74 pihole api - use keepalive for curl queries
Adds the keepalive header to all curl requests

This reduces session establishment time across the multiple

requests necessary to authenticate, obtain response and log out

Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2025-07-26 18:48:32 +10:00
Dan Schaper
be36432f24 Speed up pihole api (#6336) 2025-07-21 10:51:25 -07:00
Christian König
71501e15e5 Re-order authentication errors in verbose mode
Signed-off-by: Christian König <github@yubiuser.dev>
2025-07-13 22:16:40 +02:00
Rob Gill
0187087da0 Speed up pihole --api
Get session authentication information via single jq operation,
setting defaults if no data returned.

Simplify jq test for valid JSON data

Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2025-07-14 05:44:46 +10:00
Christian König
d16c049768 Set PI_HOLE_SCRIPT_DIR in api.sh
Signed-off-by: Christian König <github@yubiuser.dev>
2025-06-05 14:45:29 +02:00
Christian König
6f429d82b4 Allow to get API URL from local.api.ftl even if DNS port has changed
Signed-off-by: Christian König <github@yubiuser.dev>
2025-05-30 21:05:08 +02:00
Dan Schaper
a04ed13d0a Allow simple pihole api output, containing only the JSON payload (#6096) 2025-05-16 13:57:04 -07:00
RD WebDesign
dee44cb3da Define "silent" as default option and include "verbose" to the man page
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-05-13 14:22:41 -03:00
Dan Schaper
de31858950 Use shell parameter expansion to split http_code and payload
Codespell

editorconfig

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2025-05-12 12:26:56 -07:00
RD WebDesign
190798e572 Allow simple pihole api output, containing only the JSON payload
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-05-12 14:23:15 -03:00
Christian König
fc103af050 Revert response code logic
Signed-off-by: Christian König <github@yubiuser.dev>
2025-05-04 21:45:44 +02:00
Christian König
1bea6db50a Fix API logic in api.sh
Signed-off-by: Christian König <github@yubiuser.dev>
2025-04-25 21:16:52 +02:00
Christian König
8733b429dd Treat FTL return data as strings - part II
Signed-off-by: Christian König <github@yubiuser.dev>
2025-04-20 22:50:55 +02:00
Christian König
ca1bab3c1b Fix more shellcheck warnings
Signed-off-by: Christian König <github@yubiuser.dev>
2025-04-07 10:52:57 +02:00
Christian König
5de9b6ae69 Add 2FA handling to api.sh
Signed-off-by: Christian König <github@yubiuser.dev>
2025-03-07 13:43:41 +01:00
Christian König
cadee26dba Improve dig error handlin in api.sh
Signed-off-by: Christian König <github@yubiuser.dev>
2025-02-22 13:48:55 +01:00
Christian König
3011d48b6f Use tail instead of parameter expansion
Signed-off-by: Christian König <github@yubiuser.dev>
2024-12-22 23:44:31 +01:00
Christian König
c777152c04 Only separat data and status when needed
Signed-off-by: Christian König <github@yubiuser.dev>
2024-12-22 21:57:47 +01:00
DL6ER
b304562c8e Add session details to API command output
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-08-24 10:39:12 +02:00
DL6ER
8e4fc27168 Add pihole api [endpoint] callback suitable for local API requests
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-08-24 10:06:48 +02:00
DL6ER
c2ed30480d Show when requested domains were not found on the list
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-06-25 14:10:35 +02:00
DL6ER
5dfcd02c40 Improve pihole -f
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-06-22 10:31:03 +02:00
DL6ER
25f384a923 Do not use CLI password when no password is set at all
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-06-20 19:41:47 +02:00
DL6ER
bfc18f8329 Rewrite list functions to use the API
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-06-19 23:04:39 +02:00
DL6ER
4df7cee6c2 Add partial matching hint if exact matching found nothing
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-06-19 22:21:43 +02:00
DL6ER
a2951cd3b8 Hide successful login/logout messages to avoid cluttering the terminal
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-06-19 22:19:54 +02:00
DL6ER
520641fa5e Try to use the CLI password for logins (if enabled and readable by the current user)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2024-06-19 22:18:11 +02:00
Christian König
debab10792 Use 204
Signed-off-by: Christian König <ckoenig@posteo.de>
2024-01-11 20:42:32 +01:00
yubiuser
2529fbeacd Treat FTL return data as strings (#5509) 2023-12-09 18:35:14 +01:00
Christian König
2681835f94 Treat FTL return data as strings
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-12-06 00:23:15 +01:00
DL6ER
32a741b5c7 We do not follow 308 but FTL also doesn't suggest it
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-12-02 22:42:36 +01:00
DL6ER
96bf07863f Use CHAOS TXT local.api.txt instead of trying to parse pihole-FTL --config webserver.ports
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-12-01 09:10:06 +01:00
DL6ER
6016131280 Ensure we also check the last port
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-28 22:59:49 +01:00
DL6ER
974fea592d Iterate over ports, skip redirected ports
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-28 00:05:55 +01:00
DL6ER
a6565bf9a1 Support special webserver.port ports ending in "s" (secure) and "r" (redirect)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2023-11-23 22:07:31 +01:00
Christian König
f7ba059b94 Query directly and authenticate only if required
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-10-14 14:03:56 +02:00
Christian König
ee4eb8db20 chmod +x
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-08-13 22:26:44 +02:00
Christian König
2227a2c569 Add API functions
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-08-09 21:25:50 +02:00