Commit Graph
194 Commits
Author SHA1 Message Date
Mcat12 cfea5cfca3 Only give relevant total in top domain JSON output
If it's `top_ads`, give `ads_blocked_today`. If it's `top_domains`, give `dns_queries_tdoay`. Both are not needed at the same time.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-06-26 21:32:15 -04:00
DL6ER 0dfb855605 Merge branch 'development' into new/API
Conflicts:
	request.c
2017-06-26 16:08:38 +02:00
Mcat12 5df0395824 Change key name of forwards over time JSON
Previously, both `forward_dest` and `forward_destinations` were keys in the JSON output at the root level. Which contains the over time data, and which contains the forward destination hostnames + IP addresses? Because of this ambiguity, the over time section should be renamed to `over_time`.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-06-25 20:00:08 -04:00
DL6ER 01dc64cea4 Refactor DB thread to run exclusively either saving queries into the DB *or* deleting old queries (i.e. every hour at minute 59 no queries will be saved to the DB, but instead, two minutes of data will be saved at the full hour) 2017-06-22 23:14:13 +02:00
DL6ER cda02291ff Add number of unique clients to statistics 2017-06-19 19:39:44 +02:00
DL6ER 6cab55125c Merge branch 'development' into new/API 2017-06-16 12:42:55 +02:00
DL6ER 1755c71a2b Restructure DELETE statement because it didn't work as expected (#81)
* Restructure DELETE statement because it didn't work as expected

* Revert changes in the Makefile
2017-06-16 12:33:44 +02:00
Mcat12 693e69befc Send API headers every time & simplify getList 2017-06-15 20:13:18 -04:00
Mcat12 a06ecba711 Make sure to send API headers even if there's no data 2017-06-15 20:09:09 -04:00
DL6ER cb9d1cd617 Add "/dns/status" 2017-06-15 11:37:10 +02:00
DL6ER c8f349d8db Stop at "&" after domain/client filtering strings 2017-06-15 11:16:19 +02:00
DL6ER 7cef472876 Imporve triming of newline character when reading in the lists.
The function strcspn() counts the number of characters until it hits a '\r' or a '\n' (in other words, it finds the first '\r' or '\n').
If it doesn't hit anything, it stops at the '\0' (returning the length of the string).
Note that this works fine even if there is no newline, because strcspn stops at a '\0'.
In that case, the entire line is simply replacing '\0' with '\0'.
2017-06-15 10:27:11 +02:00
DL6ER 0e3f8b5f06 Use getline() instead of the deprecated fgets() to avoid havng to used a fixed size buffer 2017-06-15 10:15:28 +02:00
DL6ER 1905f9cb71 Return data with key "blacklist" or "whitelist" instead of "data". Use predefined constants for the location of the white- and blacklist so they can easily be changed in one place, if needed. 2017-06-15 10:12:14 +02:00
DL6ER cce43dc36e It is no severe issue if the lists (e.g. blacklist) are not there - so we should just return an empty array. 2017-06-15 10:07:54 +02:00
Mcat12 446a1b9707 Add GET /dns/whitelist and /dns/blacklist 2017-06-14 21:31:01 -04:00
Mcat12 ecc2ef3a13 Do some formatting 2017-06-14 20:47:04 -04:00
DL6ER 5df32339a8 Send two additional counter values along with the top lists 2017-06-14 17:39:57 +02:00
DL6ER 59fe8732bb Return what is aksed for (top_domains) 2017-06-14 16:54:05 +02:00
DL6ER 30a3f7e90f Also send "dns_queries_today" in Top Domains / Ads requests 2017-06-14 16:53:14 +02:00
DL6ER 942250e936 Also send "dns_queries_today" in Top Clients request 2017-06-14 16:52:24 +02:00
DL6ER 70e3b5d9f4 Move "/overTime/*" -> "/stats/overTime/*" 2017-06-14 16:31:43 +02:00
DL6ER 9d891d5f89 Added "/overTime/query_types" 2017-06-14 16:30:06 +02:00
DL6ER 2aa2ff1af2 Added "/overTime/forward_dest", renamed "/stats/overTime" -> "/overTime/graphs" 2017-06-14 16:16:25 +02:00
DL6ER b868c568eb Add "/dns/recent_blocked" (can take argument ?limit=123) 2017-06-14 14:39:20 +02:00
DL6ER 2179f5d5ca Don't put integer values in quotes 2017-06-14 14:33:05 +02:00
DL6ER b5c500fdcf Fix all queries time filtering and SOCKET output determination 2017-06-14 14:22:44 +02:00
DL6ER 48d355bab0 Add "/history" 2017-06-14 14:09:11 +02:00
DL6ER f2f9601fb5 Greatly simplify code by not sending Content-Length (optional according to RFC 2616) 2017-06-14 13:27:47 +02:00
DL6ER 9cff88566c Two improvements: 1. Analyze only first line of HTTP request (before the whole header was analyzed), 2. Anaylze passed GET arguments properly, e.g. allow ?limit=123, but ignore ?sfqw=123 2017-06-14 13:01:27 +02:00
Mcat12 ea0a7cc127 Make memory error in getQueryTypes not fatal 2017-06-13 22:48:09 -04:00
Mcat12 249b9e981d Add alias path for forward destinations
Also make query types output more like the other responses.
2017-06-13 22:21:48 -04:00
Mcat12 0e7f484673 Add /stats/query_types 2017-06-13 21:59:34 -04:00
Mcat12 7af31af652 Add /stats/forward_dest 2017-06-13 21:37:11 -04:00
DL6ER 776bf43e9e Added /stats/top_clients 2017-06-14 00:05:17 +02:00
DL6ER 2b439cfbb0 Remove cJSON files. Note that it can be re-added cleanly into the code by reverting this commit. 2017-06-13 23:57:16 +02:00
DL6ER 4643f97fbc Add /stats/top_domains and /stats/top_ads and parameters therein 2017-06-13 23:53:54 +02:00
DL6ER 824b9e97dc Improve/add more comments to the code 2017-06-13 11:39:38 +02:00
DL6ER 1481176d1b Added overTime statistics to API, http://pi.hole:4747/stats/overTime and http://pi.hole/admin/api.php?overTimeData10mins give identical results 2017-06-13 11:30:45 +02:00
DL6ER b15f537d14 Clean socket routines, move detection of what the client is asking for into process_api_request() (request.c) much like we already do it for socket requests 2017-06-13 11:03:39 +02:00
DL6ER e20fe2a533 Output JSON data w/o using any extra JSON module 2017-06-13 10:45:17 +02:00
Mcat12 1d29630db2 Implement API JSON output for summary
Currently using the cJSON library, as it's entirely contained
within one source and one header file and is very easy to use.
By adding on the API output formats to the previous raw socket
code, we can simply change the output format when the response
type is `API` instead of `SOCKET`. As shown in the implemented
summary API code, this should be very simple for most commands.
2017-06-12 21:32:53 -04:00
DL6ER b2688bfd35 Add type variable to all request subroutines which can later be used to decide whether the output whould be in telnet format, or JSON (possibly even "v2" JSON) 2017-06-12 20:48:50 +02:00
DL6ER 19c54b0e0c Replace sprintf() + swrite() by the new ssend() routine. This enhancement removes the fixed buffer we used before and allows for responses having arbitraty lengths 2017-06-12 19:53:20 +02:00
DL6ER e159b5626e We don't allow caching the responds of FTL 2017-06-12 19:33:23 +02:00
DL6ER 692d69947e Add FTL SQLite3 implementation, we compile SQLite3 on-the-fly to become independent of installed libraries
Limit DB filesize, configureable via config file, if set to zero, the DB functionality is disabled altogether
Add ">dbstats" to the telnet interface
2017-06-09 09:47:13 +02:00
DL6ER 22e50c5a34 Use allocated boolean for free 2017-05-27 14:22:48 +02:00
DL6ER 3bead9d83c Used wrong index in getForwardDestinations 2017-05-27 14:19:53 +02:00
DL6ER c616bbc838 Don't exclude audited domains from dash board tables (#47) 2017-05-12 23:17:17 +02:00
DL6ER 14ab44a032 Restructure code such that cast is not necessary for qsort comparison function (#41) 2017-05-10 22:36:05 +02:00