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
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.
events > subscriptions[] > event may be either a string (existing
functionality) or now a list of strings. If a list, the subscriptions
are treated the same for each event in the list.
To make it possible for command subscriptions to determine which event
was triggered, a {__eventname} substitution has been added.
While long term we want to have unicode here, the rest of the code
is not even remotely prepared for handling utf-8 strings as visible in
the large amount of unicode issues visible in sentry.
So for now we go back to byte objects and fix#3091 differently
We know that python 2.7 is about to reach end of life. We are making
preparations for this in the devel branch. We don't need pip going
around and alarming our users about something they cannot solve, and
which pretty much is already solved anyhow.
So we nuke this stupid message present in current pip versions. Hard.
See also #2988
We are only interested in
* Exceptions that are
* logged either in octoprint.* or tornado.* and not from third party
plugins or unhandled
Implements #3094
It was causing a ton of issues with backend code using `Settings.save`
to persist changes outside of REST API calls, triggering configuration
update dialogs in the frontend way too often and when not needed.
Added a flag instead to cause the `save` method to trigger an event and
setting that to False by default. Settings REST API uses it, other
callees in e.g. plugin code will be able to as well in the future if
necessary.
It would be cleaner to always trigger this event and adjust calling code
and frontend code to compensate, but with third party plugins out there
this is not going to happen reliably so we go this route.
It's no longer installable from source under OctoPi 0.14 due to an
unpinned setup_requires dependency on setuptools_scm, and since we still
have to support that installation scenario that is a problem. Thankfully
it's only used in the plugin manager for parsing the notice date, and
we can just use datetime.strptime for that.
With the inclusion of the ForceLogin plugin that doesn't serve a real
purpose anymore in most cases, and it was only ever more of a rate
limiting feature than an actual security measure anyhow. Plus it lead to
a ton of false security alarms along the lines of "OMG UI_API_KEY IN THE
SOCKET HANDSHAKE, PWNED!!1!".
On stock installations, the behaviour will be unchanged since the
ForceLogin plugin prevents any kind of API access without authentication
that isn't the login request itself, including access to blueprint
plugin endpoints that do not specify that they are unprotected.
If a user decides to disable the ForceLogin plugin but keep access
control enabled, anonymous API access will now be possible without API
key or the need to fetch the current UI API Key from the server via the
websocket or the source code of the index page. This is a change
compared to earlier behaviour, but with a very limited impact as as
mentioned the UI API Key was so far also easily obtainable either via
the websocket or by parsing a fresh copy of the HTML page.
If the user decides to disable access control, there's no change
compared to previous behaviour.
Disabling the API - which was so far the only real use case for having
the UI API Key in the first place apart from basic rate limiting - has
also been removed. Allowing this only made things horribly complex as
the default frontend fully depends on the API's availability. Users
who do not wish third parties to have access to the API should
simply leave the ForceLogin plugin enabled.
Chamber temperatures reported via M105 will only be parsed if the
fw reports chamber capabilities (through Cap:CHAMBER_TEMPERATURE:1) or
the currently selected printer profile has a heated chamber configured.
This is to avoid incompatibility issues with firmware variants that
might already use the C parameter for something else (which might be the
case since we don't have a reliable well defined standard that people
need to adhere to...)
Chamber temperature commands M141 and M191 will only be allowed to be
sent if the selected printer profile has a heated chamber configured.
This mirrors the behaviour for the bed temperature commands M140 and
M190 and heated bed configuration.
Display of chamber data in the graph will only happen if the printer
profile has a heated chamber configured.
Implements one workflow behind #321
Instead of a boolean option to block sending of M0 *and* M1 and
hardcoding them and M25 to pause an ongoing print, we now have two lists
for blocked commands and pausing commands respectively.
Blocked by default: M0 and M1.
Pausing by default: M0, M1 and M25.
Implements #2970
-4 or --ipv4 will behave as if "--host 0.0.0.0" (or any other specific
v4 address) was supplied and only bind the server socket to v4. It will
be ignored if a v6 address is set to bind to.
-6 or --ipv6 will only bind the server socket to v6 instead of dual
stack on both v4 and v6. It will be ignored if a v4 address is set to
bind to.
Implements #2904
Improves performance of file manipulation, especially in cases with a
lot of files in the folder, without the added complexity of fully
decoupling metadata file serialization from general processing.
Better fix for #3057
Makes more sense than putting them into sys.modules as <identifier>,
which also can cause conflicts (e.g. in the case of octoprint.plugins
.logging which then suddenly gets found instead of the built-in crucial
logging module).
After two days of trying to make the plugin loading work completely,
including loading bundled templates etc, using only native importlib
methods, I've finally given up and bundled the (deprecated) imp module
for Python 3+ which relies on importlib but does some magic I've yet to
figure out which makes stuff just work.
Replacing imp completely with something more slim is something for
another day, for now we want to get stuff to work under Py3 with as
little warnings as possible.
Adding a plugin's identifier to the list plugins._forcedCompatible in
config.yaml will make OctoPrint ignore its python compatibility status,
e.g.
plugins:
_forcedCompatible:
- myplugin
This might be helpful for plugin authors during development but should
NOT be used in production!
See also #2722
We could also have set ALLOW_UNICODE globally, but this way we might
catch situations where we definitely do not expect mixed results between
py2 and py3.
If selected, the current layer is drawn at 30% opacity and then the progress is drawn over the top at 100%
Added additional checkbox on GCodeView page to include current layer as preview
The current 2.7 Python binary on Debian returns "2.7.15+" as its version, which
is not PEP440 compliant. Tthere is no feedback at all from Debian maintainers
regarding the bug report as of now:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914072
This patch makes sure to drop any trailing '+' character in a version string.
Fixes#3049
It lives on as curalegacy at
https://github.com/OctoPrint/OctoPrint-CuraLegacy
which will be added to the plugin repository once the first RC of 1.3.11
lands.
Due to this change, the general handling of STL files has also changed
slightly. They will no longer be supported by upload out of the box
unless a SlicerPlugin is available (which will now by default extend the
extension tree with STL files, unless overwritten). As a consequence of
that the file type filters in the file list have also been adjusted to
only show up if there are additional file types to filter for.
Also make sure that our environment specific dependencies get recorded
to the wheel so that we don't have to build in the same environment as
the software will run later (consider this work towards a PyPI release
that might also be backported).
* When no plugins are installed, backup does not create a
plugin_list.json file.
* Restore then fails when it tries to read the missing file.
* Add check to ensure plugin_list.json exists before restoring
from backup.
That's normal for plugins that were installed as eggs instead of wheels
and we don't want to raise the error in this case. If we also don't find
egg metadata we'll log a warning anyhow.
Any other exceptions will be raised though.
Normally I'd say, broken files are broken files, but since in case of an
encoding error in config.yaml the server won't come up anymore we are
erring on the side of caution here and running with errors="replace"
The general consensus regarding codecs.open appears to be that it's only
left in Python 3 for backwards compatibility (which I find kind funny
but I digress...) and that io.open should be used instead for Py2.6+
since it's available and behaving the same in both versions. So that's
what we do here.
NamedTemporaryFile doesn't support the encoding parameter under py2.
However, without it specifying text mode defaults to ascii, causing some
issues especially with config files containing utf-8.
By swapping NamedTemporaryFile for mkstemp and a custom io.open call
(parameterized according to the open mode) we can support a proper
encoding aware atomic_write.
Admin only access by default for these was implied by not having them
added to one of the three major default groups, making it explicit is
more clear though.
That way we can easily provide a Read Only group that allows read-only
access and which can then be added to the Guest group by users who
desire anonymous read-only access, similar to disabling the forcelogin
plugin in 1.3.10+
No events are about to be removed in 1.4.0, only the payload fields
marked as deprecated. And for some reason ReST doesn't appear to allow
including that piece of information within the `deprecated` directive,
so now we have a slightly different way of expressing it...
Necessary requests were wrongfully denied after initial setup of a user
account due to hasBeenCustomized still being used and its deprecated
wrapper wrapping the always False implementation in the UserManager base
class instead of the adjusted one in the FileBasedUserManager. Evil bug.
where required. At some places it's not.
Also, "if foo in some_dict.keys()" is unnecessarily slow.
Replaced with "if foo in some_dict".
I left "for key in some_dict.keys()" alone;
"for key in some_dict" is equivalent but not always obvious.
Should no longer match lines like
FIRMWARE_NAME:Marlin 1.1.7-C2 (Github) SOURCE_CODE_URL:https://github.com/Robo3D/Marlin-C2 PROTOCOL_VERSION:C2 MACHINE_TYPE:RoboC2 EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff EMERGENCY_CODES:M108,M112,M410
but should pass unit tests.
Fixes#2945
Should no longer match lines like
FIRMWARE_NAME:Marlin 1.1.7-C2 (Github) SOURCE_CODE_URL:https://github.com/Robo3D/Marlin-C2 PROTOCOL_VERSION:C2 MACHINE_TYPE:RoboC2 EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff EMERGENCY_CODES:M108,M112,M410
Fixes#2945
Allow configuration of whether to enable the plugin if firmware support
is detected, always or never. Handle PROMPT_SUPPORT capability report
accordingly.
See MarlinFirmware/Marlin#12982
Note: Has to be enabled manually for now as long as we cannot detect
that the firmware indeed has support for M876 and hence has it as part
of the EMERGENCY_PARSER.
See MarlinFirmware/Marlin#12982
These are never what we want, as they swallow KeyboardInterrupt.
TODO: many of these handlers really should be more specific and/or
log that they replaced an unparseable value with a default.
Currently uses a sponsored sentry instance on sentry.io. Error tracking
is disabled by default and currently still has to be enabled through
manual configuration in config.yaml (plugins.errortracking.enabled=true)
So far we only checked for keys or auth headers on the API, the plugin
so far only checked if there was an existing cookie via a passive login.
Now it will try to login the user from any provided api keys or
authorization headers as well and only fall back to the passive login if
that doesn't succeed. A call to the frontend with either will thus not
trigger the login dialog.
See #2997
If an M27 to query SD status came after the change of state to printing
but before the M24 to actually start the print on the printer's side the
firmware would report "Not SD printing" and OctoPrint would consequently
cancel the just start job right away.
This patch introduces a new "Starting" state that will be active while
preparing a print job (in case of SD: selecting the file, setting file
position & finally starting the print). The comm layer treats as
nearly identically to the Printing state, the only difference is in the
treatment of received "not sd printing" messages which will be ignored
while still Starting.
Additionally this patch introduces a "two strikes rule" for "not sd
printing" messages (which can be configured to be another number of
strikes). Only if OctoPrint receives two consecutive "not sd printing"
messages from the printer will it actually cancel the printer. This is
to work around a potential (albeit very very unlikely) race condition
that still exists even with the starting state.
Fixes#3001
There was still some redundancy due to how SD upload so far was
implemented. Things are now better reusable from hooks.
Also fixed the problem that OctoPrint would *always* use the first hook,
whether it actually handled the upload or not.
Adds print job owner (= user who selected/started a job) and user who
started/paused/resumed/cancelled a job to the print job events as
applicable.
Also added logging of print job events to octoprint.log with this
information.
Plugins can use the event data for further logging or tracking.
Implements #2982
I would have preferred it to just depend on the default styling of
search type inputs in browsers, which at least on Webkit and IE will add
a clear button automatically, but Firefox doesn't add one and the
corresponding ticket [1] also doesn't look like that will change soon.
So a custom implementation it is. Hooray.
Implements #2983
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=558594
Currently write timeouts are not really implemented (as they are set to 10000 seconds). The current code also has the unwanted side effect of casuing the use of a select call (in the Linux PySerial library) even when a write does not need to block. This call to select can in some odd cases cause the write to block for the duration of the set timeout which in turn triggers a transmission error. See issue https://github.com/foosel/OctoPrint/issues/2996
This change addresses both issues by allowing the use of the existing write retry code to handle timeouts and by using non-blocking write mode to avoid the use of select.
Users get too confused by the warning the lack of it generates on plugin
installs/uninstalls and updates of any kind through pip. An FAQ entry
on that matter hasn't helped, so we are now pulling out the nuclear
option to reduce support overhead.
Implements #2988
with responsive plugins like TouchUI, all of the pages render on mobile just fine.. except the login page. I was tired of scrolling much wider than my phone's display to make it show up, so I did some investigation. Turns out it was just missing the meta viewport.
Even if a user doesn't have a uuid at startup, they might enable tracking later and .. then a uuid isn't created until the next startup. For this reason and others, we shouldn't pass None to sha.update. Also, by adding a 'uuid missing' string to the log post, we can now track how many instances are missing a uuid for some reason. (though these may show now as a uuid of 'None').
If you have an ancient setuptools, 4a36ddb3aa
won't successfully prevent installing. These changes will at least give a sane error,
rather then just barfing on random syntax errors due to the `unicode` type not
being present in py3k.
Cherry picked from 2f20f2d
That will give us an idea if the current hypothesis that quite a number
of people are shutting down their instance at night is correct or not,
which in turn will inform future startup optimizations.
Otherwise if tracking is disabled we still do the work and then throw
it away, which is kinda stupid.
Also fixes potential issues with using things like the unique_id when
it hasn't in fact been set due to disabled tracking.
Regardless how cold the temperature is, display it in the table. Some
people otherwise seem to think that OctoPrint "can't handle"
temperatures below 10°C and will blame it for MINTEMP errors triggered
in the firmware.
SyntaxError:Can't assign to function call
declared the dictionary using a diferent format that works in both py2 and py3
/src/octoprint/server/api/system.py", line 192
async=True,
^
SyntaxError: invalid syntax
Sadly the stupid file locking of windows makes it impossible to
hot swap the config directory. In order to support windows a two step
approach would be needed. Maybe at a later date, currently simply not
worth the effort tbh considering how seldomly windows is used as OS for
OctoPrint.
Making on_after_startup asynchronous unearths some odd issue that causes
subsequent callback calls to duplicate. It might just be PyCharm's
debugger (disabling it makes the problem go away and I so far couldn't
reproduce it without it), but just in the case that I introduced some
weird race condition with this _async approach I'm removing it. I'd
rather have badly implemented plugins break the startup then the startup
being inherently broken from the get go.
Added a couple more warnings in the docs though.
* spinners for the enable/disable buttons
* error handler for persisting the decision that unlocks the wizard
Might help to work around issues less than a hand full of people have
now observed where the wizard's buttons are non functional but the
wizard itself is active and blocking.
More data needed to reproduce and debug the core issue though.
To work around some ad blockers that might block this otherwise - which
is kinda funny since the js file doesn't do any tracking, it just
makes the setup wizard for the opt-in functional 🤦♀️
- add a way to get the raw value only from throttle state (glad I already plumbed it into the object!)
- add warning about not sending uuid, modify the log entry too
- weave the throttle_state through pi_support and tracking. This should come in handy to see how many throttled Pis are out there, as well as if it is correllated with canceled prints.
- upgraded disclosure of tracking information so it shows as INFO-level in the logs and all the information is dumped. If tracking.octoprint.org gets it, I should have it too :)
This reverts commit 4ed5f7e
The updates cause issues on very old python environments (distribute
instead of setuptools, e.g. OctoPi 0.12) due to new package formats.
We'll postpone them to 1.3.11, since OctoPrint 1.3.10 will then refuse
to upgrade in such environments anyhow.
Apparently socket.has_ipv6 doesn't actually do what it says in the docs
(state whether the underlying platform supports ipv6). It returns True
even when ipv6 has manually been disabled for whatever reason. So we
will no longer trust this but instead attempt to actually create a v6
socket and only if that succeeds assume that v6 is indeed supported on
the platform.
`octoprint_setuptools` is imported into the build before the dependencies are installed, hence we don't have `past.builtins` yet. Since the `basestring` type was only needed for some asserts here that *usually* shouldn't be needed we can just comment out that stuff for now.
Some prepwork for py3. Tossing these together:
- assertItemsEqual doesn't do what it says on the box. It only said "hey, these lists have the same number of items". Not content or anything. Changing that to SetEqual, which is much closer to what is wanted- ensuring that lists have the same content without caring about their order.
- use assertRaises instead of try/catch
- update some mocks, especially mock_open.
- include the refactored test_get_recovery_data sent to the maintenance branch in #2806.
Try python3 import & revert back to python2 if ImportError is raised
this include BaseHttpServer -> http.server, StringIO -> io, HTMLParser -> html.parser
* are not directly iterable
* doesn't work with len() function
* doesn't allow list concatenation
This commit wraps all relevant map/filter outputs into a list object type
Snapshot test threw a 500 Internal Error.
After some investigation (no exception got thrown, except in debug mode) I noticed that the test url function tried to access octoprint util which was not imported.
Because util was used in different locations of this function I decided to put it at the top of the function right after import requests.
We now support adding other permissions to Permissions on creation, so
there's no need for this anymore.
Adjusted plugin permission addition accordingly by merging "regular" and
"combined" types.
Migrated log download permission.
Fixed some stuff here and there that I can't remember right now.
For issue @485
Added progress bar to the Timelapse tab between the settings and files
Added code to process the output of ffmpeg and compute a percentage
Added code to communicate the percentage from the server to the client
Added myself to the authors
Changed tests to reflect new loglevel
* permissions and groups are now optional fields on users - if not
provided, will be set to empty permissions and default groups
* description is now an optional field on groups - if not provided
will be set to an empty string
* Made the group manager a bit leaner
* Removed code duplication for group and user editor
* OctoPrint.access.groups.update now takes an object just like the add
method - this enables to do partial updates and also is way easier
to remember
* Some bugs fixed
* Added wrappers for the old add/remove/changeRolesForUser methods -
just a simple rename is not correct since those took roles, not
permissions. Needs some tests, haven't been able to do that yet.
The socket client will now authenticate with the socket after login,
using the session id from the login response. This will associate the
session with the socket server side. Any messages to the client apart
from "connected" and "reauthRequired", will be checked against the
STATUS permission and not be sent if that is missing from the current
user (which might also be the anonymous/guest user).
A logout of the session and any changes of the user or their permissions
will trigger trigger a reauthRequired message to be sent over the
socket, instructing the client to either perform a new passive login to
update the user's permissions, or to logout altogether (server side
logout or user removal).
Known bugs:
* Changing group permissions sometimes doesn't propagate through -
seems to be caused by the code not properly finding the login
sessions of affected users based on the changed group. Not yet sure
what's up there.
Open points:
* Deactivation of a user's account also needs to invalidate the
session
* Session timeout needs to be evaluated (currently 30min, unclear if
that suffices)
* possibly more I can't think of right now
Old behaviour of insisting on API key presence for each and every
request can however still be enforced.
Making this part of the granular permission system epic since only then
will people be able to more finely tune what data will be available for
anonymous users.
Solves #1681
We only want to initialize it when the graph is actually visible. For
this we hook into tab changes, user changes and StartupComplete. That
will hopefully ensure that once it DOES become visible it will get
initialized, but not before.
If we have logged out or passive login failed, that way we'll still get
the needs of the anonymous user. One less GET request to make from the
frontend which also means one less potential race condition during
initialization.
* We now use a set key (derived from name used for setting the
attribute on Permissions or provided in permission definition from
plugins)
* We do a multipass resolution of combined plugin permissions (the
former approach was limited to two passes)
We also do logging on the permissions added through plugins. Also did
some code deduplication while at it.
* Removed PermissionsManager and merged functionality of that into
Permissions class
* Decoupled GroupManager from UserManager
* Renamed some things for less redundancy
* Removed unused YAML conversion methods
* Stricter differentiation between Manager parent class and concrete
implementations
* Marked broken tests as skipped and broken, separated them further
and added some
Also includes not throwing that data away in users.yaml - we don't want
to prevent people from switching back and forth between 1.3.x and 1.4.0
during the RC period (or ourselves during development ;)), so we need to
stay backwards compatible here at least until 1.5.0.
- Fixed a forgoten refactoring inside the first run wizard
- Added possibility to also throw a warning when deprecated JavaScript Variables are used
- Therefore made the whole deprecation logging a bit more generic, so it will be easy to reuse it in the future
- Reintroduces the "deprecated" USER_ARRAY as a non deprecated array, so we have a central place where we can adjust the permissions for users (only valid for first run and creating the user group on migration)
- User group will be created on first run now and when migrating from an older version
Removed the Enabled stuff from Permissions and Groups, because both have an always on requirement
Fixed a wrong Permission
Moved the previously splitted javascript access client back into one file
Combined users, permissions and groups as access.users, access.permissions and access.groups
Many refactorings inside the javascript part
Added general javascript deprecated function, logs a message to the javascript console
Adjusted the user add and edit modals to recenter themself when uncollapsing the groups and/or permissions sections
* UserSettings: crashed if overwrite an existing key with primitive value by same key with complex value. Also reduced number of calls to user.get_setting()
* Updated tests
We have our own cache, and that would get confused by not
allowing a reload of the templates at runtime, which Flask 0.11+
will not allow anymore unless this setting is set to True.
Logs a deprecation warning when any of the made-property fields is
accessed as a getter and return value. Implements __eq__, __ne__,
__bool__ and __nonzero__ to allow things like "user.is_anonymous ==
True" or "not user.is_anonymous" is used.
Careful with serialization to json, needs "bool(...)" wrapper to not
cause an exception (or inclusion in a custom serializer).
Affected fields:
* is_anonymous
* is_authenticated
* is_active
* is_user
* is_admin
To be removed again in OctoPrint 1.5.0
Logs a deprecation warning when anything from flask.ext is accessed,
imports flask_<name> instead and returns it.
To be removed again in OctoPrint 1.5.0
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
@@ -125,17 +125,17 @@ following section *completely* and also follow the instructions in the
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://discourse.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 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
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,8 +152,8 @@ 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
discourse.octoprint.org, NOT here.
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
reports fully fill out the bug reporting template (if you don't know
@@ -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.
@@ -195,7 +195,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.
@@ -275,11 +275,11 @@ all requested information or your ticket will be closed.
### Where can I find which version and branch I'm on?
Please refer to [this FAQ entry](https://discourse.octoprint.org/t/how-can-i-find-out-the-version-of-octoprint-or-octopi-i-am-running/204/1).
Please refer to [this FAQ entry](https://community.octoprint.org/t/how-can-i-find-out-the-version-of-octoprint-or-octopi-i-am-running/204/1).
### Where can I find those log files you keep talking about?
Please refer to [this FAQ entry](https://discourse.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299/1).
Please refer to [this FAQ entry](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299/1).
### Where can I find my browser's error console?
@@ -287,9 +287,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,12 +298,13 @@ 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
[forums](https://discourse.octoprint.org/c/development)** first so
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
heavy changes to the code locations you'd target as well, or your
@@ -310,19 +312,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 +336,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 +389,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 +424,12 @@ 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`
## 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).
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
The community forum is available at [discourse.octoprint.org](https://discourse.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).
@@ -26,21 +34,21 @@ The official plugin repository can be reached at [plugins.octoprint.org](https:/
**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
[the community forum at discourse.octoprint.org](https://discourse.octoprint.org) where there are other active users who might be
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
[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 discourse.octoprint.org](https://discourse.octoprint.org)
[official documentation](http://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
* Andrew Moorby
* Arnljot Arntsen
* Ash King
* BigTreeTech
* Boris Hussein
* Brad Jackson
* Brian E. Tyler
* BuildBee
* Christian Petropolis
* Christian Wolf
* COLLE+McVOY
* D Brian Kimmel
* DeltaMaker 3D Printers
*E3D BigBox
*Dennis Breining
* Eric Betts
* Ernesto Martinez
* F. Kunsmann
* Frank Sander
* Franziska Kunsmann
* George Robles
*günter weber
* Hydra Research LLC
*James Seigel
*Jeff Moe
*Jeff Renfer
*Greg Holloway
* Hog Duske
*Hopewell Medical Acupuncture Center
*Hugh Blemings
*jean-claude migneault
* Jefferson Hunt
* Jeremiah Avery
* Joseph Payne
* Josh Daniels
* Jeremy Cole
* Joe Pasqua
* John Gregory Robinson
* Joshua Wills
* Justin Kaufman
* Kaile Riser
* Kale Stedman
* Kazuhiro Ogura
* Kodama Inc.
*Lewis Newby
*LulzBot®
* Kelly C McNiece
*Kenneth Jiang
*Kurt Wubbels
* Kyle Menigoz
* LA 3D Printer Repair
* Lee Dohm
* Loyal Moses
* Makespace Madrid
* Mark Walker
* Martin Beattie
* Michael Aumock
* Michael Begala
* Miles Flavel
*mitchell hirsch
* Noe Ruiz
*Mosaic Manufacturing
* Neil R. Goldberg
* Patrick Glyré
* Patrick McGinnis
* Prof Yuh Wen Chen
* Raise3D
* Randy C. Will
* Ranjib Dey
* Richard McGuire
* Richard Michaud
* Rigid3D
* Robert Gusek
* Roger Strolz
*Roy Cortes
*Rudolff Vang
* Samer Najia
* Simon Hallam
* Ronald Griehsler
*Sacha Telgenhof
*Sebastien Andrivet
* Stefan Krister
* Steve Thompson
* Sven Mueller
*Symbiotic Devices
* Thomas Hatley
* Timothy D Hoogland
* Trent Shumay
*Ulrich Kempken
and 1351 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 2107 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.
All system operations require the ``SYSTEM`` permission.
.._sec-api-system-command-list:
@@ -20,6 +20,8 @@ List all registered system commands
A :http:statuscode:`200` with a :ref:`List all response <sec-api-system-commands-listall>`
will be returned.
Requires the ``SYSTEM`` permission.
**Example**
..sourcecode::http
@@ -38,30 +40,21 @@ List all registered system commands
{
"action": "shutdown",
"name": "Shutdown",
"command": "sudo shutdown -h now",
"confirm": "<strong>You are about to shutdown the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"confirm": "<strong>You are about to reboot the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"confirm": "<strong>You are about to restart the OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
@@ -99,30 +92,21 @@ List all registered system commands for a source
{
"action": "shutdown",
"name": "Shutdown",
"command": "sudo shutdown -h now",
"confirm": "<b>You are about to shutdown the system.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"confirm": "<strong>You are about to shutdown the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"confirm": "<b>You are about to reboot the system.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"confirm": "<strong>You are about to reboot the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"confirm": "<b>You are about to restart the OctoPrint server.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"confirm": "<strong>You are about to restart the OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
After this has completed, you'll find your shiny new build of CuraEngine in
the `build` folder (full path for above example:
``~/CuraEngine/build/CuraEngine``).
.._sec-bundledplugins-cura-configuring:
Configuring the plugin
----------------------
The Cura plugin needs to be configured with the full path to your copy of the
CuraEngine executable that it's supposed to use. You can do this either via
the Cura plugin settings dialog or by manually configuring the path to the
executable via ``config.yaml``, example:
..code-block::yaml
plugins:
cura:
cura_engine:/path/to/CuraEngine
.._sec-bundledplugins-cura-profiles:
Using Cura Profiles
-------------------
The Cura Plugin supports importing your existing profiles for Cura **up to and
including Cura 15.04.x**. Newer Cura releases (e.g. 15.06 or 2.x) use a different
internal format that will *not* work with the current version of the Cura Plugin.
You can find downloads of Cura 15.04.x for Windows, Mac and Linux `on Ultimaker's download page <https://ultimaker.com/en/products/cura-software/list>`_.
In order to export a slicing profile from the Cura desktop UI, open it,
set up your profile, then click on "File" and there on "Save Profile". You can
import the .ini-file this creates via the "Import Profile" button in the
Cura Settings within OctoPrint.
.._sec-bundledplugins-cura-sourcecode:
Source code
-----------
The source of the Cura plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/cura``.
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
@@ -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 supplyting 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
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 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.
@@ -146,12 +207,14 @@ You'll need a user account with administrator privileges.
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,194 @@ 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
Loaded 100 of 742 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.