* Previously only colour determined Target vs Actual temperatures, this wasn't
great at a glance for colourblind people; making the target dashes makes this
clearer.
* 📄 Add license info for flot plugins
---------
Co-authored-by: Rob Emery <git@mintsoft.net>
Co-authored-by: Gina Häußge <gina@octoprint.org>
Was actually wrong to have that here, but thankfully it was
implemented wrong as well, and here two wrongs made
one right.
To match existing firmware out there, we should be sending
SD status auto reports with progress information whenever
a print from a selected SD file has been started. If a such a print
is cancelled via OctoPrint, all we can do is send an M25 to pause
it and just never resume it. That means that the SD status will
continue to report the current file position.
See #4924
Will provide instance stats and some fun achievements, but also
include some calls to action for funding.
One of the steps towards improving OctoPrint's financial support
again.
- error information for errors leading to disconnect or cancelling
will now be persisted in the printer object until reconnect or print
start
- a new REST API endpoint allows fetching that information
- the frontend has be adjusted to fetch that on server connect and
relevant events and show an error icon next to the printer state
which on click opens the modal
- additionally, the modal will be triggered if an error event is raised
Improves #4714
Provides more details incl. log excerpt
and FAQ link, to hopefully help users
diagnose printer issues themselves
instead of assuming OctoPrint caused
them.
Implements #4714
Not setting the _finished flag to True caused the UploadStorage-
FallbackHandler to generate an additional empty text/html response
for every POST/PUT/etc request. If that arrived inside a keep-alive
connection followed by additional requests, it caused the browser
to consider the text/html response to be the response to the follow-up
request, causing all kinds of mayhem.
Otherwise we might run into a race condition in case of long running
commands.
For an example see #4907:
A `G4 S54` triggered a `wait` response, since right after sending the
`ok` the host didn't send a new incoming line fast enough to prevent
that from happening. As a result, combined with several simulated
transmition errors right after, things get so much out of balance that
at some point the incoming queue runs full and an exception gets
triggered, killing the connection with a simulated SerialTimeout.
This fix should close the core cause of #4907
Copied from current tornado.wsgi.WSGIContainer. Seems to solve
to not delete the tmp files too early.
Also turned UploadStorageFallbackHandler async, otherwise
connections would be closed too early, causing issues in E2E
and probably also regular use.
Copied from current tornado.wsgi.WSGIContainer. Seems to solve
#4764. UploadStorageFallbackHandler needed some adjustments
to not delete the tmp files too early.
argon2-cffi uses calendar versioning, therefore the pin achieves no compatibility promises and only limits releases to from before 2022.
Co-authored-by: Gina Häußge <gina@octoprint.org>
E.g. if we try to load notifications for a bundled plugin (could
happen in case of identifier clash - normally *shouldn't* but just
did during development, so better safe than sorry)
Instead of customizing an existing tool that does a lot of stuff
that we don't need but lacks what we DO need (branch based virtual
tags), now there's a custom single file implementation that mixes
concepts from versioneer, miniver and the lookup that so far was
implemented in OctoPrint's custom build of versioneer, and does so
with less overhead.
Closes#4685
* Added regex filtering feature
Added new regex setting, new Filtering regex setting UI and filter on the incoming messages.
* Fixed a wrong variable name in the template.
* Changed settings name from 'regex' to 'filter'
In case of invalid/unusable folder configurations, OctoPrint
will roll back to its default so as to not prevent server
startup altogether (which would be a big issue for less
technical people).
However, this creates the problem that unless a user
fiddling around with base folder paths actually checks
the log and base folder config whether things are still
as originally configured, they won't see issues immediately,
e.g. caused by network shares not yet being available
during OctoPrint's startup.
Thus, we now will log such issues not only in the log but
will also show a popup to connecting admins, that will
inform them about which folders failed their validation and
were rolled back.
This will only work on the same startup, not following
startups, but it should give a bit more heads-ups to people
fiddling around with network shares specificially - hopefully.
Implements #4881
Without this patch, an attacker with admin rights could configure
a specially crafted GCODE Script to allow for code execution during
rendering of that script. An attacker might use this to extract data
managed by OctoPrint, or manipulate data managed by OctoPrint,
as well as execute arbitrary commands with the rights of the
OctoPrint process on the server system.
Fixes a reported security issue, CVE pending.
Will call `onWebcamRefresh` on the bound viewmodel of the currently
active webcam. It is up to the implementing webcam view model
to execute the actual refresh.
Only the mjpg stream type of the classicwebcam currently supports
this, for the other stream types it is a no-op.
Note that the button will be displayed on mouseover regardless of
whether it will actually be capable of triggering a refresh or not.
Also adjusted the fade-in animation of the keycontrol overlay to
match the refresh button and webcam selector.
Implements #4617
- `octoprint systeminfo` will now generate a bundle in the
current directory even without an explicitly added .
- `octoprint systeminfo --short` has been added to generate
the abridged version
This should clear up issues we saw in the past where users forgot
the . and then just pasted the abridged text only version when
we wanted a bundle.
Also make sure we don't go beyond a 1:1 aspect ration on rotation.
Finally get rid of some CSS issues caused by a loss of flexbox mode
in deeper divs.
Implements #4837
It was not storing its current value properly, thanks to an incomplete
refactoring ages ago during which etag and lastmodified types were
joined into httpheader.
Closes#4806
This works around a bug when installing PyYaml
>=5.4.1,<6.0.1 ever since Cython 3.0 has been released.
PyYaml 6.0.1 pins Cython to a version less than 3.0 which
resolves this issue (for now).
See also yaml/pyyaml#724
Safety hints in the first run end dialog have been
reworked to be more visually alerting and a
checkbox has been added for each that has
to be checked in order to proceed with the
wizard.
See discussion in #4739
`loggerDict[logger]` might be a placeholder. `getLogger` takes care of
replacing said placeholder with a full logger upon first access, before
returning it.
Closes#4753
* 🐛 Reduce intersection observer threshold
When this value is 1, scrolling down the page (sometimes?) triggers the value to change - probably something changes invisibly. Setting it to anything less than 1 seems to cure the issue, and there are no longer unwanted triggers of changes. 1% also seems to make more sense here than 100% - we want the webcam to load whenever even a tiny amount of it is visible.
* ♻️ Change visibility observer threshold to 1%
* ♻️ Use log.debug instead of console.debug
---------
Co-authored-by: Gina Häußge <gina@octoprint.org>
We need to reset emptyLayers (and should - for the sake of consistency -
also reset percentageByLayer) after running an analysis because
otherwise old values will stay in there until page reload, causing layers
to not render that actually are not empty but were in any previously
loaded model.
* log extruder and file position on pause
* satisfy linter
* move values into event, include also cancel action
* please the linter
* updated event documentation
* ♻️ Remove data redundancy
We really don't want to include origin and filename
in the event again when all we actually want
is the fileposition.
---------
Co-authored-by: Gina Häußge <gina@octoprint.org>
`None` values were converted to an empty string by sv, leading to
comparison issues with (correct) integers. Using the default order
value for sv fixes that.
Closes#4818
It was completely non deterministic due to no info about last print
and upload date having been collected in the backend.
This is fixed now, making storing by last upload date, last print
etc also apply to folders.
The corresponding data has also been made available in the frontend.
Closes#4800
It was not storing its current value properly, thanks to an incomplete
refactoring ages ago during which etag and lastmodified types were
joined into httpheader.
Closes#4806
* Handles M115 GEOMETRY capability report
* No need to use a separate format string...
* Origin has no effect on machine height...
* ♻️ virtual: refactor area report
Now depends on a single config setting `m115ReportArea`.
If true, the virtual printer will generate an area report from the current
printer profile and include it in the M115 reponse. Ships as false
by default.
---------
Co-authored-by: Gina Häußge <gina@octoprint.org>
In that case the nav container isn't available, and thus
the attempt to select the first link from that to activate
simply failed silently.
Instead we now check whether the nav container is
even there, and if not just activate the first tab pane.
Closes#4791
Avoids issues with chunked transfers that remove the "Content-Length" header, which the GCODE viewer requires for calculating percentages for progress monitoring.
Closes#4772
The original project has been abandoned two years ago: https://pypi.org/project/netifaces/
The new project claims to be nearly fully API-compatible: https://pypi.org/project/netifaces2/
Note the differences regarding `gateways` function and `AF_` constants.
The OctoPrint code however does not seem to use any of those, I tested the web interface without facing issues or errors, so given the CI/CD is passed, it should be fine.
Signed-off-by: MichaIng <micha@dietpi.com>
* Use webcam container for intersection instead of controls
* Removed check for tab visibility, fully rely on control.js logic
* Allow intersection observers to be recreated
* Use onStartupComplete as callback to defer intersection initialization
* Use webcam container for intersection instead of controls
* Removed check for tab visibility, fully rely on control.js logic
* Allow intersection observers to be recreated
* Use onStartupComplete as callback to defer intersection initialization
Apparently we have an issue when updating from an older OctoPrint install
that included that to a newer one that depends on OctoPrint-Setuptools, because
the `octoprint_setuptools` package simply won't be installed in that case.
A reinstall after updating OctoPrint makes it available, but that's not something
we can do in the field.
Long term this needs a better solution, short term we are simply going to provide
OctoPrint-Setuptools to pyproject.toml users, and a vendored copy here. It's the
only solution I see for now.
Really closes#4749
This is the final version to include universal wheels. Newer versions
seem to have native C extensions, no arm wheels are provided, building
them on a Pi takes *ages* and piwheels.org currently doesn't have
already compiled wheels for latest available either due to build issues.
For now we'll stick to 0.39.4, long term we might have to compile our own
wheels find another solution.
The latest version of Babel no longer supports this
but raises an error, which in turn leads to a
500 Server Error response here.
To fix this, we set a default for best_match.
Closes#4744
baseURL needs to be prefixed manually, since
PlayWright will use `new URL` internally which
interprets our paths relative to the domain,
not any paths provided as well.
If for some reason an exception gets thrown
inside get_current_versions that doesn't get
caught therein, `_get_versions_data_ready` will
never be set and thus any calls waiting for it
will block forever.
This patch fixes that by always setting the event
in the `finally` block.
Announcement and Softwareupdate plugin now
request the online status more often, to better
anticipate intermittent network failures.
Possible solution for #4634
Logins via credentials, remember me cookie, headers or
autologin will now generate an entry in auth.log, as will
logouts via the API.
This should allow auditing OctoPrint access, and also
make it possible to use something like fail2ban if
desired.
Errors during install, e.g. due to dependency issues, that
happened while a "Requirement already installed" message
was present in the output as well, were wrongly read as
a "reinstall needed" case if there was no failure line
present for some reason.
The logic has now been adjusted so that a reinstall will
only be triggered if there was no `Error:` line in the
output. A test case has been added as well.
Closes#4703
We've been getting a deprecation warning about -x for a
while now. This change switches to using the less clean-css
plugin. Detection to make sure the package is installed
has been added and the instructions on how to get
everything needed for the command to work have been
updated.
* 🚧 WIP: multi install of plugins from JSON export
* 🚧 pmgr: Multi install works
TODO: better tracking in install log of individual
steps/results.
* 🚧 Fix error reporting, improve working dialog
* 🐛 Hide action buttons while still installing
* 🚸 Confirmation dialog for json multi install
* 🐛 Fix notifications for single installs
Also: a typo
* Create new WebcamPlugin type
* Let user switch webcam plugin
* Move keyboard controls
* Rename webcam plugin
* Rename webcam plugin
* Update settings pane
* Extract JS code from control.js
* Temporary fix for KO bindings
* Migrate settings to plugin
* Fix issue on tab change
* Migrate settings UI
* Join WebRTC servers to string on migration
* Allow list of all webcams to be retrieved
* Enricht settings with webcams and ensure backwards compatibility
* Fix binfing lost bug
* Do not contain webcam settings if permission is missing
* Style tabs
* Unload webcam based on visibility
* Let user pick default webcam
* Refactor webcam access in Python
* Show snapshot and stream URL in settings dialog
* Update timelapse
* Small UI improvements
* Ensure default webcam is used if nothign is set
* Remove dummy webcams
* Remove commented sections
* Fix CI build
* Ensure configuration types are correct
* Only show selector if more than one webcam is available
* Access default webcam savely in case not set
* Use enum values for stream ratio
* Address PR comments
* Convert data structure to dict
* Create function to get snapshot, remove force=True from migration
* Fix timelapse not captured
* Fix inverted condition check
* Update wording in timelapse error message
* Apply rotate/flip to timelapse
* Add compatibility layer for plugins
* Remove exclusion of classicwebcam plugin
* Fix unit tests
* Fix unit tests #2
* Add onWebcamVisbilityChange callback
* Move stream and snapshot wizard to plugin
* Replace classic_webcam with classicwebcam
* Rename WebcamPlugin to WebcamProviderPlugin
* Rename take_snapshot to take_webcam_snapshot
* Update copyright
* Default to empty dict
* Wrap WebcamCompatibility into Optional
* Rename CoreWizardWebcamViewModel to ClassicWebcamWizardViewModel
* Simplify settings dict creation
* Use plugin identifier for logging
* Add file header
* Simplify toDict() function and renamt to to_dict()
* Rename iter to snapshot
* Remove redundant boolean checks
* Replace with
* Add WebcamNotAbleToTakeSnapshotException
* Reset wizard version to 1
* Reset wizard version to 1
* Update disabling discouraged messgae
* Update default webcam description
* Simplify webcam collection
* Remove test webcam
* 🐛 Fix wrong data location
* ♻️ Refactor settings compatibility layer
Use a settings overlay centrally derived on
server start/platform initialization. Mark overlay
as deprecated so that warnings on read and write
access will be logged to overlay leaves, and writes
will also be denied.
Adjust octoprint.webcams methods to allow injecting
plugin manager and settings instance to use to
support use during initialization.
TODO: Reset overlay when default webcam changes?
TODO: If we split the compat layer then we should
also add TWO overlays, one for snapshot and one for
stream config stuff.
* 💚 Fix unit tests
* ♻️ Move webcam related schema
Webcam, WebcamCompatibility and RatioEnum have
nothing to do with the config anymore but are
rather WebcamProviderPlugin specific, so let's move
them into their own octoprint.schema.webcam package.
* Remove old wizard logic
* Add seprate setting got snapshot webcam
* Convert WebRTC servers to list
* 🚸 Log warning on deprecated settings on API
If anyone is trying to set stuff from the webcam
compat layer, we now get a log entry, or multiple
if needed.
Long term we might want to return an error on
the API
* ☂ Ensure plugin can actually be found
Also use API methods of plugin manager instead of
accessing internal control properties directly.
Co-authored-by: Gina Häußge <gina@octoprint.org>
Four new hooks were added:
- octoprint.plugin.backup.before_backup
- octoprint.plugin.backup.after_backup
- octoprint.plugin.backup.before_restore
- octoprint.plugin.backup.after_restore
Those will allow plugins to perform additional
tasks right before/after backup and right before/
after restore.
This is a compromise for #4195: Instead of having
an extension point in OctoPrint to pull in
additional files, having to figure out
readability, proper allow listing to prevent
attempts to backup everything and the kitchen sink
and such, plugins CAN pull in additional stuff
they want to have in the backup into their data
folder and then on restore (or start after
restore) put it where it belongs. In an ideal
world, we would ever only want to backup stuff
that is already in the base folder anyhow, but
as #4195 demonstrates there is sometimes a need
for more.
And since these hooks are not limited to this
functionality specifically but could also be used
for other stuff (think reregistering somewhere
after restore or whatnot), I think they are a
good compromise.
Implements #4195
This way
?l10n=zh_hk
will work too, not just
?l10n=zh_hant_hk
Additionally, a comma separated list of l10n
options can now also be provided via query
or header, not just a single value:
?l10n=zh_hk,zh
See #4445
In multiple locations OctoPrint so far only used
the language component, rendering territory and/or
script specific translations unusable and
unselectable.
Fixes#4445
We extracted octoprint_setuptools into its own
package on pypi and pull that in on OctoPrint's
install to support plugins gettings installed
non-isolated via setuptools.
Additionally, OctoPrint's setup.py will use it
for clean & translation sub commands, but it's
made optional during install - we don't need
additional commands during a wheel build/install.
Plugins that use pyproject.toml can now add
octoprint-setuptools as a build requirement:
[build-system]
requires = ["setuptools>=40.8.0", "wheel", "octoprint-setuptools"]
build-backend = "setuptools.build_meta"
That way, isolated builds (as triggered by
the existance of pyproject.toml) will work.
And finally, by adding wheel as a dependency
to OctoPrint, we ensure that pip won't try to
install setup.py based plugins in an isolated
environment and fail due to the missing
octoprint_setuptools dependency.
Implements #4682
Work towards fixing #4552
If LFN_WRITE capability is reported as supported,
OctoPrint by default now will upload SD files
to the printer under their full name instead of
shortening it to DOS conventions.
The primary name as reported by the firmware
(first entry in the M20 output) is still
considered the main name and used for any file
operations like selecting or deleting. So, if
the firmware supports a DOS name here, that's
also what OctoPrint will (continue to) use for
any such operations.
Implements #4494
By adding a query parameter `devmode` it can be
re-enabled.
This should hopefully reduce the amount of text-only
systeminfo we get on the forums.
Implements #4524
When 3.12 comes around, we can always change
the python version requirement for local testing,
but this way there will be no bad surprises in the
field, OctoPrint will just refuse to install.
* add M118 echo command on the virtual printer
update string format by using format function for command M117
* clean up
* Update src/octoprint/plugins/virtual_printer/virtual.py
Add reg ex to match all , need to be tested
Co-authored-by: Gina Häußge <gina@octoprint.org>
* fix regex suggestion
Co-authored-by: Gina Häußge <gina@octoprint.org>
* Initial version. Seems tp works as intended except for skipUntil
* typo
* skipUntilThis support
* skipUntil should also be skipped if it is ""
* Update src/octoprint/plugins/gcodeviewer/__init__.py
Co-authored-by: Gina Häußge <gina@octoprint.org>
* Apply requested changes.
* Rename symbols for readability
Co-authored-by: Gina Häußge <gina@octoprint.org>
Just going by name breaks backups
with arbitrary file names created
from CLI or the helper.
Instead of matching on the name, we
now check whether it's a zip and
contains a metadata.json.
Closes#4659
Closes#4621
Individual commits:
* User names with extra spaces are invalid
* fix return value formatting
* API: Add user name validation
* Core Wizard: Add error message
Add 'invalid user name' error message
* Fix colon typo
* Fix style
* Fix import
* fix error state in core wizard
separately handle invalid user name
* fix isort style error
* Fix API validation
python strings use strip()
* add user name validation to settings
* Correct spelling of username
* implemented foosel's requested changes
changed checks from invalidUsername to validUsername everywhere
standardized the requirements for valid user names
* introduced providedUsername function
ensures user name field doesn't start in an error state
Co-authored-by: Frederik <stuff+git@fredo.org>
* 🚧 Handle multiple uploads better
Start for support. Has some TODOs and outstanding issues to tackle still, including the file upload/overwrite/rename/cancel dialog
* 🚧 Handle failed multiple uploads better
Show target filename when showing errors
Only refresh the files list if there was at least one successful file upload in the batch
* 🚧 Queue up file exists confirmations for multiple uploads
See #4300
* 🚧 Scroll to only the last uploaded file
* 🚧 Fix scrolling to the file
index starts at 0, length 1
Co-authored-by: Gina Häußge <gina@octoprint.org>
in the event handler onSlicingStarted the uploadProgressPercentage was given the parameter perecntage, but this was not know, so it will throw an error.
As this is the start of the slicing the correct value should be 0
* Track travel moves and notify if exceeds print volume
* Implement changes from pr review
* Update GcodeAnalysisQueue docstring for travel area
* Update docs for GCODE analysis information
* Update exceedance messages for translation
* Defer M20 commands until initial capability report is done
* Fix whitepsace
* Add setting for deferring sd file refresh
* Refactor to be more similar to _firmware_info implementation
* Add event hook for after capability report
* Improve capability report hook name
* Fix headline formatting
Co-authored-by: Gina Häußge <gina@octoprint.org>
Strict was causing issues for users who navigate
to their OctoPrint instance using a custom start
page, since `SameSite=Strict` would suppress
all cookies in that case, forcing you to login
again.
Will show variables needed for URL generation and
cookie suffix generation, both as seen by client
and server, and highlight any mismatches.
Also links to the reverse proxy FAQ and includes
information on which request headers are
relevant.
Not translated, kept as simple as possible.
Not behind a login since none of this information
should be news to a client on a properly
configured proxy setup.
We not only import it but also do a quick hash
and verify run to make sure the backend actually
works, otherwise we only support pbkdf2_sha256.
Additionally support multiple hash algorithms
and detect which one to use based on the password
hash.
Our tooling never really supported them anyhow,
tarfiles contain way more options to mess with
the file system as a recent vulnerability showed,
and now there was also a bigger issue reported
in the tarfile core library, so let's just get
rid of this and make the code a bit more slim
in the process.
* 🔒️ Protect against CSRF attacks
CORS and the JSON API heavily reduced the
attack surface here, but especially the upload
endpoints were still vulnerable to CSRF attacks.
All endpoints on the API that use methods
beyond GET, HEAD or OPTIONS now require
the presence of a csrf token (generated
by the UI on first load) AND a X-CSRF-Token
header with a matching value (Double Submit
Cookie), unless authorization is done through
an API-Key instead of a browser session.
Additionally, the SameSite attribute now is
set to "Strict" by default.
* 🔒️ Expand CSRF protection to plugins
Plugins are currently by default *opted out* of CSRF protection, to ensure
backwards compatibility with third party plugins in the field. However,
in a future OctoPrint version this will become a default *opt in*. Plugin
authors are advised to adjust the implementation with an explicit decision
via a logged warning generated in the default implementation. Additionally,
plugins that have opted out their whole plugin will generate a warning in
the startup messages.
A decorator to exempt individual endpoints from CSRF protection as certain
workflows require (see for example the auth request in the appkeys plugin)
is provided.
The general rule of thumb should be to opt in and only exempt those non
GET/HEAD/OPTIONS endpoints that really need to be usable without an
API key or CSRF cookie/header combo. In practice, that should be pretty
much non.
* 🐛 Fix a left-over from a local test
* 🐛 Fix wrong setting in E2E test config.yaml
* 🧑💻 Set CSRF header for $.ajax as well
We already ensure the header is set in the client lib and on the
file upload widgets, but many third party plugins don't use the
client lib but rather $.ajax directly and thus break without this.
* 📝 Improve docs on CSRF protection
uploads, timelapse and watched folder should be
configurable in the UI, but limiting anything else
to the config.yaml file is fair considering it
rarely should have to be touched. This reduces
the likelihood of misconfiguration or abuse.
- users.yaml is now versioned, and a backup is made
on version change. Thus, before any of the new
hashes are being saved to it, a backup with the
old ones will be made, here users.v1.yaml.
- The no longer needed salt is removed from the
config if no legacy hashes are left in
users.yaml. Prior to this removal however, a
backup of config.yaml is made,
config.cleanup_legacy_hashes.yaml.
When rolling back to an earlier version of
OctoPrint, moving both backups back over to
config.yaml and users.yaml respectively and
restarting will restore the ability to login
again.
With a fallback of pbkdf2_sha256 should anything
go wrong while attempting to import argon2
from passlib, e.g. due to broken native bindings.
Migration happens transparently on first login via
username and password.
If the default group gets actively deselected
during creation, it should not be automatically
added by the backend. Only add default groups
if no group info was provided at all, don't
add them if an empty list is provided.
Same for permissions.
So far it only required SETTINGS for historic reasons. The
description of SETTINGS however doesn't hint at that kind
of access and so this was misleading and could have led
to dangerous configurations.
Limited to admin anyhow, but let's make sure we only
ever provide things that look like valid backups on
this endpoint anyhow.
Also fixed a deprecated use of admin_validator.
* 🔒️ Tie remember_me cookie to password hash
That way when the password gets changed,
existing cookies automatically get
invalidated.
* 🔒️ Invalidate user sessions on password change
This will require a user to log in again after
their password is changed, either by themselves
or through an admin.
This is a slight change in behaviour compared
to before, but makes sure password changes
are enforced across all existing sessions.
* ♻️ remember_key_for_user => signature_key_for_user
* 🔒️ Invalidate sessions after 15min of inactivity
The server has been keeping track of login
session for a while, but now it also only
considers such (active login) sessions fresh
that have been active within the past 15min.
That way, a session cookie's lifetime is now
also restricted server side. An active
socket connection suffices to keep the
session alive, as do any other requests
using the cookie.
As the session tracking happens in-memory,
all sessions will become invalid on server
restart. However, if the remember me cookie
is set, after server restart a passive
login will succeed.
* 🔒️ Limit remember_me validity to 90 days
So far that was only done through the cookie
duration, and with a year to boot. Now we
encode the creation date into the cookie
and check against that, if it exceeds the
cookie duration the cookie is considered
unset.
Will prevent reuse of ancient remember me
cookies (and force the user to login at
least once every 90d).
* 💚 Fix unit tests
New cookie handling requires a faked flask
config object.
Related: https://huntr.dev/bounties/d27d232b-2578-4b32-b3b4-74aabdadf629/
A language pack containing a directory traversing
symlink could be uploaded. Upon backup creation, the
symlink would then lead to inclusion of whatever it
was pointing to in the resulting backup. This could
be used by an attacker with admin permissions to extract
information from the server.
A wrong role assigned to PluginManager LIST permission as
introduced in 1.8.0 causes a privilege escalation,
allowing read-only and user group the same rights as
the MANAGE permission:
- enabling/disabling plugins
- uninstalling plugins
- listing installed plugins incl. their details
- retrieving plugin notices
- deleting orphaned plugin settings
Announcements will now no longer trigger
a popup (unless from a priority 1 channel
like Important) but instead cause an
unread counter to be rendered on the
notification icon (1-9 and infinity symbol
for more). The announcement reader has
been extended by a default "Unread" tab
that shows all unread news items, and
a Mark All Read button has been added to
quickly get rid of the unread counter
altogether.
Should improve UX by reducing notification
spam significantly.
Admins may still change existing user account passwords without
having to enter the current one, however the regular user oriented
password change dialog has been adjusted to require entry of the
current password. The API has been locked down accordingly and
the password change endpoint has seen a small change due to that,
please refer to the updated documentation.
Admins may still change existing user account passwords without
having to enter the current one, however the regular user oriented
password change dialog has been adjusted to require entry of the
current password. The API has been locked down accordingly and
the password change endpoint has seen a small change due to that,
please refer to the updated documentation.
Also enforce that on downloads and mirror it on the
API.
Prevents accidental or intentional renaming of
valid files to something like .html to e.g. attempt
to run arbitrary JS code in the browser on
"download" in the context of the OctoPrint URL.
Stealing login credentials via XSS is very unlikely
here given their http-only nature, however it's
still better to prevent this from happening anyhow.
Should reduce likelihood of brute force attacks
on unsecure networks if users decide to deploy/make
OctoPrint accessible there against all advice to
the contrary.
Cherry picked from 82c892ba40
- Use "M20 L T" (if CAPABILITY_EXTENDED_M20 is available) which gives
us long file names but also file timestamps.
- Wire up that timestamp into "date" field which gives us "Uploaded: ...
ago" for files on SD card. Sorting by upload date also works.
- Implementing this also fixes parsing of response to (for example
manually sent) "M20 T" command. Octoprint assumed that third entry
in response is always long file name while with M20 T it is timestamp.
- Add conversion routines between M20 T timestamp and unix timestamp. Wire
up that conversion in virtual printer.
See also https://reprap.org/wiki/G-code#M20:_List_SD_card
Should reduce likelihood of brute force attacks
on unsecure networks if users decide to deploy/make
OctoPrint accessible there against all advice to
the contrary.
Flask 2.2 requires werkzeug 2.2 which we can't
upgrade to due to flask-login, and the current
version pins might be causing issues in the
field.
TODO for 1.9.0: upgrade werkzeug & flask if
possible with flask-login.
* Notify user if file or folder removal fails
* Improve error messages for failed file or folder removal
* Notify user if file is too large to upload
* Improve notification for failed file and folder uploads
The redirect parameter to the login dialog now gets restricted to local URLs (as detected by unset scheme & netloc) that match a short list of allowed endpoints routes.
* No longer assume SD card is always available on Repetier
Drop sdAlwaysAvailable handling and react on Repetier
firmware messages related to SD cards. Octoprint
already handles some of these messages, so only
add missing pieces.
While at it also handle M22 release message for prusa firmware
("SD card released").
* 🚸 Move "sdAlwaysPresent" option in settings
With it no longer being set during auto detection or
Repetier specific, it makes sense to move it out
of the former location and into an advanced settings
area.
Co-authored-by: Gina Häußge <gina@octoprint.org>
Less than 1% of (tracked) OctoPrint client loads
happen in browsers that are still stuck on ES5.
So let's get rid of the ES5 limitation and make
life easier for anyone working on OctoPrint's JS
code.
As a test of the eslint config, login.js and
recovery.js have been switched to the use of
arrow functions.
Implements #4562
Traefik sets `X-Forwarded-Prefix` to the prefix path
if the stripPrefix middleware is used. Instead of
having to define `X-Script-Name` manually in such
cases, this now makes OctoPrint also check that
header for prefix information.
See also https://doc.traefik.io/traefik/middlewares/http/stripprefix/
Switched all replacement logic to {} style format strings, which means
we no longer need to escape % internally. Only escaping it in one single
place now, before pacing the capture file pattern to ffmpeg, as THAT
uses % style formatting.
Closes#4505
We make sure to check if any of the credentials
we support are contained in the incoming settings
data and if so set that, and only that, on our
plugin settings, instead of overwriting the
stored credentials with just those that changed.
See #4540
Individual commits:
* Add last position cache
* Must be lower than percentage of next level.
* Fully working version with jsonc compression
* Switch to pako.js for both speed and efficiency
* compressed code is now an instance of Uint8Array
* Temporary fix for rebuildLayerPercentageLookup and purgeEmptyLayers
* Fix merge issues
* Fix prettier
* Fix prettier
* Calculate empty layers and percentage of layer in doAnalyse
* Delete all state when doing clear()
* Delete all state when doing clear()
* Add options to control compression. Allow to enable compression from the warning page.
* Do not always turn on compression by default.
* Correctly calculate the rendererEmptyLayers array.
* Only show "force compression" if compression is not already enabled.
* pre-commit fixes
* Use correct index and fix merge issues.
* Add some comments.
* Update src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 (Co-authored-by: Gina Häußge <gina@octoprint.org>)
* Move "Skip to this" up and make the threshold dependent on alwaysCompress setting.
* Remove redundant "Skip to this" (Co-authored-by: Gina Häußge <gina@octoprint.org>)
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.
* ⬆️ Initial FA6 upgrade
Only broken icon noticed so far is announcements header.
Strangely, the plugin manager 'Install' buttons have regained their plus signs.
* Allow plugins to use new FA5/6 icon styles in sidebar
Adds some backwards compatibility testing to allow new icons to work. Icons can be specified with either `fas fa-<icon>` or just `<icon` to use `fa fa-<icon>`. Both will work.
* 🔥 Remove plugin manager plus icon
It was gone for a while, I think I prefer the look of the button without it. No need to have an icon next to it IMO.
* ⬆️ Upgrade to FA 6.1.1
* ◀️ Add back v4 compatibility
And fix preloading V3....
* 🐛 Correct icon style
* 🐛 Fix font preload
Changed to fix dual loading in this PR, but I did it wrong. Now properly fixed.
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
description:Create a bug report to help improve OctoPrint
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!**
@@ -19,9 +33,6 @@ body:
OctoPi, [read this FAQ entry](https://faq.octoprint.org/octoprint-vs-octopi).
Do also not seek support here ("I need help with ...", "I have a
question ...", "Can someone walk me through ..."), that belongs into the
[community forum at community.octoprint.org](https://community.octoprint.org) or on the [Discord server](https://discord.octoprint.org).
And finally, make sure any bug you want to report is still present with the **current**
@@ -60,15 +71,15 @@ body:
required:true
- type:input
attributes:
label:If you could not test in safe mode, please state why
label:If you could not test in safe mode, please state why ("currently printing" is NOT an excuse!)
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
too long" or "I have a long print running right now" are **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.
If you really *cannot* test in safe mode at all, leave a short explanation as to why. If you can but just not right now, then wait with reporting until you can!
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"
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). It also serves as central knowledge base.
The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme). It also serves as a central knowledge base.
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).
@@ -38,14 +37,14 @@ 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/) 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/), debugging help
[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)
@@ -69,7 +68,7 @@ which is a custom SD card image that includes OctoPrint plus dependencies.
The generic steps that should basically be done regardless of operating system
and runtime environment are the following (as *regular
user*, please keep your hands *off* of the `sudo` command here!) - this assumes
you already have Python 2.7, 3.6 or 3.7, pip and virtualenv and their dependencies set up on your system:
you already have Python 3.7+, pip and virtualenv and their dependencies set up on your system:
1. Create a user-owned virtual environment therein: `virtualenv venv`. If you want to specify a specific python
to use instead of whatever version your system defaults to, you can also explicitly require that via the `--python`
@@ -87,7 +86,7 @@ access control as necessary.
OctoPrint depends on a few python modules to do its job. Those are automatically installed when installing
OctoPrint via `pip`.
OctoPrint currently supports Python 2.7, 3.6 and 3.7.
OctoPrint currently supports Python 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12.
## Usage
@@ -140,7 +139,7 @@ which is located at `~/.octoprint` on Linux, at `%APPDATA%/OctoPrint` on Windows
at `~/Library/Application Support/OctoPrint` on MacOS.
A comprehensive overview of all available configuration settings can be found
[in the docs](http://docs.octoprint.org/en/master/configuration/config_yaml.html).
[in the docs](https://docs.octoprint.org/en/master/configuration/config_yaml.html).
Please note that the most commonly used configuration settings can also easily
@@ -8,74 +8,60 @@ thanks to everyone who contributed!
* 3D-TECH
* 3DPrinterOS
* Arnljot Arntsen
* Artillery 3D
* Al Mucci
* Ash King
* BigTreeTech
* Boris Hussein
* Brad Jackson
* BRANDON ROBERTSON
* BuildBee
* Chris Lynch
* Christian Petropolis
* Christian Wolf
* Christian Würthner
* Christoph Sigrist
* Creality3D
* Dana Voigt
* David Bounds
* DeltaMaker 3D Printers
* Dennis Breining
* Douglas Floyd
*Dr. Frank Wester
* Eric Betts
* Dima Gorbenko
*Ed Crump
* Ernesto Martinez
* Fiberpunk
* Franziska Kunsmann
* George Robles
* Greg Holloway
* Hog Duske
*Itay Shem-tov
*Jacob Renstrom
* Jeff Green
* Jeff Moe
* Jeremy Cole
* Joshua Wills
* John Cassel
* Julian Melo
* Justin Kaufman
* Kaile Riser
* Kazuhiro Ogura
* Kelly C McNiece
* Kenneth Jiang
* Kurt Wubbels
* Kyle Menigoz
* LA 3D Printer Repair
* Lachlan Bell
* Lee Dohm
* Lefteris Lertas
* LulzBot
* Makespace Madrid
* Mark Greenwald
* Mark Walker
* Martin Majewski
* Michael Aumock
* Mike Kershaw
* Miles Flavel
* Michael Badagliacco
* Mike Labanov
* Mosaic Manufacturing
* Nat Friedman
* Neil R. Goldberg
* Norman Jaffe
* Obico
* Ory Weaver
* Peopoly
* Pete Barnwell
* Raise3D
* Randy C. Will
* Ranjib Dey
* Richard McGuire
* Richard Michaud
* Richard Stocks
* Robert Gusek
*Ronald Griehsler
* Sebastien Andrivet
*SimplyPrint
* Stefan Krister
* Steve Dougherty
* Steve Thompson
*Sven Mueller
* TH3D
* The Spaghetti Detective
* Ulderico Cirello
*Tideline 3D
* Ulrich Kempken
and 2347 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
and 1918 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
@@ -135,7 +135,7 @@ check the corresponding checkbox in the API settings dialog.
..warning::
This means any browser page can send requests to the OctoPrint API. Authorization is still required however.
This means any browser page can send requests to the OctoPrint API. Authorization via an API-Key is still required however.
If CORS is not enabled you will get errors like the following::
@@ -151,6 +151,29 @@ If CORS is not enabled you will get errors like the following::
the login mechanism (or reusing an existing login session). When accessing OctoPrint
via CORS, you'll therefore always need to use an API key.
.._sec-api-general-csrf:
CSRF Protection
===============
..versionadded:: 1.8.3
To protect OctoPrint against `CSRF attacks <https://owasp.org/www-community/attacks/csrf>`_ against the non CORS affected upload endpoints, in case of browser session based authorization the API
is protected using the `Double Submit Cookie mitigation strategy <https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#double-submit-cookie>`_.
On first page load of the UI, the login page or the recovery page, a ``csrf_token_P<port>`` or ``csrf_token_P<port>_R<root>`` cookie is set
that can be read via client-side JavaScript. All requests towards the API that are not ``GET``, ``HEAD`` or ``OPTIONS``
and rely on cookie based authorization (so not on an API key but rather an active login session) are required
to send both the ``csrf_token`` cookie as well as an ``X-CSRF-Token`` header containing its value.
..note::
If you use the :ref:`JS Client library <sec-jsclientlib>`, this will take care of doing the needful for you. Any code in the *Core UI* calling
API functions through ``$.ajax`` or ``$.get`` or ``$.post`` will also take care of this for you. If you use another library for
accessing OctoPrint's API in a browser context, you'll need to make sure to send the ``X-CSRF-Token`` header yourself. Examples for
several JS frameworks can be found in the `OWASP cheatsheet on CSRF attacks <https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#javascript-guidance-for-auto-inclusion-of-csrf-tokens-as-an-ajax-request-header>`_.
Take a look at the implementations of ``OctoPrintClient.getCookie`` and ``OctoPrintClient.getHeaders`` in ``src/octoprint/static/js/client/base.js``
for details on how to retrieve the cookie value and how to construct the header.
*``update_folder`` or ``checkout_folder``: (mandatory) The working directory.
@@ -551,7 +560,7 @@ Global credentials
..versionadded:: 1.5.0
Starting with OctoPrint 1.5.0, the Software Update Plugin supports supplyting a GitHub
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>`_
* `Python 3.7<https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
* `Latest stable Python 3 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
*`Git <https://git-scm.com>`_
* Checkout the OctoPrint sources from their Git repository:
@@ -24,15 +24,15 @@ below.
* Enter the checked out source folder: ``cd OctoPrint``
* 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 venv3``
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 venv3``
e.g. ``virtualenv --python=/path/to/python3/bin/python venv``
* Activate the virtual environment: ``source venv3/bin/activate`` (Linux, macOS) or ``source venv3/Scripts/activate`` (Git Bash under Windows, see below)
* 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:
@@ -57,34 +57,12 @@ When the virtual environment is activated you can then:
* run the test suite from the checked out source folder via ``pytest``
* trigger the pre-commit check suite manually from the checked out source folder via
``pre-commit run --hook-stage manual --all-files``
* rebuild ``.css`` files from ``.less`` sources. See ``octoprint dev css:build --help``
* build the documentation running ``sphinx-build -b html . _build`` in the ``docs``
folder -- the documentation will be available in the newly created ``_build``
directory. You can simply browse it locally by opening ``index.html``
If a Python 2 environment is also desired (e.g. for maintenance reasons), also do the following extra steps:
* Prerequisites:
* `Python 2.7 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
* Create a virtual environment in the checked out source folder for Python 2: ``virtualenv --python=python2 venv2``
.. note::
This assumes that the ``python2`` 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/python2/bin/python venv2``
* Activate the virtual environment: ``source venv2/bin/activate`` (Linux, macOS) or ``source venv2/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]'``
* check whether there are newer versions of OctoPrint's dependencies available via
``python setup.py scan_deps``
.._sec-development-environment-source-linux:
@@ -94,14 +72,14 @@ Linux
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
First make sure you have python 2 and 3 including their header files, pip, setuptools, virtualenv, git and some build requirements
First make sure you have python 3 including its header files, pip, setuptools, virtualenv, git and some build requirements
installed:
* On apt based distributions (e.g. Debian, Ubuntu, ...):
If a Python 2 environment is also desired, then also download and install
*`Python 2.7.18 MSI installer <https://octoprint.org/files/python-2.7.18.msi>`_ (mirrored on octoprint.org)
* it's recommended to install Python 2.7 into ``C:\Python27`` - if you select
different install locations please substitute accordingly
* it's also recommended to install for all users
*`Microsoft Visual C++ Compiler for Python 2.7 <https://octoprint.org/files/VCForPython27.msi>`_ (mirrored on octoprint.org)
Then:
..code-block::none
cd /c/Devel/OctoPrint
virtualenv --python=C:\Python27\python.exe venv2
source ./venv2/Scripts/activate
python -m pip install --upgrade pip
pip install -e '.[develop,plugins]'
.._sec-development-environment-windows-optional:
Optional but recommended tools
@@ -248,12 +178,6 @@ Mac OS X
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 and 3 environments during development. Please send a
`Pull Request <https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
@@ -266,11 +190,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:
*``reason``: the reason for the error, one of ``firmware``, ``resend``, ``resend_loop``, ``timeout``,
``connection``, ``start_print``, ``autodetect`` or unset.
*``consequence``: What was done as a consequence of that error. ``emergency`` if an ``M112`` emergency stop was sent
and the connection to the printer closed, ``disconnect`` if the connection was just closed, ``cancel`` if the ongoing
print job was cancelled. Might also be missing if nothing happened as a consequence.
In case of errors with reason ``firmware``, the following additional fields might be present in the payload:
*``faq``: a link to the FAQ entry for the error
*``logs``: the last lines from the communication log
PrinterStateChanged
The state of the printer changed.
@@ -220,8 +235,10 @@ Upload
*``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 the file will immediately be selected, as requested on the API by the corresponding parameter
*``print``: whether the file will immediately start printing, as requested on the API by the corresponding parameter
*``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
@@ -239,6 +256,7 @@ FileAdded
*``name``: the file's name
*``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]``
*``operation``: the operation that triggered the event, either ``add``, ``copy`` or ``move``.
..note::
@@ -256,6 +274,7 @@ FileRemoved
*``name``: the file's name
*``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]``
*``operation``: the operation that triggered the event, either ``remove`` or ``move``
..note::
@@ -263,6 +282,26 @@ FileRemoved
..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.
@@ -292,6 +331,22 @@ FolderRemoved
..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.
@@ -481,6 +536,8 @@ PrintCancelled
*``position.f``: last feedrate for move commands **sent through OctoPrint** (note that if you modified the
feedrate outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will
NOT be accurate)
*``fileposition``: position in the file in bytes at the time of cancellation
*``progress``: print progress as a percentage at the time of cancellation
..deprecated:: 1.3.0
@@ -512,6 +569,8 @@ PrintPaused
*``position.f``: last feedrate for move commands **sent through OctoPrint** (note that if you modified the
feedrate outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will
NOT be accurate)
*``fileposition``: position in the file in bytes at the time of pausing
*``progress``: print progress as a percentage at the time of pausing
@@ -110,7 +110,7 @@ The subnet to use is usually the IP address range of your LAN, which sounds scar
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:
On OctoPi (or another Linux distribution) you can use the following command:
..code-block::
@@ -133,7 +133,7 @@ Example: Your PC has an IP address of ``192.168.23.42`` and a subnet mask of
The easy way: Using the OctoPrint-AutoLoginConfig plugin
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
OctoPrint's plugins are `Python Packages <https://docs.python.org/2/tutorial/modules.html#packages>`_ which in their
OctoPrint's plugins are :ref:`Python Packages <tut-packages>` which in their
top-level module define a bunch of :ref:`control properties <sec-plugins-controlproperties>` defining
metadata (like name, version etc of the plugin) as well as information on how to initialize the plugin and into what
parts of the system the plugin will actually plug in to perform its job.
@@ -35,10 +35,23 @@ any :ref:`settings overlays <sec-plugins-controlproperties-plugin_settings_overl
On disabling a plugin, its hook handlers, helpers, mixin implementations and settings overlays will be de-registered again.
When a plugin gets enabled, OctoPrint will also call the :func:`on_plugin_enabled` callback on its implementation
(if it exists). Likewise, when a plugin gets disabled OctoPrint will call the :func:`on_plugin_disabled` callback on
its implementation (again, if it exists).
Some plugin types require a reload of the frontend or a restart of OctoPrint for enabling/disabling them. You
can recognize such plugins by their implementations implementing :class:`~octoprint.plugin.ReloadNeedingPlugin` or
:class:`~octoprint.plugin.RestartNeedingPlugin` or providing handlers for one of the hooks marked correspondingly.
For these plugins, disabling them will *not* trigger the respective callback at runtime as they will not actually
be disabled right away but only marked as such so that they won't even load during the required restart.
..image:: ../images/plugins_lifecycle.png
Note that uninstalling a plugin through the bundled Plugin Manager will make a plugin first get disabled and
then unloaded, but only if it doesn't require a restart. Plugins wishing to react to an uninstall through the
Plugin Manager may implement :func:`~octoprint.plugin.types.OctoPrintPlugin.on_plugin_pending_uninstall` (added in OctoPrint 1.8.0) which will always be called by the Plugin Manager,
regardless of whether the plugin requires a restart of OctoPrint to be fully uninstalled or not. Please be aware
that the Plugin Manager is not the only way to uninstall a plugin from the system, a user may also uninstall it
manually through the command line, circumventing Plugin Manager completely.
Once your plugin is available in the official plugin repository, you probably want to create and distribute new versions.
For "beta" users you can use the manual file distribution method, or a more elegant release channels (see below).
After you finalized a new plugin version, don't forget to actually update the version in the ``setup.py``,
and `submit a new release on github <https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository#creating-a-release>`_.
Once your plugin is available in the official plugin repository, you probably want to create and distribute new versions.
For "beta" users you can use the manual file distribution method, or a more elegant release channels (see below).
After you finalized a new plugin version, don't forget to actually update the version in the ``setup.py``,
and `submit a new release on github <https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository#creating-a-release>`_.
After you published the new release, you can verify it on your installed octoprint,
with force checking the updates under the advanced options (in the software updates menu in the settings).
After you published the new release, you can verify it on your installed octoprint,
with force checking the updates under the advanced options (in the software updates menu in the settings).
The new versions will appear to the plugin users in the next 24 hours (it depends on their cache refreshes).
The `Software Update Plugin <https://docs.octoprint.org/en/master/bundledplugins/softwareupdate.html#>`_ has options to define multiple release channels,
The `Software Update Plugin <https://docs.octoprint.org/en/master/bundledplugins/softwareupdate.html#>`_ has options to define multiple release channels,
and you can let the users decide if they want to test your pre-releases or not.
This can be achieved with defining ``stable_branch`` and ``prerelease_branches`` in the ``get_update_information`` function,
This can be achieved with defining ``stable_branch`` and ``prerelease_branches`` in the ``get_update_information`` function,
and creating github releases to the newly configured branches too.
For more information you can check the `Software Update Plugin documentation <https://docs.octoprint.org/en/master/bundledplugins/softwareupdate.html#version-checks>`_
For more information you can check the `Software Update Plugin documentation <https://docs.octoprint.org/en/master/bundledplugins/softwareupdate.html#version-checks>`_
or read a more step-by-step writeup `here <https://github.com/cp2004/OctoPrint-Knowledge/blob/main/release-channels.md>`_.
Loaded 100 of 641 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.