If guest/anonymous users where configured with read-only rights,
the login dialog would enter a redirect loop due to require_login_with
not recognizing anonymous use with permissions as valid.
Fixes#4516
Requires admin rights to exploit in any way.
With OctoPrint 1.8.0 all cookies with credentials
are http-only and thus not targetable (to my
knowledge) by this.
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N, Severity Low
Apparently Chrome will happily create URL objects from
what is actually HTML tags. So now we will also
URI encode the stream URL prior to embedding in the page.
This protects against lines from the printer like
T:210.04 /210.00 B:52.00 /52.00 @:85 B:1234.0 /1234.0
We've seen *so* much weird stuff out there in firmware, let's better
be safe rather than sorry and rule out latter values from overwriting
former values just in case.
Settings._config has been turned into a read-only view by the
recent refactoring of the settings hierarchy. Refactored our use
as needed to still function and added deprecated decorator to
getter and setter property to communicate this change in behaviour.
_config wasn't documented, so it is not part of the official API and
thus this doesn't qualify as a breaking change, however there might
be plugins there that went beyond the documented API and use it in
some way (possibly even stuff I have written in the past), so
best give them a heads-up.
Closes#4486
Apparently werkzeug removes stuff on minor releases and that just
broke flask-login 0.5. A newer version isn't out yet, so we pin to
a lower version of werkzeug for 1.8.0 and will then see what to do
with this situation for 1.9 and later (potentially even vendor
flask-login as it appears pretty dead currently).
Could trigger when reloading page while preliminary cache
was being done, causing an internal server error
on page load, immediately fixed by a second reload.
Seems to be caused by the change in webasset handling
in 1.8.0, hence considering this a regression.
Fix consists of switching to a thread-safe in-memory
manifest storage.
Apparently disabling it if no serial ports are currently
known to the client breaks certain workflows for people.
So this is a short-term solution to fix things for them, while
technically non-sensical (why offer to connect if we don't see
anything to connect to?) So in 1.9.0 this should rather be
solved by adding some form of platform agnostic (!) auto-refresh,
either regular polling while no port is detected, or even
watchdog enabled event based refresh. See #4473.
Only ever send *completed* layers to the frontend. Otherwise in case of
zHops and such we risk sending incomplete layers and missing whole
command segments in the process.
Closes#4459
* Fix too broad regex
* Fix lack of error handling in case of reserved identifier
All of these got already introduced in 1.4.1, but now with #4388
they are WAY more likely to pop up (e.g. in garbage lines too) and
completely nuke the connection.
Closes#4456
* Don't crash if template is set to None
* In general catch any error while processing plugin template
configs and ignore plugin completely.
Closes#4453
If we strip \r from \r\n, our line length and thus file position
calculation will be off by one. We'll just leave it in as it
doesn't influence our parsing and makes things way easier.
Thanks to @JoveToo for the heads-up on Discord.
If we run into a timeout with `M400` and never receive
the requested position data in time, don't keep
the recording flags set or we will record an
outdated position first time we see another
`M114` response.
See #4440
* Demo Github Token Settings
* 🚸 swu: explain where and why to get a GitHub PAT
* 🐛 swu: Only set GH PAT if it's been provided
Co-authored-by: Gina Häußge <gina@octoprint.org>
Adds a "downloading" and a "splitting lines" step so
it's clear that something IS happening, even though
the progress bar isn't yet showing a percentage.
* Replace AVLTree with double binary search
* Remove unused variable
* reader.js
* Best return the correct variables
* Better compare with percentage of next layer.
* Fix several bugs and edge conditions
* Implement iterative binary search
* No point in going through the math if it can be only 1 layer.
* Add last position cache
* Remove AVLTree from repository
* Must be lower than percentage of next level.
* Look up the percentage value in the correct model.
* If we add extra zlifted element, we need to sort the layer.
* Remove caching and add lookup array to simplify code.
* Restore change.
* Also clear layerPercentageLookup on clear()
* Fix pre-commit issues.
* Fix pre-commit issues.
* 🔥 Remove now disabled sortLayers
* 🐛 Fix layer split in gcoded viewer
We now create a layer each per z-height, even if we
encounter the same z-height several times in a print.
This might also solve #2243, though I have not tested it yet.
Co-authored-by: Gina Häußge <gina@octoprint.org>
* Support two-digit flavors for G00 G01 G02 G03
Many CAM processors generate two-digit movement commands. These are legal movement commands but the viewer is currently blind to them. (Evidently slicers never generate these, or this would have already been an issue.)
This does not fully solve rendering of non-extruding toolpaths, but it enables a workaround in combination with M101 added to the preamble.
* 🥅 Support G00, G01, G02, G03 in backend as well
Co-authored-by: Gina Häußge <gina@octoprint.org>
Ever since the needed upgrade, the e2e tests have
been very shaky. Let's try to up the retry count
to get this under control.
Long term I need to find out what's going on,
but currently I'm not able to even reproduce the
issue (jquery not loading). And/or maybe switch
to PlayWright if I can't get it to work reliably
anymore.
* adds an update queue to allow starting updates while printing, #3320, #3589, #3585
* change to 202 status code instead of abort for queued installs
* remove commented code
* fix formatting
* UI improvements
proper list merging, without duplicates
* add countdown timer on print completion prior to update
don't automatically update on print fail
add ability to cancel queued updates
* UI tweaks and fixes
* minor bugfix
* if logic adjustment to prevent sending messages to front end when no updates queued
* add timer abort on print start in case he update is in process
* added wait for timelapse completion to avoid interrupting that process due to resstart at the end of updates.
* ♻️ Get rid of some data duplication
...and a TODO
* API adjustments as requested, removed PNotify hack for singleButtonNotify change (broken)
* added print_cancelled flag to deal with changes related to waiting for timelapse
switched PNotify back from singleButtonNotify and added class hidden to button instead to avoid Pnotify.update issue
* 💄 minify CSS
Implements #3320
Implements #3585
Implements #3589
Implements #4431
Co-authored-by: Gina Häußge <gina@octoprint.org>
* Add support for changing hook order
Default hook value changed from None to 1000
* ♻️ Refactor sorting override logic
* fetch settings during platform initialization instead of in plugin core
* rename from hook order to sorting order as it's also used for the
sorting context of implementations
* make sure settings are initialized empty in defaults
* 📝 Add missing docs for sorting order overrides
* ✨ Fully support reordering of implementations too
Co-authored-by: Gina Häußge <gina@octoprint.org>
* Use json for annoucements cache
Parsing this XML file is very slow, so there's no reason to do it more
than we have to.
See 4480-2021-12-11T13:23:48-05:00.json, MainThread -> parse
On my system, this reduces the time for /plugin/announcements/channels
from 250ms CPU time to 50ms.
The rough improvment in this specific function call is from 8% to 0.32%
of total runtime.
* ♻️ Refactor json serializer
* Move back to octoprint.util.json
* Leave old encoding helper as is but add additional
one focused on serialization (with full roundtrips).
Use each as needed (primarily encoding one).
octoprint.util.encoding -> old one
octoprint.util.serializing -> new one
Each serves different purpose, we don't want
to end up with `__jsonclass__` stuff in our
API output at some point, so separate the
concerns here and allow different handling.
* Ensure wrappers are in place for backwards
compatibility (e.g. dump vs dumps).
* 🐛 Fix handling of invalid cache
We get different exceptions now and in any case just throw
*anything* away that we can't parse.
* 🎨 Use fallback typing annotation for Py3.7.{0,1}
Better solution than getting stuck to Dict only, thanks
@flaviut for the suggestion!
* 🐛 Fix bytes encoding
bytes objects are explicitly not always UTF-8, so encode them in a way
that doesn't lead to errors and encoding/decoding problems when they are
actually binary data.
Co-authored-by: Gina Häußge <gina@octoprint.org>
That's only interesting for dicts anyhow, so let
the chainmap itself take care of fetching
the top-most individual values and only spend
more cycles on picking the right layer for
unmerged access if we can't find the value.
Prusa Firmware now has sendChecksumWithUnknownCommands and unknownCommandsNeedAck as they've decided to
add non-GCODE commands to their MMU
command subset that otherwise possibly cause
issues in the field, especially if part of a
sliced file.
Implements #4423
* settings: reimplement storage chainmap
This implementation is mostly compatible with the previous one, but in
my opinion is much easier to read and much easier to reason about.
The areas of incompatiblity are, in my opinion, bugs that have been
fixed.
* 💚 Fix a failing test
Slight behaviour change means there's no emtpy
dict left in the top layer but the whole key
is gone.
* 🎨 Let pre-commit do its thing after merge
Co-authored-by: Gina Häußge <gina@octoprint.org>
* Initial work for temperature markings
* Made markings label always stay on graph
* Made the markings persist after reload
* Added myself to authors
* Fixed prettier issues
* Made markings types lower case and added Done marking
* Code cleanup
* Made markings expire after a while
* Code cleanup
* Some CSS changes & make it optional
Co-authored-by: Gina Häußge <gina@octoprint.org>
* adds a setting for sd cancel command, #4368
not binding to settingsViewModel as expected, needs adjustment to API?
* add settings API bits for binding issue
* instantiate setting on init.
* ✨ Add `--no-color` option to disable colored output on console
Closes#4396
Also removed the setting of INFO logs to white, instead it will be left as default. If there is a light-colored background (such as white) then it becomes unreadable. Can then just use whatever user has configured for their default and not worry about contrast issues.
* 🎨 Remove redundant bool wrapper
* ⬆️ Update to colorlog 6
That way we get support for NO_COLOR as well:
https://no-color.org/
* 💬 Add NO_COLOR to --no-color help
Co-authored-by: Gina Häußge <gina@octoprint.org>
* ✨ Add `octoprint dev css:build` command
Has the necessary paths pre-configured and can build all the less files in one go, if you so wish.
* ➕ Add login & recovery less files
* 🔨 Don't build all if none specified
Explicit better than implicit? Makes `--all` useful at least.
* 🐛 Fix announcements typo
Co-authored-by: Gina Häußge <gina@octoprint.org>
* Adding shutdown action command.
* Add myself
* Add error handling.
* First attempt at systemcommands module
* Fix pre-commit issues
* Fix pre-commit issues
* Add log message.
* Update src/octoprint/systemcommands/__init__.py
* Renamed __call, simplified code.
* Inject systemcommands into plugins
* Use underscore between words in dict.
* ♻️ systemcommands -> system_command_manager
* ♻️ Switch places that make sense to system_commands_manager
Also switch SCM to use CommandlineCaller instead of
reinventing the wheel, same for other places.
* 🔒️ Don't enable support for action:shutdown by default
It could be abused by malicious firmware and/or GCODE
somehow tricked on the user, so let's play it safe
and make it something the user has to consciously enable.
* 📝 Add missing documentation
Co-authored-by: Gina Häußge <gina@octoprint.org>
... at least not yet. to_str is currently a (deprecated)
synonym for to_bytes, and changing that behaviour
would be a breaking change. Better leave it to 2.0.
This allows browsers and other clients to calculate download progress
and detect if the download fails (they get less data than expected).
This is most useful when downloading multiple timelapses due to their
potential size.
This is a backport of PR #4313
* Added Try/Except test to prevent I/O errors when connecting to a nonexistent serial port
* Added an additional possible failure condition to log message
* Fixed log message formatting
* Make player fit source aspect ratio when rotated
* Fix rotated landscape video in wrong position
* Ensure webcam layout updated when rotation changed
* Add PiP and sound controls
* Add full screen control
* Make controls transparent unless hovering video
* Fix WebRTC mute/unmute not working
* Fix typo
Co-authored-by: Gina Häußge <gina@octoprint.org>
* Reduce code duplication for HLS and webRTC
* Ensure webRTC and HLS are unloaded when switching
* Add comments to rotation code
* Ensure PiP and fullscreen use correct video
* Extract click handler for fullscreen and PiP
Co-authored-by: Gina Häußge <gina@octoprint.org>
We need to process markdown stuff in OctoPrint
now anyhow, might as well just convert
the files previously converted during build on
the go.
That also makes it easier to keep setup.py
Py2 compatible.
* pyupgrade
* various new codemods
* manual removal of Py2/3 compat imports
* manual adjustment of docs, examples, tests
* to_str is now the new to_unicode, deprecated
redirection to to_bytes has been removed
* to_native_str has been redirected to point to
to_str
* to_unicode has been redirected to point to
to_str
* atomic_write refactored to use
NamedTemporaryDirectory
* various other fixes/refactorings all over the
place
Instead of silently ignoring a select/print
on file upload if the necessary preconditions
(printer is online and free to take new jobs) aren't
met, include the effective print/select flags
on the upload API and in the triggered UPLOAD event.
Cleaner would be to simply abort such an API request
with a 409, but that will cause issues with
existing third party plugins and clients and thus
we leave it at simply making the necessary data
available without changing behaviour.
cc @jneilliii
We don't want to reimplement already-installed-,
egg-problem- and other logic in multiple places,
so centralize this in octoprint.util.pip and
also add a test suite.
already-installed-logic has also been updated
to solve #4363 by now checking if there's been
a successful result line and if not if there's
been an "already satisfied" line, which should
work more universally across pip versions.
Closes#4363
If set to true, will perform a double install,
once normal (to gather required dependencies), once
with --force-reinstall and --no-deps (to force a
reinstall of the package itself).
See #4363
* Generate thumbnails by taking the last frame
* Allow thumbnails to be downloaded
* Update thumbnail UI
* Clean up code
* Ensure thumbnails get deleted with the timelapse
* Clean up code
* Update CSS for timelpase thumbnails
* Add timestamp and show formatted date
* Update thumbnail size in UI
We should rarely if ever regenerate the webassets in production and can
wait a few seconds for regeneration in development, if it means we can
get rid of a whole monkey patch and an internal use of pickle with
non-tamperproof files.
So disable the bundle component cache and switch the manifest over
to use a json file. Ensure the latter is also removed on server
start, just like the other webassets related generated files.
Better solution to what was discussed in #4339 and originally
to be solved with the now reverted 0f41a42.
Just in case someone might somehow find a way to
tamper with the cached compiled assets on disk
(e.g. through a 3rd party plugin), this should
now be better protected against abuse.
See also #4339
Our distutils import used to determine the current
interpreter's site-packages directory caused
an import warning.
Switching to a different method of determining
the path solved the error and is also way
cleaner.
Found here: https://stackoverflow.com/a/52638888
* If no ports are detected, don't even allow to
connect, instead show a hint to refresh and
link an FAQ entry.
* When auto detection fails, show a notification
with a link to the FAQ.
Implements #4237
For testing behaviour when the printer is locked. Marlin feature, enabled with `PASSWORD_FEATURE`.
Can be enabled on startup, where no communication is possible until unlock. In Marlin, it accepts a 1-9 digit password.
Also added/fixed OKs not being sent on klipper errors. Possible resolution to the hanging experienced debugging https://github.com/OctoPrint/OctoPrint/issues/4299#issuecomment-978112886
on my recently installed rpi 4b device with the latest octopi image, `localhost` resolves to `::1`, which I hadn't thought to add to the `localNetworks` list in the config. With this change people following this guide as I did will end up adding the ipv6 version so that `localhost` will correctly resolve regardless of which network stack is active and primary.
Hooks running into errors could prevent commands to
be sent overall, as witnessed in
https://community.octoprint.org/t/38807
This should now no longer be possible.
* "Update all" will now only update *enabled* items
* "Update all available" (dropdown) will update enabled *and* muted items
* "Check for updates" does what it always did
* "Force check for updates" (dropdown) bypasses the cache
* Notification muting and logic is now also explained in a footer.
URL will be provided as "auth_dialog" property on
app token request. Clients may open the URL in a
browser window to request access directly.
The dialog acts identical to the popups in OctoPrint's
UI.
For now restricted to third party plugins.
Allows bulk enabling and disabling. Should help
with debugging and also general maintenance.
Implements #4314
If we disabled some checks in the past, and their
providing plugins are currently disabled, we
will have checks configured that only consist
of a "disabled" key. That will cause a warning
to be logged as there's no type defined. So
we now simply ignore entries without a type
altogether.
The original frozendict module is maintained again and has not removed
setup.py from the repository to make packaging harder. Also the 2.x
releases have added native code to speed it up.
We need to however stick to older versions for
Python 2 and can only pull in newer versions
under Python 3.
Co-authored-by: Gina Häußge <gina@octoprint.org>
That will allow us to determine if a user *actually* recently launched
in safe mode when reporting an issue.
I wish this wasn't necessary, but as House always said, everybody lies.
By highlighting every fifth grid line in the GCode Viewer, people
can better see spatial relations. Plus, it looks a bit like
engineering grid paper!
For #4179
Co-authored-by: Adam Wolf <adamwolf@feelslikebunring.com>
Co-authored-by: Gina Häußge <gina@octoprint.org>
Apparently some printers/printer connections really don't like the
attempt to set the low latency flag, as in, it fails, handled gracefully,
but then the connection is broken regardless.
We'll disable it by default for now, and tackle this properly in 1.8.0.
Instead of forcing plugins to use absolute paths to templates,
via a plugin aware jinja2 environment it is now detected whether
the template they are importing does locally exist in their own
template folder (in which case it gets automatically prefixed) or not.
A deprecation notice is now only logged when a plugin imports a
template from another template without the prefix (which probably
is a *very* rare occurence anyhow).
Will add a reminder if an issue is labeled 'triage' and now bundle
is detected.
Will go away if issue is no longer labeled 'triage' or edited to fix the
problem.
Templates provided by plugins are now internally
registered under "plugin_<identifier>/<template>".
Automatically generated includes via the template
subsystem have been adjusted to accomodate this
change. For plugins still relying on the old
single namespace imports, a fallback loader has been
put in place that insures includes without prefix will
continue to function for now but generated a deprecation
message in the log.
Fixes#4260
On OctoPi 0.15 OctoPrint 1.7.0+ will refuse to update.
Reason: yet another dependency no longer building in
this ancient environment. We'll allow an upgrade to 1.7.0
because we cannot retroactively warn people about this
anymore, but from here on out that's it.
OctoPi 0.15 was released in 2018, I think it's fair to
expect people to update, especially with the available
backup and restore functionality.
Will be called by the plugin manager when a plugin
is about to be uninstalled through it. Useful for
any cleanup tasks a plugin might want to do when it
gets uninstalled.
Note that this method does not HAVE to be called if
the plugin is uninstalled outside of OctoPrint by
deleting/pip uninstall'ing the plugin.
This brings the load time of /api/settings on my crappy ARM board from
1s to 0.4s
This is done by
- optimizizing the hot loop inside deep_dict, which provides most the
gain (to 0.46s)
- using pickle for deep-copying, which is fast when doing lots of
pointer chasing, but slow when doing long copies (to 0.37s)
This is useful to be able to tell when a performance issue is due to the
network or due to the actual execution time
There's hardly any overhead, so send it with every request.
We only use the search in one single place, it's not
part of an external API and three lines only. It makes
sense to internalize it into serialList.
Also, python 2 doesn't yet have os.scandir, so use the
fallback implementation in that case.
The existing code lists the directory contents 7 times. This usually
isn't a big deal, but I'm running Octoprint on a really slow ARM board,
so this ends up taking 123ms (coming out to 17ms per call).
We can speed this up a lot by only listing the files once, and searching
through them. With this change, this function is fast enough that it
doesn't show up in the profiler
This makes the width of the modal really narrow when it is first opened & on certain screen sizes, removing this line appears to fix the issues.
Closes#4216
We should only ever attempt to set it if we are supposed
to set it to True. Otherwise there's no need to do
anything really and risk running into issues.
Closes#4203
SWU and PMGR make use of that to add console logs. SWU
now also adds the update log as plugin_softwareupdate_update.log.
Also improved caching and sorting behaviour on SWU update log.
I had a response like
```
"date": 1614624977,
"display": "Misc_-_Happy_Birthday_1.gcode",
"gcodeAnalysis": {
"analysisPending": false
},
"hash": "20af558d1fc68865333892cd9d0536293120e3b7",
"name": "Misc_-_Happy_Birthday_1.gcode",
"origin": "local",
"path": "Misc_-_Happy_Birthday_1.gcode",
```
Can't go 3 levels deep in JS without checking that the object exists, which apparently in some cases it doesn't.
This broke sphinx autodoc, it would not pick up the module-level docstrings. In most cases, this was not really a problem but printer profiles documentation was missing quite a lot.
Python 3.10 introduces a backwards incompatible change around collections and collections.abcs, which tornado was impacted by.
According to Tornado's release notes https://www.tornadoweb.org/en/stable/releases/v6.0.0.html seem like there is not much else to worry about, and the devel branch has already upgraded it.
Would be good to get this tested by someone else using Python 3.10 and some plugins, and also some Python 2 installs.
See also #4043 for the other collections-related changes.
Users now get a meaningful error message in both the plugin install log
as well as a clickable FAQ link in the plugin management log
notification.
Works for pip and single file installs.
Implements #4166
Instead of zero dimensions and bounding box we now just say "Model
contains no extrusion."
That should hopefully make it clear. Works for new analysis results with
`_empty` flag as well as analysis results with all 0 dimensions.
See also #4162
Many users are still copy/pasting the textual system info dump and
forget to share the bundle. Rephrase the request to target the bundle
and hide the info dump behind a More area. Also link to the bundle
viewer.
Includes proper handling auf cancel/pause situation, where we use the
position report as a signal that all movement has ended and the position
report should be used for final cancel/pause position, adds a new
terminal filter and also takes care of capability report evaluation and
proper interval setting via M154.
cc @thinkyhead - the cancel/pause situation worried me, so I took a look
how to solve it and that meant the implementation was already done as
well. Hope you don't hold it against me to tackle this myself after all.
Also support quoted long names, which apparently are sent by some
firmwares? Make a suggestion for a format that is universally parseable,
document it on the reprep wiki, people STILL find a way to be
incompatible to it. I can't even...
Anyhow. See https://community.octoprint.org/t/adding-support-for-m20-l/34402
We need to update the links to the py2 windows files. Also make py2
environment instructions optional across the board, they really should
only be relevant for maintenance going forward.
If we are on py3 and thus can rely on pathvalidate, we'll now no longer
slugify uploaded files names, but try to keep them as close to the
original name as possible, including unicode and emoji and whatnot. This
requires the underlying file system to support this, so just in case the
old behaviour can be enforced by setting the config flag
feature.enforceReallyUniversalFilenames to true.
Closes#4078
Small annoyance - it doesn't *need* to be any larger, but the text buttons look too small up there. As a result I removed the small class from the icon button to make it line up.
Chrome's canvas arc method seems to produce wrong results in case of
extremely large radii combined with extremely small enclosed angles. So
in case of Chrome we'll now default to a replacement function
approximating the arc with bezier curves. This can however be disabled
via the advanced options.
Additionally, another debug visualization option was added that shows
the arcs with their center points and segment borders.
Closes#4117
An interesting condition of when the correct positioning was calculated - with the animation, often the webcam stream loaded fast enough that it was before the animation was finished. Now there is no animation (from jQuery) then we hit a timing problem.
Yes, it is hardcoded but so is the modal width.
Minor refactoring to get rid of three problems. Not only is #4115 as
introduced by 886c3d9449 fixed but changes
to the bed dimensions after printer profile change now trigger a proper
viewport reset (zoom & translation) and there's now also a button to
reset the viewport to a sensible default should you get completely lost
in the viewer canvas.
Closes#4115
Due to a file upload bug currently present in the issue forms,
it's not easily possible to upload logs anymore. We need logs, so
we currently can't use the issue forms until this bug is fixed.
Adding the `unselect` right next to where the `select` is implemented.
There are two ways of unselecting, 1) using the selected filename,
2) using special word `current`
POST /api/files/local/whistle_v2.gcode
POST /api/files/local/current
If Prusa firmware is detected, fall back old behaviour of lower casing
files received from M20, instead of using them as provided (as
implemented in #3994).
Fixes#4102
Also deprecate plain versions key.
That way we can now easier define blacklisted version ranges and also
limit blacklisting to specific python versions (on top of OctoPrint and
plugin versions).
Analysis subcommand now has a new --layers parameter that allows us to
export information on all detected layers. Also recognizes zhop. Helpful
for comparing analysis with gcv results, see #4086
If folders are empty (no upload date) & sorted by upload, Chrome would
produce arbitrary sorting orders. The sorting now falls back on sorting
by name in such cases.
Closes#4073
On file upload, if the target file already exists, a confirmation will
now be shown that allows to explicitly overwrite the existing file,
rename the file prior to upload (with a collision free suggestion
provided) or cancel the upload.
A feature flag allows to disable this confirmation again to restore the
old behaviour in case the new one clashes with people's workflows.
Implements #3873
Also do the same for timelapses.
For individual files, the LargeResponseHandler takes care of this
validation. For zip downloads however, we need to do it. An earlier
refactoring accidentally applied the same logic to the invididual
downloads as well, though in a broken way, this now fixes behaviour in
both variants.
Each heading used it's own style, so now they are all aligned with the most common.
H3 was the most common, so I went with that.
No issues here, this was just one thing that annoyed me :)
And log when it is undervoltage.
The problem here was twofold: first, a very generic message asking to check the log confused users. Second, there was nothing logged when it said check the logs.
So, this changes that so the message is escaped and displayed in the pnotify and when the update is blocked for undervoltage this is logged.
This does not add logging for other methods, since it seems unnecessary to me.
Closes#4024
`path` in this context is just `octoprint.log`, so the path validation is useless - it will always look in the basedir, because that is where Tornado has been told to look.
No other validators do the same as far as I can see (timelapse and files).
Closes#4045🎨 Pretty
api/plugin/pluginmanager has been deprecated in favor of
plugin/pluginmanager/plugins, plugin/pluginmanager/orphans and
plugin/pluginmanager/repository. Additionally, there's now
plugin/pluginmanager/plugin/<key> to retrieve info for a specific plugin
by its identifier.
Repository and orphans are only fetched on opening of the Settings
dialog, plugins and notifications on login with required permissions.
All list endpoints make use of ETag headers.
The former simple API endpoint api/plugin/pluginmanager has been left in
the code for now but marked as deprecated. Same goes for the clientJS
API.
Implements #4035
People might not actually always have a home command in their GCODE
files, so let's just depend on the so far pretty universal truth that
printers have a bed at z=0 and that is just always the lowest Z of a
printed object. And just in case, let's make this value configurable
because the printer gods only know what some people might come up with
in terms of experimental printer mechanics that end up with negative z
coordinates or a bed at z=100.
Closes#4036
Added an ES6 polyfill, fixed some minor issues in less.js, put less.js
into lib bundle again.
Further steps should be taken to ensure the core JS files stay ES5
compliant with regards to the use of arrow functions, let, const and so
on, at least the versions bundled into the webassets.
Closes#3920
Make sure our core JS files stay ES5 compatible.
Alternatively we could find a way run them through babel first, initial
experiments with dukpy have sadly resulted in a blocked server, so far
no clue why.
Related to #3920
Just in case some firmware variant decides to go for case sensitivity
here (shouldn't usually happen since this should always be 8.3 names,
but people tinker...) we treat the SD file names case sensitively again.
Closes#3994
We were trying to fetch the repo url from the settings. However, due to
the settings overlays from other plugins not being available when
operating in a CLI environment, the repository URL was unset and thus
nothing was fetched.
This is now fixed by falling back to the default repo URL from the
pluginmanager, which has been extracted into a constant for that reason.
Fixes#3883
Non-ASCII host names under Windows are bad news for firing up an
HTTPServer instance. We can't fix that, but we can display a better
error message.
See https://bugs.python.org/issue26227Closes#3963
The switch back was enqueued in a timeout, however that timeout was only
ever cleared if fancy functionality was already enabled when trying to
switch it back on due to a logic error. Now it gets cleared whenever the
time needed for processing the log lines is above the threshold.
Potentially fixes#3905
409 returns on this endpoint are common if the printer is not currently
connected. Reduce log spam by rewriting such requests to INFO level,
which by default won't get logged.
We continously scaled all coordinates, quickly blowing up the values in
minMax. Fix this to only scale as needed when converting the input
coordinates into a vector.
See #3930
`M150 W40 R20 G20 B20` was being read as `G20`, improve matching so we
only look at the actual GCODE command instead of any parameter that
looks like one.
See #3930
When plugin install went async (4cf2a673c8) not all of the responses were caught. This PR changes the rest of the responses to become asynchronous as well.
Closes#3849
Will help us label PRs based on their contents, and then that info
can be used to make the whole branch validation a bit more intelligent.
For reasons of consistency, also rename issue labeler to issue
automation.
It turns out that a) we were not yet doing plugin installation after an
archive/file upload asynchronously, so that any delays there could still
cause timeouts, and that b) we were also not handling the conflict
situation of trying to start another plugin install while one is already
running correctly on the frontend.
This fixes both issues.
That will allow us to get a general idea of actively used vs idle
instances. A huge number of instances in an error state could also be an
indicator of problems with a release.
Would also be a cool thing to be able to add "this many printers are
currently printing" to data.octoprint.org
* Fix button state so that the tracking can be enabled/disabled after
selecting one of the options for the first time.
* Improve formatting in tracking wizard template to improve code
readability.
* Add myself to AUTHORS file.
Marlin includes the build time in it's firmware name, until now the expression split it on the colon, and failed to do it properly.
Example format that now works:
```
FIRMWARE_NAME:Marlin 2.0.7.2 (Nov 27 2020 14:30:11)
```
When plugin install went async (4cf2a673c8) not all of the responses were caught. This PR changes the rest of the responses to become asynchronous as well.
Closes#3849
setup.py STDOUT and STDERR are printed via pip STDOUT until v19 and STDERR from v20 on, which can hence parsed by the originating script directly. This allows the fragile need to a temporary file that needs to be R/W-opened by two different processes.
Signed-off-by: MichaIng <micha@dietpi.com>
That way it won't even enter the state data if it's not JSON compliant,
that's better than no longer being able to send any state reports just
because one plugin is sending broken data.
Closes#3875
The default json library in python will send infinity values as `Infinity` as described [here](https://docs.python.org/3/library/json.html#json.dump). Check that the JSON is strictly valid before sending it, otherwise throw an exception.
This fixes#3875
It turns out _.merge will also merge arrays, which in turn will re-add
anything we've just removed from a setting that happens to be an
array, thus as blocked commands or temperature presets.
Fixes#3855Fixes#3867
New version 0.10.5 restricts upper Python version limit to <=3.6.
That won't work for Python 3 OctoPrint installs out there, so we
stick to the (for us) perfectly working 0.10.4
Dear library maintainers, please don't push breaking changes on
patch releases...
* update event-type in trigger-docker workflow
* add dispatch_canary job
* change canary to trigger from maintenance
* add bleeding release type for trigger_docker.yml
* make things uglier to make prettier happy
We don't initialize the settings plugins (and we don't want to change
that either since it's a TON of potentially error prone overhead just
to allow a glorified editing of a yaml file), so we now can force
values even if their paths are unknown to OctoPrint. Can be abused to
clutter config.yaml, but so can plugins.
Closes#3869
It turns out _.merge will also merge arrays, which in turn will re-add
anything we've just removed from a setting that happens to be an
array, thus as blocked commands or temperature presets.
Fixes#3855Fixes#3867
Fixes issue editing settings in the UI via VP settings plugin:
`Unexpected error while connecting to serial port VIRTUAL, baudrate 250000 from hook virtual_printer: TypeError: 'unsupported operand type(s) for //: 'int' and 'str'' @ comm.py:_open_serial:3667`
We don't want children to be included on api/files or api/files/origin,
but we do want them on api/files/origin/path as that gets taken from
a file listing itself. So a level parameter is introduced on the storage
interface, defaulting to 0 and thus the former behaviour (remove
children), but setting it to a value > 0 will only remove grand children
and thus give us a way to query what we want on the detail endpoint.
See #3844
Children were not being included without the recursive parameter when it
should in fact only have been grandchildren and later generations.
Closes#3844
* Move check for updates & update all buttons to the top of the interface
* Move advanced options to collapsed section at the top of the interface
Part 2 of 2, implementing #3801
Allows to specify additional config overlay paths to use between the
default settings and config.yaml. Can be either individual yaml files,
or a whole directory containing an arbitrary number of yaml files.
Allows to change the default configuration without interfering with
config.yaml.
OctoPrint side solution for #3821, OctoPi needs to be modified to make
use of this for its platform specific configuration.
* Move get more button to the top of the UI, beside the settings button
* Move information about pip, notices etc. to collapse that appears beside the button
* Fix the top bar when scrolled, no longer a double-scrolling area.
It now has a dedicated place on the state panel. Also gets exposed
separately on the API. API docs clarify value range of state field on
job API.
Closes#3828
If we don't, chances are high someone will happily assign the admin
group as a subgroup to the guest group and then publicly expose their
instance on the internet, thus completely defeating the purpose of
making access control mandatory.
We'll also automatically sanitize such configurations now but log a
warning. I don't see a better way to protect the innocent, sorry.
That way, if OctoPrint is running on a device with network
`192.168.1.0/24` and we query with an address from that range, we'll
actually get that subnet address back instead of the more general
`192.168.0.0/16`.
In Python 3, `filter()` returns an iterable rather than a list. Whilst this is better for performance, our list is not long and it means we can call `len()` on the list.
Tested using reproduction steps in #3814 and verified that language packs can now be installed properly.
Closes#3814
Missing users.yaml should already trigger the wizard to pop up again,
but corrupted users.yaml so far made the user manager to mark itself as
customized and THEN fall on its face.
We now first make sure we can actually load stuff (and if not raise an
exception and a critical error in the log), and only then mark the user
manager as successfully customized.
Implements #3804
A pyc file alone should really never happen anyhow in our plugin setup,
and they would not load under Py3 anyhow as we can't parse the
compatibility information right now.
Simply removing their support altogether as it should not have been
utilized anywhere anyhow as far as I am aware, and never was officially
documented as supported to boot.
Should be done at plugin manager level, not externally. Ignore pyc files
though as we currently can't parse their metadata (looking into that).
Fix tests while at it.
Protects against loading things from the plugin folders that aren't
actually plugins, like errant setup.py files, see for example
https://community.octoprint.org/t/26143
While the 'About OctoPrint' button opened the dialog, it creates confusing behaviour if a user clicks 'System info' first, since 'About OctoPrint' will then open the system info too.
This PR adjusts this, to force 'About OctoPrint' to open to the about page.
Using the config setting resend_ratio or the resend_ratio DEBUG command,
a percentage of lines to request a resend for can be set. Setting the
value to 0 disables the simulation.
Added to test #3672
Plugin Manager, Software Update and Backup will use that if set.
Otherwise the old default of using LocalPipCaller is used.
Not exposed via the UI as this REALLY should only be used by people who
know what they are doing and the majority of users out there will never
ever have to use it.
Implements #3700
Should hopefully make it easier in the future to collect data needed
for ticket processing. Can be accessed through System Information in the
About dialog (also directly linked from the footer and the settings),
via a new sub command `octoprint systeminfo` on the command
line and on the recovery page.
Currently included:
* octoprint version
* safe mode yes/no
* printer firmware name (if connected)
* browser user agent (if dump happens through API)
* everything reported by the environment detector (that includes data
from plugins as well that add to that, e.g. pi_support)
* connectivity check information
Might be extended more in the future.
This is not a breaking change, due to the inclusion of the v4-shims. All icons should aim to use fontawesome 5 styles, full guide on breaking changes can be found at:
https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4
I've aimed to update all icons I could find, but due to the compatibility layer if there are a couple missed, they still all work fine.
Apparently no matter how often you tell people to not put their stuff
unsecured on the public internet, they still will do that happily and
then I get the resulting fallout from the security community.
So you now will HAVE to enable access control. No more disabled ACL.
Apparently you can't trust people with this kind of responsibility.
If you want a bit more convenience, look into the trusted network
settings in config.yaml. And get a password manager. And stop port
forwarding and exposing your OctoPrint on the public internet please -
it can be found, you are not invisible, and you are putting yourself at
risk. Learn what a VPN is and to set one up on your router, that is a
valuable skill in any case.
If someone needs to check updates more often than the rate limiting with
anonymous access allows, they can now configured a personal access token
from Github via `plugins.softwareupdate.credentials.github`. This
setting is and will not be exposed via the UI.
See #3777
Seems to confuse people with incorrectly configured printer profiles,
see various forum threads and issues on the issue tracker. This will
hopefully make such cases more transparent, though a bit spammy (hence
there's also a setting).
If we want to be able to in-place overlay the effective config, we MUST
do a deepcopy of the default or we'll actually operate on the default,
effectively leading to any changes to plugin check configs to be cleaned
up from the config file.
Closes#3765Closes#3767
They are only disabled when the printer is disconnected, not when it
is printing. This behaviour can be overridden with the `enabled`
property.
Closes#3758
That will hopefully make it easier to determine whether any slow uploads
are caused by file processing (e.g. by plugins) in the backend during
saving, or by refreshing the file list from the backend after successful
upload.
As discussed here: https://community.octoprint.org/t/24644/13
The LocalFileStorage now maintains its own internal cache for all
tracked folders and will only refresh entries if the last modification
of a (sub)folder has changed.
If enabled (via Settings > Server > Debug options) this will write two
new files to the logging dir, plugintimings.log and plugintimings.csv,
which contain timing information for each and every hook or
implementation call on plugins registered with OctoPrint. This should
be helpful to debug any kind of performance issues caused by third
party plugins. It should also be a valuable tool to debug performance
issues with bundled plugins.
As requested in #1241
At some point the last modified implementation broke, and for some
reason current Firefox also appears to be even sending an
If-Modified-Since header if an ETag is present.
This fixes caching again so that if both If-Modified-Since and
If-None-Match are present, Last-Modified and ETag will be checked,
if onlye one is present only that one will be checked, and if neither
is present the cache will always be considered stale.
Possible (at least partial) solution for #1241
We need to make sure we actually try to log in a user from API key or
auth header before checking permissions. This used to be part of the
loginui plugin that was bundled in 1.4.x, but got forgotten when
implementing that in the shape of the new dedicated login dialog that
supports custom permissions to check and redirect URLs.
Closes#3747
Use to inject additional data into the regular state pushes to
PrinterCallbacks, including the push socket.
As requested in OctoPrint/plugins.octoprint.org#553
In the future this will allow us to push changes to the update endpoints
straight to people's instances without having to ask them to manually
switch over to a new version of the plugin hosted elsewhere.
Should make future maintainer changes way easier, but also accidentally
misconfigured plugins can be fixed this way and even OctoPrint core.
So far we were constantly removing and recreating a notification on each
plugin manager log event. We now only create the notification once and
then reuse/update it.
Potentially related to #3729
Plugins may now implement the hook octoprint.plugin.backup.additional_excludes
to flag entries inside their data folder (or the whole data folder
in case of .) as to be excluded from backups. The list of currently
excluded folders is supplied to the hook handler as well in order
to make such a decision conditionally.
Implements #3720
This should hopefully close#3689
The actual result of writing to the web socket is async and a future,
since `write_message` (https://github.com/tornadoweb/tornado/blob/v5.1.1/tornado/websocke.py#L848)
returns a future. The error handling inside `send_pack` however
so far assumed synchronous behaviour (same for `rawwebsocket.py`).
Thus the exception handler there will not trigger if there's an error
while writing, and thus the connection will not have `on_close` called.
This commit works around this through a `done_callback` on the future,
which should hopefully solve it. I say should because even though I did
my best in trying to simulate the error scenario, I was never able to
trigger even the "retrieved" message, let alone a whole storm of them.
We need to immediately force it into the send queue and not allow it to
get pushed into the command queue. Otherwise it will be stuck there
waiting for busy state to end instead of the emergency sending routine
triggering.
Closes#3699
If the temporary file contained characters blacklisted by
sarge.shell_quote, e.g. a ~, the shell quote would break the install
path on windows.
Considering that the path will now always be a temporary path as
generated by Tempfile, we just get rid of shell_quote altogether as it
doesn't seem to really serve any purpose now anymore.
Closes#3701
Most of the serial connection settings require a reconnect to become
effective, not just those in the protocol fine tuning. Thus moving the
corresponding alert box to apply to the whole serial settings, not just
one sub section.
Followup to #3703, related to #3696
- changed token value to use , so as to be both
more descriptive of exactly what it is used for, and also leave room for future
uses of the same token for different events (for example triggering a test workflow
on pushes or merges)
- changed repository reference to use context instead of hard coded value, to allow
workflows to work for users who fork
When Marlin pauses due the filament run out, it sends the following line:
```
//action:pause filament_runout 0
```
The current code compares the entire string with `pause`, so Marlin's action is silently ignored.
This fix compares the first word with `pause`, so it should work correctly with Marlin filament run out detection feature.
We are switching to PROPER semver and going forward will release
maintenance releases with increased minor instead of patch, and leave
patch increases to hotfixes.
If the PollingObserver is used under Py2 on a directory that contains
utf8 file names, the default listdir implementation (scandir isn't
natively available under Py2) will generate unicode instead of str. Due
to an insufficent instance check in watchdog that will lead to a
misidentification of an entry as an DirEntry object instead of a str,
and the attempt to read the name property from that will cause an
AttributeError.
We monkey patch watchdog to use our bundled scandir backport where
needed instead of trying to fix the instance check, as that will perform
better anyhow.
Closes#3676
If the PollingObserver is used under Py2 on a directory that contains
utf8 file names, the default listdir implementation (scandir isn't
natively available under Py2) will generate unicode instead of str. Due
to an insufficent instance check in watchdog that will lead to a
misidentification of an entry as an DirEntry object instead of a str,
and the attempt to read the name property from that will cause an
AttributeError.
We monkey patch watchdog to use our bundled scandir backport where
needed instead of trying to fix the instance check, as that will perform
better anyhow.
Closes#3676
Apparently some machines out there are a bit flaky after boot and it can
take a bit for connectivity to work. As suggested by @fieldOfView in
https://community.octoprint.org/t//177/9
we thus check connectivity three times in a row if negative before
reporting it as negative.
If the comm layer starts sending state changes (e.g. to auto detect)
before the constructor returns, self._comm in the printer interface is
still None and thus states can't be decoded.
Probably part of #3653
We don't want to try to send our beforeDisconnect script if we aren't
properly connected, as that will severely delay Disconnect execution, so
we now limit that to operational states and thus allow a quick(er)
connection abort during auto detection or connection attempt.
Instead hold them back until the next slot.
Otherwise we might never get the final switch to Offline as after that
there are no current data upgrades anymore.
Otherwise we might spam our send queue leading to a bunch of lines
piling up inside it, making cancelling/pausing take longer and longer.
Potential fix for #3649
That way we can display a login dialog if we require a specific set of
permissions, which then also gets displayed if the user is logged in but
lacks them.
If the user is already logged in and has the requested permissions, an
immediate redirect to the redirect URI is triggered.
At /recovery/ there's now a (for now basic) recovery dialog that
currently allows the core functionality from the system command menu, so
shutting down and rebooting the system, restarting OctoPrint and
restarting OctoPrint in safe mode. The most important part here is the
ability to restart in safe mode, as that will allow to get OctoPrint
back into working order if an errant third party plugin or language
pack has made the standard UI non functional.
For that reason, no third party plugins are enabled or utilized on the
recovery dialog, even the theming hook is aggressively error resilient.
In order to still allow to authenticate the user (no one but ADMIN
should be allowed to use the recovery UI) the loginui plugin has been
merged into core as its own endpoint /login/ which coreui and recovery
can redirect to. This is a welcome change considering that the loginui
was absolutely necessary anyhow, and it being a plugin was merely a side
effect of backporting from forcelogin. This has now been cleaned up.
Hopefully the hardware out there should be up to it by now and combined
with the in-browser video reviews it would be a pity to still default
to mpeg2.
Static assets where being sent with session cookies. That doesn't make
sense and might actually cause issues if an asset takes *just* long
enough to load to be overtaken by a login request from something like
the loginui.
Found with the E2E tests, which turned out to be less flaky themselves
than thought 🥳
We now wait for full app initialization (OctoPrint.coreui.startedUp &
OctoPrint.loginui.startedUp) before trying to test against things.
At least in local test runs that solved the flakiness.
As to my knowledge no firmware currently implements M20 with long file
names like this:
Begin file list
UGLYNA~1.GCO 2342 Uglyname with some_longer-name.gcode
End file list
However, as proposed by myself back in 2016 that would make the most
sense (contrary to M33, which requires n+1 requests to get all metadata
from the printer), so OctoPrint now supports it and firmwares are
welcome to implement it accordingly to finally implement a *usable* way
to retrieve long filenames that doesn't saturate the serial connection
for an undeterminable amount of time just to retrieve a list of file
names.
Compare MarlinFirmware/Marlin#4733.
Also add parsing of the (not really parser friendly) output of M33.
Note that OctoPrint will not send M33 on its own even though it now
supports parsing its response. There's no capability flag for this as
far as documented, and there appears to exist a GCODE clash according
to https://reprap.org/wiki/G-code, so just blindly sending M33 to the
printer from core might cause severe issues.
Users may instead add active querying for the long name (if not included
in the M20 response) through a plugin, as demonstrated in
https://gist.github.com/foosel/cadc38123687a46816a1d3e1d160d48aCloses#1600
It might cause SyntaxErrors in third party plugins that cannot be
caught by the system and which then nuke ALL other third party plugins.
See Sebclem/OctoPrint-SimpleEmergencyStop#14 and
FormerLurker/Octolapse#567
This change can manually be applied by setting
``` yaml
devel:
webassets:
minify: false
```
in config.yaml
We don't want to try to send our beforeDisconnect script if we aren't
properly connected, as that will severely delay Disconnect execution, so
we now limit that to operational states and thus allow a quick(er)
connection abort during auto detection or connection attempt.
Instead hold them back until the next slot.
Otherwise we might never get the final switch to Offline as after that
there are no current data upgrades anymore.
filetype dependency requires paths as str, so we need to make sure
we provide what will be identified as a native str type under both
py2 and 3.
Closes#3630
Add "setTargetFromProfile" and "setTargetToZero" wrapper for setting entire profiles
Add helper function to retrieve the temperature profiles description
Just because we run with `--debug` doesn't mean we also have installed
the development dependencies. So in case we can't import `pyinstrument`
we should handle that gracefully even if `perfprofile` is requested.
We actually also support moving folders, so why not reflect that in the
UI. And instead of introducing a new permission, we should stick to
what a move actually is - a (re)upload and a delete, so if both of these
permissions are granted, moving is allowed as well. Also make sure to
disable the move action for anything not on local storage, also
visually. Finally, make current (source) folder visible and use it to
preselect entry from folder list, which should also be calculated from
the existing data instead of requiring another file list fetch.
We now also include publication date, last push date, release & release
date and github stars in the UI (if available), allow sorting by all
that and also visually highlight abandoned/disabled/incompatible
plugins. Also there's a now a filter to hide abandoned plugins and an
indicator of how many plugins of all available ones are being shown with
the currently active filters and search.
Implements #3606
We now need to have at least 150MB (configurable) of free disk space on
all of site-packages, plugins and temp folder locations available in
order to enable updates.
Closes#2312
That somehow got forgotten. Wasn't needed since bundled always get
loaded, however now that we display that kind of information in the
plugin manager it should reflect reality.
Now they no longer are separate processes but one merged one.
Port detection now will only test the two most common baudrates plus
any additionally configured ones if there is more than one port to test,
that way the additional overhead of having to cycle through both port
and baudrate should be greatly reduced.
As a consequence all avr_isp references have been finally removed.
Closes#3394
Current Jinja versions no longer allow modifying variables set outside
of for loops inside them. So something like:
{% set mark_active = True %}
{% for item in items %}
# do something
{% if mark_active %}
# do something more
{% set mark_active = False %}
{% endif %}
{% endfor %}
no longer works - mark_active will be reset on every iteration of the
loop to its initial value False. The fix is to use namespaces to
hold the modifiable values instead:
{% set ns = namespace(mark_active = True) %}
{% for item in items %}
# do something
{% if ns.mark_active %}
# do something more
{% set ns.mark_active = False %}
{% endif %}
{% endfor %}
See also #1697 and
https://jinja.palletsprojects.com/en/2.11.x/templates/#assignments
The Jinja dependency upgrade thus introduces a breaking change for
plugins as well. However, it was necessary for security reasons: older
versions have a bug that could allow template authors to break out of
the template sandbox. Not a huge risk in the context of OctoPrint
(plugins already have a lot more power than jinja would give them),
but still overdue to fix.
This reverts commit 73fbd15b
The change causes a full rescan for renaming on the uploads folder.
Unintended, needs to be looked at closer at a later date.
We didn't change any code between the last working build and the current
state since this is the master branch, so stop complaining. We'll
fix this in maintenance/1.4.1 in one way or the other.
Anything that's been closed for over a year definitely is outdated.
We really don't want people to play necromancer on ancient tickets,
it just causes support overhead (having to explain that code has
changed a ton since then and issue is likely a different one) or
user frustration (no reply).
If we can't load stuff from the backend, don't get stuck in "pip not
available" mode (which confuses people terribly) but instead show a
dedicated error.
We can't query the setting from the firmware, and we also can't reliably
track it through OctoPrint as it could be modified through GCODE
triggered through a file on the SD card and/or interactions with the
controller. Hence we now properly reflect that this value is write only
by emptying it 5s after focus loss (with a little opacity pulse to warn
about that) and immediately on sending.
That should hopefully make it a bit clearer that this value cannot be
trusted and will never reflect the firmware value unless query commands
or status reports are added for that in firmware.
Closes#3569 (though in a different way than intended by OP)
It's causing issues on rollback (integer can't be accessed like a dict).
We don't actually need it at the moment, so remove it for now and
instead add some sanity checking to the file reader.
User group is no longer enforced on all users. It is pre-checked
for new users (unless made non default) but can be disabled. That
makes it possible to have users without groups (and thus no
permissions) so beware!
TODO: Issue with default=False being written to groups.yaml,
causing the users group to not be enabled by default. Will be
solved in another commit.
Closes#3547
Use tornado.gen.coroutine as tornado.web.asynchronous is now deprecated
tornado.ioloop.PeriodicCallback no longer supports the io_loop argument.
tornado.httputil.HTTPServerRequest.supports_http_1_1 is now depricated use tornado.httputil.HTTPServerRequest.version attribute instead
We might not get the full set of data we want from the add_file
call and thus need to enrich the data further with our own
analysis results.
Whatever we get supplied from the caller will always win.
* Run with silent=false to catch issues in templates, such as missing
extensions
* Add missing extensions to fix compile errors
* Fix formatting (can't apply settings to multiple headers, need to
reapply, ini format!)
To profile a given request, just add ?perfprofile to the url. Instead of
returning the actual results, an HTML presentation of the profiling
results is returned.
This is only enabled when debug mode is enabled.
Should work around rare cases where the firmware reports invalid
tools that aren't invalid. Should usually not be needed, but there
are enough people with broken configs out there that this might
actually help people to stay running, as meh as it is.
Fixes errors from Click about ASCII encoding:
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment
This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the follow
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
Should hopefully unearth cases where the system has a connection to the
internet but name resolution is broken in some way.
We default to resolving octoprint.org.
It was not comparing scheme (which it should), it was doing the hostname
check case sensitively (which it shouldn't) and it didn't take into
account default ports.
Should close#3519
Provides one part of the solution to #3482. The other part is sadly
on the shoulders of the user, who needs to setup either a whole domain
hierarchy to not run into "third party page" issues that would trigger
SameSite=Lax blocking, or needs to reconfigure their setup to use
https and make sure to set Secure to true.
Closes#3482 (there's nothing else I can do here)
Copied the description about errors-argument from Pyh-Doc (https://docs.python.org/3/howto/unicode.html).
Im not sure how to create the HTML-Doc out of this file. So, I could not test the doc-output.
Otherwise the page won't load at all because the js/css/less files are
taken from the gz versions which are empty.
Introduced by #3497
TODO: Fix gzip encoding under Python 2 (gzip.compress doesn't exist)
Order definition might contain either the plugin identifier or the
identifier of the component it replaces. Take that into account when
resolving order mapping.
Closes#3403
Gets rid of sliders as well (since those don't work without an upper
limit) and adds a note to both that they are "write-only" as we don't
have a way to query the current values from the firmware (yay...).
Modifies #3503
Also fixes a bug in #3503, which only adjusted the client side
boundaries but forgot about the server side.
* url_for in preload instead of (potentially wrong due to prefixes)
absolute URLs to /static/...
* error resilience in case of any issues during .gz generation
* bug fix in mime type detection
* code formatting & naming here and there
Used to default to 5s, now set by default to 10s, can be completely
disabled by settings devel.sockJsConnectTimeout to 0.
Might be a possible solution for #3502.
Memoize `settings.config_hash` and `settings.effective_hash`. The
hashes will only be calculated on the first call to the respective
functions. These memoized values are invalidated when the settings
object becomes dirty, or the settings are loaded from the config file.
Reason for change: During a refresh of the root route (/), the hash of
`settings.effective.yaml` is calculated 5 times. Each call lead to a
large configuration object to be serialized to a YAML string, which would
then be hashed. As it turns out, serializing to YAML is expensive.
Note: while I do not see `settings.config_hash` hit during a refresh,
but making a change to it was easy and appropriate. It's possible that
other areas of the application may see some benefit.
Performance (on my 2016 Macbook Pro:
- building of initial cache on startup:
- before: ~3.4s
- after: ~2.9s
- loading `http://octoprint/?_refresh=1`
- before: ~1100ms
- after: ~200ms
- Only compute etag once (rather than twice) per request.
- Only stat files once per request.
- Avoid calling `isdir` or `isfile` in `collect_files`.
- Leave it to `compute_lastmodified` to stat files, which tells us if
the path exists, if it is a file, and it's last modified.
- Reduces the number of stat systemcalls by 50%.
Some firmware variants (Ultimaker 2/2+, maybe others) send a file
selected message while just scrolling through the SD file list on the
integrated controller unit. M27 polling right after file selection might
cause issues for them. This patch allows to work around that.
Closes#3479
See also #1407
It's 2020, and that version was from 2013. Lots of stuff changes in that
time.
Also, get rid of some tests that are now universally supported, as well
as tests that are enabled and never used
This also signficantly improves performance, since the new version is
much simpler.
This compresses the static assets with gzip on server startup, and then
serves them up compressed to clients.
The compression is done at server startup because some boards have very
anemic CPUs and slow "disks", so loading from disk pre-compressed and
avoiding CPU usage is a big win.
Renamed to firmware check, published to PyPI, on a different release
cycle and version number scheme than core OctoPrint but still considered
bundled via a new mechanism to mark external plugins as such.
This will speed up deployment of new firmware checks in case of new
printers with disabled thermal runaway protection, or stuff like the CBD
firmware.
For some reason people just don't seem to see the big fat blue "Print"
button on their loaded print job and then get confused when they can't
reprint the same file that's already loaded. So let's work around this.
If the socket is already logged out it will be an AnonymousUser
and thus not a SessionUser.
We shouldn't actually be pushing this without a round over an RC but
frankly I don't want to postpone the release for two weeks (as next week
is kinda busy) just to solve this obvious issue with zero side effects.
So here I am doing things I shouldn't.
is_blueprint_protected should mean a requirement of a logged in non
anonymous user. Implemented accordingly. Got forgotten during switch to
granular permission system.
Otherwise alternative UIs might still be wide open, and caching and such
was also really painful to solve before.
The LoginUI Plugin is pretty much just a distilled ForceLogin plugin.
Also declared it as hidden so it won't show up/be manageable by the
plugin manager.
It was not reported if firmware detection was disabled, even though one
should not have anything to do with the other.
Not a regression, but considering that it negatively impacts the printer
safety plugin that relies on firmware info it'll go into 1.4.0
regardless.
Was present in forcelogin and made sure that plugins triggering a
message on the socket immediately after connect would get through right
after auth.
Without this a lot of plugins out there run into issues, so this is a
backwards compatibility fix for a regression in 1.4.x.
See also #3400
We need to actually try to identify the user just like we used to do
with the forcelogin plugin. Just checking permissions will only work
if we already have a session.
Closes#3434
E.g. in Firefox reopen tab while server is down - FF will use a cached
copy and for some reason sockjs won't notice that stuff is down. So now
we have a timeout of 5s for initial connection that takes care of that.
May act as entry point for any kind of push messages a plugin might
wish to send to the client after a connect happened. Since depending
on the current permission configuration this might only be possible
once the client has authenticated on the socket, this is required.
Should close#3400
Needed its own permission, which in turn needed some changes in how the
whole "guest without read permission" situation is handled. I've
reintroduced a custom login view since the main UI would not be able
to fully load up without settings access. Said login view will override
the default UI view if the account in question does not have
Permissions.STATUS and also Permissions.SETTINGS_READ. It pretty much is
the forcelogin plugin from 1.3.x.
Closes#3425
We should only clear out the identity when the session has actually
been deemed deleted, not just on staleness due to e.g. a client IP
change.
Closes#3370
Remove code that would lead to a refresh upon receiving a
'Cache-Control: no-cache' or 'Pragma: no-cache' in a request. The
purpose of these headers is to invalidate intermdiate proxy caches, not
that of an application server. A refresh in octoprint would lead to
several seconds of high CPU utilization on lower-power systems (like the
Raspberry Pi), leading to stuttering in print jobs.
It is still possible to explicitly cause a refresh by including
`_refresh` in the query parameters of a request.
We already have Github's releases with all the changes, we don't need to
keep everything twice.
Instead of the changelog included in the about dialog there's now a link
to the release list, that should suffice.
Implements #3342
Additional "clean up all leftovers" feature to clean up anything left
over by plugins already uninstalled.
Also takes care of entries in the disabled plugin list now.
See also #3299
Plugin data can now be cleaned up
* on a plugin's uninstall through the plugin manager
* manually through a new action button in the plugin manager
Implements #3299
Ideas for further improvement:
* Management interface to show "orphaned" plugin data and delete
on request.
Will allow people to circumvent the
shoot-yourself-in-the-foot-countermeasures by editing config.yaml.
If they do that and stuff then fails due to platform instability it's
their problem.
Should fix#3301, or at least make it way less likely to happen.
The problem seems to have been made worse by `M25` not being blocking
on Klipper and thus the SD printing not being guaranteed to have stopped
yet after its return, meaning the following `M26 S0` will be denied,
causing the file position to not be properly reset and hence the issue
to arise in the first place.
On the push socket only available for admin users.
ClientOpened now also get the remoteAddress stripped from the payload
for guests on the push socket.
Implements #783
No, this doesn't mean that you can start timelapses manually or
anything, only that you do not need to be connected to a printer in
order to change the default timelapse configuration.
The previously suggested `service` folder is not available in a canonical
systemd installation. Instead new services should be placed in
`/etc/systemd/system/`
sorted does no longer support sorting None values under Python 3. This
patch introduces a utility function that ensures that None values are
replaced by a configurable default value ("" by default) and utilizes
it in places where sorted gets called with a custom sorting key that
can potentially consist of None values.
Closes#3300
* Set X-Content-Type-Options to nosniff
* Set X-Frame-Options to sameorigin (if not configured otherwise)
* SockJS iframe fallback no longer embeds sockjs library from a CDN
* SockJS no longer rewrites the unused JSESSIONID cookie
This is the last version that supports stock OctoPi 0.14, catering
towards the ancient setuptools and pip versions found on it becomes
more and more unjustifiable overhead.
We don't want to get swamped by third party plugin error messages on
sentry as that costs money.
Blacklist astroprint messages since they caused issues in the past.
Making the plugin hook work would be a ton of overhead due to the
components dictionary that needs to be supplied to it for user manager
initialization, however at the very least we should support
configuration of the used user manager class.
Both features are rarely used if at all, but we should be aware of this.
Also changed some wording, fixed to unicode and removed redundancy from
the sub commands (e.g. just "add" instead of "add_user") and flags.
Revalidation header from ceade46dd7 was
overwriting custom header in case of active wizards, causing the browser
to cache HTML code with enabled wizards.
This fixes this by checking if the headers in question actually need to
be set and aren't already there.
If the printer keeps requesting the same line over and over again,
something is either seriously wrong with the line or with the connection
In any case, log an error and disconnect.
Fixed plugin install message for UI (never worked!)
Fixed grammar in connectivity initial setup
Added space at end of lines for several multiline messages
Added confirmation dialog before disabling plugin
Added configuration options to control the confirmation dialogs
Defaults are not to confirm for disabling but confirm for uninstalling
Originally introduced by PR #673 to fix reconnect issues on pyserial,
OctoPrint will first open the serial port with PARITY_ODD then close it
again and reopen with the desired PARITY_NONE. This works around issues
likely sitting somewhere in the linux tty layer, at least on some
distributions, that don't necessarily exist on other platforms.
Stop doing the workaround on FreeBSD to start with, as this is the only
platform I can effectively test. I suspect MacOS/Windows likely also don't
need to do this.
description:Help improve OctoPrint by reporting observed bugs. Got a question or need support? See "Have questions or need support?" instead!
body:
- type:markdown
attributes:
value:>
### ✋ **This is bug tracker, not a support forum**
If something isn't working right, you have questions or need help, [**get in touch on the forums**](https://community.octoprint.org/c/support/).
Only proceed here if you are 100% sure the issue you are seeing is actually a bug in OctoPrint that *also happens in safe mode*. If in doubt, check
in on the forums first, we can always file a bug from a support request later.
---
**Thankyou for wanting to report a bug in OctoPrint!**
If this is the first time you are doing this, please take a few moments to read
through the [Contribution Guidelines](https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md).
Also check out [the FAQ](https://faq.octoprint.org) if your
problem is maybe already covered there.
You are about to report a bug in **OctoPrint**. Do not proceed if your issues
occurs with OctoPi, any third party OctoPrint plugins, unofficial or outdated
OctoPrint versions. If you are unsure of the difference between OctoPrint and
OctoPi, [read this FAQ entry](https://faq.octoprint.org/octoprint-vs-octopi).
And finally, make sure any bug you want to report is still present with the **current**
OctoPrint version and that it does not vanish when you start OctoPrint
in [safe mode](https://docs.octoprint.org/en/master/features/safemode.html) either.
Thank you for your collaboration!
- type:textarea
attributes:
label:The problem
description:>-
Describe the issue you are experiencing here. Tell us what you were trying to do
step by step, and what happened that you did not expect.
Provide a clear and concise description of what the problem is and include as many
details as possible.
placeholder:|
1. ...
2. ...
3. ...
validations:
required:true
- type:dropdown
attributes:
label:Did the issue persist even in safe mode?
description:>-
Testing in safe mode is required to make sure the issue you are reporting is not
caused by a third party plugin. Please see [here](https://docs.octoprint.org/en/master/features/safemode.html)
on how to run OctoPrint in safe mode.
options:
- Yes,it did persist
- No,it did not persist (it's an issue with one of your installed plugins, don't report here)
- I cannot test this issue in safe mode (state why below)
validations:
required:true
- type:input
attributes:
label:If you could not test in safe mode, please state why
description:>-
Issues caused by a third party plugin are a major cause of bugs reported here, so we really need to
rule out that a plugin is at fault here. [Safe mode](https://docs.octoprint.org/en/master/features/safemode.html) is an easy way to do that. Only skip safe mode
if your particular problem *absolutely requires* third party plugins to be enabled. "It would take
too long" is **not** a reason to skip testing in safe mode, neither is "I do not know how to
enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html).
If you really *cannot* test in safe mode, leave a short explanation as to why.
- type:markdown
attributes:
value:|
## Environment
- type:input
attributes:
label:Version of OctoPrint
description:Can be found in the lower left corner of the web interface.
validations:
required:true
- type:input
attributes:
label:Operating system running OctoPrint
description:>-
OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's
version can be found in `/etc/octopi_version` or in the lower left corner of the
web interface.
validations:
required:true
- type:input
attributes:
label:Printer model & used firmware incl. version
description:If applicable, always include if unsure
- type:input
attributes:
label:Browser and version of browser, operating system running browser
description:If applicable, always include if unsure
- type:markdown
attributes:
value:|
## Logs and other files needed for analysis
- type:markdown
attributes:
value:>-
Please also be sure to upload the following files below:
* Systeminfo Bundle: See [here](https://community.octoprint.org/t/what-is-a-systeminfo-bundle-and-how-can-i-obtain-one/29887) if you don't know where to find that. Just attach down below as-is. Note that you'll need at least OctoPrint 1.6.0 for this to be available - we no longer accept bug reports created for older versions than this.
* If you are reporting an issue that involves communicating with you printer, **be sure to enable `serial.log` before reproducing and creating the Systeminfo Bundle**!
* Your browser's JavaScript console, if you are reporting a problem with the
user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that.
* If possible, screenshots or videos showing the problem, especially if you
are reporting a problem with the user interface!
* GCODE files with which to reproduce, if you are reporting an issue with
GCODE file analysis or printing behaviour.
Please be aware that unless at least Systeminfo Bundle is included, your bug report
will not be processed and closed after a while.
- type:checkboxes
attributes:
label:Checklist of files to include below
options:
- label:Systeminfo Bundle (always include!)
required:true
- label:Contents of the JavaScript browser console (always include in cases of issues with the user interface)
- label:Screenshots and/or videos showing the problem (always include in case of issues with the user interface)
- label:GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour)
description:Request a new feature to implement in OctoPrint
title:"[Request]"
body:
- type:markdown
attributes:
value:>
**Thank you for wanting to request a feature in OctoPrint!**
Before you go ahead with your request, please first consider if it wouldn't be
better suited for a plugin. As a general rule of thumb, any feature that is only
of interest to a small sub group should be moved into a plugin. Only such features
that are of interest to a majority of OctoPrint's users will be implemented as
part of the core itself.
- type:textarea
attributes:
label:Is your feature request related to a problem? Please describe.
description:A clear and concise description of what the problem is. Eg, "I'm always frustrated when [...]".
- type:textarea
attributes:
label:Describe the solution you'd like
description:A clear and concise description of what you want to happen. Explain why it needs to be included in OctoPrint's core and can't become a plugin.
validations:
required:true
- type:textarea
attributes:
label:Describe alternatives you've considered
description:A clear and concise description of any alternative solutions or features you've considered.
- type:textarea
attributes:
label:Additional context
description:Add any other context or screenshots about the feature request here.
args:"☑️ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ steps.latest.outputs.release }}` was successful"
- name:📧 Discord failure notification
if:failure()
env:
DISCORD_WEBHOOK:${{ secrets.discord_webhook }}
uses:Ilshidur/action-discord@master
with:
args:"🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ steps.latest.outputs.release }}` failed"
**This is not the bug tracker of OctoPi**, which is the preconfigured
Raspberry Pi image including OctoPrint among other things - that one can be found
[here](https://github.com/guysoft/OctoPi). If you have any kind of specific
@@ -97,7 +97,7 @@ following section *completely* and also follow the instructions in the
**safe mode**, either by selecting "Restart OctoPrint in safe mode" from
the "System" menu, or by starting OctoPrint from the command line with
`octoprint serve --safe`. Then try to reproduce your issue. Find out
more about safe mode in the [docs](http://docs.octoprint.org/en/master/features/safemode.html).
more about safe mode in the [docs](https://docs.octoprint.org/en/master/features/safemode.html).
You might also want to try the current development version of OctoPrint
(if you aren't already). Refer to the [FAQ](https://faq.octoprint.org)
@@ -118,24 +118,24 @@ following section *completely* and also follow the instructions in the
it is the same as your's, it actually behaves the same as your's. E.g. if someone gives steps
to reproduce his bug that looks like your's, reproduce the bug like that if possible,
and only add a "me too" if you actually can reproduce the same
issue. Also **provide all information** as [described below](#what-should-i-include-in-a-bug-report)
issue. Also **provide all information like Systeminfo Bundle, additional logs & versions, different reproduction steps**
and whatever was additionally requested over the course of the ticket
even if you "only" add to an existing ticket. The more information available regarding a bug, the higher
the chances of reproducing and solving it. But "me too" on an actually unrelated ticket
makes it more difficult due to on top of having to figure out the original problem
there's now also a [red herring](https://en.wikipedia.org/wiki/Red_herring) interfering - so please be
very diligent here!
If in doubt about any of the above - get in touch on the [community forum](https://community.octoprint.org)
instead of opening a ticket here. If you are actually running into a bug, we'll figure it out together
If in doubt about any of the above - get in touch on the [community forums](https://community.octoprint.org)
instead of opening a ticket here. If you are actually running into a bug, we'll figure it out together
there.
### What should I include in a bug report?
First of all make sure your use **a descriptive title**. "It doesn't work"
and similar unspecific complaints are NOT descriptive titles.
**Always use the following template, even if only adding a "me too" to an
**Always use the following template, even if only adding a "me too" to an
existing ticket**:
```
@@ -152,7 +152,7 @@ or request features within OctoPrint (not OctoPi, not any OctoPrint
plugins and not unofficial OctoPrint versions).
Do not seek support here ("I need help with ...", "I have a
question ..."), that belongs on the community forum at
question ..."), that belongs on the community forum at
community.octoprint.org, NOT here.
Mark requests with a "[Request]" prefix in the title please. For bug
@@ -172,7 +172,7 @@ Thank you!
#### What were you doing?
<!--
<!--
Please be as specific as possible here. The maintainers will need to
reproduce your issue in order to fix it and that is not possible if they
don't know what you did to get it to happen in the first place.
@@ -180,9 +180,10 @@ don't know what you did to get it to happen in the first place.
Ideally provide exact steps to follow in order to reproduce your problem:
-->
1. ...
2. ...
3. ...
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
<!--
If you encountered a problem with specific files of any sorts, make sure
@@ -195,7 +196,7 @@ to also include a link to a file with which to reproduce the problem.
#### Did the same happen when running OctoPrint in safe mode?
<!--
<!--
Test if you can reproduce your problem in safe mode. You can find information
on how to enable safe mode in the Contribution Guidelines.
@@ -211,14 +212,6 @@ If you can't test this in safe mode, state why.
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
-->
#### Operating System running OctoPrint
<!--
OctoPi, Linux, Windows, MacOS, something else? With version please.
OctoPi's version can be found in /etc/octopi_version or in the lower left
corner of the web interface.
-->
#### Printer model & used firmware incl. version
<!--
@@ -231,31 +224,19 @@ If applicable, always include if unsure.
If applicable, always include if unsure.
-->
#### Link to octoprint.log
#### System Info Bundle
<!--
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
Directly uploaded here. ALWAYS INCLUDE.
The Contribution Guidelines tell you where to find that.
-->
#### Link to contents of terminal tab or serial.log
<!--
On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting communication issues. Never truncate.
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log (which the Contribution Guidelines tell you where to find).
-->
#### Link to contents of Javascript console in the browser
<!--
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.
Directly uploaded here or on gist.github.com or pastebin.com.
If applicable - always include if unsure or reporting UI issues.
The Contribution Guidelines tell you where to find that.
-->
@@ -269,9 +250,12 @@ If applicable. Always include if unsure or reporting UI issues.
I have read the FAQ.
```
Copy-paste this template **completely** (or use the version that gets pre-filled
into the "new issue" form). Do not skip any lines or the bot *will* complain! Provide
all requested information or your ticket will be closed.
Provide the same kind and amount of information also when you are just adding on to an
existing ticket!
### Where can I find the System Info Bundle?
Please refer to [this FAQ entry](https://community.octoprint.org/t/what-is-a-systeminfo-bundle-and-how-can-i-obtain-one/29887).
### Where can I find which version and branch I'm on?
@@ -287,9 +271,10 @@ See [How to open the Javascript Console in different browsers](https://webmaster
## Setting up a development environment
See [the corresponding chapter in the documentation](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment).
This also includes information on how to run the test suite and how to build
the documentation.
See [the corresponding chapter in the documentation](https://docs.octoprint.org/en/master/development/environment.html).
This also includes information on how to run the test suite and how to build
the documentation, the bundled virtual printer plugin and OctoPrint's versioning
and branching strategy.
## Pull requests
@@ -297,11 +282,12 @@ the documentation.
consider if it wouldn't be better suited for a plugin.** As a general rule
of thumb, any feature that is only of interest to a small sub group should
be moved into a plugin. If the current plugin system doesn't allow you to
implement your feature as a plugin, create a "Brainstorming" ticket to get
implement your feature as a plugin, please get in touch on the
[forums](https://community.octoprint.org/c/development) to get
the discussion going on how best to solve *this* in OctoPrint's plugin
system - maybe that's the actual PR you have been waiting for to contribute :)
2. If you plan to make **any large or otherwise disruptive changes to the
code or appearance, please get in touch on the
code or appearance, please get in touch on the
[forums](https://community.octoprint.org/c/development)** first so
that we can determine if it's a good time for your specific pull
request. It might be that we're currently in the process of making
@@ -310,19 +296,20 @@ the documentation.
just cause unnecessary work and frustration for everyone or
possibly get the PR rejected.
3. Create your pull request **from a custom branch** on your end (e.g.
`dev/myNewFeature`)[1].
`improve/myNewFeature`)[1].
4. Create your pull request **only against the `maintenance` or `devel` branch**:
* if it's a bug fix for a bug in the current stable version, an improvement of existing functionality or a
*small* new feature (e.g. a new hook, a new config flag, ...): `maintenance` branch
*otherwise: `devel` branch
* if it's a bug fix for a bug in the current stable version, an improvement of existing functionality or a
*small* backwards compatible new feature (e.g. a new hook, a new config flag, ...): `maintenance` branch
*if it's a bigger backwards compatible new feature: please [get in touch](https://community.octoprint.org/c/development) first to avoid
wasting work that doesn't match the current direction of the project or implement as a plugin.
* if it's any breaking backwards incompatible change: `devel` branch. In case of big changes, [get in touch](https://community.octoprint.org/c/development) first.
5. Create **one pull request per feature/bug fix**.
6. Make sure there are **only relevant changes** included in your PR. No
changes to unrelated files, no additional files that don't belong (e.g.
commits of your full virtual environment). Make sure your PR consists
**ideally of only one commit** (use git's rebase and squash functionality).
7. Make sure you **follow the current coding style**. This means:
*Tabs instead of spaces in the Python files[2]
* Spaces instead of tabs in the JavaScript sources
*Spaces for indenting and alignment, indentation width 4.
* English language (code, variables, comments, ...)
* Comments where necessary: Tell *why* the code does something like it does
it, structure your code
@@ -333,29 +320,41 @@ the documentation.
from experiments).
8. Ensure your changes **pass the existing unit tests**. PRs that break
those cannot be accepted. You can run the unit tests locally (after
[initial development environment setup with "develop" dependencies](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment))
[initial development environment setup with "develop" dependencies](https://docs.octoprint.org/en/master/development/environment.html))
by running
```
nosetests --with-doctest
pytest
```
in the OctoPrint checkout folder. A [travis build](https://travis-ci.org/foosel/OctoPrint)
is also setup so that if the tests should fail, your PR will be marked
in the OctoPrint checkout folder. An [automatic build workflow](https://github.com/OctoPrint/OctoPrint/actions?query=workflow%3ABuild)
is also setup so that if the tests should fail, your PR will be marked
accordingly.
9. **Test your changes thoroughly**. That also means testing with usage
scenarios you don't normally use, e.g. if you only use access control, test
without and vice versa. If you only test with your printer, test with the
virtual printer and vice versa. State in your pull request how you tested
your changes. Ideally **add unit tests** - OctoPrint severely lacks in that
department, but we are trying to change that, so any new code already covered
with a test suite helps a lot!
10. In your pull request's description, **state what your pull request does**,
9. Run the **pre-commit check suite** against your changes. You can run that (after
[initial development environment setup with "develop" dependencies](https://docs.octoprint.org/en/master/development/environment.html))
by running
```
pre-commit run --hook-stage manual --all-files
```
in the OctoPrint checkout folder. If you install the pre-commit hooks via
`pre-commit install` (which you really should!) this will even be taken care of for you prior to committing.
An [automatic build workflow](https://github.com/OctoPrint/OctoPrint/actions?query=workflow%3ABuild)
is in place that will run these checks - if they fail your PR will be marked accordingly.
10. **Test your changes thoroughly**. That also means testing with usage
scenarios you don't normally use. If you only test with your printer, test with the
virtual printer and vice versa. State in your pull request how you tested
your changes. Ideally **add unit tests** - OctoPrint severely lacks in that
department, but we are trying to change that, so any new code already covered
with a test suite helps a lot!
11. In your pull request's description, **state what your pull request does**,
as in, what feature does it implement, what bug does it fix. The more
thoroughly you explain your intent behind the PR here, the higher the
chances it will get merged fast. There is a template provided below
that can help you here.
11. Don't forget to **add yourself to the [AUTHORS](./AUTHORS.md)
12. Don't forget to **add yourself to the [AUTHORS](./AUTHORS.md)
file** :)
Template to use for Pull Request descriptions:
@@ -374,81 +373,13 @@ Template to use for Pull Request descriptions:
#### Further notes
```
## How is OctoPrint versioned?
See [the corresponding chapter in the documentation](https://docs.octoprint.org/en/master/development/versioning.html).
## What do the branches mean?
There are three main branches in OctoPrint:
* `master`: The master branch always contains the current stable release. It
is *only* updated on new releases. Will have a version number following
the scheme `<x>.<y>.<z>` (e.g. `1.2.9`) or - if it's absolutely necessary to
add a commit after release to this branch - `<x>.<y>.<z>.post<commits since x.y.z>`
(e.g. `1.2.9.post1`).
* `maintenance`: Improvements and fixes of the current release that make up
the next release go here. More or less continuously updated. You can consider
this a preview of the next release version. It should be very stable at all
times. Anything you spot in here helps tremendously with getting a rock solid
next stable release, so if you want to help out development, running the
`maintenance` branch and reporting back anything you find is a very good way
to do that. Will usually have a version number following the scheme
`<x>.<y>.<z+1>.dev<commits since increase of z>` for an OctoPrint version of `<x>.<y>.<z>`
(e.g. `1.2.10.dev12`).
* `devel`: Ongoing development of new features that will go into the next bigger
release (MINOR version number increases) will happen on this branch. Usually
kept stable, sometimes stuff can break though or lose backwards compatibility
temporarily. Can be considered the "bleeding edge". All PRs should target
*this* branch. Important improvements and fixes from PRs here are backported to
`maintenance` as needed. Will usually have a version number following the
scheme `<x>.<y+1>.0.dev<commits since increase of y>` for a current OctoPrint version
of `<x>.<y>.<z>` (e.g. `1.3.0.dev123`).
* `rc/maintenance`: This branch is reserved for future releases that have graduated from
the `maintenance` branch and are now being pushed on the "Maintenance"
pre release channel for further testing. Version number follows the scheme
`<x>.<y>.<z>rc<n>` (e.g. `1.2.9rc1`).
* `staging/maintenance`: Any preparation for potential follow-up RCs takes place here.
Version number follows the scheme `<x>.<y>.<z>rc<n+1>.dev<commits since increase of n>` (e.g.
`1.2.9rc1.dev3`) for a current Maintenance RC of `<x>.<y>.<z>rc<n>`.
* `rc/devel`: This branch is reserved for future releases that have graduated from
the `devel` branch and are now being pushed on the "Devel" pre release channel
for further testing. Version number follows the scheme `<x>.<y+1>.0rc<n>` (e.g. `1.3.0rc1`)
for a current stable OctoPrint version of `<x>.<y>.<z>`.
* `staging/devel`: Any preparation for potential follow-up Devel RCs takes place
here. Version number follows the scheme `<x>.<y>.0rc<n+1>.dev<commits since increase of n>` (e.g.
`1.3.0rc1.dev12`) for a current Devel RC of `<x>.<y>.0rc<n>`.
Additionally, from time to time you might see other branches pop up in the repository.
Those usually have one of the following prefixes:
* `fix/...`: Fixes under development that are to be merged into the `maintenance`
and `devel` branches.
* `improve/...`: Improvements under development that are to be merged into the
`maintenance` and `devel` branches.
* `dev/...` or `feature/...`: New functionality under development that is to be merged
into the `devel` branch.
There is also the `gh-pages` branch, which holds OctoPrint's web page, and a few
older development branches that are slowly being migrated or deleted.
## How OctoPrint is versioned
OctoPrint follows the [semantic versioning scheme](http://semver.org/) of **MAJOR.MINOR.PATCH**.
The **PATCH** version number is the one increasing most often due to OctoPrint's maintenance releases.
Releases that only change the patch number indicate that they contain bug fixes and small improvements
of existing functionality. Example: 1.2.8 to 1.2.9.
The **MINOR** version number increases with releases that add a lot of new functionality and
large features. Example: 1.2.x to 1.3.0.
Finally, the **MAJOR** version number increases if there are breaking API changes that concern any of the
documented interfaces (REST API, plugin interfaces, ...). So far this hasn't happened. Example: 1.x.y to 2.0.0.
OctoPrint's version numbers are automatically generated using [versioneer](https://github.com/warner/python-versioneer)
and depend on the selected git branch, nearest git tag and commits. The generated version number
should always be [PEP440](https://www.python.org/dev/peps/pep-0440/) compatible. Unless a git tag
is used for version number determination, the version number will also contain the git hash within
the local version identifier to allow for an exact determination of the active code base
(e.g. `1.2.9.dev68+g46c7a9c`). Additionally, instances with active uncommitted changes will contain
`.dirty` in the local version identifier.
See [the corresponding chapter in the documentation](https://docs.octoprint.org/en/master/development/branches.html).
## History
@@ -477,14 +408,15 @@ the local version identifier to allow for an exact determination of the active c
* 2018-03-29: "Where to find version numbers" is now located on the FAQ
* 2018-10-18: Allow PRs against `maintenance` branch for improvements and small
new features, suggest getting in touch on the forum for larger changes
* 2020-08-10: Update versioning scheme and PR instructions
* 2020-09-23: Move branch & versioning into development docs
* 2020-10-07: Introduce `pre-commit`
* 2021-02-04: Issue forms! \o/
* 2021-03-04: Correct issue forms link
* 2021-04-27: Systeminfo Bundles! \o/
## Footnotes
* [1] - If you are wondering why, the problem is that anything that you add
to your PR's branch will also become part of your PR, so if you create a
PR from your version of `devel` chances are high you'll add changes to the
PR that do not belong to the PR.
* [2] - Yes, we know that this goes against PEP-8. OctoPrint started out as
a fork of Cura and hence stuck to the coding style found therein. Changing
it now would make the history and especially `git blame` completely
unusable, so for now we'll have to deal with it (this decision might be
OctoPrint provides a snappy web interface for controlling consumer 3D printers. It is Free Software
and released under the [GNU Affero General Public License V3](http://www.gnu.org/licenses/agpl.html).
and released under the [GNU Affero General Public License V3](https://www.gnu.org/licenses/agpl-3.0.html).
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme).
The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme). It also serves as central knowledge base.
The official IRC channel is [#octoprint on freenode](https://chat.octoprint.org). Its logs can be found [here](https://freenode.logbot.info/octoprint).
An invite to the Discord server can be found at [discord.octoprint.org](https://discord.octoprint.org).
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
The documentation is located at [docs.octoprint.org](http://docs.octoprint.org).
The documentation is located at [docs.octoprint.org](https://docs.octoprint.org).
The official plugin repository can be reached at [plugins.octoprint.org](https://plugins.octoprint.org/?utm_source=github&utm_medium=readme).
**OctoPrint's development wouldn't be possible without the [financial support by its community](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
If you enjoy OctoPrint, please consider becoming a regular supporter!**
You are currently looking at the source code repository of OctoPrint. If you already installed it
(e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only
want to find out how to use it, [the documentation](http://docs.octoprint.org/) and [the public wiki](https://github.com/foosel/OctoPrint/wiki)
might be of more interest for you. You might also want to subscribe to join
want to find out how to use it, [the documentation](https://docs.octoprint.org/) might be of more interest for you. You might also want to subscribe to join
[the community forum at community.octoprint.org](https://community.octoprint.org) where there are other active users who might be
able to help you with any questions you might have.
## Contributing
Contributions of all kinds are welcome, not only in the form of code but also with regards to the
[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), debugging help
in the [bug tracker](https://github.com/foosel/OctoPrint/issues), support of other users on
[the community forum at community.octoprint.org](https://community.octoprint.org)
[official documentation](https://docs.octoprint.org/), debugging help
in the [bug tracker](https://github.com/OctoPrint/OctoPrint/issues), support of other users on
[the community forum at community.octoprint.org](https://community.octoprint.org) or
[the official discord at discord.octoprint.org](https://discord.octoprint.org)
and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
If you think something is bad about OctoPrint or its documentation the way it is, please help
@@ -48,48 +56,44 @@ in any way to make it better instead of just complaining about it -- this is an
after all :)
For information about how to go about submitting bug reports or pull requests, please see the project's
Development of this version of OctoPrint wouldn't have been possible without
[the financial support by the community](https://octoprint.org/support-octoprint/) -
[the financial support by the community](https://support.octoprint.org) -
thanks to everyone who contributed!
## Patreon Patrons
## Patrons & Sponsors
*Andre Bubel
*Andrew Moorby
*3D-TECH
*3DPrinterOS
* Al Mucci
* Arnljot Arntsen
*Bjorn Breckenridge
*Artillery 3D
* Ash King
* BigTreeTech
* Boris Hussein
* Brad Jackson
* BuildBee
* Calvin Vette
* Christian Petropolis
* Christian Wolf
* COLLE+McVOY
*D Brian Kimmel
* Christian Würthner
*Christoph Sigrist
* Craig Parker
* Creality3D
* David Bounds
* DeltaMaker 3D Printers
* Dorian Gray
*E3D BigBox
* Dennis Breining
*Douglas Floyd
* Dr. Frank Wester
* Eric Betts
* Ernesto Martinez
* Franziska Kunsmann
* George Robles
*jean-claude migneault
*Jeff Renfer
*Jefferson Hunt
* Jeremiah Avery
* Joseph Payne
*Greg Holloway
*Hog Duske
*Itay Shem-tov
* James Mackay
* Jeff Green
* Jeff Moe
* jeffiel
* Jeremy Cole
* Joshua Wills
* Julian Melo
* Justin Kaufman
* Kaile Riser
* Kale Stedman
* Kazuhiro Ogura
*LA 3D Printer Repair
*LulzBot®
*Kenneth Jiang
*Kurt Wubbels
* Kyle Menigoz
* Lachlan Bell
* Lefteris Lertas
* LulzBot
* Makespace Madrid
* Mark Walker
* Matt Van Itallie
* Michael Aumock
* Mike Kershaw
* Miles Flavel
* Mosaic Manufacturing
*OMER MEHMET SUTAS
* Patrick McGinnis
* Prof Yuh Wen Chen
*Norman Jaffe
* Peopoly
* Pete Barnwell
* Raise3D
* Randy C. Will
* Ranjib Dey
* Richard McGuire
* Richard Michaud
* Richard Stocks
* Robert Gusek
*Samer Najia
* Shawn Lewis
* Simon Hallam
*Ronald Griehsler
* Sean Jensen-Grey
* Sebastien Andrivet
* Stefan Krister
* Sven Mueller
*TEVO 3D Printers
* Steve Dougherty
*Steve Thompson
* TH3D
* The Spaghetti Detective
* TJ Horner
* Trent Shumay
* Ulrich Kempken
* Yehuda Katz
and 1544 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 2279 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
- Additional data injected by plugins via the :ref:`octoprint.printer.additional_state_data hook <sec-plugins-hooks-plugin-printer-additional_state_data>`,
indexed by plugin identifier. Structure of additional data is determined by the plugin.
OctoPi versions 0.12.0 and later already come with pybonjour installed and ready to go,
you don't need to perform these steps there.
..note::
Currently there are no releases for pybonjour available on the Python Package Index PyPI. The latest pybonjour
release is still available in the `Google Code Archive <https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz>`_.
Since that URL is hilariously long though, a shortened version is provided with https://goo.gl/SxQZ06 and
used in the installation instructions below.
In order for the Zeroconf discovery to work, the
`pybonjour package <https://pypi.python.org/pypi/pybonjour>`_ needs to be available
to the Python installation running OctoPrint.
It can be installed via ``pip``. Let's assume you installed OctoPrint manually
into some folder ``~/OctoPrint``. You executed ``python setup.py install`` within a
virtualenv in the same folder called ``venv``. In order to install ``pybonjour``
so it will be available to OctoPrint you'll need to do the following::
venv/bin/pip install https://goo.gl/SxQZ06
**Linux users:** You'll need to install an additional dependency for this to work, the
libdnssd compatibility layer for libavahi. On Debian/Ubuntu that can be achieved with::
sudo apt-get install libavahi-compat-libdnssd-dev
.._sec-bundledplugins-discovery-configuration:
Configuring the plugin
@@ -74,6 +36,10 @@ Configuring the plugin
The plugin supports the following configuration keys:
*``addresses``: List of IP addresses for which to enable discovery, if unset all
addresses available on the host will be used
*``interfaces``: List of network interfaces for which to enable discovery, if unset
all interfaces on the host will be used
*``publicPort``: Public port number OctoPrint is reachable under,
optional, if not set the port OctoPrint itself was started under will be used
*``pathPrefix``: Path prefix OctoPrint is running under, optional, if not
@@ -128,6 +94,8 @@ The following snippet is a valid configuration example for the discovery plugin
plugins:
discovery:
interfaces:
- eth0
publicPort:443
useSsl:true
zeroConf:
@@ -150,8 +118,7 @@ Announced Services
ZeroConf Service ``_http._tcp``
+++++++++++++++++++++++++++++++
If :ref:`pybonjour <sec-bundledplugins-discovery-firststeps-pybonjour>` is
correctly installed, OctoPrint will announce itself on the network via ZeroConf
OctoPrint will announce itself on the network via ZeroConf
as service ``_http._tcp``, with the TXT record containing the standard fields.
See also `this documentation of _http._tcp TXT records <http://www.dns-sd.org/txtrecords.html>`_
@@ -162,8 +129,7 @@ for more information.
ZeroConf Service ``_octoprint._tcp``
++++++++++++++++++++++++++++++++++++
If :ref:`pybonjour <sec-bundledplugins-discovery-firststeps-pybonjour>` is
correctly installed, OctoPrint will announce itself on the network via ZeroConf
OctoPrint will announce itself on the network via ZeroConf
as service ``_octoprint._tcp``. The TXT record may contain the following fields:
*``path``: path prefix to actual OctoPrint instance, inherited from ``_http._tcp``
The viewer has been included in OctoPrint ever since the first releases back in 2013, however as of
OctoPrint 1.4.1 it has been extracted into its own bundled plugin.
.._sec-bundledplugins-gcodeviewer-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
*``mobileSizeThreshold``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases
or release candidates). Defaults to ``false``.
*``sizeThreshold``: Unique instance identifier, auto generated on first activation
*``skipUntilThis``: If this string is provided the GCode Viewer will search for this string, and if found, skip all gcode up until this string. This can be used to skip prime nozzle gcode in the preview
.._sec-bundledplugins-gcodeviewer-sourcecode:
Source Code
-----------
The source of the GCode Viewer plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/gcodeviewer``.
@@ -34,21 +38,25 @@ There you can adjust the following settings:
***OctoPrint version tracking**: Whether you want to track OctoPrint *releases* or every *commit*. Usually you want to
select "Release" here which is also the default, unless you are a developer.
***OctoPrint Release Channel** (if tracking releases): The release channel of OctoPrint to track for updates. If you only want stable versions,
select "Stable" here which is also the default. "Maintenance RCs" will also allow you to update to maintenance release
candidates, "Devel RCs" will also allow you to update to development release candidates. If in doubt, leave it at
"Stable". `Read more about Release Channels here <https://github.com/foosel/OctoPrint/wiki/Using-Release-Channels>`_.
***OctoPrint checkout folder** (if tracking git commits): This must be the path to OctoPrint's git checkout folder
(``/home/pi/OctoPrint`` for OctoPi or `manual installs following the Raspberry Pi setup guide <https://github.com/foosel/OctoPrint/wiki/Setup-on-a-Raspberry-Pi-running-Raspbian>`_).
***Tracked branch** (if tracking is set to "Github Commit"): The branch that will be tracked if you set version tracking to "Github Commit".
***OctoPrint ``pip`` target** (if tracking is set to "Release" or "Github Commit"): The argument that will be provided to ``pip`` when updating OctoPrint.
Usually you don't want to change this from its default value of ``https://github.com/OctoPrint/OctoPrint/archive/{target_version}.zip``.
***OctoPrint checkout folder** (if tracking is set to "Local checkout"): This must be the path to OctoPrint's git checkout folder
(``/home/pi/OctoPrint`` for OctoPi or `manual installs following the Raspberry Pi setup guide <https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337/>`_).
Note that since OctoPrint 1.3.6 you will no longer need to set this to be able to update to releases, only if you
want to be able to update against some bleeding edge git branch.
***Enable ``pip`` update checks**: Whether to have OctoPrint automatically check for updates of
the ``pip`` tool that is used for updating most components.
***Version cache TTL**: The "time to live" of the cache OctoPrint will use to temporarily persist the version information
for the various components registered with the plugin, so that they don't have to be queried from the internet every time
you load the page. Defaults to 24h, you usually shouldn't need to change that value.
***Show notifications to users**: Whether to display update notifications (without "Update now" button) to users that cannot
apply updates.
***Minimum free disk space**: The minimum amount of free disk space needed in order to allow software updates to be run.
More settings are available by :ref:`editing the corresponding section in config.yaml <sec-bundledplugins-softwareupdate-configuration>`.
That restart commands for OctoPrint and the whole server can be configured under Settings > Server.
Restart commands for OctoPrint and the whole server can be configured under Settings > Server.
.._sec-bundledplugins-softwareupdate-cli:
@@ -119,9 +127,6 @@ Configuring the Plugin
plugins:
softwareupdate:
# the time-to-live of the version cache, in minutes
Starting with OctoPrint 1.5.0, the Software Update Plugin supports supplying a GitHub
API token to use for the ``github_release`` and ``github_commit`` version check types,
to work around possible rate limit problems if a lot of checks are to be made from a single
external IP. You may create a `personal access token <https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token>`_
and configure that as ``plugins.softwareupdate.credentials.github`` via
:ref:`config.yaml <sec-configuration-config_yaml>` in order to get a higher rate limit than with purely anonymous access.
Additionally, the username and password to use with the ``bitbucket_commit`` version check
type may also be configured via ``plugins.softwareupdate.credentials.bitbucket_user`` and
* Enter the checked out source folder: ``cd OctoPrint``
* Create virtual environments in the checked out source folder for both Python 2.7 and Python 3.7 to use for
installing and running OctoPrint and its dependencies (this avoids potential versioning issues for the dependencies
with system wide installed instances):
* PY2: ``virtualenv --python=python2 venv2``
* PY3: ``virtualenv --python=python3 venv3``
* Activate one of the virtual environments:
* PY2: ``source venv2/bin/activate`` (Linux, MacOS) or ``source venv2/Scripts/activate`` (Git Bash under Windows, see below)
* PY3: ``source venv3/bin/activate`` (Linux, MacOS) or ``source venv3/Scripts/activate`` (Git Bash under Windows, see below)
* Create a virtual environment in the checked out source folder to use for
installing and running OctoPrint and its dependencies. Creating virtual environments avoids potential versioning
issues for the dependencies with system wide installed instances:``virtualenv --python=python3 venv``
..note::
This assumes that the ``python3`` binary is available directly on your ``PATH``. If
it cannot be found on your ``PATH`` like this you'll need to specify the full path here,
e.g. ``virtualenv --python=/path/to/python3/bin/python venv``
* Activate the virtual environment: ``source venv/bin/activate`` (Linux, macOS) or ``source venv/Scripts/activate`` (Git Bash under Windows, see below)
* Update ``pip`` in the virtual environment:
* ``pip install --upgrade pip``
* Install OctoPrint in `"editable" mode <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>`_,
including its regular *and* development and plugin development dependencies:
* ``pip install -e .[develop,plugins]``
including its regular *and* development and plugin development dependencies:
*``pip install -e '.[develop,plugins,docs]'``
* Set up the pre-commit hooks that make sure any changes you do adhere to the styling rules:
* ``pre-commit install``
* Tell ``git`` where to find the file with revisions to exclude for ``git blame``:
This guide is based on the `Setup Guide for Mac OS X on OctoPrint's wiki <https://github.com/foosel/OctoPrint/wiki/Setup-on-Mac/>`_.
This guide is based on the `Setup Guide for Mac OS X on OctoPrint's Community Forum <https://community.octoprint.org/t/setting-up-octoprint-on-macos/13425>`_.
Please report back if it works for you, due to lack of access to a Mac I cannot test it myself. Thanks.
..todo::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
@@ -155,11 +187,15 @@ You'll need a user account with administrator privileges.
*``sudo xcodebuild`` (ensure the license was accepted)
* If you have more than one Xcode installed: ``sudo xcode-select -s /Applications/Xcode.app/Contents/Developer``
* Install Homebrew and use that to install Python:
* Install Homebrew and use that to install Python 3:
OctoPrint includes, by default, a virtual printer plugin. This plugin allows you to debug OctoPrint's serial
OctoPrint includes, by default, a :ref:`virtual printer plugin <sec-bundledplugins-virtual_printer>`. This plugin allows you to debug OctoPrint's serial
communication without connecting to an actual printer. Furthermore, it is possible to create certain edge conditions
that may be hard to reproduce with a real printer.
@@ -12,33 +12,219 @@ that may be hard to reproduce with a real printer.
Enabling the virtual printer
----------------------------
The virtual printer is enabled by editing OctoPrint's config.yaml file. Details on the configuration file can
be found in the full :ref:`config.yaml documentation <sec-configuration-config_yaml>`.
The steps to take are as follows:
* Find config.yaml in the OctoPrint settings folder. Usually in ``~/.octoprint`` on Linux, in ``%APPDATA%/OctoPrint`` on Windows and in ``~/Library/Application Support/OctoPrint`` on MacOS.
* Add or extend the ``devel`` section with:
..code-block::yaml
devel:
virtualPrinter:
enabled:true
* Restart OctoPrint.
* In the connection panel, a new option will appear in the Serial Port dropdown labeled ``VIRTUAL``.
* Select this option and click ``connect``.
* The virtual printer is now active.
The virtual printer can be enabled through its Settings pane.
.._sec-development-virtual-printer-config:
Virtual printer configuration options
-------------------------------------
The config.yaml file has many configuration options for the virtual printer that allow you to fine-tune its behavior.
There many configuration options via ``config.yaml`` for the virtual printer that allow you to fine-tune its behavior:
Please see the relevant :ref:`config.yaml section <sec-configuration-config_yaml-devel>` for the full details.
..code-block::yaml
plugins:
# Settings for the virtual printer
virtual_printer:
# Whether to enable the virtual printer and include it in the list of available serial connections.
# Defaults to false.
enabled:true
# Whether to send an additional "ok" after a resend request (like Repetier)
okAfterResend:false
# Whether to force checksums and line number in the communication (like Repetier), if set to true
# printer will only accept commands that come with linenumber and checksum and throw an error for
# lines that don't. Defaults to false
forceChecksum:false
# Whether to send "ok" responses with the line number that gets acknowledged by the "ok". Defaults
# to false.
okWithLinenumber:false
# Number of extruders to simulate on the virtual printer. Map from tool id (0, 1, ...) to temperature
# in °C
numExtruders:1
# Allows pinning certain hotends to a fixed temperature
pinnedExtruders:null
# Whether to include the current tool temperature in the M105 output as separate T segment or not.
#
# True: > M105
# < ok T:23.5/0.0 T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
# False: > M105
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
includeCurrentToolInTemps:true
# Whether to include the selected filename in the M23 File opened response.
#
# True: > M23 filename.gcode
# < File opened: filename.gcode Size: 27
# False: > M23 filename.gcode
# > File opened
includeFilenameInOpened:true
# Whether the simulated printer should also simulate a heated bed or not
hasBed:true
# Whether the simulated printer should also simulate a heated chamber or not
hasChamber:false
# If enabled, reports the set target temperatures as separate messages from the firmware
#
# True: > M109 S220.0
# < TargetExtr0:220.0
# < ok
# > M105
# < ok T0:34.3 T1:23.5 B:43.2
# False: > M109 S220.0
# < ok
# > M105
# < ok T0:34.3/220.0 T1:23.5/0.0 B:43.2/0.0
repetierStyleTargetTemperature:false
# If enabled, uses repetier style resends, sending multiple resends for the same line
# to make sure nothing gets lost on the line
repetierStyleResends:false
# If enabled, ok will be sent before a commands output, otherwise after or inline (M105)
#
# True: > M20
# < ok
# < Begin file list
# < End file list
# False: > M20
# < Begin file list
# < End file list
# < ok
okBeforeCommandOutput:false
# If enabled, reports the first extruder in M105 responses as T instead of T0
#
# True: > M105
# < ok T:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
# False: > M105
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
smoothieTemperatureReporting:false
# Settings related to the SD file list output
sdFiles:
# Whether M20 responses will include filesize or not
#
# True: <filename> <filesize in bytes>
# False: <filename>
size:true
# Whether M20 responses will include longname or not (only if size = true as well)
#
# True: <filename> <filesize in bytes> <longname>
# False: <filename> <filesize in bytes>
longname:false
# Forced pause for retrieving from the outgoing buffer
throttle:0.01
# Whether to send "wait" responses every "waitInterval" seconds when serial rx buffer is empty
sendWait:false
# Interval in which to send "wait" lines when rx buffer is empty
waitInterval:1
# Size of the simulated RX buffer in bytes, when it's full a send from OctoPrint's
# side will block
rxBuffer:64
# Size of simulated command buffer, number of commands. If full, buffered commands will block
# until a slot frees up
commandBuffer:4
# Whether to support the M112 command with simulated kill
supportM112:true
# Whether to send messages received via M117 back as "echo:" lines
echoOnM117:true
# Whether to simulate broken M29 behaviour (missing ok after response)
brokenM29:true
# Whether F is supported as individual command
supportF:false
# Firmware name to report (useful for testing firmware detection)
firmwareName:Virtual Marlin 1.0
# Simulate a shared nozzle
sharedNozzle:false
# Send "busy" messages if busy processing something
sendBusy:false
# Simulate a reset on connect
simulateReset:true
# Lines to send on simulated reset
resetLines:
- start
- "Marlin: Virtual Marlin!"
- "SD card ok"
# Initial set of prepared oks to use instead of regular ok (e.g. to simulate
# mis-sent oks). Can also be filled at runtime via the debug command prepare_ok
preparedOks:[]
# Format string for ok response.
#
# Placeholders:
# - lastN: last acknowledged line number
# - buffer: empty slots in internal command buffer
#
# Example format string for "extended" ok format:
# ok N{lastN} P{buffer}
okFormatString:ok
# Format string for M115 output.
#
# Placeholders:
# - firmare_name: The firmware name as defined in firmwareName
The server is attempting to connect to the printer.
..versionadded:: 1.3.0
Connected
The server has connected to the printer.
@@ -144,6 +181,8 @@ Disconnecting
event might not always be sent when the server and printer get disconnected
from each other. Do not depend on this for critical life cycle management.
..versionadded:: 1.3.0
Disconnected
The server has disconnected from the printer
@@ -151,6 +190,9 @@ Error
An unrecoverable error has been encountered, either as reported by the firmware (e.g. a thermal runaway) or
on the connection.
Note that this event will not fire for error messages from the firmware that are handled (and as such recovered from)
either by OctoPrint or a plugin.
Payload:
*``error``: the error string
@@ -164,23 +206,32 @@ PrinterStateChanged
:func:`~octoprint.printer.PrinterInterface.get_state_id` for possible values.
*``state_string``: Text representation of the new state.
..versionadded:: 1.3.0
.._sec-events-available_events-file_handling:
File handling
-------------
Upload
A file has been uploaded through the web interface.
A file has been uploaded through the :ref:`REST API <sec-api-fileops-uploadfile>`.
Payload:
*``name``: the file's name
*``path``: the file's path within its storage location
*``target``: the target storage location to which the file was uploaded, either ``local`` or ``sdcard``
*``select``: whether an immediate selection of the file was requested on the API by the corresponding parameter
*``print``: whether an immediate print start of the file was requested on the API by the corresponding parameter
*``effective_select``: whether the file will actually be selected (``select`` request got granted)
*``effective_print``: whether the file will actually start printing (``print`` request got granted)
*``userdata``: optional ``userdata`` if provided on the API, will only be present if supplied in the upload request
..deprecated:: 1.3.0
*``file``: the file's path within its storage location. To be removed in 1.4.0.
..versionchanged:: 1.4.0
FileAdded
A file has been added to a storage.
@@ -196,6 +247,8 @@ FileAdded
A copied file triggers this for its new path. A moved file first triggers ``FileRemoved`` for its original
path and then ``FileAdded`` for the new one.
..versionadded:: 1.3.3
FileRemoved
A file has been removed from a storage.
@@ -210,6 +263,28 @@ FileRemoved
A moved file first triggers ``FileRemoved`` for its original path and then ``FileAdded`` for the new one.
..versionadded:: 1.3.3
FileMoved
A file has been moved from one location to an other location.
Payload:
*``storage``: the storage's identifier
*``source_path``: the source file's path within its storage location
*``source_name``: the source file's name
*``source_type``: the source file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]``
*``destination_path``: the source file's path within its storage location
*``destination_name``: the source file's name
*``destination_type``: the source file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]``
..note::
A moved file still triggers first a ``FileRemoved`` for its original path and then ``FileAdded`` event for the new one. After that a ```UpdatedFiles``` event is also fired.
..versionadded:: 1.8.0
FolderAdded
A folder has been added to a storage.
@@ -223,6 +298,8 @@ FolderAdded
A copied folder triggers this for its new path. A moved folder first triggers ``FolderRemoved`` for its original
path and then ``FolderAdded`` for the new one.
..versionadded:: 1.3.3
FolderRemoved
A folder has been removed from a storage.
@@ -235,6 +312,24 @@ FolderRemoved
A moved folder first triggers ``FolderRemoved`` for its original path and then ``FolderAdded`` for the new one.
..versionadded:: 1.3.3
FolderMoved
A folder has been moved from one location to an other location.
Payload:
*``storage``: the storage's identifier
*``source_path``: the source folder's path within its storage location
*``source_name``: the source folder's name
*``destination_path``: the source folder's path within its storage location
*``destination_name``: the source folder's name
..note::
A moved folder still triggers first a ``FolderRemoved`` for its original path and then ``FolderAdded`` event for the new one. After that a ```UpdatedFiles``` event is also fired.
..versionadded:: 1.8.0
UpdatedFiles
A file list was modified.
@@ -249,6 +344,7 @@ UpdatedFiles
reasons of backwards compatibility and will also be sent on modification of ``printables``. It will however
be removed with 1.4.0.
..versionchanged:: 1.4.0
MetadataAnalysisStarted
The metadata analysis of a file has started.
@@ -263,6 +359,8 @@ MetadataAnalysisStarted
*``file``: the file's path within its storage location. To be removed in 1.4.0.
..versionchanged:: 1.4.0
MetadataAnalysisFinished
The metadata analysis of a file has finished.
@@ -277,6 +375,8 @@ MetadataAnalysisFinished
*``file``: the file's path within its storage location. To be removed in 1.4.0.
..versionchanged:: 1.4.0
FileSelected
A file has been selected for printing.
@@ -291,6 +391,8 @@ FileSelected
*``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
*``filename``: the file's name. To be removed in 1.4.0.
..versionchanged:: 1.4.0
FileDeselected
No file is selected any more for printing.
@@ -304,6 +406,8 @@ TransferStarted
**Note:** Name changed in version 1.1.0
..versionchanged:: 1.1.0
TransferDone
A file transfer to the printer's SD has finished.
@@ -335,6 +439,8 @@ PrintStarted
*``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
*``filename``: the file's name. To be removed in 1.4.0.
..versionchanged:: 1.4.0
PrintFailed
A print failed.
@@ -353,6 +459,8 @@ PrintFailed
*``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
*``filename``: the file's name. To be removed in 1.4.0.
..versionchanged:: 1.4.0
PrintDone
A print completed successfully.
@@ -370,6 +478,8 @@ PrintDone
*``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
*``filename``: the file's name. To be removed in 1.4.0.
..versionchanged:: 1.4.0
PrintCancelling
The print is about to be cancelled.
@@ -383,6 +493,8 @@ PrintCancelling
*``user``: the user who cancelled the print job (if available)
*``firmwareError``: the firmware error that caused cancelling the print job, if any
..versionadded:: 1.3.7
PrintCancelled
The print has been cancelled.
@@ -413,6 +525,8 @@ PrintCancelled
*``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
*``filename``: the file's name. To be removed in 1.4.0.
..versionchanged:: 1.4.0
PrintPaused
The print has been paused.
@@ -442,6 +556,8 @@ PrintPaused
*``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
*``filename``: the file's name. To be removed in 1.4.0.
..versionchanged:: 1.4.0
PrintResumed
The print has been resumed.
@@ -459,6 +575,36 @@ PrintResumed
*``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
*``filename``: the file's name. To be removed in 1.4.0.
..versionchanged:: 1.4.0
GcodeScript${ScriptName}Running
A custom :ref:`GCODE script <sec-features-gcode_scripts>` has started running.
Payload:
*``name``: the file's name
*``path``: the file's path within its storage location
*``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
*``size``: the file's size in bytes (if available)
*``owner``: the user who started the print job (if available)
*``time``: the time needed for the print, in seconds (float)
..versionadded:: 1.6.0
GcodeScript${ScriptName}Finished
A custom :ref:`GCODE script <sec-features-gcode_scripts>` has finished running.
Payload:
*``name``: the file's name
*``path``: the file's path within its storage location
*``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
*``size``: the file's size in bytes (if available)
*``owner``: the user who started the print job (if available)
*``time``: the time needed for the print, in seconds (float)
..versionadded:: 1.6.0
.._sec-events-available_events-gcode_processing:
GCODE processing
@@ -499,6 +645,11 @@ Eject
EStop
An ``M112`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
FilamentChange
An ``M600``, ``M701`` or ``M702`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
..versionadded:: 1.7.0
PositionUpdate
The response to an ``M114`` was received by OctoPrint. The payload contains the current position information
parsed from the response and (in the case of the selected tool ``t`` and the current feedrate ``f``) tracked
@@ -513,6 +664,8 @@ PositionUpdate
*``t``: last tool selected *through OctoPrint*
*``f``: last feedrate for move commands ``G0``, ``G1`` or ``G28`` sent *through OctoPrint*
..versionadded:: 1.3.0
ToolChange
A tool change command was sent to the printer. The payload contains the former current tool index and the
new current tool index.
@@ -522,6 +675,34 @@ ToolChange
*``old``: old tool index
*``new``: new tool index
..versionadded:: 1.3.5
CommandSuppressed
A command was suppressed by OctoPrint due to according configuration and will not be
sent to the printer.
Payload:
*``command``: the command that was suppressed
*``message``: a message containing an explanation of the command suppression
*``severity``: a severity level, either ``warn`` or ``info`` - ``warn`` indicates
that the command was suppressed probably due to a misconfiguration either inside
OctoPrint or the firmware and that it should be investigated by the user
..versionadded:: 1.5.0
InvalidToolReported
The firmware reported a tool as invalid upon trying to select it. It has thus been marked
as invalid and further attempts to select said tool will result in the tool command
to get suppressed (and ``SuppressedCommand`` to be generated).
Payload:
*``tool``: the tool number that was reported as invalid by the firmware
*``fallback``: the tool number that OctoPrint will revert to
..versionadded:: 1.5.0
.._sec-events-available_events-timelapses:
Timelapses
@@ -547,6 +728,8 @@ CaptureFailed
*``file``: the name of the image file that should have been saved
*``error``: the error that was caught
..versionadded:: 1.3.0
MovieRendering
The timelapse movie has started rendering.
@@ -588,6 +771,7 @@ SlicingStarted
Payload:
*``slicer``: the used slicer
*``stl``: the STL's filename
*``stl_location``: the STL's location
*``gcode``: the sliced GCODE's filename
@@ -599,6 +783,7 @@ SlicingDone
Payload:
*``slicer``: the used slicer
*``stl``: the STL's filename
*``stl_location``: the STL's location
*``gcode``: the sliced GCODE's filename
@@ -611,6 +796,7 @@ SlicingCancelled
Payload:
*``slicer``: the used slicer
*``stl``: the STL's filename
*``stl_location``: the STL's location
*``gcode``: the sliced GCODE's filename
@@ -621,6 +807,7 @@ SlicingFailed
Payload:
*``slicer``: the used slicer
*``stl``: the STL's filename
*``stl_location``: the STL's location
*``gcode``: the sliced GCODE's filename
@@ -635,14 +822,18 @@ SlicingProfileAdded
*``slicer``: the slicer for which the profile was added
*``profile``: the profile that was added
..versionadded:: 1.2.12
SlicingProfileModified
A new slicing profile was modified.
A slicing profile was modified.
Payload:
*``slicer``: the slicer for which the profile was modified
*``profile``: the profile that was modified
..versionadded:: 1.2.12
SlicingProfileDeleted
A slicing profile was deleted.
@@ -651,6 +842,8 @@ SlicingProfileDeleted
*``slicer``: the slicer for which the profile was deleted
*``profile``: the profile that was deleted
..versionadded:: 1.2.12
.._sec-events-available_events-settings:
Settings
@@ -661,3 +854,20 @@ SettingsUpdated
This event may also be triggered if calling code of :py:class:`octoprint.settings.Settings.save` or
:py:class:`octoprint.plugin.PluginSettings.save` sets the ``trigger_event`` parameter to ``True``.
..versionadded:: 1.2.0
.._sec-events-available_events-printer_profile:
Printer Profile
---------------
PrinterProfileModified
A printer profile was modified.
Payload:
*``identifier``: the identifier of the modified printer profile
You can configure Autologin via a plugin (the easy way), or manually (the hard way), but
in either case you will need to specify which user should be automatically logged in, and
which hosts are permitted access this way.
**Improperly setting this subnet option can lead to the compromise of your system, or even
your entire network. Proceed with extreme caution.**
The subnet to use is usually the IP address range of your LAN, which sounds scary but
actually isn't. Just `figure out your PC's IP address and subnet mask <https://lifehacker.com/how-to-find-your-local-and-external-ip-address-5833108>`_
and then combine both with a / in between.
On OctoPi (or another Linux distribution) you can use the follwing command:
..code-block::
ip route | grep -P 'eth0|wlan0' | awk '{print $1}'
@@ -21,8 +21,14 @@ Action commands are a feature defined for the GCODE based RepRap communication p
OctoPrint out of the box supports handling of the above mentioned commands:
start
When this command is received from the printer, a job is currently selected and *not* active, OctoPrint
will start it just like if the "Start"/"Restart" button had been clicked.
..versionadded:: 1.5.0
cancel
When this command is received from the printer, OctoPrint will cancel a current print job like if the
When this command is received from the printer, OctoPrint will cancel a current print job just like if the
"Cancel" button had been clicked.
pause
@@ -48,8 +54,39 @@ resumed
disconnect
When this command is received from the printer, OctoPrint will immediately disconnect from it.
sd_inserted
When this command is received from the printer, OctoPrint will assume an SD card is present in the printer,
set the corresponding internal state flags and send a file list request. This command is only recognized
if SD support is enabled in OctoPrint.
..versionadded:: 1.6.0
sd_ejected
When this command is received from the printer, OctoPrint will assume the SD card has been removed from
the printer and clear the corresponding internal state flags. This command is only recognized
if SD support is enabled in OctoPrint.
..versionadded:: 1.6.0
sd_updated
When this command is received from the printer, OctoPrint will assume something on the SD card in the
printer has changed and trigger a file list request. This command is only recognized
if SD support is enabled in OctoPrint.
..versionadded:: 1.6.0
shutdown
When this command is received from the printer, **support for it is enabled in its settings**
and a working system shutdown command is configured, OctoPrint will immediately shutdown the system.
This command is not enabled by default due to the high risk of seeing it abused by malicious
firmware or manipulated GCODE, but can be enabled in the OctoPrint settings via Serial Connection >
Firmware & Protocol > Action Commands if so desired by the user.
..versionadded:: 1.8.0
If the bundled :ref:`Action Command Prompt Support Plugin <sec-bundledplugins-action_command_prompt>` is enabled (which
should be the case by default), OctoPrint will also interactive dialog creation through its :ref:`supported commands <sec-bundledplugins-action_command_prompt-action_commands>`.
should be the case by default), OctoPrint will also support interactive dialog creation
through its :ref:`supported commands <sec-bundledplugins-action_command_prompt-action_commands>`.
Support for additional commands may be added by plugins by implementing a handler for the
@ commands (also known as host commands elsewhere) are special commands you may include in GCODE files streamed
through OctoPrint to your printer or send as part of GCODE scripts, through the Terminal Tab, the API or plugins.
Contrary to other commands they will never be sent to the printer but instead trigger functions inside OctoPrint.
Loaded 100 of 821 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.