This feature implements a sensor component that can be used to
track/log generic sensors from multiple sources. Each sensor
can have properties like unit of measurement, accuracy and a
display name that help frontends display the tracked measurements.
Signed-off-by: Morton Jonuschat <mjonuschat+moonraker@gmail.com>
It is possible for a move event to occur shortly after a directory
is created. These events are not bundled as part of an operation
like "copy", so they should not be suppressed, however the
notification should be emitted after the "create_dir" from its
parent is emitted.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
All of the awaitable calls in the inotify loop only block to
postpone notifications. Only gcode notifications require async
processing due to metadata analysis. Queue these notifications
while allowing inotify events to be received concurrently.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
fix
Most requests do not require waiting for inotify to process the
file event before exiting. Rework the NotifySyncLock to make this
optional. Replace the write mutex with the sync lock itself,
a guarantee that the synchronization state is cleaned up when
a request is complete.
This implementation avoids potential deadlocks or long wait times
when inotify is not enabled on a file system.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Moonraker should only force the state to report as "startup"
when Klippy is connected and it hasn't detected a transition
to startup.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This method will not work correctly if any individual part contains
a special character. For example, if an item in the path contains
a "#", the regex will return an incorrect result. Likewise, if any item
in a query string contains an "&" the query string will be correctly
escaped.
All urls supplied to the http client must be escaped by the consumer.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The configured url should already be escaped. It isn't possible to
reliably quote a full url if any of the parts contain special characters.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The url received from SimplyPrint should already be escaped. It
isn't possibly to reliably quote a full url if any of the parts contain
special characters.
This commit also corrects some minor type checking issues.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Some commands may return codes other than zero on a successful
return. Allow callers to specify an optional list of return codes that
will return success without raising an exception.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
According to the supervisord documentation the `-c` option is used to
specify the configuraiton file.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Allowing only a single part in the regex resulted in repos
without tags being assigned erronous version info. With
this change, the following tags can be parsed:
v1.0
v1.0.2
1.0
1.0.2
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When converting a semantic version to a list for comparisons
guarantee that the base version has 3 parts.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Allow tags versions with one, two, or three parts. The following
examples are now valid:
v1
v1.3
v1.0,10
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Provide a new websocket implementation that creates a near one to one
bridge with a Unix Socket connection to Klippy. This may be used to
access Klippy APIs not otherwise available over the primary websocket,
such as the various "dump" commands.
Unlike the primary websocket Moonraker does not decode or inspect
data that passes through the bridge.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This endpoint allows clients to refresh items on an individual basis
when the "name" parameter is specified. This endpoint replaces
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Re-implement pip updates using a pinned version. A version
check is now always done prior to installing python requirements,
updating when necessary.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
While the [update_manager client ...] naming convention is
deprecated it should not be disallowed. This fixes service restart
issues using the old naming convention.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Support unix connections with full access to all JSON-RPC APIs.
Internally these connections are treated as websocket connections,
however the underlying transport protocol is simplfied. Packets
are JSON encoded objects terminated with an ETX character.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Separate out code that applies to both standard websockets and the
future unix socket implementation.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Use the ConfigHelper's getpath() method to configure the
unix socket. The option may now be a template where the
datapath is passed into the context.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Do not add inotify watches for reserved paths that exclude
write acccess. Do not return include reserved paths in
file list requests without read access.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>