Commit Graph

185 Commits

Author SHA1 Message Date
DL6ER 822f8c6a28 Implement proper error handling for network table IP address sub-query
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-17 20:07:31 +02:00
DL6ER ae035c4ba7 Put FIFO log into its own unit (out of the API code)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-17 20:07:31 +02:00
DL6ER 3906490958 Return SQL error to user if sourcing data from the network table fails
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-17 20:07:31 +02:00
DL6ER e10d7fe27e Avoid buffer overflow.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-17 20:07:31 +02:00
DL6ER e018146faa Rename /api/ftl/clientIP to /api/ftl/client as we return more data than just the IP address (this is mostly a testing endpoint)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-17 20:07:31 +02:00
DL6ER 784b8ba3c9 Differentiate between POST (error on existing) and PUT, PATCH (replace if existing) for domain lists. Also return GET style reponse on success.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-17 20:07:30 +02:00
DL6ER fa5f6cdcdf Use booleans instead of string for controlling the blocking status. Return the GET response after a successful PATCH request.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-17 20:07:30 +02:00
DL6ER be3b4045ae Add filtering for domainlist endpoints
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-17 00:44:44 +02:00
DL6ER fc4f850259 Uniform GET and POST keys and rename /dns/status to /dns/blocking to avoid misunderstandings
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-16 23:44:48 +02:00
DL6ER 56fe849d83 Move white- and blacklist endpoints one level up
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-16 23:11:20 +02:00
DL6ER 2c78622cd2 Streamline /api/dns endpoints while writing the documentation for them
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-16 19:09:31 +02:00
DL6ER 67a0395390 Redirect PH7 errors into pihole-FTL.log (instead of showing in the browser output) and define gethostname() PHP function.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-02 08:52:55 +02:00
DL6ER cf5f3ef464 gcc-9 optimizations.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-01 09:44:49 +02:00
DL6ER de09b73eb7 Use embedded PH7 instead of external PHP-CGI interpreter.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-30 15:44:16 +02:00
DL6ER c92a0e4bc4 Generally assume authentication to ease the development phase until we are actually able to add authentication.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-29 20:54:30 +02:00
DL6ER 2c6e2ae41f Add NAPTR support for /api/stats/summary
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-29 00:42:35 +02:00
DL6ER 473a88f077 Remove React-specific index page rerouting.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-29 00:24:00 +02:00
DL6ER 308c80bc5a Add PHP support in Pi-hole' HTTP server.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-28 23:59:52 +02:00
DL6ER 6e40e3b2dc Finish transition to cmake on the new/http branch.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-28 20:23:51 +02:00
DL6ER 5d54d3412c Compute average response times for used upstream destinations.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:42:18 +02:00
DL6ER 6a4040e8a5 Minor optimizations to domain list handling routines (reading, adding, and removing)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:17 +02:00
DL6ER 5bdf2b96cc Fix forwarded queries counting logic quirk.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:17 +02:00
DL6ER 4dacd1c759 Make JSON string macros robust against being called with NULL strings.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER ef5cfe0a17 Add /api/stats/database/upstreams
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER a7500f1d58 Add /api/stats/database/query_types
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER cb8131d9ac Add /api/stats/database/overTime/clients
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER 7c97cb6631 Add /api/stats/database/summary
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER 76b72bf1b7 Add /api/stats/database/top_clients by generalizing the top-domains into a top-items function that can process both.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER 429622d8e9 Add /api/stats/database/top_domains and /api/stats/database/top_blocked
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER 4516ee5186 Relock shared memory before returning an error message.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER f2412873b8 Add /admin/api/stats/database/overTime/history - this allows users to select a different time interval on the dash board than only "last 24 hours".
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:37:16 +02:00
DL6ER 0f7ead8663 A few output optimizations for /api/dns/cacheinfo
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:36:13 +02:00
DL6ER 6871dbdd04 Add /api/dns/cacheinfo
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:36:13 +02:00
DL6ER 091e656de8 Only walk known IP addresses when SELECT query succeeded
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:34:23 +02:00
DL6ER 9d24bae8be Add /api/ftl/network
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:34:23 +02:00
DL6ER 46c622f256 Keep up to 64 lines of dnsmasq messages in the FIFO buffer.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:34:23 +02:00
DL6ER a6a7b9712e Add API_PRETTY_JSON config option as run-time (instead of compile-time) option for human-friendy API output.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:34:23 +02:00
DL6ER fdce5481f9 Send all details we have about a domain (excluding the database ID, because we don't need it). See PR web#440 for the necessary changes in NG web.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:34:23 +02:00
DL6ER 6bf7fb782e Read directly from domainlist table instead of using the views. This allows us to read also disabled domains plus to get all the corresponding data: date_added, date_modified, comment, enabled. They are now available in FTL, however the JSON format expected by the web interface needs to be changed to be able to send this information over.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:34:23 +02:00
DL6ER 257fcbf695 Implement transition from individual domain lists into a unified domainlist (see core PR #3015).
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:31:54 +02:00
DL6ER 5d03136e39 Send 200 queries for the query log at once. With this, the clients will always have some pages of the table in their cache.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER c639cf9b6d Actively free expired user sessions to make room for new ones.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER c38285461f Automatically log in users when there is no (or an empty) password set in setupVars.conf
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER c389f06944 Make HTTP/API session timeout configurable through pihole-FTL.conf
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER 8742e140c0 Update user cookie when session is still running.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER 76bcef3771 Update timestamp of known client when we see them again.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER 41a1da65cd Refresh in-memory index.html on receipt of SIGHUP. This allows replacing the content of /admin without having to restart FTL.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER 8ce1ac146e /api/stats/history: Only use cursor when it is a numeric value, skip if "null".
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER 5d61a0c22e Add NULL cursor in history result when privacy level is too high.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00
DL6ER b9857664f5 Lock SHM during API access.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-27 00:28:30 +02:00