Commit graph

113 commits

Author SHA1 Message Date
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
b06456e4b0 Restore timeouts from previous run
This is quite a big update, the new feature is that when the
program starts it loads the next update time from the db if
present. If so it resumes the timers from there. Maximum wait
time is currently capped at 24h.

TimerOroApi is not templated on methods anymore, rather on
the new DBOperation enum. This is so that it has that enum
value to pass it to other functions. This could've been a
separate commit, but wth...

Magic enum allows me to iterate over an enum's values at
build time, it's useful for building the query in OriginsDB
for the SELECT in the access table
(see make_select_last_access_str()).
2020-08-16 06:28:58 +01:00
0faa8fb18f Keep the db connection open throughout the lifetime of OriginsDB 2020-08-15 23:32:22 +01:00
f648e3a8a2 Propagate timer exceptions to the main thread 2020-08-15 22:52:20 +01:00
85c240b53d One debug message slipped away 2020-08-15 15:06:31 +01:00
5e7d0a33cc Add some debug printing 2020-08-15 14:58:20 +01:00
34040e5af1 Properly handle SIGINT to quit.
This puts ThreadPool::join() back to being private.
Eventia events now should inherit from Event, which will take
care of setting up the required callbacks so that events will
be notified about the main event loop stopping. Inheriting
from Event is currently not enforced.
2020-08-15 14:55:59 +01:00
1b65162a18 Update last_seen in shop snapshot table 2020-08-15 02:49:03 +01:00
ce892691f3 Use the new bind_all() everywhere 2020-08-15 02:34:51 +01:00
5df60661d3 Improve sqlite helpers a bit 2020-08-15 02:29:43 +01:00
928cabfe34 Making progress with shop snapshots 2020-08-15 01:55:46 +01:00
afb4fd2d4d Replace boost::optional with std::optional 2020-08-15 01:45:35 +01:00
29f11d3f57 Extract strings from functions because they are too verbose and drive me crazy 2020-08-14 22:27:01 +01:00