Commit Graph

1774 Commits

Author SHA1 Message Date
Eric Callahan 76500fe9f9
update_manager: improve dependency detection
Parse system packages and python requirements prior to and after each
updating, using the difference to determine if an update is necessary.
Only the new detected packages are installed unless the "force" variable
is set.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-05 19:25:53 -05:00
Eric Callahan a413f4e4cd
websockets: guarantee subscription removal
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-04 16:46:03 -05:00
Eric Callahan 1be19be747
klippy_connection: rework klippy initialization
Handle a race condition where a shutdown event could be received
from the webhooks subscription during initialization.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-04 16:43:35 -05:00
Quinn Damerell babf97be3b Adding OctoEverywhere to the default service list
module: Adding OctoEverywhere to the default service list.

Adding OctoEverywhere to the default service list in machine.py so future installs of moonraker will allow the octoeverywhere service to be managed from frontends.

Signed-off-by: Quinn Damerell <quinnd@outlook.com>
2023-02-03 19:09:34 -05:00
Eric Callahan 61d3182bea
docs: add thumbnail request documentation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-31 14:00:55 -05:00
Eric Callahan c1e4142a40
update_manager: add arch filter
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-31 14:00:54 -05:00
Eric Callahan b02e766a4d
update_manager: log detected packages
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-31 14:00:54 -05:00
Eric Callahan fb618a46fd
file_manager: fix thumbnails endpoint registration
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-31 14:00:33 -05:00
Eric Callahan 55e852cd87
file_manager: add thumbnail request endpoint
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-31 06:13:44 -05:00
Eric Callahan 1bad68cb66
dbtool: improve encoded line regex
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-28 12:09:36 -05:00
Eric Callahan 6c4c7a00cf
docs: add database backup/recovery
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-28 08:04:13 -05:00
Eric Callahan 50d22a2dff
scripts: add database backup and restore scripts
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-27 19:25:09 -05:00
Eric Callahan 46a92e1900
dbtool: update backup location
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-27 07:57:51 -05:00
Eric Callahan 2392ccd719
scripts: update default database path for fetch-apikey.sh
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-27 06:10:16 -05:00
Eric Callahan 12b1befcbc
authorizaton: type checking fix
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 07:08:23 -05:00
Eric Callahan 3dbc99fd84
docs: update authorization documentation
Authorization APIs are a now available over the websocket.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:20:02 -05:00
Eric Callahan d8941b3fb2
websockets: sanitize verbose logging
When verbose logging is enabled sanitize credentials from JSON-RPC
requests and responses.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:54 -05:00
Eric Callahan a5161816a7
websockets: decode jwts on authorized connections
Unix sockets never require authentication and it is possible for
Websocket connections to authenticate with the request itself.
In these cases the `identify` endpoint must still process an
access_token if provided, as it allows the front end to assign
the desired user to the connection.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:54 -05:00
Eric Callahan 80862799ed
websockets: require re-auth on user logout
Propagate user state changes to open websockets and unix sockets.
If a websocket's user is logged out require re-authentication.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:53 -05:00
Eric Callahan 06ec5541e3
websockets: add support for API Key authentication
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:53 -05:00
Eric Callahan eca4c7e438
authorization: limit failed login attempts
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:52 -05:00
Eric Callahan 9d6719ed31
websockets: set a websocket connection limit
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:52 -05:00
Eric Callahan 5a22b21a40
authorization: relax auth header requirements
Don't raise an exception if the authorization header contains an
invalid value, such as Basic auth.  Ignore it and move on to the
next step in authentication.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:52 -05:00
Eric Callahan 4ca39bec0a
authorization: authenticate over websocket
Register all of the "access" endpoints with the websocket.  Front
ends may now connect to the websocket without an oneshot token
and login.  If the front end already has a JWT for the user it
can be passed to the "identify" endpoint to authenticate directly.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:51 -05:00
Eric Callahan c83714bfe8
authorization: make api key authentication optional
Signed-off-by;  Eric Callahan <arksine.code@gmail.com>
2023-01-24 06:13:51 -05:00
pataar d4378eb051 notify: bump apprise to v1.2.1
Signed-off-by: Pieter Willekens<git@pataar.me>
2023-01-23 17:50:29 -05:00
Eric Callahan c964e68bc8
docs: fix erroneous note in secrets section
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2023-01-18 19:47:52 -05:00
Eric Callahan 2ad7a6a087
power: log the traceback on device init errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-18 19:31:47 -05:00
Eric Callahan db81607370
machine: use direct systemctl commands for reboot/shutdown
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-16 12:42:21 -05:00
Eric Callahan a154c5fa51
machine: add moonraker-obico to default services
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-12 18:10:30 -05:00
Eric Callahan c9a1d0f3bb
server: bump API version to 1.1.0
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-10 06:12:45 -05:00
Eric Callahan bf63798bb1
simplyprint: fix queue handler import
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-09 07:12:08 -05:00
Eric Callahan 3400094881
klippy_connection: minor change to is_ready() method
Use attribute to check the condition rather than the property.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-09 07:11:33 -05:00
Eric Callahan 486f659d20
docs: add new endpoints
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-08 13:50:09 -05:00
Eric Callahan a4b496d135
file_manager: fix internal access check
Include the reserved file check in the `can_access_path()` method.  This
fixes a potential vulnerability in the notifier where it may be possible
to attach a reserved file to a notification.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-08 13:50:08 -05:00
Eric Callahan fe9a9899e3
file_manager: reserved path fix
Raise an exception if an attempt is made to access .git folders.

Signed-off-by:  Eric Callahan <arksine.cde@gmail.com>
2023-01-08 13:50:08 -05:00
Eric Callahan 6021b39234
file_manager: implement zip endpoint
Provides an API for front ends to archive a list of files and/or
folders into a single zipped file.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-08 13:49:32 -05:00
Eric Callahan 53eda78b11
loghelper: moonraker log management
Move logger initialization out of the utils module into its own
module, loghelper.py.  This manager class simplifies access to the
underlying logger implementation and the queue listener.  Additionally
it allows for endpoint registration.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-06 12:20:54 -05:00
Eric Callahan 24dc8914d0
klippy_connection: implement manual log rollover
On systems where Klipper is installed as a service allow a
manual log rollover.  The rollover cannot be called while printing.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-06 12:20:53 -05:00
Eric Callahan ecf7fb9267
klippy_connection: add is_printing() and is_ready() methods
Several components throughout Moonraker determine whether or not
Klipper is printing or is ready before taking action.  This centralizes
queries in one area.  The checks do not query Klipper directly but
rather rely on subscriptions to push state to Moonraker.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-06 12:20:52 -05:00
Eric Callahan 019c5fc416
app: move reserved endpoints to klippy_connection
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-06 06:14:45 -05:00
Eric Callahan 225ec588eb
docs: document allowed services
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-02 07:46:44 -05:00
Eric Callahan 690f841768
machine: introduce custom allow list for service control
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-02 07:46:43 -05:00
Eric Callahan b3a9447392
power: add support for multiple bound services
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-01-02 06:30:18 -05:00
Matt White e3bcfb5ea0
mqtt: add option to publish states to individual mqtt topics
This change allows the user to choose the strategy for publishing
klipper states to MQTT.  The original strategy where all state
updates are published to a common topic is still the default, but
can be turned off using the "publish_combined_status" config option.

The newly added strategy is publishing individual state updates to
separate mqtt topics.  It is disabled by default, and can be enabled
with the "publish_split_status" config option.

Signed-off-by: Matt White <m.w.white@gmail.com>
2022-12-30 06:13:25 -05:00
Eric Callahan 358aee956b
docs: clarify power on start usage
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-12-27 10:37:10 -05:00
Eric Callahan 1999b82a86
docs: update power documentation
Note how to override SDCARD_PRINT_FILE to power on
a device before a print starts.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-12-26 08:29:24 -05:00
Eric Callahan d6b1a724a8
eventloop: improve callback handling
Wrap all callbacks in a coroutine that handles exceptions.  This
should eliminate "task not retreived" errors.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-12-24 08:07:45 -05:00
Eric Callahan 3d3911d4fd
docs: document the "force" power option
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-12-24 06:37:18 -05:00
Eric Callahan aeea9a2efd
power: introduce "force" argument for remote method calls
The "force" argument may be used turn on a device during a print
that is otherwise locked for normal requests.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-12-23 19:13:11 -05:00