Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeanon committed Jan 21, 2024
2 parents 5fbcb31 + d10ce87 commit c392c20
Show file tree
Hide file tree
Showing 9 changed files with 954 additions and 568 deletions.
13 changes: 11 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The format is based on [Keep a Changelog].
- **button**: Added `debounce_period` option
- **history**: Added a check for previous jobs not finished (ie: when power is
lost during a print). These jobs will report their status as `interrupted`.
- **build**: Added support for optional speedup dependencies `uvloop` and `msgspec`
- **update_manager**: Add support for "zipped" application updates

### Fixed

Expand All @@ -47,8 +49,15 @@ The format is based on [Keep a Changelog].

### Changed

- **build**: Bumped apprise to version `1.3.0`.
- **build**: Bumped lmdb to version `1.4.1`
- **build**: Bumped apprise to version `1.7.0`.
- **build**: Bumped lmdb to version `1.4.1`
- **build**: Bumped tornado to version `6.4.0`
- **build**: Bumped jinja2 to version `3.1.3`
- **build**: Bumped zeroconf to version `0.131.0`
- **build**: Bumped libnacl to version `2.1.0`
- **build**: Bumped distro to version `1.9.0`
- **build**: Bumped pillow to version `10.2.0`
- **build**: Bumped streaming-form-data to version `1.13.0`
- **machine**: Added `ratos-configurator` to list of default allowed services
- **update_manager**: It is now required that an application be "allowed"
for Moonraker to restart it after an update.
Expand Down
75 changes: 63 additions & 12 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ following services:
- `sonar`
- `crowsnest`

Note that systemd units are case sensitive, so the case must match
when adding a value to `moonraker.asvc`.

#### Reboot / Shutdown from Klipper

It is possible to call the `shutdown_machine` and `reboot_machine`
Expand Down Expand Up @@ -1730,9 +1733,6 @@ disk or cloned from unofficial sources are not supported.
# moonraker.conf

[update_manager]
enable_repo_debug: False
# ***DEPRECATED***
# Debug features are now enabled by the '-g' command line option
enable_auto_refresh: False
# When set to True Moonraker will attempt to fetch status about
# available updates roughly every 24 hours, between 12am-4am.
Expand Down Expand Up @@ -1787,11 +1787,11 @@ down into 3 basic types:
To benefit the community Moonraker facilitates updates for 3rd party
"Klippy Extras" and "Moonraker Components". While many of these
extensions are well developed and tested, users should always be
careful when using such extensions. Moonraker and Klipper provide
careful when using such code extensions. Moonraker and Klipper provide
no official support for such extensions, thus users experiencing an
issue should not create bug reports on the Klipper or Moonraker issue
trackers without first reproducing the issue with all unofficial
extensions disabled.
trackers without first reproducing the issue using pristine versions
of Moonraker and/or Klipper.

#### Web type (front-end) configuration

Expand Down Expand Up @@ -1843,13 +1843,13 @@ refresh_interval:
# This overrides the refresh_interval set in the primary [update_manager]
# section.
info_tags:
# Optional information tags about this extensions that are reported via
# Optional information tags about this extension that are reported via
# Moonraker's API as a list of strings. Each tag should be separated by
# a new line. For example:
# info_tags:
# desc=My Client App
# action=webcam_restart
# Front-ends may use these tags to perform additional actions or display
# Frontends may use these tags to perform additional actions or display
# information, see your extension documentation for details on configuration.
# The default is an empty list.
```
Expand Down Expand Up @@ -1974,14 +1974,14 @@ refresh_interval:
# This overrides the refresh_interval set in the primary [update_manager]
# section.
info_tags:
# Optional information tags about this application that will be reported
# front-ends as a list of strings. Each tag should be separated by a new line.
# Optional information tags about this application that will be reported to
# frontends as a list of strings. Each tag should be separated by a new line.
# For example:
# info_tags:
# desc=Special Application
# Front-ends my use these tags to perform additional actions or display
# Frontends my use these tags to perform additional actions or display
# information, see your extension documentation for details on configuration.
# The default is an empty list.
# The default is an empty list (no info tags).
```

!!! Note
Expand All @@ -1990,6 +1990,57 @@ info_tags:
[allowed services](#allowed-services) section for details on which
services Moonraker is allowed to manage and how to add additional services.

Also not that systemd services are case sensitive. The `extension_name`
in the section header and the value provided in the `managed_servies`
option must match the case of the systemd unit file.

#### Zip Application Configuration

The `zip` type can be used to deploy zipped application updates through GitHub
releases. They can be thought of as a combination of the `web` and `git_repo`
types. Like `web` types, zipped applications must include a `release_info.json`
file (see the [web type](#web-type-front-end-configuration) not for details).
In addition, `zip` types can be configured to update dependencies and manage
services.

The `zip` type is ideal for applications that need to be built before deployment.
The thing to keep in mind is that any application updated through Moonraker needs
either be cross-platform, or it needs to deploy binaries for multiple platforms
and be able to choose the correct one based on the system.

```ini
channel: stable
# May be stable or beta. When beta is specified "pre-release"
# updates are available. The default is stable.
repo:
# This is the GitHub repo of the application, in the format of owner/repo_name.
# For example, this could be set to Donkie/Spoolman to update Spoolman.
# This parameter must be provided.
path:
# The path to the Application files on disk. This folder must contain a
# a previously installed application and a valid release_info.json file.
# The folder must not be located within a git repo and it must not be located
# within a path that Moonraker has reserved, ie: it cannot share a path with
# another extension. This parameter must be provided.
refresh_interval:
# This overrides the refresh_interval set in the primary [update_manager]
# section.
persistent_files:
# A list of newline separated file names that should persist between
# updates. This is useful for virtualenv's and other files/folders that
# should not be deleted when Moonraker overwrites the folder. The default
# is no persistent files.
virtualenv:
requirements:
system_dependencies:
enable_node_updates:
is_system_service: True
managed_services:
info_tags:
# See the git_repo type documentation for detailed descriptions of the above
# options.
```

#### The System Dependencies File Format

When an application depends on OS packages it is possible to specify them
Expand Down
130 changes: 128 additions & 2 deletions docs/web_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5335,6 +5335,45 @@ An object containing all measurements for every configured sensor:
### Spoolman APIs
The following APIs are available to interact with the Spoolman integration:

### Get Spoolman Status
Returns the current status of the spoolman module.

HTTP request:
```http
GET /server/spoolman/status
```
JSON-RPC request:
```json
{
"jsonrpc": "2.0",
"method": "server.spoolman.status",
"id": 4654
}
```

Returns:

An object containing details about the current status:

```json
{
"spoolman_connected": false,
"pending_reports": [
{
"spool_id": 1,
"filament_used": 10
}
],
"spool_id": 2
}
```

- `spoolman_connected`: A boolean indicating if Moonraker is connected to
Spoolman. When `false` Spoolman is unavailable.
- `pending_reports`: A list of objects containing spool data that has
yet to be reported to Spoolman.
- `spool_id`: The current Spool ID. Can be an integer value or `null`.

#### Set active spool
Set the ID of the spool that Moonraker should report usage to Spoolman of.

Expand Down Expand Up @@ -5431,6 +5470,7 @@ JSON-RPC request:
"jsonrpc": "2.0",
"method": "server.spoolman.proxy",
"params": {
"use_v2_response": true,
"request_method": "POST",
"path": "/v1/spool",
"query": "a=1&b=4",
Expand All @@ -5444,14 +5484,83 @@ JSON-RPC request:

The following parameters are available. `request_method` and `path` are required, the rest are optional.

- `request_method`: The HTTP request method, e.g. `GET`, `POST`, `DELETE`, etc.
- `request_method`: The HTTP request method, e.g. `GET`, `POST`, `DELETE`, etc..
- `path`: The endpoint, including API version, e.g. `/v1/filament`.
- `query`: The query part of the URL, e.g. `filament_material=PLA&vendor_name=Prima`.
- `body`: The request body for the request.
- `use_v2_response`: Returns the spoolman response in version 2 format.
Default is false.

!!! Note
The version 2 response has been added to eliminate ambiguity between
Spoolman errors and Moonraker errors. With version 1 a frontend
is not able to reliably to determine if the error is sourced from
Spoolman or Moonraker. Version 2 responses will return success
unless Moonraker is the source of the error.

The version 2 response is currently opt-in to avoid breaking
existing implementations, however in the future it will be
required, at which point the version 1 response will be removed.
The version 1 response is now deprecated.

Returns:

The json response from the Spoolman server.
- Version 1

> The json response from the Spoolman server. Errors are proxied directly.
For example, if a request returns 404, Moonraker will return a 404 error
or the JSON-RPC equivalent of -32601, Method Not Found.

- Version 2

> Returns the spoolman response wrapped in an object. The object contains
two fields, `error` and `response`. A successful request will place the
returned value in the `response` field and `error` will be `null.` When
Spoolman returns an error the `response` field will be `null` and the
`error` field will contain details about the error.
```json
{
"response": {
"id": 2,
"registered": "2023-11-23T12:18:31Z",
"first_used": "2023-11-22T12:17:56.123000Z",
"last_used": "2023-11-23T10:17:59.900000Z",
"filament": {
"id": 2,
"registered": "2023-11-23T12:17:44Z",
"name": "Reactor Red",
"vendor": {
"id": 2,
"registered": "2023-06-26T21:00:42Z",
"name": "Fusion"
},
"material": "PLA",
"price": 25,
"density": 1.24,
"diameter": 1.75,
"weight": 1000,
"color_hex": "BD0B0B"
},
"remaining_weight": 950,
"used_weight": 50,
"remaining_length": 318519.4384459262,
"used_length": 16764.18097083822,
"archived": false
},
"error": null
}
```
> On Spoolman error:
```json
{
"response": null,
"error": {
"status_code": 404,
"message": "No spool with ID 3 found."
}
}
```


### OctoPrint API emulation
Partial support of OctoPrint API is implemented with the purpose of
Expand Down Expand Up @@ -6975,6 +7084,23 @@ See the [Spoolman API](#spoolman-apis) for more information.
}
```

#### Spoolman Status Changed

Moonraker will emit the `notify_spoolman_status_changed` event when the
connection state to the Spoolman service has changed:

```json
{
"jsonrpc": "2.0",
"method": "notify_spoolman_status_changed",
"params": [
{
"spoolman_connected": false
}
]
}
```

#### Agent Events
Moonraker will emit the `notify_agent_event` notification when it
an agent event is received.
Expand Down
Loading

0 comments on commit c392c20

Please sign in to comment.