Commit graph

41 commits

Author SHA1 Message Date
0dc380fa94
Removed dependency from prctl.
Also, black'd and LINT-fixed some files that hadn't been touched in a
while.
2023-07-23 19:17:30 +02:00
f9b0bc905e
Migrated websocket service.
The websocket service is no longer provided by a different service,
controlled by a different thread running on another port.

Instead, it's now exposed directly over Flask routes, using
WSGI+eventlet+simple_websocket.

Also, the SSL context options have been removed from `backend.http`, for
sake of simplicity. If you want to enable SSL, you can serve Platypush
through a reverse proxy like nginx.
2023-05-07 12:08:28 +02:00
c3fa3315f5
Implemented synchronization with webhook responses.
When a client triggers a `WebhookEvent` by calling a configured webhook
over `/hook/<hook_name>`, the server will now wait for the configured
`@hook` function to complete and it will return the returned response
back to the client.

This makes webhooks much more powerful, as they can be used to proxy
HTTP calls or other services, and in general return something to the
client instead of just executing actions.
2022-08-30 23:35:19 +02:00
1da17fca35 Print invalid rules to help debug broken configurations 2022-06-08 15:34:14 +02:00
518d9f20c6
Added docs for config plugin 2021-11-17 23:59:17 +01:00
40903393df
Removed pydoc of internal plugin methods that were propagated to the docs of all the derived plugins 2021-11-15 01:57:44 +01:00
d5cddc23fa
Fixed autodoc indentation 2021-11-15 01:21:31 +01:00
3bfc5b83ef Moved to manifest files for describing plugins and backends and their dependencies 2021-09-16 17:53:40 +02:00
2a78f81a7b Major LINT fixes 2021-04-05 00:58:44 +02:00
36fdcf6963 - The context should be properly expanded also when calling a Python procedure
- Refactored the logic for executing a request and wrapping the response common to procedures, crons and event hook decorators into platypush.common.exec_wrapper

- Added mock getvalue() method to Logger to prevent PyCharm failures in the tests when sys.stdout is redirected to the Logger object
2021-02-27 20:27:36 +01:00
Fabio Manganiello
c269c62fe6 Refactored logging names 2020-09-27 01:33:38 +02:00
Fabio Manganiello
a387b84623 Don't swallow the exception if something goes wrong in a Python hook 2020-04-30 23:55:28 +02:00
Fabio Manganiello
d46385687f Support for event filter on functional hook 2020-04-09 00:09:36 +02:00
Fabio Manganiello
0dae03551f Implemented interface for custom Python scripts, procedures and hooks [closes #131] 2020-04-08 23:22:54 +02:00
Fabio Manganiello
40a29a8214 fire_event could also be called by an external web server or service with no access to the bus. Therefore don't fail hard if the bus is not available 2020-02-24 17:17:36 +01:00
Fabio Manganiello
470f4a8fc9 Added disable_web_clients_notification on Event for events
generated with high throughput that shouldn't be propagated
to the connected websockets.
2019-12-22 19:38:01 +01:00
Fabio Manganiello
2af47372b0 Added docstring to EventGenerator class 2019-02-28 01:28:51 +01:00
Fabio Manganiello
a9fb6a38dd New API for firing events and registering/unregistering event handlers
both for plugins and backends
2019-02-28 01:21:25 +01:00
Fabio Manganiello
2d8b2ba55a Removed pp- prefix from the name of the spawned processes and threads 2019-01-13 20:41:15 +01:00
Fabio Manganiello
fbf3600e91 Setting thread and process names properly through prctl 2019-01-10 23:45:13 +01:00
Fabio Manganiello
56c7258c74 Setting names for threads 2019-01-10 23:08:29 +01:00
Fabio Manganiello
abbd8409ca Run event hook actions in another thread 2018-11-28 01:01:16 +01:00
Fabio Manganiello
c05fc9ee3f Added logic to propagate events to the websockets backend 2018-11-02 10:14:06 +00:00
Fabio Manganiello
570ef6f109 Replaced EventAction with Procedure to allow more flexibility in event hooks and cronjobs 2018-09-27 01:52:35 +02:00
Fabio Manganiello
0288f7ee1b Propagate the token in procedures and event hooks to make sure that the inner requests can be executed 2018-07-09 14:51:20 +00:00
Fabio Manganiello
2647bd3881 Implemented token verification over HTTP calls.
The token can be provided either:

* GET parameter (``?token=abc``)
* JSON payload request (``{..your_request.., "_token":"abc"})
* HTTP header (``X-Token: abc``)
* Basic HTTP auth (any username works, password: token)
2018-07-08 21:36:58 +02:00
Fabio Manganiello
66d78c8615 [#61] Plugins actions refactoring
- Using `@action` annotation to indicate methods that are allowed to be
executed as actions

- The output and errors of an action are automatically wrapped into a
`Response` object without any response build required on the plugin side
2018-07-06 02:08:38 +02:00
Fabio Manganiello
4da74b1096 Refactored logging submodule 2018-06-06 20:09:23 +02:00
Fabio Manganiello
72af7adb46 #51 first web panel iteration 2018-01-29 13:47:21 +01:00
Fabio Manganiello
ac15e581ce Added last.fm scrobbler plugin, solves #21 2018-01-15 02:40:22 +01:00
Fabio Manganiello
2871583c75 Fixed events being triggered as priority even if they had no preset priority 2018-01-07 17:10:59 +01:00
Fabio Manganiello
dfee3f5004 Recursively expand the context of a request over the nested arguments 2018-01-06 12:40:22 +01:00
Fabio Manganiello
109805fd8d Don't stop the conversation on hook match if the hook match was a priority one 2018-01-05 10:09:02 +01:00
Fabio Manganiello
5461bf532c Copy the arguments before creating the action and re-create the action every time to make sure that the context is not polluted by previous executions 2018-01-04 23:10:53 +01:00
Fabio Manganiello
fa34b05c6c Priority-based algorithm for hooks, solves #41 2018-01-04 19:19:56 +01:00
Fabio Manganiello
691a9c8593 Added test for the event/condition matching and parsing logic 2018-01-03 00:16:01 +01:00
Fabio Manganiello
2a192dacc1 References to Config static getters moved from the constructor declaration to the constructor body to prevent the default Config object to be initialized before the time and any config override to be ignored. This should also fix the tests, #33 2018-01-02 19:44:58 +01:00
Fabio Manganiello
5a92c0ac3b - Proper support for event arguments
- Better algorithm for event matching
- Added send_event support to pusher
2018-01-02 00:35:55 +01:00
Fabio Manganiello
96f2d9f496 Removed old processor module 2017-12-24 20:41:38 +01:00
Fabio Manganiello
6928e440bc Support for Flic button events 2017-12-24 13:15:37 +01:00
Fabio Manganiello
7b97a5b229 - #30 Implemented Google Assistant backend
- #21 Implemented events management
2017-12-24 01:10:48 +01:00