Adjusted tests to fit the current lack of output on the unix socket.
Added TELNET enum and used it in place of the old SOCKET to better fit
with the rest of the code base.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Currently has the hardcoded password of "password". You gain a session
by sending JSON to the API with the key of `password` and the value
set to the password you are trying to use. Then it will return a success
response with the session and will add a Set-Cookie header to set the
FTL_SESSION cookie to the session number.
The summary, queries graph, and status are accessible without
authentication.
The internal data structure used to store the sessions is valid for up
to 24 minutes after the last query. If it becomes invalid then it is
eligible to be reused for a new session. The garbage collection can be
optimized further, but it is not a problem at the moment.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This requires the `pihole` user to have sudo access to the `pihole`
command (will require a core update). Many future API commands will have
this requirement, as they too will be using the `pihole` command.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
Uses cJSON to parse, but output will still be handled directly.
I implemented different API response methods to allow for different HTTP
response codes to be sent.
The addList code is still dumb and doesn't do anything, but it's getting
there.
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>