0.2.1 ensures that the exclude_object markers are the first
non-comment g-code in the files, fixing issues with klipper adaptive
meshing
Signed-off-by: Franklyn Tackitt <git@frank.af>
This adds a new structure for API documentation, making each
aspect visible and uniform. The parameters, response, and
schema are collapsible, allowing for easier navigation.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The material theme is more feature complete and flexibile,
providing better documentation for APIs and such. This
commit is just the initial move. The documents are functional,
but the layout and color schemes are subject to change.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
While a hardware UART generally won't have symlinks in the "by-path"
and "by-id" folders, it is possible to configure udev to add them.
In addition, adding these fields makes the schema consistent.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Implement endpoints to query the following:
- Serial Devices (including Hardware UART)
- USB Devices using lsusb
- Klipper CAN Node UUIDs
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This folder contains miscellaneous files used by Moonraker
or other applications in the Klipper ecosystem.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The configfile "config" and "settings" attributes never change, and
therefore do not need to be stored in the subscription cache. They
can be significantly large, so this change can free up some memory
on low resource systems.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Some installations, such as those in public areas, may wish disallow
changes to the configuration.
This option defaults to True, so no change in behavior is introduced.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Don't raise an exception if the default source is incorrect as this
disables authorization. Fallback to moonraker. When supplied an
invalid CORS domain warn the user and skip adding it to the list.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add "login_required" and "trusted" fields. The "login_required"
field indicates that force_logins is enabled and at least one
user has been created. The "trusted" field indicates that the
connection is configured as trusted.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is necessary to perform a cors check before authenticating
the user to make sure that the headers are set if authentication
fails.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If the upstream DNS server is not available the call to socket.getfqdn()
will block until a timeout occurs. This blocks Moonraker's event loop,
resulting in carnage.
Call getfqdn() in a thread with a timeout of 5 seconds. In addition,
only request the fqdn if the user has one or more trusted domains
configured. Finally, cache resolved FQDNs for 24 hours to limit
repeated DNS queries.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This performs a significant refactor to the ZipDeploy class, making it near identiical to WebClientDeploy. Zipped applications have the same
"release_info" requirement as web clients. Unlike web clients, they may also
configure the dependency and service options available to git repos.
The ZipDeploy class can also support we clients, eliminating duplicate code
and the need to keep web_deploy.py.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Use a python dict to act as a queue for reporting used filament
per spool. This eliminates the need for locks and resolves
potential issues with spool changes when the Spoolman
service is not available.
In addition, add support for tracking multiple tools
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The exisiting implementation of spoolman's proxy endpoint
returns responses and errors exactly as they are received
by spoolman. This creates a problem of ambiguity, as the
frontend cannot easily diffentiate between an error returned
by Moonraker and an error returned by Spoolman.
This implements a "v2" alternate response to proxy requests.
All requests to spoolman will return success, with responses
wrapped in a top level object. Successful requests will be
returned in a "spoolman_response" object, errors in a
"spoolman_error" object.
Initially v2 responses will be opt-in to prevent breaking existing
spoolman implementations. However, as of this commit the v1
response is deprecated and will be removed in a future version
of Moonraker.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Connect to the spoolman sevice via websocket to receive
spool events. In addition, this gives Moonraker a persistent
connection to know when the service is available.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Allow expired JWTs for HTTP endpoints that do not require authentication.
This is technically an error by the client, as it should not provide
invalid JWTs for an endpoint, however Moonraker previously allowed
this as the token was not verified on unathenticated endpoints.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Variables should be contained within the spoolman instance, as in the
future it could be desirable to support multiple instances.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If Klipper is using systemd socket activation to generate its
unix socket the PID reported by PEERCRED will be 1, that of
systemd itself. Klipper now reports its process id in the
"info" endpoint, use that as a fallback to retreive service info.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is possible that Moonraker cannot bind to an address if its
already in use. Handle bind errors and warn/log when they are
encountered.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Moonraker dynamically registers its routes, so we cannot easily
use the routers provided by tornado.Application. Previously
all routes went through tornado.Application, then went to
our mutable router. This refactor avoids that by having our
mutable router contain the tornadoapp instance, only using
it to provide the application delegate.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is desirable to use templates (and therefore secrets) in
the server's configuration options. We need to defer loading
the "file_manager", remove its dependency from secrets. When
the file_manager is loaded it will look up "secrets" and register
the file path as reserved.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>