929 Commits

Author SHA1 Message Date
Eric Callahan
4fe89d5571
database: don't warn on UUID mismatch
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-28 18:07:18 -04:00
Eric Callahan
7f89bd7d62 git_deploy: limit corruption detection
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-28 16:13:13 -04:00
Eric Callahan
3b1c21a72d
database: attempt to install lmdb if missing
When attempting a conversion, install the lmdb package if its missing.
This should resolve issues with containers or new installations that
want to migrate a previous db to sqlite.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-28 06:11:42 -04:00
Eric Callahan
5332eab258
database: skip invalid values when migrating namespaces
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-27 10:49:34 -04:00
Eric Callahan
fa1dc438fa git_deploy: add support for pinned commits
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-25 12:30:56 -04:00
Eric Callahan
e41a934f74 database: support legacy sqlite_master table
Sqlite versions older than 3.33.0 store schema information in the
sqlite_master table rather than the sqlite_schema table.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
6b31076a43 machine: skip validation for new installs
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
3f62bb6fb4 database: add backup, restore, and compact endpoints
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
0b1fce8a6d file_manager: minor type checking fixes
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
bb0266f5c4 app: replace dict with UserInfo throughout Moonraker
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
eddf47e4a3 authorization: use SQL tables to store user info
Add a UserInfo class which provides type annotations for each member.
This class easily converts to a dict or tuple, simplifying conversion
for usage in SQL statements.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
3f0d20ed8c history: use tables for history and totals storage
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-21 06:18:46 -04:00
Eric Callahan
80c762074f database: migrate from lmdb to sqlite
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-18 08:03:47 -04:00
Eric Callahan
76704feee4 sensor: add support for parameter configuration
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-15 07:31:57 -04:00
Eric Callahan
ddc0e76ffc power: add support for uhubctl devices
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-06 06:46:53 -04:00
Eric Callahan
81899e04fd sensor: add history field options
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-05 06:29:21 -04:00
Eric Callahan
b60e6dc311 spoolman: add history field tracking spool ids
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-04 08:16:37 -04:00
Eric Callahan
531028ef4f history: report user in job history
When possible record the name of the user that requested the
job.  The klippy_api's component now takes an optional user
argument in its "start_print" method.  This user is broadcast
in an event after a print request successfully returns.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-04 08:16:37 -04:00
Eric Callahan
1dfbffb422 history: add support for auxiliary fields
Allow other components to register custom fields tracked and reported
in job history.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-04 08:16:37 -04:00
Eric Callahan
e7d3f3e961 job_state: track and store most recent Job Event
Signed-off-by:  Eric Callahan <arksine.codee@gmail.com>
2024-05-03 08:22:41 -04:00
Eric Callahan
4b1a3b8792 sensor: minor refactoring
Remove dataclasses, refactor for consistency with
other components.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-03 08:22:41 -04:00
Eric Callahan
0f2e3d7c99
mqtt: fix whitespace error
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-28 12:32:34 -04:00
Eric Callahan
ac550bac24 mqtt: add support for tls connections
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-28 12:08:30 -04:00
Eric Callahan
5570ab02ee power: remove state check when performing job queue requests
Allow the device to refresh the state in the event that its stale.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-28 12:08:30 -04:00
Eric Callahan
1ab413e9bc mqtt: add support for paho client version 2.0
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-28 12:08:30 -04:00
Eric Callahan
a802e10725
mqtt: support configurable status update interval
SIgned-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-28 06:03:12 -04:00
Eric Callahan
379a26600c
update_manager: use temporary file storage for iids
The default behavior of systemd is to remove shared memory
files when the user that created them logs out.  This breaks
instance ID tracking for most installations.  While its possible
to overcome this by changing the user type or the logind
configuration, these solutions required elevated privileges.
The simple solution is to store iids in a temporary file, with
access protected by a flock.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-27 10:52:22 -04:00
Patrick Schmidt
c857e1a99f spoolman: Add spoolman response headers to proxy results
Added the response headers to the V2 response of the proxy implementation as a new field named "response_headers".

Signed-off-by: Patrick Schmidt <ps.patti1998@gmail.com>
2024-04-24 13:51:23 -04:00
Eric Callahan
2bf6d609cb
klippy_apis: add print/job request logging
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-24 07:22:19 -04:00
Eric Callahan
9447494bd5
file_manager: static type checking fixes 2024-04-19 11:28:01 -04:00
Eric Callahan
44a5600038
job_state; check stored state on disconnect
If Klipper disconnects while printing manually set the state
to "error".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-04 20:15:33 -04:00
Eric Callahan
99b97afc7d
simplyprint: fix layer detect divide by zero
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-04-03 10:47:34 -04:00
Eric Callahan
affe196ff6
machine: move default allowed services to an asset file
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-03-15 15:07:29 -04:00
Eric Callahan
98bb40bd80
utils: add kernel version
Move the kernel version tuple calculation out of gpio.py into
the utils package so its available for any module that requires
it.  In addition, report the kernel version string with the distribution
info and log the platform in the rollover header.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-03-11 06:26:18 -04:00
Eric Callahan
10dfb0d477
update_manager: improve instance detection
Implement instance package wide for the update_manager.  This
only requires detecting multiple instances once and eliminates
costly calls to git.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-03-11 06:26:17 -04:00
bakatrouble
6b1b8c5102
metadata: support multiple filament lengths for prusaslicer
Signed-off-by: Aleksey Frolov <bakatrouble@gmail.com>
2024-03-05 19:42:59 -05:00
Eric Callahan
f0ae51792f
power: add support for custom Homeseer ports
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-03-01 05:50:03 -05:00
Eric Callahan
0850c16b00
sensor: require the 'state_response_template'
The sensor configuration isn't useful unless the user configures a
template that calls "set_result" to update fields for the desired
template.  Remove the default payload template and require
that it be configured.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-24 06:05:07 -05:00
Eric Callahan
90e13c07f7
git_deploy: fix initialization regression
New repos have not yet saved the valid state, so it is necessary to
provide a default value when attempting to access the "is_valid"
field.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-24 05:40:33 -05:00
Eric Callahan
119f579a44
git_deploy: improve refresh error handling
Save repo state if an exception is raised during a refresh
attempt.   Add additional repo warnings with for better
descriptions regarding repo issues.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-23 18:22:38 -05:00
Kamil Domański
04b1103778 Allow configuring the update refresh window
This enables customizing the time of day within which periodic refresh occurs.

Previously docs said it happens between 12am-4am which is misleading,
because the code effectively allowed refresh until 4:59:59 AM.
The default window is now '0-5', which is practically the same as before.

The comment about checking every 24h hours has been fixed as well.
This hasn't been true since commit c4fa76f21792943ea512d24326259f01d2fa7e89

Signed-off-by: Kamil Domański <kamil@domanski.co>
2024-02-17 12:41:51 -05:00
Eric Callahan
65a8271925
spoolman: fix exception handling
Make sure the connection delay isn't skipped if the
error list is full.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-14 20:34:33 -05:00
Eric Callahan
67c98f6a76
announcements: push notification for internal announcements
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-07 10:55:41 -05:00
Eric Callahan
71517b255d
machine: dont allow usb id request to block initialization
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-01 10:28:20 -05:00
Eric Callahan
6f4a0480f3
machine: add video peripheral API request
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2024-02-01 10:27:22 -05:00
Eric Callahan
eb1599fa07
machine: add support for peripheral queries
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>
2024-02-01 10:27:21 -05:00
Eric Callahan
896cd8c41e
klippy_connection: exclude configfile attrs from subscription cache
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>
2024-01-28 05:55:50 -05:00
Eric Callahan
4b9973826e
file_manager: add "enable_config_write_access" option
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>
2024-01-28 05:55:29 -05:00
Eric Callahan
c756a9029a
authorization: don't raise config errors
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>
2024-01-27 19:51:34 -05:00
Eric Callahan
43efe40cd8
authorization: report more details in /access/info
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>
2024-01-27 19:42:59 -05:00