Commit graph

125 commits

Author SHA1 Message Date
3b071727c3 Properly use the extra delay in all cases 2020-09-04 15:10:24 +01:00
a5e2c14171 Rename header to header_list 2020-09-04 15:09:08 +01:00
f8fde74b84 Rename section "rules" to "options" 2020-09-04 15:06:17 +01:00
d1573c6218 Header entries should be case insensitive 2020-09-04 02:29:26 +01:00
9dffbf811c Throw an exception when response is not 200 OK
Not sure this is the best way to do this, but
at least I'm not just ignoring errors now.
2020-09-04 01:56:38 +01:00
c98083837d Fix for the new server's reply
Just when I was about to deploy it they changed the
server to return HTTP/2... lol
No big deal (I think), fix the http header parser so
if the "OK" message string is missing it'll keep
parsing.
2020-09-04 01:17:59 +01:00
b768015b52 Implement ApiNap::fame_list() 2020-09-04 00:58:12 +01:00
571a92aa2e Implement ApiNap::market_list() 2020-09-04 00:58:12 +01:00
1cb40fd5ba Replace string_view with string
In datatypes.cpp function to_timestamp() the
istringstream needs a string, so passing
a string_view around is pointless.
2020-09-04 00:05:19 +01:00
8ca23eb221 Implement ApiNap::items_icons() 2020-09-03 23:51:38 +01:00
d66c020ad8 Implement ApiNap::items_list() 2020-09-03 23:47:33 +01:00
2aaf500b66 Implement ApiNap::WhoAmI()
Refactor code out into fetch_and_parse() since the
two functions were pretty much the copy paste of
the other. This should simplify the rest of the
missing implementations too.
2020-09-03 23:04:41 +01:00
3ff82985c9 Implement ApiNap::ping() 2020-09-03 01:59:33 +01:00
99d577f43a Bugfix in HttpResponse
string_views are potentially wrong if raw is very small
and stdlib has small string optimisation. Use unique_ptr
instead to force allocations in all cases.
2020-09-03 00:55:16 +01:00
5342185370 Build fix for systems without libev in pkg-config 2020-08-29 19:32:18 +01:00
d433e05877 Change restc-cpp into a meson wrap (lest too) 2020-08-29 18:03:04 +01:00
32dea4d089 Add virtual do destructor 2020-08-29 17:20:05 +01:00
4e63e1b246 Make Api virtual.
I think this is a bit better than what I had before.
Still a mess, but that's conditional compilation for you.
2020-08-29 17:10:41 +01:00
80bfbc640a Add option to choose between restc-cpp and nap
I don't think this is very clean, but they might fix
the bug in restc-cpp that is currently holding this
project back, and I might want to go back to it.
I might refactor this into a virtual class.
2020-08-29 16:42:34 +01:00
8b09d7da53 Store headers as string lines
curl ultimately expects null-terminated strings and
makes a copy of each, so it's pointless to mess
around with string_views and stuff if I have to make
a copy for curl at the end anyways.
2020-08-29 15:18:33 +01:00
bc6b20563b Send user specified headers with the request 2020-08-29 14:30:08 +01:00
74e98211a7 Start working on QuickRest 2020-08-29 14:28:47 +01:00
c4935ac70d Move rest stuff into nap subdir.
Nap is a quick REST. Silly joke really, but hey, 3 letters.
Great namespace name.
2020-08-29 12:34:55 +01:00
05c03c2daf Working on a replacement for restc-cpp 2020-08-29 01:54:52 +01:00
440fbd52b9 Don't install unnecessary files 2020-08-28 01:35:07 +01:00
85f7ac321e Add simdjson wrap file and meson scripts 2020-08-28 01:07:12 +01:00
6b41e08403 Fix SQLiteCpp meson scripts. 2020-08-28 00:13:13 +01:00
ada38348ee Change SQLiteCpp into a wrap file 2020-08-28 00:04:31 +01:00
e856918963 Add curlcpp subproject 2020-08-27 23:55:15 +01:00
5ef7a880e0 Get rid of redundant if 2020-08-27 17:39:06 +01:00
2c36e6794e Use the if_found feature for subdir() 2020-08-27 16:08:06 +01:00
be1a19f7c7 Move backend name to config file
Still, only one backend is available at this point.
2020-08-22 02:30:00 +01:00
c5e0b01b06 Add OriginsDB base class and a make() function
This fixes the build. The make function for the moment
just takes a string since that's all that's ever needed.
This is supposed to change since the postgresql database
will need a port, an url, password etc. Maybe
connection strings are still a thing, but if not then
I'll probably need to find a way to accept arbitrary
parameters in OriginsDB::make().
2020-08-22 01:57:14 +01:00
217c844893 Move OriginsDB sqlite files
This breaks the build
2020-08-22 01:53:04 +01:00
2a407294e1 Add an option to enable/disable sqlite backend
Currently you can't disable it since sqlite is the only
supported backend and you must have at least one enabled
and available on the system. This will be needed for later.
2020-08-22 01:30:04 +01:00
4b641e7976 Fix restc-cpp unit test's build 2020-08-22 00:50:56 +01:00
6dc4c3133f Import cmake unit test to restc-cpp 2020-08-21 21:16:05 +01:00
c1598fedb1 Add lest lib
It's required by tests in restc-cpp which I'm progressively adding
2020-08-21 21:16:05 +01:00
a1aeb3c587 Server is returning some shops selling unknown items, add support for it
Previously the code would just throw an exception and
quit (foreign key constraint violation). Add an empty
row with the missing id so it will work. When the item
list returns that item the next time, the empty row will
be filled.
2020-08-16 22:29:46 +01:00
d66af7779d Try to manage error responses
I can't get the header of the error response because of this
https://github.com/jgaa/restc-cpp/issues/102 so I'm just
hardcoding some timeout and code will keep trying.
2020-08-16 17:46:32 +01:00
a0bb97e8b7 Add new sample response 2020-08-16 17:44:41 +01:00
d5ee1cd11b Add some debug printing 2020-08-16 16:29:43 +01:00
1fcd7bd749 Append the version number to the name reported to the server 2020-08-16 15:42:45 +01:00
cef5060eb2 Add app name and reason to config header 2020-08-16 14:34:19 +01:00
d1716a0c91 Add api_key to the config file 2020-08-16 14:26:43 +01:00
1c911f36b0 Manage connection errors: print and return 1 2020-08-16 13:54:26 +01:00
2d62b44ebc Group parameters in a TimerSettings struct 2020-08-16 13:41:32 +01:00
a3153bcc66 Move TimerBase's g_extra_wait out to the settings file 2020-08-16 13:31:08 +01:00
93cfdd5586 Rename main section in settings to system 2020-08-16 12:58:39 +01:00
f426e3570d Cap max wait to 1 day
This one slipped away in my commit from earlier
2020-08-16 12:58:07 +01:00