Commit graph

87 commits

Author SHA1 Message Date
jesopo
4fb538f486 allow configuring REST API Host, have default public and local ports 2019-09-15 11:37:32 +01:00
jesopo
ea34091a83 default REST API port to 5001, not 5000 2019-09-13 15:49:32 +01:00
jesopo
fac0f569b8 remove TLS code from rest_api.py and force it to listen on localhost.
this is to force people to put something like nginx proxy_pass between the wider
internet and bitbot's rest api as the python stdlib http.server is not
production-secure.
2019-09-13 11:37:53 +01:00
jesopo
cf9c82b131 force content-length on to REST API responses 2019-09-11 11:00:55 +01:00
jesopo
be6f875e25 Revert "call self.finish() in rest_api.py in hopes it will force-close connections"
This reverts commit 5d6b2ff083.
2019-09-10 18:33:14 +01:00
jesopo
5d6b2ff083 call self.finish() in rest_api.py in hopes it will force-close connections 2019-09-10 18:28:50 +01:00
jesopo
d75d33c42c "%s", not "%d", cuz port is a str 2019-09-10 16:41:16 +01:00
jesopo
a02bfdf157 get REST API port from settings if it's not in Host header 2019-09-10 16:39:44 +01:00
jesopo
7636843fc7 'get_params' -> 'get_params_str' 2019-09-10 16:29:35 +01:00
jesopo
49527495b8 CaseInsensitiveDict does not implement .get() yet 2019-09-10 15:59:54 +01:00
jesopo
90d0452bfd first draft of ActivityPub webfinger 2019-09-10 15:40:01 +01:00
jesopo
ef7da3409b don't bother sorting json keys when the json is minified 2019-09-10 15:08:06 +01:00
jesopo
9ac46bab7d duplicate 'rest-api' setting - copypaste issue for rest-api-minify 2019-09-10 15:00:47 +01:00
jesopo
2fc75c6af7 move more REST API code on to the main thread 2019-09-10 13:55:06 +01:00
jesopo
8653068650 'code' -> 'response.code' 2019-09-10 13:45:55 +01:00
jesopo
4a08c2d134 set response.code=200 as soon as we know there's a hook waiting for it 2019-09-10 13:45:14 +01:00
jesopo
fefb9d71fb 'event_response' -> 'obj' (copypaste error) 2019-09-10 13:39:59 +01:00
jesopo
3a0183eb03 refactor REST API to use a Response object 2019-09-10 13:38:25 +01:00
jesopo
2af428cf2f Change REST API to listen on IPv6 2019-08-13 12:58:23 +01:00
jesopo
ae9d099a41 Refactor set/channelset/serverset/botset in to 'utils.Setting' objects 2019-06-28 23:16:05 +01:00
jesopo
d2a1763dc8 'call_unsafe_for_result' -> 'call_for_result_unsafe' 2019-06-26 11:04:41 +01:00
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