Commit graph

66 commits

Author SHA1 Message Date
jesopo
268c5adb3c Add depends-on hashflags to relevant modules 2019-05-25 21:40:06 +01:00
jesopo
cf29c37112 Add usage examples for all settings 2019-05-23 10:28:14 +01:00
jesopo
4058608bf2 Add 'api-port' setting to bot.conf and use it in rest_api.py 2019-03-13 16:52:51 +00:00
jesopo
6463bb16b5 move code in to the string format arg for log functions 2019-03-13 13:35:42 +00:00
jesopo
6c5a6ff9cd Show returned status code when _handle finishes 2019-03-13 13:33:53 +00:00
jesopo
9026f722c1 Remove default logging, show request path in our own _handle logging 2019-03-11 12:16:56 +00:00
jesopo
96f8777a8f Show ip and port as "ip:port" in _handle logging 2019-03-11 12:14:29 +00:00
jesopo
9d91ea6ed4 DEBUG log when REST API _handle starts and finishes 2019-03-11 12:12:51 +00:00
jesopo
1dab3dd07e Change HTTP request logging from INFO to DEBUG 2019-02-28 17:51:26 +00:00
jesopo
807021ecc4 Pass key through to _get_settings (rest_api.py) 2019-02-19 19:49:13 +00:00
jesopo
a3a75f3480 Remove copy-pasted ":" (rest_api.py) 2019-02-19 19:47:14 +00:00
jesopo
2691fa52e6 Do database-related work on UI thread (rest_api.py) 2019-02-19 19:45:26 +00:00
jesopo
25096c651a Don't require client cert validation (rest_api.py) 2019-02-10 13:26:35 +00:00
jesopo
c7d21e2d9e Typo, 'wrap_scket' -> 'ssl_wrap' (rest_api.py) 2019-02-10 13:20:22 +00:00
jesopo
1d206fe78f Use newly abstracted away ssl_wrap (rest_api.py) 2019-02-10 12:38:53 +00:00
jesopo
d772eaf36e need to .items() a dict to tuple-iterate it (rest_api.py) 2019-02-08 22:53:33 +00:00
jesopo
678e6606ed Abstract away sending response to REST API request (rest_api.py) 2019-02-08 22:04:39 +00:00
jesopo
4a68baa0a6 Return path from _path_data() (rest_api.py) 2019-02-08 21:56:58 +00:00
jesopo
e84f91977c Typo, 'utils.parse' -> 'urllib.parse' (rest_api.py) 2019-02-08 21:55:42 +00:00
jesopo
12591d2357 Remove now not used params on _request() (rest_api.py) 2019-02-08 21:54:33 +00:00
jesopo
c7843a9338 Simplify/refactor REST API request parsing code (rest_api.py) 2019-02-08 21:52:24 +00:00
jesopo
1b94a72a65 apikey command should have a minimum argument restriction (rest_api.py) 2019-02-01 12:02:02 +00:00
jesopo
7b3d7f85a6 I totally forgot that we don't need flask. at all. 2019-01-24 19:17:31 +00:00
jesopo
8ba7cb0396 Move logging API key from INFO to DEBUG (rest_api.py) 2019-01-23 22:23:21 +00:00
jesopo
086629f2dc Logging shouldn't use % string formatting (rest_api.py) 2019-01-23 22:10:32 +00:00
jesopo
6fef7fd0c6 INFO log when we get a HTTP request with an API key (including the key's
comment) (rest_api.py)
2019-01-23 22:08:26 +00:00
jesopo
9bef4b7df1 Switch to using a case insensitive dictionary for headers instead of doing
.title() on each header key
2018-12-08 09:00:12 +00:00
jesopo
281923a463 Check whether we actually have a httpd running when unloading rest_api.py 2018-12-08 08:56:47 +00:00
jesopo
9918a72f80 .items() on self.headers, to correctly use it for a dict comprehension
(rest_api.py)
2018-12-06 12:03:58 +00:00
jesopo
e6b0d4d167 .title() all header keys (rest_api.py) 2018-12-06 12:00:45 +00:00
jesopo
35108efc5f rest_api.py's '_safe_handle' function isn't used and doesn't need to be used now
that API calls are thrown straight on to the main thread
2018-11-30 21:39:28 +00:00
jesopo
d13a5069e3 Grab response from functions asked to be executed on the main thread and feed
them back to the callers, allowing rest_api.py to take the main thread while
it's waiting for the response to give back to the requesting client
2018-11-27 14:25:12 +00:00
jesopo
06078ba959 Prefix modules/rest_api.py logging with "[HTTP] " 2018-11-14 23:02:32 +00:00
jesopo
1275352576 Log HTTP events through regular logging 2018-11-14 23:01:22 +00:00
jesopo
911ace524d Typo in modules/rest_api.py, 'args_spit' -> 'args_split' 2018-11-12 22:20:46 +00:00
jesopo
161272daf5 Better denote variable-length "endpoint" arg in !apikey's usage 2018-11-12 20:44:46 +00:00
jesopo
6e4e358ed1 Typo in modules/rest_api.py, 'seting' -> 'setting' 2018-11-12 18:18:07 +00:00
jesopo
78b3ca3cdc Typo on modules/rest_api.py, '= =' -> '=' 2018-11-12 18:16:55 +00:00
jesopo
eb215d61a1 'api-minify' -> 'rest-api-minify' and make it settable from !botset 2018-11-12 18:15:08 +00:00
jesopo
a0e86f79c3 Change API key checking on-request to match what the values should be in the
database (dict of '{"name": , "permissions": }')
2018-11-12 18:06:02 +00:00
jesopo
a943e69cee Change API keys to be hex representations of UUID4s, change their value in the
database to be a dictionary ({"comment": , "permissions": }) and change the
!apikey command to take a `comment` arg (to note what specific keys are intended
for) and vararg `permissions` (a list of endpoints the API key is allowed to
hit)
2018-11-12 17:59:40 +00:00
jesopo
57aa62cc9c API keys should have a value of [] when they're created, not True 2018-11-11 09:03:19 +00:00
jesopo
b8e6bfd5e5 Add a way of appending a comment on an API key, to denote what it's for. 2018-11-11 09:02:48 +00:00
jesopo
b06eff217f typo in modules/rest_api.py; 'resonse' -> 'response' 2018-11-11 08:55:49 +00:00
jesopo
9c7afe7d2b Add missing "," in modules/rest_api.py 2018-11-11 08:54:46 +00:00
jesopo
36ab270971 typo in modules/rest_api.py, 'permimssions' -> 'permissions' 2018-11-11 08:53:37 +00:00
jesopo
8024bc9c80 Add a way to minify REST API responses in modules/rest_api.py 2018-11-11 08:51:50 +00:00
jesopo
07c813cc1f Add basic access controls to modules/rest_api.py 2018-11-10 21:54:08 +00:00
jesopo
08355c026e Log errors caught when trying to execute API endpoints 2018-11-06 17:22:50 +00:00
jesopo
f06c824ae9 Only count a None response from an API event hook to be a 404 2018-11-06 14:09:13 +00:00