Commit Graph

3230 Commits

Author SHA1 Message Date
Fabio Manganiello a2f8e2f0d2
Fixed bottom margin for ConfirmDialog buttons 2023-05-22 16:44:53 +02:00
Fabio Manganiello a7aabd7c52
Fixed handling of `:meth:` docstring annotations with relative paths. 2023-05-22 16:32:30 +02:00
Fabio Manganiello 7eca1c27c9
Blackened the qrcode and pushbullet plugins 2023-05-22 02:33:54 +02:00
Fabio Manganiello aaac6488d6
Updated webapp dist files 2023-05-22 02:24:24 +02:00
Fabio Manganiello d7405ad05d
Added multiple parsers for the entities referenced in docstrings.
The `inspect` plugin can now detect references to plugins, backends,
events, responses and schemas in docstrings and replace them either with
links to the documentation or auto-generated examples.
2023-05-22 02:20:58 +02:00
Fabio Manganiello 4f11d7cf74
Updated webapp dist files 2023-05-21 03:15:16 +02:00
Fabio Manganiello b91c1eba6d
Parse `:return:` definitions from action docstrings too. 2023-05-21 03:05:19 +02:00
Fabio Manganiello 229b8f2985
Many improvements for the `execute` panel. 2023-05-21 03:04:52 +02:00
Fabio Manganiello edf1dbee1d
Updated webapp dist files 2023-05-20 15:54:18 +02:00
Fabio Manganiello 5efc90ca17
Better PWA installation prompt.
Display a popup modal instead of a confirm box to prompt the user to
install the PWA app.

`confirm` blocks the JavaScript engine when run in `beforeMount` and
therefore the browser won't be able to proceed with `event.prompt()`.
2023-05-20 15:52:37 +02:00
Fabio Manganiello 666ea9ea6b
Added `use_werkzeug_server` option to `backend.http`.
There are situations where you may not want to run the HTTP server in a
full blown WSGI-over-Tornado container - unit/integration tests and
embedded single-core devices are among those cases.

In those scenarios, we should allow the user to be able to run the
backend using the built-in Werkzeug server provided by Flask.
2023-05-20 15:26:58 +02:00
Fabio Manganiello 013274bcbc [#259] Proper support for the progressive webapp (#262)
Closes: 259
Reviewed-on: #262
2023-05-20 02:42:33 +02:00
Fabio Manganiello 27d4a20418
Use reflection to infer the arguments of a Python user procedure 2023-05-17 17:17:59 +02:00
Fabio Manganiello 0a1209fe6e
Updated webapp dist files 2023-05-17 10:56:37 +02:00
Fabio Manganiello 33e2879413
Various UI improvements for the execute tab. 2023-05-17 10:41:02 +02:00
Fabio Manganiello 91daec579d
Reverted to the previous style for entities on mobile.
Better to use screen width wisely and avoid unnecessary padding.
2023-05-17 01:13:09 +02:00
Fabio Manganiello 61ea3d79e4
Large refactor for the `inspect` plugin.
More common logic has been extracted and all the methods and classes
have been documented and black'd.
2023-05-17 00:05:22 +02:00
Fabio Manganiello 2cba504e3b
Improvements for the autocomplete component. 2023-05-14 15:07:54 +02:00
Fabio Manganiello 8447f9a854
Improved rendering of actions/arguments documentation.
The frontend now calls `utils.rst_to_html` to render the docstrings as
HTML instead of dumping them as raw text.

Also, actions and arguments are now cached to improve performance.
2023-05-14 15:06:34 +02:00
Fabio Manganiello 5f2d6dfeb5
Added `utils.rst_to_html` action. 2023-05-14 15:05:24 +02:00
Fabio Manganiello 3c83e7f412
A faster implementation for the `inspect.get_*` methods.
Plugin/backend lookup is now done by inspecting the manifest files
instead of searching all the subpackages.
2023-05-13 13:44:46 +02:00
Fabio Manganiello 72797e73ff
Changed the Tornado paradigm to start the WSGI workers.
Use `bind_sockets`/`fork_processes` instead of reinventing the wheel
with our own multiprocessing handling.
2023-05-13 12:35:20 +02:00
Fabio Manganiello ac4fe4447e
Revert "Added a multi-worker approach to the Tornado WSGI container."
This reverts commit 71401a4936.

Temporarily reverted this commit because the `reuse_address` on the
application's `listen` method has only been implemented in Tornado 6.2 -
and Debian stable still shipts Tornado 6.1.
2023-05-13 02:36:20 +02:00
Fabio Manganiello 71401a4936
Added a multi-worker approach to the Tornado WSGI container.
The WSGI container is a good option to wrap a multi-modal webapp
(Flask + websocket routes), but it's constrained to a single-process
approach and queued/pre-buffered requests. That makes performance poor
when handling requests that may take a few seconds to complete.
2023-05-13 01:26:18 +02:00
Fabio Manganiello b7b93edbae
Updated dist files 2023-05-12 03:52:33 +02:00
Fabio Manganiello a15191d4ca
Updated dist files 2023-05-12 03:51:59 +02:00
Fabio Manganiello d4f8e51caf
A less blocking implementation of the entities loading UI logic. 2023-05-12 03:49:20 +02:00
Fabio Manganiello 62d846ddda
Updated dist files 2023-05-12 03:42:17 +02:00
Fabio Manganiello 23a5e90e2e
Updated dist files 2023-05-12 03:26:55 +02:00
Fabio Manganiello 6cd9cb6e76
Better entities caching on the frontend. 2023-05-12 03:18:22 +02:00
Fabio Manganiello 79871e0fa1
Fixed devServer routes in vue.config.js.
Use `127.0.0.1` instead of `localhost` for the Vue proxy.
2023-05-12 02:57:14 +02:00
Fabio Manganiello cfedcd701e
Performance improvements when loading the Tensorflow plugin.
The Tensorflow module may take a few seconds to load the first time and
slow down the first scan of the plugins.

All the Tensorflow imports should therefore be placed close to where
they are used instead of being defined at the top of the module.
2023-05-11 19:48:22 +02:00
Fabio Manganiello f49ad4c349
Updated dist files 2023-05-10 02:52:24 +02:00
Fabio Manganiello 6b0f0883ee
A proper way to proxy websocket calls using the Vue devServer. 2023-05-10 02:27:01 +02:00
Fabio Manganiello 78c12212c6
[#260] A simple entities caching mechanism using the browser storage. 2023-05-10 02:26:06 +02:00
Fabio Manganiello 74ab884b7a
Proper redirects upon `/execute` failure.
If a call to `/execute` fails with a 401 or 412 status, then redirect
the user to `/register` or `/login`.
2023-05-10 02:24:50 +02:00
Fabio Manganiello 0de56ad52e
Added nginx sample configuration. 2023-05-10 00:59:41 +02:00
Fabio Manganiello 1395c472c0
`docutils` moved to required dependencies. 2023-05-09 21:59:36 +02:00
Fabio Manganiello 41233138ff
Blackened `inspect` module and extracted model defs to adjacent module. 2023-05-09 21:58:02 +02:00
Fabio Manganiello b91aedc553
Updated README toc format 2023-05-09 02:56:44 +02:00
Fabio Manganiello 5415f0ccf3
Updated README 2023-05-09 02:54:02 +02:00
Fabio Manganiello ab2425ebd0
[#260] Removed legacy `backend.websocket`.
It has now been replaced by the `/ws/events` and `/ws/requests`
websocket routes under `backend.http`.
2023-05-09 02:46:43 +02:00
Fabio Manganiello a069d23bb7
[#260] Added ``/ws/requests`` websocket route. 2023-05-09 02:40:32 +02:00
Fabio Manganiello 7716a416e9
[#260] Support for sending events via websocket over `/ws/events`. 2023-05-09 02:18:58 +02:00
Fabio Manganiello edb7197f71
[#260] Implemented authentication for websocket routes.
Plus, refactored the `backend.http.app.utils` module by breaking it down
into multiple components, as the module was starting to get too large.
2023-05-09 00:03:11 +02:00
Fabio Manganiello 2d4b179879
Include the path info in the logging messages in WSRoute. 2023-05-08 12:35:54 +02:00
Fabio Manganiello 3fc622e296
Remove legacy references to the websocket HTTP port and backend in platydock. 2023-05-08 12:25:09 +02:00
Fabio Manganiello f5fcccb0bd
Refactored the new websocket routes.
Defined a `platypush.backend.http.ws` package with all the routes, a
base `WSRoute` class that all the websocket routes can extend, and a
logic in the HTTP backend to automatically scan the package to register
exposed websocket routes.
2023-05-08 11:45:14 +02:00
Fabio Manganiello 56dc8d0972
Migrated the webapp to Tornado.
It was just too painful to find a combination of versions of  gunicorn,
gevent, eventlet, pyuwsgi etc. that could work on all of my systems.

On the other hand, Tornado works out of the box with no headaches.

Also in this commit:

- Updated a bunch of outdated/required integration dependencies.
- Black'd and LINTed a couple of old plugins.
2023-05-08 02:06:45 +02:00
Fabio Manganiello f81e9061a3
`lifespan=on` is actually not required on Flask config level. 2023-05-07 16:30:41 +02:00