This allows clients to display a list of warnings that Moonraker detects. Previously this info was only logged.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Document the "force_logins" option and the ability to accept JSON Web Tokens via the query string.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Clients may pass a json web token via the query string's "access_token" argument to authorize requests that do not allow modified headers.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When "force_logins" is enabled a user login is required if at least one user is registered, overriding the "trusted_clients" configuration.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Replace non-ASCII characters with "?" and add escaped unicode version of the file name to the "Content-Disposition" header to fix problems with thumbnails and downloading for the gcode file with non-ASCII characters in filename.
Signed-off-by: Uladzimir Palekh <visor.rti@gmail.com>
This root may be used to store log files for Klipper, Moonraker, and other applications as necessary.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Update the code style guidelines informing contributors that they should validate their code with pycodestyle and mypy before submission.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
USER CHANGE: The deprecated "client_repo" and "client_path" options have been removed in this commit. Use [update_manger client client_name] to configure clients.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This includes a refactoring of the PowerDevice base class so that it defines some abstract methods that its children must implement.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Annotate function definitions, class attributes, and local variables as necessary for type hinting. This is useful for IDEs with linters that support type hints and also can be used by GitHub Actions to detect erroneous code.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Add a SentinelClass singleton. This can be used to generate Sentinels by
modules that need to use the Sentinel pattern for default values. This
allows for more robust type checking, as the Sentinel type should not be
included as a return value.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
On slower platforms it is possible for this to take time and block the event loop. Run shutil.rmtree in another thread to prevent this from occuring.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If an inotify event is generated as the result of an API request, the notifications are synchronized so that they occur after the request returns. Use a mutex to prevent multiple "write" requests processing concurrently.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If a file is moved from one location to another in the "gcodes" root it isn't necessary to rescan the file metadata as the underlying file information does not change. Add the ability to change the metadata's key and move associated thumbnails when a file is moved.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Since filelist_changed notifications are now delayed until after metadata is processed there is no need to send an additional metadata notification.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rather than tracking watch paths directly, wrap each watch in a node. This makes makes it a bit easier to handle move and delete changes, as we don't have to manage several different dicts to store the information we need.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When a directory is created, attempt to suppress notifications generated as its children are created.
Wait until all items are copied before notifying clients and scanning metadata.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The copy methods are blocking and will block the asyncio event loop. Run them in a ThreadPoolExecutor to keep the event loop free.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When a directory is deleted this attempts to suppress delete events for all children. Clients only need to be notified of the parent node, as its deletion implies all children have been deleted.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The previously deprecated "data" field has now been removed. The "size" field now reports the size of the png. Clients may use the "relative_path" field to retrieve thumbnail png files.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This guarantees that .ufps will not be unzipped in parallel and offloads a potential blocking operation to another process.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>