Commit Graph

1296 Commits

Author SHA1 Message Date
Misterke 130c2a48f0 file_manager: disallow drilling down protected folders
Signed-off-by:  Kurt Haenen <kurt.haenen@gmail.com>
2022-11-05 10:45:46 -04:00
Eric Callahan 779997c2b8
git_deploy: refresh previously corrupt repos
It is possible that the user manually corrected a corrupt repo.
If a repo makes it past initialization reset the corrupt flag.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-10-22 19:03:48 -04:00
Eric Callahan 1a3689cb7d
klippy_connect: resolve the uds path
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-22 16:45:16 -04:00
Eric Callahan 1ef34b8b60
machine: improve default database handling
Don't force a symlink to the default database if
the subfolder exits.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-22 16:44:51 -04:00
Nick Douma 6afa664ac9 ldap: Add option to use a customer LDAP query for looking up the user logging in
This allows for more advanced integration of LDAP databases that are not
covered by the default behaviour of is_active_directory.

Signed-off-by: Nick Douma <n.douma@nekoconeko.nl>
2022-10-21 19:24:35 -04:00
Eric Callahan 1f86943cbb
gpio: relax error handling
Increase the error threshold to 50 and reset within a 5 second threshold.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-21 14:13:17 -04:00
Eric Callahan 4df0b4d532
machine: abort validation if the backup config is loaded
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-21 10:26:25 -04:00
Eric Callahan 1190aba4b7
machine: add logging to validation init
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-21 10:26:25 -04:00
Eric Callahan 974b37dad8
machine: improve multi-instance validation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-20 20:27:02 -04:00
Eric Callahan 8f444a908e
shell_command: error message fix
Use the original command in the message rather than the
list generated by shlex.split().

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-20 16:54:35 -04:00
Eric Callahan 59cc8c6c7b
update_manager: report errors in update response
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-20 16:54:35 -04:00
Eric Callahan e4a670a380
update_manager: improve corrupt repo detection
It that "git status" will not detect some repo issues, these are only
found after a fetch.  When this condition is detected save the repo
state and report that the repo is corrupt and invalid.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-20 16:54:34 -04:00
Eric Callahan 74f43cad6e
git_deploy: notify attempts to fix loose objects
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-19 19:32:54 -04:00
Eric Callahan c7e290a3cd
update_manager: improve web client error handling
Singed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-19 17:58:58 -04:00
Eric Callahan 38b035389d
power: improve logging
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-19 16:35:49 -04:00
Eric Callahan 1f1c590409
power: add initial state support for all devices
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-10-19 13:43:14 -04:00
Franklyn Tackitt 6131c7afc1 Git submodules use a .git file instead of a directory
I'm playing with using git submodules to track my entire printer config,
 and moonraker only works with separate clones as is. Using `.exists()`
 instead of `.is_dir()` allows moonraker to control the submodules.

Signed-off-by: Franklyn Tackitt <git@frank.af>
2022-10-19 13:41:35 -04:00
Eric Callahan 4954cc74cd
machine: change sudo folder access test
The previous "/lost+found" is not available on all systems.  Change to
"/root", which should be available.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-19 06:21:18 -04:00
Eric Callahan f745c2ce17
database: remove legacy database warning
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-18 14:13:25 -04:00
Eric Callahan d6bdad3a9d
machine: announce required update via gcode terminal
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-18 14:07:27 -04:00
Eric Callahan 9a466f3b22
server: improve warning formatting
Introduce a "raw" parameter for /server/info that defaults to False.
Front ends that do not wish to recieve warnings with html line breaks
may set this parameter to True, otherwise newlines will be replaced
with "<br/>".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-18 07:23:25 -04:00
Eric Callahan a8cbfe6345
file_manager: improve gcode path warning
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-10-18 07:23:25 -04:00
pataar b981dc109d notify: add server endpoints for notifier to list and test them
Signed-off-by: Pieter Willekens <me@pataar.nl>
2022-10-18 05:18:30 -04:00
Eric Callahan f1c4d6b143
machine: validation fix for new installs
Add a missing return statement to _link_data_subfolder.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-17 06:30:54 -04:00
alfrix 7552631b65 update_manager: fix error message displaying the wrong option
Signed-off-by: Alfredo Monclus <alfredomonclus@gmail.com>
2022-10-16 10:31:15 -04:00
Eric Callahan 7e35e54a71
machine: increase timeout for sudo access check
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 20:01:19 -04:00
Eric Callahan 05ca71f5a8
machine: relax config validation
Don't raise an exception if the option in a path does not exist.  Remove
the option and fall back to the default path location

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 19:58:34 -04:00
Eric Callahan b9cac62db8
update_manager: log when refresh is bypassed
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 11:07:31 -04:00
Eric Callahan 65e24a14dc
update_manager: do not refresh when install validation is pending
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 10:52:05 -04:00
Eric Callahan 53fcc7386f
machine: increase timeouts for sudo commands
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 10:52:04 -04:00
Eric Callahan 00c4846d11
machine: validation fixes
Protect the sudo request with a lock.  Add retries to the sudo
commands.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 08:37:45 -04:00
th33xitus fb327a6ca9 machine: use term "sudo" instead of "root"
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2022-10-15 06:11:14 -04:00
Eric Callahan 500e8f3b68
machine: disable file write access when validation fails
Prevent users from uploading files before validation is complete, as
this can populate one of the subfolders resulting in a failure when
attempting to symlink the original path.

When validating the config symlink the database first.  This should
allow Moonraker to correctly move the database should an error
be encountered when validating the other config options.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-15 06:01:36 -04:00
Eric Callahan fb679aa056
database: minor fallback fix
Fallback if not using the default path and the database has not been created.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 19:25:47 -04:00
Eric Callahan 485b29490a update_manager: deprecate repo debug option
Use the "debug" command line option to enable debug
features for the update manager.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 1e8c7f0915 database: register debug endpoints
Allow full database access to registered debug endpoints.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 30e2ec04b7 app: add support for debug endpoints
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 86fc1057f7 server: deprecate debug logging option
Add a debug option to the command line to enable
debug features.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 9021fbea48 machine: use default password for validation
For legacy Raspberry Pi installations attempt to automate
the update using the default password.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan be9aff8b5e power: loosen bound service requirement
Specifically check against the detected service unit, otherwise
allow a power device to bind to any available service.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 41ea45a486 moonraker: remove alias option
Differentiate instances based on the data path provided.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 266c5b53d1 machine: extend system info request with unit names
Report the unit names for both Moonarker and Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan d3484e8c13 klippy_connection: report systemd service info
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 636aca6cbd app: add sudo request form to welcome page
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 5259a6fd0a moonraker: perform install validation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 6e56815b42 machine: implement install validation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 7004722499 app: report if https is enabled
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 7217b36f9b file_manager: handle overlapped inotify watches
Handle exceptions raised when adding a new watch.  Warn
the user and skip adding the node to the watched tree.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 069a655df8 file_manager: update reserved path handling
Allow components to register reserved paths, then perform reserved
path validation it upon request.  Reserved paths may be registered as
read-only or no access.  Any request to modify an file/folder that is
either reserved or a child of a reserved path is rejected.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 4df6aba6c0 app: use datapath for ssl certificate storage
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 1327602ec3 secrets: add support for the data folder
The secrets module will now look for "moonraker.secrets"
in the data folder.  If the file does not exist the deprecated
"secrets_path" option will be used as a fallback.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 524552eb84 database: add support for the data folder
Deprecate the "database_path" option.  If the database
does not exist, however the "database_path" does, it
will be used as a fallback.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 480ebfac8e file_manager: add support for new "data_path"
The config and logs paths are no longer configurable,
they all exist as folders or symbolic links within the primary
data folder.  The gcode path no longer relies on Klipper to
specify the location, instead Klipper's virtual_sdcard path
shold be configured to the location of the "gcodes" folder
in the data path.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan b78cdf9660 moonraker: add data_path and alias command line arguments
Prepare to move away from configurable paths.  This will
resolve potential security vulnerabilities in the event that
a user's access is compromised.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-14 15:15:41 -04:00
Eric Callahan 91e48200d6
simplyprint: implement direct layer detection
Klipper now has the ability to report the current layer on
properly configured slicers.  Prefer this value if available,
otherwise fall back to layer detection.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-11 19:29:36 -04:00
Eric Callahan c48fe7307a
job_state: add layer_changed event
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-11 19:29:36 -04:00
Eric Callahan 48674a46e1
simplyprint: add support for configured ambient sensors
Users may specify a dedicated ambient sensor in the
[simplyprint] configuration.  If the specified sensor is
invalid or no sensor is specified ambient detection
will fall back to an estimate using the extruder.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-11 19:29:36 -04:00
Eric Callahan 785213b2b3
simplyprint: bring up AI stream to correct state
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-11 18:01:57 -04:00
Eric Callahan 6e121c2221
simplyprint: implement "webcam_stream" demand
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-11 06:07:32 -04:00
Eric Callahan d5fa40df87
simplyprint: implement ping timer
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-11 06:07:32 -04:00
Eric Callahan f8d15d3baa
simplyprint: remove keepalive
This will be replaced by a custom ping timer to the backend.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-11 06:07:31 -04:00
Eric Callahan 2e3188a48b
klippy_connection: socket credential fix
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-10-11 06:06:19 -04:00
Mathis Mensing cd19b51117 app: add jpg files to AUTHORIZED_EXTS
Signed-off-by: Mathis Mensing <github@matmen.dev>
2022-10-10 19:41:30 -04:00
Pedro Lamas 60b871adbe metadata: strip delimiting quotes in strings
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2022-09-27 06:08:34 -04:00
SoftFever df24e3ea77 metadata: Add support to extract metadata from g-code files generated by Bambu Studio
Signed-off-by: Li Jiang <softfeverever@gmail.com>
2022-09-22 06:00:45 -04:00
Rogerio Goncalves 4806ffd2ae proc_stats: expose network packets, errors and drops
Signed-off-by: Rogerio Goncalves <rogerlz@gmail.com>
2022-09-21 05:38:06 -04:00
pataar 21bb17743f notify: add ability to notify using a remote action
Signed-off-by: Pieter Willekens <me@pataar.nl>
2022-09-21 05:36:55 -04:00
Eric Callahan 5d856b9c49
simplyprint: suppress write exceptions
Its possible for the websocket client to disconnect before
read_message() returns None.   Await all calls to write_message()
to handle websocket closed exceptions.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-09-05 05:59:02 -04:00
Eric Callahan d04e99a8ec
simplyprint: automated file reset bugfix
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-28 13:45:21 -04:00
Eric Callahan 7f2d43de3d
simplyprint: automate file reset for sp uploads
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-28 12:23:03 -04:00
Eric Callahan 3a03f48e0f
simplyprint: report error messages
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-28 11:16:52 -04:00
Eric Callahan 25e79c78b2
klippy_connection: report Klippy's state message
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-28 11:16:52 -04:00
Eric Callahan b52b0bd98a
webcam: improve default host handling
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-28 11:16:51 -04:00
Eric Callahan e8999363ed
confighelper: raise duplicate exceptions
Moonraker requires that the configuration be parsed in 'strict' mode,
ie: duplicate sections are not allowed within the same file and duplicate
options are not allowed within the same section.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-28 11:16:51 -04:00
Grant Harding 78605db001
webcam: fixed rotation param
Signed-off-by: Grant Harding gharding@gmail.com
2022-08-28 11:16:02 -04:00
Eric Callahan db7474aa88
machine: use sudo password for commands if available
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 06:30:28 -04:00
Eric Callahan 272f7b946d
machine: add endpoint to check sudo access
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:59:38 -04:00
Eric Callahan 59403e226b
git_deploy: line length fix
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:54:48 -04:00
Eric Callahan 25d99207f0
authorization: implement permitted path registration
Allow components to register paths that bypass authentication
requirements.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:25:20 -04:00
Eric Callahan fd5053ecac
app: improve debug logging
Dont log the full response when html is requested.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:22:23 -04:00
Eric Callahan 2314ea74c2
app: report asset path location
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:22:18 -04:00
Eric Callahan 942d595bc2
websockets: static type fix
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:21:56 -04:00
Eric Callahan e82fe46c11
moonraker: provide startup warnings as a list
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:20:58 -04:00
Eric Callahan 0d936d5af0
moonraker: track warnings by id
This makes it possible to remove warnings and prevent duplicates.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:20:33 -04:00
Eric Callahan 0dd8eee034
confighelper: add method to write the config to any folder
Signed-off-by:  Eric Callahan <arksine.cod@gmail.com>
2022-08-21 05:19:27 -04:00
Eric Callahan a4f9fbe298
confighelper: support config modification
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:19:12 -04:00
Eric Callahan a776f1f6dc
git_deploy: improved moved origin handling
Query the detected url and make sure it redirects to the
expected url.  This closes a security vulnerability
where a remote could be changed to an arbitrary repo's url.

The `moved_origin` option is no longer necessary, however it
is currently used as an additional check.  In the future it will be
deprecated.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:18:44 -04:00
Eric Callahan 4b25b04c4f
git_deploy: refuse recovery if repo is not verified
Close a security hole where an attacker could overwrite an existing repo
with any remote and run malicious code through an update.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:18:38 -04:00
Eric Callahan b5e7a5ba5a
update_manager: resolve pip location issues
If the supplied python executable is a symbolic link attempt
to read the location at which it points.   If this is a virtualenv
this should give us the correct pip location.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:18:16 -04:00
Eric Callahan c24fd7d11c
template: add support for UI templates
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:17:57 -04:00
Eric Callahan b7768671aa
http_client: report final resolved url in response
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:17:36 -04:00
Eric Callahan 12161d12f5
machine: improve private ip detection
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:16:06 -04:00
Eric Callahan 4efb6575b7
machine: report provider type and container info
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:15:19 -04:00
Eric Callahan c154d92499
machine: add support for setting a sudo password
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:13:44 -04:00
Eric Callahan a7b50a8068
machine: extract moonraker systemd unit info
This allows moonraker to validate and log the current unit file.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:13:31 -04:00
Eric Callahan cd24b116c6
utils: resolve the moonraker path to an absolute path
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-21 05:13:04 -04:00
Eric Callahan 66f9184c74
zeroconf: support binding to all interfaces
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-19 17:38:22 -04:00
Eric Callahan 97c8b05eee
app: support binding to all interfaces
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-19 12:21:41 -04:00
Eric Callahan 853de9e8cb
update_manager: resolve potential deadlocks on startup
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-18 07:17:54 -04:00
Eric Callahan 413e3b2f4f
simplyprint: add power device fallback
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-08 19:48:13 -04:00
Eric Callahan 3424f1b3e2
machine: fix IP detection broadcast setting
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-08 19:26:19 -04:00
Eric Callahan c4e370fcff
machine: improve LAN IP detection
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-08 19:20:56 -04:00
Pedro Lamas 8bbd269084 metadata: adds chamber temp support
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2022-08-08 17:56:27 -04:00
Eric Callahan a9345d19fa
simplyprint: fix incorrect directive
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-08 17:37:35 -04:00
Eric Callahan 39f26dc31a
simplyprint: silence stream errors
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-08-08 17:02:20 -04:00
Eric Callahan 6e253b0d42
webcam: fix default host fallback
Fallback to the loopback if unable to determine the
local ip address.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-08-08 16:55:59 -04:00
Eric Callahan 0188b81d4a
dbus_manager: verify stat path exists
Signed-off-by:  Eric Callahan  <arksine.code@gmail.com>
2022-08-01 10:22:16 -04:00
Eric Callahan e0cf635d34
simplyprint: websocket write fix
Gracefully handle websocket closed conditions.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-30 15:16:52 -04:00
Eric Callahan c251a9d7ed
simplyprint: initial implementation
This adds initial support for connecting Moonraker to the SimplyPrint
service.  Currently the connection defaults to SimplyPrint's dev/test
endpoint, this will be changed prior to official release.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-28 08:06:49 -04:00
Eric Callahan cd8954e36c
metadata: Add support for Kiri:Moto and SimplyPrint
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-27 07:59:07 -04:00
Eric Callahan e264fa82b2
confighelper: don't overwrite option tracking
Its possible for any component to request a configuration
option from another component.  Don't overwrite the
inital value stored.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-26 19:34:40 -04:00
Eric Callahan a178a6cd01
confighelper: improve file parsing
Process included files in the order they are added.  This changes how
duplicate sections throughout included files are merged, options in
the last section to be parsed will take precedent.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-26 19:34:39 -04:00
Eric Callahan bdd0222a1c
machine: handle exception if iwgetid fails
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-24 17:16:34 -04:00
Eric Callahan 6b4020a6e9
moonraker: load webcam as a core component
This makes sure that the webcam APIs are always available.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-24 11:27:30 -04:00
Eric Callahan a3cae26e33
webcam: initial implememtation
The webcam module allows users to enter webcam configuration through
moonraker.conf while keeping compatibility with frontends that
store webcam data in the database.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-24 11:27:29 -04:00
Frank Tackitt 7cd29c068d
authorization: set private network CORS header
In the future, an `Access-Control-Request-Private-Network` header will be sent with
 these requests, and servers must respond with `Access-Control-Allow-Private-Network`.

This will start with the next Chrome version (104), and Mozilla has marked the
 standard as "worth prototyping", which often leads to final implementation.

Signed-off-by: Franklyn Tackitt <git@frank.af>
2022-07-19 14:25:18 -04:00
olli-t 9fea1634b1
power: fix Hue implementation
Signed-off-by: Oliver Tetz olli.codes.some.lines@gmail.com
2022-07-18 08:17:16 -04:00
Eric Callahan bcb7a55996
power: fix type/checking formatting for Hue device
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-17 06:38:38 -04:00
lie_ink 4d803ec9e5
power: add support for hue devices
Signed-off-by: Oliver Tetz <olli.codes.some.lines@gmail.com>
2022-07-17 06:26:26 -04:00
Eric Callahan 3080885257
update_manager: change default refresh interval
Check for updates every 7 days rather than every 28 days.  This
is in preparation of an upcoming beta release.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-17 06:13:50 -04:00
Eric Callahan 53a3c64186
moonraker: move loop creation to the eventloop module
Python 3.10 deprecates "get_event_loop()", so it is necessary to
create a new loop and set it as active at startup.  Previously
Moonraker only did this after a soft restart.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-07-16 19:41:09 -04:00
Eric Callahan d37f91c9c8
power: type checking fix
For legacy purposes its possible that "initialize()" may be an
awaitable.   Ignore the type as it consues mypy.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-29 12:06:36 -04:00
Eric Callahan 31d4335e3e
power: allow indefinite remote device init
Remote devices, such as the tplink smartplug and http
based devices, may not be immediately available when
Moonraker starts.  Previously this would result in an error.

Remote switches that requiring polling for state will now
reattempt initialization indefinitely.  This behavior brings
them in line with devices that are updated asynchronously.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-29 08:07:46 -04:00
Eric Callahan 835e49c10e
klippy_connection: log raw peercred data on error
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-29 06:01:48 -04:00
Eric Callahan 0a0993f9e0
server: sleep 1ms after calling component close methods
This allows any cancelled tasks to run through the eventloop
before loop.stop() is called.

Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2022-06-28 19:21:21 -04:00
Eric Callahan 09550af466
mqtt: resolve connection blocking issues
Override the paho-mqtt client "reconnect()" method with
a method capable of taking a connected socket.  This allows
Moonraker to connect the socket asynchronously, then finish
establishing the connection.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-28 19:21:21 -04:00
Eric Callahan 0b31d7d0b2
eventloop: add async create socket method
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-28 18:25:16 -04:00
Eric Callahan 371840a988
klippy_connection: increase the read buffer limit
Allow a buffer of up to 20 MiB to cover the reception of
a very large request.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-27 10:51:56 -04:00
Eric Callahan 1eaead1073
server: handle event exceptions
Don't allow exceptions to propagate beyond a call to
_process_event().  Make sure the future is not marked
as done prior to setting the result.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-27 10:51:49 -04:00
Eric Callahan 4bed314b0a
authorizaton: fix static type checks
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-17 17:56:47 -04:00
Eric Callahan 8266376f46
authorization: fix minor typing issues
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-17 17:07:58 -04:00
Luca Schöneberg 58fa361c8c
authorization: implement /access/info endpoint
Signed-off-by: Luca Schöneberg <luca-schoeneberg@outlook.com>
2022-06-17 11:19:12 -04:00
Eric Callahan d19471fd4d
announcements: implement list feeds endpoint
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-12 06:10:29 -04:00
Eric Callahan 14ec8472ef
ldap: fix group validation
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-11 17:06:54 -04:00
Eric Callahan 7780a8a09e
authorization: add ldap support
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-10 11:19:52 -04:00
Eric Callahan f52df8c7ed
ldap: initial implementation
Introduce an ldap component that can be used authenticate
Moonraker users over ldap connections.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-10 11:19:52 -04:00
Eric Callahan 5081321a32
Revert "authorization: add LDAP support"
This reverts commit a86cbc77f6.
2022-06-08 06:23:19 -04:00
Eric Callahan 250b93e89c
git_deploy: fix install script parsing
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-08 06:13:17 -04:00
Eric Callahan 3b76d81155
machine: add sonar and crowsnest to allowed services
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-06-07 06:51:40 -04:00
Luca Schöneberg a86cbc77f6
authorization: add LDAP support
Signed-off-by: Luca Schöneberg luca-schoeneberg@outlook.com
2022-06-07 06:46:08 -04:00
Eric Callahan 74d6e35166
Revert "job_queue: always initialize state to "ready""
This reverts commit d53cf27264.
2022-06-01 17:37:03 -04:00
Eric Callahan d53cf27264
job_queue: always initialize state to "ready"
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-22 06:02:46 -04:00
Eric Callahan f15ec23c3a
http_client: increase max body size
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-21 06:27:56 -04:00
Eric Callahan 0164bb239e
klippy_connection: fix bug during initialization
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-13 05:23:06 -04:00
Eric Callahan babfba1686
mqtt: allow unlimited connection attempts
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-12 19:37:33 -04:00
Eric Callahan 09ac00ce2e
klippy_connection: request endpoints before setting the state
All of Klipper's endpoints should be available before Moonraker
reports the "ready" state.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-05-12 19:22:56 -04:00
Pierre Bedell 3d9f5dc6d9 metadata: expanded IceSL's support
Signed-off-by: Pierre Bedell pierre.bedell@gmail.com
2022-05-09 12:22:20 -04:00
Richard Mitchell 56097a35ad
wled: Add extra control for wled effects
For the "Percent" preset the intensity controls the amount of the bar lit up 0-100
Work around issue when preset is re-enabled if sending intensity or speed while no preset is active

Removed control endpoint
Added missed toggle endpoint
Transition time to 0 for control changes

Signed-off-by:  Richard Mitchell <richardjm+moonraker@gmail.com>
2022-05-09 06:32:14 -04:00
Eric Callahan cd520ba917
http_client: immediately raise cancelled errors
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-23 14:55:49 -04:00
Eric Callahan 11beaa7076
metadata: read metadata after object processing
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-21 10:28:45 -04:00
Eric Callahan 6f2ce72b4c
metadata: add a UUID to extracted metadata
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-21 06:47:31 -04:00
Eric Callahan c1eda1ef3d
http_client: modify download progress reporting
Report progress for each percentage change.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-21 06:37:52 -04:00
Eric Callahan f8a38abc89
confighelper: Update the help url for moved options
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-20 07:13:26 -04:00
Eric Callahan 4be8e2e72f
database: fix decode exception handler
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-19 10:59:38 -04:00
Eric Callahan 65946ef857
job_queue: increase ready job delay
Delay for a full second before processing a job after
Klippy reports ready.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-19 06:23:02 -04:00
Eric Callahan bbd5d8a1a1
history: add logging
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-19 06:22:58 -04:00
Eric Callahan 430c2550c5
job_state: add logging
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-19 06:18:42 -04:00
Eric Callahan fe84226908
klippy_connection: log klippy version as received
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-19 06:18:32 -04:00
Eric Callahan d3003a1584
machine: return default values for find public interface
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-15 17:27:36 -04:00
Eric Callahan 4666458793
websockets: simplify JSON-RPC execution
To accommodate access to multiple protocols Moonraker will always
require that the "params" field contain a dictionary, so reject any
other type as invalid.  There is no need to expand keyword arguments,
simply pass the params dict to the callback.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:27 -04:00
Eric Callahan da864ab391
websockets: only allow connections to identify once
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:26 -04:00
Eric Callahan cbc02d625c
websockets: add agent registration
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:26 -04:00
Eric Callahan a79e0eeef2
moonraker: add extensions to core components
Bump the API patch version with the addition of the extension
APIs.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:26 -04:00
Eric Callahan 236a7a7736
extensions: initial implementation
Add basic support "agents", ie: unmanaged extensions.  Connected
agents are granted a limited ability to emit websocket notifications
and process rpc requests from Moonraker.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:25 -04:00
Eric Callahan 1133c296b1
websockets: implement notification masking
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:25 -04:00
Eric Callahan d5a55047ab
websockets: fix status codes
HTTP 404 and JSON-RPC -32601 are equivalent, so translate
where necessary.  Any other JRPC code received outside of the
HTTP error range should be assigned a 500.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:25 -04:00
Eric Callahan f6876c15e4
websockets: add ability to call ws client methods
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:24 -04:00
Eric Callahan 3a21e9d6f0
websockets: add default values for client data
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-10 14:17:24 -04:00
Eric Callahan 7631999c8f
klippy_connection: handle credential exceptions
Handle exceptions should the attempt to fetch peer
credentials on the unix socket fail.  This isn't a hard
requirement for connection and should not cause
the connection to abort.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-08 14:37:11 -04:00
Eric Callahan b21f909705
klippy_connection: get unix socket peer credentials
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-08 14:21:17 -04:00
Eric Callahan eb6aeddf78
update_manager: detect divergent remotes
If a repo's remote has diverged then a reset is necessary as the
attempt to pull will fail.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-07 08:25:26 -04:00
Eric Callahan 536871ad18
moonraker: bump API Version to 1.0.4
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-06 08:26:33 -04:00
Eric Callahan 77027d252e
moonraker: always log configuration exceptions
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-06 08:26:32 -04:00
Eric Callahan bf19bcecae
moonraker: report additional configuration info
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-06 08:26:32 -04:00
Eric Callahan fc6714b30d
confighelper: backup the entire configuraiton
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-06 08:26:32 -04:00
Eric Callahan ad00e08d11
confighelper: add support for include directives
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-06 08:26:31 -04:00
Eric Callahan 2e4814978f
app: shallow copy arguments before passing to a request
This prevents a scenario where a request handler mutates
the arguments of a WebRequest, which could result in
changing the default "request_arguments" in
"InternalTransport.call_method()".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-05 15:48:36 -04:00
Eric Callahan fb2eacf702
confighelper: make parsed a required argument
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-05 15:48:36 -04:00
Eric Callahan ea25cce38f
confighelper: require core component sections
This is a reimplementation of commit d61540cad5,
however this attempt provides a fallback for legacy configurations
that still have configuration in the server section.

This will change how `/server/config` reports configuration.  Options
will always be reported in their respective component's field, even if
they are currently configured in the `[server]` section.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-05 15:48:34 -04:00
Eric Callahan f27daac4f4
confighelper: remove "orig section" tracking
This isn't necessary as we don't add new sections to the
original config object when parsing supplemental data.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 20:45:17 -04:00
Eric Callahan ac6cf0fac7
Revert "confighelper: match core components to their configuration"
This reverts commit d61540cad5.
2022-04-04 20:31:23 -04:00
Eric Callahan 7692197678
Revert "confighelper: remove "orig section" tracking"
This reverts commit 9c33eb225c.
2022-04-04 20:31:06 -04:00
Eric Callahan 366e68c8f4
klippy_connection: send an event when gcode commands are received
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 17:18:54 -04:00
Eric Callahan fe3b7456f6
klippy_apis: add pause, resume and cancel print method
These methods may be called internally, which invoke the associated
events.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 17:18:54 -04:00
Eric Callahan e05aeac884
proc_stats: report system memory usage
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 17:18:50 -04:00
Eric Callahan 071a430159
klippy_apis: send events on pause, resume, and cancel requests
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 17:18:04 -04:00
Eric Callahan 7c1d6a8f24
websockets: emit added, removed, and identified events
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 17:18:03 -04:00
Eric Callahan 18169f279e
file_manager: add get_directory method
This replaces the previous "get_sd_directory()" method, allowing
consumers to get any registered root path.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 17:18:03 -04:00
Eric Callahan 393cfa2a0e
machine: implement get_public_network method
This allows components to determine the current local
ip address that routes to the internet.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 17:18:02 -04:00
Eric Callahan 9c33eb225c
confighelper: remove "orig section" tracking
This isn't necessary as we don't add new sections to the
original config object when parsing supplemental data.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 15:26:16 -04:00
Eric Callahan d61540cad5
confighelper: match core components to their configuration
Most core components have default options that allow them to
load without a section specified in moonraker.conf.  This resulted
in those options showing up in the [server] section in the
"/server/config" response.  These changes will make sure that those
values show up in the correct section.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 15:16:25 -04:00
Eric Callahan 72a85e08d4
update_manager: refactor extension instantation
Don't allow extension errors to propagate, warn and continue
loading the module instead.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:24 -04:00
Eric Callahan 238b08ea1f
update_manager: bind Klipper beta updates to Moonraker
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:23 -04:00
Eric Callahan 6afc70a9f5
update_manager: add support for beta git updates
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:23 -04:00
Eric Callahan 03934d8d81
update_manager: deprecate web_beta type
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:23 -04:00
Eric Callahan 58ea3cfdc7
update_manager: deprecate zip beta type
Use the "channel" option to specify a beta.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:22 -04:00
Eric Callahan f965ce8fd8
git_deploy: refactor tag retrieval
Use git for-each-ref to retreive tags and their associated commit
hashes.  This allows us to limit the amount of tags to 10 and
simplifies the code as the returned objects are already dereferenced.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:22 -04:00
Eric Callahan e9e86c3042
update_manager: refactor AppDeloy class
Don't require the `app_params` argument, instead dynamically
generate the configuration from a dict.  This simiplifies AppDeploy
initialization as the internally generated configurations can be
read in the same way as those supplied in moonraker.conf.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:21 -04:00
Eric Callahan 54081612ca
confighelper: add a setoption method
This should only be used for internally generated configuration
that may change during runtime.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:21 -04:00
Eric Callahan 93b62236de
update_manager: reorder update instances
Instantiate the moonraker instance first, then Klipper.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2022-04-04 11:46:21 -04:00