Commit graph

96 commits

Author SHA1 Message Date
jesopo
bcdffacab5 add on_pause() and on_resume() for module - use in rest_api.py 2019-11-04 10:52:41 +00:00
jesopo
4391176c7f major security fix: adding api keys should be admin-only 2019-10-18 15:17:04 +01:00
jesopo
50d1eb6b8c combine find_setting() and find_setting_prefix() on user/channel/server/bot 2019-10-07 12:46:52 +01:00
jesopo
8938e119b4 expand apikey command to list, add, remove and info
closes #123
2019-10-04 12:39:36 +01:00
jesopo
1fac9135fb 'path' -> 'args' on REST API events 2019-09-20 10:48:24 +01:00
jesopo
691fdf8978 add missing ")" 2019-09-20 10:43:23 +01:00
jesopo
cf65614832 support path-arg variables in url_for 2019-09-20 10:41:52 +01:00
jesopo
fa33a927b1 url_for was moved to _module._url_for 2019-09-16 15:05:14 +01:00
jesopo
ea47c81ece expose url-for logic on Exports too 2019-09-16 14:55:29 +01:00
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