925 Commits

Author SHA1 Message Date
Eric Callahan
204e7ca4ff
power: add support for generic http sensors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-14 07:43:28 -04:00
Eric Callahan
d393c89ae0
http_client: add a http request wrapper
This wrapper is an object that may be used to build requests
procedurally rather than submit all request parameters in
a call to "request()", "get()", etc.  This is primarily useful for
usage in a Jinja2 context.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-05 06:13:08 -04:00
Eric Callahan
31e589abde
job_queue: fix erronous state after start
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-04 11:07:16 -04:00
Eric Callahan
6b73da55f8
job_queue: never transition after complete unless auto is enabled
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-04-04 11:03:12 -04:00
SoftFever
110cbd1084 metadata: Add support to extract metadata from g-code files generated by OrcaSlicer
Signed-off-by: Li Jiang <softfeverever@gmail.com>
2023-03-20 06:20:33 -04:00
Eric Callahan
f29c896c4a
notfiier: extend attach option
The "attach" option now accepts templates, such templates
are passed the same context received by the body and title
options.  Additionally it is possible to specify multiple
attachments by separating each attachment with a newline.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-03-05 12:28:41 -05:00
Mikkel Schmidt
40013ec270 module: add ratos-configurator to default services
Adds the RatOS configurator to the default service list in machine.py so future installs of moonraker will allow the ratos configurator service to be managed from frontends.

Signed-off-by: Mikkel Schmidt <mikkel.schmidt@gmail.com>
2023-03-05 12:27:56 -05:00
Eric Callahan
ead4cc21ce
update_manager: fix service restart
On machines running instances of Moonraker and Klipper without
the default service names it is necessary to look up their unit names
using systemd.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-26 16:19:38 -05:00
Eric Callahan
fd5ea0c6a4
octoprint_compat: validate web_request args
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 10:26:16 -05:00
Eric Callahan
6a5a5b50d3
update_manager: validate web_request args
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 10:26:16 -05:00
Eric Callahan
4281c4d978
machine: validate web_request args
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 10:26:15 -05:00
Eric Callahan
2d70511474
file_manager: use get_list WebRequest method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 10:26:15 -05:00
Eric Callahan
07e4b2cd7a
job_queue: use get_list WebRequest method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 10:26:14 -05:00
Eric Callahan
bc7e7d4548
announcements: use get_list WebRequest method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 10:26:14 -05:00
Eric Callahan
1b9f29db13
websockets: move JsonRPC and BaseSocketClient to common
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 07:08:43 -05:00
Eric Callahan
201e84cd94
database: remove stale import
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 07:08:43 -05:00
Eric Callahan
834fa2e4e0
mqtt: ignore type error in paho client
The original paho client was written without considering
static type checking.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 07:08:42 -05:00
Eric Callahan
244004136c
klippy_apis: handle invalid klippy responses
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 07:08:41 -05:00
Eric Callahan
6d73c60a38
moonraker: move common classes to common.py
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 07:08:41 -05:00
Eric Callahan
160f6d64be
simplyprint: fix error on import
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-24 07:00:47 -05:00
Eric Callahan
68c5fb6f6b
git_deploy: strip comments when parsing python reqs
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:52 -05:00
Eric Callahan
fce056e481
file_manager: fix notification sync on fast machines
Desktop class PCs may exit the request before the inotify observer
gains control of the loop.  When the observer does gain control
it will immediately notify as the sync mutex is no longer held,
this can result in sending  the websocket notification before
the response has returned.  Delay all notifications by 5ms to prevent
this.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:51 -05:00
Eric Callahan
2cda75ff2c
utils: simplify sentinel object
Use an enum to represent the sentinel rather than a singleton object.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:50 -05:00
Eric Callahan
0e80e301f0
button: remove stale sentinel import
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:50 -05:00
Eric Callahan
e32fd688e4
moonraker: correct stale annotations
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:50 -05:00
Eric Callahan
5ffd18d132
machine: update install validation to use package
If the "moonraker" entry point is available use it as an executable.  Otherwise
launch the module through the "-m" switch.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:48 -05:00
Eric Callahan
79467e6484
utils: add source_info utility module
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 18:08:48 -05:00
Eric Callahan
0f8638fec7
components: correct imports
All imports must now be relative to work correctly with the
moonraker parent package.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-22 12:16:27 -05:00
Eric Callahan
a5d63db9a6
server: rename moonraker.py to server.py
Signed-off-by:  Eric Callahan <arksiine.code@gmail.com>
2023-02-21 18:05:01 -05:00
Eric Callahan
dce3b9eaf5
file_manager: add metadata scan endpoint
Support manual scan requests for systems where inotify
does not function correctlly (network shares).  This endpoint
may also be used to force a rescan of files that have already
had an initial scan.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-21 12:10:56 -05:00
Eric Callahan
9178b3833c
file_manager: improve observer log message
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-21 07:33:45 -05:00
Eric Callahan
522fdab63d
metadata: simplify the S3Dv5 temp regex
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-21 06:24:17 -05:00
Eric Callahan
7845390dd1
file_manager: support uploading to symlinks
Previously Moonraker disabled writing to symbolic links, as
doing so would overwrite the link.  Moonraker now resolves
the link, overwrites the file, and manually emits a websocket
notification.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2023-02-20 20:42:19 -05:00
Eric Callahan
0f7b781f57
file_manager: process metadata changes when no observer is configured
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:49:48 -05:00
Eric Callahan
347c9f4d2b
file_manager: improve duplicate notifcation detection
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:58 -05:00
Eric Callahan
2fd668bf0d
file_manager: implement configurable fs observer
Currently the choices are "none" and "inotify".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:58 -05:00
Eric Callahan
1e97571aa8
file_manager: refactor attribute names
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:57 -05:00
Eric Callahan
7330c2c123
file_manager: add request notifcation fallback
Schedule fallback websocket notifications in the event that
inotify is unable to watch a file system.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:57 -05:00
Eric Callahan
51e307dbd6
file_manager: don't queue "create from move" events
Treat these events as if they were actual file write events.  They
will reset the node completion time and suppress the notifcation.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-20 19:36:56 -05:00
Christian Speich
45506647a7 metadata: Add support for Simplify3D v5
Signed-off-by: Christian Speich <christian@spei.ch>
2023-02-20 19:35:37 -05:00
Morton Jonuschat
b2ba52ce3d
sensor: add support to track generic single value sensors
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>
2023-02-20 17:43:41 -05:00
Eric Callahan
0a811b9e44
file_manager: cleanup coroutines on close
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-17 16:40:31 -05:00
Eric Callahan
7dac9c3961
file_manager: queue move event notifications
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>
2023-02-17 12:29:10 -05:00
Eric Callahan
d39792b84e
file_manager: allow concurrent inotify processing
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
2023-02-17 08:24:55 -05:00
Eric Callahan
9f08aad6f6
file_manager: improve notification sync
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>
2023-02-16 19:37:34 -05:00
Eric Callahan
87dba2f2e2
template: handle render exceptions
Re-raise as either a ServerError or ConfigError as appropriate.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-14 14:13:06 -05:00
Eric Callahan
a40dae2bc8
file_manager: improve klipper config detection
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-02-13 15:33:04 -05:00
Eric Callahan
9b9a6d0646
http_client: remove escape_url method
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>
2023-02-11 11:43:17 -05:00
Eric Callahan
0b4e604c95
webcam: remove call to escape_url
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>
2023-02-11 11:43:16 -05:00
Eric Callahan
5661b0216c
simplyprint: remove call to escape_url
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>
2023-02-11 11:43:16 -05:00