Compare commits

..
Author SHA1 Message Date
Gina Häußge 67047c006c 🚨 Start to flesh out connection parameters 2019-06-06 16:43:06 +02:00
Gina Häußge 2d872baaec 🚧 connection profiles now load properly 2019-06-06 15:50:48 +02:00
Gina Häußge a412ff42cb 🚧 WIP: More work on the connection profiles 2019-05-31 17:53:45 +02:00
Gina Häußge 06cd4ead8d 🚧 Support adding & updating connection profiles 2019-05-24 17:18:35 +02:00
Gina Häußge 13995e30b7 🚧 Introduce connection profiles 2019-05-24 16:30:22 +02:00
Gina Häußge 0d6d0f7256 🐛 Fix protocol/transport selection 2019-05-22 16:12:23 +02:00
Gina Häußge 1e8cb55be9 🐛 Fix script processing 2019-05-17 12:04:45 +02:00
Gina Häußge e63161ae17 ✨ Reset line numbers before all jobs 2019-05-16 17:40:12 +02:00
Gina Häußge f41dc58d97 ✨ Port part_of_job tracking & fix some bugs 2019-05-16 17:04:01 +02:00
Gina Häußge 522abbddbe ✨ Port various bits from old comm layer 2019-05-16 15:24:53 +02:00
Gina Häußge fecc162b5d ✨ Add "starting" state 2019-05-16 11:31:00 +02:00
Gina Häußge accb222a92 ✨ Support autodetection of klipper 2019-05-16 11:30:32 +02:00
Gina Häußge 0768e3e72b Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	src/octoprint/plugins/virtual_printer/virtual.py
#	src/octoprint/printer/standard.py
2019-05-16 11:30:11 +02:00
Gina Häußge 4b04e8fd79 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/plugins/forcelogin/templates/forcelogin_index.jinja2
2019-05-14 11:22:35 +02:00
Gina Häußge 2edd2ba887 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2019-05-14 11:21:19 +02:00
Gina Häußge fcef3a1bbd Merge branch 'staging/maintenance' into maintenance 2019-05-14 11:21:01 +02:00
Gina Häußge d1d24dba9a Merge branch 'rc/maintenance' into staging/maintenance 2019-05-14 11:18:37 +02:00
Gina Häußge 2c640ff8b8 🔖 Preparing release of 1.3.11 2019-05-13 13:52:32 +02:00
Gina Häußge 0331a25ae3 📝 Reflect API key changes in docs
Closes #3121
2019-05-13 12:55:25 +02:00
Gina Häußge 326422013a Merge pull request #3147 from esver/autofocus
Add autocofus to the username in the login plugin
2019-05-13 11:23:37 +02:00
Olivier Esver 9b4da62e69 Add autocofus to the username in the login plugin 2019-05-11 20:53:51 +02:00
Gina Häußge c0096c41a0 Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/cli/plugins.py
#	src/octoprint/events.py
#	src/octoprint/filemanager/__init__.py
#	src/octoprint/logging/__init__.py
#	src/octoprint/plugins/announcements/__init__.py
#	src/octoprint/plugins/appkeys/__init__.py
#	src/octoprint/plugins/forcelogin/__init__.py
#	src/octoprint/plugins/forcelogin/static/js/main.js
#	src/octoprint/plugins/forcelogin/templates/forcelogin_index.jinja2
#	src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
#	src/octoprint/plugins/printer_safety_check/__init__.py
#	src/octoprint/plugins/softwareupdate/__init__.py
#	src/octoprint/plugins/virtual_printer/virtual.py
#	src/octoprint/printer/__init__.py
#	src/octoprint/printer/estimation.py
#	src/octoprint/printer/standard.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/api/__init__.py
#	src/octoprint/server/api/settings.py
#	src/octoprint/server/api/system.py
#	src/octoprint/server/apps/__init__.py
#	src/octoprint/server/util/__init__.py
#	src/octoprint/server/util/flask.py
#	src/octoprint/server/util/sockjs.py
#	src/octoprint/server/views.py
#	src/octoprint/settings.py
#	src/octoprint/slicing/__init__.py
#	src/octoprint/static/js/app/helpers.js
#	src/octoprint/static/js/app/main.js
#	src/octoprint/static/js/app/viewmodels/settings.js
#	src/octoprint/static/js/app/viewmodels/temperature.js
#	src/octoprint/templates/dialogs/settings/accesscontrol.jinja2
#	src/octoprint/templates/dialogs/settings/api.jinja2
#	src/octoprint/templates/initscript.jinja2
#	src/octoprint/templates/tabs/control.jinja2
#	src/octoprint/timelapse.py
#	src/octoprint/users.py
#	src/octoprint/util/comm.py
#	src/octoprint/util/gcodeInterpreter.py
#	src/octoprint/vendor/sockjs/tornado/transports/rawwebsocket.py
#	src/octoprint/vendor/sockjs/tornado/transports/websocket.py
#	translations/messages.pot
2019-05-10 17:13:55 +02:00
Gina Häußge b46a66caa8 ♻ Slight refactoring... 2019-05-09 15:40:51 +02:00
Gina Häußge 6711813fef Merge pull request #3134 from tduehr/remote
Remote user support
2019-05-09 15:23:37 +02:00
Timur Duehr 7726e5c04e review fixes 2019-05-09 15:14:51 +02:00
Timur Duehr 495d99fbe9 Add support for remote users 2019-05-09 15:14:36 +02:00
Gina Häußge a35b7cddf2 🐛 Only add response text if there is one 2019-05-09 15:08:48 +02:00
Gina Häußge f2af5e8b86 💬 Change wording to reflect more potential error cases
Closes #3133
2019-05-09 14:59:00 +02:00
Gina Häußge 289c3a4d0f 🐛 Fix handling of Empty exception in send loop
Closes #3096
2019-05-09 13:39:56 +02:00
Gina Häußge 4cb67fe72c ☔ Don't allow NaN in generated JSON output on APIs
See also #3022
2019-05-08 17:52:27 +02:00
Gina Häußge b79fc94a4e ☔ Protect against NaN & Inf in GCODE
Also cleanup broken metadata entries that contain invalid json.

Fixes #3022
2019-05-08 17:49:53 +02:00
Gina Häußge fca626a3d6 ✨ Support tags on GCODE script hook
Also add `plugin:<plugin id>` to script parts from plugins.

Implements #3101
2019-05-08 16:55:18 +02:00
Gina Häußge f5a04973c4 🐛 Fix emergency codes not jumping queues
Fixes #3104
2019-05-07 15:10:18 +02:00
Gina Häußge 1c9ff91bae ♻️ Make emergency codes configurable 2019-05-07 15:09:41 +02:00
Gina Häußge e1e521300b 🐛 Only do autologin if not actively logged out
Fixes #3142
2019-05-07 13:11:33 +02:00
Gina Häußge c1e8bc717a 🐛 gcodeviewer: fix layers vanishing on rerender
Fixes #3143
2019-05-07 12:33:19 +02:00
Gina Häußge 22d7392769 🔊 gcodeviewer: Increase logging 2019-05-07 11:09:42 +02:00
Gina Häußge 904e7d2ecd 🐛 gcode viewer: do not invert axes
The axis inversion is only relevant to the control panel (depends on
how the print head is positioned), NOT the rendition of the GCODE.

Fixes #3137
2019-05-03 17:26:55 +02:00
Gina Häußge b3173386ae 🐛 modals: re-add missing minHeight support 2019-05-03 16:44:38 +02:00
Gina Häußge 1e3b8dfb2c Merge pull request #3131 from rfinnie/multiple-events
[Request] Allow subscriptions of multiple events
2019-05-03 16:08:46 +02:00
Gina Häußge 94d172ab67 Merge branch 'maintenance' into multiple-events 2019-05-03 15:57:50 +02:00
Gina Häußge 7dac6ca433 Merge pull request #3126 from jackwilsdon/toggle-search-filtering
Add option for disabling filters on search results
2019-05-03 15:32:51 +02:00
Ryan Finnie 9aeeb5fecc Allow subscriptions of multiple events
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.
2019-04-24 10:11:09 -07:00
Gina Häußge 52f65b469d Merge branch 'staging/maintenance' into maintenance 2019-04-24 16:29:20 +02:00
Gina Häußge 0843c0fbc7 📝 Reflect API key changes in docs
Closes #3121
2019-04-24 16:26:10 +02:00
Jack Wilsdon 11607fbc73 Add jackwilsdon to author list 2019-04-20 15:53:55 +01:00
Jack Wilsdon 1521b76090 Add option for disabling filters on search results 2019-04-20 15:24:06 +01:00
Gina Häußge a33a7b4d67 Merge branch 'staging/maintenance' into maintenance 2019-04-11 15:25:12 +02:00
Gina Häußge c00fdbf73b 🔖 staging/maintenance is now 1.3.11rc4.dev 2019-04-11 15:21:39 +02:00
Gina Häußge af32858549 🔖 Preparing release of 1.3.11rc3, part 2 2019-04-11 12:21:24 +02:00
Gina Häußge d1104ddbae 🐛 Fix file list refresh after SD list update 2019-04-11 12:14:59 +02:00
Gina Häußge e2519abbbe ✨ Add setting for exclusive comm port flag
Just in case there are issues with that on some setups as first RC seem
to indicate, we make it toggleable.
2019-04-11 12:14:38 +02:00
Gina Häußge 967b3bbff8 🔖 Preparing release of 1.3.11rc3 2019-04-10 17:38:17 +02:00
Gina Häußge 9721aec32a 🐛 printer safety: Fix for unicode issues
Fixes #3090
2019-04-10 17:15:59 +02:00
Gina Häußge 68952c20bd ⏪ Switch lines read from serial back to bytes
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
2019-04-10 17:15:58 +02:00
Gina Häußge 9775d99feb 🔇 error tracking: mute tornado's WebSocketErrors 2019-04-10 12:03:45 +02:00
Gina Häußge bfcff9a1cd 🐛 Fix some potential encoding errors 2019-04-10 12:03:31 +02:00
Gina Häußge 5ca286f4e3 🔇 error tracking: mute ispErrors 2019-04-10 11:39:02 +02:00
Gina Häußge 7dae700215 🐛 sockjs-tornado: Handle websocket errors 2019-04-09 17:32:29 +02:00
Gina Häußge 58806a3d00 🔧 error tracking: update DSNs 2019-04-09 17:22:16 +02:00
Gina Häußge 72cc1afb45 🐛 Refresh connection tab on disconnect
That way we'll hopefully notice vanishing/changed ports.

Potential fix for #3111, waiting for test results from @arhi
2019-04-09 17:00:57 +02:00
Gina Häußge 323131cbc5 ☔ Harden against estimation exceptions 2019-04-09 16:56:17 +02:00
Gina Häußge f389773036 ☔ Make sure rolling window is at least 1
See #3116
2019-04-09 16:56:02 +02:00
Gina Häußge 0a04043922 🐛 Fix potential division by zero
Fixes #3116
2019-04-09 16:55:35 +02:00
Gina Häußge 84fa3b6073 🐛 Don't log empty lines
See also #3115
2019-04-09 11:07:11 +02:00
Gina Häußge d6576306b0 🐛 Add missing rstrip
Fixes #3115
2019-04-09 11:06:04 +02:00
Gina Häußge 8970fb42b1 ✨ error tracking: further filtering 2019-04-08 14:08:57 +02:00
Gina Häußge 55e8cc1118 ☔ more type annotations 2019-04-08 13:05:27 +02:00
Gina Häußge 43e2f79575 🐛 Fix a unicode issue
Fixes #3109
2019-04-08 13:05:02 +02:00
Gina Häußge 132e2cb244 🐛 virtual printer: Fix handling of closed connection
Closes #3114
2019-04-08 12:24:24 +02:00
Gina Häußge de6d1afdd6 ✨ Add flag to ignore incomplete startup
See https://github.com/foosel/OctoPrint/issues/3103#issuecomment-480612935
2019-04-08 12:12:00 +02:00
Gina Häußge 0a1cc68a6b ♻ error tracking: minor restructuring 2019-04-05 18:36:50 +02:00
Gina Häußge f1309dad1d ✨ error tracking: filter all exceptions triggered in plugins
The new extra parameter passed to exception loggers throughout
OctoPrint allows even more aggressive filtering to reduce the noise
further.
2019-04-05 17:48:52 +02:00
Gina Häußge b353c4eee2 ✨ extra logging parameter to add plugin identifier
Will allow to identify logged exceptions originating from calling
plugins, but also log plugin identifiers directly in the log message
if so desired.
2019-04-05 17:47:36 +02:00
Gina Häußge 34c30ed73f 🐛 Fix wrong textual representation of STARTING state
See comment/log files in #3104
2019-04-05 16:23:11 +02:00
Gina Häußge c28faa8032 ☔ SWU: empty restart command == unset 2019-04-05 15:37:25 +02:00
Gina Häußge 8da5bb2d42 🐛 Fix bug in port detection
Closes #3108
2019-04-05 15:19:58 +02:00
Gina Häußge 54c885f1ad ☔ Prevent issues if hash is n/a
Apparently it can happen that no hash is available for an STL file.
See SERVER-TQ in Sentry.

So let's be a bit more careful here.

Closes #3107
2019-04-05 10:24:41 +02:00
Gina Häußge 65fe048ade ☔ error tracking: ignore RequestExceptions
We don't want to get error events every time someone's net connection
goes down or the webcam is misconfigured.
2019-04-05 10:17:12 +02:00
Gina Häußge 3574c2ddf9 🐛 virtual printer: Fix yet another unicode issue
Closes #3105
2019-04-04 19:05:17 +02:00
Gina Häußge 1dc0f1fb31 ☔ Define empty UI_API_KEY to be backwards compatible
Some plugins rely on this to be defined, let's give them some more time
to update.
2019-04-04 18:55:24 +02:00
Gina Häußge 30ddbfd324 Merge branch 'staging/maintenance' into maintenance 2019-04-04 17:12:01 +02:00
Gina Häußge 5c522d86ca Merge remote-tracking branch 'origin/staging/maintenance' into staging/maintenance 2019-04-04 17:09:11 +02:00
Gina Häußge f785c8180b 🔖 staging/maintenance is now 1.3.11rc3.dev 2019-04-04 17:08:33 +02:00
Gina Häußge 18e7d2b72a 🔖 Preparing release of 1.3.11rc2 2019-04-04 14:26:01 +02:00
Gina Häußge 410c3ee5f6 ☔ error tracking: ignore errors from packed_plugins.js 2019-04-04 14:12:19 +02:00
Gina Häußge 48825fd4c2 ⬆ error tracking: update js sentry sdk 2019-04-04 14:11:30 +02:00
Gina Häußge ff9c83ea25 ☔ Don't confuse users with pip's "OMG PY2.7 IS EOL!!1!" message
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
2019-04-04 11:51:16 +02:00
Gina Häußge 2c18a40dcb ⬆ Update bootstrap modal
Fixes #3095
2019-04-01 14:47:42 +02:00
Gina Häußge 0b6dd7e76e 🐛 backup: exclude timelapse_tmp if timelapse is excluded
Fixes #3098
2019-04-01 14:28:40 +02:00
Gina Häußge d68c7bfc67 ☔ More resilience against platform startup issues
Might solve problems like #3100, but that is only a shot in the dark at
this point.
2019-04-01 13:57:29 +02:00
Gina Häußge c879ad27f4 ♻ Turn lines read from serial into unicode
Backported from devel branch.

Should also fix #3091
2019-04-01 13:56:19 +02:00
Gina Häußge d1914824c6 🐛 Don't read returncode on async commands 2019-03-29 17:43:45 +01:00
Gina Häußge 79196eeaf7 🔇 Match up log level 2019-03-29 17:37:02 +01:00
Gina Häußge 6491db730d ☔ Harden against broken configs
See Sentry issue SERVER-BF
2019-03-29 17:22:00 +01:00
Gina Häußge bd07cda205 ✨ error tracking: support ignoring specific exceptions
We are not interested in any SerialExceptions raised in the comm layer
due to people ripping out cables or having otherwise broken comms.
2019-03-29 16:38:15 +01:00
Gina Häußge 9c7ca0ab7a ✏ Add thanks to sentry.io 2019-03-29 16:34:48 +01:00
Gina Häußge c4da5d6764 🔇 Some changes in what gets reported as error 2019-03-29 15:27:16 +01:00
Gina Häußge 47187c233d 🐛 Default value for self._errorValue 2019-03-29 15:08:44 +01:00
Gina Häußge 982ed793d9 📈 error tracking: change DSNs 2019-03-29 14:32:34 +01:00
Gina Häußge 718306073e ♻ error tracking: Restrict what gets tracked
We are only interested in

  * Exceptions that are
  * logged either in octoprint.* or tornado.* and not from third party
    plugins or unhandled

Implements #3094
2019-03-29 14:12:23 +01:00
Gina Häußge df6e94f7a3 🐛 Better validation of tool parameter on /api/printer/tool
Fixes #3092
2019-03-28 20:21:44 +01:00
Gina Häußge 1a2739c640 🐛 Fix /api/printer/tool endpoint
Fixes #3090

Fixes SERVER-24
2019-03-28 19:58:42 +01:00
Gina Häußge 9d318a4031 ☔ More hardening against invalid language packs
See issue SERVER-G in Sentry
2019-03-28 14:44:37 +01:00
Gina Häußge 292d608b97 🐛 Fix missing _chamberTemp definition
Closes #3089
2019-03-28 13:38:33 +01:00
Gina Häußge 2d7cb40633 🐛 Fix for plugin vars that contain unicode
ETag calculation could otherwise fall flat on its face.

Fixes #3088
2019-03-28 13:18:55 +01:00
Gina Häußge ce9315850f 🔖 maintenance is now 1.3.12.dev 2019-03-28 12:25:22 +01:00
Gina Häußge b8dbc627cb 🔖 staging/maintenance is now 1.3.11rc2.dev 2019-03-28 12:23:25 +01:00
Gina Häußge 73df8c2407 🔖 Preparing release of 1.3.11rc1, part 2 2019-03-28 10:54:19 +01:00
Gina Häußge 55ec8b1809 🐛 Partial revert of always sending SettingsUpdated event
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.
2019-03-28 10:52:15 +01:00
Gina Häußge 33eba705bf 🐛 invalid API key = no API key 2019-03-27 17:05:30 +01:00
Gina Häußge 9ec3a6ae7a ➖ Remove python-dateutil dependency
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.
2019-03-27 14:34:13 +01:00
Gina Häußge ec2ba63425 🔖 Preparing release of 1.3.11rc1 2019-03-26 14:58:45 +01:00
Gina Häußge 6097222b7b ♻ Remove onWizardPreventSettingsRefreshDialog
Makes the whole wizard stuff less complex.
2019-03-26 14:46:06 +01:00
Gina Häußge 40396847e3 ⬆ werkzeug.contrib.cache is now cachelib 2019-03-26 10:12:58 +01:00
Gina Häußge a296574c70 🐛 Fix handling of invalid API keys 2019-03-25 11:31:56 +01:00
Gina Häußge 547962f4bc 🐛 Fix login via Authorization header 2019-03-25 11:31:41 +01:00
Gina Häußge 1d2ceefb72 🐛 appkeys: Fix in case of disabled access control
Closes #3071
2019-03-22 19:45:22 +01:00
Gina Häußge 3d4422021e ⬆ Updated various dependencies
Closes #3074
2019-03-22 18:52:16 +01:00
Gina Häußge 3b5c11a2bb ✏ Typo 2019-03-20 14:28:35 +01:00
Gina Häußge 4908d94c97 🐛 Fix initialization of temperature graph
Was broken by #3072 & followup work
2019-03-20 13:09:58 +01:00
Gina Häußge 17a7e508c3 ♻ Remove UI_API_KEY & API disabling
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.
2019-03-19 17:14:19 +01:00
Gina Häußge 0069c94d35 🐛 forcelogin: add favicon meta tags 2019-03-19 16:55:02 +01:00
Gina Häußge 99e7824913 🐛 Fix some outdated links to the forum 2019-03-19 15:00:10 +01:00
Gina Häußge ceade46dd7 🐛 Fix caching headers on main view
Clients/browsers should be instructed to always revalidate against the
server in order to prevent any kind of old content to be served.

See https://community.octoprint.org/t/cant-login-to-the-web-interface/7908/17?u=foosel
2019-03-19 14:48:45 +01:00
Gina Häußge bc66d29d02 🐛 Fix reporting back of active port & baudrate
Closes #2859
2019-03-19 13:24:00 +01:00
Gina Häußge 9ea1074b03 ✨ Process watched folder on startup
Implements #2462
2019-03-19 11:52:32 +01:00
Gina Häußge 6e069211cc Merge remote-tracking branch 'origin/maintenance' into maintenance 2019-03-18 17:06:26 +01:00
Gina Häußge 8d3befb01f ✨ Support for heated chamber fw capabilities
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
2019-03-18 16:51:12 +01:00
Gina Häußge 42a6cab92e Merge pull request #3072 from Fabi0San/maint/temperature
Hides temperature tab if the machine has no heated bed nor extruders.
2019-03-18 12:57:35 +01:00
Gina Häußge 083e424529 ✏️ Fix a typo in the german translation
Closes #3061
2019-03-17 13:27:16 +01:00
Gina Häußge d5eefcd1a5 🐛 virtual: fix homing 2019-03-16 09:40:55 +01:00
Gina Häußge c1670d03c8 🐛 virtual: fix parsing of negative coordinates
Closes #3080
2019-03-16 09:29:04 +01:00
Gina Häußge b2637eb06a 🐛 Fix refactoring error 2019-03-13 15:09:27 +01:00
Gina Häußge 47179f2956 ☔ forcelogin: Never handle the UI if ACL is disabled
The following `passive_login` should always succeed if ACL is disabled
and hence this *should* not have caused issues, but considering

https://community.octoprint.org/t/cant-login-to-the-web-interface/7908/3

it might have after all, so better be safe than sorry here.
2019-03-13 15:09:02 +01:00
Gina Häußge d64b8512ab 💄 PGMR, SWU: Use scrollables instead of pagination 2019-03-12 17:02:14 +01:00
Gina Häußge 602ec5c495 🐛 Only use page size from local storage if configured
Should be a conscious decision by whoever uses ItemListHelper since
otherwise the size can never be changed again to a new default.

Follow-up to #2620
2019-03-12 16:52:17 +01:00
Gina Häußge a63ee9355e 🎨 Fix some linter warnings 2019-03-12 16:47:55 +01:00
Gina Häußge e44ae7a024 💚 Fix broken unit test
Who broke the test? That's right... me 😕
2019-03-12 16:26:14 +01:00
Gina Häußge 76ad332287 ♻ Use monotonic_time for relative times
Timeouts, durations and such shouldn't depend on the non-monotonic
system clock but instead use a monotonic time source.
2019-03-12 16:03:58 +01:00
Gina Häußge 93ab7bb089 Merge branch 'pr/3073' into maintenance 2019-03-12 13:57:08 +01:00
Gina Häußge b4e7e73e29 ♻ Use length of tool array for visibility
No need for an additional variable to keep in sync.
2019-03-12 13:56:53 +01:00
Gina Häußge 92ad53a9ec ♻ Use ko computed for visibility state 2019-03-12 13:42:45 +01:00
Gina Häußge 21c9c51858 ♻ Backport some more pieces from devel 2019-03-12 13:40:58 +01:00
Gina Häußge 38a321e175 ✨ Add configurable list of blocked and pausing commands
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
2019-03-12 12:16:23 +01:00
Gina Häußge 32050c31ae 🐛 Only process pause if we aren't already pausing
Also don't process a pause if we are cancelling. "isPrinting" is too
broad here, so we use explicit states.
2019-03-12 12:12:24 +01:00
Gina Häußge f020fc1bc6 ✨ Add ipv4- and ipv6-only command line flags
-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
2019-03-11 17:21:28 +01:00
Gina Häußge a1e8694073 🐛 Don't change to PRINTING state on resume if not RESUMING
See #2955
2019-03-11 16:02:20 +01:00
Gina Häußge e748b52098 🐛 Don't change to PAUSED state if not PAUSING
Fixes #2955
2019-03-11 15:34:11 +01:00
Gina Häußge 961b41f0fe 🐛 Fix action commands & various other things 2019-03-08 20:02:51 +01:00
Gina Häußge 4f59e0fd48 🐛 Fix resumed script 2019-03-08 16:32:21 +01:00
Gina Häußge e441976682 🐛 Fix sending of cancel, pause, resume scripts 2019-03-08 14:32:20 +01:00
Gina Häußge 864ac12097 🐛 Fix time reporting & user logging 2019-03-08 10:59:58 +01:00
Gina Häußge ee854f44cc ♻ Make some protocol flags dynamic
Less risk of forgetting to adjust them on some randomg state change.

Fixes issues with pausing/resuming/finishing.
2019-03-07 12:48:06 +01:00
Gina Häußge cc5c19dde9 Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	src/octoprint/filemanager/storage/local.py
2019-03-06 15:12:27 +01:00
Gina Häußge aab629d80e 🎨 except: => except Exception: 2019-03-06 15:10:38 +01:00
Gina Häußge 4e2afbc170 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/filemanager/storage.py
#	src/octoprint/util/__init__.py
#	src/octoprint/util/comm.py
2019-03-06 14:49:42 +01:00
Gina Häußge 8668c6200a ✨ Decorator for timing methods
Probably mostly helpful during development...
2019-03-06 13:53:53 +01:00
Gina Häußge e01f391b30 ⚡ More intelligent use of copy & deepcopy
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
2019-03-06 13:44:45 +01:00
Gina Häußge 92618362e1 💚 Forgot to adjust the tests for d071684 2019-03-05 17:01:10 +01:00
Gina Häußge d071684d41 ♻ Remove old metadata.yaml files
Were deprecated and supposed to be removed with 1.3.10, we'll do it with
1.3.11.
2019-03-05 16:53:30 +01:00
Gina Häußge 7d0bd6a339 ☔ Remove stale entries from metadata
If a file no longer exists on disk for whatever reason it also doesn't
need to be kept in metadata.json.

See also #3057

Cherry-picked from 15d3b2ca
2019-03-05 16:20:13 +01:00
Fabi0San 1b5a654a2d Hide Tool section in Control for machines with no extruders. Such as Lasers. 2019-03-04 19:00:08 -08:00
FabioSan f0ee7f343e Hides temperature tab if the machine has no heated bed nor extruders. 2019-03-04 18:34:55 -08:00
Gina Häußge f36a6a0409 🐛 Fix missing error field on protocol 2019-03-01 18:09:28 +01:00
Gina Häußge de8be65be7 🚧 WIP: user action logging, continued 2019-03-01 18:09:13 +01:00
Gina Häußge 780948fe7d 🐛 Fix ok_timeout detection under Py2 as well
d291734 only fixed it for Py3 🤦‍♀️
2019-03-01 16:24:32 +01:00
Gina Häußge c27936a9db 🐛 Fix print logging 2019-03-01 15:31:36 +01:00
Gina Häußge caad7a3f60 🐛 tracking: Use correct payload roperty for elapsed time 2019-03-01 13:16:11 +01:00
Gina Häußge 7c75c882d3 ♻ Put time into job event payload 2019-03-01 13:15:45 +01:00
Gina Häußge 9594b75b78 Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	src/octoprint/plugins/tracking/__init__.py
2019-03-01 11:29:14 +01:00
Gina Häußge 3e16f0901a Merge remote-tracking branch 'origin/maintenance' into maintenance 2019-03-01 11:21:01 +01:00
Gina Häußge 8866ed716d ☔ Better resilience against invalid SD status reports 2019-03-01 11:20:45 +01:00
Gina Häußge cf16392e18 💚 Ignore vendor path for tests & fix 2.7 tests 2019-02-28 17:05:13 +01:00
Gina Häußge 34e4a20866 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/plugins/__init__.py
#	src/octoprint/plugins/tracking/__init__.py
2019-02-28 16:40:04 +01:00
Gina Häußge 0f157d3747 ♻ Load bundled plugins under octoprint.plugins.*
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).
2019-02-28 16:37:09 +01:00
Gina Häußge 1b3a8acf0d ♻ Work around deprecation of imp
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.
2019-02-28 16:07:07 +01:00
Gina Häußge fdb4e75241 Merge pull request #3066 from fieldOfView/fix_docs_job_state
Add missing documentation about state in `jobs` endpoint
2019-02-28 12:34:35 +01:00
Gina Häußge 4dbb24ecd7 📝 state is not a sub data model but a string 2019-02-28 12:26:25 +01:00
fieldOfView a15e2de251 Fix datamodel structure 2019-02-28 12:17:35 +01:00
fieldOfView c652bed871 Add missing documentation about state in jobs endpoint 2019-02-28 11:40:22 +01:00
Gina Häußge 1ed6730400 🔊 Improved logging in case of plugin syntax errors 2019-02-27 16:11:00 +01:00
Gina Häußge dde99736e4 📝 Fix an error in the docs 2019-02-27 14:32:37 +01:00
Gina Häußge 334f2c35f9 ✨ Allow to ignore compatibility for plugins
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
2019-02-27 14:28:35 +01:00
Gina Häußge aacd59ae78 ☔ Log exceptions while parsing the AST 2019-02-27 13:43:01 +01:00
Gina Häußge 253a38c32d ♻ gcode => printables 2019-02-26 15:31:22 +01:00
Gina Häußge e08becbb4c Merge pull request #3055 from AndyQ/show_current_layer
Added ability to preview the current layer to be drawn
2019-02-26 13:54:43 +01:00
Gina Häußge 09a043b393 🐛 tracking: fix handling of missing print time
See also #3063
2019-02-26 13:50:35 +01:00
Gina Häußge 9eafe9979a 🚧 WIP: user action logging 2019-02-22 19:25:02 +01:00
Gina Häußge 086a2c9f82 Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	src/octoprint/plugins/virtual_printer/virtual.py
2019-02-22 18:48:10 +01:00
Gina Häußge 058dbd0c2e 🐛 virtual: fix regexes again 2019-02-22 18:46:45 +01:00
Gina Häußge 54c8923087 🐛 virtual: fix some str/bytes issues
Threw some type annotations into it while at it. Should make the IDE
become angry at such problems in the future.
2019-02-22 18:29:36 +01:00
Gina Häußge 0c58566789 🐛 Fix on_protocol_job_resumed call 2019-02-22 17:51:34 +01:00
Gina Häußge d2917346f5 🐛 Fix ok_timeout detection 2019-02-22 17:50:43 +01:00
Gina Häußge e7f1302f3c 🐛 Fix pausing -> paused
Was not waiting for scripts and such to complete before the state
change.
2019-02-22 15:23:28 +01:00
Gina Häußge eca74233eb 🐛 Fix resume 2019-02-22 14:47:31 +01:00
Gina Häußge 1025f0be43 💚 Revert "🎨 Remove unnecessary import"
This reverts commit 295b96f259.
2019-02-22 13:31:36 +01:00
Gina Häußge 295b96f259 🎨 Remove unnecessary import
Already included in the next line
2019-02-22 12:53:18 +01:00
Gina Häußge adea0db344 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/util/__init__.py
2019-02-22 12:48:52 +01:00
Gina Häußge 0c4f4383e3 ♻ Introduce type hints
For now we'll only use them to have our IDEs scream at us...
2019-02-22 11:44:45 +01:00
Gina Häußge 36fb7805e5 🐛 Fix type error in case of a resend 2019-02-22 11:33:45 +01:00
Gina Häußge c7afd7951c 💚 Fix tests (final pass) 2019-02-21 16:58:44 +01:00
Gina Häußge f489f4ffd1 Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	.travis.yml
#	src/octoprint/util/__init__.py
2019-02-21 15:44:27 +01:00
Gina Häußge 9f2821fe96 👷 ALLOW_UNICODE and custom pretty printer in doctests
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.
2019-02-21 15:36:10 +01:00
Gina Häußge dcc1148863 👷 Switching from nose to pytest 2019-02-21 15:34:07 +01:00
Gina Häußge ba96ba8fe8 🚧 WIP: Fixing tests, part 3 2019-02-21 15:29:41 +01:00
Gina Häußge 02566ae9d0 👷 ALLOW_UNICODE and custom pretty printer in doctests
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.
2019-02-21 15:29:20 +01:00
Gina Häußge 8080e65366 Merge branch 'devel' into dev/commRefactoringNG 2019-02-21 11:52:11 +01:00
Gina Häußge e972026ad0 🚸 PMGR: show message if plugin repo list is empty
E.g. due to filters or compatibility issues.
2019-02-20 18:11:08 +01:00
Gina Häußge 6592be63f8 ✨ PMGR: Support python compatibility flag in plugin repo 2019-02-20 18:10:59 +01:00
Gina Häußge 8b5626e49c 💚 Fix unit tests under Py3 2019-02-20 16:28:06 +01:00
Gina Häußge be4a931e32 ✨ Add Python 3 compat control property
As discussed in #2722
2019-02-20 16:14:12 +01:00
Gina Häußge 548da0d64f Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/environment.py
2019-02-20 15:33:15 +01:00
Gina Häußge 45aa26f13e ♻ Add central methods for getting python version 2019-02-20 15:32:07 +01:00
Gina Häußge 25f26170ff Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/plugins/printer_safety_check/__init__.py
#	tests/filemanager/test_filemanager.py
2019-02-20 15:10:25 +01:00
Gina Häußge 4a64bc6023 Merge branch 'improve/moreFlexiblePrinterSafetyChecks' into maintenance
# Conflicts:
#	src/octoprint/plugins/printer_safety_check/__init__.py
2019-02-20 14:41:09 +01:00
Gina Häußge 8e6773d19f 🐛 printer_safety_check: Fix some issues with new implementation 2019-02-20 14:39:21 +01:00
Gina Häußge dfcddea581 🎨 Fix some whitespace issues 2019-02-19 13:28:15 +01:00
Gina Häußge ff59e275bf Merge branch 'improve/errortracking_plugin' into maintenance 2019-02-19 13:11:38 +01:00
Gina Häußge 0f8f1ec8e0 ✨ Finalize first version of errortracking plugin
Also add docs for that & the Anonymous Usage Tracking plugin.
2019-02-19 13:11:25 +01:00
AndyQ 0e302d440f Added ability to preview the current layer to be drawn
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
2019-02-18 11:28:41 +01:00
Gina Häußge 980616519d Merge pull request #3054 from rgriebl/master
Fix python version detection on Debian testing/unstable
2019-02-18 10:46:56 +01:00
Gina Häußge 434751634f Merge pull request #3053 from AndyQ/MultipleFiliament_fix
Fixed error in GCode viewer where multiple filaments available (e.g. …
2019-02-18 10:44:33 +01:00
Robert Griebl c35708a422 Fix python version detection on Debian testing/unstable
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
2019-02-18 00:37:08 +01:00
AndyQ 64464a38ce Fixed error in GCode viewer where multiple filaments available (e.g. using Prusa MMU2), but only using a filament that isn't the first one
e.g. filament 4
2019-02-17 11:57:13 +00:00
Gina Häußge 4c76225c41 🚧 WIP: Fixing tests, part 2 2019-02-15 18:54:07 +01:00
Gina Häußge 1f4bfa854b 👷 Switching from nose to pytest 2019-02-15 18:52:44 +01:00
Gina Häußge 4be18c2668 🚧 WIP: Fixing tests 2019-02-15 12:56:57 +01:00
Gina Häußge 225cca34e1 🔥 Remove old test code 2019-02-14 17:29:42 +01:00
Gina Häußge 9a4149164b ♻ Some porting from maintenance/devel 2019-02-14 17:29:02 +01:00
Gina Häußge cf9243c2e7 Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	src/octoprint/filemanager/storage/local.py
#	src/octoprint/logging/handlers.py
#	src/octoprint/plugin/__init__.py
#	src/octoprint/plugins/virtual_printer/virtual.py
#	src/octoprint/printer/standard.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/api/connection.py
#	src/octoprint/server/api/files.py
#	src/octoprint/settings.py
#	src/octoprint/static/js/app/viewmodels/connection.js
#	src/octoprint/util/__init__.py
#	tests/plugin/test_settings.py
2019-02-14 17:27:00 +01:00
Gina Häußge 0e482151fd Merge pull request #3051 from CapnBry/unfuzzy-timetips
Always show unfuzzy times for total print time and time left in tooltip
2019-02-14 15:59:34 +01:00
Gina Häußge c5bf58e1cc ♻️ == -> === 2019-02-14 15:56:09 +01:00
Bryan Mayland 38b7be0142 Fix whitespace 2019-02-14 14:52:24 +00:00
Bryan Mayland 28a515ba6a Always show unfuzzy times for total print time and time left in tooltip 2019-02-14 14:41:01 +00:00
Gina Häußge b6b562399e 💥 Remove deprecated AppSessionManager
Has been replaced by the bundled AppKeys plugin and its workflow.
Deprecation will be announced in 1.3.11.
2019-02-13 17:04:31 +01:00
Gina Häußge 3654512085 🐛 Fix mysteriously broken unit tests 2019-02-13 16:42:21 +01:00
Gina Häußge e7dbd804ce ♻ Use to_unicode instead
See #2722
2019-02-13 16:35:00 +01:00
Gina Häußge 7fd03265d4 🐛 Work around for jsonify calls with bytes
See #2722
2019-02-13 16:32:34 +01:00
Gina Häußge 369679bae5 🐛 Work around CPython bug bpo-29097 2019-02-13 16:12:28 +01:00
Gina Häußge 27e1f2e6e7 🐛 Fix package collection
As mentioned in #2722

See also razerraz@d269c36
2019-02-13 15:26:15 +01:00
Gina Häußge 109cbeea6a 🐛 Fix slicing permission 2019-02-13 15:21:37 +01:00
Gina Häußge 606199dcc9 Merge branch 'maintenance' into devel
# Conflicts:
#	tests/filemanager/test_filemanager.py
2019-02-13 14:56:40 +01:00
Gina Häußge 38868303da 🐛 Fix tests 2019-02-13 14:55:48 +01:00
Gina Häußge 75b5fe198f Merge branch 'maintenance' into devel
# Conflicts:
#	AUTHORS.md
#	src/octoprint/_version.py
#	src/octoprint/plugins/backup/__init__.py
#	src/octoprint/plugins/cura/__init__.py
#	src/octoprint/plugins/cura/profile.py
#	src/octoprint/plugins/cura/templates/cura_settings.jinja2
#	src/octoprint/plugins/softwareupdate/scripts/update-octoprint.py
#	src/octoprint/printer/standard.py
#	src/octoprint/server/api/files.py
#	src/octoprint/server/util/tornado.py
#	src/octoprint/server/views.py
#	src/octoprint/users.py
#	src/octoprint/util/__init__.py
#	versioneer.py
2019-02-13 14:28:06 +01:00
Gina Häußge fe65f18f78 💥 Unbundling the cura plugin
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.
2019-02-13 13:41:44 +01:00
Gina Häußge e1e302f93d ✨ Allow slicing while printing on multi core systems
If we don't know the number of cores or the number is less than two we
the old behaviour still applies.

Implements #1938
2019-02-13 12:06:32 +01:00
Gina Häußge 1cea388481 🐛 Fix _version.py generation 2019-02-12 13:53:20 +01:00
Gina Häußge 14a3d903d7 Merge remote-tracking branch 'origin/maintenance' into maintenance 2019-02-12 13:46:35 +01:00
Gina Häußge 34d6a6f8ce ⬆ Update versioneer & generated file 2019-02-12 12:29:00 +01:00
Gina Häußge 6a03532ea7 ♻ Backport py3 compat for versioneer 2019-02-12 12:25:41 +01:00
Gina Häußge 649bfdbe37 Merge branch 'master' into maintenance 2019-02-12 12:18:31 +01:00
Gina Häußge 8ce2290d63 📝 Improve docs for connection API
See #3043
2019-02-12 12:07:55 +01:00
Gina Häußge b1413abfff Merge pull request #3045 from akraus53/patch-1
I fixed a few typos in the German translation
2019-02-12 12:02:42 +01:00
Alexander Kraus 772914f38c Fixed a few typos
I hope this is the correct Branch....
2019-02-11 22:54:04 +01:00
Gina Häußge c6b4eee437 🐛 treat pausing as paused for resume handling
See MarlinFirmware/Marlin#13039 and #2955
2019-02-11 18:21:32 +01:00
Gina Häußge e67f72ce3d 🐛 paused action must not trigger *any* local processing
That includes sending M400 and M114 to capture the pause position.

See MarlinFirmware/Marlin#13039
2019-02-11 18:19:47 +01:00
Gina Häußge de6da3f360 Merge branch 'master' into maintenance 2019-02-11 10:08:54 +01:00
Gina Häußge b744c341eb 💬 discourse.octoprint.org => community.octoprint.org 2019-02-11 09:58:39 +01:00
Gina Häußge 697af69e97 Merge branch 'master' into maintenance 2019-02-08 17:06:59 +01:00
Gina Häußge 601451a3f1 ✨ Setting to disable fuzzy estimates
Implements #3040
2019-02-08 16:44:25 +01:00
Gina Häußge 81d523b73d ♻ Backport to_str -> to_bytes from devel
Add unit tests.
2019-02-08 14:39:07 +01:00
Gina Häußge deacd9c188 Merge pull request #3041 from Microtome/add-klipper-to-firmware-autodetect
Add support for klipper in firmware autodetect
2019-02-08 14:02:37 +01:00
Gina Häußge 3c5aa60d2b 🐛 Some more unicode vs bytes fixes 2019-02-07 18:35:35 +01:00
Daniel Joyce 6e0024149e Add support for klipper firmware autodetect 2019-02-07 07:36:11 -08:00
Gina Häußge 1b876f1cf3 ♻ Only depend on chainmap and scandir under py2 2019-02-07 16:31:43 +01:00
Gina Häußge 580e5f5122 🐛 It's time.monotonic in py3, not monotonic.monotonic 2019-02-07 15:40:31 +01:00
Gina Häußge 22f6a38f0a ♻ Universal wheel and related setup.py adjustments
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).
2019-02-07 15:28:01 +01:00
Gina Häußge 620aa4dfe0 📝 README adjustment to state Py3 support 2019-02-07 12:35:53 +01:00
Gina Häußge dd3b318327 Merge branch 'pr/3036' into maintenance 2019-02-07 12:07:13 +01:00
Gina Häußge 1ccc787222 📝 docs: grammar 2019-02-07 11:57:21 +01:00
Gina Häußge f8e7ae7436 Merge branch 'py23' of github.com:smurfix/OctoPrint into pr/3032 2019-02-07 11:56:16 +01:00
Gina Häußge 3ae284d9a7 Merge branch 'devel' into pr/3032 2019-02-07 11:51:41 +01:00
Gina Häußge caf5be562e 🐛 Workaround for "Request.is_xhr deprecated" warning 2019-02-07 11:51:09 +01:00
Gina Häußge 069e83c63c Merge pull request #3039 from Microtome/improve-backup-filename
Improve backup filename, fix for #3030
2019-02-07 11:43:02 +01:00
Daniel Joyce 0cf345f29b Fix bug where if no plugins are installed, restore fails
* 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.
2019-02-06 21:06:19 -08:00
Daniel Joyce 0fda153d60 Provide a better name for backup files, use utility function for consistent name 2019-02-06 20:45:07 -08:00
Matthias Urlichs c01a34f358 fix grammar, simplify instructions
A "pip" alias that points to the correct version is part of the venv.

"activate" auto-deactivates the previous venv.
2019-02-06 18:46:53 +01:00
Gina Häußge deee737660 🐛 Raise no exception in case of missing wheel metadata
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.
2019-02-06 18:36:00 +01:00
Gina Häußge 8425c7b973 Merge branch 'py23' of github.com:smurfix/OctoPrint into pr/3032 2019-02-06 18:13:57 +01:00
Gina Häußge 1e42db040d 📝 docs: some rewording re dev environment 2019-02-06 18:12:44 +01:00
Matthias Urlichs e2d4b64510 superfluous "import io" 2019-02-06 17:29:19 +01:00
Gina Häußge 61136edeea ✅ Add tox.ini 2019-02-06 17:19:28 +01:00
Gina Häußge 7614ef40d3 🐛 Fix repeatability of doctests under py2 2019-02-06 17:07:50 +01:00
Gina Häußge 935639a51a 🐛 Fix json file writing
Apparently json.dump produces mixed bytes/unicode content. So now we use
json.dumps wrapped in to_bytes and that's it.
2019-02-06 16:51:54 +01:00
Gina Häußge ec689e3939 🐛 Fix versioneer 2019-02-06 16:35:32 +01:00
Hannappel 84f95b1099 Fixes creating of groups 2019-02-06 16:08:15 +01:00
Gina Häußge fd8788dd34 ♻ More error resilience for encoding issues in config.yaml
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"
2019-02-06 16:06:56 +01:00
Gina Häußge 32a8646135 ♻ codecs.open -> io.open
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.
2019-02-06 16:05:09 +01:00
Gina Häußge 09cc7cf5f7 🐛 Fix unicode vs bytes issues for atomic_write
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.
2019-02-06 16:03:32 +01:00
Gina Häußge 496e9f0ec4 ✅ Add unit test for pip caller initialization 2019-02-06 13:11:03 +01:00
Gina Häußge 18b2ecd64c 🐛 Fix unicode vs bytes issues in PipCaller
* environment for subprocess needs native str (at least under win)
  * when reading a text file we should also be writing one inside the
    test balloon
2019-02-06 12:53:23 +01:00
Gina Häußge cc6f61c62e 🐛 discovery: fix unicode vs bytes issues in SSDP 2019-02-06 12:00:16 +01:00
Matthias Urlichs de149613cb Run flake8 tests only once 2019-02-05 18:13:44 +01:00
Matthias Urlichs a7ca374955 Fix additional flake8 nits 2019-02-05 17:54:09 +01:00
Daniel Joyce 61ac8430d6 Added self to Authors file 2019-02-05 08:46:58 -08:00
Daniel Joyce 6b4dfcb960 Support opening serial port in exclusive mode.
* Slight cleanup and refactoring
2019-02-05 08:46:44 -08:00
Matthias Urlichs d7d3272905 Merge errors fixed 2019-02-05 17:43:31 +01:00
Matthias Urlichs 9eb29a8ce0 found another unnecessary list-ification 2019-02-05 17:41:30 +01:00
Matthias Urlichs bf16bd1180 Merge py23 from devel 2019-02-05 17:36:07 +01:00
Matthias Urlichs 7b5315383b Add wildcard import for compatibility 2019-02-05 17:35:25 +01:00
Matthias Urlichs 72729ad418 fix speling an move to docstring 2019-02-05 17:34:57 +01:00
Matthias Urlichs e6f902cbe7 add logging 2019-02-05 17:34:45 +01:00
Matthias Urlichs 9b14f32279 take PY3 from existing declaration 2019-02-05 17:34:27 +01:00
Matthias Urlichs 7ad4d75588 fixed merge errors 2019-02-05 17:34:15 +01:00
Gina Häußge 5a623b486c ✅ Adding flake8 to CI 2019-02-05 17:28:44 +01:00
Gina Häußge 920283cf87 Merge branch 'devel' into pr/3032
# Conflicts:
#	src/octoprint/access/groups.py
#	src/octoprint/static/css/octoprint.css
2019-02-05 17:08:24 +01:00
Gina Häußge becd16b892 🐛 Fix a test 2019-02-05 16:08:40 +01:00
Gina Häußge f59c1ce804 ⬆ Upgrade Flask-Login dependency
It used to be 0.3.0+, some merge in the past must have broken that.
2019-02-05 15:58:15 +01:00
Gina Häußge c71972c0f8 ♻ Explicitly add admin group to plugin permissions
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.
2019-02-05 15:58:15 +01:00
Gina Häußge 47a9a40ec9 ✨ permissions: Groups can now have subgroups
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+
2019-02-05 15:58:15 +01:00
Matthias Urlichs 5c1fffc3d0 comm: more str vs. bytes (esp. baudrate detect) 2019-02-05 14:30:23 +01:00
Matthias Urlichs fe090cc6cc Virtual printer: str vs. bytes 2019-02-05 14:29:27 +01:00
Matthias Urlichs ab3c4ab66c Don't compare with None 2019-02-05 14:29:04 +01:00
Matthias Urlichs 1d6b7244b5 Bah. That glob-import-removal was overzealous. 2019-02-04 21:33:35 +01:00
Matthias Urlichs ea17566aba some more unused variables 2019-02-04 21:13:19 +01:00
Matthias Urlichs 315ed57916 Another missing import 2019-02-04 21:12:20 +01:00
Matthias Urlichs 1014582b4b removed wildcard imports 2019-02-04 21:10:11 +01:00
Matthias Urlichs cf77053901 missing imports 2019-02-04 21:10:04 +01:00
Matthias Urlichs f040482b18 don't assign to an unused variable 2019-02-04 21:09:27 +01:00
Matthias Urlichs 523fadd930 Don't shadow globals 2019-02-04 21:08:32 +01:00
Matthias Urlichs 97d0fbd2c9 Don't compare with bool values 2019-02-04 21:07:53 +01:00
Matthias Urlichs 3b820f6848 Scoping error: py3 deletes exceptions after their except: block 2019-02-04 21:02:32 +01:00
Matthias Urlichs e8b9f385b4 "has_key" is deprecated 2019-02-04 20:54:54 +01:00
Matthias Urlichs 95bc1006a0 Fix undefined "autologin_as" and "local_networks" 2019-02-04 20:49:49 +01:00
Matthias Urlichs 14ef17163f Don't compare with None 2019-02-04 20:44:57 +01:00
Matthias Urlichs 9a1bd8af87 These are numbers so unicode() is not necessary 2019-02-04 20:35:00 +01:00
Matthias Urlichs a292a12c4a The lastline buffer has bytes
This reduces required work because we only need to convert back when
resending
2019-02-04 20:35:00 +01:00
Matthias Urlichs 200a3ef4eb replaced a bunch of map() with generator expressions 2019-02-04 20:35:00 +01:00
Matthias Urlichs 88582beb55 grammar ;-) 2019-02-04 20:29:22 +01:00
Matthias Urlichs 6d7c8bbda6 More backslashes 2019-02-04 20:13:06 +01:00
Matthias Urlichs 9a7f92174a forgot to replace a unicode=str instance 2019-02-04 20:13:06 +01:00
Gina Häußge 61431c0df3 Merge remote-tracking branch 'origin/master' 2019-02-04 18:48:10 +01:00
Matthias Urlichs a301fc6da9 Merge remote-tracking branch 'origin/devel' into py23 2019-02-04 18:44:23 +01:00
Gina Häußge cc0b63cbb9 📝 Fix a formatting issue
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...
2019-02-04 18:40:57 +01:00
Matthias Urlichs e08dc0b5aa missed importing "long" from past.builtins 2019-02-04 17:04:33 +01:00
Matthias Urlichs a368a7f1c9 comm: we already have a logger. Use it. 2019-02-04 17:04:01 +01:00
Gina Häußge 020403dc54 💬 Correct typo in german translation
Closes #3029
2019-02-04 14:43:12 +01:00
Matthias Urlichs 6a601d4f8e clean_ansi: accept strings 2019-02-04 14:33:57 +01:00
Gina Häußge 7a3b370469 🐛 Fix earlier merge error
New permission system does handle disabled ACL slightly differently.
2019-02-04 14:30:02 +01:00
Matthias Urlichs e676d53e9f Fix the remaining docstr tests
Sets are annoying to test:
(a) their repr() is different
(b) they might get re-ordered.
2019-02-04 14:15:09 +01:00
Matthias Urlichs 40b231f692 fix TagStripper for py2 2019-02-04 14:14:55 +01:00
Matthias Urlichs 86664fdb39 super() doesn't work in Py2. Yech. 2019-02-04 13:58:56 +01:00
Matthias Urlichs 4ebb5cf42d more native_str 2019-02-04 13:38:31 +01:00
Matthias Urlichs e8bee435af forgotten import 2019-02-04 13:33:46 +01:00
Matthias Urlichs 082f977f7a Disable unicode strings in github_release
I am too lazy to fix all the doctests
2019-02-04 13:32:34 +01:00
Matthias Urlichs 237a2c0add Make the HTML tag stripper 2.7 compatible
convert_charrefs defaults to True on Py3.5 ff.
2019-02-04 13:20:47 +01:00
Matthias Urlichs 2e47f49f7a Make to_native_str() decode bytes
used for doctests
2019-02-04 13:14:32 +01:00
Matthias Urlichs 05919363e1 De-ANSIfication needs to run on bytes. 2019-02-04 13:14:01 +01:00
Matthias Urlichs 7c8547555c double escapes vs. raw strings. Ugh. 2019-02-04 13:13:30 +01:00
Matthias Urlichs ce0c77f0bf Travis: run on xenial distro 2019-02-04 13:13:09 +01:00
Matthias Urlichs aec041b014 Fix unicode woes in doctests 2019-02-04 13:00:54 +01:00
Matthias Urlichs 58b32803df Tell Travis to also test py3.6 and py3.7 2019-02-04 12:49:11 +01:00
Matthias Urlichs 6d447f8408 unicode woes for funcion __name__/__qualname__ 2019-02-04 12:47:44 +01:00
Matthias Urlichs 54d359f730 Don't spew a stack trace if vcgencmd doesn't work / exist 2019-02-04 11:34:05 +01:00
Matthias Urlichs 4d9f0fca41 Unicode woes for serial seending 2019-02-04 11:24:25 +01:00
Matthias Urlichs 41146c2b7c another hash 2019-02-04 11:23:08 +01:00
Matthias Urlichs 99d7157cb7 Missing translation 2019-02-03 19:10:27 +01:00
Matthias Urlichs c8b5662ff2 a bunch of bytes 2019-02-03 19:02:10 +01:00
Matthias Urlichs b781681e0f There's no 'file' in Py3 2019-02-03 19:01:47 +01:00
Matthias Urlichs 5edeecdc8c Py3 codecs.open doesn't like mode='t' 2019-02-03 19:01:07 +01:00
Matthias Urlichs f82ec61463 restore setup.py
Incompatibility with Jinja 2.10
2019-02-03 19:00:29 +01:00
Matthias Urlichs 372a8d2ea8 Feedparser: avoid warning due to their workaround
see Feedparser issues 328 and 310
2019-02-03 17:39:12 +01:00
Matthias Urlichs 9c5d1dec59 don't apply str.lower() to unicode 2019-02-03 17:39:01 +01:00
Matthias Urlichs feff5e0978 type() vs. unicode, again 2019-02-03 17:25:39 +01:00
Matthias Urlichs 019bf5acd4 use past.builtins.unicode 2019-02-03 17:19:46 +01:00
Matthias Urlichs 717aafee08 TODO catch this sphinx error in a reasonable way 2019-02-03 16:39:31 +01:00
Matthias Urlichs 67c5a5e168 went through "except Exception:" with a fine comb 2019-02-03 16:39:01 +01:00
Matthias Urlichs 6310afa261 owchie to_native 2019-02-03 16:36:20 +01:00
Matthias Urlichs cd6ae6e47b setup 2 unicode_literals 2019-02-03 16:35:48 +01:00
Matthias Urlichs b01e1c269d owchie to_native 2019-02-03 16:35:12 +01:00
Matthias Urlichs 49fb0f87d5 Clean up Py2-vs.Py3 imports 2019-02-03 16:32:00 +01:00
Matthias Urlichs 8956e7a173 actually purge logger entries 2019-02-03 15:55:49 +01:00
Matthias Urlichs 9fa20f0e52 rename to_str to to_bytes 2019-02-03 14:54:28 +01:00
Matthias Urlichs 6bf8384c35 Kill of u"" (visual clutter) 2019-02-03 14:25:41 +01:00
Matthias Urlichs 1dacbc35bf Use unicode_literals __future__ 2019-02-03 14:09:57 +01:00
Matthias Urlichs 7522dbed1d serial readline: bytes 2019-02-03 14:06:06 +01:00
Matthias Urlichs d433c919ec more bare except: 2019-02-03 14:02:41 +01:00
Matthias Urlichs a6f701802f Simplify: set([GEN]) → set(GEN) 2019-02-01 17:33:32 +01:00
Matthias Urlichs e03feeb7ac checked "basestring" 2019-02-01 17:23:08 +01:00
Matthias Urlichs 00068114a1 Unicode oops 2019-02-01 17:15:42 +01:00
Matthias Urlichs 6a7e11eb7c items not values 🙄 2019-02-01 17:14:27 +01:00
Matthias Urlichs 6f987577f4 missed hash_update 2019-02-01 17:14:10 +01:00
Matthias Urlichs 819d690bc3 Merge devel into py23 2019-02-01 16:50:56 +01:00
Gina Häußge dbfe487f13 Merge branch 'maintenance' into devel 2019-02-01 15:12:42 +01:00
Gina Häußge 21a82bbdb6 🐛 Fix enableWebcam render kwarg
Was using the wrong setting name.
2019-02-01 15:10:28 +01:00
Gina Häußge 47e9afa811 ♻ Use new named registration params for UiStateVM 2019-02-01 14:58:02 +01:00
Gina Häußge f9edea0c2c 🐛 Fix duplicate auth request on socket
Merge error.
2019-02-01 14:57:11 +01:00
Gina Häußge 8ef3d1dcad 🐛 Fix reload loop on first setup
Removed the forcelogin plugin since it's obsolete in 1.4.0 thanks to
the granular permission system anyhow.
2019-02-01 14:56:48 +01:00
Gina Häußge fcfef25c93 🐛 Fix first run wizard again
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.
2019-02-01 14:45:38 +01:00
Gina Häußge 604d2f7811 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/views.py
#	src/octoprint/templates/dialogs/settings/api.jinja2
2019-02-01 11:12:29 +01:00
Gina Häußge 727fd12939 🚸 CORS change needs restart to take effect 2019-02-01 10:55:24 +01:00
Gina Häußge 100fe5f290 🐛 Allow disabling CORS headers on SockJS endpoints
Fixes 2) of #3024
2019-02-01 10:40:37 +01:00
Matthias Urlichs a721256204 AssertEquals is deprecated 2019-01-31 20:10:30 +01:00
Matthias Urlichs 24d2efd3ce Merge devel into py23 2019-01-31 20:08:40 +01:00
Gina Häußge 1acf69cb6d 🐛 Add CORS headers to tornado endpoints (if enabled)
Fixes 1) of #3024
2019-01-31 17:38:10 +01:00
Gina Häußge 3815c340a8 ☔ Protect against corrupt language packs 2019-01-31 17:07:10 +01:00
Gina Häußge 5e8220055f 🐛 Fix merge error 2019-01-31 14:44:46 +01:00
Gina Häußge 38eff3fe6f Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/api/system.py
2019-01-31 14:07:14 +01:00
Gina Häußge 4e47ecabf8 🐛 Fix duped log entries 2019-01-31 13:57:05 +01:00
Gina Häußge c36a378b60 Merge branch 'hotfix/documentation_error' into maintenance 2019-01-30 15:08:41 +01:00
Gina Häußge 9a7ebde76b 📝 Fix documentation for firmware info & capability plugin hooks 2019-01-30 15:02:32 +01:00
Gina Häußge c23bafd788 ☔ Protect against callback errors in decorators on default view 2019-01-30 14:36:53 +01:00
Gina Häußge 1aea92a5f1 ☔ Protect against invalid preemptive cache config data
Fixes #3023
2019-01-30 14:36:52 +01:00
Gina Häußge df9617ac1e 🔀 Merge branch 'maintenance' into devel 2019-01-30 11:27:30 +01:00
Gina Häußge 0b23417f45 🐛 Add missing asset that got lost during a merge
Fixes #3021
2019-01-29 16:48:07 +01:00
Matthias Urlichs 828ba56952 list()-ify keys(), values() and items()
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.
2019-01-28 21:55:44 +01:00
Matthias Urlichs 63723baf07 list()-ify map() and filter()
where required. At some places it's not.
2019-01-28 21:55:44 +01:00
Matthias Urlichs b60b20d784 Clean up example code 2019-01-28 21:06:35 +01:00
Matthias Urlichs 1e0bdc8b8c octoprint => octoprint serve
for the trivial case of starting "run" without arguments
2019-01-28 20:36:02 +01:00
Matthias Urlichs b47b39af99 missing import 2019-01-28 20:36:02 +01:00
Matthias Urlichs 6bc4d8fca4 TODO: TypeError is too unspecific
This might need better error filtering, assuming that we need it in the
first place. For now, remove entirely.
2019-01-28 20:36:02 +01:00
Matthias Urlichs 1e01e587f3 another missing comma 2019-01-28 20:36:02 +01:00
Matthias Urlichs d8f5dd701b another tab 2019-01-28 20:36:02 +01:00
Matthias Urlichs bee609a316 more list() 2019-01-28 20:36:02 +01:00
Gina Häußge fb38c396e8 Merge pull request #3010 from HarlemSquirrel/maintenance-disk-usage
Add system usage API endpoint
2019-01-28 18:33:38 +01:00
Gina Häußge 904b3c6cf5 🔧 Adjust default regex of temperature terminal filter (2nd try)
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
2019-01-28 18:20:03 +01:00
Gina Häußge 7f2b79bcd5 ⏪ Revert "🔧 Adjust default regex of temperature terminal filter"
This reverts commit dd692d6
2019-01-28 18:02:46 +01:00
Gina Häußge dd692d6f30 🔧 Adjust default regex of temperature terminal filter
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
2019-01-28 17:56:10 +01:00
Gina Häußge 5d021d76a0 ✨ action_command_prompt: PROMPT_SUPPORT capability support
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
2019-01-28 17:41:01 +01:00
Matthias Urlichs 5794a347f1 Added myself to AUTHORS ;-) 2019-01-28 15:08:40 +01:00
Gina Häußge 2db230549e ✨ action_command_prompt: signal prompt support on connect (default off)
Note: Has to be enabled manually for now as long as we cannot detect
that the firmware indeed has support for M876.

See MarlinFirmware/Marlin#12982
2019-01-28 14:50:40 +01:00
Gina Häußge 01484b630a ✨ action_command_prompt: EMERGENCY_PARSER support (default off)
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
2019-01-28 14:32:10 +01:00
Matthias Urlichs 5d8535cb9c Test string must be Unicode 2019-01-28 14:14:23 +01:00
Matthias Urlichs 21d3622c2e fix dependency (TEMP) 2019-01-28 14:14:23 +01:00
Matthias Urlichs 008cde6ef6 octoprint.user => octoprint.access.user 2019-01-28 14:14:23 +01:00
Matthias Urlichs 4df57cd8fe Fix DeprecationWarning about using __plugin_implementations__ 2019-01-28 14:14:23 +01:00
Matthias Urlichs f53380c04e superfluous (and deprecated) import 2019-01-28 14:14:23 +01:00
Matthias Urlichs 8af45e2f21 need to list-ify OS matches 2019-01-28 14:14:23 +01:00
Matthias Urlichs 0da47858fa Escaping woes 2019-01-28 14:14:23 +01:00
Matthias Urlichs abfffa3231 Remove deprecated unittest.TestCase.assertDictContainsSubset 2019-01-28 14:14:23 +01:00
Matthias Urlichs e056ccdf29 Testing: exception args 2019-01-28 14:14:23 +01:00
Matthias Urlichs e334d8b073 Testing: file modes 2019-01-28 14:14:23 +01:00
Matthias Urlichs f1673c148f str vs utf 2019-01-28 14:14:23 +01:00
Matthias Urlichs ae5a1dc6dc Don't base your exceptions on BaseException 2019-01-28 14:14:23 +01:00
Matthias Urlichs 7fcc3551ca We need text mode for JSON and YAML 2019-01-28 14:14:23 +01:00
Matthias Urlichs f3fdac7e5a Use raw strings for all regexps.
No exceptions please.
2019-01-28 14:14:23 +01:00
Gina Häußge d8088887e1 🐛 Fix bug introduced in bd58138acf 2019-01-28 13:45:09 +01:00
Gina Häußge 379411cea7 🔧 action_command_prompt: M876 as default command
See MarlinFirmware/Marlin#12982
2019-01-28 13:10:00 +01:00
Gina Häußge 5e953c12a1 💬 Rewording 2019-01-28 13:07:34 +01:00
Gina Häußge bd58138acf 🎨 Refactored for better code reuse 2019-01-28 13:05:27 +01:00
Gina Häußge 44b4c6cc40 🐛 sleep => time.sleep 2019-01-28 13:00:26 +01:00
Gina Häußge f3f1061f9d ❇️ Configurable terminal log size in comm layer
See https://discourse.octoprint.org/t/logging-terminal-information-on-failed-print/7047/3?u=foosel
2019-01-28 12:03:16 +01:00
Matthias Urlichs bba95e9000 dup future statement 2019-01-28 11:12:51 +01:00
Matthias Urlichs fa81791c29 NO we do NOT open text files in binary mode 2019-01-28 11:12:29 +01:00
Matthias Urlichs a4072723bf tabs vs. spaces 2019-01-28 11:11:46 +01:00
Matthias Urlichs d451acdd4f "futures" is py2 only 2019-01-28 11:11:34 +01:00
Matthias Urlichs a1a15e40e0 Replace all bare "except:" handlers
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.
2019-01-28 07:50:55 +01:00
Matthias Urlichs 0c264ca0d2 less encompassing exception 2019-01-28 07:50:55 +01:00
Matthias Urlichs 9e4b0f83d8 misc 2019-01-28 07:50:55 +01:00
Matthias Urlichs 2b8d831308 bad patch 2019-01-28 07:50:55 +01:00
Matthias Urlichs fcb0f877b8 py23 2019-01-28 07:50:55 +01:00
Matthias Urlichs c74e3a0a0b don't multiply with -1 2019-01-28 07:50:55 +01:00
Matthias Urlichs ea64c017e8 event tags etc. are not supposed to be binary 2019-01-28 07:50:55 +01:00
Matthias Urlichs 70a104e32a shebang python2 => python 2019-01-28 07:50:54 +01:00
Matthias Urlichs 75a37f5ce7 missing comma
merge error
2019-01-28 07:50:54 +01:00
Matthias Urlichs e4d083028c hashlib fix from razer 2019-01-28 07:50:54 +01:00
Matthias Urlichs 6bab550830 unicode/basestring confabulation 2019-01-28 07:37:28 +01:00
Matthias Urlichs f9916783e9 whitespace 2019-01-28 07:34:19 +01:00
Matthias Urlichs e00375e586 don't use six 2019-01-27 17:49:20 +01:00
Matthias Urlichs 41fab8a36c atomic_write: use keyword for mode argument
this will allow us to define atomic_write as keyword-only
as soon as py2 compatibility is dropped.
2019-01-27 17:42:36 +01:00
Matthias Urlichs c05b6572c5 Fix coding= headers 2019-01-27 17:36:16 +01:00
Matthias Urlichs 1ae6b73f7a use setup.py from razer 2019-01-27 17:34:35 +01:00
Matthias Urlichs 670ca15997 Merge remote-tracking branch 'origin/maintenance' into py23 2019-01-27 17:28:46 +01:00
Matthias Urlichs ea5ef34cc1 Merge commit 'ac3b8ebfccfc626c19d1ae731df65cd408f9b9c4' into py23 2019-01-27 17:16:14 +01:00
Matthias Urlichs 958fc7600d Merge commit 'e0543de8ef5c1f67d4064e84a5e7ecacbdf1029e' into py23 2019-01-27 17:15:52 +01:00
Matthias Urlichs 13d894e74b Merge commit '9cfcbd3929cd7fbea4e585f01e101a3dc5055ee1' into py23 2019-01-27 17:14:15 +01:00
Matthias Urlichs 353309fc60 Merge commit 'd3334b29d9124b8a9e9c2dbfcdd6e125e471c412' into py23 2019-01-27 17:13:28 +01:00
Matthias Urlichs 3501179257 Merge commit '41e74df8d33b4f8b332ca278db478a70dcfe7aec' into py23 2019-01-27 17:12:24 +01:00
Matthias Urlichs f993f744ba Merge commit 'c623e90ebc59b90b4f4cf582ab8185b2872acff4'; commit 'f416e96414f33fb31afdf4dfbf3c863e3db35543'; commit '9ecf39febe31a44e5f5db28249ebbf006ac1580c'; commit '582b03f21fe3d808bf4e11bbba90af54b6651b34'; commit 'f5c8b04958170f19f1806b1722bf5e857ded3dce'; commit '36818057a3b4769a77731f3be8bc661437db7132'; commit 'd987cb23c119132b287f70f1c979aac8c9fff7d2' into py23 2019-01-27 17:10:01 +01:00
Gina Häußge 68410cb3d7 🐛 Fix an issue with plugin sorting
If we just uninstalled a plugin there might not be a PluginInfo object.
In that case assume the plugin is not bundled (not False = True)
2019-01-25 16:14:45 +01:00
Gina Häußge db009e3ba2 🐛 backup: do not translate plugin name
Only translate it at template level, not before.

Fixes #3012
2019-01-25 15:48:35 +01:00
Gina Häußge 09d3c44161 🐛 unicode-ify octoprint.plugin.core
Fixes #3012
2019-01-25 15:39:31 +01:00
Gina Häußge c2814651f9 errortracking: keep disabled on unreleased versions
We don't want to track errors during development, unless overridden
via config flag.
2019-01-23 12:23:38 +01:00
Gina Häußge eb46815789 Slight refactoring for improved testability & fix tests 2019-01-22 15:40:08 +01:00
Kevin McCormack 449fa0c7ec WIP Update test_system 2019-01-21 12:49:57 -05:00
Kevin McCormack 0489dfeaee [WIP] Add disk usage API endpoint 2019-01-20 10:02:13 -05:00
Gina Häußge a9b395dac8 ✨ Dedicated settings for webcam/timelapse support
Implements #2974
2019-01-18 16:58:34 +01:00
Gina Häußge 44a40b8297 errortracking: fix typo -_- 2019-01-18 14:36:46 +01:00
Gina Häußge 49728f18c6 errortracking: add missing dependency 2019-01-18 14:27:26 +01:00
Gina Häußge f6ec0bca6e errortracking: first throw at an implementation
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)
2019-01-18 14:13:26 +01:00
Gina Häußge 6a069de240 Put generic templates after javascript assets
That way it's possible for plugins to reference already loaded libraries
or constants in any injected generic templates.
2019-01-18 14:10:47 +01:00
Gina Häußge 2287c65784 forcelogin: ui_render sorting key of 0
If third party UIPlugin want to override the forcelogin plugin, they'll
need to return a negative sorting key.
2019-01-17 17:55:24 +01:00
Gina Häußge 3b26a2f7d2 Take bundle status into account for plugin sorting 2019-01-17 17:54:24 +01:00
Gina Häußge 18ffdcff6b forcelogin: Accept auth via apikey & auth headers
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
2019-01-17 17:33:00 +01:00
Gina Häußge faab946aeb Add missing , 🤦‍♀️ 2019-01-17 15:34:57 +01:00
Gina Häußge a48e069aa6 Fix race condition on start of SD print
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
2019-01-17 13:16:07 +01:00
Gina Häußge d4d5bed514 Fix broken sdcard upload success handling
Spotted by @devildant, thanks!

Closes #3005
2019-01-17 10:49:48 +01:00
Gina Häußge 97f84f120c Improve inline docs for serial.disconnectOnErrors behaviour
See #3002
2019-01-16 19:17:10 +01:00
Gina Häußge cdc69ea93c tracking: add elapsed time to cancelled tracking event 2019-01-16 18:50:51 +01:00
Gina Häußge 467dd344cf docs: document time field in PrintCancelled payload 2019-01-16 18:48:53 +01:00
Gina Häußge 6b9c9f47da Don't send reason field in PrintCancelled event payload 2019-01-16 18:47:40 +01:00
Gina Häußge b7f17531d2 tracking: fix tracking not starting fully during runtime
We didn't start the ping thread and also not the throttle state monitor
if switched on during run time.
2019-01-16 18:38:47 +01:00
Gina Häußge 987379d6e7 Merge branch 'maintenance' into pr/2968
# Conflicts:
#	src/octoprint/plugins/tracking/__init__.py
2019-01-16 18:34:30 +01:00
Gina Häußge 62b1d91901 tracking: refactored individual enable check
Way less repetition this way.
2019-01-16 18:33:41 +01:00
Gina Häußge 7cb5013b08 tracking: always generate a uuid on startup
But just in case still check if it's set before doing anything with it.
2019-01-16 18:29:49 +01:00
Gina Häußge 06a3baa588 Merge branch 'maintenance' into pr/2900 2019-01-16 17:52:06 +01:00
Gina Häußge 07934d26eb Refactored some things and added more docs
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.
2019-01-16 17:51:53 +01:00
Gina Häußge 3ae97a3e13 Add user & job owner to print job events
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
2019-01-16 14:04:16 +01:00
Gina Häußge 5f22e68985 Add clear button to files search
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
2019-01-16 12:01:03 +01:00
Gina Häußge df1dc17c51 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2019-01-16 10:29:30 +01:00
Gina Häußge 71aa405b26 Merge pull request #3004 from gloomyandy/pr_write_timeout
Use non blocking I/O for writes to implement write timeout (take 2)
2019-01-16 10:29:02 +01:00
Gina Häußge 2d2986922d Merge pull request #2986 from tedder/responsive_login_page
make login page responsive
2019-01-16 10:27:59 +01:00
Andy Shaw 7b5dbef166 Use non blocking I/O for writes to implement write timeout
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.
2019-01-15 19:33:51 +00:00
Gina Häußge da61a49bd8 Forgot something 2019-01-15 17:28:13 +01:00
Gina Häußge 002802bb20 Deprecate appkey API in favor of Application Keys Plugin
Slated to be removed in 1.4.0. AFAIK nobody used it anyhow.
2019-01-15 17:25:58 +01:00
Gina Häußge 45b59494ca Add new hook too allow plugins to register custom events
Implements #2965
2019-01-15 16:54:50 +01:00
Gina Häußge 83530ec7b9 Logging: deletion confirmation & bulk delete
Implements #2962
2019-01-15 15:09:42 +01:00
Gina Häußge 918b70185e Set max-height on PNotify notifications
Fixes #2959
2019-01-15 14:51:57 +01:00
Gina Häußge 6aa89b77dc autologin: also check against v6 representation of v4 networks
See #2976
2019-01-14 12:03:53 +01:00
Gina Häußge 1679b45cd6 Merge pull request #2978 from agrif/fix/plugin-module-names
Use module name when loading plugins from entry points.
2019-01-11 15:11:06 +01:00
Gina Häußge 4728a1a5a9 Merge pull request #2993 from hgross/fix/restore-on-docker-volumes
Fix #2992 (restore mechanism on docker volumes)
2019-01-11 14:54:45 +01:00
Gina Häußge c35a387520 Merge pull request #2973 from melgish/bugfix/2971
use jQuery for checked state.
2019-01-11 14:53:01 +01:00
Gina Häußge d7aae66886 Add --disable-pip-version-check to pip calls
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
2019-01-11 14:23:48 +01:00
Henning Groß 67ab9d577a Merge branch 'maintenance' into fix/restore-on-docker-volumes 2019-01-08 10:58:19 +01:00
MirceaDan d987cb23c1 Merge branch 'devel' into dev/py23_metaclass 2019-01-07 21:41:14 -08:00
Henning Gross 10d045d743 Added @hgross to AUTHORS.md 2019-01-07 22:25:29 +01:00
Henning Gross 44818993ff #2992 use shutil.move instead of os.rename 2019-01-07 21:49:21 +01:00
tedder 970b9c3384 make login page responsive
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.
2019-01-02 19:53:21 -08:00
Aaron Griffith 89f94be96a Use module name when loading plugins from entry points. 2018-12-29 21:52:11 -05:00
Nicholas J. Fiorello Jr 52cfd93301 use jQuery for checked state. 2018-12-24 18:11:47 -05:00
tedder 2a8d103dc6 handle missing uuid at sha time
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').
2018-12-22 14:47:52 -08:00
Gina Häußge d452051c0a Add systemd file
As discussed in #1716
2018-12-19 14:47:52 +01:00
Gina Häußge 99b32fc6c3 Merge remote-tracking branch 'origin/maintenance' into maintenance 2018-12-19 13:37:51 +01:00
Gina Häußge 5b4f4e3d77 Tentatively support Python 3 while that is being worked on 2018-12-19 13:36:55 +01:00
Gina Häußge c66b451efd Merge branch 'maintenance' into devel 2018-12-19 13:35:42 +01:00
Gina Häußge 4e9437114b Change wording & exception type 2018-12-19 13:35:18 +01:00
Connor Wolf 52c7321c78 Handle unsupported version at runtime.
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
2018-12-19 13:34:37 +01:00
Gina Häußge ef94646083 printer_safety: Added version restriction to anycubic detection
Had to refactor check system to make this possible. Checks are now
implemented in classes that allow to track state.
2018-12-19 13:17:45 +01:00
Unknown 37f3396be3 try fix default function 2018-12-18 19:32:31 +01:00
Unknown f8f461b804 add callback for on success/error for hook sdcopy 2018-12-18 19:07:15 +01:00
Unknown 5396daa7f6 move default fuction to local fuction + minor fix 2018-12-18 18:47:16 +01:00
Gina Häußge bb51dc23fc Merge pull request #2960 from jubaleth/fix/ExceptionMessageCorrection
Exception message correction
2018-12-18 11:06:35 +01:00
Jubaleth 2733838574 Corrected plugin manager failure exception message 2018-12-17 18:57:22 +01:00
Gina Häußge a23d92158b tracking: Track uptime of OctoPrint in ping event
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.
2018-12-17 17:47:22 +01:00
Gina Häußge 99225244f1 Add full version string to API 2018-12-17 14:20:42 +01:00
Gina Häußge e30f1b9f82 Add "::1/128" to localNetworks for auto login
See BillyBlaze/OctoPrint-TouchUI#266
2018-12-17 12:29:19 +01:00
Unknown 054bbead72 clean doc + add default function + reduce parameter 2018-12-13 21:28:49 +01:00
Unknown 30294e9009 replace tab by space 2018-12-13 18:39:29 +01:00
Gina Häußge bf5bc14c87 backup: fix needed space calculation
It wasn't taking excludes into account. Now its calculation mirrors the
zip file creation.
2018-12-13 16:29:22 +01:00
Gina Häußge f6dd13af7a tracking: add printer safety warnings to tracking
We want to get an idea how many people are running unsafe firmware.
2018-12-13 15:24:24 +01:00
Gina Häußge 5760b4b264 tracking: check enabled state before preparing payload
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.
2018-12-13 13:13:02 +01:00
Gina Häußge 49b995b234 Set 10min idle timeout on tornado under windows
Possible workaround for #2916
2018-12-12 16:06:15 +01:00
Gina Häußge 8cf5ca9589 tracking: Track firmware/communication errors 2018-12-12 15:41:36 +01:00
Gina Häußge ae36a3905a printer safety: Mark Malyan M200 fw 4.0+ as safe
Implements #2947
2018-12-12 15:25:38 +01:00
Gina Häußge bfd847f0a6 GCODE viewer: Bring back the layer count 2018-12-12 15:16:17 +01:00
Gina Häußge e14cb44e13 Fix merge error & forcelogin plugin 2018-12-12 14:39:39 +01:00
Gina Häußge 17ad63dabf Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/templates/tabs/temperature.jinja2
2018-12-10 15:01:16 +01:00
Gina Häußge ef81702219 Merge remote-tracking branch 'origin/maintenance' into maintenance 2018-12-10 14:59:55 +01:00
Gina Häußge 7cbe6244ae Merge branch 'staging/maintenance' into maintenance 2018-12-10 14:59:39 +01:00
Gina Häußge 112a8b9c8b Merge branch 'rc/maintenance' 2018-12-10 13:01:23 +01:00
Gina Häußge 98b692d845 Preparing release of 1.3.10 2018-12-10 12:44:25 +01:00
Gina Häußge f4f7c87640 Always show actual received from printer instead of off
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.
2018-12-06 11:49:23 +01:00
MirceaDan 39cda08d07 added six to required deps
i believe six was already brought in by other packages, but better to be specified in clear than to assume other will install it.
2018-12-03 10:41:46 -08:00
Gina Häußge 3a1611e5c4 Merge branch 'maintenance' into devel 2018-12-03 14:17:32 +01:00
Gina Häußge 5af5cbbb37 Merge branch 'staging/maintenance' into maintenance 2018-12-03 14:16:50 +01:00
Gina Häußge a657ebd528 staging/maintenance is now 1.3.10rc5.dev 2018-12-03 14:16:31 +01:00
Gina Häußge e628aedbc1 Preparing release of 1.3.10rc4 2018-12-03 12:42:28 +01:00
MirceaDan 7736cf1e6d import configparser py3
compat with py3
import configparser
2018-12-02 16:10:37 -08:00
MirceaDan 41e74df8d3 click.disable_unicode_literals_warning = True
when importing from future unicode literals those warning will need to be disabled
2018-12-02 15:44:20 -08:00
MirceaDan ac3b8ebfcc winreg compatibility with python3
_winreg has been renamed in winreg in py3
2018-12-02 15:24:19 -08:00
MirceaDan e0543de8ef print is a function + header
made print a function and added imports from future and encoding
2018-12-02 02:30:47 -08:00
MirceaDan f243a52823 all files start now with same 2 lines
# coding=utf-8
from __future__ import absolute_import, division, print_function
2018-12-02 02:13:12 -08:00
MirceaDan 94013ddb70 py23 compat for defining metaclasses
in python 3 and py2 metaclases are define ddiferentley, using six to get to a common solution
2018-12-02 01:25:27 -08:00
MirceaDan 9cfcbd3929 unquote works properley now with py2 and py3
py3 support directley to provide encoding, py2 has to do more work
2018-12-02 01:12:12 -08:00
MirceaDan 6cfbdc6062 py23 urlib compat
unquote was move dto a diferent location
2018-12-01 22:44:01 -08:00
MirceaDan d3334b29d9 fix for tests and previous commit regarding estimations
tests needed updated None replaced with -1
2018-12-01 22:26:30 -08:00
MirceaDan 94ce6f1dd1 cannot compare number with None
TypeError: '<' not supported between instances of 'float' and 'NoneType'
2018-12-01 20:02:22 -08:00
MirceaDan c623e90ebc chnaged teh default from binary to text mode
seams like open was defaulting to text mode, since now is specified in clear i made sure it matches with teh previous default
2018-12-01 17:43:19 -08:00
MirceaDan b6e49b59a7 unitest update to decode utf8
TypeError: write() argument 1 must be unicode, not str
2018-12-01 17:11:07 -08:00
MirceaDan f416e96414 defined unicode as str or used basestring
in py3 unicode does not exists is default str type but it exists in py2, wrote code to make it run in both py2 and py3
2018-12-01 17:00:37 -08:00
MirceaDan 347f53baa4 file must be open in text mode
those files must be opened in text mode in python3
2018-12-01 16:36:11 -08:00
MirceaDan 9ecf39febe we need a list not a map object
AssertionError: Second sequence is not a list: <map object at 0x7f7b0d3811d0>
2018-12-01 16:26:43 -08:00
MirceaDan 582b03f21f async is a function in py3
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
2018-12-01 16:13:20 -08:00
MirceaDan ff0b94c78d py23 compat: list is needed not a view
in py3 keys() returns a view but in this cases we need a list
2018-12-01 15:42:01 -08:00
MirceaDan f5c8b04958 DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
2018-12-01 15:07:04 -08:00
MirceaDan 36818057a3 commands to be able to develop for py2 and py3 in same time
this way we can test both py2 and py3
2018-12-01 13:13:19 -08:00
MirceaDan a5cff5bc3d this file must be opened in text mode
the version file must be read in text mode
2018-12-01 12:19:30 -08:00
MirceaDan a4bff305b3 name update
filled in full name
2018-12-01 12:08:10 -08:00
MirceaDan 6b149e2fc9 fixed unitests for io.open change
the fixups needed change to use io.open in mock
some io.open needed to be read as text
2018-12-01 11:57:10 -08:00
Gina Häußge 38fce1665b backup: signal restore done before reboot 2018-11-30 20:07:18 +01:00
Gina Häußge f51a98768c backup: more feedback during restore
The upload of a backup can take a while, so pop up the work dialog as
soon as that starts, not only when it is finished.
2018-11-30 20:06:57 +01:00
Gina Häußge 4d04c323f6 backup: use base version for version check 2018-11-30 20:06:24 +01:00
Gina Häußge 94116bfd53 backup: fix on_restore_failed calls 2018-11-30 18:33:58 +01:00
Gina Häußge a05761e63f backup: better error logging 2018-11-30 18:29:55 +01:00
Gina Häußge 89469d38ae printer safety: Fix localization of warning 2018-11-30 17:06:07 +01:00
Gina Häußge bd2616e888 backup: exclude generated, logs & watched
We don't need these in the backup, and in fact they only make things
more bloated and/or complicated.
2018-11-30 16:53:26 +01:00
Gina Häußge 02e996436d backup: restore is not supported on windows
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.
2018-11-30 16:53:19 +01:00
Gina Häußge a3f2e0b56c backup: fix plugin compatibility check on restore
Fixes #2920
2018-11-30 16:21:58 +01:00
MirceaDan 337e49208a py23 compat: using io.open instead of open
for python3 and python2 to work teh same io.open must be used for file handling
2018-11-30 00:32:57 -08:00
Gina Häußge b052925424 Merge remote-tracking branch 'origin/devel' into devel
# Conflicts:
#	tests/filemanager/test_filemanager.py
2018-11-28 17:37:47 +01:00
Gina Häußge 970c867ee4 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/plugins/forcelogin/__init__.py
#	src/octoprint/server/util/sockjs.py
#	src/octoprint/users.py
2018-11-28 16:33:11 +01:00
Gina Häußge c4295d6a81 Merge branch 'staging/maintenance' into maintenance 2018-11-28 14:57:14 +01:00
Gina Häußge d60cab1962 staging/maintenance is now 1.3.10rc4.dev 2018-11-28 14:56:39 +01:00
Gina Häußge b01e327f9d Preparing release of 1.3.10rc3 2018-11-28 12:56:02 +01:00
Gina Häußge 09af2813d0 Add dedicated issue templates 2018-11-27 14:21:13 +01:00
Gina Häußge 2f69a84352 Use max of comm & temp timeout as serial timeout
That way we avoid issues if the user has set a longer temperature
reporting interval than (busy) communication timeout.

See #2905
2018-11-26 15:33:37 +01:00
Gina Häußge 13260fa219 tracking: file path instead of just name in print events
Closes #2908
2018-11-26 14:10:03 +01:00
Gina Häußge 9a90093dda tracking: file path instead of just name in print events
Closes #2908
2018-11-26 14:08:33 +01:00
Gina Häußge 8292408c79 Remove image from changelog, replace with text
Closes #2909
2018-11-26 12:05:58 +01:00
Gina Häußge 9165f83084 printer safety: Mark stock Micro3D fw as unsafe
See https://github.com/donovan6000/iMe/issues/67#issuecomment-441454163
2018-11-26 10:27:20 +01:00
Gina Häußge c2ef371089 Docs: add documentation for some config params 2018-11-23 11:12:40 +01:00
Gina Häußge fa9472d4aa Fix SWU restart command again
Accidentally committed something I only changed for a test. Oops.
2018-11-22 15:54:02 +01:00
Gina Häußge 037e92c447 Recognize incomplete startups and set safe mode flag 2018-11-22 15:52:18 +01:00
Gina Häußge 170804d4df Create a backup of working config.yaml after startup 2018-11-22 13:47:02 +01:00
Gina Häußge ac129a2576 Only patch sarge's async on python 2 2018-11-22 13:10:59 +01:00
Gina Häußge db8d420860 Decorator for sarge that translate async to async_
Should work around issues with third party plugins that haven't yet
adapted.
2018-11-22 12:37:28 +01:00
Gina Häußge 7d7cbb1760 Some reordering in the settings 2018-11-21 16:14:23 +01:00
Gina Häußge 89979f1bee Revert "Hardening against bad plugins"
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.
2018-11-21 16:14:06 +01:00
Gina Häußge bd241e8e6c backup: allow zip64 2018-11-21 12:19:04 +01:00
Gina Häußge 7939b0ae4d backup: better error reporting 2018-11-21 12:10:03 +01:00
Gina Häußge 6b57ba2d7d printer_safety: detect iMe on Micro3D
See donovan6000/iMe#67
2018-11-20 12:42:52 +01:00
Gina Häußge 2c5465f9a6 Got rid of an unused import 2018-11-20 12:42:50 +01:00
Gina Häußge 1565129cfb docs: warning about blocking ops in some plugin callbacks 2018-11-20 12:42:49 +01:00
Gina Häußge b8d4a58207 SWU: remove one thread level
on_after_startup now runs in its own thread, no need to spawn yet
another.
2018-11-20 12:42:43 +01:00
Gina Häußge 900f03dc8a SWU: add a timeout to the wait on environment info 2018-11-20 12:24:50 +01:00
Gina Häußge 0c4c4a9d18 Hardening against bad plugins
We don't want on_after_startup or on_event handling to get blocked by
some rogue plugin that decides to block or outright kill the thread.
2018-11-20 12:19:17 +01:00
Gina Häußge ff4ed38329 Track user logout on socket 2018-11-19 15:24:12 +01:00
Gina Häußge 5f78ab7b73 Register for plugin messages on socket connect
Second part of the fix for #2898
2018-11-19 15:22:45 +01:00
Gina Häußge 6556d555bd forcelogin: Keep message backlog while not authed
First part of the fix for #2898
2018-11-19 15:22:33 +01:00
Gina Häußge d318ff82b8 More error resilience in the local ip check
Should solve #2897
2018-11-16 13:57:11 +01:00
Gina Häußge ff53a826f9 tracking: Fix link of plugin in plugin manager 2018-11-16 13:19:31 +01:00
Unknown abb14dc17a add hook for sdcard copy + documentation 2018-11-16 11:17:05 +01:00
Unknown a45c86eed1 Revert "add self param to error_hook + update documentation"
This reverts commit c30380d423.
2018-11-16 11:03:35 +01:00
Unknown c30380d423 add self param to error_hook + update documentation 2018-11-16 11:02:15 +01:00
Gina Häußge d79e777911 Update german translation 2018-11-15 14:42:48 +01:00
Gina Häußge 335e635ec7 printer_safety_check: Make a text translateable 2018-11-15 14:17:06 +01:00
Gina Häußge a5754a8552 pi_support: Add link to the new FAQ entry 2018-11-15 14:16:27 +01:00
Gina Häußge a8c91ff6ba pi_support: Better wording in popover & highlight current 2018-11-15 12:57:02 +01:00
Gina Häußge 6285fd8010 Allow dynamic values in ko popover binding 2018-11-15 12:40:03 +01:00
Gina Häußge c69f20c648 Mark py3 as supported for development even though it's not 2018-11-13 16:23:28 +01:00
Gina Häußge 88c93a7c11 Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
2018-11-13 16:22:07 +01:00
Gina Häußge 92629468c0 Merge remote-tracking branch 'origin/maintenance' into maintenance
# Conflicts:
#	setup.py
2018-11-13 16:17:56 +01:00
Gina Häußge 56a1d4f966 Merge branch 'staging/maintenance' into maintenance 2018-11-13 16:17:08 +01:00
Gina Häußge 799aedcaed staging/maintenance is now 1.3.10rc3.dev 2018-11-13 16:16:43 +01:00
Gina Häußge de42ce73f7 Preparing release of 1.3.10rc2 2018-11-13 12:43:06 +01:00
Gina Häußge 962e09906e tracking: Fix translatability of a message 2018-11-13 12:42:31 +01:00
Gina Häußge f607f55683 printer_safety_check: Detect Ender 3 stock fw
As reported in https://discourse.octoprint.org/t/thermal-runaway-protection-absent-on-creality-ender-3/2787
2018-11-13 11:17:24 +01:00
Gina Häußge 8e464f59ac Reapply "Updated several dependencies to current version"
This reverts commit e14c00f135.
2018-11-12 17:27:37 +01:00
Gina Häußge 91b524813c Minimum python version is now 2.7.9 2018-11-12 17:27:37 +01:00
Gina Häußge 1b45047826 tracking: wizard changes
* 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.
2018-11-12 15:23:17 +01:00
Gina Häußge edd4d90b12 tracking: tracking.js -> usage.js
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 🤦‍♀️
2018-11-12 14:33:43 +01:00
Gina Häußge 0a3ad8a880 tracking: add time & reason for failure to print_failed
(cherry picked from commit b7e373c)
2018-11-12 14:33:43 +01:00
Gina Häußge 82615791a2 Add time & reason for failure to PrintFailed event
(cherry picked from commit dae0264)
2018-11-12 14:33:42 +01:00
Gina Häußge 4548be34f0 Always trigger SettingsUpdated event on new save
So far it was only triggered when saving via the REST API, causing some
issues here and there.
2018-11-12 11:40:21 +01:00
Gina Häußge 2b5af2c36a Add docs for octoprint.util.commandline 2018-11-09 18:16:57 +01:00
Gina Häußge a939130748 Better description for Error event 2018-11-08 18:39:03 +01:00
Gina Häußge b7e373c40f tracking: add time & reason for failure to print_failed 2018-11-08 17:41:45 +01:00
Gina Häußge dae0264a58 Add time & reason for failure to PrintFailed event 2018-11-08 17:41:27 +01:00
Gina Häußge b2e50e13d4 Blacklist broken regex version 2018-11-08 15:54:05 +01:00
Gina Häußge cb4404a833 Merge branch 'pr/2878' into staging/maintenance 2018-11-08 15:50:13 +01:00
Gina Häußge 38bb81cfe7 tracking: add throttle events, slightly change throttle payload
Also adjusted helper signature in pi_support plugin slightly.

Addon to #2878
2018-11-08 15:49:11 +01:00
Gina Häußge 1667f9bd52 Fix bug introduced in 4caf4ef09 2018-11-08 14:00:48 +01:00
Gina Häußge 1ec61a9fe6 Give the favicon mask SVG width and height attrs
Otherwise it won't render correctly in Firefox due to drawImage silently
failing, see also https://bugzilla.mozilla.org/show_bug.cgi?id=700533

Closes #2879
2018-11-08 13:42:19 +01:00
tedder 98c84b6bb9 fix test, match dict 2018-11-08 01:34:45 +00:00
tedder 76f48b3b13 PR feedback: throttle state and uuid
- 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
2018-11-08 01:29:15 +00:00
Gina Häußge 8596ae5c4a SWU: Make sure check providers are in the correct format
Just in case there's some odd data in `config.yaml` as reported in https://github.com/foosel/OctoPrint/issues/2871#issuecomment-436507623
2018-11-07 11:10:31 +01:00
tedder c1482eaacd add throttle_state to tracking
- 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 :)
2018-11-06 15:37:45 -08:00
Gina Häußge e23fe4a925 forcelogin: Fix issue when running with acl disabled
Closes one variant of #2876
2018-11-06 17:34:01 +01:00
Gina Häußge 8939537fb5 Merge branch 'staging/maintenance' into maintenance 2018-11-06 15:57:18 +01:00
Gina Häußge 2f08b90200 Merge branch 'master' into staging/maintenance 2018-11-06 15:56:33 +01:00
Gina Häußge 68ca2c5e51 Pin regex dependency to last known working version
See #2874 and https://bitbucket.org/mrabarnett/mrab-regex/issues/301/typeerror-character-mapping-must-return
2018-11-06 15:52:41 +01:00
Gina Häußge 343195477b Fix connection fail if fw doesn't send start
Closes #2872
2018-11-06 14:47:39 +01:00
Gina Häußge 4caf4ef09b Fix GCODE viewer not being able to load files
Side effect of the ForcedLogin plugin and a bug in
get_flask_user_from_request.

Closes #2873
2018-11-06 14:02:49 +01:00
Gina Häußge 54677f96f4 Merge branch 'maintenance' into devel 2018-11-06 12:32:25 +01:00
Gina Häußge 0ba987e126 maintenance is now 1.3.11.dev 2018-11-06 12:31:53 +01:00
Gina Häußge 0325628693 staging/maintenance is now 1.3.10rc2.dev 2018-11-06 12:29:28 +01:00
Gina Häußge e522633c98 Merge branch 'maintenance' into devel
# Conflicts:
#	AUTHORS.md
#	src/octoprint/plugins/pluginmanager/__init__.py
#	src/octoprint/plugins/softwareupdate/__init__.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/api/__init__.py
#	src/octoprint/server/util/flask.py
#	src/octoprint/server/util/sockjs.py
#	src/octoprint/server/util/tornado.py
#	src/octoprint/static/js/app/client/base.js
#	src/octoprint/users.py
2018-11-06 11:57:57 +01:00
Gina Häußge e14c00f135 Revert "Updated several dependencies to current version"
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.
2018-11-05 14:25:10 +01:00
Gina Häußge b0a4a49f99 Changelog for 1.3.10rc1 2018-11-05 13:18:05 +01:00
Gina Häußge 5b4839369e appkeys: Probe endpoint to check for workflow support
Also adjusted docs and js client lib accordingly.
2018-11-05 12:50:05 +01:00
Gina Häußge 1ff02b9f1c Update bundled German translation 2018-11-05 11:59:48 +01:00
Gina Häußge e2c1fa3d43 Appkeys: request creation should respond with 201 2018-11-02 17:04:58 +01:00
Gina Häußge 39a466e316 Appkeys: Make timeout thread safe 2018-11-02 12:53:30 +01:00
Gina Häußge 9e940eacc3 Merge branch 'fix_appkey_orphan_dialogs' of https://github.com/fieldOfView/OctoPrint into pr/2869 2018-11-02 12:27:16 +01:00
Gina Häußge 2e38f237de Fix cancel snippet for shared nozzle setups
See https://discourse.octoprint.org/t/prusa-mmu2-how-to-properly-configure/4937/
2018-11-02 12:20:05 +01:00
fieldOfView 7f36ffdafd Expire request_access when the client stops polling 2018-11-02 11:04:06 +01:00
Gina Häußge 39b2da3230 Merge pull request #2868 from gdombiak/extrude_speed2
Documentation fixed and extrusion speed value check
2018-11-02 10:52:42 +01:00
fieldOfView c489829efb Add myself to AUTHORS.md
because it's a requirement for a PR
2018-11-02 09:31:56 +01:00
fieldOfView e30e129e2a Close request_access dialogs on other open connections when a decision is made
Once a decision is made on one connection (browser window), dialogs on other connections are no longer relevant.
2018-11-02 09:22:30 +01:00
Gaston Dombiak 32d5b25013 Removed unnecessary variable initialization 2018-11-01 21:44:42 -07:00
Gaston Dombiak 6227a0dfb9 1) Fixed documentation about speed unit and 2) extrusion speed is now limited to printer profile max value 2018-10-31 20:45:56 -07:00
Gina Häußge e234c6146e Better detection of ipv6 support
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.
2018-10-31 13:39:54 +01:00
Gina Häußge c146731e5a Merge pull request #2865 from gdombiak/extrude_speed
Extrude speed
2018-10-31 11:58:28 +01:00
Gina Häußge 5ee242be4a Fix doc bug: mm/s => mm/min 2018-10-31 11:54:17 +01:00
Gaston Dombiak 556878a774 Merge branch 'maintenance' into extrude_speed 2018-10-30 19:09:05 -07:00
Gaston Dombiak 00aa4876e9 Added support to specify extrude/retract speed. Only at REST API. No UI changes were made 2018-10-30 19:01:20 -07:00
Gina Häußge f72f948744 Merge pull request #2828 from tedder/devel_ted_py3_round3
tedder's python3 fixes, round 3
2018-10-30 17:36:38 +01:00
Gina Häußge e5e8581f9a Detect invalid test setups in settings tests
Should prevent future cases of the chainmap issue observed in #2828 and
maybe also #2829
2018-10-30 17:16:48 +01:00
Gina Häußge 3ad4818488 Use read instead of write mode in _load_yaml 2018-10-30 16:56:14 +01:00
Gina Häußge b3cc44cea5 Fix build error
`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.
2018-10-30 16:46:12 +01:00
Gina Häußge 95a9f84b39 Reflect current connection in connection panel
Implements #2859
2018-10-30 15:56:36 +01:00
Gina Häußge 371f1a818f tracking: add uuid to filename hash in print event tracking
We don't need to be able to identify the same file across multiple
instances, just repeated prints on the same instance.

Thanks to @scoder for the suggestion.
2018-10-30 13:36:32 +01:00
Gina Häußge 4ed5f7ed28 Updated several dependencies to current version
Werkzeug update required a flask monkey patch since we can't update
flask due to it depending on a newer jinja version which is backwards
incompatible and hence would cause issues with third party plugins.

Also added notes to the dependencies that are found to be hard to update
so that future release preparations don't require to figure out the
"why not" all over again.
2018-10-30 13:31:36 +01:00
Gina Häußge 4eb81aae9d cura: workaround for broken placeholders in profiles
Apparently some exports contain ?print_temperature? instead of
{print_temperature} style placeholders? At least that was observed in
the example in #2629.

This fixes such placeholders.
2018-10-29 17:41:57 +01:00
Gina Häußge dafa4c97ad cura: fix extruder count for start gcode selection
Fixes #2629
2018-10-29 17:30:49 +01:00
Gina Häußge 0268cafa90 Reflect current port/baudrate/profile in connection tab
Fixes #2740
2018-10-29 13:56:34 +01:00
Gina Häußge a5caac8d38 Disable external heatup detection for teacup fw
Implements #2854
2018-10-29 11:55:37 +01:00
Gina Häußge 7ca9d56327 Merge branch 'improve/appauth' into maintenance 2018-10-29 11:45:05 +01:00
Gina Häußge d9323b7172 docs: new clientjs asset type 2018-10-29 11:44:27 +01:00
Gina Häußge 8f6d67195d appkeys: clean up pendings older than 10min & meta data 2018-10-29 11:42:12 +01:00
Gina Häußge 342d526a51 appkeys: finalize docs 2018-10-29 11:08:00 +01:00
Gina Häußge d7c5f57c98 appkeys: fix app bulk selection 2018-10-29 10:32:13 +01:00
Gina Häußge d89ca38ee8 WIP: Docs for appkeys plugin 2018-10-29 10:30:48 +01:00
Gina Häußge cb969be403 docs: clarify that user name == user id 2018-10-24 09:52:26 +02:00
Gina Häußge 7cb649c303 docs: fix auth message docs on push API
Thanks @gdombiak for the heads-up
2018-10-24 09:48:00 +02:00
Gina Häußge 6d7d365b27 appkeys: bulk delete & fixed sorting 2018-10-23 13:47:54 +02:00
Gina Häußge 8ad720e554 Merge remote-tracking branch 'origin/improve/appauth' into improve/appauth
# Conflicts:
#	src/octoprint/plugins/appkeys/__init__.py
#	src/octoprint/plugins/appkeys/static/clientjs/appkeys.js
#	src/octoprint/plugins/appkeys/static/js/appkeys.js
#	src/octoprint/plugins/appkeys/templates/appkeys_usersettings.jinja2
#	src/octoprint/server/util/flask.py
2018-10-22 18:53:28 +02:00
Gina Häußge 37190da2d6 Merge branch 'maintenance' into improve/appauth
# Conflicts:
#	src/octoprint/server/util/flask.py
2018-10-22 18:50:32 +02:00
Gina Häußge 2746139fa6 appkeys: central settings page with all keys 2018-10-22 18:44:55 +02:00
Gina Häußge c9f10ae723 printer_safety_check: docs update 2018-10-22 17:42:31 +02:00
Gina Häußge 202006149c forcelogin: documentation, incl. newly added hooks 2018-10-22 17:38:48 +02:00
Gina Häußge 671973062e announcements: add missing images for docs 2018-10-22 16:43:07 +02:00
Gina Häußge 1d15c2a176 backup: docs & small changes in wording 2018-10-22 16:42:47 +02:00
Gina Häußge 5e490ec7fd Revert "Update some dependencies"
This reverts commit 6d2be17
2018-10-22 16:19:42 +02:00
Gina Häußge 1889a40241 Merge branch 'improve/swuCheckEnvironment' into maintenance 2018-10-22 13:07:59 +02:00
Gina Häußge 6d2be1743a Update some dependencies
There are more updates, but they introduce backwards compatibility
issues that would hurt third party plugins, so we need to find
workarounds for these first - or trigger a grace period.
2018-10-22 13:02:57 +02:00
Gina Häußge e9e4adf09b tracking: flask.ext.babel => flask_babel 2018-10-22 13:01:42 +02:00
Gina Häußge 535ad6eae6 Merge pull request #2858 from gdombiak/issue_2850
Fixed unsafe write_message call from another thread
2018-10-22 11:47:16 +02:00
Gaston Dombiak c4167a82c5 Fixed unsafe write_message call from another thread.
Issue #2850
2018-10-21 00:58:14 -07:00
Gina Häußge 087a9ece2c Make sure to show only one external address warning notification at once 2018-10-19 17:00:42 +02:00
Gina Häußge b77380a8ac Add logging for active/passive login 2018-10-19 16:50:58 +02:00
Gina Häußge 169275b052 Fix wrong position of parentheses, add unit tests 2018-10-19 16:39:18 +02:00
Gina Häußge 757dfcf5c7 unmap ipv6 mapped v4 addresses on lan check 2018-10-19 16:19:51 +02:00
Gina Häußge 8e39eac207 discovery: start name counter at 1
We want our second instance with the same name to show up as (2) not (1)
2018-10-19 14:17:16 +02:00
Gina Häußge 9e48b8ab65 make sure to strip comments from address 2018-10-19 14:13:33 +02:00
Gina Häußge 36b07b2337 discovery: enumerate zeroconf service names on collision
Fixes #2852
2018-10-19 13:58:37 +02:00
Gina Häußge e57c46fb67 Missed something in yesterday's changes to contrib guide 2018-10-19 13:34:13 +02:00
Gina Häußge df8226b8c5 Small changes to the contribution guidelines
* allow PRs against `maintenance` branch for improvements and small
    new features
  * suggest getting in touch on the forum for larger changes
2018-10-19 13:34:12 +02:00
Gina Häußge 2f89082df2 Missed something in yesterday's changes to contrib guide 2018-10-19 13:14:52 +02:00
Gina Häußge e0943527d6 Merge pull request #2847 from eyal0/always_babel_extract
Remove requirement to have messages.pot to use babel_extract
2018-10-18 18:36:42 +02:00
Gina Häußge 108db045ce Small changes to the contribution guidelines
* allow PRs against `maintenance` branch for improvements and small
    new features
  * suggest getting in touch on the forum for larger changes
2018-10-18 18:06:01 +02:00
Eyal Soha 025986794f Remove requirement to have messages.pot to use babel_extract 2018-10-18 11:52:01 -04:00
Gina Häußge ac2354907a Remove some trailing whitespace 2018-10-18 17:33:08 +02:00
Gina Häußge 7b5d2e3e0c Allow whitespace after : in M114 responses
Closes #2839
2018-10-18 17:32:32 +02:00
Gina Häußge efa556a812 Announcements: forgot to git add the new doc page -_- 2018-10-15 17:23:21 +02:00
Gina Häußge 7f9764c386 Announcements: fix a bug & add docs 2018-10-15 17:11:07 +02:00
Gina Häußge e95e546c08 Appkey: Copy key to clipboard 2018-10-15 12:48:41 +02:00
Gina Häußge b0e7df47a6 Appkeys: Add key persistence 2018-09-29 15:00:28 +02:00
Gina Häußge 257fc0d1cd Appkeys: allow fetching of all keys
Also added TODO list ;)
2018-09-29 15:00:27 +02:00
Gina Häußge 3fe2b611bc Appkeys: fix template config 2018-09-29 15:00:27 +02:00
Gina Häußge d6c63a5cb9 appauth -> appkeys 2018-09-29 15:00:27 +02:00
Gina Häußge ad8205c386 AppAuth: workflow fully implemented & client lib 2018-09-29 15:00:27 +02:00
Gina Häußge 6efd4dfd08 New options for confirmation dialog
* oncancel: callback to call when cancel button is pressed
  * noclose: don't allow dismissing/closing the dialog without having
    chosen to proceed or cancel
2018-09-29 15:00:27 +02:00
Gina Häußge 469bf844ee Clientlib: support operation without api key 2018-09-29 15:00:27 +02:00
Gina Häußge 4f58c64881 New asset type "clientjs" for client library bits 2018-09-29 15:00:27 +02:00
Gina Häußge b428faacc8 Appauth plugin: WIP 2018-09-29 15:00:26 +02:00
Gina Häußge 4e3adcc3f3 Add no_firstrun_access decorator 2018-09-29 15:00:26 +02:00
Gina Häußge f88147003c Repetier firmware reports fatal errors with another prefix 2018-09-29 14:54:39 +02:00
Gina Häußge bbbe85f737 Multiline fatal error parsing for Marlin 2018-09-29 14:38:54 +02:00
Gina Häußge fc97d0b424 Virtual: simulate some fatal errors 2018-09-29 14:38:35 +02:00
Gina Häußge b054ec47ad Special handling for fatal errors
If the firmware locks up it doesn't make sense to stay connected to
it even if we are supposed to only cancel an ongoing print.
2018-09-29 13:28:09 +02:00
Gina Häußge 87e7a19fdd Forcelogin: Support theming via custom hook 2018-09-28 17:57:05 +02:00
Gina Häußge fed257b5d8 Forcelogin: Fix spinner 2018-09-28 17:19:31 +02:00
Gina Häußge e53ae8cd56 Forcelogin: Access to settings isn't needed either 2018-09-28 17:15:37 +02:00
Gina Häußge a9f76dd1a3 Forcelogin: allow socket when ACL isn't setup yet 2018-09-27 18:47:00 +02:00
Gina Häußge 6bc5b8a7a9 Forcelogin: lock down sockjs socket as well 2018-09-27 18:44:03 +02:00
Gina Häußge cb9bedb6a0 Add hooks to control sockjs registrations and messages 2018-09-27 18:43:46 +02:00
Gina Häußge 5ff790048d Fix unit tests 2018-09-26 15:52:10 +02:00
Gina Häußge f32ea65b2c Support EMERGENCY_PARSER & use M108 on cancel (unless disabled)
Implements #1504
2018-09-26 15:29:15 +02:00
Gina Häußge 1f957e1ee2 forcelogin: disable while ACL hasn't been configured 2018-09-26 15:21:51 +02:00
Gina Häußge 32be5ca87c Better error handling if file becomes unreadable
Implements #2674
2018-09-24 16:50:14 +02:00
tedder 9cb3631ad0 first py3 fix 2018-09-22 18:05:32 -07:00
tedder 743ff35bcf add some yaml wrappers for the test environment 2018-09-22 18:05:10 -07:00
tedder df706f61db import locally for py3 mock compatability 2018-09-22 17:21:33 -07:00
tedder 791e759b40 keys() doesn't return a list, so restoring the contract. 2018-09-22 17:21:05 -07:00
tedder 22fdc1d933 final open mock tactic: add a central global. 2018-09-22 16:58:24 -07:00
tedder aa383e3ca1 fix all __builtin__.open patch/mock calls 2018-09-22 16:15:22 -07:00
tedder 472fda6645 setuptools py3 compatability 2018-09-22 16:02:44 -07:00
tedder bd35de80c3 fix test_file_helpers, couldn't figureout a non-conditional way to do this 2018-09-22 15:55:19 -07:00
tedder 52fe19e5f9 fix util.to_unicode for py2/py3. 2018-09-22 15:54:29 -07:00
tedder c2f09b1715 fixes to test_comm_helpers 2018-09-22 13:14:27 -07:00
Gina Häußge 8876ab0ce5 SWU: Fix version output of CLI update message 2018-09-21 18:43:20 +02:00
Gina Häußge ad8910354c SWU: Fix CLI updating
Closes #2712
2018-09-21 18:41:22 +02:00
Gina Häußge e8d6a9b221 Only reset timeout to busy once it has been set on printer
Should fix #2752
2018-09-21 18:25:58 +02:00
Gina Häußge f3cfe2ba48 Virtual: add long running pseudo G33
Useful for testing busy protocol on commands.
2018-09-21 18:25:58 +02:00
Gina Häußge d2ecb0a28f Merge pull request #2827 from tedder/docfix_sdReleativePath_maint
spellfix 'sdReleativePath'
2018-09-21 18:05:21 +02:00
Ted Timmons 134ee77e4a spellfix 'sdReleativePath'
It's only misspelled in the docs, it is correct in the code.
2018-09-21 08:45:53 -07:00
Gina Häußge 10f3f72b9c Unit tests: Fix duplicated test method
Closes #2805
2018-09-21 14:35:20 +02:00
Gina Häußge 1ccc1fa47b Merge pull request #2807 from tedder/201809_py3_devel_prep_b
201809 py3 devel prep batch b
2018-09-21 12:20:44 +02:00
tedder 2972d38cef use a number instead of a string for safe_dump 2018-09-18 08:54:58 -07:00
tedder 4662606907 PR feedback: use future instead of six
Tests pass.
2018-09-18 08:37:34 -07:00
Gina Häußge 2c50aa789a Merge branch 'pr/2733' into devel
# Conflicts:
#	src/octoprint/plugins/discovery/__init__.py
2018-09-18 17:30:30 +02:00
Gina Häußge 78b6d3a5e2 Merge pull request #2800 from gerfderp/patch-1
Documentation conjugation fix.
2018-09-18 17:18:18 +02:00
Gina Häußge a920c4fe21 Merge pull request #2806 from tedder/201809_rewrite_test_get_recovery
rewrite test_get_recovery_data
2018-09-18 17:12:27 +02:00
Gina Häußge 9e62b250ac Merge pull request #2804 from cameroncros/system-api-documentation
Fixed up documentation for system api. Now correctly matches current behaviour
2018-09-18 17:11:32 +02:00
Gina Häußge 52468e7e1c Merge pull request #2802 from tedder/201809_temperature_regex_update
201809 temperature regex update
2018-09-18 17:10:37 +02:00
Gina Häußge 03722e5e70 Merge branch 'pr/2731' into devel
# Conflicts:
#	src/octoprint/cli/analysis.py
2018-09-18 17:06:37 +02:00
Gina Häußge 9112a800c8 Add forcelogin plugin 2018-09-14 20:06:32 +02:00
Gina Häußge 177d235b29 Make a helper method public 2018-09-14 20:06:32 +02:00
Gina Häußge 2de2dc7c31 Allow further access restriction on API and Tornado routes through plugin hooks 2018-09-14 20:06:32 +02:00
Paul de Vries 8074a06d33 Use .fail instead of .error
.error() was removed in jQuery 3 and is throwing errors when logging out,
use .fail instead
2018-09-09 11:37:38 +00:00
Gina Häußge 75c801d63f Unit tests for is_lan_address
Also fixed a bug in subnet creation in the process.
2018-09-04 14:01:31 +02:00
Gina Häußge ed07764f09 Put warnings into core/first run wizard 2018-09-04 12:00:07 +02:00
Gina Häußge a929100889 Allow to disable ip check & define trusted subnets
Will need manually editing config.yaml for the time being. Someone who
is not able to edit a yaml file should not be able to disable the
warning.
2018-09-04 09:26:29 +02:00
Gina Häußge 286376321c Detect connections to the UI from external ips
Show warning to protect the innocent who don't know better than to
port forward.

Warning is ignorable (per browser) to allow users who know what they are
doing to easily get rid of it. If you don't know what you are doing and
also actively ignore THIS warning I really can't help you anymore.
2018-09-03 21:23:08 +02:00
Gina Häußge 4a36a3eed2 Appkeys: Add key persistence 2018-09-03 18:38:36 +02:00
tedder 7867052339 another 'set equality', this one to fix map/list mappings 2018-09-02 00:44:30 -07:00
tedder 8a0252ccfe add patch workaround for py2/py3 2018-09-02 00:16:06 -07:00
tedder e84293c415 add py3compat to CaseInsensitiveSet 2018-09-01 22:34:36 -07:00
tedder 250e83ad7e more specific asserts
This lets the testing framework show the test error better.
2018-09-01 22:32:47 -07:00
tedder 660724741c quick refactor for deprecated 'assertEquals'
It's been quietly allowed but was dropped in py3.
2018-09-01 22:31:33 -07:00
tedder a5f87597ad refactor and upgrade tests
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.
2018-09-01 22:27:10 -07:00
tedder 8bf9b8650d rewrite test_get_recovery_data
I was pulling my hair out with some py3 compatability, so .. I ended up basically rewriting it. Basically a big refactor, still compatible with py2.
2018-09-01 22:07:41 -07:00
Cameron Cross ebef35a573 Fixed up documentation for system api. Now correctly matches current behaviour. 2018-09-02 10:03:21 +10:00
tedder d6da819cd6 add unit tests for temperature regexes 2018-09-01 10:46:29 -07:00
tedder 2fbc81604a update temperature regex
It exists in three locations, so I'm making sure they are all synced. This ensures the MP Mini Delta flavor of Marlin is properly masked; I have that and a Prusa mk3 to verify against.

This came out of this thread:
https://discourse.octoprint.org/t/temperature-message-filter-doesnt-filter-temperature-messages/3643
2018-09-01 08:39:25 -07:00
Gina Häußge 2ca63febee Appkeys: allow fetching of all keys
Also added TODO list ;)
2018-08-31 20:45:16 +02:00
Gina Häußge 224674f27e Appkeys: fix template config 2018-08-31 20:35:16 +02:00
Gina Häußge 2f1d71a98c appauth -> appkeys 2018-08-31 20:22:40 +02:00
gerfderp 7366110f07 Update helpers.rst
fixing conjugation
2018-08-29 14:59:00 -07:00
Gina Häußge e5eb72cbfb Docs: Make it extra crystal clear to use a VPN 2018-08-29 15:49:09 +02:00
Gina Häußge b0028cd3fb AppAuth: workflow fully implemented & client lib 2018-08-28 22:05:28 +02:00
Gina Häußge 2343caea30 New options for confirmation dialog
* oncancel: callback to call when cancel button is pressed
  * noclose: don't allow dismissing/closing the dialog without having
    chosen to proceed or cancel
2018-08-28 22:04:34 +02:00
Gina Häußge 61d037f188 Clientlib: support operation without api key 2018-08-28 22:02:40 +02:00
Gina Häußge 2a79d9183a New asset type "clientjs" for client library bits 2018-08-28 22:02:18 +02:00
Gina Häußge 5dbc88b6f2 Detect scrolling direction in terminal
Only disable autoscroll if we are scrolling up.
2018-08-27 15:58:15 +02:00
Gina Häußge 83876806db Force terminal scroll on browser tab activation
Possible fix for #2774
2018-08-27 15:57:59 +02:00
Gina Häußge 5a5785be4a Appauth plugin: WIP 2018-08-24 11:59:23 +02:00
Gina Häußge 25cd4f8201 Add no_firstrun_access decorator 2018-08-24 11:58:56 +02:00
Gina Häußge 2d72a52338 Backup: Fix a copy paste error 2018-08-22 17:58:29 +02:00
Gina Häußge b5a161594d Fix documentation error
We return 403 on a wrong API key, not 401 - 401 causes issues with Basic Auth setups as reported
in #2297 and hence fixed in b1f9e070a4.

Closes #2706
2018-08-20 14:25:28 +02:00
Gina Häußge a24363c4b0 Fix API error when accessing sdcard file details
Closes #2705
2018-08-20 14:04:09 +02:00
Gina Häußge 524562527e Cura: Error message if profile import fails
See #2769
2018-08-20 12:58:27 +02:00
Gina Häußge 26856d052f Fix wrong min/max parameter being used for timeouts
Closes #2780
2018-08-20 11:54:27 +02:00
Gina Häußge 17f8817b78 Backup: Got rid of caching plans 2018-08-17 15:06:07 +02:00
Gina Häußge 4eb1d2bf80 Backup: Check compatibility when installing plugins from repo during restore 2018-08-17 15:00:09 +02:00
Gina Häußge 62120affae PMGR: Finalize extraction of is_os_compatible into octoprint.util.platform 2018-08-17 14:13:01 +02:00
Gina Häußge 66b501cfaa Backup: Show list of plugins unknown during restore in settings 2018-08-16 17:50:58 +02:00
Gina Häußge 140bf9aa5a Backup: Fix recording list of uninstallable plugins 2018-08-16 15:20:11 +02:00
Gina Häußge 711ca457f2 Backup: WIP of handling unknown plugins 2018-08-16 09:05:45 +02:00
Gina Häußge 07ae4ffe14 Backup: Delete bck from earlier restore on startup 2018-08-14 19:56:17 +02:00
Gina Häußge 3800b21e69 Bkacup: Fix CLI logging of exceptions 2018-08-14 19:48:58 +02:00
Gina Häußge 196b152ec4 Backup: Remove left over parameter 2018-08-14 19:28:36 +02:00
Gina Häußge 970810dc92 Backup: Move into "OctoPrint" sub section 2018-08-14 19:28:11 +02:00
Gina Häußge 4fec14197b Backup: Some UI changes & confirmations 2018-08-14 19:27:47 +02:00
Gina Häußge b354334a2e Backup: Add log window during restore 2018-08-13 19:02:50 +02:00
Gina Häußge a934750504 Backup: Upload of backup to restore works 2018-08-10 20:46:30 +02:00
Gina Häußge 9dc29689f4 Backup: Restore now seems to work 2018-08-10 11:58:06 +02:00
Gina Häußge 8518b40b5f Backup: WIP on restore function
Plugin installation is still challenging.
2018-08-09 12:45:27 +02:00
Gina Häußge aabd624f88 Backup: WIP on restore 2018-08-07 15:14:12 +02:00
Gina Häußge 6ae88ab8c6 Backup: subfolder for basedir contents 2018-08-06 13:43:17 +02:00
Gina Häußge 6251031d6e Backup works, incl management UI 2018-08-06 13:35:02 +02:00
Gina Häußge 249b3f442b Slight refactoring 2018-08-06 13:34:30 +02:00
Gina Häußge ff6012bb00 WIP: Backup & Restore plugin 2018-08-03 17:20:28 +02:00
Gina Häußge a137946e3a Remove setup_requires - it's incompatible to pip 2018-07-28 23:36:28 +02:00
Gina Häußge 909dd551d6 Specify support python versions 2018-07-28 23:30:43 +02:00
Gina Häußge 687b449207 SWU: Prevent auto updates in outdated environments
We will now demand minimum versions of Python, pip and setuptools to be
present before we enable updating through the plugin.

Current minimum versions are those shipped with stock OctoPi 0.14.0.
2018-07-28 23:21:47 +02:00
Gina Häußge efe552264c SWU: Fix update button being visible if update impossible 2018-07-28 23:00:07 +02:00
Gina Häußge 44fcd4e305 Merge branch 'maintenance' into devel 2018-07-25 17:38:45 +02:00
Gina Häußge b7e788ec1b Work around an issue with sarge 0.1.5
Closes #2747
2018-07-25 17:34:54 +02:00
Gina Häußge 90704e292b Merge branch 'maintenance' into devel 2018-07-25 16:57:00 +02:00
Gina Häußge e964d2410c Merge branch 'staging/maintenance' into maintenance
# Conflicts:
#	docs/bundledplugins/cura.rst
2018-07-25 16:56:43 +02:00
Gina Häußge 09284cd9b9 Merge branch 'rc/maintenance' into staging/maintenance 2018-07-25 16:54:21 +02:00
Gina Häußge 97d37c5078 Merge branch 'master' into rc/maintenance 2018-07-25 16:28:28 +02:00
Gina Häußge 432090a56a Preparing release of 1.3.9 (part 2) 2018-07-25 16:27:05 +02:00
Gina Häußge 1847b41f7e Preparing release of 1.3.9 2018-07-25 13:38:57 +02:00
Gina Häußge 4963a4b849 docs: warning re expensive code in gcode hooks 2018-07-24 17:44:59 +02:00
Gina Häußge 46e425de88 Gcodeviewer: fix some JS warnings 2018-07-24 16:30:03 +02:00
Gina Häußge 376d38e0cf Gcodeviewer: remove printed/visited layer counts
Apparently it was confusing people and it's not really adding any kind
of meaningful information anyhow.
2018-07-24 16:28:41 +02:00
Gina Häußge 92c43ee6f9 docs: slight adjustment in wording 2018-07-23 09:48:41 +02:00
Iván cce37f0501 Remove malicious link as noticed in #2746 2018-07-23 09:45:53 +02:00
Gina Häußge 2e8f543aa3 Merge branch 'pr/2748' into maintenance 2018-07-23 09:45:24 +02:00
Iván d2dfd22a2c Remove malicious link as noticed in #2746 2018-07-22 02:49:32 +02:00
Gina Häußge b83dd76c89 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/static/js/app/viewmodels/printerstate.js
2018-07-20 12:27:36 +02:00
Gina Häußge b51cb31b46 Merge branch 'staging/maintenance' into maintenance 2018-07-20 12:26:16 +02:00
Gina Häußge eea1050a18 staging/maintenance is now 1.3.9rc5.dev 2018-07-20 12:26:00 +02:00
Gina Häußge 71b2cc87a3 Preparing release of 1.3.9rc4 2018-07-20 11:14:48 +02:00
Gina Häußge a37165d7d9 Tracking: Fix unit tests 2018-07-19 18:25:16 +02:00
Gina Häußge b06f804e9e Tracking: Change printer connection event 2018-07-19 18:17:29 +02:00
Gina Häußge d64ca79f05 Tracking: Only send requests if online 2018-07-19 18:17:29 +02:00
Gina Häußge 490ade5e17 Tracking: Granular control over tracked events 2018-07-19 18:17:28 +02:00
Gina Häußge 573503e84d Tracking: Track firmware name 2018-07-19 18:17:28 +02:00
Gina Häußge 9e0e4bf7b6 Pi Support: Allow configuration of vcgencmd 2018-07-19 18:17:28 +02:00
Gina Häußge 452645d950 Merge pull request #2742 from eyal0/faster_analysis3
Faster gcode analysis: Remove kwargs Vector.__init__ and simplify getCodeFloat
2018-07-19 09:41:06 +02:00
Eyal Soha d2bb731bd7 Remove kwargs from Vector constructor and also simplify getCodeFloat 2018-07-19 09:43:48 +03:00
Gina Häußge 2062acd372 Fix print button being enabled w/o selected file
Closes #2737
2018-07-18 17:21:20 +02:00
Gina Häußge 40b5c272c4 Merge pull request #2723 from eyal0/always_gcode_analyze
Always run the GCodeAnalyser, even if the slicer provided analysis
2018-07-18 16:48:14 +02:00
Gina Häußge 31e4df44f9 Merge pull request #2739 from eyal0/faster_analysis2
Use infinity instead of None in MinMax3D to improve performance
2018-07-18 16:28:25 +02:00
Eyal Soha cd3c8ebbe6 Use infinity instead of None in MinMax3D to improve performance
Speed is improved by about 5%
2018-07-18 16:57:42 +03:00
Gina Häußge fe13348fd3 Don't perform write tests on every getBaseFolder call
Especially not when rendering the main UI - we don't want to trigger
a 500 then, even if some folders are misconfigured.
2018-07-18 15:41:26 +02:00
Gina Häußge 903dd36d68 Strip --no-cache-dir for pip < 1.6
Closes #2738
2018-07-18 11:08:47 +02:00
Gina Häußge 59a435a787 Pi support: spelling fixes 2018-07-17 18:37:24 +02:00
Gina Häußge 71cc312ccc Pi support: move itertools import into debugging cluster 2018-07-17 18:25:13 +02:00
Gina Häußge 8d1ae438e5 Pi support: re-enable production config m) 2018-07-17 17:52:37 +02:00
Gina Häußge 7ebcb47955 Pi support: remove obsolete URL from about dialog 2018-07-17 17:49:16 +02:00
Gina Häußge 71e60183c5 Pi Support: add setting for throttle check
Just in case something acts up with that...
2018-07-17 17:49:03 +02:00
Gina Häußge 9c055137eb Pi Support: fix ordering of about dialog 2018-07-17 17:46:50 +02:00
Gina Häußge eaa8933782 Pi Support: fix state update push 2018-07-17 17:46:36 +02:00
Gina Häußge 0d330e3c5a Pi Support: slight change in timer startup 2018-07-17 16:59:03 +02:00
Gina Häußge 18ed113122 Pi Support: fix logic error 2018-07-17 16:57:04 +02:00
Gina Häußge 48e454856c Pi Support: change check implementation 2018-07-17 15:54:18 +02:00
Gina Häußge 917b86655f Tracking: always use percentage encoding
Otherwise we'll run into https://discuss.elastic.co/t/cant-parse-field/26557/4
on our tracking server
2018-07-17 15:53:41 +02:00
Gina Häußge 7a2225b332 Pi Support: strip 0 bytes from strings 2018-07-17 15:30:28 +02:00
Gina Häußge 20237a73ac Pi Support: Add debug logging to throttle check 2018-07-17 15:17:36 +02:00
Gina Häußge 4a3f894064 Tracking: fix a missed renamed field 2018-07-17 15:15:35 +02:00
Gina Häußge 0c9098f7bf Tracking: Fix a typo 2018-07-17 15:10:04 +02:00
Gina Häußge 53a2e04501 Tracking: adapt to new pi support plugin 2018-07-17 14:59:10 +02:00
Gina Häußge c6f5f1a0f7 Less scary message if a plugin doesn't pass check 2018-07-17 14:38:28 +02:00
Gina Häußge 1cff2581db OctoPi support => Pi support
* changed model detection implementation to use device-tree
  * now active if running on a Pi, regardless whether that runs OctoPi
    or not
  * detect undervoltage/overheat issues via vcgencmd and report back on
    UI
2018-07-17 14:38:12 +02:00
Gina Häußge 7ab4b90d07 Fix a flask import 2018-07-16 15:32:19 +02:00
Gina Häußge fd4ff2bf37 Merge branch 'maintenance' into devel
# Conflicts:
#	AUTHORS.md
#	src/octoprint/plugin/__init__.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/api/__init__.py
#	tests/timelapse/test_timelapse_helpers.py
2018-07-16 15:29:02 +02:00
Gina Häußge 5cf02ac9ee Merge branch 'staging/maintenance' into maintenance 2018-07-16 15:21:49 +02:00
Gina Häußge 460481c9c2 staging/maintenance is now 1.3.9rc4.dev 2018-07-16 15:21:25 +02:00
Gina Häußge 2806676707 Preparing release of 1.3.9rc3 2018-07-16 13:15:00 +02:00
sti2d 76f93d8875 Fix import changes on python 3
Try python3 import & revert back to python2 if ImportError is raised
this include BaseHttpServer -> http.server, StringIO -> io, HTMLParser -> html.parser
2018-07-14 10:09:28 +02:00
sti2d 30359f52ab In python 3, map/filter return specific object types that :
* 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
2018-07-14 09:22:27 +02:00
sti2d 0020f029d1 Python yaml now use numeric value for indent attribute, this commit take care of that 2018-07-14 07:06:18 +02:00
Gina Häußge 9559f09ec7 Merge pull request #2730 from eyal0/faster_analysis
Improve octoprint gcode analysis speed
2018-07-13 19:25:54 +02:00
Eyal Soha 542edbc3e6 Revert "Use infinity instead of None for faster MinMax3d"
This reverts commit 792fe328ef.

Most of the speed-up comes from removing the unneeded import and the unrolling so no big deal.
2018-07-13 20:07:35 +03:00
Gina Häußge f82d50b0f6 Some compatibility fixes 2018-07-13 18:41:50 +02:00
Gina Häußge e224b0ac71 Fix & extend unit tests 2018-07-13 18:02:42 +02:00
Gina Häußge 68f4ecefb0 Add hook to extend supported timelapse extensions
Implements #2729
2018-07-13 17:42:34 +02:00
Gina Häußge d73d930e5f Move to sarge 0.1.5
Replace async with async_ where necessary
2018-07-13 15:20:12 +02:00
Eyal 8c1262dd3f Replace infinity tests with inequality 2018-07-13 11:57:52 +03:00
Eyal Soha 792fe328ef Use infinity instead of None for faster MinMax3d 2018-07-13 00:44:04 +03:00
Eyal Soha 111a37e97e Unroll record for improved speed 2018-07-13 00:42:33 +03:00
Eyal Soha c2bb234c20 Remove extra import math 2018-07-13 00:29:43 +03:00
Gina Häußge 0a634a76a0 Different fix for #2632
Our original one causes dead locks as reported in #2677
2018-07-12 16:46:28 +02:00
Gina Häußge 41c0dac19d Fix state comparisons in timeout handling
We weren't yet looking at the new intermediary states here.
2018-07-12 14:40:57 +02:00
Gina Häußge f728423f29 Fix resend handling during job_on_hold
Missing response to a resent line was not properly detected and handled.
2018-07-12 14:39:45 +02:00
Gina Häußge 61e5184377 Fix "now" timestamp
Should be taken *after* reading from the serial line, not before.
2018-07-12 14:38:12 +02:00
Gina Häußge a2527998c2 Resolve dead lock issue in job_on_hold implementation
(Hopefully) closes #2677
2018-07-11 18:10:51 +02:00
Eyal Soha 2dda3a0e32 Always run the GCodeAnalyser, even if the slicer provided analysis
The analysis from the Slicer or other sources is sent to the GCodeAnalyser, which can use it or ignore it.

This fixes https://github.com/foosel/OctoPrint/issues/2445#issuecomment-403599347
This fixes https://github.com/eyal0/OctoPrint-PrintTimeGenius/issues/13
2018-07-10 09:06:15 +03:00
Gina Häußge e2394446b0 Merge branch 'pr/2717' into maintenance 2018-07-06 17:15:45 +02:00
Gina Häußge d248df3826 Merge branch 'maintenance' into devel 2018-07-06 17:00:19 +02:00
Gina Häußge 1befd0ecc1 Merge branch 'staging/maintenance' into maintenance 2018-07-06 16:59:48 +02:00
Gina Häußge 386ae7609d Fix initialization order of estimator
Closes #2719
2018-07-06 16:55:05 +02:00
Gina Häußge 7587f34c94 Tracking: track software updates 2018-07-06 16:19:32 +02:00
Gina Häußge 6b54a15ed9 Tracking: add shutdown & extend startup data 2018-07-06 16:16:09 +02:00
Gina Häußge d391f0c12b Tracking: better kwarg encoding 2018-07-06 15:44:29 +02:00
Gina Häußge 8460a4173d Tracking: fix print reporting 2018-07-06 15:43:42 +02:00
Brad Fisher fe7149c715 Rendering speed enhancements; New event hooks 'onDragStart', 'onDrag', 'onDragStop', 'onViewportChange'; Bugfix to correct refresh() and refresh(0) both causing redraw of last drawn layer instead of refresh(0) drawing layer 0 2018-07-06 08:16:50 -05:00
Gina Häußge 443647e78e Add detection for Pi3B+ 2018-07-06 15:11:45 +02:00
Gina Häußge dc19ad4c4c Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/util/__init__.py
2018-07-06 14:40:46 +02:00
Gina Häußge 50bb0bcfd4 Merge branch 'staging/maintenance' into maintenance 2018-07-06 14:35:54 +02:00
Gina Häußge e15946ff79 staging/maintenance is now 1.3.9rc3.dev 2018-07-06 14:34:19 +02:00
Gina Häußge fd94fc94a0 Merge branch 'staging/maintenance' into rc/maintenance 2018-07-06 13:01:31 +02:00
Gina Häußge 798bc2b225 Preparing release of 1.3.9rc2 2018-07-06 13:01:19 +02:00
Gina Häußge 6728302bb3 Preparing release of 1.3.9rc2 2018-07-06 12:55:25 +02:00
Gina Häußge f7a3e6a6ee Add --no-cache-dir flag to update pip operations
Otherwise we might run into some weird infinite loop issues within
pip's cache handling under certain circumstances, and we really
don't want to risk that in the field.

See also #2543 for another issue worked around by this, and
pypa/pip#3532 for the core issue
2018-07-06 12:08:52 +02:00
Gina Häußge 8eba3fef0a Add disconnect handling
Had to refactor quite some bits to be able to implement this.
2018-07-05 17:36:43 +02:00
Gina Häußge e93d2104fd Add last temperature to script context & event on M112 2018-07-05 12:22:53 +02:00
Gina Häußge a7aa58e524 Add printer profile, use where needed 2018-07-05 12:17:10 +02:00
Gina Häußge c442906379 Resolve a dwelling TODO 2018-07-05 11:25:38 +02:00
Gina Häußge 0834288cfc Fix estimator initialization on SD print start
Closes #2715
2018-07-05 10:59:14 +02:00
Gina Häußge faff20943f Capture & log any errors in the state update worker
See #2715
2018-07-05 10:58:45 +02:00
Gina Häußge bb0b01aa01 Add resend_ok_timer to work around broken resends 2018-07-04 17:52:25 +02:00
Gina Häußge 14661339ef Merge branch 'improve/tracking' into maintenance 2018-07-04 15:14:59 +02:00
Gina Häußge 8ca188e509 Tracking: rename tab in settings 2018-07-04 15:10:48 +02:00
Gina Häußge 3da4877d50 Tracking: Display instance ID in settings 2018-07-04 15:08:09 +02:00
Gina Häußge 382f10557e Tracking: Add explanation text & links 2018-07-04 11:17:17 +02:00
Gina Häußge d9c6cca370 Anonymous usage tracking 2018-07-03 19:06:53 +02:00
Salandora 88a962b3ab Fix for _test_url
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.
2018-07-01 03:07:49 +02:00
Gina Häußge 3173783620 Join connection dialog with new comm layer 2018-06-29 20:55:54 +02:00
Gina Häußge 5d0cb14f71 Fix Print Time/Printed tracking for successfully completed jobs
We want this data to stick around after the print job ended, just like
it does now
2018-06-28 15:31:04 +02:00
Gina Häußge 60d84b7d06 Make SD prints work again
#mswa
2018-06-27 17:37:56 +02:00
Gina Häußge abf4f90f0e Fix an issue with collision free sd name detection 2018-06-26 17:32:58 +02:00
Gina Häußge 93d77e6b25 Fix missing event field 2018-06-26 16:30:48 +02:00
Gina Häußge fd13b18ef7 Remove parsing limitation on sd file streaming 2018-06-26 13:28:05 +02:00
Gina Häußge 13ab34a5c8 Better API key check 2018-06-25 18:53:42 +02:00
Gina Häußge 033e567d2a Merge pull request #2701 from Salandora/fix/firstRunWizard
Fix add user part of the first run wizard
2018-06-25 12:54:47 +02:00
Gina Häußge 2a67772f46 Different base icon & setting
(cherry picked from commit dc61b61)
2018-06-25 12:47:31 +02:00
tedder f69718b060 make favicon color match custom theme color
With multiple octopis, the theme/header color is really nice for quickly distinguishing them. But it doesn't help with an ocean of open tabs. This does- simply carry the theme color onto the favicon.

I could do this as a plugin and/or make it a configurable setting, but it's very small change that doesn't need that much overhead, and generally I have opinions about having a plethora of setting flags for nonfunctional things. Thanks to @jneilliii for [helping me through the viewmodels](https://discourse.octoprint.org/t/where-can-i-get-the-theme-color/2354/5).

(cherry picked from commit e1089de)
2018-06-25 12:47:31 +02:00
Gina Häußge a97b8c2fd9 Sanity check disabled plugin list just in case
See https://github.com/foosel/OctoPrint/issues/2687#issuecomment-399797596
2018-06-25 11:20:31 +02:00
Gina Häußge 08c384ac68 Merge pull request #2697 from eyal0/patch-2
estimatedPrintTime is in seconds, not minutes
2018-06-25 11:07:41 +02:00
Gina Häußge 00354f4a1e Merge pull request #2696 from eyal0/patch-1
Fix comment in types.py to match the code
2018-06-25 11:06:34 +02:00
Marc Hannappel d03d4b7b4c Fix add user part of the first run wizard 2018-06-25 10:15:28 +02:00
Eyal 1a9b6c01a6 estimatedPrintTime is in seconds, not minutes
The documentation says that the estimated print time should be given in minute.  But in practice, when I give it in minutes, the GUI shows an error factor of 60.  By supplying it in seconds, the correct value is shown.

So it should probably actually be "in seconds"
2018-06-24 15:45:29 +03:00
Eyal c4dc7d0f55 Fix comment in types.py to match the code
The comment says that the key should be `_analysis` but in the code it is `analysis`: https://github.com/foosel/OctoPrint/blob/master/src/octoprint/slicing/__init__.py#L312

This fixes the comment but leaves the code unchanged.
2018-06-24 15:04:38 +03:00
Gina Häußge 38ddd3102d Fix another broken permission
Closes #2689
2018-06-22 12:49:51 +02:00
Gina Häußge 6dd501217a Remove an unnecessary debug line 2018-06-22 11:48:57 +02:00
Gina Häußge 5a60af9d13 Improve SD print detection 2018-06-22 11:22:22 +02:00
Gina Häußge 887304fe18 Some more badges 2018-06-20 23:01:23 +02:00
Gina Häußge 2bd8aa00f3 Add build status and IRC badge 2018-06-20 20:03:19 +02:00
Gina Häußge e58387b4f2 Make new additions from 1.3.x use permissions 2018-06-20 16:36:15 +02:00
Gina Häußge 1de58b7be1 error => fail 2018-06-20 16:31:13 +02:00
Gina Häußge 58d8deefcd Merge branch 'maintenance' into devel
# Conflicts:
#	AUTHORS.md
#	setup.py
#	src/octoprint/plugins/announcements/static/js/announcements.js
#	src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
#	src/octoprint/server/api/__init__.py
#	src/octoprint/static/css/octoprint.css
#	src/octoprint/static/js/app/dataupdater.js
#	src/octoprint/static/js/app/viewmodels/printerstate.js
2018-06-20 16:29:18 +02:00
Gina Häußge cb8ce62ec4 maintenance is now 1.3.10.dev 2018-06-20 15:52:46 +02:00
Gina Häußge e49a4d8cfa staging/maintenance is now 1.3.9rc2.dev 2018-06-20 15:52:00 +02:00
Gina Häußge fdf0f75ffa Preparing release of 1.3.9rc1 (part 2) 2018-06-20 15:18:42 +02:00
Gina Häußge 5fb8674937 Merge branch 'master' into maintenance 2018-06-20 13:08:25 +02:00
Gina Häußge d3871e3487 Pin sarge to 0.1.4
0.1.5 renamed the async keyword.

Library authors, please, stick to semantic versioning :(
2018-06-20 12:48:10 +02:00
Gina Häußge 9dd9badb33 Pin tornado to 4.5.3
We don't want to accidentally pull in 5.0b1
2018-06-19 18:49:41 +02:00
Gina Häußge 3de9635180 Preparing release of 1.3.9rc1 2018-06-19 18:48:28 +02:00
Gina Häußge e2f626d421 Virtual printer: select_sd command 2018-06-19 11:24:05 +02:00
Gina Häußge b7a8c29fb4 Add an API endpoint to fetch template order
That should make it easier for third party plugins that want to offer
reordering capabilities of tab, sidebar, etc
2018-06-18 19:35:47 +02:00
Gina Häußge 15f10d4a84 sidebar > tabs 2018-06-18 18:23:03 +02:00
Gina Häußge 0faf2792e9 Clarify something about component ordering 2018-06-18 18:21:59 +02:00
Andy Castille caa1a3d76f Display absolute file upload times on hover 2018-06-18 18:03:01 +02:00
Gina Häußge fae01d2c75 Merge branch 'pr/2633' into maintenance 2018-06-18 17:53:47 +02:00
Gina Häußge 248235c5e0 Fix indentation 2018-06-18 17:53:32 +02:00
Gina Häußge 2febfcd8b3 Announcements: Don't reload on mark read
Only reload if we mark read from the management dialog.
2018-06-18 16:05:10 +02:00
Gina Häußge 704331525f Split settings init to allow better error logging 2018-06-18 15:37:51 +02:00
Gina Häußge 6c279f155a Improve fatal startup error handling 2018-06-18 15:07:18 +02:00
Gina Häußge e5afde2c2c Up a couple of versions 2018-06-18 14:33:28 +02:00
Gina Häußge f5b99a6e34 Fix symlink test util
That was resolving the path completely before checking
whether the symlink is broken or not.
2018-06-18 14:24:04 +02:00
Gina Häußge 8ef13ba529 Fix flask version 2018-06-18 14:22:56 +02:00
Gina Häußge 654055da61 Add symlink check to test API endpoint 2018-06-18 11:37:36 +02:00
Gina Häußge 68f67219ed Refactor test API endpoint 2018-06-18 11:37:02 +02:00
Gina Häußge 436ffb6db8 Detect broken symlinks during folder validation
Closes #2644
2018-06-18 11:20:21 +02:00
Gina Häußge b569cc456b Fix typePath missing for sdcard files on files API
Closes #2589
2018-06-18 10:48:27 +02:00
dadosch 023b9eda90 Two spaces were missing 2018-06-18 09:54:33 +02:00
Gina Häußge fe2dbf699d SWU: Lock down UI while updating
Implements #1217
2018-06-15 18:15:13 +02:00
Gina Häußge 17c6c83503 Fix SD printing 2018-06-15 17:02:53 +02:00
Gina Häußge 688e4d36d1 Fix script order
beforePrint* should always precede any commands from the print job.

Also make sure we only jump from "finishing" to "operational" after the
afterPrintDone script has been sent. Also wait for all moves to finish.
2018-06-15 15:44:34 +02:00
Gina Häußge 86b886ede7 Remove resend repetition code
It's apparently completely broken and the fact that no one noticed
and reported that means it never really gets used either from the looks
of it.

So instead of allowing it to introduce broken resend handling, we'll
rather remove it for now.
2018-06-15 13:15:27 +02:00
Gina Häußge 392149b504 Add view model list to coreui object 2018-06-14 19:25:46 +02:00
Gina Häußge acd05cdcc5 Limit parsing to comm when streaming to SD 2018-06-14 19:16:25 +02:00
Gina Häußge 1a67b5b3fc Upload to SD is now working 2018-06-14 18:54:40 +02:00
Gina Häußge 473d4a752a Fix message parsing again 2018-06-14 12:58:10 +02:00
Gina Häußge 33a5e389fd Fix line pushing 2018-06-13 17:35:16 +02:00
Gina Häußge 287a13b944 Reset handling 2018-06-12 16:28:22 +02:00
Gina Häußge 5282db6871 Implement job_on_hold functionality 2018-06-12 15:57:46 +02:00
Gina Häußge b79618d752 Disable heatup detection when auto reporting 2018-06-12 13:54:35 +02:00
Gina Häußge 391930e2cb Fix reported state id 2018-06-12 13:48:12 +02:00
Gina Häußge 4630cc8ee0 Fix restart button 2018-06-12 13:47:52 +02:00
Gina Häußge 4e83466af3 Fix temperature polling 2018-06-12 13:29:29 +02:00
Gina Häußge b7e08c7ddc Fix pausing 2018-06-12 13:29:19 +02:00
Gina Häußge 85ef3f1df2 Fix modals not hiding fully anymore 2018-06-09 13:07:34 +02:00
Gina Häußge 6e44149284 Treat scripts triggered by job as part of the job
Including blocking their sending via job_on_hold.

Closes #2583
2018-06-09 11:58:53 +02:00
Gina Häußge 534f3aa2d4 Fix for potential division by zero on SD upload
Closes #2675
2018-06-09 10:15:56 +02:00
Gina Häußge 13e5cf45ec Fix reset handling while printing
Could get stuck in cancelling due to resend issues.

Should fix #2509
2018-06-08 17:14:40 +02:00
Gina Häußge 4cb103e042 Fix cancel_preparation call in case of failure
It should be _failed if the timer runs out, not _done. Only difference
is a log entry though, so not that big of a deal.
2018-06-08 11:03:44 +02:00
Gina Häußge 701208484a WIP first throw at scripts
Currently broken:
  * temperature and position logging in context
  * pausing and cancelling
2018-06-07 17:49:35 +02:00
Gina Häußge 02252d1254 finishing state 2018-06-07 14:29:42 +02:00
Gina Häußge 8347f182ef queue markers, pausing, cancelling 2018-06-07 14:16:47 +02:00
Gina Häußge 7e4faa20b7 Fix temperature access 2018-06-06 15:12:27 +02:00
Gina Häußge 717eef25da Fix wrong (1%) progress on print finish 2018-06-06 13:06:39 +02:00
Gina Häußge 31fbebdbb9 Basic action commands are working 2018-06-05 17:39:04 +02:00
Gina Häußge afe224ae08 Fix resend request handling
Resends didn't use up oks due to a missing to_command during enqueuing.
2018-06-05 16:54:52 +02:00
Gina Häußge d09f75a815 Add commdebug logger
To help with debugging ping pong communication
2018-06-05 16:54:01 +02:00
Gina Häußge 812ce40e35 Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	src/octoprint/logging/handlers.py
#	src/octoprint/printer/standard.py
2018-06-05 13:22:15 +02:00
Gina Häußge f8e6e4e3db Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/plugins/printer_safety_check/__init__.py
2018-06-05 11:12:42 +02:00
Gina Häußge db81bf1e72 Add new states "resuming" and "finishing"
The later allows us to distinguish between a file having been streamed
completely and the print job done script having streamed completely as
well.

Should fix #2547
2018-06-05 11:07:31 +02:00
Gina Häußge 9c89c4c999 Simplified a log handler 2018-06-04 18:44:10 +02:00
Gina Häußge d133bd47e5 Fix uninstall detection of disabled plugins
Fixes #2549 part 2
2018-06-04 18:01:34 +02:00
Gina Häußge 90391d2897 Forbid <=0 for various timeouts & intervals
Closes #2551
2018-06-04 15:13:45 +02:00
Gina Häußge 66cad78c41 WIP: busy proto, dwelling, ok timeout 2018-05-31 17:42:52 +02:00
Gina Häußge 4e91f47e8b Add protocol state to handler calls 2018-05-31 15:15:32 +02:00
Gina Häußge 4b753d03dc internal_state => internal_flags 2018-05-31 10:59:17 +02:00
Gina Häußge 6f18749df1 time.time => monotonic_time 2018-05-31 10:44:30 +02:00
Gina Häußge eab0ce8aee Add firmware & capability reporting, temp autoreports
Also refactored flavors to make adding additional ones (e.g. from
plugins) even easier.
2018-05-31 10:19:15 +02:00
Gina Häußge ba00b4d675 Fix bug in GcodeCommand constructor 2018-05-30 19:12:30 +02:00
Gina Häußge 9bc8638d80 Fix resend handling 2018-05-30 14:32:46 +02:00
Gina Häußge d124efdb71 Fix race condition in resend handling
Could be triggered if two resend requests without an ok were directly
following each other, causing a resend ok timer to be triggered for each
and a consequent attempt to process the same resend status again.

Should fix #2632
2018-05-29 17:30:59 +02:00
Gina Häußge 4f1b781219 docs: forgot to push two images 2018-05-29 16:13:50 +02:00
Gina Häußge 6673536e10 Added some additional printer safety checks
* Repetier firmware versions prior to 0.92 don't have thermal runaway/
    decouple detection, so we always warn about those
  * If the firmware supports the THERMAL_PROTECTION capability report
    but it's reported as disabled, we also warn about that (see also
    MarlinFirmware/Marlin#10465)
2018-05-29 15:19:35 +02:00
Gina Häußge 118afd4720 Refactor version parsing helpers
Extract get_comparable_version for use in other places as well.
2018-05-29 15:16:14 +02:00
Gina Häußge a0cbc10ba7 Add two new hooks for firmware information
octoprint.comm.firmware.info - response to M115
octoprint.comm.firmware.capabilities - capability report lines
2018-05-29 15:13:25 +02:00
Gina Häußge 38b7640769 Add support for prompt_* action commands 2018-05-28 18:16:06 +02:00
Gina Häußge b266f1ca55 Update psutil dependency
Might fix #2658 (although I'm still at a complete loss as to how that
lib could influence serial connection stability O_O).
2018-05-28 10:46:40 +02:00
Gina Häußge 0ef0eff917 Add paused and resumed action commands
Slightly different behaviour than the already existing pause and resume,
see the docs.
2018-05-25 18:21:11 +02:00
Gina Häußge fd29efe88e Update jQuery to 3.3.1 2018-05-25 17:25:58 +02:00
Gina Häußge cd3acfb384 Merge branch 'pr/2606' into maintenance 2018-05-25 16:49:33 +02:00
Gina Häußge f9548a7ece Sort serial ports naturally 2018-05-25 16:42:46 +02:00
Gina Häußge ce5275c91e docs: Add example for float factors
Closes #2663
2018-05-25 14:57:35 +02:00
Gina Häußge d9c8351025 WIP: tags, print time estimation, gcode parsing 2018-05-24 18:52:19 +02:00
Gina Häußge 73a16f6075 Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	src/octoprint/printer/standard.py
2018-05-24 10:53:56 +02:00
Gina Häußge a92372ec7e Fix permission on temperature set button
Closes #2662
2018-05-24 10:36:20 +02:00
Gina Häußge 4967d19b6a WIP: Add tags & atcommands 2018-05-23 18:45:00 +02:00
Gina Häußge 8a1db8e4c5 Disable fade in for cancel confirmation
Requests to add an option for it in 3, 2, 1...

Closes #2597
2018-05-18 18:22:19 +02:00
Gina Häußge 7b773f6fd2 Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
#	src/octoprint/templates/dialogs/settings/accesscontrol.jinja2
#	src/octoprint/templates/sidebar/files_header.jinja2
2018-05-18 13:45:42 +02:00
Gina Häußge 0d120b2977 Merge pull request #2650 from ntoff/fix/grey-plugin-delete-clickable
Fix greyed plugin manager delete icons still being clickable
2018-05-18 12:42:00 +02:00
ntoff bf71a20ac1 Fix greyed plugin manager delete icons still being clickable
Fixes https://github.com/foosel/OctoPrint/issues/2549
2018-05-18 19:21:50 +10:00
Gina Häußge 846d3a63bc Merge pull request #2648 from malnvenshorn/class-methods-as-callbacks
Allow class methods as callbacks in view model
2018-05-18 10:00:48 +02:00
malnvenshorn 15d6bf3a70 Allow class methods as callbacks in view model 2018-05-17 19:11:52 +02:00
Gina Häußge cec1bc6c0f Allow plugins to override analysis & print time estimation
Using two new hooks, plugins may now provide alternative implementations
for the GCODE analysis and the live print time estimation.

Should allow people to get creative with regards to #1203, #1905, #2281,
#2445, #2514

Implements #1797, #1905
2018-05-17 18:58:15 +02:00
Gina Häußge 69681a27d6 Fix the unrendered timelapse list being visible when empty 2018-05-17 17:27:00 +02:00
Gina Häußge 0adcfc693d Merge branch 'pr/2410' into devel 2018-05-17 16:29:09 +02:00
Gina Häußge b73507fd2b Increase default bitrate for timelapses 2018-05-17 16:27:18 +02:00
Gina Häußge bea6bd013c Some small fixes
* fixed whitespace
  * less repetition for output/capture format
  * value range check for ffmpegVideoCodec as suggested
2018-05-17 16:23:50 +02:00
Gina Häußge 5456f5a70a Fix potential for invalid sorting of uploads
"date" and "size" might be undefined on both parameters (e.g. for
folders, SD files). We have no guarantee that "a" will always have
either defined, so make sure to test or a wrong sorting order might be
the consequence.

Fixes #2355
2018-05-17 10:57:01 +02:00
Gina Häußge 9a881012e2 Add new 3rd party lib to list 2018-05-16 18:36:07 +02:00
Gina Häußge d62df7643b Use resize sensor to fix progress bar text widths
Closes #2635
2018-05-16 18:29:39 +02:00
Gina Häußge e980444f86 Merge pull request #2642 from malnvenshorn/itemlisthelper-add-update
ItemListHelper - Methods for adding and updating items
2018-05-15 17:14:37 +02:00
Gina Häußge 7d40320a5b SWU: Fix another leftover wrong permission name 2018-05-15 17:05:54 +02:00
Gina Häußge 09456b923f SWU: Fix update button not working
Closes #2641
2018-05-15 17:01:12 +02:00
Gina Häußge 39e6c11c39 Fix overflown tabdrop tabs not being selectable
Closes #2643
2018-05-15 16:45:38 +02:00
Koen Kooi 5aef014773 unit tests: timelapse: add videocodec test
This test checks if both videocodec and container format have been set
correctly.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2018-05-15 10:42:11 +02:00
Koen Kooi 9738884ff8 messages.pot: add videocodec settings entries
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2018-05-15 10:42:11 +02:00
Koen Kooi 27b625a614 timelapse: pick container and suffix based on setting
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2018-05-15 10:42:07 +02:00
malnvenshorn 9d1f4fb126 Add methods for adding and updating items 2018-05-14 13:52:03 +02:00
Koen Kooi 096e9fc326 timelapse: change videocodecs to predefined list 2018-05-11 12:19:39 +02:00
Koen Kooi f577d6b45d timelapse: add setting for videocodec
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2018-05-11 12:19:34 +02:00
Gina Häußge bd7a28af5b Fix unit test 2018-05-10 18:35:25 +02:00
Gina Häußge 104b0a504c Merge branch 'pr/2586' into devel
# Conflicts:
#	AUTHORS.md
#	src/octoprint/server/util/sockjs.py
#	src/octoprint/static/js/app/viewmodels/timelapse.js
2018-05-10 18:18:05 +02:00
Gina Häußge 40bfbe0d7b knockoutify progress bar
Also hide it when we are not rendering anything.
2018-05-10 18:15:49 +02:00
Gina Häußge 4bf5984ace ffmpeg needs help for continuous progress reporting
See https://stackoverflow.com/a/35422274
2018-05-10 18:15:25 +02:00
Gina Häußge 4b64fb7f47 Corrected some merge issues 2018-05-09 14:05:25 +02:00
Gina Häußge 7e11104b9c Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	src/octoprint/__init__.py
#	src/octoprint/plugins/softwareupdate/static/css/softwareupdate.css
#	src/octoprint/printer/__init__.py
#	src/octoprint/printer/standard.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/api/files.py
#	src/octoprint/util/__init__.py
2018-05-08 15:57:05 +02:00
sylvled 3de5bca48b Update config_yaml.rst
gcodeAnalysis and gcodeViewer were without section name. Added them.
2018-05-07 10:28:14 +02:00
Gina Häußge 81471df419 Option to send M0/M1 to the printer
Also added a message to the serial output if M0/M1 is blocked.

Closes #1513
2018-05-05 15:49:59 +02:00
Gina Häußge 99ef84788a SWU: Support updating single items via UI
Closes #2615
2018-05-05 15:13:25 +02:00
Gina Häußge bfbf9fb66e Confirmation dialog helper now supports an html body 2018-05-05 15:12:03 +02:00
Gina Häußge 6074a3d964 Never send referrers with links 2018-05-05 14:01:29 +02:00
Gina Häußge 74e82afa24 About: Use github logo for source link 2018-05-05 13:50:27 +02:00
Gina Häußge 2b5c14b3c3 Change "Cancel" to "Close" on Settings
The Settings dialog also allows some "instant actions" (e.g. adding
users, changing specific plugin settings and so on). Having to click on
"Cancel" after actually doing something just feels wrong in such cases
so the Settings dialog now has a "Close" instead of a "Cancel" button.

Other sub dialogs will stay as is since that better reflects their
behaviour.
2018-05-05 13:48:19 +02:00
Gina Häußge e5b167bcb4 Merge branch 'pr/2595' into maintenance 2018-05-05 13:29:33 +02:00
Gina Häußge a70928aac6 Revert "Fix trivial copy and paste errors"
This reverts commit e02679a

It actually wasn't a copy and paste error - it *is* a plugin after all,
so "PluginSettings" makes sense.
2018-05-05 13:29:11 +02:00
Gina Häußge 7548e7a623 Revert "Replace "Cancel" label with "Abort" on buttons for consistency"
This reverts commit eb37607
2018-05-05 13:28:04 +02:00
Gina Häußge 8d9034b5a4 Gcode viewer: show approx. print head position
Also change retract/resume from dot to triangle/inverted triangle.

Closes #2318
2018-05-05 12:56:12 +02:00
Gina Häußge b5194ffc00 Plugin core: Fetch package name from entry point
See also #2625
2018-05-05 12:56:12 +02:00
Gina Häußge fa6cda3356 Merge pull request #2620 from malnvenshorn/itemlisthelper-save-pagesize
ItemListHelper - Save page size to local storage
2018-05-05 10:14:25 +02:00
Ben Lye 4d9ec9a7e3 Add M118 to commands to not uppercase
Adds M118 to the default list of commands which should not automatically be converted to uppercase.
2018-05-05 10:10:02 +02:00
Gina Häußge e44a2fdd97 Update pkginfo dependency 2018-05-04 12:55:32 +02:00
Gina Häußge 95ac669d5c Plugin subsystem: Use entry_point.dist to fetch metadata
Support egg "PKG-INFO" and wheel "METADATA" files in metadata folder. Less
guess work throughout the include path this way.

Better solution for #2625 than c3eebdb
2018-05-04 12:55:16 +02:00
Gina Häußge 5e899204f0 Merge branch 'hotfix/pip10' into maintenance 2018-05-03 18:02:14 +02:00
Gina Häußge c3eebdb158 Fix plugin metadata parsing for pip 10+ 2018-05-03 18:00:28 +02:00
Gina Häußge 8369d311bf Small refactoring & fixed tests 2018-05-03 17:42:30 +02:00
Gina Häußge 13b85fbbd0 Fix fps source when rendering unrendered timelapse
Should be taken from config unless provided as parameter, not hard coded
to 25.

Closes #2621
2018-05-03 15:40:36 +02:00
Gina Häußge ddd2711f95 Fix a broken unit test
We now initialize the folders when initializing the settings, so the
test that the folder didn't yet exist before retrieving its path
naturally failed.
2018-05-03 12:18:10 +02:00
Gina Häußge 9addbbb9a1 Fix refactoring bug
Closes #2617
2018-05-03 11:45:46 +02:00
malnvenshorn 735e2c6c94 Convert page size to integer when reading from local storage 2018-05-01 15:50:27 +02:00
malnvenshorn 9d2ee2b55b Save page size to local storage 2018-05-01 12:32:55 +02:00
malnvenshorn 7988e7487f DRY principle for storage IDs 2018-05-01 12:21:01 +02:00
Gina Häußge 4bbe49ac6d Sanity check for configured folders
* On startup: Check they are writable, if not revert to defaults
  * On settings save: Check they are writable, if not return an HTTP 400
  * In the settings dialog: Allow quick check of writability via Test
    buttons

Should hopefully prevent users from nuking their instance by configuring
some custom folder that isn't writable.

TODO:
Currently simply doesn't close the settings dialog, needs some message
or something (or client side folder validation on clicking the button).
2018-04-27 17:44:07 +02:00
Gina Häußge 9e32439f44 Watchdog: Ignore hidden & removed files
Closes #2558
2018-04-27 16:17:04 +02:00
Gina Häußge 3ebb36f877 Disable user display if access control is disabled
Also show something more human friendly if the active user for a print
job is the "_api" user of the global api key.
2018-04-27 11:53:49 +02:00
Gina Häußge d8eb57548d Merge branch 'dev/granularPermissions' into devel
# Conflicts:
#	src/octoprint/server/api/files.py
#	src/octoprint/server/api/job.py
#	src/octoprint/static/js/app/viewmodels/users.js
2018-04-26 19:27:11 +02:00
Gina Häußge d8072f0e05 Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
2018-04-26 19:10:16 +02:00
Gina Häußge 3d7016f500 Fixed/removed completely outdated & broken tests 2018-04-26 19:09:03 +02:00
Gina Häußge 41e3a0390f Removed CombinedPermissions
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.
2018-04-26 19:08:30 +02:00
Gina Häußge 42a9a1976d Fix anonymous user & disabled ACL mode 2018-04-26 18:25:27 +02:00
Gina Häußge 569991e55c removeable => removable, changable => changeable 2018-04-26 13:06:14 +02:00
Gina Häußge b2996f10ff Get rid of a bit of Python2 only code 2018-04-26 12:56:07 +02:00
Gina Häußge 42fb4f4700 Fix remember me and IPv4/IPv6 sessions
Session protection mode "strong" is apparently incompatible to the
remember me function in general and on top of that I observed issues
with at least Windows happily switching between connecting to an
instance via IPv4 and IPv6, causing changes in the reported client IP
and hence the session protection killing the session as a result.
2018-04-26 12:40:07 +02:00
Gina Häußge 52934602cd Fix forgotten self 2018-04-26 12:03:34 +02:00
Gina Häußge 2a0eda5c34 Make sure we have the current user data in editor
Fixes #2534
2018-04-26 11:30:48 +02:00
Gina Häußge a3b3fbe269 Add some more strings to the known error classes
"Missing linenumber" is apparently also an option we want to recognize
as non critical error, and while we are at it let's make sure we also
capture "linenumber" without a space for resend request communication
errors, just in case firmware devs add some variance here.
2018-04-26 11:00:29 +02:00
Gina Häußge 2fe177ffb8 Virtual: Fix default M114 format string 2018-04-25 17:01:24 +02:00
Gina Häußge d8bc75222f Remove some left overs from a small refactor
Closes #2610
2018-04-25 17:01:24 +02:00
Gina Häußge c3bb651d9e Properly decouple individual metadata locks
Thanks to @CapnBry for the heads-up here.
2018-04-25 17:01:24 +02:00
Gina Häußge 135cf6a9cc Migrate file storage metadata to json
As suggested by @CapnBry, that should give us a significant speed
boost considering that yaml serialization and deserialization is some
orders of magnitude slower than json.

We only do that for the file metadata for now - it has the biggest gain
to expect from a speed boost, and having the configuration as yaml
actually has its readability advantages.
2018-04-25 17:01:24 +02:00
Gina Häußge be4b98b9da Merge pull request #2604 from dforsi/fix/issue/2534
Reload older values after cancelling the Settings dialog
2018-04-25 10:51:41 +02:00
Gina Häußge 673b367902 Merge pull request #2591 from dforsi/fix/valid-html
Fix markup for some HTML labels
2018-04-25 10:41:57 +02:00
Gina Häußge 81626ceec5 Small change in user display in state panel 2018-04-24 16:52:17 +02:00
Gina Häußge b653ee59c8 Merge branch 'pr/2576' into maintenance
# Conflicts:
#	src/octoprint/printer/standard.py
2018-04-24 16:45:08 +02:00
Gina Häußge 79abe31a06 Move printing user into job data & add UI representation 2018-04-24 16:44:41 +02:00
Gina Häußge 30a523b8c1 Fix printer.select_file
* properly handle relative paths for selection
  * properly handle absolute paths for recovery data comparison

Fixes #2601
2018-04-24 16:00:09 +02:00
Gina Häußge c104f45b16 SWU: Default to force_base = False 2018-04-24 13:49:21 +02:00
Gina Häußge a9bc814016 Merge branch 'master' into maintenance 2018-04-24 13:18:47 +02:00
Gina Häußge edd00cfa80 Some adjustments for PyPI stuff 2018-04-24 12:41:45 +02:00
Daniele Forsi 60baf54d7b Refresh the details in the Connection pane when settings are updated 2018-04-23 23:54:02 +02:00
Daniele Forsi 536f5458bb Show details in the Connection pane ordered as in the Settings dialog
Return the Serial Port and the Baudrate lists without sorting them.
2018-04-23 16:05:47 +02:00
Daniele Forsi a4cc3a9309 Reload older values after cancelling the Settings dialog
Fixes #2534
2018-04-22 23:09:37 +02:00
ZachNo b7adf115ee Changed to CommandlineCaller, added test
Now using CommandlineCaller using a custom logger function.
Added test in test_timelapse_helpers.py for _process_ffmpeg_output
2018-04-21 21:44:52 -04:00
Gina Häußge f72b92caff Revert Tornado 5 fixes for sockjs 2018-04-20 22:39:26 +02:00
Gina Häußge d3e7842c3a Revert "Minor adjustments for Tornado 5"
This reverts commit 258f3725bf.
2018-04-20 22:39:25 +02:00
Gina Häußge 555bdefd46 Pin tornado to >=4.5.3,<5 for now
There appears to be a memory leak issue with tornado 5.x as reported in #2585
2018-04-20 22:39:20 +02:00
Gina Häußge 7cf0f552f5 Track group flags from default groups 2018-04-20 20:31:10 +02:00
Gina Häußge 246c614635 Allow plugins to declare permissions as default for standard groups 2018-04-20 20:00:34 +02:00
Gina Häußge df62f08ec3 React to permission changes & fix timelapse permissions 2018-04-20 14:32:21 +02:00
Gina Häußge b6f71eeb3b restricted_access => require_firstrun
We don't want to require a login session anymore in most cases, we have granular permissions for this.
2018-04-20 14:08:02 +02:00
Gina Häußge e2a7e07a0a Fix some imports 2018-04-20 14:04:38 +02:00
Gina Häußge b3acd36092 Don't try to login/out anonymous users 2018-04-20 14:02:39 +02:00
Gina Häußge 7a037b9c66 Make sure to update data if current permissions change 2018-04-19 22:01:52 +02:00
Gina Häußge c1cf359b43 Fix a group duplication bug 2018-04-19 18:49:05 +02:00
Daniele Forsi 206c22f6aa Add some icons to the About page
Also moves Documentation so that the first 4 items are the same as in the footer.
2018-04-19 18:34:40 +02:00
Daniele Forsi 14959c2d66 Hide the buttons when the file list is hidden 2018-04-19 17:51:00 +02:00
Daniele Forsi eb3760715f Replace "Cancel" label with "Abort" on buttons for consistency
Now only the main settings dialog has a "Cancel" button and the other
dialogs have "Abort" on the buttons that do not save the changes.
2018-04-19 15:55:35 +02:00
Daniele Forsi e02679a587 Fix trivial copy and paste errors 2018-04-19 15:36:09 +02:00
Daniele Forsi 4064b3fc72 Make the API buttons and title in the Settings similar to those in other dialogs 2018-04-19 15:36:09 +02:00
Daniele Forsi e3f2a16e92 Fix caret icon always shown in position "closed" even whe details are visible 2018-04-19 15:36:09 +02:00
Gina Häußge 2d883d6d20 Make "users" group mandatory for logged in users
That makes the migration scenario way easier and also makes sense
in general.
2018-04-19 14:55:47 +02:00
Gina Häußge a9441400b3 Merge branch 'fix/positionLogTimeout' into maintenance
# Conflicts:
#	src/octoprint/util/comm.py
2018-04-19 14:10:16 +02:00
Gina Häußge 09781613ce Add timeout for position log on pause/cancel
Workaround for firmware which doesn't provide a proper M114 report that might
be unparseable. We don't want to get stuck in such cases (which appear to be more
common than should be the case - this whole comm situation is just FUBAR).
2018-04-19 14:09:18 +02:00
Gina Häußge 63b63f6aad Test for image/* in snapshot test 2018-04-19 13:10:58 +02:00
Gina Häußge 1637187c76 Extend URL test to also allow whitelist/blacklist check for the returned content type 2018-04-19 13:10:41 +02:00
Gina Häußge 303ef405bb Fix snapshot test button not resetting on error 2018-04-19 13:01:37 +02:00
Gina Häußge bf3da2a662 Fixes a race condition causing stalls when pausing/cancelling
Closes #2581 & closes #2587
2018-04-18 13:02:36 +02:00
Gina Häußge b8194ecc84 Fixes a race condition causing stalls when pausing/cancelling
Closes #2581
2018-04-18 12:59:38 +02:00
Gina Häußge 472ab367b0 Disable logging the position on cancel by default
Apparently that is causing too many issues in the field. If someone
actually DOES need the position data, they can always enable this.
2018-04-18 12:59:38 +02:00
Gina Häußge 8f50180543 Virtual: allow defining custom M114 responses 2018-04-17 09:10:33 +02:00
Zachary N 2fa18f5855 Merge branch 'devel' into dev/timelapseProgress 2018-04-16 18:25:48 -04:00
Daniele Forsi 11eae082fc Remove invalid xmlns attributes so that the default value is used
Fixes 2 validation errors:
Error: Bad value http://www.w3.org/1999/html for the attribute xmlns (only http://www.w3.org/1999/xhtml permitted here).
          <div id="offline_overlay" xmlns="http://www.w3.org/1999/html">↩    <
Error: Bad value http://www.w3.org/1999/html for the attribute xmlns (only http://www.w3.org/1999/xhtml permitted here).
          <div id="reloadui_overlay" xmlns="http://www.w3.org/1999/html">↩    <
2018-04-16 20:07:28 +02:00
Daniele Forsi 885446328d Add missing "for" and "id" attributes to some HTML labels 2018-04-16 20:07:28 +02:00
Daniele Forsi 8cb4d84905 Fix HTML labels with wrong "for" attribute
Fixes some validation errors detected by https://validator.w3.org and other errors.
2018-04-16 20:07:28 +02:00
ZachNo a4ce92c963 Added timelapse render progress bar
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
2018-04-16 06:05:25 -04:00
Gina Häußge 0da52cb366 Update pyserial to 3.4
Final part of the fix for #2333
2018-04-13 18:32:09 +02:00
Gina Häußge 57ea18a9a4 Fix Print Job Left display
Fixes #2579
2018-04-13 18:17:03 +02:00
Gina Häußge c84d39a803 Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/server/__init__.py
2018-04-13 17:23:42 +02:00
Gina Häußge 06478415b5 Merge remote-tracking branch 'refs/remotes/origin/maintenance' into maintenance 2018-04-13 17:08:47 +02:00
Gina Häußge 6a8a1c31e3 maintenance is now 1.3.9.dev 2018-04-13 17:08:19 +02:00
Gina Häußge cce7961ee3 Merge branch 'staging/maintenance' into maintenance 2018-04-13 17:07:48 +02:00
Gina Häußge 725227338a Merge branch 'rc/maintenance' into staging/maintenance 2018-04-13 17:06:36 +02:00
Gina Häußge c55c568bbd Preparing release of 1.3.8 2018-04-13 16:22:44 +02:00
Gina Häußge 45d8c28883 Pin psutil to 5.4.3
Fixes #2577
2018-04-13 15:31:44 +02:00
Gina Häußge 8076e59861 Add hotfix branch type & set to tag tracking 2018-04-13 15:31:01 +02:00
Gina Häußge d59eaa2a91 Admins are also users 2018-04-12 19:49:04 +02:00
Gina Häußge f7ad87449a Identify groups by a key & add group role 2018-04-12 19:07:59 +02:00
malnvenshorn b41df46491 Added @malnvenshorn to AUTHORS.md 2018-04-12 17:00:37 +02:00
Gina Häußge 08bfae216c Merge branch 'devel' into dev/permission
# Conflicts:
#	src/octoprint/plugins/printer_safety_check/__init__.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/util/sockjs.py
2018-04-12 16:37:27 +02:00
Gina Häußge 64db784d8d Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/server/__init__.py
2018-04-12 16:35:53 +02:00
Gina Häußge 5a91b8db48 Some permission changes & fixes 2018-04-12 16:34:17 +02:00
malnvenshorn 5205d2e352 Tracking user of print job 2018-04-12 16:15:53 +02:00
Gina Häußge 9c923be5f0 Better solution for the Tornado 5 + SockJS + haproxy issue
Looks like Nagle's algorithm was the cause. Adding

    option http-no-delay

to haproxy.cfg solves the problem without modification of the timeout,
however that is not an option for the thousands of instances already
deployed in the field.

So instead we add 300ms to the roundtrip based connection timeout, that
should hopefully get around any Nagle-induced delays (usually between
40 and 200ms according to various sites on the net).
2018-04-12 13:19:02 +02:00
Gina Häußge 88328bbe0e Merge pull request #2568 from vitormhenrique/master
Fix dead link on hooks documentation
2018-04-12 12:58:46 +02:00
Gina Häußge 132614045c Early detection & logging of broken files response
Fixes #2572
2018-04-12 12:08:19 +02:00
Gina Häußge a33b037364 Fix ItemListHelper throwing an error on undefined items
Just fall back to an empty list.

Fixed #2572 (at least the bit that isn't a broken nginx config)
2018-04-12 11:55:14 +02:00
Gina Häußge 33b27e450f Merge branch 'fix/sockjs' into maintenance 2018-04-11 18:47:18 +02:00
Gina Häußge a5d541dafc Fix sockjs not working behind haproxy
For some reason the websocket connection runs into a timeout, the xhr
transport doesn't properly take over, and then stuff takes ages to
realign again.

Only happens under Tornado 5, doesn't happen under Tornado 4.5

Increasing the timeout for now instead of pinning to Tornado 4.5 in the
hopes that might still be figured out.

Incredibly weird though.
2018-04-11 18:47:08 +02:00
Gina Häußge 258f3725bf Minor adjustments for Tornado 5 2018-04-11 18:43:23 +02:00
Gina Häußge c4d8e344d1 Remove wrongly placed whitespace 2018-04-11 11:15:46 +02:00
Gina Häußge f3128a15d9 Safety Plugin: Add Malyan M200 & CR-10S
Malyan M200 identified by firmware name "Malyan" and model "M200".
Printer also known as Monoprice Select Mini, see also ID strings in
#2271.

CR-10S identified by "Author: (CR-10Slanguage)".
2018-04-11 11:15:18 +02:00
Gina Häußge 6f224bd825 Workaround for typo & whitespace in Malyan M115 responses
NAME. instead of NAME:, whitespace between key and value component.
2018-04-11 11:12:56 +02:00
Vitor de Miranda Henrique 58bbbc2ad9 Update hooks.rst
Fix Software Update plugin link, it was pointing to an old github page --> https://github.com/OctoPrint/OctoPrint-SoftwareUpdate
instead of the bundled plugin--> https://github.com/foosel/OctoPrint/tree/master/src/octoprint/plugins/softwareupdate
2018-04-10 16:19:55 -05:00
Gina Häußge 75de062b55 Safety Plugin: Add detection of Anycubic Mega
Identified by "Author: (Jolly, xxxxxxxx.CO.)" in startup messages.
2018-04-10 18:09:55 +02:00
Gina Häußge 58f73f3ed9 Merge branch 'maintenance' into devel 2018-04-09 17:03:30 +02:00
Gina Häußge 85dfcbd156 Merge branch 'staging/maintenance' into maintenance 2018-04-09 17:03:15 +02:00
Gina Häußge a6cec7d2ef Merge branch 'rc/maintenance' into staging/maintenance 2018-04-09 17:02:51 +02:00
Gina Häußge 6d7f8a2a64 Don't raise error when trying to read from finished print
Could be caused by timing issues and one `continue_sending` too many, so
just ignore this but log a warning.
2018-04-09 15:56:35 +02:00
Gina Häußge 8869748ecc Don't trigger ok timeout while heating or in long running command
Workaround for printers that don't send busy:processing during heatups
like they should.
2018-04-09 15:53:25 +02:00
Gina Häußge e0b0f2ae18 Preparing release of 1.3.7 2018-04-09 12:38:56 +02:00
Gina Häußge 440ccf165e [Docs] Add missing image
Fixes #2557
2018-04-09 11:50:16 +02:00
Gina Häußge 7e0b187cb8 Bundle sockjs-tornado dependency
It appears to be unmaintained at the moment, and the current version
is incompatible to Tornado 5.

Instead of monkey patching ad infinitum we instead bundle the dependency
in the new vendor sub package.
2018-04-06 18:38:06 +02:00
Gina Häußge 025f545ef7 Better requirement detection in octoprint_setuptools
Plus unit tests.
2018-04-06 14:59:11 +02:00
Gina Häußge 6af1afb546 Don't tab to "forget password" link 2018-04-06 14:59:11 +02:00
Gina Häußge 1dd1eb3768 Merge pull request #2554 from tedder/upstream_maintenance
docfix: make 'settings' proper yaml
2018-04-06 09:33:32 +02:00
tedder 77d126fc09 make 'settings' proper yaml
See PR #2530; I assumed it should go into 'devel' so it is right in new releases, but Gina asked for it to be done here.
2018-04-05 13:38:25 -07:00
Gina Häußge 4a3902c060 Merge pull request #2533 from dforsi/fix/fix-api-buttons
Fix buttons not disabled when there isn't an API key available
2018-04-05 12:59:08 +02:00
Gina Häußge 83cdd4d79d Merge pull request #2552 from dforsi/fix/fix-typos
Fix typos in the docs
2018-04-05 12:58:00 +02:00
Daniele Forsi 1d1191eae0 Fix typos in the docs 2018-04-04 23:13:32 +02:00
Daniele Forsi 1efa0fa1e6 Fix buttons not disabled when there isn't an API key available
Also keeps always enabled the button to refresh the global API key.
Bootstrap buttons made from HTML <a> tags can only be disabled with CSS.
2018-04-04 20:09:06 +02:00
Gina Häußge 1852578136 Merge branch 'devel' into dev/permission
# Conflicts:
#	src/octoprint/plugins/logging/__init__.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/util/sockjs.py
#	src/octoprint/static/css/octoprint.css
2018-04-04 16:47:51 +02:00
Gina Häußge 085424f192 Support for binding to IPv6 addresses
Defaults to :: if IPv6 is supported, 0.0.0.0 otherwise. Both
intermediary server and Tornado are instructed to bind their sockets to
both IP versions.

Positive IPv6 support detection relies on

  * socket.has_ipv6 being True
  * socket.IPPROTO_IPV6 and socket.IPV6_V6ONLY being available (or
    redefined in case of Windows) in order to ensure dual stack binding
    for the intermediary server

Implements #2351
2018-04-04 15:04:33 +02:00
Gina Häußge db23bed00b Remove intermediary dialog for "forgot password"
Might annoy people after all having to click twice just to get the
information they are looking for.

Can be changed if the process gets changed.
2018-04-04 13:12:53 +02:00
Gina Häußge fdb2ba8146 Merge branch 'maintenance' into devel 2018-04-04 12:41:37 +02:00
Gina Häußge 9c31fa88a5 Merge branch 'staging/maintenance' into maintenance 2018-04-04 12:36:24 +02:00
Gina Häußge c5439da9d2 staging/maintenance is now 1.3.7rc5.dev 2018-04-04 12:34:57 +02:00
Gina Häußge e5caa3d0bf Preparing release of 1.3.7rc4 2018-04-04 11:10:45 +02:00
Gina Häußge a821346b07 Don't trigger PRINT_FAILED twice on disconnect
Fixes #2546
2018-04-04 11:10:43 +02:00
Gina Häußge 561bf83d88 Merge pull request #2540 from dforsi/fix/fix-rst
Add missing documentation for GCODE analysis and other small fixes
2018-04-04 09:51:06 +02:00
Gina Häußge baf8941f31 Merge pull request #2532 from dforsi/fix/fix-typos
Fix typo
2018-04-04 09:49:42 +02:00
Daniele Forsi f7dec5542b Fix typos 2018-04-03 23:41:34 +02:00
Daniele Forsi 6ec8b97ddb Add missing documentation for GCODE analysis and other small fixes
Adds documentation for `dimensions` and `printingArea`; fixes `length`
and `volume`; adds two internal references.
Fixes #2463.
2018-04-03 20:35:58 +02:00
Gina Häußge 0ac9ea518c SWU: Update "How to use release channels" link 2018-04-03 17:47:23 +02:00
Gina Häußge 9f80aefcc9 thaw_frozendict should be fully recursive
So far it was only deep-diving into frozendicts, not dicts (which might
contain frozendicts).

In principle we probably should also dive into tuples and lists and
other containers, but in our current application we don't put
frozendicts into those so let's not overdo it.
2018-04-03 16:56:59 +02:00
Gina Häußge c1fe8f5a35 Fix RawWebsocketTransport of sockjs
Ran into issues due to session wrapping in order to support custom
Json encoding.

We now make sure to

  * only wrap non-raw sessions (since only those have send_jsonified
    defined which we overwrite)
  * overwrite tornado.escape.json_encode to use our custom encoder as
    fallback, since that is used for RawWebsocketTransport

Fixes an issue with the /sockjs/websocket endpoint hinted at in #2529
2018-04-03 16:45:14 +02:00
Gina Häußge fcecb5c0f0 Fix heatup flag not resetting on external SD print start
If the start of the SD print could only be verified after the blocking
heatup was through, the start time was reset to None and hence the
heatup flag was not cleared on receival of the first ok, causing no
commands to be sent out and things to run into a timeout.

Fixes #2536
2018-04-03 15:41:13 +02:00
Gina Häußge 25005b547c Virtual: Add some debug commands for sd printing 2018-04-03 15:38:43 +02:00
Gina Häußge 35343705ca Merge pull request #2543 from ganey/bugfix/pip--no-cache-dir
Pip install with --no-cache-dir to handle plugin installations with MemoryError
2018-04-03 13:49:59 +02:00
Ganey 22e894c245 Merge branch 'maintenance' into bugfix/pip--no-cache-dir 2018-04-03 12:46:05 +01:00
Gina Häußge 4ef01610d0 Merge pull request #2541 from dforsi/dev/forgot-email
Add link to instructions to reset passwords
2018-04-03 13:34:29 +02:00
Michael Gane bb065828f2 pip install using --no-cache-dir for low memory devices 2018-04-03 10:51:52 +01:00
Daniele Forsi d0637f61d4 Add link to instructions to reset passwords 2018-04-02 23:46:06 +02:00
Daniele Forsi 84319366d1 Fix typo 2018-03-29 22:11:36 +02:00
Gina Häußge 92ea6ee9aa Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/util/tornado.py
2018-03-29 17:01:18 +02:00
Gina Häußge 2152c401bf Merge branch 'staging/maintenance' into maintenance 2018-03-29 16:59:24 +02:00
Gina Häußge dbfe7fece1 staging/maintenance is now 1.3.7rc4.dev 2018-03-29 16:58:55 +02:00
Gina Häußge 9c5d996ea2 Preparing release of 1.3.7rc3 2018-03-29 15:47:35 +02:00
Gina Häußge b8e7cfb506 "Where to find versions" is not on the FAQ 2018-03-29 14:24:58 +02:00
Gina Häußge 822f757f9d Ignore wait if job is on hold
See #2524
2018-03-29 14:23:17 +02:00
Gina Häußge b04aff7d5e Fix command expansion for non-gcode commands 2018-03-28 15:24:50 +02:00
Gina Häußge 0070349d66 Fix browser session getting overwritten by API key
Closes #2505
2018-03-27 16:53:14 +02:00
Gina Häußge 0cbad44055 Fix temperature profiles saving string values
Closes #2520
2018-03-27 16:23:13 +02:00
Gina Häußge 2571d32134 Include children on first level folder listings
This allows step-by-step traversal of file listings without the
recursive flag.

Fixes #2496
2018-03-27 15:29:53 +02:00
Gina Häußge 64ee8bac60 Support parsing xheaders in tornado
That will give us more accurate client ips, with a one hop limitation
however, see http://www.tornadoweb.org/en/stable/httpserver.html. If
more than one hop/reverse proxy is used in front of OctoPrint, their IPs
should be configured as server.reverseProxy.trustedDownstream in
config.yaml so they don't get detected as client IPs.

Implements #2512
2018-03-27 14:54:52 +02:00
Gina Häußge da392b9c9f Log asynchronously
Implements #2522
2018-03-27 13:50:03 +02:00
Gina Häußge 3179a1846f Update to Tornado 5 2018-03-27 11:45:02 +02:00
Gina Häußge b3912b2281 Remove legacyPluginAssets flag 2018-03-26 15:33:33 +02:00
Gina Häußge db14723ea2 Use regular scrollbars instead of slimscroll
See #2379
2018-03-26 15:17:17 +02:00
Gina Häußge 28831a68dd Add (configurable) small delay before baudrate detection
Solves issue with controllers that don't like baudrate switches right
after connection, e.g. the Einsy board.

Fixes #2517
2018-03-26 14:43:56 +02:00
Gina Häußge fb4e95bf8e Merge branch 'maintenance' into devel 2018-03-23 16:29:30 +01:00
Gina Häußge 6f18495395 Merge branch 'staging/maintenance' into maintenance 2018-03-23 16:29:06 +01:00
Gina Häußge 028425542f staging/maintenance is now 1.3.7rc3.dev 2018-03-23 16:28:47 +01:00
Gina Häußge 339d1df5a9 Preparing release of 1.3.7rc2 2018-03-23 15:29:00 +01:00
Gina Häußge 2abe67a24c Logging: Discourage disabling this plugin 2018-03-23 15:27:12 +01:00
Gina Häußge fc2ef8a09c Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2018-03-23 14:59:25 +01:00
Gina Häußge 0809540bd7 force always means "now", even when printing 2018-03-23 14:58:47 +01:00
Gina Häußge 47267abcd1 Fix HTTP 500 in case of unconfigured slicer
Fixes #2508
2018-03-23 14:24:10 +01:00
Gina Häußge 23f130da58 Fix "undefined" settings values not saving
Fixes #2494
2018-03-23 14:17:23 +01:00
Gina Häußge 3a71d39785 Merge pull request #2504 from dforsi/fix/fix-typos
Fix typos
2018-03-23 10:11:55 +01:00
Gina Häußge c41aecc2b8 Merge pull request #2502 from dforsi/fix/valid-html
Fix some invalid HTML
2018-03-23 10:11:21 +01:00
Gina Häußge 9af6b42bdd Virtual: Fix queue clearing on reset 2018-03-22 17:50:48 +01:00
Gina Häußge 7cb910a69a Forgot a monotonic.monotonic 2018-03-22 17:10:06 +01:00
Gina Häußge c30db16085 Fire print failed event on error while printing
That will ensure to also stop timelapse
2018-03-22 16:17:25 +01:00
Gina Häußge 832a0c88aa Virtual: also reset autoreporting & fix heatup 2018-03-22 16:15:56 +01:00
Gina Häußge 972c2823a0 Add missing _sprintf wrapper around messages
Fixes #2499
2018-03-22 14:21:20 +01:00
Gina Häußge f10bfa67ca Use "import pip" method of calling pip only as last resort
Doing that poses too much risk with pip's general "no API support", as
seen in #2499.
2018-03-22 13:59:38 +01:00
Gina Häußge fb834f81ee Use pkg_resources to find out local pip version
Doing a "import pip; pip.__version__" or "from pip import __version__"
poses too much risk with pip's general "no API support", as seen in
#2499.
2018-03-22 13:46:38 +01:00
Gina Häußge 957ba43320 Virtual: Support for simulated reset 2018-03-22 13:36:12 +01:00
Gina Häußge 133850f61c Actually, make that a deepcopy 2018-03-22 13:08:01 +01:00
Gina Häußge f782cfe83f Thaw the frozendict on printer.get_current_data
We don't want calling code to run into trouble because of that.

Fixes #2506
2018-03-22 12:58:52 +01:00
Gina Häußge 70254e910c Use octoprint.util.monotonic_time instead of monotonic 2018-03-22 11:41:31 +01:00
Gina Häußge f981cca47e Forgot a "global"
Fixes #2501
2018-03-22 11:34:39 +01:00
Daniele Forsi 06f62bd874 Fix a typo in the docs 2018-03-22 00:23:02 +01:00
Daniele Forsi 23bcbba013 Fix typo 2018-03-21 19:28:22 +01:00
Daniele Forsi cb18d3fe32 Fix some invalid HTML
Fixes 4 kinds of errors found with https://validator.w3.org/nu/#textarea
Bad value javascript for attribute lang on element script
Bad character after < . Probable cause: Unescaped < . Try
escaping it as &lt; .
The element label must not appear as a descendant of the label element.
Element legend not allowed as child of element form in this context.

Note: the change related to <legend> seems big because of the increased
indent of the existing code (use "git diff --ignore-all-space" or
"git log --patch --ignore-all-space" to see the lines actually added).
2018-03-21 16:14:02 +01:00
Gina Häußge 95694453f4 Merge pull request #2495 from dforsi/fix/remove-unneeded-format
Remove unneeded format() filter from template
2018-03-20 16:51:16 +01:00
Gina Häußge 0825e0660f Merge pull request #2498 from dforsi/fix/issue/2487
Document the async flag of custom system commands
2018-03-20 16:50:19 +01:00
Gina Häußge 0224037478 Have OctoPrintJsonEncoder fall back to flask encoder
That supports some types we want to keep just in case.
2018-03-20 16:19:06 +01:00
Daniele Forsi 819d4d0fdf Expand the description of custom system commands
Fixes #2487
2018-03-20 16:12:49 +01:00
Gina Häußge cedbf039d2 Consolidate json encoding like in 1.3.x 2018-03-20 16:12:32 +01:00
Gina Häußge d1711f0376 Merge branch 'devel' into dev/permission
# Conflicts:
#	src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
#	src/octoprint/server/__init__.py
#	src/octoprint/server/util/flask.py
#	src/octoprint/server/util/sockjs.py
#	src/octoprint/static/css/octoprint.css
#	src/octoprint/static/js/app/viewmodels/printerstate.js
#	src/octoprint/templates/tabs/timelapse.jinja2
2018-03-20 16:10:19 +01:00
Daniele Forsi 1c43e193ba Remove unneeded format() filter 2018-03-19 18:55:14 +01:00
Gina Häußge 047b9f544a Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/__init__.py
#	src/octoprint/server/util/__init__.py
#	src/octoprint/server/util/flask.py
#	src/octoprint/users.py
2018-03-19 17:24:11 +01:00
Gina Häußge 4f1cd6b3a2 maintenance is now 1.3.8.dev 2018-03-19 17:19:38 +01:00
Gina Häußge e4914b8bd3 staging/maintenance is now 1.3.7rc2.dev 2018-03-19 17:18:39 +01:00
Gina Häußge da2c9632ea Preparing release of 1.3.7rc1 2018-03-19 13:46:19 +01:00
Gina Häußge 8a3a87efac Extract firmware safety check into bundled plugin 2018-03-19 13:22:59 +01:00
Gina Häußge 8cdae335a2 Fix typo in issue template 2018-03-19 10:50:56 +01:00
Gina Häußge 75ad9aeeb6 Merge branch 'pr/2491' into maintenance 2018-03-19 10:50:31 +01:00
Daniele Forsi 709f7a76f1 Remove unused or duplicated imports
Fixes the following pylint's warnings:
W:  9, 0: Unused import io (unused-import)
W: 33, 1: Unused walk imported from os (unused-import)
W:308, 4: Reimport 're' (imported line 16) (reimported)
W: 17, 1: Reimport 'os' (imported line 8) (reimported)
2018-03-19 10:49:03 +01:00
Gina Häußge c04fade9a7 docs: Fix two issues pointed out by @dforsi
Thanks!
2018-03-19 10:46:20 +01:00
Daniele Forsi 2ecbd9f8c8 Fix typos in docs 2018-03-19 10:43:08 +01:00
Gina Häußge 3e24b68b45 Attach additionalClasses to all custom controls
Fixes #2489
2018-03-19 10:36:26 +01:00
Gina Häußge 46a0c3057f Logging: At missing CSS file
Thanks @kantlivelong for the heads-up
2018-03-19 10:36:07 +01:00
Greg Sadetsky 902407ed92 typo fix 2018-03-19 00:44:04 -04:00
Gina Häußge ccbe9311d7 Add firmware safety warning
For now it only triggers for the Anet A8's stock firmware which for some
idiotic reason has thermal runaway protection disabled (it's 2018 ffs!)
2018-03-18 00:38:06 +01:00
Gina Häußge 8ea7528d41 Show control tab if webcam or control allowed 2018-03-17 18:03:41 +01:00
Gina Häußge 82dffa50f7 Improve log output of PipHelper & LocalPipHelper
Should make it easier to detect the reason for a broken pip install in
the future (e.g. non writable install directories).
2018-03-16 17:23:56 +01:00
Gina Häußge 0d51e5bb1c Hide connection refresh button if panel is collapsed 2018-03-16 14:34:09 +01:00
Gina Häußge fd7fbcc113 CSS update 2018-03-16 14:12:52 +01:00
Gina Häußge 5791562c6a [Doc] Some changes on the index & a fix 2018-03-16 14:12:39 +01:00
Gina Häußge 6582740a1e http://faq... -> https://faq... 2018-03-16 11:15:22 +01:00
Gina Häußge 73ce6f43ab bit.ly/octoserial -> faq.octoprint.org/serialerror 2018-03-16 11:14:19 +01:00
Gina Häußge bc746a49e9 Merge branch 'master' into maintenance 2018-03-16 11:05:25 +01:00
Gina Häußge e8d5449a8f Adjust issue template for new GH layout
Apparently the "big yellow box" hinting the contribution guidelines
vanished some time ago and got replaced by a teeny tiny link to the
right under "Helpful resources". Ah well.
2018-03-15 16:30:54 +01:00
Gina Häußge 01f5a58709 Fix a typo 2018-03-15 16:20:33 +01:00
Gina Häußge 61769262f6 New meta git prefix for github meta md updates 2018-03-15 16:10:17 +01:00
Gina Häußge faa8174846 Link to community forum & new FAQ location
Also updated contribution guidelines & templates
2018-03-15 16:08:02 +01:00
Gina Häußge 0eb441058e Links to new forum & FAQ 2018-03-13 18:51:04 +01:00
Gina Häußge 32a31a7d4a Hook for defining custom atcommands 2018-03-13 11:06:52 +01:00
Gina Häußge 01bae0c95c _atcommand_abort_sending => _atcommand_abort_queuing 2018-03-12 18:37:43 +01:00
Gina Häußge ada873be1d First throw at native @ command support
For now the following commands are supported:

  * @pause: Pauses the print
  * @resume: Resumes the print
  * @cancel or @abort: Cancels the print

As discussed in #2414. Also implements #324.
2018-03-12 18:33:40 +01:00
Gina Häußge a95407c815 Fix flask_login._get_remote_addr
We can't easily upgrade to 0.3.0 right now due to backwards incompatible
changes in that version (some methods became properties). So for now
we simply backport the fix in question through a monkey patch.

Fixes #2296
2018-03-12 16:40:19 +01:00
Gina Häußge e0722e6c28 flask.ext.* => flask_*
And some refactoring in the server class
2018-03-12 16:39:35 +01:00
Gina Häußge e32aa3f2c8 text/plain mime type for log downloads 2018-03-12 12:38:39 +01:00
Gina Häußge 8e764e34ee SWU: Refer to console log on update failure 2018-03-12 12:25:17 +01:00
Gina Häußge cfb0eb84e2 Make sure that "method" is a function
It could be null or anything else really, so better be safe than sorry
;)

See comments in ntoff/OctoPrint-Estop#4
2018-03-09 19:12:26 +01:00
Gina Häußge effefffe74 SWU: Better detection if an update is already running 2018-03-09 16:06:50 +01:00
Gina Häußge 8148fd7679 SWU: Add sleep_a_bit updater for testing 2018-03-09 16:05:47 +01:00
Gina Häußge f8079c3f50 Fix unset error handling
No proper value was set if ignoreErrorsFromFirmware ==
disconnectOnErrors == false. Now falls back correctly to "cancel".

Closes #2472
2018-03-09 15:42:11 +01:00
Gina Häußge 4c3e44d50e Fix a method call
Thanks @FormerLurker for the heads-up!
2018-03-09 10:48:50 +01:00
Gina Häußge a2ccf414e6 comm: compat fix for pyserial 2.7 vs 3.4
Closes #2468
2018-03-09 10:40:02 +01:00
Gina Häußge 02c42ecdc0 [doc] Fix an error 2018-03-08 18:09:44 +01:00
Gina Häußge c6dfdf8d4b comm: custom readline implementation w/ buffer
We always read everything from the serial that is currently available in
our rx buffer but only return the first line in that. While that
increases our memory consumption slightly, it should hopefully not cause
issues and should greatly reduce the risk of buffer overflows making us
lose or receive corrupt data.

Possible solution for #2370 and #2454
2018-03-08 18:09:28 +01:00
Gina Häußge 10af43285b comm: fix job_on_hold & add further options for using it
* next command could be queued even if job was already on hold due to
    a check missing
  * context manager was too limiting, could lead to race conditions
    where the job_on_hold flag wasn't set in time when moved to a
    handler thread, introducing a dedicated set_job_on_hold method
    for that solves this (at the downside of requiring more care from
    plugin developers utilizing this)

Fixes #2467
2018-03-08 15:12:22 +01:00
Gina Häußge 25dc4528af comm: Add line & pos in file to command tags 2018-03-08 10:40:01 +01:00
Gina Häußge bb61bbb2b4 Add "Not SD printing" to sd status terminal filters
As noted in #2335
2018-03-07 17:49:49 +01:00
Gina Häußge e6ec48b8a1 Support SD status autoreport 2018-03-07 17:45:06 +01:00
Gina Häußge 98c7ad0c20 If current == total -> not SD printing 2018-03-07 17:07:21 +01:00
Gina Häußge 52bb94e272 Try to detect externally started SD prints
Strongly depends on the firmware:

  * Firmware must send a "File opened: ..." message on start of the
    print
  * Firmware must respond to an immediately sent M27 with "SD printing
    byte <current>/<total>"
  * Firmware must stay responsive during ongoing print to allow for
    regular M27 polls (or push those automatically) or M25 to pause/
    cancel the print through OctoPrint.
2018-03-07 16:35:18 +01:00
Gina Häußge e0f8ae8986 "SD printing byte 0/0" means we ain't printing
Newer versions of Marlin apparently now report it like that instead of
returning "Not SD printing".
2018-03-07 16:34:58 +01:00
Gina Häußge 291fa88a82 Merge branch 'pr/2444' into maintenance 2018-03-07 15:39:56 +01:00
Gina Häußge 88b622e282 customClass => additionalClasses 2018-03-07 15:39:36 +01:00
Gina Häußge 3fcd5adfbd Timelapse: Add snapshot imeout & SSL validation settings
Implements #2455 & #2362
2018-03-07 15:20:46 +01:00
Gina Häußge 1f9c9bed42 Timelapse: Remove post roll capturing from timed timelapses
As discussed in #2317 this option was confusing and frustrating too many
people. Instead of an actual capture we'll now just do the same as for
z-based timelapses and use the last image repeatedly.

No, using the live webstream and capturing real time image is NOT an
option and not going to happen here, see the discussion in #2317 on this
as well.
2018-03-07 14:56:10 +01:00
Gina Häußge f1401d3f1e Gcode viewer: Don't hiccup on GCODE subcodes
Implements #2378
2018-03-07 14:33:33 +01:00
Gina Häußge 5216729834 Add a regular server heartbeat to the log 2018-03-07 14:24:38 +01:00
Gina Häußge bab4782b8c Log comm states to application log
Should allow to better debug some things in the future
2018-03-07 14:09:55 +01:00
Gina Häußge eada72a4d9 Add __str__ for sockjs connection 2018-03-07 14:05:10 +01:00
Gina Häußge 088b4a8059 Use frozendict for printer state
Attempt to narrow down on #1951.

To be on the safe side, the use of frozendict here can be disabled by
settings devel.useFrozenDictForPrinterState to False in the config.
2018-03-07 14:04:20 +01:00
Gina Häußge 90aa5ed3d4 Custom json encoding for flask & sockjs
That will allow us to support encoding non-built in types by simply
adding them through octoprint.util.json.JsonEncoding.add_encoder
2018-03-07 14:01:42 +01:00
Gina Häußge 3c8d2f2df5 Remove a blank line so @ntoff can sleep again
Also reformatted the block of text a bit in code.
2018-03-07 13:46:24 +01:00
Gina Häußge 283c44e35e Better logging of printer callback errors 2018-03-07 13:41:29 +01:00
Gina Häußge 125673b846 Merge pull request #2466 from ntoff/improve/disconnectWarning
Add a confirmation if disconnecting while printing
2018-03-07 13:38:03 +01:00
ntoff fb6ff04013 Add a confirmation to disconnect while printing
Fullfills a feature request:
https://github.com/foosel/OctoPrint/issues/2287

Add a confirmation dialog if a user attempts to disconnect while a print
is in progress
2018-03-07 22:21:54 +10:00
Gina Häußge 6a3f1d28fb Reduce code duplication in error handling 2018-03-06 15:08:41 +01:00
Gina Häußge 2abff3b589 Fix broken unit test 2018-03-06 15:05:25 +01:00
Gina Häußge c84f49e852 Change presentation of serial error handling config
A set of radio controls is less confusing than two distinct checkboxes.
2018-03-06 14:49:30 +01:00
Gina Häußge de0660f678 Force disconnect on error state
Fixes #2461
2018-03-06 13:28:40 +01:00
Gina Häußge ee36e2abd3 Allow detection of firmware w/ broken resend
If firmware doesn't send an ok immediately after a resend request, we
will now be able to detect this (if enabled to do so) by starting a
timer that will simulate an ok after .5s if none has been received.

This should help with issues like prusa3d/Prusa-Firmware#331 where an ok
is only missing sometimes and not always, making the existing workaround
of always simulating an ok after a resend cause additional problems.
2018-03-06 12:48:24 +01:00
Gina Häußge 11eb731b3d Virtual printer: simulate broken resends w/o ok 2018-03-06 12:44:11 +01:00
Gina Häußge 01d37fc9ee PMGR: Reduce notification spam 2018-03-05 17:25:15 +01:00
Gina Häußge 59cbfaf8ff Introduce Cancelling/Pausing states before full cancel/pause
We so far switched immediately to "Operational" state, even while the M400/M114
combo and/or any post switch scripts were still being executed. That was confusing
and as witnessed in #2321 and also #2449 also could cause issues.
2018-03-05 16:12:33 +01:00
Gina Häußge b8e4ac21d0 Example and copy-paste-fix for new comm error handler hook 2018-02-28 17:14:06 +01:00
Gina Häußge 2db2532c2f Fix unit tests broken by implementation of #2208 2018-02-28 17:07:53 +01:00
Gina Häußge d42c74d34a Hook for custom error handling by plugins
Implements #2208
2018-02-28 16:50:08 +01:00
Gina Häußge 551d6aab68 Detect invalid tools according to firmware
Also don't send invalid tool commands (based on printer profile and
former responses from the firmware on the ongoing connection).

Closes #2302
2018-02-26 17:25:42 +01:00
Gina Häußge 2c87133f3d Virtual: Report invalid extruders on serial
For testing #2302
2018-02-26 17:05:18 +01:00
Gina Häußge 296af89b02 Fix two buggy sets of tags 2018-02-26 16:52:00 +01:00
Gina Häußge 18ad764ef5 Also detect plugins only provided as pyc
Implements #2448
2018-02-26 16:04:27 +01:00
Gina Häußge ec86b3328e Remove left-over parameter 2018-02-26 12:51:38 +01:00
Gina Häußge 820ad59539 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2018-02-26 12:48:46 +01:00
Gina Häußge b3fff6e95f Fix firmware error reporting on job cancel
Closes #2364
2018-02-26 12:47:46 +01:00
Gina Häußge 763888e83a Allow slicers to manage their profiles themselves 2018-02-24 22:30:12 +01:00
Gina Häußge c6bb825f7e Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2018-02-24 22:09:56 +01:00
Gina Häußge c3ba9c8453 Fix upload_cli 2018-02-24 15:20:56 +01:00
Gina Häußge a3ba266a6b Some more work on the AST parsing
Also use version parsed from AST for blacklist check too.
2018-02-24 14:54:58 +01:00
electr0sheep 9a8b8d86d5 Extended "customControls_controlTemplate_command" 2018-02-23 18:00:54 -07:00
Gina Häußge b108fc939c Extract control property values from disabled plugins
By parsing the main plugin file into a Python AST we can still extract
the control property values (as long as they are simple string
assignments or calls to gettext with a string argument) without having
to execute them in any way.
2018-02-23 19:06:24 +01:00
Gina Häußge 40082456c1 Don't even import disabled plugins
We want to avoid disabled plugins interfering with our application
in any way at all.

Hence disabled plugins are now treated the same way as blacklisted ones.
The system will only create a dummy entry for them and not import them
at all. As a consequence, a restart of the platform will be necessary
for disabling plugins that were disabled.

The Plugin Manager has been adjusted accordingly.

Note that by no longer even importing the base file, plugin name,
version, description and other such metadata defined through control
properties won't be accessible.

Closes #2442
2018-02-23 19:05:34 +01:00
Gina Häußge 43bf55d503 Migrate logging plugin to new permission system 2018-02-20 15:43:20 +01:00
Gina Häußge b9a5e1db69 Merge branch 'devel' into dev/permission
# Conflicts:
#	src/octoprint/plugins/corewizard/__init__.py
#	src/octoprint/plugins/pluginmanager/__init__.py
#	src/octoprint/plugins/softwareupdate/__init__.py
#	src/octoprint/printer/standard.py
#	src/octoprint/server/__init__.py
#	src/octoprint/server/api/job.py
#	src/octoprint/server/api/log.py
#	src/octoprint/server/util/__init__.py
#	src/octoprint/server/views.py
#	src/octoprint/static/css/octoprint.css
#	src/octoprint/static/js/app/main.js
#	src/octoprint/static/js/app/viewmodels/log.js
#	src/octoprint/static/js/app/viewmodels/loginstate.js
#	src/octoprint/static/js/app/viewmodels/printerstate.js
#	src/octoprint/static/js/app/viewmodels/users.js
#	src/octoprint/static/less/octoprint.less
#	src/octoprint/templates/dialogs/settings/logs.jinja2
#	src/octoprint/templates/tabs/control.jinja2
#	src/octoprint/util/__init__.py
2018-02-20 15:42:43 +01:00
Gina Häußge 03d421c629 Merge remote-tracking branch 'origin/devel' into devel 2018-02-20 13:17:41 +01:00
Gina Häußge 066e7d1e39 flask.ext.foo => flask_foo 2018-02-20 13:15:30 +01:00
Gina Häußge 4fd641dc74 Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/server/__init__.py
2018-02-20 12:55:55 +01:00
Gina Häußge 541844ce3c Add action:cancel
Closes #2367
2018-02-19 11:38:58 +01:00
Gina Häußge 33147b0305 Make terminal logging to log unicode safe
Closes #2426
2018-02-19 11:27:37 +01:00
Gina Häußge 55f5c472a0 [Docs] Some fixes 2018-02-16 22:03:54 +01:00
Gina Häußge d166bafa8d New context "job_on_hold" on printer object
Can be used to do some stuff while printing while ensuring that the file
won't continue to be streamed. Should be used sparingly and only for
very limited reasons since it can severely affect print results.
2018-02-16 22:03:45 +01:00
Gina Häußge 00e6a3856f Allow tagging of GCODE commands throughout their lifecycle
Commands injected/extended/rewritten through one of the phase hooks or
sent by a plugin through self._printer.commands will also be tagged with
"plugin:<plugin identifier>", allowing other code to detect these tags
and handle such commands differently.

That will be interesting for plugins that need to differentiate between
commands originating from the printed file vs the user vs the system vs
other plugins.
2018-02-16 18:41:17 +01:00
Gina Häußge 1587ee6402 Forgot to adjust migrated settings locs in comm layer 2018-02-16 10:24:13 +01:00
Gina Häußge eadb4a5bb6 [Docs] document new capabilities config settings 2018-02-15 17:10:15 +01:00
Gina Häußge 5c63e618b1 Refactor serial settings
* migrate several actually serial & protocol related settings from
    feature settings to serial settings
  * migrate terminal auto uppercase blacklist from serial settings to
    feature settings
  * restructure the serial settings dialog
  * adjust docs accordingly
2018-02-15 17:05:01 +01:00
Gina Häußge be3907c7d1 Allow disabling busy & autoreport support 2018-02-15 11:56:29 +01:00
Gina Häußge 8732ec9756 Introduce ok timeout to detect stalls in auto report scenarios
If a printer supports auto reporting the temperature but doesn't also
support sending "wait" if the command buffer runs dry, it can happen
that a lost "ok" never gets detected properly because no timeout is ever
triggered (the printer is in fact sending data after all), but we should
actually try to get comms running again.

Introducing a custom ok timeout solves this. We reset this every time we
see an "ok", "wait" or "busy", but if we run into it while printing we
perform the same steps as if we hadn't received any data at all from the
printer over the duration of the currently active communication timeout
value (whether to choose "communication" or "communicationBusy" here
depends on whether we also detected support of the busy protocol or
not).
2018-02-15 11:56:28 +01:00
Gina Häußge 7d3d3408eb Switch to lower comm timeouts on busy protocol detection
If the printer supports the busy protocol (which we should automatically
notice by it using it on the first blocking heatup or otherwise blocking
operation), it's safe reduce the communication timeout to a way way
lower value since the busy protocol should guarantee a heartbeat from
the printer at known intervals and so timeouts really should only happen
if something gets lost on the way.

We also set the interval on the printer to our configured busy timeout
minus 1s so we can be sure that we should always see a busy line from
the printer before we run into our own timeout. We do this via M113.
2018-02-15 11:56:28 +01:00
Gina Häußge 6afb291440 Merge pull request #2422 from koenkooi/balloon-maintenance
piptestballoon: fix typo in comment: intenional -> intentional
2018-02-13 10:41:01 +01:00
Koen Kooi 522ee49b5b piptestballoon: fix typo in comment: intenional -> intentional
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2018-02-13 10:35:08 +01:00
Gina Häußge de9fdf79c4 Merge branch 'improve/trustBasicAuth' into maintenance 2018-02-12 15:27:24 +01:00
Gina Häußge 26dbf59251 Allow newer versions of pyserial
This will allow our fix for #2333 to become active even with OctoPrint
1.3.7 if the user manually upgrades pyserial to version 3.1 or newer.
2018-02-12 14:39:58 +01:00
Gina Häußge 8ad0aadb52 SWU: Workaround for pip problem with eggs
Starting with pip 7.x pip runs into an issue if a software package
formerly installed as a Python egg (= zip file stored in site-packages,
referenced through easy-install.pth, e.g. through a stand alone "python
setup.py install") is to be updated to a newer version.

The issue arises since the egg is still on the python path after the
replacement has taken place, and pip tries to read from it without error
handling for the fact that this file is now not longer existing. The
source of the problem appears to be with both the bundled as well as the
stock versions of pkg_resources and pip's usage of them to perform its
management duties. It's currently unclear if the problem is a bug or a
feature, even though it strongly looks like the first one.

In any case, during tests it was found that this problem can be worked
around by simply performing a second "pip install" with same parameters
right after the failed first one.

This patch detects this scenario based on the logged error message and
performs the second install if deemed necessary.

This is a preparational step to allow upgrade of the pyserial dependency
(and other dependencies currently installed as eggs as part of
OctoPrint's former "python setup.py install" installation procedure)
with OctoPrint 1.3.8, to finalize the fix for #2333.
2018-02-12 14:39:58 +01:00
Gina Häußge 87921061d9 SWU: New version checkers for debugging
* always_current: Always reports as current
  * never_current: Always reports as needing an update
2018-02-12 14:39:58 +01:00
Gina Häußge 6812001639 SWU: Point to log file by name in error messages 2018-02-12 14:39:58 +01:00
Gina Häußge 00616a3d73 Merge pull request #2411 from kantlivelong/terminal_autoscroll_enchancements
ENHANCEMENT: Terminal: Autoscroll Enhancements
2018-02-08 20:36:57 +01:00
Shawn Bruce a7a78c11d4 Terminal: Autoscroll Enhancements
* Disable autoscroll when scrolling up.
	* Scroll to bottom when autoscroll is toggled to enable.
2018-02-08 13:32:08 -05:00
Gina Häußge 60c7974aa4 Revert "Update to pyserial 3.4"
This is causing issues on update thanks to the PySerial installation
logging an error if the former version was installed through
dependency resolution during OctoPrint's python setup.py install run
(which is most likely the case for pretty much all live installations
out there).

Update (and hence activation of fix for #2333) postponed until a
solution for this issue is found.

This reverts commit 77989d2a76.
2018-02-08 16:53:45 +01:00
Gina Häußge 441db2dbbc Merge pull request #2409 from koenkooi/mkv-maintenance
timelapse: add m4v and mkv as supported container formats
2018-02-08 15:50:28 +01:00
Koen Kooi 066d3d7422 timelapse: add m4v and mkv as supported container formats
Not every player can handle non-mpeg2 codecs inside a .mpg. QuickTime
Player on OSX goes a step further and won't play h264-in-mp4, only
h264-in-m4v.
2018-02-08 15:44:55 +01:00
Gina Häußge 98b71a5870 Tell PySerial to cancel reads & writes on connection close
Only done if the methods needed for that exist and are callable though
(to prevent issues with custom serial port implementations provided
through hooks, or operating systems that don't have support for
cancel_read/cancel_write in PySerial.

Fixes #2333 (at least as far as we'll ever be able to fix it)
2018-02-08 15:17:12 +01:00
Gina Häußge 77989d2a76 Update to pyserial 3.4 2018-02-08 15:04:36 +01:00
Gina Häußge f35fe32a92 Better fix of "copy all" on Terminal tab
See also #2392
2018-02-08 12:36:31 +01:00
Gina Häußge b79f669351 Fix "copy all" on Terminal tab
Closes #2392
2018-02-08 12:28:36 +01:00
Gina Häußge 528bd90d02 Merge pull request #2406 from kantlivelong/about_showTab_fix
BUGFIX: Fix showTab function
2018-02-07 17:51:12 +01:00
Gina Häußge b8d23c8bc1 Logging: Fix a return value 2018-02-07 16:46:33 +01:00
Gina Häußge bb822fb9dd Logging: add/move docs for the plugin 2018-02-07 14:18:52 +01:00
Gina Häußge 77aeb6146e Logging: redirects for backwards compatibility 2018-02-07 14:18:51 +01:00
Gina Häußge de253e5086 Logging: some refactoring and fixes
* logs => logging
  * i18n
  * Add JS client & streamline API
  * Whitespace and metadata fix
  * Add LESS/CSS files
  * camelCase => snake_case
  * fix log deletion & add missing var
2018-02-07 14:17:53 +01:00
Shawn Bruce 986591aed4 Logging: extract log managment into bundled plugin 2018-02-07 14:11:49 +01:00
Shawn Bruce 48f87b2979 Fix showTab function 2018-02-06 11:20:55 -05:00
Gina Häußge ec12bd7cd4 Introduce CaseInsensitiveSet & use for valid boolean trues
Follow up to #2385
2018-02-06 10:15:57 +01:00
tedder b3b19dc136 add 'True' as a string as a boolean
This allows pythonic API clients to pass boolean values in:

requests.get('/api/printer', params={'history': True})

Previously this didn't work, as Octoprint doesn't see True as a boolean, it gets a sting. So it never matches True, it only matches "True".

Easy to test:
curl -H "X-Api-Key: x" http://octopi.local/api/printer?history=true | grep history
curl -H "X-Api-Key: x" http://octopi.local/api/printer?history=True | grep history
2018-02-06 09:48:49 +01:00
Gina Häußge 9f1abee023 Add refresh button to the connection panel 2018-02-06 09:31:48 +01:00
Gina Häußge fca7005bfa [Docs] Document basic auth config settings 2018-02-05 15:54:12 +01:00
Gina Häußge fcf7358855 BasicAuth: Check PW too by default
Also slightly refactored to deduplicate.
2018-02-05 15:37:46 +01:00
Gina Häußge c050bd15ac Merge branch 'basic_auth_autologin' of https://github.com/bzed/OctoPrint into maintenance 2018-02-05 12:31:26 +01:00
Gina Häußge 3e236dc57d Temperature graph: Small axis fixes
* remove "just now" X axis tick, we just don't show anything for less
    than a minute ago now
  * add unit to Y axis ticks

Closes #2371
2018-02-05 12:27:57 +01:00
Gina Häußge aa0ea299ea Docs for printer profile related bits and pieces 2018-02-01 18:26:13 +01:00
Bernd Zeimetz 57a58b3bd7 Trust basic authentication headers for user login.
This is my suggestion on how to handle basic authentication for users
mananaged by OctoPrint's UserManager.

In my opinion OctoPrint should not be doing Basic Authentication on its
own. The commen case is that it runs on some slow hardware which its not
able to handle stupid bots trying out thousands of passwords in short
time. Also you want to protect it as much as possible from the outside
to ensure that the basd internet can't break your 72h print after 71
hours by brute-forcing passwords.

So I'm introducing an
  accessControl: trustBasicAuthentication
config option. If enabled, it will take the user name from the
Authorization header, check if the user exists and is enabled - and if
so, just login the user.
2018-01-22 21:32:04 +01:00
Gina Häußge 67005577b7 Cura plugin: str to unicode
Closes #2368
2018-01-22 17:48:32 +01:00
Gina Häußge b1f9e070a4 Return 403 instead of 401 on missing/insufficient credentials
Closes #2297
2018-01-22 16:06:36 +01:00
Gina Häußge b5aae0b8fa Improve resilience against errors on file listing
Closes #2294
2018-01-22 13:51:32 +01:00
Gina Häußge 1b5b243760 Merge pull request #2338 from kantlivelong/octoprint_comm_protocol_scripts_enhancement
Allow plugins to define gcode script variables using the octoprint.comm.protocol.scripts hook
2018-01-22 12:07:13 +01:00
Shawn Bruce 6545f9a816 Allow plugins to define gcode script variables using the octoprint.comm.protocol.scripts hook 2018-01-12 13:05:45 -05:00
Gina Häußge c11288ff65 Merge pull request #2337 from kantlivelong/autoconnect_fix
BUGFIX: Fix autoconnect on start so that it works with the port set to AUTO (#2311)
2018-01-12 15:35:50 +01:00
tedder ed70944f69 grammatical fix in text
[It's a common error](https://brians.wsu.edu/2016/05/31/setup-set-up/); I'm not sure if it needs to be fixed in all three places or perhaps only in the .pot file.

(cherry picked from commit a77fbfe)
2018-01-12 15:34:05 +01:00
Gina Häußge 16b690089d Merge pull request #2328 from tedder/grammar_fix_setup
grammatical fix in text
2018-01-12 15:31:09 +01:00
Gina Häußge 88cb28cec9 More resilience against possible None parameters 2018-01-12 15:29:06 +01:00
Shawn Bruce 15c390b199 Fix autoconnect on start so that it works with the port set to AUTO (#2311) 2018-01-03 00:08:44 -05:00
tedder a77fbfe0c2 grammatical fix in text
[It's a common error](https://brians.wsu.edu/2016/05/31/setup-set-up/); I'm not sure if it needs to be fixed in all three places or perhaps only in the .pot file.
2017-12-27 19:57:47 -08:00
Shawn Bruce 8b09b11faa Check for valid queue entry before attempting to dequeue. 2017-12-27 11:31:42 -05:00
Gina Häußge bad3612ed2 Minimum temperature cutoff is now 1 min
Solves core reason of #2213
2017-12-14 18:10:41 +01:00
Gina Häußge b079978384 Fix missing line break in case of > 3 announcements 2017-12-14 14:06:48 +01:00
Gina Häußge b36a776f51 Merge branch 'maintenance' into devel 2017-12-12 13:09:41 +01:00
Gina Häußge 13558c01f9 Merge branch 'staging/maintenance' into maintenance 2017-12-12 13:09:24 +01:00
Gina Häußge 777c02135e Fixed a copy paste error in the changelog 2017-12-12 12:42:40 +01:00
Gina Häußge 793bb714eb Preparing release of 1.3.6 2017-12-12 10:36:33 +01:00
Gina Häußge 8229842334 Revert "Some long overdue == vs === view model cleanup"
This reverts commit 8a977e8777.

Was causing at least one regression, to be redone for 1.3.7
2017-12-12 10:09:27 +01:00
Gina Häußge ef6b39757b Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2017-12-08 16:22:19 +01:00
Gina Häußge 2cae028d47 Merge branch 'staging/maintenance' into maintenance 2017-12-08 16:22:05 +01:00
Gina Häußge 38a711ac56 staging is now 1.3.6rc4 2017-12-08 16:21:05 +01:00
Gina Häußge a8747f7e36 Fix a bug with release vs dev version detection 2017-12-08 15:09:58 +01:00
Gina Häußge 17e6f5d508 Preparing release of 1.3.6rc3 2017-12-07 17:40:04 +01:00
Gina Häußge 133a4658ee Switch to https for (plugins.)octoprint.org
Also add utm tags to the two support-octoprint links so we have a chance
to see if anyone ever actually clicks on those.
2017-12-07 16:35:01 +01:00
Gina Häußge 0a2e2ed297 Don't write default update type & method to config
If we set method to pip in 1.3.6 and then roll back to 1.3.5 we will
need to a manual config.yaml update otherwise or we will no longer be
able to update.

Be removing the force parameter and using the actual default settings
instead of current ones, we don't do that anymore.
2017-12-07 11:15:43 +01:00
Gina Häußge 86934c8863 Support M114 response from RepRapFirmware
RRF uses format X:... Y:... Z:... E0:... E1:... instead of
X:... Y:... Z:... E:...
2017-12-06 16:03:19 +01:00
Gina Häußge 13eb5ec7ed Merge pull request #2250 from kantlivelong/resettable_timer
Added ResettableTimer class
2017-12-06 11:42:45 +01:00
Shawn Bruce 6ce6160f3d Added ResettableTimer class 2017-12-05 12:00:12 -05:00
Gina Häußge 9c39dd7303 Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
2017-12-05 16:02:19 +01:00
Gina Häußge 9bdbb930ad Merge branch 'staging/maintenance' into maintenance 2017-12-05 16:01:28 +01:00
Gina Häußge 6b41dbc12b staging is 1.3.6rc3.dev 2017-12-05 16:00:58 +01:00
Gina Häußge 3f4a70cf92 Prepare release of 1.3.6rc2 2017-12-05 12:34:55 +01:00
Gina Häußge 41eb9481b3 Fix offset values on API after setting one offset
Make sure to set the actual effective offsets as provided by the comm
layer (which merges incoming single offset adjustments) instead of only
setting the input, effectively nuking return of offsets set prior.

Closes #2268
2017-12-05 12:17:48 +01:00
Gina Häußge 743d590d52 model might not be set yet
So don't try to read its length right away.

Closes #2267
2017-12-05 10:54:33 +01:00
Gina Häußge 900e8a2aaf Docs: Fixed a typo 2017-12-05 10:40:20 +01:00
Gina Häußge 06816fb8dc Test: checksum missing => missing checksum 2017-12-04 16:04:38 +01:00
Gina Häußge cc0a17f2ac Unit tests for MachineCom._handle_errors
With various Marlin and Repetier error variants.
2017-12-04 15:56:31 +01:00
Gina Häußge 9b1b4420a3 Make error messages in virtual printer configurable
We want to be able to test various firmware variants for stuff like
checksum and line number mismatches...

See also #2262
2017-12-04 11:47:29 +01:00
Gina Häußge 263925625b resend_request_communication_errors was too narrow
Didn't match Marlin's "checksum mismatch", only Repetier's "checksum
error". Since the error handler checks against
recoverable_communication_errors before
resend_request_communication_errors, we can just switch back to the more
broader check against "checksum" for the latter.

We could also have added an explicit check for "checksum mismatch"
instead but since we used to check for "checksum" and we don't know what
other varieties for this specific error might be out there in the
thousands of firmware variants (who needs consistency when they can
have a free for all?), we'll err on the side of caution instead.

Fixes #2262
2017-12-04 11:10:06 +01:00
Gina Häußge f72dfb48e1 Fix ordering of plugin assets
Should be alphabetical per their identifier. As noticed by @BillyBlaze
2017-12-01 18:16:44 +01:00
Gina Häußge e064400900 Link to blacklist in wizard & settings
As suggested by @Kunsi in #2256
2017-12-01 17:47:16 +01:00
Gina Häußge eb5a3d1d36 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/static/js/app/main.js
2017-12-01 16:10:12 +01:00
Gina Häußge 03d24ff3b9 maintenance is now 1.3.7.dev 2017-12-01 16:07:50 +01:00
Gina Häußge 107954021b staging is 1.3.6rc2.dev 2017-12-01 16:05:06 +01:00
Gina Häußge 99e1c3ac00 Remove branch from display version
It's no longer reliable since the Github archive export we'll now
usually use for upgrading does weird things when a tag is available on
more than one branch and we don't want our current stable version to
be reported as "rc/devel" just because that tag is available there too.

A full blown version number should be definitive enough considering that
if it's not a tag it will also contain the commit hash.
2017-12-01 12:48:33 +01:00
Gina Häußge 2ea8981a48 Preparing release of 1.3.6rc1 2017-12-01 12:14:52 +01:00
Gina Häußge d1f54b5a22 More error resilience 2017-12-01 11:16:16 +01:00
Gina Häußge 1c55a12207 New link 2017-12-01 11:15:56 +01:00
Gina Häußge 58dba3a79a Update german translation
And remove some translatable text from the about dialog template of the
OctoPi support plugin.
2017-11-30 18:16:40 +01:00
Gina Häußge e9d17f0f0f Docs: Include config options for plugin blacklist 2017-11-30 17:27:14 +01:00
Gina Häußge 4ea76f84c5 Fix log roll over logging 2017-11-30 17:26:44 +01:00
Gina Häußge ac345daba2 Don't output pi model & serial in about dialog
Too public for this kind of information after all. The OctoPi version is
enough info.
2017-11-30 17:25:27 +01:00
Gina Häußge 3cf694a333 Also update hash on tab change
Related to #203
2017-11-30 12:50:05 +01:00
Gina Häußge 26c8c5f03f Don't fire onAfterTab twice & check tab's there
Related to #203
2017-11-30 12:49:55 +01:00
Marc Hannappel f2bd5d605e Added active tab using hash from URL feature, as requested in issue #203
(cherry picked from commit bcb74d0)
2017-11-30 12:29:37 +01:00
Gina Häußge 0560e9da02 Disable distance buttons when printing
Closes #2232
2017-11-29 19:32:06 +01:00
Gina Häußge cec8d15b46 Some additions to the docs
* Note that api/job is what you want for info about the selected file
    as promised in #2251
  * Added pause/resume script from
    https://gist.github.com/foosel/1c09e269b1c0bb7a471c20eef50c8d3e
    as example to the gcode scripts section (with disclaimer)
2017-11-29 19:31:56 +01:00
Gina Häußge 38c9840e30 Add note to printer profile editor about offsets
We don't need to define them in the firmware AND in OctoPrint. If they
are already set in firmware we'll otherwise get wonky issues in the
GCODE viewer or when slicing.

Closes #2229
2017-11-29 19:00:00 +01:00
Gina Häußge f77e49be7f Use new ChainedHunk for JsPluginBundle 2017-11-29 18:53:38 +01:00
Gina Häußge d465f23309 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/plugins/corewizard/__init__.py
#	src/octoprint/plugins/discovery/__init__.py
#	src/octoprint/plugins/pluginmanager/__init__.py
2017-11-29 18:19:08 +01:00
Gina Häußge 00cb71898a Some rewording and icons on final wizard page 2017-11-29 18:15:41 +01:00
Gina Häußge 328c08b775 Wrap all plugin's JS assets into same IIFE
As discussed in #2200.

For this to work we've introduced sub-bundles per plugin for the JS
assets. CSS and LESS on the other hand are basically handled as before.
We use a custom bundle class here since it's apparently not possible to
keep a sub bundle from inheriting the parent's filters, thus not
allowing us something like

  packed_plugins [js_plugin_delimiter_bundler]
    packed_plugin_a [js_delimiter_bundler]
    packed_plugin_b [js_delimiter_bundler]
    ...

The individiual bundles per plugin would inherit
js_plugin_delimiter_bundler and we'd get a double wrapper - not helpful.

Instead we now have a modified JsPluginBundle that overwrites
Bundle._merge_and_apply to further wrap the returned hunk.
2017-11-29 17:28:30 +01:00
Gina Häußge ca7aa322c3 Some cleanup, refactoring & docs 2017-11-29 15:55:33 +01:00
Gina Häußge 5c20e264e2 Feature flag to enable legacy plugin assets
Work around issues like #2246 until the plugins that are affected are
fixed.

To be removed in 1.3.8.

See also #2200
2017-11-29 15:55:09 +01:00
Gina Häußge 987a6b3cf8 PLUGIN_SOFTWAREUPDATE_ACCESS is no longer used 2017-11-28 16:49:22 +01:00
Gina Häußge 6b3d68f9aa Backwards compatibility for user_permission 2017-11-28 16:25:03 +01:00
Gina Häußge fcd34265c8 Fix empty active checkbox 2017-11-28 13:21:20 +01:00
Gina Häußge 088b0cf1e7 Merge branch 'devel' into dev/permission
# Conflicts:
#	src/octoprint/server/__init__.py
#	src/octoprint/server/api/__init__.py
#	src/octoprint/server/util/flask.py
2017-11-28 13:19:54 +01:00
Gina Häußge e6061fdd9c Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/util/flask.py
2017-11-28 13:08:34 +01:00
Gina Häußge aa65671ac7 Always check active flag 2017-11-28 13:05:28 +01:00
Gina Häußge cf8a30cc4e Reordering: Put settings related things together 2017-11-28 12:20:14 +01:00
Gina Häußge 6ba1e10b8b Fix API key generation 2017-11-28 12:14:30 +01:00
Gina Häußge 2a96864c07 Merge branch 'devel' into dev/permission
# Conflicts:
#	src/octoprint/templates/dialogs/settings/accesscontrol.jinja2
2017-11-28 12:07:39 +01:00
Gina Häußge 14bd0632c0 parse_requirements => Requirement.parse
Since we only ever handle one requirement here, the parse_requirements
generator (which btw needs a next m() is not the best choice.

Also extracted install command cleanup into class method and added tests
for that.

cc @markwal
2017-11-28 12:02:43 +01:00
Gina Häußge 48fceac0fe Merge branch 'maintenance' into devel 2017-11-27 17:27:30 +01:00
Gina Häußge d174d7ab80 Temporary fix for #2246 until #2200 is solved 2017-11-27 17:24:40 +01:00
Gina Häußge a2d38016ec Fix some corner cases of print time formatting
Closes #2242
2017-11-27 12:38:13 +01:00
Gina Häußge cf25291dee Mark readonly fields readonly instead of disabled
Further fix for FF issues with disabled input fields as tracked in
#2056 and #2196.
2017-11-27 12:23:20 +01:00
Gina Häußge ad246deb9e Merge branch 'maintenance' into devel 2017-11-24 14:05:41 +01:00
Gina Häußge 6d4f8266cd Fix message for synchronous system commands
We managed to swap those m(
2017-11-24 13:46:38 +01:00
Gina Häußge 991dab58d5 Remove experimental extension tree caching 2017-11-24 13:20:50 +01:00
Gina Häußge 0de0e4ea9b Handling of non gcode SD file transfers
No guarantees however that transporting anything BUT gcode via the usual
M28/M29 interface will even remotely work. Note that it most likely
won't work if the transferred file contains an M29 (= end transfer),
just like with transferred GCODE files.

Also note that stuff like config files or some such that might be
transferred might contain lines that are too large to fit into the
buffer of the printer. This is really just to enable plugins to maybe do
some nifty stuff, no official support of streaming arbitrary files to
the printer's SD (for that we'd need WAY more firmware support first).

See jneilliii/OctoPrint-SmoothiewareConfig#1
2017-11-24 13:11:23 +01:00
Gina Häußge 9b3c1947d9 Limit SD transfers to broader machinecode type
See jneilliii/OctoPrint-SmoothiewareConfig#1
2017-11-24 13:08:10 +01:00
Gina Häußge 364d692db2 Support leaf merging for file extension tree
This allows us to add new extensions to existing entries (e.g. a new
extension for gcode files)
2017-11-24 13:07:16 +01:00
Gregers Gram Rygg b002e41a00 Respond with 411 Length Required when missing 2017-11-24 11:32:07 +01:00
Gina Häußge f3080daa47 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2017-11-24 11:31:44 +01:00
Gina Häußge 06ab173b21 Merge pull request #2239 from alex-gh/faster_checksum
Improve the checksumming speed.
2017-11-24 11:27:06 +01:00
Gina Häußge 26789a2bb7 CPU frequency might be reported as None
Don't die when that's the case.
2017-11-24 11:26:27 +01:00
Gina Häußge 4a5308b4ab Fix plugin detection only finding one plugin
We actually should iterate over ALL of the generator, not just its first
entry m)
2017-11-24 10:51:14 +01:00
Gina Häußge c2509fad9c Add icon to add printer profile/add cura profile
To consolidate with access control buttons.
2017-11-23 19:09:45 +01:00
Gina Häußge eeb216e08d More work on the permissions
* 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.
2017-11-23 19:09:14 +01:00
Gina Häußge 2761608c1e Refactor user list to better fit user details
Also fix default group pre fill in user add dialog.
2017-11-23 15:59:04 +01:00
alex-gh f4eb60dc6a Improved the checksumming speed by a factor of 1.4-3.4 2017-11-23 14:04:31 +01:00
Gina Häußge a0a8d641c3 Merge branch 'doc/SuseLinuxInstallation' of https://github.com/caikn/OctoPrint into maintenance 2017-11-23 10:41:11 +01:00
Gina Häußge 27536388f2 Refactor access control settings
Also fix some issues that were left over from/introduced by earlier
commits.
2017-11-22 19:28:07 +01:00
Gina Häußge 21c8bd54f5 __hash__ and __eq__ for OctoPrintPermission 2017-11-22 15:31:17 +01:00
Gina Häußge fa5619fad7 Fix group permission propagation
Also refactored some bits
2017-11-22 15:28:58 +01:00
caikn e32f469de4 fix typo 2017-11-22 14:04:32 +00:00
caikn 8bc99f928c add installation doc for SLES 2017-11-22 12:52:48 +00:00
Gina Häußge 6221175649 Add note about how to run test suite 2017-11-22 13:19:24 +01:00
Gina Häußge b252da477c Virtual printer: allow empty/None prepared oks 2017-11-22 12:49:58 +01:00
Gina Häußge 022c59a094 Fix unit tests again 2017-11-21 14:36:30 +01:00
Gina Häußge bc8abdfc62 First throw at securing the socket & propagating user changes
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
2017-11-21 14:24:17 +01:00
Gina Häußge d8cffc4b22 Merge branch 'devel' into dev/permission
# Conflicts:
#	src/octoprint/plugins/announcements/static/js/announcements.js
#	src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
#	src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
#	src/octoprint/server/__init__.py
#	src/octoprint/static/css/octoprint.css
#	src/octoprint/static/js/app/viewmodels/connection.js
#	src/octoprint/static/js/app/viewmodels/control.js
#	src/octoprint/static/js/app/viewmodels/files.js
#	src/octoprint/static/js/app/viewmodels/gcode.js
#	src/octoprint/static/js/app/viewmodels/log.js
#	src/octoprint/static/js/app/viewmodels/loginstate.js
#	src/octoprint/static/js/app/viewmodels/navigation.js
#	src/octoprint/static/js/app/viewmodels/printerprofiles.js
#	src/octoprint/static/js/app/viewmodels/printerstate.js
#	src/octoprint/static/js/app/viewmodels/settings.js
#	src/octoprint/static/js/app/viewmodels/temperature.js
#	src/octoprint/static/js/app/viewmodels/terminal.js
#	src/octoprint/static/js/app/viewmodels/timelapse.js
#	src/octoprint/static/js/app/viewmodels/users.js
2017-11-21 11:42:28 +01:00
Gina Häußge 312760f86a flask.ext.babel => flask_babel 2017-11-21 11:33:55 +01:00
Gina Häußge 5ea22c602c Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/plugins/announcements/__init__.py
#	src/octoprint/server/util/tornado.py
2017-11-21 10:30:38 +01:00
Gina Häußge 8a977e8777 Some long overdue == vs === view model cleanup 2017-11-21 10:18:46 +01:00
Gina Häußge 65753a0539 Convert to new viewmodel declaration
We've been supporting the new object based view model declaration
format since 1.3.0, time to move the bundled view models towards
actually using it.
2017-11-21 10:17:52 +01:00
Gina Häußge f1518e6fe6 Use octoprint.__version__ instead of more convuluted option 2017-11-20 18:08:05 +01:00
Gina Häußge c7e248b142 Fix handling of "missing line number" errors
We so far assumed that a resend request would follow that. Alas, it
won't and we'll simply get stuck due to a missing ack from the printer.
So let's simulate that here to keep things flowing.

Fixes #2226
2017-11-20 18:07:15 +01:00
Gina Häußge 59ca2188d9 Fix resend simulating & add trigger_missing_lineno
* we now don't send the triggered resend/comm errors out of band but
    instead as a response to the next received actual line - that
    prevents us from getting out of sync
  * new trigger_missing_lineno debug function to trigger a missing line
    number error _without_ a resend request for testing fix for #2226
2017-11-20 17:57:00 +01:00
Gina Häußge 7540aa6b72 No longer require API keys for anonymous access
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
2017-11-17 15:57:45 +01:00
Gina Häußge c479c5455c Don't log request on uncaught errors in tornado
Might leak information if logs are shared. Still stick to the old
logging verbosity however if running in debug mode.
2017-11-17 12:06:17 +01:00
Gina Häußge 84cc89832b Docs: Adapt web ui startup diagram 2017-11-14 17:36:53 +01:00
Gina Häußge 9554079e4b Slight refactoring of CoreUI init order
We must not fire the StartupComplete callback before we've signaled that
we are done loading the UI in the UiStateViewModel.
2017-11-14 16:49:43 +01:00
Gina Häußge 481faf8da1 Fix graph initialization
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.
2017-11-14 16:49:42 +01:00
Gina Häußge fd6c7cd48f Make needlogin only become true after loading finishes 2017-11-14 16:49:36 +01:00
Gina Häußge 9441ea572d Return anonymous user object on API
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.
2017-11-14 16:45:35 +01:00
Gina Häußge 0414e4a6a6 Fix a binding 2017-11-14 16:42:40 +01:00
Gina Häußge ebfc6f2f26 More dynamic detection of plugin mixins
Instead of hardcoding a list of supported mixins, we now instead define
a base class (or a list thereof) from which mixins might inherit and use
inspection to determine the set of mixins each plugin implementation
implements. Not only will that reduce the risk of forgetting to add a
new mixin to the whitelist, but it will also allow mixins defined by
plugins.
2017-11-13 16:01:37 +01:00
Gina Häußge 0b1db60d8b Easier copying of terminal contents 2017-11-13 14:10:54 +01:00
Gina Häußge f9c738541f Workaround: temperature select not working in Edge
As suggested by @Mikk36 in #2214.

Closes #2214.
2017-11-13 13:51:27 +01:00
Gina Häußge 6c21911eb0 Merge pull request #2217 from Depaulicious/patch-1
Fix __future__ import in util
2017-11-13 10:09:24 +01:00
Davide Depau fd7fdec565 Fix __future__ import in util
This syntax is accepted by CPython, but it doesn't work on PyPy.
2017-11-12 17:17:08 +01:00
Gina Häußge b892b43ee1 Plugin metadata for OctoPi Support plugin & fix 2017-11-10 19:14:33 +01:00
Gina Häußge 14c1dfe9a3 New command "octoprint config effective" 2017-11-10 19:08:24 +01:00
Gina Häußge 1180e4e27b Fix & extend environment detection on Pi 2017-11-10 18:27:52 +01:00
Gina Häußge b2d70de144 Environment detection & logging on startup
Incl. OctoPi version & RPi model through bundled plugin that only
gets loaded if OctoPi is detected.
2017-11-10 17:32:59 +01:00
Gina Häußge 0bb343e1d3 Sort timelapses by mtime instead of ctime
Otherwise we get bad sorting after copying over the files from another
instance (e.g. after backup/restore as described on the wiki).
2017-11-10 13:25:16 +01:00
Gina Häußge 92b048c789 Reset temperature data on disconnect 2017-11-10 13:03:36 +01:00
Gina Häußge a6eac3911b Reset temperature offsets on disconnect
Fixes #2203
2017-11-10 12:40:58 +01:00
Gina Häußge 80bc82df55 Protect against broken packages in python env
As seen in https://groups.google.com/forum/#!msg/octoprint/DyXdqhR0U7c/kKMUsMmIBgAJ
a broken entry_points.txt in some arbitrary Python package installed in
the same python envrionment as OctoPrint can make our whole plugin
detection fail and hence interrupt regular server startup.

This adds better protection against such cases.
2017-11-10 11:14:50 +01:00
Gina Häußge 651a8f315b Strip query params from displayed link URLs
Looks to chaotic otherwise.
2017-11-10 10:50:25 +01:00
Gina Häußge 158f14df89 Fix alignment of default marker in group list
Also slightly change wording of columns ("Group" is kinda redundant)
2017-11-09 19:07:58 +01:00
Gina Häußge 93a80fe256 Have group actions mirror group flags in UI
Disable edit action for unchangeable groups, disable remove action for
unremovable groups.
2017-11-09 19:02:47 +01:00
Gina Häußge 398e10588c Slight changes in permission resolution
* 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.
2017-11-09 18:54:51 +01:00
Gina Häußge 6d1f610085 Full page loading and login screens 2017-11-09 14:14:13 +01:00
Gina Häußge bd95dad85e Move permissions into JS init script & socket
No need for an AJAX request that might produce a race condition.
2017-11-09 12:08:03 +01:00
Gina Häußge bf8301bd6a Fix CombinedPermission creation from plugins 2017-11-09 11:41:58 +01:00
Gina Häußge 231006ab26 Fix ApiUser creation for key 2017-11-09 11:18:12 +01:00
Gina Häußge 69f9c523f9 Add utm tags to announcement links 2017-11-09 10:49:39 +01:00
Gina Häußge 2364474ea6 Docs: Fix language on code-block & indentation 2017-11-08 18:10:37 +01:00
Gina Häußge 00067768da Docs: PyCharm run config with dependency update 2017-11-08 18:08:06 +01:00
Gina Häußge 744f4d0f42 Require CONNECTION permission for connection panel 2017-11-08 16:24:59 +01:00
Gina Häußge ad269751b8 Require PRINT permission for print/pause/cancel 2017-11-08 16:22:12 +01:00
Gina Häußge 4c77f07bc9 Default guest permissions mirror prior versions 2017-11-08 16:18:14 +01:00
Gina Häußge e974cb8ec5 Refactored (Permissions|Group|User)Manager
* 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
2017-11-08 15:59:31 +01:00
Gina Häußge 48c02e1018 Backwards compatibility for user.roles
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.
2017-11-07 12:56:29 +01:00
Gina Häußge 3ef97bf4d7 Update psutil version 2017-11-06 17:09:16 +01:00
Gina Häußge 5aad696c5c Do not enable timelapse if settings are missing
If snapshot url and/or ffmpeg path are not set, the timelapse cannot
work regardless of what type has been configured.

So if the current configuration still contains a timelapse type other
than "off" but snapshot url or ffmpeg path are unset, force a disabled
timelapse.

Fixes #2206
2017-11-06 12:24:19 +01:00
Gina Häußge 9837f67140 Small adjustments in webasset filters
* Add comment with source file to JsDelimiterBundler and
    JsPluginDelimiterBundler
  * Include source file name in JsPluginDelimiterBundler catch
    block and use log.error instead of console.error
2017-11-06 11:39:11 +01:00
Josh Major dc53942015 Added plugin Javascript isolation 2017-11-04 10:08:04 -05:00
Gina Häußge 79581c390a Prefer plain pip over git for updating OctoPrint
At least unless we've selected git based tracking over release tracking.

This should greatly reduce the likelihood of not being able to update
due to some git repository corruption issues, as has happened to some
people in the past.
2017-11-03 16:31:21 +01:00
Gina Häußge c30e54d75c Slight rewording/typo correction 2017-11-03 14:55:55 +01:00
Gina Häußge 55adb7ca33 Support sub codes for auto upper casing too
If either the full code or just the main code are blacklisted, only
upper case the code. Otherwise also upper case the parameter list.

In any case push originally entered command to history, not the
modified one.
2017-11-03 14:48:45 +01:00
Gina Häußge 980b72607e Update AUTHORS.md
Fixed one entry and added @pbackx
2017-11-03 12:57:33 +01:00
Peter Backx ce16f861b3 Implemented @foosel's suggestions + made the blacklist settings actually work [#1026]
(cherry picked from commit 1857f07)
2017-11-03 12:44:25 +01:00
Ishwar Agarwal 51406b7c42 Auto uppercase Gcode except commands in configurable blacklist
Added new config setting: auto uppercase blacklist that is configurable
in the advanced option of the serial tab, with M117 included in the
default settings of the blacklist. Changed the sendCommand method in the
TerminalViewModel to auto uppercase the entire gcode command except when
gcode is in the blacklist. Updated documentation to include the default
auto uppercase blacklist command M117.

Resolves: #1026

(cherry picked from commit dbf7af1)
2017-11-03 12:44:05 +01:00
Gina Häußge 2fcbf49348 Docs: Some small changes as followup to #2176 2017-11-03 11:33:47 +01:00
Gina Häußge 5f34d5df27 Docs: Update mermaid to fix deprecation warning 2017-11-03 11:31:15 +01:00
Peter Backx a0df4e78b5 Fixing Sphinx warnings during doc generation 2017-11-03 11:11:52 +01:00
Gina Häußge f398ee90b0 Fix a merge error
And while at it also introduce groups and permission manager factories,
just like for the user manager.
2017-11-02 17:59:54 +01:00
Gina Häußge 23fcdc0365 Refactor SettingsPlugin.on_settings_load
Use current_user.has_permission instead of current_user.is_admin.
2017-11-02 16:38:27 +01:00
Gina Häußge e91da1cd8d include_doc => includedoc 2017-11-02 15:02:25 +01:00
Gina Häußge 4e0d3725cb Refactor someName => some_name in access classes 2017-11-02 14:30:35 +01:00
Gina Häußge f45cb1560f Fix SessionUserTestCase 2017-11-02 14:14:57 +01:00
Gina Häußge 7214b9f2c2 Fix (dis)connect button 2017-11-02 12:48:48 +01:00
Gina Häußge 37990996b7 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/util/flask.py
2017-11-02 11:12:22 +01:00
Gina Häußge 772ee76e76 More hardening against invalid requests
See #2189
2017-11-02 09:36:53 +01:00
Marc Hannappel 024b58097e Check the connection sidebar a litte bit more, if the Connection permission is not granted, but the status permission is, one will be able to view the current settings, but not change them. 2017-11-02 09:23:07 +01:00
Marc Hannappel 2cc1fe7fe2 Fix a merge mistake 2017-11-02 09:21:23 +01:00
Marc Hannappel e0cd48df92 Fix a wrong _.all to _.any 2017-11-02 09:21:00 +01:00
Marc Hannappel d45d2f5123 Merge branch 'maintenance' of github.com:foosel/OctoPrint into dev/permission 2017-11-02 08:33:32 +01:00
Gina Häußge 532ac0264d Force https index URL in requirements.txt
Also an additional measure against #2193
2017-11-01 16:15:18 +01:00
Gina Häußge caaaa2e4e9 Fix temperature autoreport after external reset
We didn't reset the capability flag and also didn't resend M155. Now we
do at least the latter if we detected that the printer supports
temperature auto reporting earlier.
2017-10-30 12:59:43 +01:00
Gina Häußge 02aad445aa Hardening against system.actions = null
See #2187
2017-10-30 12:36:09 +01:00
Marc Hannappel eb5e2c94a3 Fix a misalignment problem with the temperature graph 2017-10-27 15:19:41 +02:00
Marc Hannappel ced74f5b45 Some minor fixes 2017-10-27 15:18:51 +02:00
Marc Hannappel 01e557a689 Merge branch 'maintenance' of github.com:foosel/OctoPrint into dev/permission 2017-10-27 14:24:30 +02:00
Gina Häußge b8b01558ce Merge branch 'maintenance' into devel 2017-10-27 14:24:21 +02:00
Gina Häußge bf7d4173cd Fix auto-adjust of temperature y axis
Thanks @Salandora for the heads-up
2017-10-27 14:22:03 +02:00
Gina Häußge 0ff0da4a7b Merge pull request #2182 from kantlivelong/invalid_tool_temp_fix
Handle non-[existent/functioning] tools
2017-10-27 13:48:41 +02:00
Marc Hannappel 08c90e0909 Merge branch 'maintenance' of github.com:foosel/OctoPrint into dev/permission 2017-10-27 09:11:26 +02:00
Shawn Bruce b2552795dc Set tools actual/target to 0 if they dont exist. 2017-10-26 13:12:38 -04:00
Shawn Bruce 4b5eff5ec6 Don't set target temp for tools that do not exist. 2017-10-26 12:42:55 -04:00
Gina Häußge bedcbb80be Set a minimum delay of 1s between snapshots
Followup to #2067
2017-10-26 16:38:40 +02:00
Gina Häußge 09509ca61d Refactor timelapse form & add reset button 2017-10-26 16:33:00 +02:00
Gina Häußge 8bf3f4ff50 Rate limit snapshots on for z-timelapses
This is to prevent against an endless stream of snapshots when
accidentally printing a vase mode file despite the warning.

As mentioned in #2067
2017-10-26 16:03:54 +02:00
Gina Häußge 2d925a2665 Synced with setup.py 2017-10-26 14:56:57 +02:00
Gina Häußge 490ef61e19 If serial.log is disabled, log how to enable it
That will hopefully help a bit against the endless stream of "serial
.log was empty" statements on the bug tracker. Or not. Here's hope.
2017-10-26 13:13:21 +02:00
Gina Häußge a1548e1c1d Fix issue in M115 parser
If FIRMWARE_NAME is not there, but NAME is neither, we'd run into an
exception due to the Malyan detection. Not anymore.

Fixes #2181
2017-10-26 13:12:09 +02:00
Gina Häußge 77e48335da Virtual printer: support config of reset lines
Also updated config docs accordingly.
2017-10-26 13:10:54 +02:00
Gina Häußge 14b8fd7fa5 Only send "deactivated" status if password matches 2017-10-25 17:30:56 +02:00
Gina Häußge 0afa854763 Support a centralized plugin blacklist (opt-in)
A centralized plugin blacklist read from plugins.octoprint.org on server
start now allows us to stop plugins from being loaded that are known to
cause severe issues with OctoPrint's regular operation.

Blacklist entries can be restricted for specific plugin versions &
OctoPrint versions, allowing for very granular control of any kind of
blocking.

Additionally users may disable blacklist processing in general (an
opt-in wizard and a new section in the settings have been added) and
at server start via the new --ignore-blacklist parameter available for
"octoprint serve" and "octoprint daemon".

If a plugin is blacklisted, OctoPrint will not even import the
plugin module in question (if only a plugin key is specified OR a key
and a version and the plugin's version is already known during import
time, which is the case for plugins loaded from entry points) or at the
very least stop the plugin from being enabled (if a plugin key and a
version is specified and the plugin's version is only known after
loading, which is the case for plugins loaded from directories).
2017-10-25 17:29:00 +02:00
Marc Hannappel 052408982a Revert "Some Changed to the temperature.js file"
This reverts commit ce2463588d.
2017-10-25 15:11:53 +02:00
Marc Hannappel 68c57cc4eb Merge branch 'maintenance' of github.com:foosel/OctoPrint into dev/permission 2017-10-25 14:43:38 +02:00
Marc Hannappel 3d1f3be4fc Make sure that deactivated Users can't login 2017-10-25 14:40:49 +02:00
Marc Hannappel 9eb4f3f843 Forgot to remove <<<<<< HEAD 2017-10-25 11:22:30 +02:00
Marc Hannappel 4ad7b38648 Changed a few == to === in temperature.js 2017-10-25 11:20:37 +02:00
Marc Hannappel ce2463588d Some Changed to the temperature.js file 2017-10-25 11:17:51 +02:00
Marc Hannappel 9804e3eca0 Merge branch 'devel' of github.com:foosel/OctoPrint into dev/permission 2017-10-25 11:10:58 +02:00
Gina Häußge e9fb3a3ebb Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/server/util/__init__.py
2017-10-25 09:32:38 +02:00
Marc Hannappel b65b97870f Remove a unnecessary function of the new permission system 2017-10-25 09:13:07 +02:00
Marc Hannappel 0c243e0dc2 Changed a few == to === 2017-10-25 09:12:24 +02:00
Marc Hannappel d88b1fbec0 Merge branch 'devel' of github.com:foosel/OctoPrint into dev/permission 2017-10-25 09:11:13 +02:00
Gina Häußge 38c410f80f New sub command "octoprint safemode"
Sets server.startOnceInSafeMode flag to true. Probably easier for a lot
of people than editing a config file or running OctoPrint manually from
command line, in case the built-in "Restart in safe mode" system command
is not an option.
2017-10-24 13:23:10 +02:00
Gina Häußge 46bd2ce7e9 Fix "octoprint config" sub command 2017-10-24 12:31:44 +02:00
Gina Häußge 10fc631700 More error resilience against broken view models
We so far only protected the binding process itself against errors
triggered inside view models. Now we are also more resilient against
issues arising in view model callbacks like onBeforeBinding,
onBoundTo and onAfterBinding as well as exceptions during plugin
instantiation itself.

Triggered by jneilliii/OctoPrint-TPLinkSmartplug#19 which was also
reported on OctoPrint's tracker as #2168, #2170 and #2171 and on OctoPi
as guysoft/OctoPi#427.
2017-10-24 10:37:25 +02:00
Gina Häußge 8f78784be3 Add safety warning to first run wizard
There are too many printers out there with crappy electronics that are
just waiting to go up in smoke, and people keep leaving those alone
because "they are monitoring them via OctoPrint, so nothing can happen".
So let's add a safety warning, in the hopes that will bring at least
some people to their senses or at the very least force them into making
the conscious decision to blow all warnings into the wind.
2017-10-23 18:41:42 +02:00
Gina Häußge 4479dd0222 Fix API key copy function in user list
Was firing on page load instead of only when clicked m(
2017-10-23 15:42:17 +02:00
Gina Häußge 9466e5d001 Some cleanup and renaming 2017-10-23 13:51:00 +02:00
Gina Häußge 4b3d883639 Don't evaluate onWebcamLoaded more than once
Firefox for some reason keeps triggering the event and we don't want to
do unnecessary work on each trigger (and flood the log with debug
statements).
2017-10-23 13:51:00 +02:00
Gina Häußge 4439f5aad0 Workaround for a Firefox bug
Firefox doesn't trigger dragleave if the mouse leaves the browser
window to another window on top during an active drag. That leaves
OctoPrint stuck with the drag-n-drop overlay.

Adding a timeout for dragover for only Firefox that clears the overlay
solves this issue.

Solves #2166
2017-10-23 13:51:00 +02:00
Gina Häußge cb50646134 Merge pull request #2163 from jcbelanger/patch-1
Use valid css instead of less for example
2017-10-23 11:14:57 +02:00
Marc Hannappel 0781cb1d41 Add a confirmation dialog to the delete request of a group. 2017-10-23 11:11:47 +02:00
Marc Hannappel eb2ed341a2 Fixeda bug where the group description was not sent to the server side, which caused an exception while creating a group. 2017-10-23 11:11:06 +02:00
Marc Hannappel e5f6824304 Redo the Migration part from old role system to new permission System 2017-10-23 11:08:32 +02:00
Gina Häußge c8e5820c7d Change wording of a tooltip
Closes #2167
2017-10-23 11:02:39 +02:00
Joshua Belanger 8e03dbfa14 Use valid css instead of less for example 2017-10-20 23:06:32 -04:00
Gina Häußge 8372b1f433 Merge branch 'master' into maintenance 2017-10-20 20:13:46 +02:00
Joshua Belanger b6cf895c56 Update gettingstarted.rst 2017-10-20 20:10:13 +02:00
Gina Häußge 25e05418d8 Upped version of requests and cookiecutter
Fixes #2160
2017-10-20 20:06:49 +02:00
Gina Häußge 2e134ba8b0 Merge pull request #2162 from jcbelanger/patch-1
Update gettingstarted.rst
2017-10-20 20:02:01 +02:00
Joshua Belanger 76f4ffc0a1 Update gettingstarted.rst 2017-10-20 13:54:11 -04:00
Gina Häußge 21cc58ad14 GCO viewer: Persist options to localStorage
See #443
2017-10-20 19:34:39 +02:00
Gina Häußge b65a3bb903 GCO viewer: Add advanced options
Allow user toggling of sortLayers and hideEmptyLayers.

As suggested in #1973
2017-10-20 19:24:33 +02:00
Gina Häußge e49adcac85 GCO viewer: Fix error on empty layers 2017-10-20 19:22:39 +02:00
Gina Häußge 813c2be35a docs: Fix line numbered listings
Numbers didn't match up with content due to inconsistent line height.
2017-10-19 13:38:43 +02:00
Gina Häußge 3ad4b7b0a5 Fix Sphinx theme for local builds 2017-10-19 13:15:45 +02:00
Gina Häußge e7b455f880 New hook octoprint.accesscontrol.keyvalidator
Allows plugins to provide their own API keys which then can be
validated/translated into a User instance via this hook.
2017-10-19 13:15:18 +02:00
Gina Häußge a9819cc2f9 b/h5 => strong on new reset warnings 2017-10-18 17:19:45 +02:00
Gina Häußge 0b95894da1 Test button for online connectivity check
As suggested by @ntoff.
2017-10-18 17:12:21 +02:00
Gina Häußge 9c3d7bbbc3 New server subcommand on test API
Tests if a host/port combination is reachable via server_reachable.
2017-10-18 17:11:22 +02:00
Gina Häußge 01b3b8a0e0 Make first slicing profile the default
We also reflect that in the Cura profile import dialog by checking and
disabling modification of the corresponding checkbox if no profiles are
yet available.
2017-10-18 16:01:48 +02:00
Gina Häußge 50983c8524 Fix initial size of temperature graph
Plot area was wrongly sized due to (invisible) X axis tick labels.

We now initialize an empty plot to min/max timestamps of "now" to
circumvent this. Additionally plot was not properly initialized on
initial load of page due to onAfterTabChange not firing for the first
tab.

Also added a bit for tick labels.
2017-10-18 12:39:38 +02:00
Gina Häußge e99f762974 Cura Plugin: Less "not configured yet" logging 2017-10-17 18:59:40 +02:00
Gina Häußge 468155c9c8 Fix cache invalidation on slicing API
Wasn't properly revalidating when an already registered slicer switched
between unconfigured and configured.

Also adjusted data format version tracking on files and slicing API to
match.
2017-10-17 18:59:05 +02:00
Gina Häußge 880124bbe0 Merge branch 'maintenance' into devel 2017-10-17 11:07:02 +02:00
Gina Häußge 7df78defb1 Make data version part of etag
We might add fields to things like file entries (e.g. "display") and in
such cases want to refetch the list even if the files itself didn't
change, to make sure those new fields are available to the clients.

See https://github.com/foosel/OctoPrint/issues/2111#issuecomment-337164940
2017-10-17 11:05:43 +02:00
Gina Häußge b719fd1c15 Merge branch 'maintenance' into devel 2017-10-16 16:21:14 +02:00
Gina Häußge d0aa81c977 Merge branch 'staging/maintenance' into maintenance 2017-10-16 16:21:00 +02:00
Gina Häußge 13de4b4b1d staging/maintenance is now 1.3.6rc1.dev 2017-10-16 16:20:43 +02:00
Gina Häußge 4fba88d197 Merge branch 'rc/maintenance' into staging/maintenance 2017-10-16 16:09:14 +02:00
Gina Häußge 77753ca026 Preparing release of 1.3.5 2017-10-16 13:21:27 +02:00
Gina Häußge fd53f47f86 Wider scrollbars & no fade out
Increased scrollbar width of file list and plugin repository list to
10px (from 5px). Fixed scroll bar hiding itself on initialization due to
alwaysVisible not properly persisting the initial binding.

Enhance knockout binding syntax for slimScrolledForeach: slimscroll
initialization parameters may now be provided during data binding via
the additional slimscroll property accepted as part of the extended
foreach syntax, e.g.

slimScrolledForEach: {data: ..., slimscroll: {alwaysVisible: true, ...}}

Implements #2111
2017-10-13 17:52:54 +02:00
Gina Häußge af4f97f2df Updated slimscroll.js to version 1.3.8 2017-10-13 17:52:54 +02:00
Gina Häußge 44f5916cd4 Faster animation speed & close on PNotify 2017-10-13 17:52:54 +02:00
Gina Häußge 4e80d69e51 SWU: Always auto-hide up-to-date info
See #2042
2017-10-13 17:52:54 +02:00
Gina Häußge 020180a4a7 Merge pull request #2152 from ntoff/improve/auto-update-warn-sd-interupt
Add print interruption warning to auto update dialog
2017-10-13 11:49:45 +02:00
ntoff a21934abba add print interruption warning to auto update dialog 2017-10-13 13:04:38 +10:00
Gina Häußge 42ac133436 Support full UTF8 file names
Files (and folders) are still slugified to ASCII for storage on disk,
but now the original filename is stored alongside in metadata.yaml
and used for display in the file list and print status.

The slicing dialog also inherits that display name for use as base
for the suggested GCODE name.

Internally, everything still depends completely on the slugified
ASCII version.

This implements #2094
2017-10-12 18:08:41 +02:00
Gina Häußge 464b431741 Merge branch 'maintenance' into devel 2017-10-11 16:28:12 +02:00
Gina Häußge 42018ae29a starts_with => startswith
Now that was embarrassing.

Fixes #2151
2017-10-11 16:27:51 +02:00
Gina Häußge 054bbd8a9b comm: no need to fetch potential ports again 2017-10-11 16:20:37 +02:00
Gina Häußge 4093995ba0 STK500v2: Retries for reading from serial
This would normally not fly at all but we give it a pass here since we
only use that module for auto detection anyhow (and probably not for
much longer since that approach is simply too error prone).

Adapted from

  https://github.com/foosel/OctoPrint/issues/2138#issuecomment-334117910

by @dtynan.

Solves #2138 until I come up with something better
2017-10-11 16:19:37 +02:00
Marc Hannappel ff0e4f50da Merge branch 'devel' of github.com:foosel/OctoPrint into dev/permission 2017-10-11 10:19:18 +02:00
Gina Häußge d1fdbd5080 More lenient check for unrendered timelapses
Only delete automatically if modification AND creation date are older
than the calculated cutoff.
2017-10-10 12:51:43 +02:00
Gina Häußge abfcc6e5aa Fix deletion of unrendered timelapses
If the filename contained a [] pair, the file would not match the glob
pattern used for selecting for deletion.

Backporting the glob.escape function from Python 3.4 and using it here
should fix that. We only use our own ported version if glob.escape
doesn't exist - that should reduce redundant code once we become Python
3 compatible.
2017-10-10 12:41:47 +02:00
Gina Häußge b89b6970c6 Fix temperature plot init if it's not the 1st tab
If the temperature graph was not on the first tab, the plot would be
initialized without being visible, causing some sizing issues and
alignment issues with the Y axis ticks.

Forcing the plot to only get initialized once visible solves these
problems.

Fixes #2147
2017-10-09 15:57:52 +02:00
Gina Häußge 40eb3c1072 Merge pull request #2146 from ntoff/improve/shutdown-serial-reset-warn
Add possible print disruption warning to shutdown dialog
2017-10-09 11:13:03 +02:00
ntoff 178131945e Add possible print distruption warning to shutdown dialog 2017-10-06 09:32:49 +10:00
Peter Backx 452ee8e156 Adding documentation for the virtual printer plugin. 2017-10-05 18:19:08 +02:00
Gina Häußge 8ba23e84ca Merge branch 'maintenance' into devel 2017-10-04 15:04:30 +02:00
Gina Häußge 807b44a35e Merge branch 'staging/maintenance' into maintenance 2017-10-04 15:02:26 +02:00
Gina Häußge f4e7ab424b staging is 1.3.5rc5.dev 2017-10-04 15:02:07 +02:00
Gina Häußge e88e6ba292 Preparing release of 1.3.5rc4 2017-10-04 13:33:46 +02:00
Gina Häußge 25c56a5402 Wizard: Force ACL sub wizard to always come first
If required.

Closes #2140
2017-10-04 11:34:06 +02:00
Marc Hannappel 4cbddf66d3 Merge branch 'maintenance' of github.com:foosel/OctoPrint into dev/permission 2017-10-04 09:55:51 +02:00
Gina Häußge c5e7212fa2 PMGR: Support VCS URLs to install from
Implements #2104
2017-10-02 17:56:38 +02:00
Gina Häußge 0f8f4579d6 Add no-op default action to login form
That way people clicking too fast on login before the view models are
bound won't be able to make the form submit username and password as GET
parameter to the base URL.

Closes #2108
2017-10-02 16:39:57 +02:00
Gina Häußge 12126621c5 Merge pull request #2044 from dforsi/fix/fix-typos
Fix typos in strings and comments
2017-09-29 16:28:33 +02:00
Gina Häußge a093dbc36f Merge pull request #2109 from mrbeam/upstream_maintenance
added decorator for calls only available on the first run.
2017-09-29 16:26:55 +02:00
Gina Häußge 0f325b95c1 Minor changes to #2123 for better readability 2017-09-29 16:18:52 +02:00
Gina Häußge 7fc0f48659 Adjust unit tests for script root in cookie suffix 2017-09-28 17:43:53 +02:00
Gina Häußge dfe345007e Updated sockjs-tornado dependency
Apparently we need 1.0.3 after all for custom session classes.

Reported by @MoonshineSG in #2095
2017-09-28 16:30:27 +02:00
Gina Häußge 4fe6e0545a Also include script name in cookie name
Otherwise we might run into trouble if we have an OctoPrint instance
running on / and /octoprint2 for example - the browser will send
cookies for both instances to the /octoprint2 instance and whatever
gets processed last will overwrite the value before in Tornado's cookie
processing. This of course will nuke the login session in case of the /
cookie being sent or processed last.

Appending the path/script root to the cookie name solves this, similar
to how we circumvented an identical problem caused by browsers not
distinguishing between ports for cookies.

Solves an issue reported by @mgrl in #2095
2017-09-28 16:23:27 +02:00
Gina Häußge c84e199e87 Add & use "octoprint analysis gcode" subcommand
That should solve any weird import issues we have when
running gcodeInterpreter.py directly (and hence putting
octoprint.util as first entry into the python path,
causing potential issues with imported modules such as
yaml to catch the octoprint.util.platform module instead
of the actual python platform module).

See reported problem with that by @CapnBry in #2095
2017-09-28 10:33:28 +02:00
Marc Hannappel 9ba9c3b9c5 Merge devel into dev/Permissions with some additions
- 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
2017-09-28 09:00:05 +02:00
Luke McKechnie 791f0457fb Fix for SharedNozzle, replicating temp from current tool to all tools. Issue # 2077 2017-09-21 09:31:33 -04:00
Teja 56ad1841d4 added decorator for before firstrun only calls. 2017-09-08 16:20:37 +02:00
Gina Häußge adbcc07bae Merge branch 'maintenance' into devel 2017-08-25 14:57:00 +02:00
Gina Häußge b161a1f093 Merge branch 'staging/maintenance' into maintenance 2017-08-25 14:56:42 +02:00
Gina Häußge 79f7a5a1e7 staging is 1.3.5rc4.dev 2017-08-25 14:56:15 +02:00
Gina Häußge 679674df22 Preparing release of 1.3.5rc3 2017-08-25 11:46:40 +02:00
Gina Häußge 5989d243d3 Fix wrapping of temperature controls on touch devices
Successfully tested in Chrome (desktop & Android), Firefox (desktop &
Android), Safari (desktop & iOS).

Closes #2059
2017-08-25 09:47:11 +02:00
Gina Häußge 97cb0088f6 Delay opening of serial.log until first message
That way we don't risk running into potential "file busy" issues
under windows on log file rollover.
2017-08-24 19:16:41 +02:00
Gina Häußge 2ed36ed383 Do not block when processing held back events! 2017-08-23 19:07:08 +02:00
Gina Häußge 12b8a54081 set_close_exec on intermediary server port for unix & windows
Using the win32 API it's possible to prevent the intermediary server
socket from inheriting itself to subprocesses. So let's use that here.

Another bit of the solution for #2090.
2017-08-23 18:31:42 +02:00
Gina Häußge a35e145649 Don't forward events to uninitialized EventPlugin implementations
Another part of fixing #2090
2017-08-23 18:19:37 +02:00
Gina Häußge f77be701a2 Only fire events once Events.STARTUP has been seen
One part of fixing #2090
2017-08-23 18:11:40 +02:00
Gina Häußge e9401b7090 Easier copying of API keys
There's now a dedicated button for that.

This should get around issues like #2056. Also increased size
of API key display field (where possible). Fixes #2055
2017-08-22 18:10:32 +02:00
Gina Häußge b138c2bccf New global JS helper copyToClipboard 2017-08-22 18:05:53 +02:00
Gina Häußge 76c2113ad4 Fix block-level input-append/input-prepend
We still had double borders going on for included add-ons.
2017-08-22 18:05:00 +02:00
Gina Häußge bfe5bc179c New hook octoprint.comm.protocol.temperatures.received
Allows preprocessing/sanitizing temperatures as received from the
printer.

Workaround for printers that occasionally report garbage temperature
data, e.g. #2050
2017-08-22 11:32:47 +02:00
Gina Häußge d7298cee06 Virtual printer: Less code duplication in temp simulation 2017-08-22 11:21:04 +02:00
Gina Häußge fbcbb3f5f7 Virtual printer: Support configurable ambient temperature 2017-08-21 16:52:38 +02:00
Gina Häußge 0c2169dd9c Removed leftover </span>
Thanks @dforsi for the heads-up.
2017-08-21 13:17:29 +02:00
Gina Häußge 7828258fdb Merge pull request #2048 from dforsi/fix/fix-rst
Fix some rst warnings
2017-08-21 12:38:20 +02:00
Daniele Forsi edb4d0fe04 Fix warnings about duplicated names in rst files
Replacing a single underscore (which creates a named target) with a double
underscore creates an anonymous target.

Fixes:
/home/daniele/OctoPrint/docs/bundledplugins/cura.rst:4: WARNING: Duplicate explicit target name: "here".
/home/daniele/OctoPrint/docs/plugins/hooks.rst:370: WARNING: Invalid caption: /home/daniele/OctoPrint/docs/plugins/hooks.rst:4: (INFO/1) Duplicate explicit target name: "custom_action_command.py".
2017-07-30 23:18:08 +02:00
Daniele Forsi 69dec6e83f Fix typos in strings and comments
Those typos were found with codespell which is available from
https://github.com/lucasdemarchi/codespell.git
2017-07-29 16:12:08 +02:00
Gina Häußge 4d27de032d Improved handling of external reset while operational
* Display message to user
  * Stop print/transfer (lost state)
2017-07-28 13:35:00 +02:00
Gina Häußge 7073c12444 Virtual printer: Support debug commands while streaming 2017-07-28 13:34:10 +02:00
Gina Häußge 60be6349f5 Allow cancelling file transfers
Cancelling also deletes the incomplete file on the printer's SD.
2017-07-28 13:08:28 +02:00
Gina Häußge ec55890c55 Check that .metadata.yaml actually contains a dict
It might just be empty (= None) or a list or something.

Thanks @Kunsi for the heads-up.
2017-07-28 12:01:36 +02:00
Marc Hannappel 83ed6a4297 Added additional Permissions in the bundled Plugins 2017-07-27 16:14:36 +02:00
Marc Hannappel 1c07974f6c Adjust the bundled Plugins to the new hasPermission functions 2017-07-27 16:11:45 +02:00
Marc Hannappel c3e430b472 Split loginState.hasPermission in hasPermission and hasPermissionKo, the ko version returns a knockout pureComputed and uses the hasPermission version, hasPermission version does the normal check and is intended to be used in functions.
Also adjust the permission checks to the splitted functions, and integrate new checks to hide elements and get rid of console errors
2017-07-27 16:04:58 +02:00
Marc Hannappel a8fef06aa8 Add ability to register combined permission to the permission manager, they will not show up in the regular permission list 2017-07-27 16:01:20 +02:00
Marc Hannappel 281eb346a5 Add a unioned permission objects, this mostly is used for the api GET methods 2017-07-27 15:55:55 +02:00
Marc Hannappel 15c8bd7d6d More bugfixes, additionally add a can() function to the PluginIdentityContextManager, and replace the dicts with OrderedDicts 2017-07-27 15:51:20 +02:00
Marc Hannappel d0d1da3456 Fix a few bugs and remove some now unnecessary functions 2017-07-27 15:26:00 +02:00
Gina Häußge 7c73ff78bc Merge branch 'maintenance' into devel 2017-07-27 14:39:14 +02:00
Gina Häußge e508898564 Merge branch 'staging/maintenance' into maintenance 2017-07-27 14:38:54 +02:00
Gina Häußge c33e9e4c85 staging is 1.3.5rc3.dev 2017-07-27 14:38:30 +02:00
Gina Häußge 1f9fe8c868 Preparing release of 1.3.5rc2 2017-07-27 13:33:45 +02:00
Gina Häußge 8f2e4ad978 Temperature tab: "Hotend" -> "Tool" 2017-07-27 12:41:08 +02:00
Gina Häußge b82d955ec7 Fix printer profile update on temperature tab & gcode viewer
As reported in #2033
2017-07-27 12:40:27 +02:00
Gina Häußge 832d2f4155 Fix temperature controls in FF not fitting on one line
Mentioned in #2033
2017-07-27 10:14:59 +02:00
Gina Häußge c336452f6c Do not run subprocesses while intermediary server is active
Any processes inheriting the open port descriptor of that server will
cause the actual server startup to fail due to the port still being
claimed.

We can't fully prevent this under Windows thanks to fnctl not being
available and win32api being a PITA, and also close_fds on Popen not
being allowed if we also need to redirect stdout/stderr/stdin for a
process. So let's hope hardening against this problem when running
under *nix, adding a bit fat warning to never start a subprocess
during the intermediary's runtime and also moving the only actual
process we so far DID start (analysis backlog processing) to after
Tornado is running will suffice.

Fixes #2035
2017-07-27 09:58:20 +02:00
Gina Häußge a9b6edde2b Fix incompatibility with non-ASCII strings in wizard sorting 2017-07-26 16:47:57 +02:00
Gina Häußge d59ef5c711 Corewizard: Fix wrongly displaying firstrunonly wizards again 2017-07-26 16:47:40 +02:00
Gina Häußge 375480c707 allViewModels -> self.allViewModels 2017-07-26 16:32:05 +02:00
Gina Häußge 60cacb9447 Temperature: Fix for legend not updating with current values
See #2033
2017-07-26 16:26:27 +02:00
Marc Hannappel e0309dc6c0 Added announcement permission to the announcement plugin 2017-07-26 14:35:30 +02:00
Gina Häußge cd6009c180 Merge branch 'maintenance' into devel
# Conflicts:
#	docs/plugins/hooks.rst
#	src/octoprint/server/__init__.py
2017-07-26 14:31:08 +02:00
Gina Häußge a21f5c4497 Merge branch 'staging/maintenance' into maintenance 2017-07-26 14:27:59 +02:00
Gina Häußge c159ab7fe2 Merge branch 'rc/maintenance' into staging/maintenance 2017-07-26 14:27:47 +02:00
Gina Häußge 251ed7a2a2 Merge branch 'staging/maintenance' into maintenance 2017-07-26 14:25:15 +02:00
Gina Häußge e949e0198f maintenance is now 1.3.6.dev, staging is 1.3.5rc2.dev 2017-07-26 14:24:30 +02:00
Marc Hannappel 29bd4e96d6 Add PluginPermissionDecorator and PluginIdentityContext to handle @Permissions.PLUGIN_X_Y.require() decorator correctly. This is necessary, because at the time of the evaluation these Permissions can't be already initialized. So I added a new PluginIdentityContext which will look for the permissions when needed and check them, if they can't be found it will raise a UnknownPermission Exception 2017-07-26 13:45:57 +02:00
Marc Hannappel 5d5ca0d7aa Fix AnonymousUser 2017-07-26 13:42:17 +02:00
Marc Hannappel e7df4b8d6d Revert permission_test, change get_session to session, Some smaller fixes (missing semicolon, added some $root in jinja templates) 2017-07-26 13:39:38 +02:00
Gina Häußge 1a6dbb3f4a Preparing release of 1.3.5rc1 2017-07-26 12:47:47 +02:00
Gina Häußge 10e834f623 Improve logging of async system commands
Closes #2025
2017-07-24 18:32:21 +02:00
Gina Häußge 5ce34f774e GCODE Viewer: Fix file position calculation
We were only adding one byte for "\n". That ignored that our regex
could also match "\r\n" or "\r\r" or something like that.

Our split regex now only matches one "\r" or "\n". Empty lines we'll
simply ignore anyhow so no real harm done.

Also, we no longer strip the comments in this step - leave that to
the worker running in its own thread. Not only should that speed
things up a bit, it will also allow us to better debug the worker in
the future.
2017-07-24 12:55:39 +02:00
Gina Häußge 0456896d71 GCODE Viewer: Fix issue with lookup of layer index 0
We were just testing if z_heights[z] was truthy. If the layer index was
set but 0 that wasn't properly detected and let to overwriting our
layer information. Instead check explicitly against undefined.

Closes #2017
2017-07-24 12:52:13 +02:00
Gina Häußge e06c09e206 Fix some more FontAwesome related things
* remove some more "fa" classes where they didn't belong
  * use "fa-toggle-(on|off)" instead of circles where they were used
    to signify toggle actions
  * fix SD card icon being too high

Another follow-up to #1915
2017-07-21 12:29:18 +02:00
Gina Häußge a6d3299b91 Add user manager factory hook 2017-07-20 20:03:05 +02:00
Gina Häußge 0a7f2a209b Add opt-in wizard for online connectivity check
See also #2011
2017-07-20 20:02:57 +02:00
Gina Häußge 67f7580506 Only run connectivity checker if enabled
Otherwise assume we are online but don't ping anything.

See also #2011
2017-07-20 20:02:44 +02:00
Gina Häußge aab3a7bd63 Wizard: Support to prevent the "settings updated" dialog
Subwizards might actually intentionally want to update stuff through
the settings API, let's allow that.
2017-07-20 19:36:14 +02:00
Gina Häußge d0f5592421 Fix sorting of filament usage for more than one tool 2017-07-20 19:23:52 +02:00
Gina Häußge bb6ea4d81b Also set autocorrect to off on username field 2017-07-20 09:50:08 +02:00
Gina Häußge 7e32e5be8f GCODE viewer: Support \r, \n and \r\n line endings
So far we only supported \n and \r\n, leading to problems with MM
GCODE files generated by Slic3r Prusa Edition which apparently
produces \r line endings for some reason.

Closes #1996
2017-07-20 09:18:38 +02:00
Gina Häußge 266cae3509 PMGR: Refresh on any connectivity change 2017-07-19 18:49:52 +02:00
Gina Häußge 0dcbffb9d2 Bundled plugins: Handle connectivity states
See also #2011
2017-07-19 18:42:29 +02:00
Gina Häußge fb8c56be57 SWU: Track network connectivity & handle offline scenarios
See also #2011
2017-07-19 18:42:28 +02:00
Gina Häußge 2bc0c4a77f Synchronize pip helper cache access 2017-07-19 18:42:28 +02:00
Gina Häußge 187c09e7da Centralized online connectivity check
See also #2011
2017-07-19 18:42:27 +02:00
Gina Häußge 5c62b33967 Do not call uninitialized plugins in call_plugin 2017-07-19 18:42:26 +02:00
Gina Häußge 5db9acb359 SWU: Fix CLI commands
Client refactoring in d72c7c14 caused issues here.

Closes #2012
2017-07-18 12:39:11 +02:00
Gina Häußge 962d6ab27f CLI: Helpers for initializing client from command line 2017-07-18 12:37:23 +02:00
Gina Häußge 21699699b6 CLI: Fixed logging init for plugins
Also fixed a stupid typo ;)
2017-07-18 12:36:16 +02:00
Gina Häußge 8fec0859d9 Don't use fixed width on terminal input
Instead added some additional styles to support input-block-level
inputs with add-ons.
2017-07-18 09:46:32 +02:00
Shawn Bruce 1b9ff1b0e2 Move terminal command below terminal output and fill the row
Clicking terminal output (excluding highlighting) will set focus to terminal command
Change fancy functionality style from muted to warning so that it stands out more
2017-07-17 12:42:14 -04:00
Gina Häußge ee2d644239 Remove support for multi command expansion in sending phase
We won't support this after all, it's too much of a headache with
regards to the sending queue. Pausing takes longer, cancelling takes
longer, resends get more complicated and so on.

Command expansion in the queuing phase needs to suffice.
2017-07-17 16:26:32 +02:00
Gina Häußge a50db4b08e Options to disable position logging on cancel/pause
Provided as a workaround for people who don't want the associated
minimal delay in cancelling/pausing.

See #1946
2017-07-17 15:40:08 +02:00
Gina Häußge 6f5707a0fc Attach identity reset to logout signals
Safer than doing it manually
2017-07-17 13:14:45 +02:00
Marc Hannappel fbd8a97ffd Merge branch 'devel' of github:foosel/OctoPrint into dev/permission 2017-07-17 09:02:32 +02:00
Gina Häußge 4147ffa503 Merge branch 'maintenance' into devel 2017-07-14 11:29:49 +02:00
Gina Häußge cf053ddbed Temperatures may in fact be negative
E.g. in case of a disconnected thermistor, or when it is really
really cold. Make sure our parsing doesn't get confuse by this and
thinks that

  ok T:150.0/210.0 T0:-55.7/0 T1:150.0/210.0

is actually only T and T1 being reported by the firmware, causing
stuff to be wrongly canonicalized thanks to T/T1 being Smoothie's way
of reporting dual extruder setups.

Fixes #2007
2017-07-14 11:18:04 +02:00
Gina Häußge b1101f5150 Virtual printer: support pinning of temperatures
Helpful for simulating disconnected thermistors, preparation for
debugging #2007
2017-07-14 11:07:25 +02:00
Gina Häußge 3a9d581423 Decouple writing of print log from everything else
Fixes delay in cancel processing as observed by @capnbry with regards
to #1946.

More tests necessary to ensure this was the only cause.
2017-07-13 20:00:45 +02:00
Gina Häußge 142a1b0dcb Progress might be 0, don't divide by it then 2017-07-13 15:48:22 +02:00
Gina Häußge a33f44ea25 Fix File(Added|Removed) and Folder(Added|Removed) events
Were defined as 1-tuple instead of a string thanks to a syntax error.
2017-07-12 16:13:51 +02:00
Gina Häußge 23e58d2fc1 Make sure resent lines always win before regular ones
Introduced a custom send queue type that actually contains two queues,
one for resends, one for regular lines. A flag indicates whether
lines should be returned from both or only resends. That way we
ensure that as soon as we have an active resend request we ignore
what was already in the queue and only send the lines we need to resend.

Also: PrependQueue => PrependableQueue
2017-07-11 17:10:02 +02:00
Marc Hannappel be2ef79686 Fix OctoPrintJsonEncoder to properly work with wrapt, additionally fix a wrong Permission name and combine 2 lines of code 2017-07-10 08:33:28 +02:00
Gina Häußge 2e897f19ac Synchronize all writing access to the send queue 2017-07-07 15:56:22 +02:00
Gina Häußge 16e96743c5 Docs for api_user/api_password on bitbucket_commit 2017-07-06 16:30:44 +02:00
Gina Häußge 4c6c764c5c Small simplifications and clarifications 2017-07-06 16:18:55 +02:00
Gina Häußge e86ba9a395 Merge branch 'f_bitbucket_swupdate3' of https://github.com/mrbeam/OctoPrint into pr/mrbeam/f_bitbucket_swupdate3 2017-07-06 15:33:19 +02:00
Gina Häußge c1c09d417d Removed a line that was accidentally committed 2017-07-05 17:58:33 +02:00
Gina Häußge f8d225a768 Support for parsing GCODE subcodes
Hook handlers will get any parsed subcode as optional keyword argument
"subcode".
2017-07-05 17:56:46 +02:00
Gina Häußge 4c3f4c2a8b Fix "additional data" toggle in file list 2017-07-05 16:37:39 +02:00
Gina Häußge cc3d34635e Add API function to (re)analyse files 2017-07-05 16:37:03 +02:00
Gina Häußge c81c93896b Apply tool offsets immediately and only once
Less tracking of offsets and also more similar to how
firmware does this.

We rewrite our current position on tool change to current position
plus tool offset instead of applying it for every single
position change.
2017-07-05 15:16:08 +02:00
Marc Hannappel 120406d115 Merge branch 'devel' of github:foosel/OctoPrint into dev/permission 2017-07-05 11:44:24 +02:00
Marc Hannappel d72ae6102b Added missing files/folders 2017-07-05 10:07:20 +02:00
Marc Hannappel 4adfad8708 Added custom attribute permission_test for template.sidebar and template.tab this shall be used to set the visibility permission/s, therefore added a tabs.js file (name can still change, but I don't find a better name right now) and fixes a few brackets 2017-07-05 10:02:24 +02:00
Gina Häußge 2e6d65378f Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/util/flask.py
#	src/octoprint/static/js/app/main.js
#	src/octoprint/users.py
2017-07-05 09:30:00 +02:00
Gina Häußge 3cdc59d7f1 Fix offset passing to analysis subprocess 2017-07-05 08:58:42 +02:00
Gina Häußge 5156cdbe68 Very minor refactoring & cleanup 2017-07-05 08:58:08 +02:00
Marc Hannappel 4ec1a9af39 Refactor a huge amount of code thanks to design failure, also add some comments and make things more translatable 2017-07-05 08:16:31 +02:00
Marc Hannappel 1109bd35e7 Replace a few leftovers of isUser with new permissions, also fix a few permission checks 2017-07-05 08:01:11 +02:00
Gina Häußge 0915c45f72 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2017-07-04 16:48:42 +02:00
Gina Häußge b2c1bb4b53 Option to automatically send temperature fine adjustments
As suggested by a loyal Patron ;)
2017-07-04 16:44:23 +02:00
Andy Werner 3bb06a1a33 SW Update check type 'bitbucket_commit' now supports API credentials for private repos 2017-07-03 17:17:43 +02:00
Gina Häußge 8ad165c625 Fix blur of temp input focus on submit
Also separated "clear offset" button in offset editor from input
field, looks better this way.
2017-07-03 16:08:41 +02:00
Gina Häußge 841b86a017 Merge branch 'maintenance' into improve/temperatureInput 2017-07-03 16:07:19 +02:00
Mark Walker c0c249ece9 Typo: red->read 2017-07-01 10:37:51 -07:00
Gina Häußge 5fc194accd Docs: Added sequence diagrams for web interface lifecycle
For now only startup and reconnect to server.
2017-06-30 18:28:49 +02:00
Gina Häußge ed6c01c12a Remove current_user from template contexts
That should never have been enabled for our usage scenario in the
first place.
2017-06-30 14:37:37 +02:00
Gina Häußge e309646504 Prevent unnecessary settings fetch during startup
We fetch settings once explicitly after passive login but before
completed startup. Without this patch we fetched them again after
onUserLoggedIn got fired (if it got fired by the passive login)
during startup. That's not necessary because we did the passive login
before our initial settings fetch, so IF that already logged us in,
our settings fetch already was done with us logged in as well and
the onUserLoggedIn later only tells us what we already knew.
2017-06-30 14:36:18 +02:00
Gina Häußge 96ee80afd2 Only trigger onUserLogged(In|Out) if login state actually changed
This also includes triggering an initial onUserLoggedIn after
initialization if the user turned out to be logged in by passive login.
2017-06-30 14:34:05 +02:00
Gina Häußge 8aec836d22 Minor refactoring of the web interface startup (again)
We still had some concurrent requests triggered through onStartup that
managed to overtake the passive login (and hence nuke the session
data on the client). This should now really not be possible any longer.

Also created a sequence diagram of the new process and linked it from
a lengthy comment.
2017-06-30 11:59:52 +02:00
Gina Häußge 697df4f3ce And fixed connection accordion toggling again
#1001 said hi once more after fixing the onUserLogged(In|Out) events
not firing...
2017-06-30 09:48:57 +02:00
Gina Häußge ac3f4d598c Fixed onUserLoggedIn/Out not firing correctly on startup anymore
Introduced by b205e84d4b
2017-06-30 09:39:14 +02:00
Gina Häußge 836fbef6d8 Fixed an error in the temp graph when not connected 2017-06-30 09:24:07 +02:00
Gina Häußge ce4cf38547 Removed log prefixing again
It caused issues with our line number tracking in the browser
developer tools and I don't see any way to avoid this considering
that we can't adjust the arguments supplied to console.log without in
fact wrapping it :/
2017-06-29 17:37:01 +02:00
Gina Häußge 38a5da1c35 Fix connection accordion again
Slightly different order of things caused #1001 to resurface.
2017-06-29 16:51:04 +02:00
Gina Häußge b205e84d4b Refactored web startup to minimise risks of race conditions
Under specific circumstances it could happen that the passive login
response was overtaken by a response from an earlier still
unauthenticated request which would then effectively overwrite the
session cookie immediately and hence cause the browser to use its
login session against the server, but without displaying that to the
user. See #1881 for what is probably an issue caused by exactly this
kind of scenario.

Additionally a couple of requests needed to be done a second time
after login, just moments after having done them for an anonymous
user. See #1572 for a request to change this behaviour.

This patch changes the startup order of the web interface like this:

  1. connect to the websocket, postpone any events triggered by
     this (e.g. "fromHistoryData") until 3
  2. perform a passive login, postpone any events triggered by this
     (e.g. "onUserLoggedIn", "onUserLoggedOut") until 4
  3. trigger postponed events from 1
  4. trigger "onStartup" (triggers postponed events from 2)
  5. fetch settings
  6. bind view models etc

A connection close of the websocket will disable event processing on the
socket until it is marked as initialized again by the passive login
processing, which will also be triggered immediately on server connect.

That way under normal circumstances nothing should ever get triggered
in the registered view models that might generated requests to the
server API until a passive login has been done, a server session
initialized and if necessary a user properly authenticated.
2017-06-29 15:42:19 +02:00
Gina Häußge 7ab4d12548 Better error resilience against wrong user manager
Also improved get_class by using importlib instead of complicated
climbing through the whole module tree.
2017-06-29 15:07:17 +02:00
Gina Häußge f6c3e5991d PMGR: Detect if plugin needs printer reconnect 2017-06-28 10:30:35 +02:00
Gina Häußge 188b59a319 Added id to tabs content div
cc @Salandora
2017-06-27 15:47:39 +02:00
Gina Häußge b3594e367e Remove superfluous <br> tag from progress dialog output lines 2017-06-27 15:07:00 +02:00
Gina Häußge 12d40122d1 Use wrapt.ObjectProxy for SessionUser wrapper class
Our old manual wrapped didn't properly work in some aspects, this
version now should hopefully take care of most common proxy object
pitfalls.
2017-06-27 15:03:37 +02:00
Gina Häußge 2e11a7b860 Introduced pre-output css class for line based output pres
Easier to just put this on all output pre tags than defining
display:block on the contained spans for all individually.
2017-06-27 11:54:15 +02:00
Gina Häußge f20185db3a Better handling of timelapse deletion errors
Closes #1975
2017-06-27 11:32:42 +02:00
Gina Häußge 0db323d0c5 Removed unused import 2017-06-26 17:14:03 +02:00
Gina Häußge 639d8d4c5f Perform gcode analysis in subprocess 2017-06-26 16:19:18 +02:00
Gina Häußge 5e0b53b651 Better thread safety for SockJS
Heartbeat messages could still be sent out of turn, causing message
corruption or other weird things. This should hopefully fix this.
2017-06-23 17:56:17 +02:00
Gina Häußge 1ebfa4b1dd New event ToolChange and tool change GCODE scripts
(cherry picked from commit 5f79aa6)
2017-06-23 16:06:44 +02:00
Gina Häußge 35c45df86c Allow multi line commands in sending phase
(cherry picked from commit 1018946)
2017-06-23 14:55:34 +02:00
Gina Häußge a50e8bbbb5 Merge branch 'improve/temperatureGraphCrosshair' into maintenance 2017-06-22 17:33:09 +02:00
Gina Häußge 4665070601 last_temperatures -> last_temperature (for consistency) 2017-06-22 12:47:55 +02:00
Gina Häußge b34fc8e05e Merge branch 'improve/temperatureInScripts' into maintenance
# Conflicts:
#	src/octoprint/util/comm.py
2017-06-22 12:45:50 +02:00
Gina Häußge a3ece229f2 Fixed button types & update displayed current offset in dialog 2017-06-21 12:40:59 +02:00
Gina Häußge fc53febb87 WIP: Improved temperature controls 2017-06-20 16:53:41 +02:00
Gina Häußge dad956b5c9 Treat Anet A8 firmware as Repetier firmware
It appears to behave identically and probably is a renamed variant.
That would also explain #1737 and some observations reported in
#1946.
2017-06-19 16:33:33 +02:00
Gina Häußge 981110d4b2 Devel RC release channel should also track Maintenance RCs
That way people don't have to toggle between Maintenance and Devel RCs
just to get _all_ RCs.
2017-06-14 13:52:47 +02:00
Gina Häußge 81efd3251c Merge branch 'devel' into dev/commRefactoringNG 2017-06-14 11:27:22 +02:00
Gina Häußge 24dc12023b Merge branch 'maintenance' into devel 2017-06-13 16:01:36 +02:00
Gina Häußge cbd94a9020 Ignore coordinates outside bed for zoom/centering in gcode viewer
They might be nozzle priming routines which are not actually part of
the model proper and hence it doesn't make sense trying to keep them
visible when zooming in on the model, or allowing them to offset the
model center.
2017-06-13 15:59:30 +02:00
Gina Häußge 77db00a2ea Extend coordinates used for min/max calculation
Both old and new position are relevant, we are extruding from one to
the other.
2017-06-13 15:58:12 +02:00
Marc Hannappel f53be57f0d Added User wrapper, this makes sure we stay backwards compatible 2017-06-09 09:31:50 +02:00
Marc Hannappel 9db4559b0c User dict's get method, Renamed GroupCantbeChanged to GroupCantBeChanged, some smaller styling fixes 2017-06-09 09:28:03 +02:00
Marc Hannappel 23a249ca0f Fix headers, as mentioned in the comments 2017-06-09 09:24:59 +02:00
Gina Häußge 665078e1a4 Better backwards compatibility & disable crosshair on mobile 2017-06-07 14:24:24 +02:00
Gina Häußge cfae406a4c Fix issue with hover pos being undefined & resizing of plot 2017-06-07 10:59:22 +02:00
Gina Häußge 00c14e6936 First throw at tracking individual data points in the temp graph
See #1640
2017-06-07 10:10:31 +02:00
Gina Häußge 6a1b162e7b Support for temperature autoreporting instead of polling
Now also detects capabilities reported by (extended) M115 output and
if AUTOREPORT_TEMP is available enables it with the configured
autoreport interval and disables active polling.

Implements #1679
2017-06-06 18:46:23 +02:00
Gina Häußge a2fd39b3c4 Removed some unused variables from StateMonitor 2017-06-06 12:47:38 +02:00
Gina Häußge bda2fd94e3 More hardening against expected folders being files
See #1953
2017-06-06 10:01:21 +02:00
Gina Häußge 3171958a8c Merge branch 'maintenance' into devel 2017-06-02 16:36:08 +02:00
Gina Häußge 9e207ca8a1 SWU: Force exact version update for OctoPrint when tracking releases 2017-06-02 16:27:25 +02:00
Gina Häußge 5d321926bb Corewizard: Don't load js if not required 2017-06-02 16:06:11 +02:00
Gina Häußge 3d3e0212c6 Corewizard: Disable client if not required 2017-06-02 16:06:00 +02:00
Gina Häußge e3d44d7d06 Use client default if server default printer profile in unavailable 2017-06-02 16:05:12 +02:00
Gina Häußge d39c124f35 Allow empty & custom size in print job events
Thanks to @erikheidstra for the heads-up
2017-06-02 14:25:02 +02:00
Gina Häußge 8603ea4b6f Fix stupid typo causing printerProfileManager.set_default
Thanks for the heads-up @erikheidstra!
2017-06-02 14:20:06 +02:00
Marc Hannappel 422f1b2b5e Combine user, permissions and group tests as access test, Fix a problem with GroupsCantbeChanged 2017-06-02 11:23:44 +02:00
Gina Häußge a681048df6 Enable blockWhileDwelling for Malyan printers
See #1941 and #1762
2017-06-01 17:08:28 +02:00
Gina Häußge d689496802 Fix stupid typo causing unnecessary creation of default profile 2017-06-01 16:29:49 +02:00
Gina Häußge fed3ec9616 Merge branch 'maintenance' into devel 2017-06-01 16:12:53 +02:00
Gina Häußge 5a23b46c11 Merge branch 'staging/maintenance' into maintenance 2017-06-01 16:11:50 +02:00
Gina Häußge 2b96e57923 maintenance & staging/maintenance are now 1.3.5(rc1) 2017-06-01 16:09:34 +02:00
Gina Häußge 885e88a5e0 Merge branch 'rc/maintenance' into staging/maintenance 2017-06-01 16:08:30 +02:00
Gina Häußge fe481e12b3 Prepare release of 1.3.4 (hotfix) 2017-06-01 12:22:23 +02:00
Gina Häußge cbdf85c27a Fix crash on startup thanks to invalid default profile & auto connect
See #1942

This does NOT fix the root cause of `_default.profile` becoming an
empty file (apparently during migration from config.yaml?), however
since this particular situation was impossible to reproduce so far this
workaround for the consequences will have to suffice for now since we
want a hotfix as fast as possible for 1.3.3.
2017-06-01 12:10:12 +02:00
Gina Häußge 751867d5b8 Merge branch 'maintenance' into devel 2017-05-31 16:58:56 +02:00
Gina Häußge 674637f6b2 Merge branch 'staging/maintenance' into maintenance 2017-05-31 16:58:32 +02:00
Gina Häußge 9056f5d610 maintenance & staging/maintenance are now 1.3.4(rc1) 2017-05-31 16:57:10 +02:00
Gina Häußge b55c4ef5ca Preparing release of 1.3.3 2017-05-31 15:49:01 +02:00
Gina Häußge b9747d0f0e Fix typo: TRANFERING_FILE
(cherry picked from commit c4fcc59efd)
2017-05-31 11:24:44 +02:00
Gina Häußge 0feae3ba18 Centralized browser detection 2017-05-31 10:45:19 +02:00
Gina Häußge 1cc3ddb03c Add levels & color to browser console log 2017-05-30 17:46:03 +02:00
Gina Häußge 33cafbbd8a Make stream timeout adjustable
As suggested by @ntoff in #1937
2017-05-30 17:26:30 +02:00
Mark Walker c4fcc59efd Fix typo: TRANFERING_FILE 2017-05-30 00:29:30 -07:00
Gina Häußge 528bbba6ed Merge branch 'maintenance' into devel 2017-05-29 13:46:59 +02:00
Gina Häußge d274a9c73d Fixed a couple of FontAwesome issues
* fa-circle-blank does not exist, replaced with fa-circle-o (see also
    report in #1928)
  * fa-trash-o instead of fa-trash (same look and feel)
  * fa-check instead of fa-check-circle (same look and feel)
  * fixed toggleContent binding to also be able to toggle fa icons
  * fix deletion spinner in file list (was still using old icon-
    classes which of course weren't there anymore and hence not
    toggleable)
  * icons-ul => fa-ul
  * remove superfluous fa class from some places

Follow-up to #1915.
2017-05-29 13:42:11 +02:00
Gina Häußge 905c05ba06 Merge branch 'maintenance' into devel 2017-05-24 18:06:43 +02:00
Gina Häußge c3619a3795 No scary message on autodetect fail 2017-05-24 18:04:11 +02:00
Gina Häußge dffb33727d More sensible sorting of baudrates for auto detect
115200 is the most likely baudrate candidate for printers, followed
by 250000. Any additional baudrates that were configured are even more
likely.
2017-05-24 17:56:01 +02:00
Gina Häußge 78724163b1 No need for programmer mode for detecting one port 2017-05-24 17:54:30 +02:00
Gina Häußge b6a09abb83 Fix an issue causing non-gcode commands not to be sent
Introduced by multi-command returns from comm handlers
2017-05-24 17:51:01 +02:00
Gina Häußge 77b6d83e0b Set X-Robots-Tag and remove Server header in responses
Also set robots meta tag in index.jinja2
2017-05-24 16:53:54 +02:00
Gina Häußge fcacf28c45 Merge branch 'maintenance' into devel 2017-05-24 14:53:40 +02:00
Gina Häußge 7c6b85a0ad Merge branch 'staging/maintenance' into maintenance 2017-05-24 14:51:24 +02:00
Gina Häußge df038e6a4d staging/maintenance is now 1.3.3rc4.dev 2017-05-24 14:50:18 +02:00
Gina Häußge ce1541e956 Preparing release of 1.3.3rc3 2017-05-24 13:26:06 +02:00
Gina Häußge bd1d0e6073 Merge branch 'rc/maintenance' into staging/maintenance 2017-05-24 12:33:40 +02:00
Gina Häußge ff89cdf6d0 Fix versioneer lookup entry for 1.3.3rc3 staging branch 2017-05-24 12:28:09 +02:00
Gina Häußge 76f58e05ec Better fix for #1821
Instead of disabling capturing of postroll by default (which we actually
don't want and doing so was a mistake thanks to misremembering the
meaning of the variable in question), we now properly reset the
default value for that check box (which wasn't properly set only due to
a very stupid typo).
2017-05-24 12:26:14 +02:00
Gina Häußge 2a600d7d00 Fix consecutive timed timelapses without postroll capture
Due to the timer never properly resetting to None only one timelapse
was ever done.

Introduced in 7e2382fed4, covered until
315a80a7a7.

Closes #1934
2017-05-24 11:57:02 +02:00
Gina Häußge 4a84fa95e4 [docs] Fix another typo in the SettingsPlugin docs 2017-05-23 10:15:04 +02:00
Gina Häußge 557c761e80 [docs] Fix a typo in the SettingsPlugin docs 2017-05-23 10:13:04 +02:00
Gina Häußge 10cb60acca [docs] Warn about the need to protect sensitive settings in plugins 2017-05-22 19:24:20 +02:00
Gina Häußge 5e55d637af Don't escape \t, \r or \n in terminal output 2017-05-22 14:06:12 +02:00
Gina Häußge 8942d7d50d Slight rewording for the webcam error message
See #1925
2017-05-19 18:25:40 +02:00
Gina Häußge 3e5d82c665 Merge branch 'maintenance' into devel 2017-05-19 18:18:59 +02:00
Gina Häußge 0ad09e422d Add stream URL to webcam error message for logged in users 2017-05-19 17:59:54 +02:00
Gina Häußge 0657160389 Different "webcam error" text for non-admins 2017-05-19 17:59:12 +02:00
Gina Häußge cfde6342a8 Update SockJS to 1.1.2
Also include source maps. While those are stripped when bundling, for
alternative UIs including sockjs they still might make sense.
2017-05-19 12:29:40 +02:00
Gina Häußge 832c27ed18 Filter source maps from bundled assets
At least for now. Might be re-evaluated in the future. URL rewrite
filter for such a case already in place.
2017-05-19 12:28:20 +02:00
Marc Hannappel 1bea7654b8 More work on the tests 2017-05-19 11:46:06 +02:00
Marc Hannappel 38ea778ccf Fix warning_factory warning 2017-05-19 11:45:45 +02:00
Marc Hannappel 31f300f6d8 Use lower case names for method names split with an underscore 2017-05-19 11:44:54 +02:00
Marc Hannappel 4e8bb688aa Some adjustments in the users.py, remove sorting of permissions and groups, user has_permission instead of is_admin, not p in s -> p not in s 2017-05-19 09:49:38 +02:00
Marc Hannappel 563d623278 Use dict() instead of [] for the permissionManager, raise Exception if someone tries to add an already known permission 2017-05-19 09:47:21 +02:00
Marc Hannappel 24790e8b2a Use gettext for Permission description. Fix __repr__ for Permissions, Group and User. 2017-05-19 09:45:11 +02:00
Marc Hannappel 58806dee68 Adjusted the permissionslist from [] to None, Fixed some styling 2017-05-19 08:59:35 +02:00
Gina Häußge 59d78ba893 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2017-05-18 11:20:54 +02:00
Gina Häußge 7770ee3d08 static/assets/vendor => static/vendor
Our static folder is basically an assets folder (it just is named differently).
So let's get rid of the redundant directory level.
2017-05-18 11:12:33 +02:00
Gina Häußge 2d9ad41e49 Moved FontAwesome css into vendor folder & use cssrewrite filter for webassets
That fixes up the relative URLs to the font files and should make updates down the line
a thing of a quick copy and paste (plus allow some more sophisticated dependency
management down the road as well).

Also renamed fonts folder for FontAwesome 3.2.1 from font to fonts, for more
consistency.
2017-05-18 11:10:37 +02:00
Gina Häußge 821156c9d6 Py3: basestring => past.builtins.basestring 2017-05-17 19:01:42 +02:00
Gina Häußge 9e5982be29 Attach on_sent callback to last command only 2017-05-17 18:51:34 +02:00
Gina Häußge 39c87d19b7 Fixed a left-over typo. 2017-05-17 17:47:58 +02:00
Gina Häußge d029abc8f3 Updated docs with an example of multi command expansion 2017-05-17 17:47:58 +02:00
Gina Häußge 7b5848b9c3 Extracted handler result normalization and added tests for it
Caught some more bugs while doing that.
2017-05-17 17:47:57 +02:00
Gina Häußge 53bfbf5acf Refactored things a bit to remove a bit of repetition 2017-05-17 17:47:21 +02:00
Goswin von Brederlow 917c9e54ba Allow octoprint.comm.protocol.gcode.queuing hook to return a list of commands 2017-05-17 17:46:58 +02:00
Davide Depau d8d9c7fe64 Merge branch 'maintenance' into fa-update 2017-05-17 17:46:01 +02:00
Davide Depau 6c0f2de780 upgrade FontAwesome CSS+fonts to 4.7.0, keeping 3.2.1 as fallback [2/2] 2017-05-17 17:35:49 +02:00
Davide Depau 700975d670 upgrade templates to use FontAwesome 4.7.0 classes [1/2] 2017-05-17 17:35:27 +02:00
Gina Häußge 4fda12b512 Merge branch 'maintenance' into devel 2017-05-17 14:00:17 +02:00
Gina Häußge 9fac314d71 SWU: restart asynchronously instead of synchronously
Otherwise we will block ourselves, waiting for the restart command to
complete which it only can when we are no longer there.

Should reduce restart times on update significantly.

Downside is that we no longer can wait for the return code of the
call. However, that should be caught by our UI handler timing out for
the restart and showing an error prompting the user to restart
manually.
2017-05-17 13:44:11 +02:00
Gina Häußge 9dfee34f01 Fix various popup buttons allowing multiple clicks
As suggested by @ntoff in #1914
2017-05-17 13:44:08 +02:00
Gina Häußge dc8473bc4d Add check for valid job file type to job validation 2017-05-17 13:44:04 +02:00
Ken c1c75f032d Fixed webcam not loading bug if first/initial tab is "Control"
(cherry picked from commit d66a4f3)
2017-05-17 13:44:01 +02:00
Gina Häußge 9ad180c02a Disable "Upload to SD" ui elements while printing
As suggested by @ntoff in #1914
2017-05-17 13:43:57 +02:00
Gina Häußge 7795320fc8 Allow timelapse config through UI when not connected to printer
That restriction didn't really make sense.

As mentioned in #1918
2017-05-17 13:43:53 +02:00
Gina Häußge a54c8fbeb7 maintenance branch is now 1.3.4.dev 2017-05-17 13:43:49 +02:00
Gina Häußge 337957198b Introducing staging/* branches for rc preparation
That way we can switch maintenance over to follow-up stable release
preparation earlier and don't have to hold back commits.
2017-05-17 13:33:28 +02:00
Gina Häußge 0c62465a22 Merge branch 'maintenance' into devel 2017-05-17 12:22:19 +02:00
Gina Häußge 2bae87b85a Preparing release of 1.3.3rc2 2017-05-17 10:59:48 +02:00
Gina Häußge 51959319eb PGMR: Fix call to non existing onAlways
Closes #1919
2017-05-16 16:00:40 +02:00
Gina Häußge 6d73e6557b Timelapse: Disable "save as default" along other controls
Fixes #1918
2017-05-15 13:03:40 +02:00
Gina Häußge 4c65313c7f Fix a regression causing job data to be reset on completion of a print
Fixes #1917
2017-05-15 12:40:05 +02:00
Gina Häußge 41cf85d9db Some rephrasing 2017-05-12 14:58:30 +02:00
Marc Hannappel 785b0caaf2 Fixed a few left overs of the old hasPermission check in the pluginmanager and softwareupdater
Fixed a few left overs from removing the groups and permissions enabled property
2017-05-12 08:46:35 +02:00
Gina Häußge 3d4c50d481 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/server/api/settings.py
2017-05-11 17:43:42 +02:00
Gina Häußge 3fbd477d15 Preparing release of 1.3.3rc1 2017-05-11 15:25:43 +02:00
Gina Häußge 2c73dd36c5 Final fixes before 1.3.3rc1 2017-05-11 15:23:45 +02:00
Gina Häußge c91fe0c4fc Further decouple some plugin fetch tasks from initial startup thread 2017-05-11 15:23:41 +02:00
Gina Häußge 3bfc4725d2 SWU: Added cache timestamp to UI
Implements #1521
2017-05-11 12:45:02 +02:00
Gina Häußge b6fbe6fafd Added docs for bitbucket_commit check type
Update to #1898
2017-05-11 12:12:22 +02:00
Gina Häußge 263c297bed Made last/pause/cancel temperature available in GCODE scripts
Implements #1910
2017-05-11 10:00:54 +02:00
Gina Häußge dba95ee94f Handle G90/G91 and M82/M83 distinct by default
By default G90/G91 define relativeMode, M82/M83 define relativeE. The
extruder coordinate will be viewed as relative when either
relativeMode or relativeE are set. This mirrors the implementation in
Marlin (current and legacy forks) as well as Repetier.

SmoothieWare's implementation resets the relative mode of the
extruder on a G90/G91. To still accomodate this different
implementation a new settings has been added under Settings >
Feature: "G90/G91 overrides relative extruder mode". Checking this
switches to the alternative interpretation for future gcode analysis
and visualization.

The only difference between the two of them is that the following
segment of GCODE:

    M83
    G90

will have the extruder still set to relative on Marlin and
Repetier but set to absolute on Smoothieware.

Please note that the setting in all likelihood will be moved to
the printer profile in the future, since it makes more sense to have
it on a per printer basis. It's not part of the set of features
available for auto detection since it's required for GCODE analysis
and hence needs to be known even outside of a connection to the
printer.

Implements #1818
2017-05-10 16:43:20 +02:00
Marc Hannappel c0975ed15e Started to adjust the tests to the new permission system 2017-05-10 13:56:09 +02:00
Marc Hannappel ce6de6efa6 Moved users.py to new access package, add wrapper file users.py for backwards compatibility
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
2017-05-10 13:52:30 +02:00
Gina Häußge f0b63a8e7f Set lines in log outputs to "display: block"
Taken from reverted commits 6465175e09
and 0f6edabea3.
2017-05-10 09:58:02 +02:00
Gina Häußge e166765f7f Revert "Also use fastForEach in working dialogs of PMGR & software update"
This reverts commit 0f6edabea3.
2017-05-10 09:25:53 +02:00
Gina Häußge 15e8bbe147 Revert "Improve terminal performance by adding FastForEach"
This reverts commit 6465175e09.

# Conflicts:
#	src/octoprint/static/css/octoprint.css
#	src/octoprint/static/less/octoprint.less
2017-05-10 09:25:18 +02:00
Gina Häußge 853bb2fc16 Have G92 set pos directly, use offset only for tool offsets
See #1906 for related discussion
2017-05-09 17:17:08 +02:00
Gina Häußge ccc3c4ef32 Detect invalid settings data to persist (not a dict), send 400 2017-05-09 14:36:45 +02:00
Gina Häußge 72898360f3 Get rid of ridiculous float precision in temperature commands
"M104 S200.00000000" is completely unnecessary when "M104 S200" works
just fine.
2017-05-09 09:38:10 +02:00
Gina Häußge 2caa10f15e Don't send T with temperature set commands for shared nozzles
Fixes #1907
2017-05-09 09:29:52 +02:00
Gina Häußge 399ec5a909 Allow configuring the webcam stream's aspect ratio
Options are 16:9 and 4:3, 16:9 is the default.
2017-05-08 17:35:51 +02:00
Gina Häußge c844217f82 Placeholder for webcam image to avoid moving controls on load
An aspect ratio of 16:9 is assumed, with other ratios showing black
letterbox borders as required.

During loading a text "Webcam loading..." is displayed in the webcam
space. On loading error, the (broken) image is hidden and an error
text is displayed instead.

Solves #478
2017-05-08 17:04:03 +02:00
Marc Hannappel 561c1fc338 Fixed the comment about rereference functions 2017-05-05 15:01:13 +02:00
Marc Hannappel e94affe588 Refactored the way the permissions gets checked on the frontend, also made corresponding changes to the backend 2017-05-05 14:55:17 +02:00
Marc Hannappel 43e3648ba7 Fixed a few missing thing, Added a few Comments to some functions to explain their functionality 2017-05-05 14:53:07 +02:00
Gina Häußge f32d7c434d Docs: Added note that coordinates in script context might be None
Wasn't made clear before.
2017-05-03 20:18:11 +02:00
Gina Häußge 844494a9d5 Only prevent command processing if streaming AND printing
Otherwise we might run into a rare race condition where the M110 sent
on start of a SD card upload gets prepared for sending after the
source file is already opened. That would then lead to the M110 not
getting processed anymore by OctoPrint and hence the line number
counter not resetting accordingly, leading to one line number
mismatch after the next from the firmware.

Testing if our "isPrinting" flag is ALSO set to true here ensures
that we'll only stop processing commands internally once the state
has actually switched to printing, which only happens after the
firmware responds to the M28 sent after the M110.

Fixes #1882 and probably also the issue encountered by @amd989 in
#1762 (which looks like exactly the same problem)
2017-05-03 18:55:00 +02:00
Gina Häußge f1254622c5 Docs: Link to Jinja 2.8.1 documentation mirror at jinja.octoprint.org
The official docs are only 2.9+, that doesn't help us as long as we are
stuck with 2.8.

Fixes #1900
2017-05-03 11:56:25 +02:00
Marc Hannappel 63938c6fd3 Added migration steps from old permission system to new permission system
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
2017-05-03 11:21:43 +02:00
Gina Häußge 060aa1274a Some minor refactoring of #1898 for better maintainability 2017-05-02 17:45:28 +02:00
Andy Werner fe0aa0301f Software update plugin: added check_type bitbucket_commit
(cherry picked from commit ee75ddc)
2017-05-02 17:25:01 +02:00
Gina Häußge cda48f3b71 Fix some potential encoding issues
Might be a fix for #1884, can't be confirmed though, ticket is
incomplete.
2017-05-02 14:59:05 +02:00
Gina Häußge c69ef1598a Don't allow multiple parallel webcam tests
Disable button when a test is already active. Also have spinner
defined centrally and only made visible on active test.

Should hopefully give better feedback to impatient users ;)

Solves #1897
2017-05-02 13:39:38 +02:00
Gina Häußge 0161d915d6 Some refactoring in CuraViewModel
* Use click data-bind for submit button instead of manual click
    binding
  * Keep metadata synchronized (otherwise changing identifier, name,
    description, overwrite or default flag after adding a file does
    absolutely nothing)
  * Disable submit button and fields when no file is selected.
  * Disable submit button (and show spinned) when request is in
    progress.

Related to #1893
2017-05-02 12:57:32 +02:00
Eyal Soha f5fad5186e Clear upload data when Aborting cura profile upload modal.
This fixes #1893.

Also, only bind click to the "Confirm" button once instead of binding
and unbinding it for each file.  Binding it just once seems cleaner.

(cherry picked from commit 83d1921)
2017-05-02 10:04:54 +02:00
Gina Häußge 2817979c3d CSS updated 2017-05-02 09:57:26 +02:00
Gina Häußge cc44c1a981 Make sure to properly handle unicode passwords
Fix & test for #1891
2017-05-02 09:35:02 +02:00
Gina Häußge f21a1093f3 Eval message integrity for checksumming 2017-05-02 09:21:53 +02:00
Gina Häußge 72318fa696 Fix comment stripping 2017-05-02 09:21:19 +02:00
Gina Häußge babc581c5d More migrations from stable comm layer to new layer
Also fixed:
  * comment stripping
  * resends (? maybe ?)
  * transport error detection
2017-04-21 23:05:58 +02:00
Gina Häußge c28fb4164b Transport registry, events and various fixes
Broken:

  * print time estimation
  * comment stripping (not stripping totally empty lines)
  * resend handling (837, 838, 833 - boom)
  * job pause/resume events?
  * possibly more
2017-04-20 17:18:36 +02:00
Gina Häußge a6db08992f Fixed some merge errors & temperature reporting 2017-04-20 15:17:07 +02:00
Gina Häußge 2dea5e0ffc Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	setup.py
#	src/octoprint/filemanager/__init__.py
#	src/octoprint/filemanager/storage.py
#	src/octoprint/printer/__init__.py
#	src/octoprint/printer/standard.py
#	src/octoprint/server/__init__.py
2017-04-20 12:25:08 +02:00
Gina Häußge dda3a303d2 Recover terminal functionality on processing speed increase
If double the speed needed for output during print/fancy terminal
functionality is detected, re-enable that after a timeout of 5s.
Decrease of speed cancels the timeout again. That should prevent wild
toggling.

Should solve #1862
2017-04-20 12:15:40 +02:00
Gina Häußge b79606da70 Never auto-complete GCODE to send
Solves #1875
2017-04-19 18:03:44 +02:00
Gina Häußge fb9131f67a Some de-duplication 2017-04-19 11:34:34 +02:00
Eyal Soha 358a252736 Fix dragndrop upload
See #1867. Fixes #202.

(cherry picked from commit d658c64)
2017-04-19 11:34:11 +02:00
Marc Hannappel 9cab4d510a WIP: More Refactorings 2017-04-18 16:37:45 +02:00
Gina Häußge fd7c81c7fb Link to FAQ entry about SerialExceptions to log output
As suggested in #1876
2017-04-18 13:03:17 +02:00
Gina Häußge a09b54d374 Have tag based branches not report post versions unless dirty
That will allow us to make changes to e.g. github related metadata files
stored in the repository without OctoPrint reporting a non tag version.
2017-04-13 11:49:58 +02:00
Gina Häußge 2a7cebfe55 Keep "Load and print" button enabled when file is selected
Some users get confused by having to use the blue "Print" button in
the state panel for consecutive prints of the same model, let's solve
this once and for all.
2017-04-12 19:04:45 +02:00
Gina Häußge 0f6edabea3 Also use fastForEach in working dialogs of PMGR & software update 2017-04-12 18:54:08 +02:00
Gina Häußge 45231ea7f8 Merge branch 'improve/terminalFastForEach' into maintenance 2017-04-12 18:21:52 +02:00
Gina Häußge c00b46ef5c Support timeout parameter in client and CLI 2017-04-12 15:40:54 +02:00
Gina Häußge 251a1ea4b5 "a couple" => "a few"/"some"
Because apparently I was using it wrong, at least for some parts of the
world :)
2017-04-12 14:54:32 +02:00
Gina Häußge bba9d6cc18 Use proper timeouts for requests + better error handling
Default behaviour apparently is blocking, we never want that!

Also make error responses actually raise an exception.
2017-04-12 13:50:52 +02:00
Gina Häußge 9bcce4e56a docs: plugin tutorial requires 2017-04-12 13:00:56 +02:00
Marc Hannappel 41621826d8 WIP: More Refactorings 2017-04-12 10:41:43 +02:00
BillyBlaze 6465175e09 Improve terminal performance by adding FastForEach
Move the AutoScroll function to an animation frame to prevent layout thrashing and to keep it in sync with fastForEach
Remove the <br> tag from the terminal and use display: block; on span tags to prevent increasing DOM nodes and faster processing of the terminal
2017-04-12 08:17:34 +00:00
Gina Häußge fe585e7115 Do not repeatedly apply any set offsets in the gcode interpreter
They would accumulate and cause wrong calculations

Solves #1863
2017-04-12 09:38:53 +02:00
Marc Hannappel 2149030dbb Added Function to register default permissions, WIP 2017-04-12 09:09:47 +02:00
Marc Hannappel 8c0bd7e5e3 Fix leftover merge conflict 2017-04-12 09:08:43 +02:00
Marc Hannappel 5283682c47 Readded somehow lost import requests 2017-04-12 08:37:38 +02:00
Marc Hannappel b53d20d2ee WIP: Refactored the groups and permissions into access 2017-04-12 08:34:06 +02:00
Marc Hannappel ed6bdf97d1 Merge branch 'devel' of github.com:foosel/OctoPrint into dev/permission 2017-04-12 08:33:27 +02:00
Marc Hannappel 93cfa564f7 WIP: Some more Refactorings 2017-04-12 08:21:06 +02:00
Marc Hannappel 579b8fce96 Merge branch 'devel' of github.com:foosel/OctoPrint into dev/permission 2017-04-12 08:18:41 +02:00
Shawn Bruce d1d9462423 Add octoprint.timelapse.capture.[pre/post] hooks (#1854)
* Add octoprint.timelapse.capture.pre and octoprint.timelapse.capture.post hooks

* Adjust underline length
2017-04-11 18:29:52 +02:00
Gina Häußge b84432c8a5 Merge branch 'patch-1' of http://github.com/ParkerK/OctoPrint into maintenance 2017-04-11 09:36:13 +02:00
Parker K c6623c8883 added missing period and space so works 2017-04-10 21:35:46 -04:00
Gina Häußge ef01560199 If file hash doesn't match on adding a file, kill all metadata 2017-04-10 17:31:00 +02:00
Gina Häußge 1666a1f607 Removed "minify" option for assets and some redundancy 2017-04-10 16:28:04 +02:00
Gina Häußge 4109b2f6c2 Announcements: Unit tests for the converters 2017-04-10 13:57:21 +02:00
Gina Häußge 9f32e91e05 Turned lazyload into jquery plugin, used for announcements
On call of the lazyload plugin, all matched img elements will be
checked if they have a data-src attribute. If so, their src attribute
will be replaced with the contents of the data-src attribute
(effectively loading the image) and the data-src attribute will be
removed (so that multiple calls don't call multiple processing).
2017-04-10 11:54:03 +02:00
Gina Häußge 7c8f148fa8 Announcements: Don't load imgs until reader is opened
Closes #1858
2017-04-10 11:21:18 +02:00
Gina Häußge d1c6381792 Intermediary page: Offer "reload now" once server is up but not cached 2017-04-10 10:45:16 +02:00
Gina Häußge a477268beb More logging for preemptive cache 2017-04-10 10:43:46 +02:00
Gina Häußge 346f818707 PGMR: More general flexibility for os compat check
* Don't restrict the list of compatibility values to check against
    to only those we have mapped, also support unmapped more exotic
    ones.

  * Allow 1:1 check against sys.platform values (with startswith).
    Combined with the above that allows very granular compatibility
    modelling ("freebsd11", "freebsd12") if required.

  * Instead of only whitelisting ("linux", "freebsd") now also black
    listing is possible ("!windows").

    A detected os must match all provided whitelist elements (if the
    whitelist is empty that is considered always the case) and none of
    the backlist elements (if the blacklist is empty that is also
    considered always the case).

See the included unit tests for examples of how this works.
2017-04-07 09:18:37 +02:00
Gina Häußge 956d9581c5 PMGR: Add freebsd os compatibility flag 2017-04-07 09:16:26 +02:00
Gina Häußge 7828ab0bf9 Fix tests for server.util.*
Weren't properly included in test suite, and those for the flask
utility also had some errors due to buggy test implementation.
2017-04-07 09:15:08 +02:00
Gina Häußge 41e9d96815 Use pip instead of python setup.py develop in CLI for plugin install
Apparently python setup.py develop tries to re-install all scripts
provided by plugins (maybe only under Windows?). Since that includes
OctoPrint's own executable, things will explode with an access denied
error there. Switching over to pip install -e . fixes that, and also
is more conform with the install approach the plugin will take in
production anyhow.
2017-04-07 09:15:05 +02:00
Gina Häußge 09d1025dfc Use blacklisting instead of whitelisting for checking daemon support
Just to be on the safe side... This is _exactly_ the same behaviour
as it was under 1.2.x again.
2017-04-06 10:02:48 +02:00
Gina Häußge 299f9c4a26 Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/plugins/pluginmanager/__init__.py
2017-04-04 15:28:28 +02:00
Gina Häußge 163fd83bf5 PGMR: Detect necessity to reinstall
So far using the "... from URL" or "... from an uploaded archive"
mechanism for installing a plugin would fail without further
information if the plugin to be installed was already installed.

The plugin manager will now detect this situation by parsing the
corresponding message from the pip output and trigger a reinstall
instantly.

A message about this will be logged to octoprint.log and the install
output.

Additionally the error handling for installation errors has been
slightly improved (install output no longer says "Done!" but "Error!"
with the reason as provided by the server) and the "could not install
plugin from URL unknown" issue should also be solved.
2017-04-04 15:18:37 +02:00
Gina Häußge e109bf0ca6 Fix: Make Printer.is_ready behave as advertised 2017-04-03 18:48:45 +02:00
Gina Häußge 4d324c5239 Fix unit tests 2017-04-03 18:47:27 +02:00
Gina Häußge 8cbf5a74b3 Fix analysis backlog calculation for specific path on storage
We need to convert the provided path into a local storage one first,
otherwise the following scandir calls will fall on their faces.
2017-04-03 17:18:26 +02:00
Gina Häußge b24851ca05 New events: FileAdded, FileRemoved, FolderAdded, FolderRemoved
Closes #1092
2017-04-03 15:50:23 +02:00
Gina Häußge 1219939189 Add missing dependency
Closes #1850
2017-04-03 09:43:07 +02:00
Gina Häußge d72c7c144e Make octoprint_client support multiple instances
Adjusted cli implementation accordingly
2017-03-31 18:48:13 +02:00
Gina Häußge 5c0a564592 PMGR: Better handling of plugins disabled on the repo
Switched button from "Incompatible" to "Disabled", added link to
plugin page on repo with the prominent alert box explaining the
reason for disabling.
2017-03-31 17:55:18 +02:00
Gina Häußge d27dd26a61 PMGR: Also allow filtering notices against affected OctoPrint versions 2017-03-31 17:32:41 +02:00
Gina Häußge 52633d0433 PMGR: Support for plugin notices
Evaluates json data file as e.g. published on
plugins.octoprint.org/notices.json and displays notices for plugins
installed and matching (optional) version lists.
2017-03-31 16:52:48 +02:00
Gina Häußge ea3b7ab1da Update pnotify to version 2.1.0, incl. all modules 2017-03-31 15:22:59 +02:00
Gina Häußge a01b9fe8d4 Disable reload button and show spinner on click 2017-03-30 15:50:32 +02:00
Gina Häußge f1cf482919 Adjusted metadata of bundled plugins 2017-03-30 14:09:12 +02:00
Gina Häußge 18e14aa412 Support "disabling unrecommended" for bundled plugins
* Extended plugin metadata by new property, only evaluated for bundled
    plugins.
  * Adjusted plugin manager to evaluate new metadata and add
    confirmation dialog with details when attempting to disable such
    a plugin.
2017-03-30 14:08:47 +02:00
Gina Häußge c3ad1d3691 Announcements: Various improvements
* Added combined OctoBlog feed, replacing news + spotlight (+
    octoprintonair), added corresponding config migration
  * Subscribe to all registered feeds by default
  * Added config button to announcement reader
  * Added note how to edit announcement subscriptions to notifications
  * Auto-hide announcements on logout
  * Order channels server-side based on new order config setting
2017-03-30 12:40:57 +02:00
Gina Häußge 35d9775e51 Limit verbosity of failed system event handlers 2017-03-30 11:37:46 +02:00
Gina Häußge fda67f48ff Allow users to ignore update notification & setting to disable outright
Old default behaviour of showing logged in users the update
notification stays default, but can now be disabled via the software
update plugin settings.

Additionally added the ignore button to the notification for users as
well (and made ignore entry in local storage user specific to still
show notification to other logged in users), plus a small hint that
in order to apply updates an admin is needed. Additionally now hiding
the notification on log out.

Closes #1739
2017-03-29 14:47:49 +02:00
Gina Häußge e97c9f954d Early validation of file to select for printing & better documentation
See #1843
2017-03-29 11:53:16 +02:00
Gina Häußge 01ad9b8b14 Fix order of PrintCancelled and PrintFailed event
Closes #1836
2017-03-27 17:42:07 +02:00
Gina Häußge 2d105517c9 Synchronized access to selected file in printer implementation
Should solve #1837
2017-03-27 16:48:43 +02:00
Gina Häußge 41d8b3476c Added safe mode section to ticket template 2017-03-27 15:25:45 +02:00
Gina Häußge 97b2a02926 Fix message catchall * not working in socket clientlib 2017-03-24 16:56:11 +01:00
Gina Häußge 517fd6f3ab Auto detect Malyan firmware and configure comm layer
Should close #1762
2017-03-24 16:55:54 +01:00
Gina Häußge fb2f9ba593 Added note on lack of language pack repo & to use the wiki 2017-03-22 16:50:33 +01:00
Gina Häußge 3ec2d7bd14 Delete confirmation & bulk delete for timelapses
Also introduced a new helper, a progress modal that can be used for
providing feedback about things such as bulk delete operations in the
background.

See #748 and discussion in #1807
2017-03-22 16:28:33 +01:00
Gina Häußge 675a54aa05 Fix filter parameter and force parameter on /api/files/<origin> 2017-03-21 13:15:43 +01:00
Gina Häußge 880b99faaf Better feedback of current vs selected profile & available actions
Also part of fixing core reason of #1734
2017-03-21 10:43:45 +01:00
Gina Häußge 5535a9aeb0 Handle default printer profile like all other profiles
It now resides in a file on disk and can be deleted. If the profile
configured as default is not available (e.g. due to having been
manually deleted, or on first start), the default profile as defined
in the profile manager will be written as _default and that will be
used/set as default.

On first start after this change gets applied, OctoPrint will migrate
the old "default overlay" residing in config.yaml to a file on disk
and delete the old entries in config.yaml.

Solves core reason of #1734
2017-03-20 18:33:13 +01:00
Gina Häußge 3bc77ffe3d Always merge with basic default profile 2017-03-20 13:18:39 +01:00
Gina Häußge 896aad3ab0 Migrate printer profile before saving as well
We want to make sure that externally added profiles are up to current
format.
2017-03-20 13:18:39 +01:00
Claudiu Ceia 01e970553f Fix typo: Celcius to Celsius (#1826) 2017-03-20 10:26:53 +01:00
Gina Häußge 5c27e974fb Merge branch 'maintenance' into devel 2017-03-19 10:53:58 +01:00
Gina Häußge 6613d580f2 Support daemon mode on linux AND freebsd 2017-03-19 10:53:44 +01:00
Gina Häußge 53bd4b1ea9 Merge branch 'maintenance' into devel 2017-03-16 18:10:38 +01:00
Gina Häußge ac6900ffb6 REALLY remove "Hide empty folders" m)
See #1671
2017-03-16 16:33:58 +01:00
Gina Häußge 6465b58384 maintenance branch is now 1.3.3.dev 2017-03-16 15:18:46 +01:00
Gina Häußge fa73fd3c14 Merge branch 'master' into maintenance
# Conflicts:
#	src/octoprint/server/api/settings.py
#	src/octoprint/settings.py
2017-03-16 15:16:52 +01:00
Gina Häußge 13714dc8d9 Enable save button when marking "save as default" 2017-03-16 11:25:53 +01:00
Gina Häußge 5a6edefec1 Slight rewording 2017-03-16 11:25:48 +01:00
ntoff 87be930a68 timelapse tab unsaved warning and rearrange interval input box
Addition of a notification under the save button when there are unsaved
changes, and a notice under the save as default checkbox when unticked,
that changes are only temporary.

Also move the "interval" box up the top to position it underneath the
timelapse type dropdown list, and change the text to be a bit more
descriptive.

(cherry picked from commit 381a016)
2017-03-15 12:47:47 +01:00
Gina Häußge 627d11fa51 Remove some redundance & return 400 on all wrong option values 2017-03-14 17:25:39 +01:00
Gina Häußge 315a80a7a7 Fix wrong default value for postroll
Closes #1821
2017-03-14 17:25:13 +01:00
Gina Häußge 3d10fff7de Merge branch 'maintenance' into devel 2017-03-13 17:48:49 +01:00
Gina Häußge 1b91790f5f Merge branch 'fix/fileAccessRaceCondition' into maintenance 2017-03-13 17:14:14 +01:00
Gina Häußge 3e5923b21e Consolidate API Key handling
System wide API key now offers a generate button like the user
API keys. Setting the API key directly to a value via the settings API
endpoint is now no longer possible, which should prevent setting it
accidentally thanks to the browser prefilling things where it shouldn't.

No delete button is offered for the system wide API key since it will
get automatically regenerated on server start if not set, so
regeneration is the only functionality here that makes sense.

If no API key is set in the user settings, the "delete" button is now
disabled. If a key is already set and a new one is to be generated, a
confirmation dialog makes sure this is really what the user wants. Same
for deleting an existing API key.

Both the system wide API key and the user specific API keys will now
only display a QRCode if there's actually a value for the key.
2017-03-13 17:09:56 +01:00
Gina Häußge c1fdbaa1e7 Force refresh of settings on login/logout
Our access rights might have changed, so let's make sure our
view of the settings is up to date.
2017-03-13 17:07:27 +01:00
Gina Häußge 8107d65504 Merge branch 'maintenance' into devel 2017-03-09 18:44:54 +01:00
Gina Häußge 9a4cebfb61 Merge branch 'maintenance' into devel 2017-03-09 12:04:35 +01:00
Shawn Bruce 5c81833415 Only reset scroll position for settings content. (Fixes #1812) 2017-03-08 14:16:17 -05:00
Gina Häußge d88ca50de0 Merge branch 'maintenance' into devel 2017-03-08 18:11:54 +01:00
Andy Werner b75b53d05a Fix an issue in user settings
* 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
2017-03-07 10:35:33 +01:00
Marc Hannappel c2cae5b2fc Added ability to give a description to groups 2017-03-01 11:47:23 +01:00
Gina Häußge 30e962b447 Merge branch 'maintenance' into devel 2017-02-24 15:28:01 +01:00
Gina Häußge f710bb535e Merge branch 'devel' into pr/kevans91/dep-up 2017-02-21 16:41:02 +01:00
Gina Häußge 814b02900b Fixed a test left-over
Thanks for the heads-up @kevans91
2017-02-21 16:39:51 +01:00
Gina Häußge 4958353335 Fix repr for User and SessionUser 2017-02-21 14:00:50 +01:00
Gina Häußge 9884c52c4e Upgrade to current versions again 2017-02-21 13:23:52 +01:00
Gina Häußge 0cd4fc8655 Enable template auto reload by default
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.
2017-02-21 13:21:42 +01:00
Gina Häußge 5d07c5a0b2 Updated mirrored methods of custom tornado http server
Should now be up to date with stock implementation again.
2017-02-21 13:21:18 +01:00
Gina Häußge cf20b3a3c3 flask.ext.foo => flask_foo for things new on devel 2017-02-21 13:19:44 +01:00
Gina Häußge dbe4acd47d flask.request.json => flask.request.get_json()
Old property is deprecated as of Flask 0.11
2017-02-21 13:18:59 +01:00
Gina Häußge b7a0f5bee5 Compatibility layer for plugins depending on user.is_anonymous() etc
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
2017-02-21 12:24:21 +01:00
Gina Häußge 0adb62b485 Compatibility layer for plugins depending on flask.ext
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
2017-02-21 11:56:31 +01:00
Gina Häußge a439608fe7 Merge pull request #1786 from ghulands/safari_fix
Issue #1780: Safari Webcam Fix.
2017-02-21 09:17:05 +01:00
Greg Hulands e82efd24d3 Issue #1780: Safari Webcam Fix. 2017-02-20 11:02:07 -08:00
Gina Häußge 3d1f3ed068 Merge branch 'dep-up' of https://github.com/kevans91/OctoPrint into pr/kevans91/dep-up 2017-02-20 14:48:59 +01:00
Gina Häußge bac972de53 Merge branch 'maintenance' into devel 2017-02-20 14:34:42 +01:00
Marc Hannappel 95310991b8 Merge branch 'devel' of github.com:foosel/OctoPrint into dev/permission 2017-02-17 14:15:51 +01:00
Marc Hannappel f60a759dca Some Refactorings to the Granular Permission System 2017-02-17 13:57:02 +01:00
Gina Häußge 4f6f829dc3 Merge branch 'maintenance' into devel 2017-02-17 13:49:56 +01:00
Marc Hannappel 8962ebd175 More wor done on the Encoder/Decoder part, additionally cherry-picked the Update flask commit from @kevans91 2017-02-15 17:00:52 +01:00
Kyle Evans 218b3c87db Cherry-picked
Update flask, flask-{login,principal,babel,assets} versions to the latest, flask.ext. => flask_
2017-02-15 16:47:58 +01:00
Marc Hannappel c12a0f8cdf Added OctoPrintJson Encoder and Decoder 2017-02-13 16:32:41 +01:00
Gina Häußge 4a41ccb4e6 Merge pull request #1768 from eyal0/same_device_view_model
add sameDevice to SlicingViewModel
2017-02-13 12:50:53 +01:00
Marc Hannappel 0d1f53d58d Moved Yaml Representer and Constructors into src/octoprint/util/yaml.py 2017-02-13 11:56:24 +01:00
Eyal Soha fea07917fa add sameDevice to SlicingViewModel 2017-02-12 12:35:57 +02:00
Gina Häußge 003c2e0dca Merge pull request #1748 from eyal0/add_same_device_to_slicing_api
Add sameDevice to api/slicing API
2017-02-08 11:49:52 +01:00
Eyal Soha ce38ef6289 add same device to the slicing API 2017-02-02 10:47:41 +02:00
Gina Häußge 2457c58817 Merge branch 'maintenance' into devel 2017-01-25 12:55:29 +01:00
Gina Häußge ab6dd66bad Merge branch 'maintenance' into devel 2017-01-25 12:51:45 +01:00
Gina Häußge d430fe35c5 Merge branch 'maintenance' into devel 2017-01-20 16:29:08 +01:00
Gina Häußge 6d1e28ae9c We still need _read_lines after all in the streamed file info 2017-01-18 13:04:01 +01:00
Gina Häußge 1e482369b8 Further synchronization in comm layer
Prevent concurrent sending of commands from the monitor thread for
incoming ok's while processing the start, pause, resume or cancel
of a print job.
2017-01-18 12:58:38 +01:00
Gina Häußge a6c4f8ba3b Fix potential race condition on print start
When the sending of the first line of a file to print is still taking
place while an "ok" from the firmware comes in, it's possible
that two threads will try to access the file handle in parallel. That
can lead to trouble within Python's codecs module.

Synchronizing all access to the handle should do the trick.
2017-01-17 17:46:20 +01:00
Gina Häußge 9650c71155 Merge branch 'maintenance' into devel
# Conflicts:
#	AUTHORS.md
2017-01-13 15:12:25 +01:00
Marc Hannappel 95da7551d2 Added the possibility to set default Groups and fixed a typo 2017-01-13 14:47:18 +01:00
Marc Hannappel 667473f90e Merge branch 'devel' of github.com:foosel/OctoPrint into dev/permission 2017-01-13 12:41:55 +01:00
Gina Häußge cf9e17ebfd Merge branch 'maintenance' into devel 2017-01-12 19:05:15 +01:00
Gina Häußge ec55909305 Merge branch 'devel' of github.com:foosel/OctoPrint into devel 2017-01-11 12:17:12 +01:00
Gina Häußge 3e03f7c12a Merge branch 'maintenance' into devel 2017-01-11 12:15:07 +01:00
Gina Häußge edc2005b2c Merge pull request #1703 from noahsmartin/nm/pollingComment
Changed old comments to not claim a method does more than it really does
2017-01-11 11:17:49 +01:00
Noah Martin 72f3fa6eda Changed old comments to not claim a method does more than it really does, because comments are there to clear up confusion, might as well start here.
poll_temperature and poll_sd_status are called by a RepeatedTimer now, the methods don't re-enqueue themselves.
2017-01-10 23:36:55 -08:00
Gina Häußge 48c02c6f55 Merge pull request #1665 from jammi/ttySfix
Octoprint /dev/ttyS* addition
2017-01-09 17:10:32 +01:00
Gina Häußge 8b7643332b Merge branch 'devel' of github.com:foosel/OctoPrint into devel 2017-01-09 16:38:44 +01:00
Kyle Evans 639619ff93 Partially revert 57de36a 2017-01-09 08:51:52 -06:00
Kyle Evans 0a08ef0ed4 Merge branch 'devel' into dep-up 2016-12-27 23:46:39 -06:00
Marc Hannappel b3f35c579b Little update to the active tab using hash from URL, forgot to add a check if the hash is valid, fixed this now 2016-12-21 10:56:11 +01:00
Marc Hannappel bcb74d01b6 Added active tab using hash from URL feature, as requested in issue #203 2016-12-21 10:51:19 +01:00
Marc Hannappel 8a8b88af13 Fix folders doesn't get listed when performing a filtering in file section, issue #1667 2016-12-21 09:44:24 +01:00
Marc Hannappel 58ed405c88 Fix Files not shown when user logged in, if guest user had no permission to view files 2016-12-21 09:33:23 +01:00
Marc Hannappel a3d4f80599 Add GuestUser to handle guest permission, fix some missing braces 2016-12-21 09:06:18 +01:00
Marc Hannappel 7bfd55f3f0 Fix admin und guest group 2016-12-21 09:02:38 +01:00
Juha-Jarmo Heinonen 153b5de1d4 Added /dev/ttyS* into serial ports to find.
OctoPrint was unable to find any of the serial ports on my CubieBoard, which are all ttyS devices; this fixes that issue.
2016-12-19 20:49:23 +02:00
Marc Hannappel 932b7a094d Added manually edited octopint.css file 2016-12-19 11:15:35 +01:00
Marc Hannappel 47b8c661e7 Changed a few more isAdmin to new Permissions.SETTINGS, started implementing the Groupsystem, refactored a few things with the Permissions 2016-12-16 14:27:41 +01:00
Marc Hannappel 3bb0f51d08 Ugly fix for Temperature graph not displayed correctly 2016-12-12 13:41:56 +01:00
Marc Hannappel 32fc5ccd3e Fix a bug with gcode_viewer, make loginState.hasPermission commands pureComputedObservables 2016-12-12 13:40:48 +01:00
Marc Hannappel 4f3cba32da Initial work for Granular Permission System, actually only per User Permission, Group system still needs to be programmed 2016-12-12 09:17:47 +01:00
Kyle Evans b2c60ba884 Rebase to devel now that 1.3.0 has released 2016-12-08 08:56:40 -06:00
Gina Häußge a2323a7bb2 Merge branch 'devel' into dev/commRefactoringNG
# Conflicts:
#	setup.py
#	src/octoprint/plugins/virtual_printer/virtual.py
#	src/octoprint/printer/__init__.py
#	src/octoprint/printer/standard.py
#	src/octoprint/util/__init__.py
2016-12-08 14:37:12 +01:00
Kyle Evans 537ed2d11f Rebase to devel 2016-11-27 00:32:38 -06:00
Kyle Evans f318cc5e28 Update 970880d, flask.ext.login -> flask_login 2016-11-10 13:12:02 -06:00
Kyle Evans 1001cc607e Merge branch 'devel' into dep-up 2016-11-10 12:37:21 -06:00
Kyle Evans 35d480bc48 Clean up bogus whitespace changes/inconsistency 2016-10-25 21:36:47 -05:00
Kyle Evans 37f51ef983 Botched the initial Flask-Login update -- is_active(), is_authenticated(), and is_anonymous() got converted into properties, so we should do the same 2016-10-07 11:37:36 -05:00
Kyle Evans 943d7ce31a Update Click 2016-10-06 21:35:43 -05:00
Kyle Evans bc54ddf19f Update psutil 2016-10-06 21:25:48 -05:00
Kyle Evans 7d091d18ee Update semantic_version 2016-10-06 21:19:54 -05:00
Kyle Evans 599e24634c Update requests 2016-10-06 21:16:31 -05:00
Kyle Evans e998edd083 Update pkginfo 2016-10-06 21:12:46 -05:00
Kyle Evans e15ca55558 Update rsa 2016-10-06 21:11:33 -05:00
Kyle Evans 23a2801284 Update pyserial 2016-10-06 21:08:45 -05:00
Kyle Evans 9a6da3f46f Update PyYAML 2016-10-06 21:03:29 -05:00
Kyle Evans fbb881bb42 Update Tornado, adapt CustomHTTPServer to new usage 2016-10-06 21:00:14 -05:00
Kyle Evans 87d65c150b Update werkzeug 2016-10-06 20:30:12 -05:00
Kyle Evans bb2fcd5b00 Update flask, flask-{login,principal,babel,assets} versions to the latest, flask.ext. => flask_ 2016-10-06 20:25:04 -05:00
Gina Häußge cfe8b1a764 Experimenting with a real printer 2016-02-15 09:43:50 +01:00
Gina Häußge aee1dff718 Trying to get disconnecting to work reliably 2016-02-12 08:51:14 +01:00
Gina Häußge 54bd41903b Merge branch 'devel' into dev/commRefactoringNG 2016-02-11 13:46:58 +01:00
Gina Häußge c813df9afe Do not hiccup if listener to remove isn't registered 2016-02-11 08:46:47 +01:00
Gina Häußge e312f66823 We depend on pyserial 3 in this branch... 2016-02-11 08:34:55 +01:00
Gina Häußge 648c10c91f Merge branch 'devel' into dev/commRefactoringNG
Conflicts:
	src/octoprint/printer/__init__.py
	src/octoprint/printer/standard.py
2016-02-10 16:54:15 +01:00
Gina Häußge 2cf902c6c3 Stupid typos are stupid 2016-02-08 11:28:20 +01:00
Gina Häußge 26934fae02 Printing more or less works against the virtual printer 2016-02-05 16:19:36 +01:00
Gina Häußge 74ba9364f4 First attempt at connecting with existing architecture 2016-02-04 18:39:50 +01:00
Gina Häußge 18222420ee Merge branch 'devel' into dev/commRefactoringNG 2016-02-04 14:11:35 +01:00
Gina Häußge 89a37766df Minimal job queue in test code, first local file print 2016-01-30 12:08:31 +01:00
Gina Häußge cf02471db7 More work on getting to the point where printing might work
Status reporting, timeout handling, parsing etc... lots of work
2016-01-29 21:16:13 +01:00
Gina Häußge ff9b7de615 Introduced jobs, more work on protocols and transports 2016-01-29 09:02:35 +01:00
Gina Häußge b7ad8faaee WIP 2016-01-27 14:34:00 +01:00
Gina Häußge 34facfe764 WIP 2016-01-22 12:05:17 +01:00
Gina Häußge c83b6288aa Started implementation of Protocol type hierarchy 2016-01-20 13:03:34 +01:00
Gina Häußge b66f86de71 Renamed url_scheme property to key 2016-01-19 11:59:29 +01:00
Gina Häußge 581cd19446 Starting work on a better version of the comm refactoring 2016-01-16 16:35:31 +01:00
611 changed files with 76920 additions and 25724 deletions

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ trim_trailing_whitespace = true
[**.py]
indent_style = tab
indent_size = 4
[src/octoprint/static/js/app/**.js]
indent_style = space
-90
View File
@@ -1,90 +0,0 @@
READ THE FOLLOWING FIRST:
If not already done, please read the "guidelines for contributing"
that are linked ^-- just up there in the big yellow box. Also read
the FAQ: https://github.com/foosel/OctoPrint/wiki/FAQ.
This is a bug and feature tracker, please only use it to report bugs
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 ..."), that belongs on
the mailing list or the G+ community (both linked in the "guidelines
for contributing" linked above, read it!), NOT here.
Mark requests with a "[Request]" prefix in the title please. Fully fill
out the bug reporting template for bug reports (if you don't know where
to find some information - it's all described in the contribution
guidelines linked up there in the big yellow box).
When reporting a bug do NOT delete any lines from the template but
those enclosed in [ and ] - and those please DO delete, they are
only provided for your information and removing them makes your
ticket more readable :)
Make sure any bug you want to repor tis still present with the CURRENT
OctoPrint version and that it does not vanish when you start OctoPrint
in safe mode - how to do that is also explained in the contribution
guidelines linked up there in the big yellow box.
Thank you!
(Before submitting your ticket, please delete this text up to and
including the line too - it's only here for you, we already know it
by heart ;))
----
#### What were you doing?
[Please describe the steps to reproduce your issue. 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.
If you encountered a problem with specific files of any sorts, make sure
to also include a link to a file with which to reproduce the problem.]
#### What did you expect to happen and what happened instead?
#### Branch & Commit or Version of OctoPrint
[Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.]
#### Operating System running OctoPrint
[OctoPi, Linux, Windows, MacOS, something else? With version please.]
#### Printer model & used firmware incl. version
[If applicable, always include if unsure.]
#### Browser and Version of Browser, Operating System running Browser
[If applicable, always include if unsure or reporting UI issues.]
#### Link to octoprint.log
[On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.]
#### Link to contents of terminal tab or serial.log
[On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting any kind of communication issues between OctoPrint and your printer.
Never truncate.
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log.]
#### Link to contents of Javascript console in the browser
[On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.]
#### Screenshot(s) or video(s) showing the problem:
[If applicable. Always include if unsure or reporting UI issues.]
I have read the FAQ.
+135
View File
@@ -0,0 +1,135 @@
---
name: Bug report
about: Create a report to help improve OctoPrint
---
<!--
READ THE FOLLOWING FIRST:
If not already done, please read the the Contribution Guidelines that
are linked to the right under "Helpful resources" > "Contributing".
Also read the FAQ: https://faq.octoprint.org
This is a bug and feature tracker, please only use it to report bugs
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
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
where to find some information - it's all described in the Contribution
Guidelines linked up there in the big yellow box).
When reporting a bug do NOT delete ANY lines from the template.
Make sure any bug you want to report is still present with the CURRENT
OctoPrint version and that it does not vanish when you start OctoPrint
in safe mode - how to do that is also explained in the Contribution
Guidelines linked up there in the big yellow box.
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.
Ideally provide exact steps to follow in order to reproduce your problem:
-->
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
<!--
If you encountered a problem with specific files of any sorts, make sure
to also include a link to a file with which to reproduce the problem.
-->
#### What did you expect to happen?
#### What happened instead?
#### 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.
If you can't reproduce in safe mode, this is a bug with one of your
installed third party plugins. Don't open a ticket here!
If you can't test this in safe mode, state why.
-->
#### Version of OctoPrint
<!--
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
-->
#### Operating System running OctoPrint
<!--
OctoPi, Linux, Windows, MacOS, something else? With version please.
OctoPi's version can be found in /etc/octopi_version or in the lower left
corner of the web interface.
-->
#### Printer model & used firmware incl. version
<!--
If applicable, always include if unsure.
-->
#### Browser and version of browser, operating system running browser
<!--
If applicable, always include if unsure.
-->
#### Link to octoprint.log
<!--
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
The Contribution Guidelines tell you where to find that.
-->
#### Link to contents of terminal tab or serial.log
<!--
On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting communication issues. Never truncate.
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log (which the Contribution Guidelines tell you where to find).
-->
#### Link to contents of Javascript console in the browser
<!--
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.
The Contribution Guidelines tell you where to find that.
-->
#### Screenshot(s)/video(s) showing the problem:
<!--
If applicable. Always include if unsure or reporting UI issues.
-->
I have read the FAQ.
+21
View File
@@ -0,0 +1,21 @@
---
name: Feature request
about: Suggest an idea for this project
---
<!--
Please make sure to add [Request] to your issue's title. Thank you!
-->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+10 -8
View File
@@ -1,3 +1,4 @@
<!--
Thank you for your interest into contributing to OctoPrint, it's
highly appreciated!
@@ -7,6 +8,7 @@ as well that contains important information.
As a summary, please make sure you have ticked all points on this
checklist:
-->
* [ ] Your changes are not possible to do through a plugin and relevant
to a large audience (ideally all users of OctoPrint)
@@ -16,12 +18,13 @@ checklist:
Brainstorming ticket
* [ ] Your PR targets OctoPrint's devel branch, or maintenance if it's
a bug fix for an issue present in the current stable version (no PRs
against master or anything else)
against master or anything else please)
* [ ] Your PR was opened from a custom branch on your repository
(no PRs from your version of master, maintenance or devel please),
e.g. dev/my_new_feature
e.g. dev/my_new_feature or fix/my_bugfix
* [ ] Your PR only contains relevant changes: no unrelated files,
no dead code, ideally only one commit - rebase your PR if necessary!
no dead code, ideally only one commit - rebase and squash your PR
if necessary!
* [ ] Your changes follow the existing coding style
* [ ] If your changes include style sheets: You have modified the
.less source files, not the .css files (those are generated with
@@ -32,11 +35,10 @@ checklist:
nothing broke
* [ ] You have added yourself to the AUTHORS.md file :)
Feel free to delete all this help text, then describe
your PR further. You may use the template provided below to do that.
The more details the better!
----
<!--
Describe your PR further using the template provided below. The more
details the better!
-->
#### What does this PR do and why is it necessary?
+3
View File
@@ -31,9 +31,12 @@ OctoPrint.egg-info
*.codekit
venv
venv2
venv3
venv26
venv27
venv33
venv34
venv35
venv36
venv37
+11 -1
View File
@@ -1,12 +1,22 @@
---
language: python
dist: xenial
matrix:
include:
- python: '3.7'
env: RUN_FLAKE8=true
python:
- "3.7"
- "3.6"
- "2.7"
install:
- pip install -e .[develop]
script:
- nosetests --with-doctest
- test -n "$RUN_FLAKE8" || pytest
- test -z "$RUN_FLAKE8" || flake8 --ignore=D,E,W,F401 src/ tests setup.py
sudo: false
git:
depth: 250
+12 -5
View File
@@ -7,20 +7,27 @@
# The file is processed from top to bottom, the first matching line wins. If <tag> or <reference commit> are left out,
# the lookup table does not apply to the matched branches
# master and rc shall not use the lookup table, only tags
# master, meta, rc and prerelease shall not use the lookup table, only tags
master
meta/.*
rc/.*
hotfix/.*
prerelease
# neither should disconnected checkouts, e.g. 'git checkout <tag>'
HEAD
\(detached.*
# maintenance is currently the branch for preparation of maintenance release 1.3.2
# maintenance is currently the branch for preparation of maintenance release 1.3.12
# so are any fix/... and improve/... branches
maintenance 1.3.2 6393de8c7d42a8bbddcab7cdbb6530ea88a8c82d pep440-dev
fix/.* 1.3.2 6393de8c7d42a8bbddcab7cdbb6530ea88a8c82d pep440-dev
improve/.* 1.3.2 6393de8c7d42a8bbddcab7cdbb6530ea88a8c82d pep440-dev
maintenance 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
fix/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
improve/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
# staging/maintenance is currently the branch for preparation of 1.3.11rc4
# so is regressionfix/...
staging/maintenance 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev
regressionfix/.* 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
+30 -4
View File
@@ -1,6 +1,6 @@
# Authors
The following people have contributed to OctoPrint's code base (ordered by
The following people have contributed to OctoPrint's code base (ordered roughly by
date of first contribution):
* [Gina Häußge](https://github.com/foosel)
@@ -61,24 +61,50 @@ date of first contribution):
* [Siim Raud](https://github.com/2ndalpha)
* ["geoporalis"](https://github.com/geoporalis)
* [Andrew Malota](https://github.com/2bitoperations)
* [Alexander Leisentritt](https://github.com/Alex9779)
* [therealbstern](https://github.com/therealbstern)
* [Ishwar Agarwal](https://github.com/agarwali)
* [Kye Hoover](https://github.com/eykrevooh)
* [Joseph Carrick](https://github.com/carricktel)
* [Alexander Leisentritt](https://github.com/Alex9779)
* [therealbstern](https://github.com/therealbstern)
* [Philipp Baum](https://github.com/philphilphil)
* [Kyle Evans](https://github.com/kevans91)
* [Javier Martínez Arrieta](https://github.com/Javierma)
* ["MirceaDan"](https://github.com/ByReaL)
* [Mircea Dan Gheorghe](https://github.com/ByReaL)
* [Ovidiu Hossu](https://github.com/MoonshineSG)
* [Eyck Jentzsch](https://github.com/eyck)
* [Mathias Rangel Wulff](https://github.com/mathiasrw)
* [Clemens Niemeyer](https://github.com/clemniem)
* ["I-am-me"](https://github.com/I-am-me)
* [J-J Heinonen](https://github.com/jammi)
* [Noah Martin](https://github.com/noahsmartin)
* [Eyal Soha](https://github.com/eyal0)
* [Greg Hulands](https://github.com/ghulands)
* [Andreas Werner](https://github.com/gallore)
* [Shawn Bruce](https://github.com/kantlivelong)
* [Claudiu Ceia](https://github.com/ClaudiuCeia)
* [Goswin von Brederlow](https://github.com/mrvn)
* [Luke McKechnie](https://github.com/galamdring)
* [Peter Backx](https://github.com/pbackx)
* [Josh Major](https://github.com/astateofblank)
* ["alex-gh"](https://github.com/alex-gh)
* [Bernd Zeimetz](https://github.com/bzed)
* [Daniele Forsi](https://github.com/dforsi)
* [Ganey](https://github.com/ganey)
* [Sven Lohrmann](https://github.com/malnvenshorn)
* [Andy Castille](https://github.com/klikini)
* [Zachary Nofzinger](https://github.com/ZachNo)
* [Gaston Dombiak](https://github.com/gdombiak)
* [Brad Fisher](https://github.com/bradcfisher)
* [Aldo Hoeben](https://github.com/fieldofview)
* [Henning Groß](https://github.com/hgross)
* [Jubaleth](https://github.com/jubaleth)
* [Matthias Urlichs](https://github.com/smurfix)
* [Daniel Joyce](https://github.com/DanielJoyce)
* [Andy Qua](https://github.com/AndyQ)
* [Fabio Santos](https://github.com/Fabi0San)
* [Jack Wilsdon](https://github.com/jackwilsdon)
* [Ryan Finnie](https://github.com/rfinnie)
* [Timur Duehr](https://github.com/tduehr)
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
[Daid Braam](https://github.com/daid). Parts of its communication layer and
+888 -1015
View File
File diff suppressed because it is too large. Load diff
+183 -111
View File
@@ -21,45 +21,41 @@ or **[creating pull requests](#pull-requests)**.
## Issues, Tickets, however you may call them
Please read the following short instructions fully and follow them. You can
Please read the following instructions fully and follow them. You can
help the project tremendously this way: not only do you help the maintainers
to **address problems in a timely manner** but also keep it possible for them
to **fix bugs, add new and improve on existing functionality** instead of doing
nothing but ticket management.
![Ticket flow chart](http://i.imgur.com/qYSZyuw.png)
![Ticket flow chart](https://i.imgur.com/cw19qHX.png)
- **[Read the FAQ](https://github.com/foosel/OctoPrint/wiki/FAQ)**
- **[Read the FAQ](https://faq.octoprint.org)**
- If you want to report a **bug**, [read "How to file a bug report" below](#how-to-file-a-bug-report)
and *[use the provided template](#what-should-i-include-in-a-ticket)*.
You do not need to do anything else with your ticket.
- If you want to post a **feature request** or a **documentation request**, add `[Request]`
to your issue's title (e.g. `[Request] Awesome new feature`). A question on how to run/change/setup
something is **not** what qualifies as a request here, use the
[Mailinglist](https://groups.google.com/group/octoprint) or the
[Google+ Community](https://plus.google.com/communities/102771308349328485741) for
[community forum at community.octoprint.org](https://community.octoprint.org) for
such support issues.
- If you are a **developer** that wants to brainstorm a pull request or possible
changes to the plugin system, add [Brainstorming] to your issue's title (e.g.
`[Brainstorming] New plugin hook for doing some cool stuff`).
changes to the plugin system, please get in touch on the
[community forum at community.octoprint.org](https://community.octoprint.org/c/development).
- If you need **support**, have a **question** or some **other reason** that
doesn't fit any of the above categories, the issue tracker is not the right place.
Consult the [Mailinglist](https://groups.google.com/group/octoprint) or the
[Google+ Community](https://plus.google.com/communities/102771308349328485741) instead.
Consult the [community forum at community.octoprint.org](https://community.octoprint.org/c/support) instead.
No matter what kind of ticket you create, never mix two or more "ticket reasons"
into one ticket: One ticket per bug, request, brainstorming thread please.
----
**Note**: A bot is in place that monitors new tickets, automatically
categorizes them and checks new bug reports for usage of the provided template.
That bot will only bother you if you open a ticket that appears to be a bug (no
`[Request]` or `[Brainstorming]` in the title) without the template, and it
will do that only to ensure that all information needed to solve the issue is
available for the maintainers to directly start tackling that problem.
----
> 👉 **Note**
>
> A bot is in place that monitors new tickets, automatically
> categorizes them and checks new bug reports for usage of the provided template.
> That bot will only bother you if you open a ticket that appears to be a bug (no
> `[Request]` in the title) without the complete template, and it
> will do that only to ensure that all information needed to solve the issue is
> available for the maintainers to directly start tackling that problem.
## How to file a bug report
@@ -72,22 +68,25 @@ following section *completely* and also follow the instructions in the
### What should I do before submitting a bug report?
1. **Make sure you are at the right location**. This is the Github repository
1. **Make sure you are at the right location**. This is the bug tracker
of the official version of OctoPrint, which is the 3D print server and
corresponding web interface itself.
**This is not the Github respository of OctoPi**, which is the preconfigured
**OctoPrint doesn't manage your network connection or your webcam nor
can it fix your printer not getting detected as a serial interface** -
if you have any kinds of problems with that, get in touch on the
[community forum](https://community.octoprint.org).
**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). Please note that while we do have
some entries regarding OctoPi in the FAQ, any bugs should be reported in the
[proper bug tracker](https://github.com/guysoft/OctoPi/issues) which - again -
is not here.
[here](https://github.com/guysoft/OctoPi). If you have any kind of specific
issue with how the OctoPi system is setup, go there please.
**This is also not the Github repository of any OctoPrint Plugins you
**This is also not the bug tracker of any OctoPrint Plugins you
might have installed**. Report any issues with those in their corresponding
bug tracker (probably linked to from the plugin's homepage).
Finally, **this is also not the right issue tracker if you are running a
Finally, **this is also not the right bug tracker if you are running a
forked version of OctoPrint**. Seek help for such unofficial versions from
the people maintaining them instead.
@@ -101,7 +100,7 @@ following section *completely* and also follow the instructions in the
more about safe mode in the [docs](http://docs.octoprint.org/en/master/features/safemode.html).
You might also want to try the current development version of OctoPrint
(if you aren't already). Refer to the [FAQ](https://github.com/foosel/OctoPrint/wiki/FAQ)
(if you aren't already). Refer to the [FAQ](https://faq.octoprint.org)
for information on how to do this.
3. The problem still exists? Then please **look through the
@@ -111,8 +110,8 @@ following section *completely* and also follow the instructions in the
Sorting through duplicates of the same issue sometimes causes more work than
fixing it. Take the time to filter through possible duplicates and be really
sure that your problem definitely is a new one. Try more than one search query
(e.g. do not only search for "webcam" if you happen to run into an issue
with your webcam, also search for "timelapse" etc). Do not only read the subject lines
(e.g. do not only search for "timelapse" if you happen to run into an issue
with your webcam, also search for "recording" etc). Do not only read the subject lines
of tickets that look like they might be related, but also read the ticket itself!
**Very important:** Please make absolutely sure that if you find a bug that looks like
@@ -126,115 +125,161 @@ 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://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** (please remove what's within `[...]`, that's
only provided here as some additional information for you), **even if only adding a
"me too" to an existing ticket**:
**Always use the following template, even if only adding a "me too" to an
existing ticket**:
#### What were you doing?
```
<!--
READ THE FOLLOWING FIRST:
[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.
If not already done, please read the the Contribution Guidelines that
are linked to the right under "Helpful resources" > "Contributing".
If you encountered a problem with specific files of any sorts, make sure
to also include a link to a file with which to reproduce the problem.]
Also read the FAQ: https://faq.octoprint.org
#### What did you expect to happen?
This is a bug and feature tracker, please only use it to report bugs
or request features within OctoPrint (not OctoPi, not any OctoPrint
plugins and not unofficial OctoPrint versions).
#### What happened instead?
Do not seek support here ("I need help with ...", "I have a
question ..."), that belongs on the community forum at
community.octoprint.org, NOT here.
#### Branch & Commit or Version of OctoPrint
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
where to find some information - it's all described in the Contribution
Guidelines linked up there in the big yellow box).
[Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.]
When reporting a bug do NOT delete ANY lines from the template.
#### Printer model & used firmware incl. version
Make sure any bug you want to report is still present with the CURRENT
OctoPrint version and that it does not vanish when you start OctoPrint
in safe mode - how to do that is also explained in the Contribution
Guidelines linked up there in the big yellow box.
[If applicable, always include if unsure.]
Thank you!
-->
#### Browser and Version of Browser, Operating System running Browser
#### What were you doing?
[If applicable, always include if unsure.]
<!--
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.
#### Link to octoprint.log
Ideally provide exact steps to follow in order to reproduce your problem:
-->
[On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.]
1. ...
2. ...
3. ...
#### Link to contents of terminal tab or serial.log
<!--
If you encountered a problem with specific files of any sorts, make sure
to also include a link to a file with which to reproduce the problem.
-->
[On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting communication issues. Never truncate.
#### What did you expect to happen?
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log.]
#### What happened instead?
#### Link to contents of Javascript console in the browser
#### Did the same happen when running OctoPrint in safe mode?
[On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.]
<!--
Test if you can reproduce your problem in safe mode. You can find information
on how to enable safe mode in the Contribution Guidelines.
#### Screenshot(s) showing the problem:
If you can't reproduce in safe mode, this is a bug with one of your
installed third party plugins. Don't open a ticket here!
[If applicable. Always include if unsure or reporting UI issues.]
If you can't test this in safe mode, state why.
-->
I have read the FAQ.
#### Version of OctoPrint
Copy-paste this template **completely**. Do not skip any lines or the bot
*will* complain!
<!--
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
-->
#### Operating System running OctoPrint
<!--
OctoPi, Linux, Windows, MacOS, something else? With version please.
OctoPi's version can be found in /etc/octopi_version or in the lower left
corner of the web interface.
-->
#### Printer model & used firmware incl. version
<!--
If applicable, always include if unsure.
-->
#### Browser and version of browser, operating system running browser
<!--
If applicable, always include if unsure.
-->
#### Link to octoprint.log
<!--
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
The Contribution Guidelines tell you where to find that.
-->
#### Link to contents of terminal tab or serial.log
<!--
On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting communication issues. Never truncate.
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log (which the Contribution Guidelines tell you where to find).
-->
#### Link to contents of Javascript console in the browser
<!--
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.
The Contribution Guidelines tell you where to find that.
-->
#### Screenshot(s)/video(s) showing the problem:
<!--
If applicable. Always include if unsure or reporting UI issues.
-->
I have read the FAQ.
```
Copy-paste this template **completely** (or use the version that gets pre-filled
into the "new issue" form). Do not skip any lines or the bot *will* complain! Provide
all requested information or your ticket will be closed.
### Where can I find which version and branch I'm on?
You can find out all of them by taking a look into the lower left corner of the
OctoPrint UI:
![Current version and git branch info in OctoPrint's UI](http://i.imgur.com/HyHMlY2.png)
If you don't have access to the UI you can find out that information via the
command line as well. Either `octoprint --version` or `python setup.py version`
in OctoPrint's folder will tell you the version of OctoPrint you are running
(note: if it doesn't then you are running a version older than 1.1.0,
*upgrade now*). A `git branch` in your OctoPrint installation folder will mark
the branch you are on with a little *. `git rev-parse HEAD` will tell you the
current commit.
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?
OctoPrint by default provides two log outputs, a third one can be enabled if
more information is needed.
One is contained in the **"Terminal" tab** within OctoPrint's UI and is a log
of the last 300 lines of communication with the printer. Please copy-paste
this *completely* somewhere (disable auto scroll to make copying the contents easier) -
e.g. http://pastebin.com or http://gist.github.com - and include a link in
your bug report.
There is also **OctoPrint's application log file** or in short `octoprint.log`,
which is by default located at `~/.octoprint/logs/octoprint.log` on Linux,
`%APPDATA%\OctoPrint\logs\octoprint.log` on Windows and
`~/Library/Application Support/OctoPrint/logs/octoprint.log` on MacOS. You can
also access it directly through OctoPrint via Settings > Logs. Please
copy-paste this *completely* to pastebin or gist as well and include a link in your bug
report.
It might happen that you are asked to provide a more **thorough log of the
communication with the printer** if you haven't already done so, the `serial.log`.
This is not written by default due to performance reasons, but you can enable
it in the settings dialog. After enabling that log, please reproduce the problem
again (connect to the printer, do whatever triggers it), then copy-paste
`~/.octoprint/logs/serial.log` (Windows: `%APPDATA%\OctoPrint\logs\serial.log`,
MacOS: `~/Library/Application Support/OctoPrint/logs/serial.log`) to pastebin
or gist and include the link in the bug report.
You might also be asked to provide a log with an increased log level. You can
find information on how to do just that in the
[docs](http://docs.octoprint.org/en/master/configuration/logging_yaml.html).
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?
@@ -243,6 +288,8 @@ 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.
## Pull requests
@@ -254,7 +301,8 @@ See [the corresponding chapter in the documentation](http://docs.octoprint.org/e
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 open a "Brainstorming" ticket 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
@@ -264,7 +312,8 @@ See [the corresponding chapter in the documentation](http://docs.octoprint.org/e
3. Create your pull request **from a custom branch** on your end (e.g.
`dev/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: `maintenance` 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
5. Create **one pull request per feature/bug fix**.
6. Make sure there are **only relevant changes** included in your PR. No
@@ -283,7 +332,17 @@ See [the corresponding chapter in the documentation](http://docs.octoprint.org/e
* Make sure you do not add dead code (e.g. commented out left-overs
from experiments).
8. Ensure your changes **pass the existing unit tests**. PRs that break
those cannot be accepted.
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))
by running
```
nosetests --with-doctest
```
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
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
@@ -345,10 +404,16 @@ There are three main branches in OctoPrint:
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:
@@ -360,7 +425,7 @@ Those usually have one of the following prefixes:
* `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 couple of
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
@@ -405,6 +470,13 @@ the local version identifier to allow for an exact determination of the active c
* 2017-03-09: Allow PRs against `maintenance` branch for bugs in stable.
* 2017-03-10: Reproduce bugs in safe mode to make sure they are really caused
by OctoPrint itself and not a misbehaving plugin.
* 2017-03-27: Added safe mode section to ticket template.
* 2017-11-22: Added note on how to run the unit tests
* 2018-03-15: Link to new community forum and some clarifications re bug
reporting
* 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
## Footnotes
* [1] - If you are wondering why, the problem is that anything that you add
View File
File renamed without changes.
+37 -25
View File
@@ -1,35 +1,47 @@
# OctoPrint
[![GitHub version](https://badge.fury.io/gh/foosel%2FOctoPrint.svg)](https://badge.fury.io/gh/foosel%2FOctoPrint)
![GitHub release](https://img.shields.io/github/release/foosel/OctoPrint.svg?colorB=brightgreen)
[![Travis build status](https://img.shields.io/travis/foosel/OctoPrint.svg)](https://travis-ci.org/foosel/OctoPrint)
[![Discourse topics](https://img.shields.io/discourse/https/community.octoprint.org/users.svg)](https://community.octoprint.org)
[![IRC](https://img.shields.io/badge/chat-on%20irc-brightgreen.svg)](https://chat.octoprint.org)
[![Twitter Follow](https://img.shields.io/twitter/follow/OctoPrint3d.svg?style=social&label=Follow)](https://twitter.com/OctoPrint3d)
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](http://octoprint.org).
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme).
The official IRC channel is [#octoprint on freenode](https://chat.octoprint.org). Its logs can be found [here](https://freenode.logbot.info/octoprint).
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
The documentation is located at [docs.octoprint.org](http://docs.octoprint.org).
The official plugin repository can be reached at [plugins.octoprint.org](http://plugins.octoprint.org).
The official plugin repository can be reached at [plugins.octoprint.org](https://plugins.octoprint.org/?utm_source=github&utm_medium=readme).
OctoPrint's development wouldn't be possible without the [financial support by its community](http://octoprint.org/support-octoprint/).
If you enjoy OctoPrint, please consider becoming a regular supporter!
**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!**
![Screenshot](http://i.imgur.com/dF3noFp.png)
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 [the mailing list](https://groups.google.com/group/octoprint)
or the [G+ Community](https://plus.google.com/communities/102771308349328485741) where there are other active users who might be
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), support
of other users in the [bug tracker](https://github.com/foosel/OctoPrint/issues),
[the Mailinglist](https://groups.google.com/group/octoprint) or
[the G+ Community](https://plus.google.com/communities/102771308349328485741) and also [financially](http://octoprint.org/support-octoprint/).
[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), debugging help
in the [bug tracker](https://github.com/foosel/OctoPrint/issues), support of other users on
[the community forum at community.octoprint.org](https://community.octoprint.org)
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
in any way to make it better instead of just complaining about it -- this is an Open Source Project
@@ -49,38 +61,35 @@ which is a custom SD card image that includes OctoPrint plus dependencies.
The generic steps that should basically be done regardless of operating system
and runtime environment are the following (as *regular
user*, please keep your hands *off* of the `sudo` command here!) - this assumes
you already have Python 2.7, pip and virtualenv set up on your system:
you already have Python 2.7, 3.6 or 3.7, pip and virtualenv set up on your system:
1. Checkout OctoPrint: `git clone https://github.com/foosel/OctoPrint.git`
2. Change into the OctoPrint folder: `cd OctoPrint`
3. Create a user-owned virtual environment therein: `virtualenv venv`
4. Install OctoPrint *into that virtual environment*: `./venv/bin/python setup.py install`
4. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install .`
You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octoprint`, see [Usage](#usage)
for details.
After installation, please make sure you follow the first-run wizard and set up
access control as necessary. If you want to not only be notified about new
releases, but also be able to automatically upgrade to them from within
OctoPrint, take a look [at the documentation of the Software Update Plugin](https://github.com/foosel/OctoPrint/wiki/Plugin:-Software-Update#making-octoprint-updateable-on-existing-installations)
and at its settings.
access control as necessary.
## Dependencies
OctoPrint depends on a couple of python modules to do its job. Those are automatically installed when installing
OctoPrint via `setup.py`:
OctoPrint depends on a few python modules to do its job. Those are automatically installed when installing
OctoPrint via `pip`:
python setup.py install
pip install .
You should do this every time after pulling from the repository, since the dependencies may have changed.
OctoPrint currently only supports Python 2.7.
OctoPrint currently supports Python 2.7, 3.6 and 3.7.
## Usage
Running the `setup.py` script via
Running the pip install via
python setup.py install
pip install .
installs the `octoprint` script in your Python installation's scripts folder
(which, depending on whether you installed OctoPrint globally or into a virtual env, will be in your `PATH` or not). The
@@ -133,5 +142,8 @@ be edited from OctoPrint's settings dialog.
## Special Thanks
Cross-browser testing services are kindly provided by [BrowserStack](http://www.browserstack.com/).
Profiling is done with the help of [PyVmMonitor](http://www.pyvmmonitor.com).
Cross-browser testing services are kindly provided by [BrowserStack](https://www.browserstack.com/).
Profiling is done with the help of [PyVmMonitor](https://www.pyvmmonitor.com).
Error tracking is powered and sponsored by [Sentry](https://sentry.io).
+26 -36
View File
@@ -1,67 +1,57 @@
# Supporters
# Supporters
Development of this version of OctoPrint wouldn't have been possible without
[financial support by the community](http://octoprint.org/support-octoprint/) -
[the financial support by the community](https://octoprint.org/support-octoprint/) -
thanks to everyone who contributed!
## Patreon Patrons
* 3D Moniak
* Aleph Objects, Inc.
* Andre Bubel
* Andrew Moorby
* Arnljot Arntsen
* Bjorn Breckenridge
* Boris Hussein
* Brad Jackson
* Brent Fiegle
* Brian E. Tyler
* Christopher Day
* Christian Petropolis
* CreativeTools
* Christian Wolf
* COLLE+McVOY
* D Brian Kimmel
* DeltaMaker 3D Printers
* Doug Johnson
* Dorian Gray
* E3D BigBox
* Eric Betts
* Ernesto Martinez
* Exovite
* Frank Sander
* Gary Deen
* Gary N McKinney
* Franziska Kunsmann
* George Robles
* James Seigel
* Jamie R McGuigan
* Jamie van Dyke
* Jeff Moe
* Josh Daniels
* jean-claude migneault
* Jeff Renfer
* Jefferson Hunt
* Jeremiah Avery
* Joseph Payne
* Joshua Wills
* Justin Kaufman
* Kaile Riser
* Kale Stedman
* Kazuhiro Ogura
* Lamin Kivelä
* LA 3D Printer Repair
* LulzBot®
* Makespace Madrid
* Marcus Ackermann
* Mark Qvist
* Mark Walker
* Masayoshi Mitsui
* Michael Aumock
* Miles Flavel
* Mohammed khorakiwala
* Noe Ruiz
* Mosaic Manufacturing
* OMER MEHMET SUTAS
* Patrick McGinnis
* Peter Grace
* Peter Schmehl
* PRINT3Dforum.com
* Prof Yuh Wen Chen
* Randy C. Will
* Robert Gusek
* Roger Strolz
* Roy Cortes
* Samer Najia
* SD3D
* SeeMeCNC
* Shawn Lewis
* Simon Hallam
* Stefan Krister
* Stephane Schittly
* Sven Mueller
* Terrance Shaw
* Thomas Hatley
* Timeshell.ca
* TEVO 3D Printers
* Trent Shumay
* Ulrich Kempken
and 1041 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 1544 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
+7 -2
View File
@@ -6,9 +6,10 @@
* [Babel JavaScript Support](https://github.com/mitsuhiko/babel/blob/master/contrib/babel.js): BSD
* [Bootstrap](http://getbootstrap.com/): Apache License 2.0
* [Bootstrap Modal](http://jschr.github.io/bootstrap-modal/): Apache License 2.0
* [Bootstrap Slider Knockout Bindings](https://github.com/cosminstefanxp/bootstrap-slider-knockout-binding): MIT
* [Bootstrap Slider Knockout Binding](https://github.com/cosminstefanxp/bootstrap-slider-knockout-binding): MIT
* [Bootstrap Slider](http://seiyria.com/bootstrap-slider/): Apache License 2.0
* [Bootstrap Tabdrop](http://www.eyecon.ro/bootstrap-tabdrop): Apache License 2.0
* [css-element-queries](https://github.com/marcj/css-element-queries): MIT
* [Detect Mobile Browser](http://detectmobilebrowsers.com/): Public Domain
* [Flot](http://www.flotcharts.org/): MIT
* [JavaScript MD5](https://github.com/blueimp/JavaScript-MD5): MIT
@@ -36,6 +37,7 @@
* [Awesome-Slugify](https://pypi.python.org/pypi/awesome-slugify): GPLv3
* [chainmap](https://bitbucket.org/jeunice/chainmap): Python
* [Click](http://click.pocoo.org/): BSD
* [emoji](https://github.com/carpedm20/emoji/): BSD
* [feedparser](https://github.com/kurtmckee/feedparser): BSD
* [Flask](http://flask.pocoo.org/): BSD
* [Flask-Assets](http://github.com/miracle2k/flask-assets): BSD
@@ -44,6 +46,8 @@
* [Flask-Markdown](http://github.com/dcolish/flask-markdown): BSD
* [Flask-Principal](http://packages.python.org/Flask-Principal/): MIT
* [future](https://python-future.org/): MIT
* [futures](https://github.com/agronholm/pythonfutures): Python
* [monotonic](https://github.com/atdt/monotonic): Apache License 2.0
* [netaddr](https://github.com/drkjam/netaddr/): BSD
* [netifaces](https://bitbucket.org/al45tair/netifaces): MIT
* [pkginfo](http://pypi.python.org/pypi/pkginfo/): Python
@@ -60,13 +64,14 @@
* [Tornado](http://www.tornadoweb.org/): Apache License 2.0
* [watchdog](http://github.com/gorakhargosh/watchdog): Apache License 2.0
* [websocket-client](https://github.com/liris/websocket-client): LGPLv3
* [wrapt](http://wrapt.readthedocs.org/): BSD
## Development (testing, documentation generation, etc)
* [ddt](https://github.com/txels/ddt): MIT
* [mock](https://github.com/testing-cabal/mock): BSD
* [nose](http://pythonhosted.org/nose/): LGPL
* [pypandoc](https://github.com/bebraw/pypandoc): MIT
* [Sphinx](http://sphinx-doc.org/): BSD
* [sphinxcontrib-httpdomain](https://bitbucket.org/birkenfeld/sphinx-contrib/src/default/httpdomain/): BSD
* [sphinxcontrib-mermad](https://github.com/mgaitan/sphinxcontrib-mermaid): BSD
* [sphinx_rtd_theme](https://github.com/snide/sphinx_rtd_theme/): BSD
+6
View File
@@ -37,6 +37,11 @@
vertical-align: 10%;
}
.rst-content .highlight>pre,
.rst-content .linenodiv>pre {
line-height: 1.5;
}
/* make code tags non-red again */
code,
.rst-content tt {
@@ -52,3 +57,4 @@ a:visited code,
.rst-content a:visited tt {
color: #9B59B6 !important;
}
-170
View File
@@ -1,170 +0,0 @@
.. _sec-api-apps:
****
Apps
****
.. contents::
.. _sec-api-apps-sessionkey:
Session Keys
============
OctoPrint offers a special API key type for apps to use, the so called App Session Key. These keys have a time based
validity and are generated by OctoPrint for requesting apps.
Obtaining those keys is based on a handshake procedure backed by cryptographic signatures using RSA. OctoPrint needs to
be aware of apps and their associated public keys (this can be achieved either via entries in ``config.yaml`` or by
installing app specific plugins which implement the ``AppPlugin`` type).
Apps can be registered within OctoPrint via ``config.yaml`` by adding them to the ``api`` > ``apps`` section, using the
application's id concatenated with its version as key, with the public key provided as item ``pubkey`` (stripped of the
``BEGIN RSA PUBLIC KEY`` and ``END RSA PUBLIC KEY`` separators and also newlines) and optionally also whether the app is
enabled or not (defaults to enabled, so can be left out if it's not to be set to disabled explicitly).
Example:
.. sourcecode:: yaml
api:
apps:
"com.example.my_octoprint_app:0.9":
pubkey: MEgCQQDYkr5Fv/YXK5ZL1uwRN4A61IagZaYLGqJ5JJGFo8wDrmpAMRqE9kK4+5hIDblC5DzfEr5oP7OA3tRO48Rf5yInAgMBAAE=
enabled: false
"com.example.my_octoprint_app:1.0":
pubkey: MEgCQQCIWfi7Nc8bcnfZJJtA6a4RyMC+sKBlMOb25OVNNB4L2v0TiGO72jVKR4osvb4oztlbRW5GkdiY0T2LJcfDYvkJAgMBAAE=
In the example, the app ``com.example.my_octoprint_app`` in version 0.9 has been disabled (e.g. due to the key having
leaked) whereas version 1.0 is fully registered with OctoPrint and may verify app session keys.
.. _sec-api-apps-sessionkey-workflow:
Workflow
--------
Apps perform the handshake by first requesting a temporary key with very limited validity,
then sending a message back to OctoPrint containing their id, version, the temporary key and a signature created with their
private key over these three pieces of data. OctoPrint then tries to verify the signature and if successful unlocks the
key to be used as a fully recognized API key.
For performing the handshake a special API exists within OctoPrint for which no API key is needed which is described below.
.. _sec-api-apps-sessionkey-get:
Obtaining a temporary session key
---------------------------------
.. http:get:: /apps/auth
Retrieve a temporary session key with a minimum validity. It can only be used as a proper API key after having been
:ref:`verified <sec-api-apps-sessionkey-verify>`.
Returns the temporary session key and the timestamp until it's valid.
**Example**:
.. sourcecode:: http
GET /apps/auth HTTP/1.1
Host: example.com
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"unverifiedKey": "F43A844750F74AD080FE9F438D47B33C",
"validUntil": 1416220357.011
}
:statuscode 200: No error
.. _sec-api-apps-sessionkey-verify:
Verifying a temporary session key
---------------------------------
.. http:post:: /apps/auth
Verify a formerly :ref:`retrieved <sec-api-apps-sessionkey-get>` temporary session key by providing credentials and a
cryptographic signature over these credentials and the temporary key.
Returns the now verified session key and the new validity.
**Example**:
.. sourcecode:: http
POST /apps/auth HTTP/1.1
Host: example.com
Content-Type: application/json
{
"appid": "com.example.my_octoprint_app",
"appversion": "1.0",
"key": "F43A844750F74AD080FE9F438D47B33C",
"_sig": "LGVCiolQWDc4AVn1DOcWljY0cFQxWF4pldVveUjjmL9JhiL0LnCKBbGwZ/CwKBWswFAxPaxQ0kDusVdOmCUa/w=="
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"key": "F43A844750F74AD080FE9F438D47B33C",
"validUntil": 1416227497.011
}
.. _sec-api-apps-sessionkey-signature:
Creating the signature
----------------------
The signature is created by concatenating the ``appid``, ``appversion`` and ``key`` fields, separated by a ``:`` (colon),
signing the result with the app's private key using SHA-1 and then BASE64-encoding the result, stripping newlines.
Example for signature generation using Python and the `Python RSA library <https://pypi.python.org/pypi/rsa>`_:
.. sourcecode:: python
import base64
import rsa
appid = "com.example.my_octoprint_app"
version = "1.0"
unverified_key = "F43A844750F74AD080FE9F438D47B33C"
message_to_sign = appid + ":" + version + ":" + unverified_key
// => "com.example.my_octoprint_app:1.0:F43A844750F74AD080FE9F438D47B33C"
private_key = rsa.PrivateKey.load_pkcs1("...")
signature = base64.encodestring(rsa.sign(message_to_sign, private_key, "SHA-1")).replace("\n", "")
// => "LGVCiolQWDc4AVn1DOcWljY0cFQxWF4pldVveUjjmL9JhiL0LnCKBbGwZ/CwKBWswFAxPaxQ0kDusVdOmCUa/w=="
.. _sec-api-apps-sessionkey-testing:
Testing your implementation
---------------------------
If you want to use app session keys, here is the key pair with which the above examples were created, in order for you
to verify your signature implementation::
-----BEGIN RSA PRIVATE KEY-----
MIIBPQIBAAJBAIhZ+Ls1zxtyd9kkm0DprhHIwL6woGUw5vbk5U00Hgva/ROIY7va
NUpHiiy9vijO2VtFbkaR2JjRPYslx8Ni+QkCAwEAAQJARK4lFo+FEcs3yR2iQjEy
p+yaAbNQJ4hZXlVvltLAYICzOM3kyKx53/eKU59NjskLz9q6QxfleymYPWAgl4NW
fQIjAJVH8MjwNcaAquTM9z2OiFi3OC8WgaKOi5W/T+r2+B70wG8CHwDp08dqOZ/u
xcBiy4Wzpcme9bckqoVuS3gWMm+YqgcCIwCMFU07kkY0NyumtzxPdIA4F/7OGSWf
IHqWFEfvasAddHlbAh8A5UgkB3Zf7Bt+7aFSBnlvve6FWm/XDPL12xYztYgrAiIa
W3miN6FjIm+8TDowrk+nyYXG2GZefeY7QXOjYr6tlDn0
-----END RSA PRIVATE KEY-----
-----BEGIN RSA PUBLIC KEY-----
MEgCQQCIWfi7Nc8bcnfZJJtA6a4RyMC+sKBlMOb25OVNNB4L2v0TiGO72jVKR4os
vb4oztlbRW5GkdiY0T2LJcfDYvkJAgMBAAE=
-----END RSA PUBLIC KEY-----
+2 -2
View File
@@ -39,7 +39,7 @@ Get connection settings
"options": {
"ports": ["/dev/ttyACM0", "VIRTUAL"],
"baudrates": [250000, 230400, 115200, 57600, 38400, 19200, 9600],
"printerProfiles": [{"name": "Default", id: "_default"}],
"printerProfiles": [{"name": "Default", "id": "_default"}],
"portPreference": "/dev/ttyACM0",
"baudratePreference": 250000,
"printerProfilePreference": "_default",
@@ -59,7 +59,7 @@ Issue a connection command
Issue a connection command. Currently available command are:
connect
Instructs OctoPrint to connect to the printer. Additional parameters are:
Instructs OctoPrint to connect or, if already connected, reconnect to the printer. Additional parameters are:
* ``port``: Optional, specific port to connect to. If not set the current ``portPreference`` will be used, or if
no preference is available auto detection will be attempted.
+80 -13
View File
@@ -31,7 +31,7 @@ Printer State
* - ``flags``
- 1
- Printer state flags
- A couple of boolean printer state flags
- A few boolean printer state flags
* - ``flags.operational``
- 1
- Boolean
@@ -44,6 +44,14 @@ Printer State
- 1
- Boolean
- ``true`` if the printer is currently printing, ``false`` otherwise
* - ``flags.pausing``
- 1
- Boolean
- ``true`` if the printer is currently printing and in the process of pausing, ``false`` otherwise
* - ``flags.cancelling``
- 1
- Boolean
- ``true`` if the printer is currently printing and in the process of pausing, ``false`` otherwise
* - ``flags.sdReady``
- 1
- Boolean
@@ -232,12 +240,18 @@ File information
* - ``name``
- 1
- String
- The name of the file without path. E.g. "file.gco" for a file "file.gco" located anywhere in the file system.
- The name of the file without path. E.g. "file.gco" for a file "file.gco" located anywhere in the file system. Currently
this will always fit into ASCII.
* - ``display``
- 1
- String
- The name of the file without the path, this time potentially with non-ASCII unicode characters.
E.g. "a turtle 🐢.gco" for a file "a_turtle_turtle.gco" located anywhere in the file system.
* - ``path``
- 1
- String
- The path to the file within the location. E.g. "folder/subfolder/file.gco" for a file "file.gco" located within
"folder" and "subfolder" relative to the root of the location.
"folder" and "subfolder" relative to the root of the location. Currently this will always fit into ASCII.
* - ``type``
- 1
- String
@@ -249,8 +263,11 @@ File information
- Path to type of file in extension tree. E.g. ``["model", "stl"]`` for ``.stl`` files, or ``["machinecode", "gcode"]``
for ``.gcode`` files. ``["folder"]`` for folders.
Additional properties depend on ``type``. For a ``type`` value of ``folder``, see "Folders". For any other value
see "Files".
Additional properties depend on ``type``.
For a ``type`` value of ``folder``, see :ref:`Folders <sec-api-datamodel-files-folders>`.
For any other value see :ref:`Files <sec-api-datamodel-files-files>`.
.. _sec-api-datamodel-files-folders:
Folders
'''''''
@@ -266,13 +283,14 @@ Folders
* - ``children``
- 0..*
- Array of :ref:`File information items <sec-api-datamodel-files-file>`
- Contained children for entries of type ``folder``. Will only include children in subfolders in recursive
listings. Not present in non recursive listings, this might be revisited in the future.
- Contained children for entries of type ``folder``. On non recursive listings only present on first level
sub folders!
* - ``size``
- 0..1
- Number
- The size of all files contained in the folder and its subfolders. Not present in non recursive listings, this might
be revisited in the future.
- The size of all files contained in the folder and its subfolders. Not present in non recursive listings!
.. _sec-api-datamodel-files-files:
Files
'''''
@@ -329,11 +347,17 @@ Abridged file or folder information
- 1
- String
- The name of the file or folder without path. E.g. "file.gco" for a file "file.gco" located anywhere in the file system.
Currently this will always fit into ASCII.
* - ``display``
- 1
- String
- The name of the file without the path, this potentially with non-ASCII unicode characters.
E.g. "a turtle 🐢.gco" for a file "a_turtle_turtle.gco" located anywhere in the file system.
* - ``path``
- 1
- String
- The path to the file or folder within the location. E.g. "folder/subfolder/file.gco" for a file "file.gco" located within
"folder" and "subfolder" relative to the root of the location.
"folder" and "subfolder" relative to the root of the location. Currently this will always fit into ASCII.
* - ``origin``
- 1
- String, either ``local`` or ``sdcard``
@@ -365,14 +389,58 @@ GCODE analysis information
- 0..1
- Object
- The estimated usage of filament
* - ``filament.length``
* - ``filament.tool{n}.length``
- 0..1
- Integer
- The length of filament used, in mm
* - ``filament.volume``
* - ``filament.tool{n}.volume``
- 0..1
- Float
- The volume of filament used, in cm³
* - ``dimensions``
- 0..1
- Object
- Information regarding the size of the printed model
* - ``dimensions.depth``
- 0..1
- Float
- The depth of the printed model, in mm
* - ``dimensions.height``
- 0..1
- Float
- The height of the printed model, in mm
* - ``dimensions.width``
- 0..1
- Float
- The width of the printed model, in mm
* - ``printingArea``
- 0..1
- Object
- Information regarding the size of the printing area
* - ``printingArea.maxX``
- 0..1
- Float
- The maximum X coordinate of the printed model, in mm
* - ``printingArea.maxY``
- 0..1
- Float
- The maximum Y coordinate of the printed model, in mm
* - ``printingArea.maxZ``
- 0..1
- Float
- The maximum Z coordinate of the printed model, in mm
* - ``printingArea.minX``
- 0..1
- Float
- The minimum X coordinate of the printed model, in mm
* - ``printingArea.minY``
- 0..1
- Float
- The minimum Y coordinate of the printed model, in mm
* - ``printingArea.minZ``
- 0..1
- Float
- The minimum Z coordinate of the printed model, in mm
.. _sec-api-datamodel-files-ref:
@@ -401,4 +469,3 @@ References
- URL
- The model from which this file was generated (e.g. an STL, currently not used). Never present for
folders.
+33 -3
View File
@@ -82,8 +82,37 @@ Retrieve all files
"path": "folderA",
"type": "folder",
"typePath": ["folder"],
"children": [],
"size": 1334
"children": [
{
"name": "whistle_v2_copy.gcode",
"path": "whistle_v2_copy.gcode",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"hash": "...",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/folderA/whistle_v2_copy.gcode",
"download": "http://example.com/downloads/files/local/folderA/whistle_v2_copy.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
}
]
}
],
"free": "3.2GB"
@@ -192,6 +221,7 @@ Retrieve all files
"refs": {
"resource": "http://example.com/api/files/local/folderA/subfolder",
}
}
],
"size": 1334,
"refs": {
@@ -442,7 +472,7 @@ Upload file or create folder
:form select: Whether to select the file directly after upload (``true``) or not (``false``). Optional, defaults
to ``false``. Ignored when creating a folder.
:form print: Whether to start printing the file directly after upload (``true``) or not (``false``). If set, ``select``
is implicitely ``true`` as well. Optional, defaults to ``false``. Ignored when creating a folder.
is implicitly ``true`` as well. Optional, defaults to ``false``. Ignored when creating a folder.
:form userdata: [Optional] An optional string that if specified will be interpreted as JSON and then saved along
with the file as metadata (metadata key ``userdata``). Ignored when creating a folder.
:form foldername: The name of the folder to create. Ignored when uploading a file.
+116 -11
View File
@@ -11,9 +11,12 @@ General information
Authorization
=============
OctoPrint's API expects an API key to be supplied with each request. This API key can be either the globally
configured one, a user specific one if "Access Control" is enabled or an ref:`App Session Key <sec-api-apps-sessionkey>`.
Users are able to generate and revoke their custom API key via the "Change password" dialog.
If :ref:`Access Control <sec-features-access_control>` is enabled OctoPrint's API expects an API key to be supplied with each request. This API
key can be either the globally configured one, a user specific one or an app and user specific one as generated by the
authorization workflow implemented by the bundled :ref:`Application Keys Plugin <sec-bundledplugins-appkeys>` (since 1.3.10).
Clients are advised to implement the :ref:`Application Keys Plugin workflow <sec-bundledplugins-appkeys-workflow>` first and
fallback on directing the user to manually supply the the user specific API key. The global key should rarely be used.
The API key must be supplied in the custom HTTP header ``X-Api-Key``, e.g.
@@ -23,8 +26,6 @@ The API key must be supplied in the custom HTTP header ``X-Api-Key``, e.g.
Host: example.com
X-Api-Key: abcdef...
If it is missing or included but invalid, OctoPrint will directly return a response with status :http:statuscode:`401`.
For testing purposes it is also possible to supply the API key via a query parameter ``apikey``, e.g.
.. sourcecode:: http
@@ -34,6 +35,24 @@ For testing purposes it is also possible to supply the API key via a query param
Please be advised that clients should use the header field variant if at all possible.
If the key is missing or invalid, OctoPrint will treat the request as it would any unauthenticated anonymous request to the endpoint.
Consequently, if the bundled :ref:`ForceLogin plugin <sec-bundledplugins-forcelogin>` is active (which is the default), that means
that any requests without or with an invalid API key targeting other API endpoints than :ref:`Login <sec-api-general-login>`
will be denied with a :http:statuscode:`403`.
.. warning::
If :ref:`Access Control <sec-features-access_control>` is disabled, OctoPrint will treat any unauthenticated anonymous requests and thus also requests
with an invalid or outright missing API key as requests with full admin rights!
.. note::
The API key requirements changed in 1.3.11. Up to that version, even if Access Control was disabled, all requests needed to
be supplied with an API Key. To make the webinterface work under these circumstances, an unauthenticated anonymous API key was injected into the
HTML page and also available on the :ref:`Push API <sec-api-push>`. The presence and ready availability of this unauthenticated
anonymous "UI API key" caused confusion and false alarm among users and didn't contribute to the security of the platform in a
meaningful way, so it was finally abandoned in 1.3.11.
.. _fig-api-general-globalapikey:
.. figure:: ../images/settings-global-api-key.png
:align: center
@@ -55,17 +74,12 @@ Please be advised that clients should use the header field variant if at all pos
The API key options in the "Change password" dialog. Users can generate and revoke their custom API key here.
.. note::
OctoPrint's web interface uses a custom API key that is freshly generated on every server start. This key is not
intended to be used by any other client and would not be very useful in any case, since it basically represents
a completely anonymous client.
.. _sec-api-general-contenttype:
Content Type
============
If not otherwise stated OctoPrint's API expects request bodies and issues response bodies as ``Content-Type: application/json``.
If not otherwise stated, OctoPrint's API expects request bodies and issues response bodies as ``Content-Type: application/json``.
.. _sec-api-general-encoding:
@@ -120,3 +134,94 @@ If CORS is not enabled you will get errors like the following::
XMLHttpRequest cannot load http://localhost:8081/api/files. No 'Access-Control-Allow-Origin'
header is present on the requested resource.
.. _sec-api-general-login:
Login
=====
.. http:post:: /api/login
Creates a login session or retrieves information about the currently existing session ("passive login").
Can be used in one of two ways: to login a user via username and password and create a persistent session (usually
from a UI in the browser), or to retrieve information about the active user (from an existing session or an API key)
via the ``passive`` flag.
Will return a :http:statuscode:`200` with a :ref:`login response <sec-api-general-datamodel-login>` on successful
login, whether active or passive. The active (username/password) login may also return a :http:statuscode:`401` in
case of a username/password mismatch or unknown user and a :http:statuscode:`403` in case of a deactivated account.
:json passive: If present, performs a passive login only, returning information about the current user that's
active either through an existing session or the used API key
:json user: (active login only) Username
:json pass: (active login only) Password
:json remember: (active login only) Whether to set a "remember me" cookie on the session
:status 200: Successful login
:status 401: Username/password mismatch or unknown user
:status 403: Deactivated account
.. _sec-api-general-logout:
Logout
======
.. http:post:: /api/logout
Ends the current login session of the current user.
Only makes sense in the context of browser based workflows.
Will return a :http:statuscode:`204`.
:status 204: No error
.. _sec-api-general-datamodel:
Data model
==========
.. _sec-api-general-datamodel-login:
Login response
--------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- the user's name/id
* - ``active``
- 1
- boolean
- Whether the user's account is active or not
* - ``admin``
- 1
- boolean
- Whether the user has admin rights or not
* - ``user``
- 1
- boolean
- Whether the user has user rights or not (always ``true``)
* - ``apikey``
- 1
- string or None
- The user's API key, if set
* - ``settings``
- 1
- dict
- The user's settings, if any
* - ``session``
- 1
- string
- The session key, can be used to authenticate with the ``auth`` message on the :ref:`push API <sec-api-push>`.
* - ``_is_external_client``
- 1
- boolean
- Whether the client that made the request got detected as external from the local network or not.
+10 -2
View File
@@ -4,6 +4,9 @@
Job operations
**************
Use these operations to query the currently selected file and start/cancel/restart/pause the
actual print job.
.. contents::
.. _sec-api-jobs-command:
@@ -209,7 +212,8 @@ Retrieve information about the current job
"filepos": 337942,
"printTime": 276,
"printTimeLeft": 912
}
},
"state": "Printing"
}
:statuscode 200: No error
@@ -240,4 +244,8 @@ Job information response
- 1
- :ref:`sec-api-datamodel-jobs-progress`
- Information regarding the progress of the current print job
* - ``state``
- 1
- String
- A textual representation of the current state of the job, i.e. "Operational", "Printing", "Pausing", "Paused",
"Cancelling", "Error" or "Offline".
+3 -9
View File
@@ -39,9 +39,7 @@ Retrieve installed language packs
"_core": {
"identifier": "_core",
"name": "Core",
"languages": [
...
]
"languages": []
},
"some_plugin": {
"identifier": "some_plugin",
@@ -61,7 +59,6 @@ Retrieve installed language packs
"last_update": 1470859680,
"author": "The italian Transifex Team"
}
...
]
}
}
@@ -124,9 +121,7 @@ Delete a language pack
"_core": {
"identifier": "_core",
"name": "Core",
"languages": [
...
]
"languages": []
},
"some_plugin": {
"identifier": "some_plugin",
@@ -138,8 +133,7 @@ Delete a language pack
"locale_english": "German",
"last_update": 1474574597,
"author": "Gina Häußge"
},
...
}
]
}
}
+5 -168
View File
@@ -4,172 +4,9 @@
Log file management
*******************
.. note::
Log file management (and logging configuration) was moved into a bundled plugin in OctoPrint 1.3.7. Refer to
:ref:`the Logging's plugins API <sec-bundledplugins-logging-api>` for the API documentation.
All log file management operations require admin rights.
.. contents::
.. _sec-api-logs-list:
Retrieve a list of available log files
======================================
.. http:get:: /api/logs
Retrieve information regarding all log files currently available and regarding the disk space still available
in the system on the location the log files are being stored.
Returns a :ref:`Logfile Retrieve response <sec-api-logs-datamodel-retrieveresponse>`.
**Example**
.. sourcecode:: http
GET /api/logs HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files" : [
{
"date" : 1393158814,
"name" : "octoprint.log",
"size" : 43712,
"refs": {
"resource": "http://example.com/api/logs/octoprint.log",
"download": "http://example.com/downloads/logs/octoprint.log"
}
},
{
"date" : 1392628936,
"name" : "octoprint.log.2014-02-17",
"size" : 13205,
"refs": {
"resource": "http://example.com/api/logs/octoprint.log.2014-02-17",
"download": "http://example.com/downloads/logs/octoprint.log.2014-02-17"
}
},
{
"date" : 1393158814,
"name" : "serial.log",
"size" : 1798419,
"refs": {
"resource": "http://example.com/api/logs/serial.log",
"download": "http://example.com/downloads/logs/serial.log"
}
}
],
"free": 12237201408
}
:statuscode 200: No error
:statuscode 403: If the given API token did not have admin rights associated with it
.. _sec-api-logs-delete:
Delete a specific logfile
=========================
.. http:delete:: /api/logs/(path:filename)
Delete the selected log file with name `filename`.
Returns a :http:statuscode:`204` after successful deletion.
**Example Request**
.. sourcecode:: http
DELETE /api/logs/octoprint.log.2014-02-17 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
:param filename: The filename of the log file to delete
:statuscode 204: No error
:statuscode 403: If the given API token did not have admin rights associated with it
:statuscode 404: If the file was not found
.. _sec-api-logs-datamodel:
Data model
==========
.. _sec-api-logs-datamodel-retrieveresponse:
Logfile Retrieve Response
-------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``files``
- 0..*
- Array of :ref:`File information items <sec-api-logs-datamodel-fileinfo>`
- The list of requested files. Might be an empty list if no files are available
* - ``free``
- 1
- String
- The amount of disk space in bytes available in the local disk space (refers to OctoPrint's ``logs`` folder).
.. _sec-api-logs-datamodel-fileinfo:
File information
----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- String
- The name of the file
* - ``size``
- 1
- Number
- The size of the file in bytes.
* - ``date``
- 1
- Unix timestamp
- The timestamp when this file was last modified.
* - ``refs``
- 1
- :ref:`sec-api-logs-datamodel-ref`
- References relevant to this file
.. _sec-api-logs-datamodel-ref:
References
----------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``resource``
- 1
- URL
- The resource that represents the file (e.g. for deleting)
* - ``download``
- 1
- URL
- The download URL for the file
The former endpoints ``/api/logs`` and ``api/logs/<path>`` are marked as deprecated but still work for now. New
client implementations should directly use the new endpoints provided by the bundled plugin. Existing implementations
should adapt their endpoints as soon as possible.
+212 -13
View File
@@ -22,6 +22,11 @@ Bed
corresponding resource returns temperature information including an optional history. Note that Bed commands
are only available if the currently selected printer profile has a heated bed.
See :ref:`sec-api-printer-bedcommand`.
Chamber
Chamber commands allow setting the temperature and temperature offset for the printer's heated chamber. Querying
the corresponding resource returns temperature information including an option history. Note that Chamber commands
are only available if the currently selected printer profile has a heated chamber.
See :ref:`sec-api-printer-chambercommand`.
SD card
SD commands allow initialization, refresh and release of the printer's SD card (if available). Querying the
corresponding resource returns the current SD card state.
@@ -37,7 +42,7 @@ Besides that, OctoPrint also provides a :ref:`full state report of the printer <
OctoPrint's internal webserver is single threaded and can only handle one request at a time. This is
not a problem generally since asynchronous programming allows to just have one request which is waiting for
data from a long running backend operation to sleep while handling other requests. The internal framework
used for providing the REST API though, Flask, is based on WSGI, which is synchrounous in nature. This means
used for providing the REST API though, Flask, is based on WSGI, which is synchronous in nature. This means
that it is impossible to wait in a non blocking wait while handling a request on the REST API. So in order to
return the response of a command sent to the printer, the single thread of the webserver would have to be blocked
by the API while the response wasn't available yet. Which in turn would mean that the whole web server would
@@ -149,6 +154,8 @@ Retrieve the current printer state
"operational": true,
"paused": false,
"printing": false,
"cancelling": false,
"pausing": false,
"sdReady": true,
"error": false,
"ready": true,
@@ -179,6 +186,8 @@ Retrieve the current printer state
"operational": true,
"paused": false,
"printing": false,
"cancelling": false,
"pausing": false,
"sdReady": true,
"error": false,
"ready": true,
@@ -213,9 +222,9 @@ Issue a print head command
* ``z``: Optional. Amount/coordinate to jog print head on z axis, must be a valid number corresponding to the distance to travel in mm.
* ``absolute``: Optional. Boolean value specifying whether to move relative to current position (provided
axes values are relative amounts) or to absolute position (provided axes values are coordinates)
* ``speed``: Optiona. Speed at which to move. If not provided, minimum speed for all selected axes from printer
* ``speed``: Optional. Speed at which to move. If not provided, minimum speed for all selected axes from printer
profile will be used. If provided but ``false``, no speed parameter will be appended to the command. Otherwise
interpreted as an integer signifying the speed in mm/s, to append to the command.
interpreted as an integer signifying the speed in mm/min, to append to the command.
home
Homes the print head in all of the given axes. Additional parameters are:
@@ -223,9 +232,9 @@ Issue a print head command
* ``axes``: A list of axes which to home, valid values are one or more of ``x``, ``y``, ``z``.
feedrate
Changes the feedrate factor to apply to the movement's of the axes.
Changes the feedrate factor to apply to the movements of the axes.
* ``factor``: The new factor, percentage as integer or float (percentage divided by 100) between 50 and 200%.
* ``factor``: The new factor, percentage between 50 and 200% as integer (``50`` to ``200``) or float (``0.5`` to ``2.0``).
All of these commands except ``feedrate`` may only be sent if the printer is currently operational and not printing.
Otherwise a :http:statuscode:`409` is returned.
@@ -276,9 +285,9 @@ Issue a print head command
HTTP/1.1 204 No Content
**Example feed rate request**
**Example feed rate request (1/2)**
Set the feed rate factor to 105%.
Set the feed rate factor to 105% using an integer argument.
.. sourcecode:: http
@@ -296,6 +305,26 @@ Issue a print head command
HTTP/1.1 204 No Content
**Example feed rate request (2/2)**
Set the feed rate factor to 105% using a float argument.
.. sourcecode:: http
POST /api/printer/printhead HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "feedrate",
"factor": 1.05
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``jog`` or ``home``.
:json number x: ``jog`` command: The amount to travel on the X axis in mm.
:json number y: ``jog`` command: The amount to travel on the Y axis in mm.
@@ -338,11 +367,13 @@ Issue a tool command
Extrudes the given amount of filament from the currently selected tool. Additional parameters:
* ``amount``: The amount of filament to extrude in mm. May be negative to retract.
* ``speed``: Optional. Speed at which to extrude. If not provided, maximum speed for E axis from printer
profile will be used. Otherwise interpreted as an integer signifying the speed in mm/min, to append to the command.
flowrate
Changes the flow rate factor to apply to extrusion of the tool.
* ``factor``: The new factor, percentage as integer or float (percentage divided by 100) between 75 and 125%.
* ``factor``: The new factor, percentage between 75 and 125% as integer (``75`` to ``125``) or float (``0.75`` to ``1.25``).
All of these commands may only be sent if the printer is currently operational and -- in case of ``select`` and
``extrude`` -- not printing. Otherwise a :http:statuscode:`409` is returned.
@@ -457,9 +488,9 @@ Issue a tool command
HTTP/1.1 204 No Content
**Example flow rate request**
**Example flow rate request (1/2)**
Set the flow rate factor to 95%.
Set the flow rate factor to 95% using an integer attribute.
.. sourcecode:: http
@@ -477,6 +508,26 @@ Issue a tool command
HTTP/1.1 204 No Content
**Example flow rate request (2/2)**
Set the flow rate factor to 95% using a float attribute.
.. sourcecode:: http
POST /api/printer/tool HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "flowrate",
"factor": 0.95
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``target``, ``offset``, ``select`` or ``extrude``.
:json object targets: ``target`` command: The target temperatures to set. Valid properties have to match the format ``tool{n}``.
:json object offsets: ``offset`` command: The offset temperature to set. Valid properties have to match the format ``tool{n}``.
@@ -577,12 +628,12 @@ Issue a bed command
are:
target
Sets the given target temperature on the printer's tools. Additional parameters:
Sets the given target temperature on the printer's bed. Additional parameters:
* ``target``: Target temperature to set.
offset
Sets the given temperature offset on the printer's tools. Additional parameters:
Sets the given temperature offset on the printer's bed. Additional parameters:
* ``offset``: Offset to set.
@@ -664,7 +715,7 @@ Retrieve the current bed state
an :http:statuscode:`409`.
.. note::
If you want both tool and bed temperature information at the same time, take a look at
If you want tool, bed and chamber temperature information at the same time, take a look at
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
**Example**
@@ -714,6 +765,154 @@ Retrieve the current bed state
:statuscode 409: If the printer is not operational or the selected printer profile
does not have a heated bed.
.. _sec-api-printer-chambercommand:
Issue a chamber command
=======================
.. http:post:: /api/printer/bed
Chamber commands allow setting the temperature and temperature offsets for the printer's heated chamber. Available commands
are:
target
Sets the given target temperature on the printer's chamber. Additional parameters:
* ``target``: Target temperature to set.
offset
Sets the given temperature offset on the printer's chamber. Additional parameters:
* ``offset``: Offset to set.
All of these commands may only be sent if the printer is currently operational. Otherwise a :http:statuscode:`409`
is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
If no heated chambed is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires user rights.
**Example Target Temperature Request**
Set the target temperature for the printer's heated chamber to 50°C.
.. sourcecode:: http
POST /api/printer/chamber HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "target",
"target": 50
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Offset Temperature Request**
Set the temperature offset for the heated chamber to -5°C.
.. sourcecode:: http
POST /api/printer/chamber HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "offset",
"offset": -5
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``target`` or ``offset``.
:json object target: ``target`` command: The target temperature to set.
:json object offset: ``offset`` command: The offset temperature to set.
:statuscode 204: No error
:statuscode 400: If ``target`` or ``offset`` is not a valid number or outside of the supported range, or if the
request is otherwise invalid.
:statuscode 409: If the printer is not operational or the selected printer profile
does not have a heated chamber.
.. _sec-api-printer-chamberstate:
Retrieve the current chamber state
==================================
.. http:get:: /api/printer/chamber
Retrieves the current temperature data (actual, target and offset) plus optionally a (limited) history (actual, target,
timestamp) for the printer's heated chamber.
It's also possible to retrieve the temperature history by supplying the ``history`` query parameter set to ``true``. The
amount of returned history data points can be limited using the ``limit`` query parameter.
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
If no heated chamber is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
.. note::
If you want tool, bed and chamber temperature information at the same time, take a look at
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
**Example**
Query the chamber temperature data and also include the temperature history but limit it to two entries.
.. sourcecode:: http
GET /api/printer/chamber?history=true&limit=2 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"chamber": {
"actual": 50.221,
"target": 70.0,
"offset": 5
},
"history": [
{
"time": 1395651928,
"chamber": {
"actual": 50.221,
"target": 70.0
}
},
{
"time": 1395651926,
"chamber": {
"actual": 49.1123,
"target": 70.0
}
}
]
}
:query history: If set to ``true`` (or: ``yes``, ``y``, ``1``), history information will be included in the response
too. If no ``limit`` parameter is given, all available temperature history data will be returned.
:query limit: If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history
will be returned. Will be ignored if ``history`` is not enabled.
:statuscode 200: No error
:statuscode 409: If the printer is not operational or the selected printer profile
does not have a heated chamber.
.. _sec-api-printer-sdcommand:
Issue an SD command
+10 -1
View File
@@ -52,6 +52,7 @@ Retrieve all printer profiles
"height": 200
},
"heatedBed": true,
"heatedChamber": false,
"axes": {
"x": {
"speed": 6000,
@@ -93,6 +94,7 @@ Retrieve all printer profiles
"height": 200
},
"heatedBed": true,
"heatedChamber": true,
"axes": {
"x": {
"speed": 6000,
@@ -184,6 +186,7 @@ Add a new printer profile
"height": 200
},
"heatedBed": true,
"heatedChamber": false,
"axes": {
"x": {
"speed": 6000,
@@ -267,6 +270,7 @@ Add a new printer profile
"height": 300
},
"heatedBed": false,
"heatedChamber": false,
"axes": {
"x": {
"speed": 6000,
@@ -352,6 +356,7 @@ Update an existing printer profile
"height": 200
},
"heatedBed": true,
"heatedChamber": false,
"axes": {
"x": {
"speed": 6000,
@@ -578,10 +583,14 @@ Profile
- 0..1
- ``boolean``
- Whether the printer has a heated bed (``true``) or not (``false``)
* - ``heatedChamber``
- 0..1
- ``boolean``
- Whether the printer has a heated chamber (``true``) or not (``false``)
* - ``axes``
- 0..1
- Object
- Description of the printer's axes properties, one entry each for ``x``, ``y``, ``z`` and ``e`` holding maxium speed
- Description of the printer's axes properties, one entry each for ``x``, ``y``, ``z`` and ``e`` holding maximum speed
and whether this axis is inverted or not.
* - ``axes.{axis}.speed``
- 0..1
+32 -14
View File
@@ -47,23 +47,41 @@ Clients must ignore any unknown messages.
The data model of the attached payloads is described further below.
OctoPrint's SockJS socket also accepts one command from the client to the server,
the ``throttle`` command. Usually, OctoPrint will push the general state update
in the ``current`` message twice per second. For some clients that might still
be too fast, so they can signal a different factor to OctoPrint utilizing the
``throttle`` message. OctoPrint expects a single integer here which represents
the multiplier for the base rate limit of one message every 500ms. A value of
1 hence will produce the default behaviour of getting every update. A value of
2 will set the rate limit to maximally one message every 1s, 3 to maximally one
message every 1.5s and so on.
OctoPrint's SockJS socket also accepts two commands from the client to the server.
Example for a ``throttle`` client-server-message:
* ``auth`` (since 1.3.10): With the ``auth`` message, clients may associate an
existing user session with the socket. That is of special importance to receive
any kind of messages if the bundled :ref:`Forcelogin Plugin <sec-bundledplugins-forcelogin>` is enabled
(as it is by default), since it will prevent any kind of status messages to be sent to connected unauthenticated
clients.
.. sourcecode:: javascript
The ``auth`` message expects the user id of the user to authenticate followed by ``:`` and a session key to be
obtained from the successful payload of a :ref:`(passive or active) login via the API <sec-api-general-login>`.
{
"throttle": 2
}
Example for a ``auth`` client-server-message:
.. sourcecode:: javascript
{
"auth": "someuser:LGZ0trf8By"
}
* ``throttle``: Usually, OctoPrint will push the general state update
in the ``current`` message twice per second. For some clients that might still
be too fast, so they can signal a different factor to OctoPrint utilizing the
``throttle`` message. OctoPrint expects a single integer here which represents
the multiplier for the base rate limit of one message every 500ms. A value of
1 hence will produce the default behaviour of getting every update. A value of
2 will set the rate limit to maximally one message every 1s, 3 to maximally one
message every 1.5s and so on.
Example for a ``throttle`` client-server-message:
.. sourcecode:: javascript
{
"throttle": 2
}
.. _sec-api-push-datamodel:
+287 -4
View File
@@ -62,12 +62,290 @@ Save settings
{
"api": {
"enabled": true,
// ...
"enabled": true
},
// ...
"appearance": {
"color": "black"
}
}
.. _sec-api-settings-generateapikey:
Regenerate the system wide API key
==================================
.. http:post:: /api/settings/apikey
Generates a new system wide API key.
Does not expect a body. Will return the generated API key as ``apikey``
property in the JSON object contained in the response body.
Requires admin rights.
:status 200: No error
:status 403: No admin rights
.. _sec-api-settings-fetchtemplaatedata:
Fetch template data
===================
.. http:get:: /api/settings/templates
Fetch data (currently only the sorting order) of all registered template components in the system.
Use this to get a full list of the identifiers of all UI components provided either by core OctoPrint or any
currently active plugins.
Example:
.. sourcecode:: http
GET /api/settings/templates HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"order": {
"about": [
{
"id": "about",
"name": "About OctoPrint"
},
{
"id": "supporters",
"name": "Supporters"
},
{
"id": "authors",
"name": "Authors"
},
{
"id": "changelog",
"name": "Changelog"
},
{
"id": "license",
"name": "OctoPrint License"
},
{
"id": "thirdparty",
"name": "Third Party Licenses"
},
{
"id": "plugin_pluginmanager",
"name": "Plugin Licenses",
"plugin_id": "pluginmanager",
"plugin_name": "Plugin Manager"
}
],
"generic": [
{
"id": "plugin_announcements",
"name": "plugin_announcements",
"plugin_id": "announcements",
"plugin_name": "Announcement Plugin"
}
],
"navbar": [
{
"id": "settings",
"name": "settings"
},
{
"id": "systemmenu",
"name": "systemmenu"
},
{
"id": "plugin_announcements",
"name": "plugin_announcements",
"plugin_id": "announcements",
"plugin_name": "Announcement Plugin"
},
{
"id": "login",
"name": "login"
}
],
"plugin_pluginmanager_about_thirdparty": [],
"settings": [
{
"id": "section_printer",
"name": "Printer"
},
{
"id": "serial",
"name": "Serial Connection"
},
{
"id": "printerprofiles",
"name": "Printer Profiles"
},
{
"id": "temperatures",
"name": "Temperatures"
},
{
"id": "terminalfilters",
"name": "Terminal Filters"
},
{
"id": "gcodescripts",
"name": "GCODE Scripts"
},
{
"id": "section_features",
"name": "Features"
},
{
"id": "features",
"name": "Features"
},
{
"id": "webcam",
"name": "Webcam & Timelapse"
},
{
"id": "accesscontrol",
"name": "Access Control"
},
{
"id": "gcodevisualizer",
"name": "GCODE Visualizer"
},
{
"id": "api",
"name": "API"
},
{
"id": "section_octoprint",
"name": "OctoPrint"
},
{
"id": "server",
"name": "Server"
},
{
"id": "folders",
"name": "Folders"
},
{
"id": "appearance",
"name": "Appearance"
},
{
"id": "plugin_logging",
"name": "Logging",
"plugin_id": "logging",
"plugin_name": "Logging"
},
{
"id": "plugin_pluginmanager",
"name": "Plugin Manager",
"plugin_id": "pluginmanager",
"plugin_name": "Plugin Manager"
},
{
"id": "plugin_softwareupdate",
"name": "Software Update",
"plugin_id": "softwareupdate",
"plugin_name": "Software Update"
},
{
"id": "plugin_announcements",
"name": "Announcements",
"plugin_id": "announcements",
"plugin_name": "Announcement Plugin"
},
{
"id": "section_plugins",
"name": "Plugins"
},
{
"id": "plugin_action_command_prompt",
"name": "Action Command Prompt",
"plugin_id": "action_command_prompt",
"plugin_name": "Action Command Prompt Support"
},
{
"id": "plugin_curalegacy",
"name": "Cura Legacy",
"plugin_id": "curalegacy",
"plugin_name": "Cura Legacy"
}
],
"sidebar": [
{
"id": "plugin_printer_safety_check",
"name": "Printer Safety Warning",
"plugin_id": "printer_safety_check",
"plugin_name": "Printer Safety Check"
},
{
"id": "connection",
"name": "Connection"
},
{
"id": "state",
"name": "State"
},
{
"id": "files",
"name": "Files"
}
],
"tab": [
{
"id": "temperature",
"name": "Temperature"
},
{
"id": "control",
"name": "Control"
},
{
"id": "gcodeviewer",
"name": "GCode Viewer"
},
{
"id": "terminal",
"name": "Terminal"
},
{
"id": "timelapse",
"name": "Timelapse"
}
],
"usersettings": [
{
"id": "access",
"name": "Access"
},
{
"id": "interface",
"name": "Interface"
}
],
"wizard": []
}
}
Requires admin rights.
.. warning::
This API endpoint is in beta. Things might change. If you happen to want to develop against it, you should drop
me an email to make sure I can give you a heads-up when something changes in an backwards incompatible way.
:status 200: No error
:status 403: No admin rights
.. _sec-api-settings-datamodel:
Data model
@@ -87,6 +365,9 @@ mapped from the same fields in ``config.yaml`` unless otherwise noted:
-
* - ``api.key``
- Only maps to ``api.key`` in ``config.yaml`` if request is sent with admin rights, set to ``n/a`` otherwise.
Starting with OctoPrint 1.3.3 setting this field via :ref:`the API <sec-api-settings-save>` is not possible,
only :ref:`regenerating it <sec-api-settings-generateapikey>` is supported. Setting a custom value is only
possible through `config.yaml`.
* - ``api.allowCrossOrigin``
-
* - ``appearance.name``
@@ -115,7 +396,7 @@ mapped from the same fields in ``config.yaml`` unless otherwise noted:
-
* - ``feature.sdSupport``
-
* - ``feature.sdReleativePath``
* - ``feature.sdRelativePath``
-
* - ``feature.sdAlwaysAvailable``
-
@@ -233,6 +514,8 @@ mapped from the same fields in ``config.yaml`` unless otherwise noted:
-
* - ``webcam.ffmpegThreads``
-
* - ``webcam.ffmpegVideoCodec``
-
* - ``webcam.watermark``
-
* - ``webcam.flipH``
+18 -22
View File
@@ -42,27 +42,25 @@ List All Slicers and Slicing Profiles
Content-Type: application/json
{
"cura": {
"key": "cura",
"displayName": "CuraEngine",
"curalegacy": {
"key": "curalegacy",
"displayName": "Cura Legacy",
"default": true,
"profiles": {
"high_quality": {
"key": "high_quality",
"displayName": "High Quality",
"default": false,
"resource": "http://example.com/api/slicing/cura/profiles/high_quality"
"resource": "http://example.com/api/slicing/curalegacy/profiles/high_quality"
},
"medium_quality": {
"key": "medium_quality",
"displayName": "Medium Quality",
"default": true,
"resource": "http://example.com/api/slicing/cura/profiles/medium_quality"
},
...
"resource": "http://example.com/api/slicing/curalegacy/profiles/medium_quality"
}
}
},
...
}
}
:statuscode 200: No error
@@ -83,7 +81,7 @@ List Slicing Profiles of a Specific Slicer
.. sourcecode:: http
GET /api/slicing/cura/profiles HTTP/1.1
GET /api/slicing/curalegacy/profiles HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
@@ -97,15 +95,14 @@ List Slicing Profiles of a Specific Slicer
"key": "high_quality",
"displayName": "High Quality",
"default": false,
"resource": "http://example.com/api/slicing/cura/profiles/high_quality"
"resource": "http://example.com/api/slicing/curalegacy/profiles/high_quality"
},
"medium_quality": {
"key": "medium_quality",
"displayName": "Medium Quality",
"default": true,
"resource": "http://example.com/api/slicing/cura/profiles/medium_quality"
},
...
"resource": "http://example.com/api/slicing/curalegacy/profiles/medium_quality"
}
}
:param slicer: The identifying key of the slicer for which to list the available profiles.
@@ -128,7 +125,7 @@ Retrieve Specific Profile
.. sourcecode:: http
GET /api/slicing/cura/profiles/quick_test HTTP/1.1
GET /api/slicing/curalegacy/profiles/quick_test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
@@ -140,15 +137,14 @@ Retrieve Specific Profile
{
"displayName": "Just a test",
"description": "This is just a test",
"resource": "http://example.com/api/slicing/cura/profiles/quick_test",
"resource": "http://example.com/api/slicing/curalegacy/profiles/quick_test",
"data": {
"bottom_layer_speed": 20.0,
"bottom_thickness": 0.3,
"brim_line_count": 20,
"cool_head_lift": false,
"cool_min_feedrate": 10.0,
"cool_min_layer_time": 5.0,
...
"cool_min_layer_time": 5.0
}
}
@@ -178,14 +174,14 @@ Add Slicing Profile
.. sourcecode:: http
PUT /api/slicing/cura/profiles/quick_test HTTP/1.1
PUT /api/slicing/curalegacy/profiles/quick_test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"displayName": "Just a test",
"description": "This is just a test to show how to create a cura profile with a different layer height and skirt count",
"description": "This is just a test to show how to create a curalegacy profile with a different layer height and skirt count",
"data": {
"layer_height": 0.2,
"skirt_line_count": 3
@@ -201,8 +197,8 @@ Add Slicing Profile
{
"displayName": "Just a test",
"description": "This is just a test to show how to create a cura profile with a different layer height and skirt count",
"resource": "http://example.com/api/slicing/cura/profiles/quick_test"
"description": "This is just a test to show how to create a curalegacy profile with a different layer height and skirt count",
"resource": "http://example.com/api/slicing/curalegacy/profiles/quick_test"
}
:param slicer: The identifying key of the slicer for which to add the profile
+52 -28
View File
@@ -38,30 +38,21 @@ List all registered system commands
{
"action": "shutdown",
"name": "Shutdown",
"command": "sudo shutdown -h now",
"confirm": "You are about to shutdown the system.",
"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).",
"source": "core",
"resource": "http://example.com/api/system/commands/core/shutdown"
},
{
"action": "reboot",
"name": "Reboot",
"command": "sudo reboot",
"confirm": "You are about to reboot the system.",
"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).",
"source": "core",
"resource": "http://example.com/api/system/commands/core/reboot"
},
{
"action": "restart",
"name": "Restart OctoPrint",
"command": "sudo service octoprint restart",
"confirm": "You are about to restart the OctoPrint server.",
"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).",
"source": "core",
"resource": "http://example.com/api/system/commands/core/restart"
}
@@ -99,30 +90,21 @@ List all registered system commands for a source
{
"action": "shutdown",
"name": "Shutdown",
"command": "sudo shutdown -h now",
"confirm": "You are about to shutdown the system.",
"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).",
"source": "core",
"resource": "http://example.com/api/system/commands/core/shutdown"
},
{
"action": "reboot",
"name": "Reboot",
"command": "sudo reboot",
"confirm": "You are about to reboot the system.",
"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).",
"source": "core",
"resource": "http://example.com/api/system/commands/core/reboot"
},
{
"action": "restart",
"name": "Restart OctoPrint",
"command": "sudo service octoprint restart",
"confirm": "You are about to restart the OctoPrint server.",
"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).",
"source": "core",
"resource": "http://example.com/api/system/commands/core/restart"
}
@@ -139,7 +121,7 @@ Execute a registered system command
.. http:post:: /api/system/commands/(string:source)/(string:action)
Execute the system command ``action`` on defined in ``source``.
Execute the system command ``action`` defined in ``source``.
**Example**
@@ -154,7 +136,7 @@ Execute a registered system command
.. sourcecode:: http
204 No Content
HTTP/1.1 204 No Content
:param source: The source for which to list commands, currently either ``core`` or ``custom``
:param action: The identifier of the command, ``action`` from its definition
@@ -184,18 +166,60 @@ List all response
- Description
* - ``core``
- 0..n
- List of :ref:`command definitions <sec-api-system-commands-definiton>`
- List of :ref:`client command definitions <sec-api-client-system-commands-definiton>`
- List of all core commands defined.
* - ``custom``
- 0..n
- List of :ref:`command definitions <sec-api-system-commands-definiton>`
- List of :ref:`client command definitions <sec-api-client-system-commands-definiton>`
- List of all custom commands defined in ``config.yaml``.
.. _sec-api-client-system-commands-definiton:
Client command definitions
--------------------------
A restricted form of the full :ref:`command definition <sec-api-system-commands-definiton>`.
For exposing via the API.
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The name of the command to display in the System menu.
* - ``action``
- 1
- string
- An identifier to refer to the command programmatically. The special ``action`` string
``divider`` signifies a divider in the menu.
* - ``confirm``
- 0..1
- string
- If present and set, this text will be displayed to the user in a confirmation dialog
they have to acknowledge in order to really execute the command.
* - ``source``
- 1
- string
- Source of the command definition, currently either ``core`` (for system actions defined by
OctoPrint itself) or ``custom`` (for custom system commands defined by the user through ``config.yaml``).
* - ``resource``
- 1
- string
- The URL of the command to use for executing it.
.. _sec-api-system-commands-definiton:
Command definition
------------------
The full command definition is not available via the API.
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
+2 -2
View File
@@ -128,7 +128,7 @@ Rendered timelapse
* - ``date``
- 1
- string
- Formatted timestamp of the the timelapse creation date
- Formatted timestamp of the timelapse creation date
* - ``url``
- 1
- string
@@ -162,7 +162,7 @@ Unrendered timelapse
* - ``date``
- 1
- string
- Formatted timestamp of the the timelapse job creation date
- Formatted timestamp of the timelapse job creation date
* - ``recording``
- 1
- bool
+115 -12
View File
@@ -30,6 +30,14 @@ Test paths or URLs
existence but also whether it is of the specified type. Optional.
* ``check_access``: A list of any of ``r``, ``w`` and ``x``. If present it will also
be checked if OctoPrint has read, write, execute permissions on the specified path.
* ``allow_create_dir``: If ``check_type`` is provided and set to ``dir``, this will allow
OctoPrint to create the target ``path`` as a directory if it doesn't yet exist to allow
for further tests.
* ``check_writable_dir``: If ``check_type`` is provided and set to ``dir``, this will
check that the provided ``path`` is a writable directory. OctoPrint not only check if the
permissions on the directory allow for writing but also attempt to write (and delete) a
small test file ``.testballoon.txt`` to the directory to test if writing is actually
possible.
The ``path`` command returns a :http:statuscode:`200` with a :ref:`path test result <sec-api-util-datamodel-pathtestresult>`
when the test could be performed. The status code of the response does NOT reflect the
@@ -38,13 +46,15 @@ Test paths or URLs
.. _sec-api-util-test-url:
url
Tests whether a provided url responds. Request method and expected status codes can
Tests whether a provided URL responds. Request method and expected status codes can
optionally be specified as well. Supported parameters are:
* ``url``: The url to test. Mandatory.
* ``url``: The URL to test. Mandatory.
* ``method``: The request method to use for the test. Optional, defaults to ``HEAD``.
* ``timeout``: A timeout for the request, in seconds. If no reply from the tested URL has been
received within this time frame, the check will be considered a failure. Optional, defaults to 3 seconds.
* ``validSsl``: Whether to validate the SSL connection if the ``url`` happens to be an HTTPS URL or not. Optional,
defaults to ``True``.
* ``status``: The status code(s) or named status range(s) to test for. Can be either a single
value or a list of either HTTP status codes or any of the following named status ranges:
@@ -63,11 +73,32 @@ Test paths or URLs
from the URL check will be returned as part of the check result as well. ``json`` will attempt
to parse the response as json and return the parsed result. ``true`` or ``bytes`` will base64 encode the body
and return that.
* ``content_type_whitelist``: Optional array of supported content types. If set and the URL returns a content
type not included in this list, the test will fail. E.g. ``["image/*", "text/plain"]``.
* ``content_type_blacklist``: Optional array of unsupported content types. If set and the URL returns a content
type included in this list, the test wil fail. E.g. ``["video/*"]``. Can be used together with ``content_type_whitelist``
to further limit broader content type definition, e.g. by putting ``image/*`` into the whitelist, but disallowing
PNG by including ``image/png`` on the blacklist.
The ``url`` command returns :http:statuscode:`200` with a :ref:`URL test result <sec-api-util-datamodel-urltestresult>`
when the test could be performed. The status code of the response does NOT reflect the
test result!
.. _sec-api-util-test-server:
server
Tests whether a provided server identified by host and port can be reached. Protocol can optionally be specified
as well. Supported parameters are:
* ``host``: The host to test. IP or host name. Mandatory.
* ``port``: The port to test. Integer. Mandatory.
* ``protocol``: The protocol to test with. ``tcp`` or ``udp``. Optional, defaults to ``tcp``.
* ``timeout``: A timeout for the test, in seconds. If no successful connection to the server could be established
within this time frame, the check will be considered a failure. Optional, defaults to 3.05 seconds.
The ``server`` command returns :http:statuscode:`200` with a :ref:`Server test result <sec-api-util-datamodel-servertestresult>`
when the test could be performed. The status code of the response does NOT reflect the test result!
Requires admin rights.
**Example 1**
@@ -226,16 +257,52 @@ Test paths or URLs
}
}
:json command: The command to execute, currently either ``path`` or ``url``
:json path: ``path`` command only: the path to test
:json check_type: ``path`` command only: the type of path to test for, either ``file`` or ``dir``
:json check_access: ``path`` command only: a list of access permissions to check for
:json url: ``url`` command only: the URL to test
:json status: ``url`` command only: one or more expected status codes
:json method: ``url`` command only: the HTTP method to use for the check
:json timeout: ``url`` command only: the timeout for the HTTP request
:json response: ``url`` command only: whether to include response data and if so in what form
:statuscode 200: No error occurred
**Example 6**
Test whether a server is reachable on a given port via TCP.
.. sourcecode:: http
POST /api/util/test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"command": "server",
"host": "8.8.8.8",
"port": 53
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"host": "8.8.8.8",
"port": 53,
"protocol": "tcp",
"result": true
}
:json command: The command to execute, currently either ``path`` or ``url``
:json path: ``path`` command only: the path to test
:json check_type: ``path`` command only: the type of path to test for, either ``file`` or ``dir``
:json check_access: ``path`` command only: a list of access permissions to check for
:json allow_create_dir: ``path`` command and ``checktype`` of ``dir`` only: whether to allow creation of the
directory if it doesn't yet exist (``true``) or not (``false``, default)
:json check_writable_dir: ``path`` command and ``checktype`` of ``dir`` only: whether to test if the directory
is writable by also trying to create a test file in it (``true``) or not (``false``, default)
:json url: ``url`` command only: the URL to test
:json status: ``url`` command only: one or more expected status codes
:json method: ``url`` command only: the HTTP method to use for the check
:json timeout: ``url`` and ``server`` commands only: the timeout for the test request
:json response: ``url`` command only: whether to include response data and if so in what form
:json host: ``server`` command only: the server to test
:json port: ``server`` command only: the port to test
:json protocol: ``server`` command only: the protocol to test
:statuscode 200: No error occurred
.. _sec-api-util-datamodel:
@@ -244,6 +311,9 @@ Data model
.. _sec-api-util-datamodel-pathtestresult:
Path test result
----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
@@ -275,6 +345,9 @@ Data model
.. _sec-api-util-datamodel-urltestresult:
URL test result
---------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
@@ -306,3 +379,33 @@ Data model
- object
- A dictionary with all headers of the checked URL's response. Only present if ``response`` in the
request was set.
.. _sec-api-util-datamodel-servertestresult:
Server test result
------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``host``
- 1
- string
- The host that was tested.
* - ``port``
- 1
- int
- The port that was tested
* - ``protocol``
- 1
- string
- The protocol that was tested, ``tcp`` or ``udp``
* - ``result``
- 1
- bool
- ``true`` if the check passed.
+4 -2
View File
@@ -7,7 +7,8 @@ Version information
.. http:get:: /api/version
Retrieve information regarding server and API version. Returns a JSON object with two keys, ``api`` containing
the API version, ``server`` containing the server version.
the API version, ``server`` containing the server version, ``text`` containing the server version including
the prefix ``OctoPrint `` (to determine that this is indeed a genuine OctoPrint instance).
**Example Request**
@@ -26,7 +27,8 @@ Version information
{
"api": "0.1",
"server": "1.1.0"
"server": "1.3.10",
"text": "OctoPrint 1.3.10"
}
:statuscode 200: No error
@@ -0,0 +1,110 @@
.. _sec-bundledplugins-action_command_prompt:
Action Command Prompt support
=============================
The OctoPrint Action Command Prompt Support Plugin comes bundled with OctoPrint (starting with 1.3.9).
It allows firmware to trigger dialog prompts for logged in users using :ref:`action commands <sec-features-action_commands>`, e.g. to wait
for user acknowledgement or allow the user to choose between options, and also to close the dialog again
in case its no longer needed, e.g. due to the user proceeding on the printer's own controller.
The choice of the user can be communicated back to the firmware via a configurable GCODE command with a
placeholder for the selected option's index.
.. _fig-bundledplugins-action_command_prompt-example:
.. figure:: ../images/bundledplugins-action_command_prompt-example.png
:align: center
:alt: Simple prompt example
A simple dialog example triggered by the firmware
.. _sec-bundledplugins-action_command_prompt-firststeps:
First Steps
-----------
In order for this plugin to work, you'll need to configure it with the command your firmware uses to accept
dialog selections. You can do that in the settings dialog.
Currently there is no agreed upon command for this since no firmware has yet made use of this feature, so OctoPrint
ships with an empty value here.
.. _sec-bundledplugins-action_command_prompt-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``selection_command``: The command to send to the firmware on choice, including the ``{choice}`` placeholder, e.g. ``M876 S{choice}``.
You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``.
.. _sec-bundledplugins-action_command_prompt-action_commands:
Supported action commands
-------------------------
prompt_begin <message>
Starts the definition of a prompt dialog. ``<message>`` is the message to display to the user. Will be ignored
if a dialog is already defined.
prompt_choice <text>
Defines a choice with the associated ``<text>``. Will be ignored if no dialog has been defined yet.
prompt_button <text>
Same as ``prompt_choice``.
prompt_show
Tells OctoPrint that the dialog is now fully defined and to prompt the user. Will be ignored if no dialog is
defined yet.
prompt_end
Tells OctoPrint that the dialog should now be closed (e.g. the user made the choice on the printer directly instead
of through OctoPrint). Will be ignored if no dialog is defined yet.
.. _sec-bundledplugins-action_command_prompt-example:
Example communication with the firmware
---------------------------------------
.. _sec-bundledplugins-action_command_prompt-sourcecode:
To display the :ref:`above dialog <fig-bundledplugins-action_command_prompt-example>` the firmware sent these action commands:
.. code-block:: none
//action:prompt_begin Filament unloaded, swap then proceed
//action:prompt_choice Filament swapped
//action:prompt_show
If the user clicks the button, assuming a ``selection_command`` of ``M876 S{choice}`` is configured, OctoPrint
will send back ``M876 S0`` (0-based index).
A more complicated example with three options would be the following:
.. code-block:: none
//action:prompt_begin Filament runout detected. Please choose how to proceed:
//action:prompt_choice Swap filament
//action:prompt_choice Home X/Y and pause print
//action:prompt_choice Abort print
//action:prompt_show
This would produce the following output:
.. _fig-bundledplugins-action_command_prompt-example2:
.. figure:: ../images/bundledplugins-action_command_prompt-example2.png
:align: center
:alt: Another prompt example
Another dialog example triggered by the firmware
If the user selects "Abort print", OctoPrint will send ``2`` as selected choice.
Source code
-----------
The source of the Action Command Prompt Support plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/action_command_prompt``.
+67
View File
@@ -0,0 +1,67 @@
.. _sec-bundledplugins-announcements:
Announcement Plugin
===================
The OctoPrint Announcement Plugin comes bundled with OctoPrint (starting with 1.2.11).
It displays announcements fetched from OctoPrint's websites, such as important updates, release announcements, new
plugins and similar. Through some manual configuration via ``config.yaml`` it also allows adding additional channels
via RSS or Atom feed URLs.
.. _fig-bundledplugins-announcements-example1:
.. figure:: ../images/bundledplugins-announcements-example1.png
:align: center
:alt: Example notification
An example notification from the Announcement Plugin.
.. _fig-bundledplugins-announcements-example2:
.. figure:: ../images/bundledplugins-announcements-example2.png
:align: center
:alt: Announcement reader
The Announcement Plugin's reader dialog.
.. _fig-bundledplugins-announcements-settings:
.. figure:: ../images/bundledplugins-announcements-settings.png
:align: center
:alt: Announcement settings
The Announcement Plugin's settings dialog.
.. _sec-bundledplugins-announcements-configuration:
Configuring the plugin
----------------------
The plugin allows enabling and disabling the preconfigured announcement channels via its settings dialog.
On top of that it's possible to add additional announcement channels (as RSS or Atom feed URLs) or change the
configuration of the existing channels through ``config.yaml``.
The available configuration keys are:
* ``channels``: Configured announcement channels. A mapping from a unique identifier to a configuration structure
that follows this format:
* ``name``: Name of the channel, used e.g. in the title of the displayed notifications.
* ``description``: Description of the channel.
* ``priority``: ``1`` for high priority announcements (red notification), ``2`` for regular ones (yellow notification).
* ``type``: Currently unused.
* ``url``: URL for the feed acting as notification source, must be RSS or Atom format.
* ``enabled_channels``: List of identifiers of enabled channels.
* ``forced_channels``: List of identifiers of channels that cannot be disabled (currently only ``_important`` which is used sparingly).
* ``channel_order``: List of channel identifiers in the order they should appear in the UI.
* ``ttl``: Time to live of the channel cache in minutes (default: 6 hours).
* ``display_limit``: Limit of items to display per channel (default: 3).
* ``summary_limit``: Limit of characters to display from each channel entry (default: 300).
.. _sec-bundledplugins-announcements-sourcecode:
Source code
-----------
The source of the Announcement plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/announcements``.
+543
View File
@@ -0,0 +1,543 @@
.. _sec-bundledplugins-appkeys:
Application Keys Plugin
=======================
The OctoPrint Application Keys Plugin comes bundled with OctoPrint (starting with version 1.3.10).
It implements a workflow for third party apps or clients to obtain an application specific API key from OctoPrint to interact with it
on a user's behalf, via confirmation of the user through OctoPrint's web interface. Existing keys can be managed
on a per-user base as well as globally by administrators.
.. _fig-bundledplugins-appkeys-confirmation:
.. figure:: ../images/bundledplugins-appkeys-confirmation_prompt.png
:align: center
:alt: Confirmation
The plugin's confirmation generated for a new application key request.
.. _fig-bundledplugins-appkeys-user_settings:
.. figure:: ../images/bundledplugins-appkeys-user_settings.png
:align: center
:alt: Key management via user settings
Users can manage the application specific API keys registered to their account via their user settings.
.. _fig-bundledplugins-appkeys-settings:
.. figure:: ../images/bundledplugins-appkeys-settings.png
:align: center
:alt: Global key management via settings
Administrators can manage all application specific API keys registered to any user.
.. _sec-bundledplugins-appkeys-workflow:
Workflow
--------
The workflow to receive an API key for a third party client/an app via the Application Keys Plugin should consist
of the following steps:
1. The User opens the App and gets prompted to enter or select an instance URL. Optionally (recommended!) the User also
enters their username which is also their user ID into the App.
2. The App :ref:`probes for workflow support <sec-bundledplugins-appkeys-api-probe>` on the Server. If this request
doesn't get an HTTP :http:statuscode:`204` the App needs to direct the user to an alternative manual workflow
(copy-paste API key) and abort this one. Otherwise it proceeds to the next step.
3. The App sends a :ref:`key request <sec-bundledplugins-appkey-datamodel-keyrequest>` to the Server to start the
authorization process.
4. The Server triggers a confirmation dialog for the User on the Webinterface and returns an endpoint to the
App to poll for a decision in the ``Location`` header of an HTTP :http:statuscode:`201`.
5. The App uses the obtained request specific endpoint to poll for a decision every second. An HTTP :http:statuscode:`202`
signals that no decision has been made yet.
6. The User either accepts or denies the access request which makes the Webinterface send a
:ref:`decision request <sec-bundledplugins-appkey-datamodel-decisionrequest>` to the Server.
7. If the User accepted the request, the App receives an HTTP :http:statuscode:`200` with an attached
:ref:`API key response <sec-bundledplugins-appkey-datamodel-keyresponse>`. If they deny it, the App will receive
an HTTP :http:statuscode:`404`.
.. mermaid::
sequenceDiagram
participant User
participant App
participant Webinterface
participant Server
note over User, Server: Step 1, 2 & 3
User->>App: enters URL of instance to connect to and optional user_id
App->>Server: GET /plugin/appkeys/probe
alt Workflow unsupported
Server->>App: 404
App->>User: alternative workflow, copy-paste key manually
else Workflow supported
App->>Server: POST /plugin/appkeys/request, (app_name, user_id)
note over User, Server: Step 4
Server-->>Webinterface: plugin message for "appkeys" w/ (app_name, user_token, user_id)
Webinterface-->>User: Display confirmation dialog
Server->>App: 201, Location: /plugin/appkeys/request/<app_token>
note over User, Server: Step 5
loop Poll for decision
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 202
end
note over User, Server: Step 6 & 7
alt User accepts
User-->>Webinterface: Allow access
Webinterface->>Server: POST /plugin/appkeys/decision/<user_token>, (True)
Server->>Webinterface: 204
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 200, api_key
else User denies
User-->>Webinterface: Deny access
Webinterface->>Server: POST /plugin/appkeys/decision/<user_token>, (False)
Server->>Webinterface: 204
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 404
end
end
.. _sec-bundledplugins-appkeys-api:
API
---
.. _sec-bundledplugins-appkeys-api-probe:
Probe for workflow support
..........................
.. http:get:: /plugin/appkeys/probe
Probes for support of the workflow.
Normally returns an HTTP :http:statuscode:`204`, indicating workflow availability. If a different status code is returned
(usually an HTTP :http:statuscode:`404`), the plugin is disabled or not installed. Fall back to manual api key exchange.
:status 204: the workflow is supported
.. _sec-bundledplugins-appkeys-api-startauthprocess:
Start authorization process
...........................
.. http:post:: /plugin/appkeys/request
Starts the authorization process.
Expects a :ref:`Key request <sec-bundledplugins-appkey-datamodel-keyrequest>` as request body.
The ``app`` parameter should be a human readable identifier to use
for the application requesting access. It will be displayed to the user. Internally it will be used case insensitively,
so ``My App`` and ``my APP`` are considered the same application identifiers.
The optional ``user`` parameter should be used to limit the authorization process to a specified user. If the parameter
is left unset, any user will be able to complete the authorization process and grant access to the app with their
account. E.g. if a user ``me`` starts the process in an app, the app should request that name from the user and use
it in the ``user`` parameter. OctoPrint will then only display the authorization request on browsers the user ``me``
is logged in on.
:json app: application identifier to use for the request, case insensitive
:json user: optional user id to restrict the decision to the specified user
:status 201: authorization process started, polling URL to query can be found in ``Location`` header
.. _sec-bundledplugins-appkeys-api-polldecision:
Poll for decision on existing request
.....................................
.. http:get:: /plugin/appkeys/request/<str:app_token>
Endpoint generated per authorization request to poll for the result.
Returns an HTTP :http:statuscode:`202` while no decision has been made yet, an HTTP :http:statuscode:`200` and
a :ref:`Key response <sec-bundledplugins-appkey-datamodel-keyresponse>` if access has been granted and an
HTTP :http:statuscode:`404` if the request has been denied or timed out.
.. note::
The request will be considered stale and deleted internally if the polling endpoint for it isn't called
for more than 5s.
:status 200: access granted, API key in response body
:status 202: no decision has been made yet, continue polling
:status 404: access denied or request timed out
.. _sec-bundledplugins-appkeys-api-decide:
Decide on existing request
..........................
.. http:post:: /plugin/appkeys/decision/<str:user_token>
Endpoint to decide on the authorization request.
Expects a :ref:`Decision request <sec-bundledplugins-appkey-datamodel-decisionrequest>` as request body.
Returns an HTTP :http:statuscode:`204` on success.
:json decision: boolean value to indicate whether to confirm (``True``) or deny (``False``) access
:status 204: success
.. _sec-bundledplugins-appkeys-api-fetchlist:
Fetch list of existing application keys
.......................................
.. http:get:: /api/plugin/appkeys
Fetches a list of existing application keys and pending requests registered in the system for the current user.
If the additional optional parameter ``all`` is provided and the user has administrator rights, fetches a list
of *all** application keys and pending requests registered in the system for any user.
Returns a :http:statuscode:`200` with a :ref:`List response <sec-bundledplugins-appkey-datamodel-listreponse>` in the
body upon success.
:query all: Fetch all application keys and pending requests from all users. Requires administrator rights.
.. _sec-bundledplugins-appkeys-api-issuecommand:
Issue an application key command
................................
.. http:post:: /api/plugin/appkeys
Application key commands allow revoking existing application keys and manually generating new ones. The available
commands are:
revoke
Revokes an existing application key. Must belong to the user issuing the command, unless the user has admin rights
in which case they make revoke any application key in the system. Expects the key in question as parameter ``key``.
generate
Generates a new application key for the user, using the application identifier provided as parameter ``app``.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example revoke request**
Revokes the (fictional) key ``aabbccddeeff112233445566``.
.. sourcecode:: http
POST /api/plugin/appkeys HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "revoke",
"key": "aabbccddeeff112233445566"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example generate request**
Generates a new key for application identifier "My awesome application 1.0".
.. sourcecode:: http
POST /api/plugin/appkeys HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "generate",
"key": "My awesome application 1.0"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``revoke`` or ``generate``
:json string key: ``revoke`` command: The key to revoke
:json string app: ``generate`` command: Application identifier for which to generate a key
:statuscode 204: No error
:statuscode 400: Invalid or missing parameter
.. _sec-bundledplugins-appkey-datamodel:
Data model
----------
.. _sec-bundledplugins-appkey-datamodel-keyrequest:
Key request
...........
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``app``
- 1
- str
- Application identifier to use for the request
* - ``user``
- 0..1
- str
- User identifier/name to restrict the request to
.. _sec-bundledplugins-appkey-datamodel-keyresponse:
Key response
............
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``apikey``
- 1
- str
- the API key generated for the application
.. _sec-bundledplugins-appkey-datamodel-decisionrequest:
Decision request
................
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``decision``
- 1
- boolean
- ``True`` if the access request it to be granted, ``False`` otherwise
.. _sec-bundledplugins-appkey-datamodel-listreponse:
List response
.............
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``keys``
- 1
- list of :ref:`key list entries <sec-bundledplugins-appkey-datamodel-keylistentry>`
- Keys registered in the system
* - ``pending``
- 1
- list of :ref:`pending list entries <sec-bundledplugins-appkey-datamodel-pendinglistentry>`
- Currently pending authorization requests
.. _sec-bundledplugins-appkey-datamodel-keylistentry:
Key list entry
..............
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``api_key``
- 1
- str
- API key
* - ``app_id``
- 1
- str
- Application identifier
* - ``user_id``
- 1
- str
- User ID of the key's owner
.. _sec-bundledplugins-appkey-datamodel-pendinglistentry:
Pending list entry
..................
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``app_id``
- 1
- str
- Application identifier
* - ``user_id``
- 0..1
- str
- optional: User ID of user who can grant or deny request
* - ``user_token``
- 1
- str
- Token to grant or deny request
.. _sec-bundledplugins-appkeys-jsclientlib:
JavaScript Client Library
-------------------------
.. js:function:: OctoPrintClient.plugins.appkeys.getKeys(opts)
Retrieves registered keys and pending requests for the current user.
See :ref:`Fetch list of existing application keys <sec-bundledplugins-appkeys-api-fetchlist>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.getAllKeys(opts)
Retrieves registered keys and pending requests for all users.
Needs administrator rights.
See :ref:`Fetch list of existing application keys <sec-bundledplugins-appkeys-api-fetchlist>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.generateKey(app, opts)
Generates a key for the given ``app`` and the current user.
See :ref:`Issue an application key command <sec-bundledplugins-appkeys-api-issuecommand>` for details.
:param string app: Application identifier
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.revokeKey(key, opts)
Revokes the given ``key``. The key must belong to the current user, or the current user must have administrator
rights.
See :ref:`Issue an application key command <sec-bundledplugins-appkeys-api-issuecommand>` for details.
:param string key: Key to revoke
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.decide(token, decision, opts)
Decides on an existing authorization request.
See :ref:`Decide on existing request <sec-bundledplugins-appkeys-api-decide>` for more details.
:param string token: User token for which to make the decision, as pushed to the client via the socket.
:param boolean decision: Whether to grant access (``true``) or not (``false``).
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.probe(opts)
Probes for workflow support.
See :ref:`Probe for workflow support <sec-bundledplugins-appkeys-api-probe>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.request(app, opts)
Starts a new authorization request for the provided ``app`` identifier.
See :ref:`Start authorization process <sec-bundledplugins-appkeys-api-startauthprocess>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.requestForUser(app, user, opts)
Starts a new authorization request for the provided ``app`` and ``user`` identifiers.
See :ref:`Start authorization process <sec-bundledplugins-appkeys-api-startauthprocess>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.checkDecision(token, opts)
Polls for a decision on an existing authorization request identified by ``token``.
See :ref:`Poll for decision on existing request <sec-bundledplugins-appkeys-api-polldecision>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.authenticate(app, user, opts)
Convenience function that probes for support, issues a request and then automatically starts polling for a decision
on the returned polling endpoint every 1s, until either a positive or negative decision is returned. On success the
returned promise is resolved with the generated API key as argument. If anything goes wrong or there is no support
for the workflow, the promise is rejected.
**Example usage**
.. sourcecode:: javascript
OctoPrint.plugins.appkeys.authenticate("My App", "some_user")
.done(function(api_key) {
console.log("Got our API key:", api_key);
})
.fail(function() {
console.log("No API key for us");
})
:param string app: Application identifier
:param string user: Optional user identifier
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. _sec-bundledplugins-appkeys-sourcecode:
Source code
-----------
The source of the Application Keys plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/appkeys``.
+70
View File
@@ -0,0 +1,70 @@
.. _sec-bundledplugins-backup:
Backup Plugin
=============
The OctoPrint Backup Plugin comes bundled with OctoPrint (starting with 1.3.10).
It allows the creation and restoration of backups of OctoPrint's settings, data and installed plugins [#]_.
This allows easy migration
to newly setup instances as well as making regular backups to prevent data loss.
.. _fig-bundledplugins-backup-settings:
.. figure:: ../images/bundledplugins-backup-settings.png
:align: center
:alt: OctoPrint Backup Plugin
The plugin's settings panel with existing backups, the backup creation and restore sections.
As long as plugins adhere to the standard of storing their data and settings in OctoPrint's plugin data folders, their
data will be part of the backup. Note that the backups made by the Backup Plugin will *not* be part of any backups -
you'll need to persist the resulting zip files yourself!
.. _sec-bundledplugins-backup-cli:
Command line usage
------------------
The Backup Plugin implements a command line interface that allows creation and restoration of backups.
It adds two new commands, ``backup:backup`` and ``backup_restore``.
.. code-block:: none
$ octoprint plugins backup:backup --help
Initializing settings & plugin subsystem...
Usage: octoprint plugins backup:backup [OPTIONS]
Creates a new backup.
Options:
--exclude TEXT Identifiers of data folders to exclude, e.g. 'uploads' to
exclude uploads or 'timelapse' to exclude timelapses.
--help Show this message and exit.
$ octoprint plugins backup:restore --help
Initializing settings & plugin subsystem...
Usage: octoprint plugins backup:restore [OPTIONS] PATH
Restores an existing backup from the backup zip provided as argument.
OctoPrint does not need to run for this to proceed.
Options:
--help Show this message and exit.
.. note::
The ``backup:backup`` command can be useful in combination with a cronjob to create backups in regular intervals.
.. _sec-bundledplugins-backup-sourcecode:
Source code
-----------
The source of the Backup plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/backup``.
.. [#] Note that only those plugins that are available on `OctoPrint's official plugin repository <https://plugins.octoprint.org>`_
can be automatically restored. If you have plugins installed that are not available on there you'll get their
names and - if available - homepage URL displayed after restore in order to be able to manually reinstall them.
-138
View File
@@ -1,138 +0,0 @@
.. _sec-bundledplugins_cura:
Cura
====
The Cura Plugin allows slicing of STL files uploaded to OctoPrint directly via
the `CuraEngine <http://github.com/Ultimaker/CuraEngine>`_ **up to and
including version 15.04.x** and supersedes the slicing support integrated into
OctoPrint so far. It comes bundled with OctoPrint starting with version 1.2.0.
.. note::
Versions of CuraEngine later than 15.04.x have changed their calling
parameters in such a way that the current implementation of OctoPrint's Cura plugin
is not compatible to it. For this reason, please use only CuraEngine versions up to
and including 15.04 for now, as available in the ``legacy`` branch of the CuraEngine
repository on Github.
The plugin offers a settings module that allows configuring the path to the
CuraEngine executable to use, as well as importing and managing slicing
profiles to be used. Please note that the Cura Plugin will use the printer
parameters you configured within OctoPrint (meaning bed size and extruder
count and offsets) for slicing.
.. _sec-bundledplugins-cura-firststeps:
First Steps
-----------
Before you can slice from within OctoPrint, you'll need to
#. :ref:`Install CuraEngine <sec-bundledplugins-cura-installing>`
#. :ref:`Configure the path to CuraEngine within OctoPrint <sec-bundledplugins-cura-configuring>`
#. :ref:`Export a slicing profile from Cura and import it within OctoPrint <sec-bundledplugins-cura-profiles>`
.. note::
OctoPi 0.12.0 and later ships with steps 1 and 2 already done, you only need to
supply one or more slicing profiles to get going :)
.. _sec-bundledplugins-cura-installing:
Installing CuraEngine
---------------------
You'll need a build of ``legacy`` branch of `CuraEngine <http://github.com/Ultimaker/CuraEngine>`_
in order to be able to use the Cura OctoPrint plugin. You can find the ``legacy`` branch
`here <https://github.com/ultimaker/curaengine/tree/legacy>`_.
If you previously used the `old variant of the Cura integration <https://github.com/foosel/OctoPrint/wiki/Cura-Integration>`_,
you probably still have a fully functional binary lying around in the
installation folder of the full install of Cura you used then -- just put the
path to that in the plugin settings.
.. _sec-bundledplugins-cura-installing-raspbian:
Compiling for Raspbian
++++++++++++++++++++++
.. note::
A binary of CuraEngine 15.04.06 precompiled on Raspbian Jessie Lite 2016-03-18 is available
`here <http://bit.ly/octopi_cura_engine_150406>`_. Don't forget to make it
executable after copying it to your preferred destination on your Pi
(suggestion: ``/usr/local/bin``) with ``chmod +x cura_engine``. Use at your
own risk.
Raspbian Jessie
~~~~~~~~~~~~~~~
Building on Raspbian Jessie is as easy as::
sudo apt-get -y install gcc-4.7 g++-4.7
git clone -b legacy https://github.com/Ultimaker/CuraEngine.git
cd CuraEngine
make
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``).
Raspbian Wheezy
~~~~~~~~~~~~~~~
You'll need to install a new version of gcc and g++ and patch CuraEngine's
Makefile (see `this post <http://umforum.ultimaker.com/index.php?/topic/5943-recent-build-of-curaengine-wont-compile-on-raspberry-pi/#entry58539>`_)
in order for the compilation to work on current Raspbian builds (e.g. OctoPi)::
sudo apt-get -y install gcc-4.7 g++-4.7
git clone -b legacy https://github.com/Ultimaker/CuraEngine.git
cd CuraEngine
wget http://bit.ly/curaengine_makefile_patch -O CuraEngine.patch
patch < CuraEngine.patch
make CXX=g++-4.7
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``.
+40
View File
@@ -0,0 +1,40 @@
.. _sec-bundledplugins-errortracking:
Error Tracking Plugin
=====================
The Error Tracking plugin will cause any logged exceptions in the server and the browser interface to be sent to
OctoPrint's `Sentry instance <https://sentry.io/>`_.
By enabling it you help to gather detailed information on the cause of bugs or other issues. This is especially
valuable on release candidates, which is why this plugin will also prompt you to enable error tracking if it detects
that you are subscribed to an RC release channel.
By default, even when enabled it will only be active if you are running a released OctoPrint version, so either a stable
release or a release candidate.
The Error Tracking plugin is using a Sentry instance kindly provided by `sentry.io <https://sentry.io/>`_. For information on their service
please refer to their `Security & Compliance documentation <https://sentry.io/security/>`_
and their `Privacy Policy <https://sentry.io/privacy/>`_.
The Error Tracking plugin has been bundled with OctoPrint since version 1.3.11.
.. _sec-bundledplugins-errortracking-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``enabled``: Whether to enable error tracking. Defaults to ``false``.
* ``enabled_unreleased``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases
or release candidates). Defaults to ``false``.
* ``unique_id``: Unique instance identifier, auto generated on first activation
.. _sec-bundledplugins-errortracking-sourcecode:
Source Code
-----------
The source of the Error Tracking plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/errortracking``.
+35
View File
@@ -0,0 +1,35 @@
.. _sec-bundledplugins-forcelogin:
ForceLogin Plugin
=================
The ForceLogin Plugin comes bundled with OctoPrint (starting with version 1.3.10). It removes the anonymous
read-only access that up until 1.3.10 was standard when accessing OctoPrint instances without being logged in and
instead forces users to log in if they want to get any kind of information from OctoPrint.
.. _fig-bundledplugins-forcelogin:
.. figure:: ../images/bundledplugins-forcelogin-dialog.png
:align: center
:alt: Forced login dialog
OctoPrint's new forced login dialog.
.. warning::
Keep in mind that **OctoPrint does not manage your webcam**, it merely embeds it. If you have a webcam,
it will still be accessible to users who are not logged in under its (guessable) URL. If you need to restrict
access to your webcam, you'll need to find a way to do so directly on the webcam server which - again -
is not OctoPrint itself.
.. note::
If you want back the old behaviour of allowing anonymous read-only access to your OctoPrint instance, disable
the ForceLogin Plugin in OctoPrint's plugin manager.
.. _sec-bundledplugins-forcelogin-sourcecode:
Source code
-----------
The source of the ForceLogin plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/forcelogin``.
+9 -1
View File
@@ -7,7 +7,15 @@ Bundled Plugins
.. toctree::
:maxdepth: 2
cura.rst
action_command_prompt.rst
announcements.rst
tracking.rst
appkeys.rst
backup.rst
discovery.rst
errortracking.rst
forcelogin.rst
logging.rst
pluginmanager.rst
printer_safety_check.rst
softwareupdate.rst
+238
View File
@@ -0,0 +1,238 @@
.. _sec-bundledplugins-logging:
Logging
=======
The OctoPrint Logging plugin comes bundled with OctoPrint starting with version 1.3.7.
It implements the log management functionality that was formerly part of the core application and adds features to
configure logging levels for sub modules through the included settings dialog.
.. _fig-bundledplugins-logging-settings:
.. figure:: ../images/bundledplugins-logging-settings.png
:align: center
:alt: Logging plugin
The settings dialog of the Logging plugin
.. _sec-bundledplugins-logging-api:
API
---
.. note::
All log file management operations require admin rights.
.. _sec-bundledplugins-logging-api-list_logs:
Retrieve a list of available log files
++++++++++++++++++++++++++++++++++++++
.. http:get:: /plugin/logging/logs
Retrieve information regarding all log files currently available and regarding the disk space still available
in the system on the location the log files are being stored.
Returns a :ref:`Logfile Retrieve response <sec-bundledplugins-logging-api-datamodel-retrieveresponse>`.
**Example**
.. sourcecode:: http
GET /plugin/logging/logs HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files" : [
{
"date" : 1393158814,
"name" : "octoprint.log",
"size" : 43712,
"refs": {
"resource": "http://example.com/plugin/logging/logs/octoprint.log",
"download": "http://example.com/downloads/logs/octoprint.log"
}
},
{
"date" : 1392628936,
"name" : "octoprint.log.2014-02-17",
"size" : 13205,
"refs": {
"resource": "http://example.com/plugin/logging/logs/octoprint.log.2014-02-17",
"download": "http://example.com/downloads/logs/octoprint.log.2014-02-17"
}
},
{
"date" : 1393158814,
"name" : "serial.log",
"size" : 1798419,
"refs": {
"resource": "http://example.com/plugin/logging/logs/serial.log",
"download": "http://example.com/downloads/logs/serial.log"
}
}
],
"free": 12237201408
}
:statuscode 200: No error
:statuscode 403: If the given API token did not have admin rights associated with it
.. _sec-bundledplugins-logging-api-delete_logs:
Delete a specific logfile
+++++++++++++++++++++++++
.. http:delete:: /plugin/logging/logs/(path:filename)
Delete the selected log file with name `filename`.
Returns a :http:statuscode:`204` after successful deletion.
**Example Request**
.. sourcecode:: http
DELETE /plugin/logging/logs/octoprint.log.2014-02-17 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
:param filename: The filename of the log file to delete
:statuscode 204: No error
:statuscode 403: If the given API token did not have admin rights associated with it
:statuscode 404: If the file was not found
.. _sec-bundledplugins-logging-api-datamodel:
Data model
++++++++++
.. _sec-bundledplugins-logging-api-datamodel-retrieveresponse:
Logfile Retrieve Response
~~~~~~~~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``files``
- 0..*
- Array of :ref:`File information items <sec-bundledplugins-logging-api-datamodel-fileinfo>`
- The list of requested files. Might be an empty list if no files are available
* - ``free``
- 1
- String
- The amount of disk space in bytes available in the local disk space (refers to OctoPrint's ``logs`` folder).
.. _sec-bundledplugins-logging-api-datamodel-fileinfo:
File information
~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- String
- The name of the file
* - ``size``
- 1
- Number
- The size of the file in bytes.
* - ``date``
- 1
- Unix timestamp
- The timestamp when this file was last modified.
* - ``refs``
- 1
- :ref:`References <sec-bundledplugins-logging-api-datamodel-ref>`
- References relevant to this file
.. _sec-bundledplugins-logging-api-datamodel-ref:
References
~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``resource``
- 1
- URL
- The resource that represents the file (e.g. for deleting)
* - ``download``
- 1
- URL
- The download URL for the file
.. _sec-bundledplugins-logging-jsclientlib:
JS Client Library
-----------------
:mod:`OctoPrintClient.plugins.logging`
--------------------------------------
.. note::
All methods here require that the used API token or the existing browser session
has admin rights.
.. js:function:: OctoPrintClient.plugins.logging.listLogs(opts)
Retrieves a list of log files.
See :ref:`Retrieve a list of available log files <sec-bundledplugins-logging-api-list_logs>` for details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.logging.deleteLog(path, opts)
Deletes the specified log ``path``.
See :ref:`Delete a specific log file <sec-bundledplugins-logging-api-delete_logs>` for details.
:param string path: The path to the log file to delete
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.logging.downloadLog(path, opts)
Downloads the specified log ``file``.
See :js:func:`OctoPrint.download` for more details on the underlying library download mechanism.
:param string path: The path to the log file to download
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. _sec-bundledplugins-logging-sourcecode:
Source Code
-----------
The source of the Logging plugin is bundled with OctoPrint and can be found in its source repository under ``src/octoprint/plugins/logging``.
+75
View File
@@ -54,6 +54,12 @@ under Settings > Plugin Manager, or by directly editing ``config.yaml``:
# Time to live for the repository cache
repository_ttl: 1440
# The URL of the plugin notices feed to use
notices: http://plugins.octoprint.org/notices.json
# Time to live for the notices feed cache
notices_ttl: 360
# Additional arguments to use with pip. Defaults to unset,
# you normally shouldn't need to modify this
pip_args: --some --additional --pip --arguments
@@ -76,6 +82,75 @@ under Settings > Plugin Manager, or by directly editing ``config.yaml``:
- hidden
- plugins
.. _sec-bundledplugins-pluginmanager-events:
Events
------
plugin_pluginmanager_install_plugin
A plugin was installed.
Payload:
* ``id``: the identifier of the installed plugin
* ``version``: the version of the installed plugin
* ``source``: source from which the plugin was installed, can be an URL or a path in the local file system
* ``source_type``: type of source from which the plugin was installed, can be ``url`` or ``path``
plugin_pluginmanager_uninstall_plugin
A plugin was uninstalled.
Payload:
* ``id``: the identifier of the uninstalled plugin
* ``version``: the version of the uninstalled plugin
plugin_pluginmanager_enable_plugin
A plugin was enabled.
Payload:
* ``id``: the identifier of the enabled plugin
* ``version``: the version of the enabled plugin
plugin_pluginmanager_disabled_plugin
A plugin was disabled.
Payload:
* ``id``: the identifier of the disabled plugin
* ``version``: the version of the disabled plugin
.. _sec-bundledplugins-pluginmanager-hooks:
Hooks
-----
.. _sec-bundledplugins-pluginmanager-hooks-reconnect_hooks:
octoprint.plugin.pluginmanager.reconnect_hooks
++++++++++++++++++++++++++++++++++++++++++++++
.. py:function:: reconnect_hooks_hook(*args, **kwargs)
Returns additional hooks defined by the plugin for which the plugin manager
should display the "You should reconnect to your printer" message on plugin
install/uninstall/enabling/disabling.
Handlers should return a Python list containing the affected hook names.
**Example**
.. code-block:: python
def reconnect_hooks_hook(*args, **kwargs):
return ["octoprint.plugin.exampleplugin.some_custom_hook",
"octoprint.plugin.exampleplugin.some_other_custom_hook"]
__plugin_hooks__ = {
"octoprint.plugin.pluginmanager.reconnect_hooks": reconnect_hooks_hook
}
.. _sec-bundledplugins-pluginmanager-sourcecode:
Source Code
@@ -0,0 +1,52 @@
.. _sec-bundledplugins-printer_safety_check:
Printer Safety Check
====================
The Printer Safety Check plugin comes bundled with OctoPrint starting with version 1.3.7.
It tries to identify printers or rather printer firmwares with known safety issues, such as
disabled thermal runaway protection, and displays a warning box to logged in users on
such identification.
.. _fig-bundledplugins-printer_safety_check-example:
.. figure:: ../images/bundledplugins-printer_safety_check-example.png
:align: center
:alt: Printer Safety Check warning example
An example of a warning generated by the Printer Safety Check
Please refer to the `entry on the "unsafe firmware" warning in OctoPrint's FAQ <https://faq.octoprint.org/warning-firmware-unsafe>`_
for a list of currently identified printers.
If you know of further printers/printer firmwares that need to be added here, please
`get in touch on the forum and provide their response to an M115 <https://faq.octoprint.org/warning-firmware-unsafe>`_.
.. note::
Feel free to disable the plugin in OctoPrint's Plugin Manager if you feel like it is unnecessary. Be advised though
that even if your printer might be running totally fine with a known unsafe configuration, that might change
unexpectedly and with `catastrophic <https://www.thissmarthouse.net/dont-burn-your-house-down-3d-printing-a-cautionary-tale/>`_
`results <https://www.reddit.com/r/3Dprinting/comments/6cekgk/house_fire_thanks_to_cheap_printer_from_china/>`_.
.. _sec-bundledplugins-printer_safety_check-events:
Events
------
warning
A printer safety warning was triggered.
Payload:
* ``check_type``: type of check that was triggered (e.g. ``m115``, ``received`` or ``cap``)
* ``check_name``: name of check that was triggered (e.g. ``aneta8``)
* ``warning_type``: type of warning that was triggered (e.g. ``firmware-unsafe``)
.. _sec-bundledplugins-printer_safety_check-source:
Source Code
-----------
The source of the Printer Safety Check plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/printer_safety_check``.
+121 -56
View File
@@ -14,14 +14,14 @@ First Steps
Out of the box the Software Update Plugin will be able to notify you of any
updates that might be available for your OctoPrint installation or any plugins
that registered themselves with it. In order to also be able to update
your OctoPrint installation, you'll need to configure
at least OctoPrint's checkout folder, and you also should
configure the restart commands for OctoPrint and the whole server.
that registered themselves with it. In order for automatic restarts after updates
to work, you should configure the restart commands for OctoPrint and the whole server.
For configuring the plugin you'll need to go into OctoPrint's Settings Dialog, navigate to the
Software Upda.. _section therein and once you are there click on the little wrench icon in the
upper right corner.
Out of the box the plugin should already be ready to update your OctoPrint installation to current
stable release versions, but you can also switch to one of the available release candidate channels
or outright git commit tracking via the plugin's configuration dialog. To open this dialog, fire up OctoPrint's
Settings Dialog, navigate to the Software Update section therein and once you are there click on the little
wrench icon in the upper right corner.
.. _fig-bundledplugins-softwareupdate-plugin-configuration:
.. figure:: ../images/bundledplugins-softwareupdate-plugin-configuration.png
@@ -32,36 +32,21 @@ upper right corner.
There you can adjust the following settings:
* **OctoPrint checkout folder**: This should 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>`_).
This must be set to allow updating from within OctoPrint
.. note::
OctoPi releases 0.12.0 and later ship with this already setup for you.
.. note::
**OctoPi 0.11.0 users**: Please also take a look at
`the note at the very end of this FAQ entry <https://github.com/foosel/OctoPrint/wiki/FAQ#how-can-i-update-the-octoprint-installation-on-my-octopi-image>`_.
Due to a little issue in that OctoPi release 0.11.0 you might have to fix
the URL your OctoPrint checkout is using for updating. This can easily be
done by SSHing into your OctoPi instance and doing this::
cd ~/OctoPrint
git remote set-url origin https://github.com/foosel/OctoPrint.git
* **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**: The release channel of OctoPrint to track for updates. If you only want stable versions,
* **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>`_).
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.
* **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.
More settings are available by :ref:`editing the correspondi.. _section in config.yaml <sec-bundledplugins-softwareupdate-configuration>`.
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.
@@ -71,9 +56,9 @@ Command line usage
------------------
The functionality of the Software Update Plugin is also available on OctoPrint's command line interface under the
``plugins`` sub command. It's is possible to check for updates via ``octoprint plugins softwareupdate:check``
and to apply available updates via ``octoprint plugins softwareupdate:update``. Please the corresponding
``--help`` pages on details:
``plugins`` sub command. It's possible to check for updates via ``octoprint plugins softwareupdate:check``
and to apply available updates via ``octoprint plugins softwareupdate:update``. Please see the corresponding
``--help`` pages for details:
.. code-block:: none
@@ -132,30 +117,29 @@ Configuring the Plugin
.. code-block:: yaml
plugins:
softwareupdate:
# the time-to-live of the version cache, in minutes
cache_ttl: 60
plugins:
softwareupdate:
# the time-to-live of the version cache, in minutes
cache_ttl: 60
# configured version check and update methods
checks:
# "octoprint" is reserved for OctoPrint
octoprint:
# this defines an version check that will check against releases
# published on OctoPrint's Github repository and an update method
# utilizing an (included) update script that will be run on
# OctoPrint's checkout folder
type: github_release
user: foosel
repo: OctoPrint
update_script: '{python} "/path/to/octoprint-update.py" --python="{python}" "{folder}" "{target}"'
update_folder: /path/to/octoprint/checkout/folder
# configured version check and update methods
checks:
# "octoprint" is reserved for OctoPrint
octoprint:
# this defines a version check that will check against releases
# published on OctoPrint's Github repository and pip as update method
# against the release archives on Github - this is the default
type: github_release
user: foosel
repo: OctoPrint
method: pip
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
# further checks may be define here
# further checks may be defined here
# pip command, if another one than the automatically detected one should be
# used - should normally NOT be necessary and hence set
pip_command: /path/to/pip
# pip command, if another one than the automatically detected one should be
# used - should normally NOT be necessary and hence set
pip_command: /path/to/pip
.. _sec-bundledplugins-softwareupdate-configuration-versionchecks:
@@ -188,6 +172,23 @@ Version checks
* ``repo``: (mandatory) Github repository to check
* ``branch``: Branch of the Github repository to check, defaults to
``master`` if not set.
* ``current``: Current commit hash. Will be updated automatically.
* ``bitbucket_commit``: Checks against commits pushed to Bitbucket. Additional
config parameters:
* ``user``: (mandatory) Bitbucket user the repository to check belongs to
* ``repo``: (mandatory) Bitbucket repository to check
* ``branch``: Branch of the Bitbucket repository to check, defaults to
``master`` if not set.
* ``current``: Current commit hash. Will be updated automatically.
* ``api_user``: (mandatory only for private repositories) Bitbucket user name (not email address).
Requires ``api_password`` to be set. Hint: This is used for the check only. For the actual
download you might register your public SSH key as access key for the according repo and
configure this as pip URL in ``config.yaml``: ``git+ssh://git@bitbucket.org/my_user/my_repo.git@{target_version}``
* ``api_password``: (mandatory only for private repositories) App password. Requires
``api_user`` to be set. **Important**: Never use your actual Bitbucket login password. Generate
a new app password. App passwords are user specific on Bitbucket.
* ``git_commit``: Checks a local git repository for new commits on its
configured remote. Additional config parameters:
@@ -208,10 +209,21 @@ Version checks
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. Additional config
parameters:
* ``python_checker``: (mandatory) A python callable which returns version
* ``python_checker``: (mandatory) A Python callable which returns version
information and whether the current version is up-to-date or not, see
below for details.
* ``always_current``: Always reports that no update is necessary. Useful for debugging
software update mechanisms during development. Additional config parameters:
* ``current_version``: Version to report for both local and remote version.
* ``never_current``: Always reports that an update is necessary. Useful for debugging
software update mechanisms during development. Additional config parameters:
* ``local_version``: Current local version. Defaults to ``1.0.0``.
* ``remote_version``: Remote version to offer update to. Defaults to ``1.0.1``.
.. _sec-bundledplugins-softwareupdate-configuration-updatemethods:
Update methods
@@ -229,8 +241,37 @@ Update methods
``update_folder`` setting or if the ``git_commit`` check is used its
``checkout_folder`` setting.
* ``python_updater``: Can only be specified by plugins through the
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. A python callable
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. A Python callable
which performs the update, see below for details.
* ``sleep_a_bit``: Does nothing but block for a configurable ``duration`` and log
a countdown in the meantime. Useful for debugging software update mechanisms
during development.
.. note::
To allow default configurations for multiple update methods, if more than one of
the above update method specific settings is set the one to use can be selected
by setting the property ``method`` to the method specific setting in question.
**Example**
The following example defines both ``pip`` and ``update_script``. By setting to
``method`` to ``pip``, the Software Update plugin is instructed to use that as
update method.
.. code-block:: yaml
plugins:
softwareupdate:
checks:
octoprint:
type: github_release
user: foosel
repo: OctoPrint
method: pip
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
update_script: '{python} "/path/to/octoprint-update.py" --python="{python}" "{folder}" "{target}"'
checkout_folder: /path/to/octoprint/checkout/folder
.. _sec-bundledplugins-softwareupdate-configuration-patterns:
@@ -251,6 +292,7 @@ plugin itself):
user: foosel
repo: OctoPrint
branch: devel
method: update_script
update_folder: /home/pi/OctoPrint
Plugin installed via pip and hosted on Github under
@@ -283,6 +325,29 @@ The same, but tracking all commits pushed to branch ``devel`` (thus allowing
branch: devel
pip: 'https://github.com/someUser/OctoPrint-SomePlugin/archive/{target}.zip'
.. _sec-bundledplugins-softwareupdate-events:
Events
------
plugin_softwareupdate_update_succeeded
An update succeeded.
Payload:
* ``target``: update target
* ``from_version``: version from which was updated
* ``to_version``: version to which was updated
plugin_softwareupdate_update_failed
An update failed.
Payload:
* ``target``: update target
* ``from_version``: version from which was updated
* ``to_version``: version to which was updated
.. _sec-bundledplugins-softwareupdate-hooks:
Hooks
@@ -320,8 +385,8 @@ octoprint.plugin.softwareupdate.check_config
.. code-block:: python
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
def get_update_information(*args, **kwargs):
return dict(
+45
View File
@@ -0,0 +1,45 @@
.. _sec-bundledplugins-tracking:
Anonymous Usage Tracking Plugin
===============================
The Anonymous Usage Tracking plugin provides valuable insights into how many instances running what versions of
OctoPrint are out there, whether they are successfully completing print jobs and various other metrics.
By enabling it you help to identify problems with new releases and release candidates early on, and to better tailor
OctoPrint's future development to actual use.
For details on what gets tracked, please refer to `tracking.octoprint.org <https://tracking.octoprint.org>`_
and also the `Privacy Policy at tracking.octoprint.org <https://tracking.octoprint.org/privacy>`_.
The Anonymous Usage Tracking plugin has been bundled with OctoPrint since version 1.3.10.
.. _sec-bundledplugins-tracking-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``enabled``: Whether to enable usage tracking. Defaults to ``false``.
* ``unique_id``: Unique instance identifier, auto generated on first activation
* ``server``: The tracking server to track against. Defaults to a tracking endpoint on ``https://tracking.octoprint.org``.
* ``ping``: How often to send a ``ping`` tracking event, in seconds. Defaults to a 15min interval.
* ``events``: Granular configuration of enabled tracking events. All default to ``true``.
* ``startup``: Whether to track startup/shutdown events
* ``printjob``: Whether to track print job related events (start, completion, cancel, ...)
* ``commerror``: Whether to track communication errors with the printer
* ``plugin``: Whether to track plugin related events (install, uninstall, ...)
* ``update``: Whether to track update related events (update successful or not, ...)
* ``printer``: Whether to track printer related events (connected, firmware, ...)
* ``printer_safety_check``: Whether to track warnings of the :ref:`Printer Safety Check <sec-bundledplugins-printer_safety_check>`
* ``throttled``: Whether to track throttle events detected on the underlying system
.. _sec-bundledplugins-tracking-sourcecode:
Source Code
-----------
The source of the Anonymous Usage Tracking plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/tracking``.
+11 -9
View File
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
#
# OctoPrint documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 02 17:08:50 2013.
@@ -33,7 +35,7 @@ needs_sphinx = '1.3'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['codeblockext', 'onlineinclude', 'sphinx.ext.todo', 'sphinx.ext.autodoc', 'sphinxcontrib.httpdomain',
'sphinx.ext.napoleon']
'sphinx.ext.napoleon', 'sphinxcontrib.mermaid']
todo_include_todos = True
# Add any paths that contain templates here, relative to this directory.
@@ -49,8 +51,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'OctoPrint'
copyright = u'%d-%d, Gina Häußge' % (year_since, year_current) if year_current > year_since else u'%d, Gina Häußge' % year_since
project = 'OctoPrint'
copyright = '%d-%d, Gina Häußge' % (year_since, year_current) if year_current > year_since else '%d, Gina Häußge' % year_since
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -207,8 +209,8 @@ htmlhelp_basename = 'OctoPrintdoc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
#latex_documents = [
# ('index', 'OctoPrint.tex', u'OctoPrint Documentation',
# u'Gina Häußge', 'manual'),
# ('index', 'OctoPrint.tex', 'OctoPrint Documentation',
# 'Gina Häußge', 'manual'),
#]
# The name of an image file (relative to this directory) to place at the top of
@@ -237,8 +239,8 @@ htmlhelp_basename = 'OctoPrintdoc'
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'octoprint', u'OctoPrint Documentation',
[u'Gina Häußge'], 1)
('index', 'octoprint', 'OctoPrint Documentation',
['Gina Häußge'], 1)
]
# If true, show URL addresses after external links.
@@ -251,8 +253,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'OctoPrint', u'OctoPrint Documentation',
u'Gina Häußge', 'OctoPrint', 'One line description of project.',
('index', 'OctoPrint', 'OctoPrint Documentation',
'Gina Häußge', 'OctoPrint', 'One line description of project.',
'Miscellaneous'),
]
+284 -95
View File
@@ -29,14 +29,14 @@ Use the following settings to enable access control:
# The user manager implementation to use for accessing user information. Currently only a filebased
# user manager is implemented which stores configured accounts in a YAML file (Default: users.yaml
# in the default configuration folder, see below)
userManager: octoprint.users.FilebasedUserManager
userManager: octoprint.access.users.FilebasedUserManager
# The YAML user file to use. If left out defaults to users.yaml in the default configuration folder.
userFile: /path/to/users.yaml
# If set to true, will automatically log on clients originating from any of the networks defined in
# "localNetworks" as the user defined in "autologinAs". Defaults to false.
autologinLocal: true
autologinLocal: false
# The name of the user to automatically log on clients originating from "localNetworks" as. Must
# be the name of one of your configured users.
@@ -51,6 +51,29 @@ Use the following settings to enable access control:
- 127.0.0.0/8
- 192.168.1.0/24
# Whether to trust Basic Authentication headers. If you have setup Basic Authentication in front of
# OctoPrint and the user names you use there match OctoPrint accounts, by setting this to true users will
# be logged into OctoPrint as the user user during Basic Authentication. Your should ONLY ENABLE THIS if your
# OctoPrint instance is only accessible through a connection locked down through Basic Authentication!
trustBasicAuthentication: false
# Whether to also check the password provided through Basic Authentication if the Basic Authentication
# header is to be trusted. Disabling this will only match the user name in the Basic Authentication
# header and login the user without further checks. Use with caution.
checkBasicAuthenticationPassword: true
# Whether to trust remote user headers. If you have setup authentication in front of
# OctoPrint and the user names you use there match OctoPrint accounts, by setting this to true users will
# be logged into OctoPrint as the user provided in the header. Your should ONLY ENABLE THIS if your
# OctoPrint instance is only accessible through a connection locked down through an authenticating reverse proxy!
trustRemoteUser: false
# Header used by the reverse proxy to convey the authenticated user.
remoteUserHeader: REMOTE_USER
# If a remote user is not found, add them. Use this only if all users from the remote system can use OctoPrint.
addRemoteUsers: false
.. _sec-configuration-config_yaml-api:
API
@@ -70,7 +93,8 @@ Settings for the REST API:
# Whether to allow cross origin access to the API or not
allowCrossOrigin: false
# Additional app api keys, see REST API > Apps in the docs
# Additional app api keys, see REST API > Apps in the docs.
# Deprecated since 1.3.11, to be removed in 1.4.0!
apps:
"some.app.identifier:some_version":
pubkey: <RSA pubkey>
@@ -140,7 +164,7 @@ appearance or to modify the order and presence of the various UI components:
# order of settings, if settings plugins are registered gets extended internally by
# section_plugins and all settings plugins
settings
settings:
- section_printer
- serial
- printerprofiles
@@ -198,7 +222,7 @@ appearance or to modify the order and presence of the various UI components:
tab:
- plugin_helloworld
OctoPrint will then turn this into the order ``plugin_helloworld``, ``temperature``, ``control``, ``gcodeviewer``,
OctoPrint will then display the tabs in the order ``plugin_helloworld``, ``temperature``, ``control``, ``gcodeviewer``,
``terminal``, ``timelapse`` plus any other plugins.
@@ -285,9 +309,13 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# to false.
okWithLinenumber: false
# Number of extruders to simulate on the virtual printer.
# 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
@@ -304,16 +332,12 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# > File opened
includeFilenameInOpened: true
# The maximum movement speeds of the simulated printer's axes, in mm/s
movementSpeed:
x: 6000
y: 6000
z: 200
e: 300
# 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
@@ -331,6 +355,18 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# 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
@@ -358,7 +394,8 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# side will block
rxBuffer: 64
# Size of simulated command buffer
# 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
@@ -370,6 +407,58 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# 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!
- "\x80"
- "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
m115FormatString: "FIRMWARE_NAME: {firmware_name} PROTOCOL_VERSION:1.0"
# Whether to include capability report in M115 output
m115ReportCapabilites: false
# Capabilities to report if capability report is enabled
capabilities:
AUTOREPORT_TEMP: true
# Simulated ambient temperature in °C
ambientTemperature: 21.3
.. _sec-configuration-config_yaml-estimation:
Estimation
@@ -381,7 +470,7 @@ the estimation of the left print time during an active job utilizes this section
.. code-block:: yaml
estimation:
# Parameters for the print time estmation during an ongoing print job
# Parameters for the print time estimation during an ongoing print job
printTime:
# Until which percentage to do a weighted mixture of statistical duration (analysis or
# past prints) with the result from the calculated estimate if that's already available.
@@ -460,52 +549,16 @@ Use the following settings to enable or disable OctoPrint features:
.. code-block:: yaml
feature:
# Whether to enable the gcode viewer in the UI or not
gCodeVisualizer: true
# Whether to enable the temperature graph in the UI or not
temperatureGraph: true
# Specifies whether OctoPrint should wait for the start response from the printer before trying to send commands
# during connect.
waitForStartOnConnect: false
# Specifies whether OctoPrint should send linenumber + checksum with every printer command. Needed for
# successful communication with Repetier firmware
alwaysSendChecksum: false
# Specifies whether OctoPrint should also send linenumber + checksum with commands that are *not*
# detected as valid GCODE (as in, they do not match the regular expression "^\s*([GM]\d+|T)").
sendChecksumWithUnknownCommands: false
# Specifies whether OctoPrint should also use up acknowledgments ("ok") for commands that are *not*
# detected as valid GCODE (as in, they do not match the regular expression "^\s*([GM]\d+|T)").
unknownCommandsNeedAck: false
# Whether to ignore the first ok after a resend response. Needed for successful communication with
# Repetier firmware
swallowOkAfterResend: false
# Specifies whether support for SD printing and file management should be enabled
sdSupport: true
# Specifies whether firmware expects relative paths for selecting SD files
sdRelativePath: false
# Whether to always assume that an SD card is present in the printer.
# Needed by some firmwares which don't report the SD card status properly.
sdAlwaysAvailable: false
# Whether the printer sends repetier style target temperatures in the format
# TargetExtr0:<temperature>
# instead of attaching that information to the regular M105 responses
repetierTargetTemp: false
# Whether to enable external heatup detection (to detect heatup triggered e.g. through the printer's LCD panel or
# while printing from SD) or not. Causes issues with Repetier's "first ok then response" approach to
# communication, so disable for printers running Repetier firmware.
externalHeatupDetection: true
# Whether to enable the keyboard control feature in the control tab
keyboardControl: true
@@ -513,28 +566,20 @@ Use the following settings to enable or disable OctoPrint features:
# notifications instead (false)
pollWatched: false
# Whether to ignore identical resends from the printer (true, repetier) or not (false)
ignoreIdenticalResends: false
# If ignoredIdenticalResends is true, how many consecutive identical resends to ignore
identicalResendsCount: 7
# Whether to support F on its own as a valid GCODE command (true) or not (false)
supportFAsCommand: false
# Whether to enable model size detection and warning (true) or not (false)
modelSizeDetection: true
# Whether to attempt to auto detect the firmware of the printer and adjust settings
# accordingly (true) or not and rely on manual configuration (false)
firmwareDetection: true
# Whether to show a confirmation on print cancelling (true) or not (false)
printCancelConfirmation: true
# Whether to block all sending to the printer while a G4 (dwell) command is active (true, repetier)
# or not (false)
blockWhileDwelling: false
# Commands that should never be auto-uppercased when sent to the printer through the Terminal tab.
# Defaults to only M117.
autoUppercaseBlacklist:
- M117
- M118
# whether G90/G91 also influence absolute/relative mode of extruders
g90InfluencesExtruder: false
.. _sec-configuration-config_yaml-folder:
@@ -591,15 +636,16 @@ Settings pertaining to the server side GCODE analysis implementation.
.. code-block:: yaml
# Maximum number of extruders to support/to sanity check for
maxExtruders: 10
gcodeAnalysis:
# Maximum number of extruders to support/to sanity check for
maxExtruders: 10
# Pause between each processed GCODE line in normal priority mode, seconds
throttle_normalprio: 0.01
# Pause between each processed GCODE line in normal priority mode, seconds
throttle_normalprio: 0.01
# Pause between each processed GCODE line in high priority mode (e.g. on fresh
# uploads), seconds
throttle_highprio: 0.0
# Pause between each processed GCODE line in high priority mode (e.g. on fresh
# uploads), seconds
throttle_highprio: 0.0
.. _sec-configuration-config_yaml-gcodeviewer:
@@ -610,16 +656,17 @@ Settings pertaining to the built in GCODE Viewer.
.. code-block:: yaml
# Whether to enable the GCODE viewer in the UI
enabled: true
gcodeViewer:
# Whether to enable the GCODE viewer in the UI
enabled: true
# Maximum size a GCODE file may have on mobile devices to automatically be loaded
# into the viewer, defaults to 2MB
mobileSizeThreshold: 2097152
# Maximum size a GCODE file may have on mobile devices to automatically be loaded
# into the viewer, defaults to 2MB
mobileSizeThreshold: 2097152
# Maximum size a GCODE file may have to automatically be loaded into the viewer,
# defaults to 20MB
sizeThreshold: 20971520
# Maximum size a GCODE file may have to automatically be loaded into the viewer,
# defaults to 20MB
sizeThreshold: 20971520
.. _sec-configuration-config_yaml-plugins:
@@ -638,6 +685,11 @@ plugins are tracked:
_disabled:
- ...
# Identifiers of plugins for which python compatibility information will be ignored and
# the plugin considered compatible in any case. Only for development, do NOT use in production.
_forcedCompatible:
- ...
# The rest are individual plugin settings, each tracked by their identifier, e.g.:
some_plugin:
some_setting: true
@@ -738,6 +790,10 @@ Use the following settings to configure the serial connection to the printer:
# Defaults to 30 sec
communication: 30
# Timeout during serial communication when busy protocol support is detected, in seconds.
# Defaults to 3 sec
communicationBusy: 3
# Timeout after which to query temperature when no target is set
temperature: 5
@@ -762,7 +818,7 @@ Use the following settings to configure the serial connection to the printer:
# Maximum number of write attempts to serial during which nothing can be written before the communication
# with the printer is considered dead and OctoPrint will disconnect with an error
maxWritePasses:
maxWritePasses: 5
# Use this to define additional patterns to consider for serial port listing. Must be a valid
# "glob" pattern (see http://docs.python.org/2/library/glob.html). Defaults to not set.
@@ -774,6 +830,19 @@ Use the following settings to configure the serial connection to the printer:
additionalBaudrates:
- 123456
# Commands which should not be sent to the printer, e.g. because they are known to block serial
# communication until physical interaction with the printer as is the case on most firmwares with
# the default M0 and M1.
blockedCommands:
- M0
- M1
# Commands which should cause OctoPrint to pause any ongoing prints.
pausingCommands:
- M0
- M1
- M25
# Commands which are known to take a long time to be acknowledged by the firmware. E.g.
# homing, dwelling, auto leveling etc. Defaults to the below commands.
longRunningCommands:
@@ -793,7 +862,8 @@ Use the following settings to configure the serial connection to the printer:
# Command to send in order to initiate a handshake with the printer.
# Defaults to "M110 N0" which simply resets the line numbers in the firmware and which
# should be acknowledged with a simple "ok".
helloCommand: M110 N0
helloCommand:
- M110 N0
# Whether to disconnect on errors or not
disconnectOnErrors: true
@@ -805,13 +875,75 @@ Use the following settings to configure the serial connection to the printer:
# impact, leave on if possible please
logResends: true
# Specifies whether OctoPrint should wait for the start response from the printer before trying to send commands
# during connect.
waitForStartOnConnect: false
# Specifies whether OctoPrint should send linenumber + checksum with every printer command. Needed for
# successful communication with Repetier firmware
alwaysSendChecksum: false
# Specifies whether OctoPrint should also send linenumber + checksum with commands that are *not*
# detected as valid GCODE (as in, they do not match the regular expression "^\s*([GM]\d+|T)").
sendChecksumWithUnknownCommands: false
# Specifies whether OctoPrint should also use up acknowledgments ("ok") for commands that are *not*
# detected as valid GCODE (as in, they do not match the regular expression "^\s*([GM]\d+|T)").
unknownCommandsNeedAck: false
# Whether to ignore the first ok after a resend response. Needed for successful communication with
# Repetier firmware
swallowOkAfterResend: false
# Specifies whether firmware expects relative paths for selecting SD files
sdRelativePath: false
# Whether to always assume that an SD card is present in the printer.
# Needed by some firmwares which don't report the SD card status properly.
sdAlwaysAvailable: false
# Whether the printer sends repetier style target temperatures in the format
# TargetExtr0:<temperature>
# instead of attaching that information to the regular M105 responses
repetierTargetTemp: false
# Whether to enable external heatup detection (to detect heatup triggered e.g. through the printer's LCD panel or
# while printing from SD) or not. Causes issues with Repetier's "first ok then response" approach to
# communication, so disable for printers running Repetier firmware.
externalHeatupDetection: true
# Whether to ignore identical resends from the printer (true, repetier) or not (false)
ignoreIdenticalResends: false
# If ignoredIdenticalResends is true, how many consecutive identical resends to ignore
identicalResendsCount: 7
# Whether to support F on its own as a valid GCODE command (true) or not (false)
supportFAsCommand: false
# Whether to attempt to auto detect the firmware of the printer and adjust settings
# accordingly (true) or not and rely on manual configuration (false)
firmwareDetection: true
# Whether to block all sending to the printer while a G4 (dwell) command is active (true, repetier)
# or not (false)
blockWhileDwelling: false
# Whether to support resends without follow-up ok or not
supportResendsWithoutOk: false
# Whether to "manually" trigger an ok for M29 (a lot of versions of this command are buggy and
# the responds skips on the ok)
# the response skips on the ok)
triggerOkForM29: true
capabilities:
# Whether to enable temperature autoreport in the firmware if its support is detected
autoreport_temp: true
# Whether to shorten the communication timeout if the firmware seems to support the busy protocol
busy_protocol: true
.. _sec-configuration-config_yaml-server:
Server
@@ -837,12 +969,19 @@ Use the following settings to configure the server:
# reset the setting to false
startOnceInSafeMode: false
# Signals to OctoPrint that the last startup was incomplete. OctoPrint will then startup
# in safe mode
incompleteStartup: false
# Set this to true to make OctoPrint ignore incomplete startups. Helpful for development.
ignoreIncompleteStartup: false
# Secret key for encrypting cookies and such, randomly generated on first run
secretKey: someSecretKey
# Settings if OctoPrint is running behind a reverse proxy (haproxy, nginx, apache, ...).
# These are necessary in order to make OctoPrint generate correct external URLs so
# that AJAX requests and download URLs work.
# that AJAX requests and download URLs work, and so that client IPs are read correctly.
reverseProxy:
# The request header from which to determine the URL prefix under which OctoPrint
@@ -876,6 +1015,14 @@ Use the following settings to configure the server:
# (X-Forwarded-Host by default, see above) with forwarded requests.
hostFallback:
# List of trusted downstream servers for which to ignore the IP address when trying to determine
# the connecting client's IP address. If you have OctoPrint behind more than one reverse proxy
# you should add their IPs here so that they won't be interpreted as the client's IP. One reverse
# proxy will be handled correctly by default.
trustedDownstream:
- 192.168.1.254
- 192.168.23.42
# Settings for file uploads to OctoPrint, such as maximum allowed file size and
# header suffixes to use for streaming uploads. OctoPrint does some nifty things internally in
# order to allow streaming of large file uploads to the application rather than just storing
@@ -909,6 +1056,31 @@ Use the following settings to configure the server:
# Command to shut down the system OctoPrint is running on, defaults to being unset
systemShutdownCommand: sudo shutdown -h now
# Configuration of the regular online connectivity check
onlineCheck:
# whether the online check is enabled, defaults to false due to valid privacy concerns
enabled: false
# interval in which to check for online connectivity (in seconds)
interval: 300
# DNS host against which to check (default: 8.8.8.8 aka Google's DNS)
host: 8.8.8.8
# DNS port against which to check (default: 53 - the default DNS port)
port: 53
# Configuration of the plugin blacklist
pluginBlacklist:
# whether use of the blacklist is enabled, defaults to false
enabled: false
# the URL from which to fetch the blacklist
url: http://plugins.octoprint.org/blacklist.json
# time to live of the cached blacklist, in seconds (default: 15 minutes)
ttl: 15 * 60
# Settings of when to display what disk space warning
diskspace:
@@ -930,6 +1102,15 @@ Use the following settings to configure the server:
# How many days to leave unused entries in the preemptive cache config
until: 7
# Configuration of the client IP check to warn about connections from external networks
ipCheck:
# whether to enable the check, defaults to true
enabled: true
# additional non-local subnets to consider trusted, in CIDR notation, e.g. "192.168.1.0/24"
trustedSubnets: []
.. note::
@@ -943,8 +1124,8 @@ Use the following settings to configure the server:
* ``X-Scheme``: should contain your custom URL scheme to use (if different from ``http``), e.g. ``https``
If you use these headers OctoPrint will work both via the reverse proxy as well as when called directly. Take a look
`into OctoPrint's wiki <https://github.com/foosel/OctoPrint/wiki/Reverse-proxy-configuration-examples>`_ for a couple
of examples on how to configure this.
`into OctoPrint's wiki <https://github.com/foosel/OctoPrint/wiki/Reverse-proxy-configuration-examples>`_ for some
examples on how to configure this.
.. _sec-configuration-config_yaml-slicing:
@@ -959,14 +1140,14 @@ Settings for the built-in slicing support:
slicing:
# Whether to enable slicing support or not
enabled:
enabled: true
# Default slicer to use
defaultSlicer: cura
defaultSlicer: null
# Default slicing profiles per slicer
defaultProfiles:
cura: ...
curalegacy: ...
.. _sec-configuration-config_yaml-system:
@@ -975,7 +1156,12 @@ System
Use the following settings to add custom system commands to the "System" dropdown within OctoPrint's top bar.
Commands consist of a name, an action identifier, the commandline to execute and an optional confirmation message to
Commands consist of a ``name`` shown to the user, an ``action`` identifier used by the code and the actual
``command`` including any argument needed for its execution.
By default OctoPrint blocks until the command has returned so that the exit code can be used to show a success
or failure message; use the flag ``async: true`` for commands that don't return.
Optionally you can add a confirmation message to
display before actually executing the command (should be set to False if a confirmation dialog is not desired).
The following example defines a command for shutting down the system under Linux. It assumes that the user under which
@@ -990,7 +1176,7 @@ OctoPrint is running is allowed to do this without password entry:
command: sudo shutdown -h now
confirm: You are about to shutdown the system.
You can also add an divider by setting action to divider like this:
You can also add a divider by setting action to divider like this:
.. code-block:: yaml
@@ -1032,7 +1218,7 @@ Use `Javascript regular expressions <https://developer.mozilla.org/en/docs/Web/J
# A list of filters to display in the terminal tab. Defaults to the filters shown below
terminalFilters:
- name: Suppress temperature messages
regex: '(Send: (N\d+\s+)?M105)|(Recv: ok T:)'
regex: '(Send: (N\d+\s+)?M105)|(Recv:\s+(ok\s+)?.*(B|T\d*):\d+)'
- name: Suppress SD status messages
regex: '(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)'
- name: Suppress wait responses
@@ -1064,6 +1250,9 @@ Use the following settings to configure webcam support:
# Should be left at 1 for RPi1.
ffmpegThreads: 1
# Videocodec to be used for encoding. Defaults to mpeg2video.
ffmpegVideoCodec: mpeg2video
# The bitrate to use for rendering the timelapse video. This gets directly passed to ffmpeg.
bitrate: 5000k
+2 -2
View File
@@ -39,8 +39,8 @@ A list of important components for which an increase in logging might be interes
* ``octoprint.filemanager``: the file management layer
* ``octoprint.plugin``: the plugin sub system
* ``octoprint.plugins.<plugin>``: the plugin ``<plugin>``, e.g. ``octoprint.plugins.discovery`` to change the log level of
the `Discovery plugin <https://github.com/foosel/OctoPrint/wiki/Plugin:-Discovery>`_ or ``octoprint.plugins.cura``
to change the log level of the `Cura plugin <https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura>`_.
the :ref:`Discovery plugin <sec-bundledplugins-discovery>` or ``octoprint.plugins.backup``
to change the log level of the :ref:`Backup plugin <sec-bundledplugins-backup>`.
* ``octoprint.slicing``: the slicing sub system
This list will be expanded when deemed necessary.
+245
View File
@@ -0,0 +1,245 @@
.. _sec-development-environment:
Setting up a Development environment
====================================
.. _sec-development-environment-source:
Obtaining, building and running the source
------------------------------------------
This describes the general steps in obtaining, building and running. OS specific instructions can be found
below.
* Prerequisites:
* `Python 2.7 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
* `Python 3.7 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
* `Git <https://git-scm.com>`_
* Checkout the OctoPrint sources from their Git repository:
* ``git clone -b devel https://github.com/foosel/OctoPrint.git``
* Enter the checked out source folder: ``cd OctoPrint``
* Create virtual environments in the checked out source folder for both Python 2.7 and Python 3.7 to use for
installing and running OctoPrint and its dependencies (this avoids potential versioning issues for the dependencies
with system wide installed instances):
* PY2: ``virtualenv --python=python2 venv2``
* PY3: ``virtualenv --python=python3 venv3``
* Activate one of the virtual environments:
* PY2: ``source venv2/bin/activate`` (Linux, MacOS) or ``source venv2/Scripts/activate`` (Git Bash under Windows, see below)
* PY3: ``source venv3/bin/activate`` (Linux, MacOS) or ``source venv3/Scripts/activate`` (Git Bash under Windows, see below)
* Update ``pip`` in the virtual environment:
* ``pip install --upgrade pip``
* Install OctoPrint in `"editable" mode <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>`_,
including its regular *and* development and plugin development dependencies:
* ``pip install -e .[develop,plugins]``
When the virtual environment is activated you can then:
* run the OctoPrint server via ``octoprint serve``
* run the test suite from the checked out source folder via ``nosetests --with-doctest``
* build the documentation from the ``docs`` sub folder of the checked out sources via ``sphinx-build -b html . _build``
To switch the activated virtual environment, simply activate the new environment as described above.
To deactivate the virtual environment and return to the system's default Python: ``deactivate``.
.. _sec-development-environment-source-linux:
Linux
.....
.. todo::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
First make sure you have python including its header files, pip, setuptools, virtualenv, git and some build requirements
installed:
* On apt based distributions (e.g. Debian, Ubuntu, ...):
.. code-block:: none
sudo apt-get install python python-pip python-dev python-setuptools python-virtualenv git libyaml-dev build-essential
* On zypper based distributions (example below for SLES 12 SP2):
.. code-block:: none
sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/python/SLE_12_SP2/ python_devel
sudo zypper ref
sudo zypper in python python-pip python-devel python-setuptools python-virtualenv git libyaml-devel
sudo zypper in -t pattern Basis-Devel
.. todo::
Using a Linux distribution that doesn't use ``apt`` or ``zypper``? Please send a
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
Then:
.. code-block:: none
cd ~/devel
git clone -b devel https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/bin/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
You can then start OctoPrint via ``~/devel/OctoPrint/venv/bin/octoprint`` or just ``octoprint`` if you activated the virtual
environment.
.. _sec-development-environment-windows:
Windows
.......
.. todo::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
This assumes you'll host your OctoPrint development checkout at ``C:\Devel\OctoPrint``. If you want to use a different
location, please substitute accordingly.
First download & install:
* `Python 2.7.15 Windows x86 MSI installer <https://www.python.org/downloads/release/python-2715/>`_
* make sure to have the installer add Python to the ``PATH`` and have it install ``pip`` too
* `Microsoft Visual C++ Compiler for Python 2.7 <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`_
* `Git for Windows <https://git-for-windows.github.io/>`_
Open the Git Bash you just installed and in that:
.. code-block:: none
pip install virtualenv
cd /c/Devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/Scripts/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
.. _sec-development-environment-mac:
Mac OS X
........
.. note::
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/>`_.
Please report back if it works for you, due to lack of access to a Mac I cannot test it myself. Thanks.
.. todo::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
You'll need a user account with administrator privileges.
* Install the latest version of Xcode suitable for your OS. For example, OS X 10.11 (El Capitan) requires Xcode 7.
* Install Xcode's command line tools:
* ``xcode-select --install``
* ``sudo xcodebuild`` (ensure the license was accepted)
* If you have more than one Xcode installed: ``sudo xcode-select -s /Applications/Xcode.app/Contents/Developer``
* Install Homebrew and use that to install Python:
* ``ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"``
* ``brew install python``
* Install `virtualenv <https://virtualenv.pypa.io/>`_
* ``pip install virtualenv``
* Install OctoPrint
.. code-block:: none
cd ~/devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source venv/bin/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
.. _sec-development-environment-ides:
IDE Setup
---------
.. todo::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
.. todo::
Using another IDE than the ones below? Please send a
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
.. _sec-development-environment-ides-pycharm:
PyCharm
.......
- "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
- "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...", select OctoPrint venv
folder (e.g. ``~/devel/OctoPrint/venv`` or ``C:\Devel\OctoPrint\venv``)
- Right click "src" in project tree, mark as source folder
- Add Run/Debug Configuration, select "Python":
* Name: OctoPrint server
* Script: path to ``run`` in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/run`` or ``C:\Devel\OctoPrint\run``)
* Script parameters: ``serve --debug``
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
* If you want dependencies to auto-update on run if necessary: "Before Launch" > "+" > "Run external tool" > "+"
* Name: Update OctoPrint dependencies
* Program: ``$PyInterpreterDirectory$/pip`` (or ``$PyInterpreterDirectory$/pip.exe`` on Windows)
* Parameters: ``install -e .[develop,plugins]``
* Working directory: ``$ProjectFileDir$``
- Add Run/Debug Configuration, select "Python tests" and therein "Nosetests":
* Name: OctoPrint nosetests
* Target: Path, ``.``
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
* Just like with the run configuration for the server you can also have the dependencies auto-update on run of
the tests, see above on how to set this up.
- Add Run/Debug Configuration, select "Python docs" and therein "Sphinx task"
* Name: OctoPrint docs
* Command: ``html``
* Input: the ``docs`` folder in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/docs`` or
``C:\Devel\OctoPrint\docs``)
* Output: the ``docs/_build`` folder in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/docs/_build`` or
``C:\Devel\OctoPrint\docs\_build``)
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Just like with the run configuration for the server you can also have the dependencies auto-update when building
the documentation, see above on how to set this up.
.. note::
Make sure you are running a PyCharm version of 2016.1 or later, or manually fix
`a debugger bug contained in earlier versions <https://youtrack.jetbrains.com/issue/PY-18365>`_ or plugin management
will not work in your developer install when running OctoPrint from PyCharm in debug mode.
+4 -179
View File
@@ -4,183 +4,8 @@
Development
###########
.. contents::
:local:
.. toctree::
:maxdepth: 3
.. _sec-development-environment:
Setting up a Development environment
====================================
.. _sec-development-environment-source:
Obtaining, building and running the source
------------------------------------------
This describes the general steps in obtaining, building and running. OS specific instructions can be found
below.
* Prerequisites:
* `Python 2.7 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
* `Git <https://git-scm.com>`_
* Checkout the OctoPrint sources from their Git repository: ``git clone https://github.com/foosel/OctoPrint.git``
* Create a virtual environment in the checkout folder to use for installing and running OctoPrint and its
dependencies (this avoids potential versioning issues for the dependencies with system wide installed
instances): ``virtualenv venv``
* Activate the virtual environment: ``source venv/bin/activate`` (might differ per your platform/OS)
* Update ``pip`` in the virtual environment: ``pip install --upgrade pip``
* Install OctoPrint in `"editable" mode <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>`_,
including its regular *and* development dependencies: ``pip install -e .[develop]``
.. _sec-development-environment-source-linux:
Linux
.....
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
First make sure you have python including its header files, pip, setuptools, virtualenv, git and some build requirements
installed:
* On apt based distributions (e.g. Debian, Ubuntu, ...):
.. code-block:: none
sudo apt-get install python python-pip python-dev python-setuptools python-virtualenv git libyaml-dev build-essential
.. todo::
Using a Linux distribution that doesn't use ``apt``? Please send a
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
Then:
.. code-block:: none
cd ~/devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/bin/activate
pip install --upgrade pip
pip install -e .[develop]
You can then start OctoPrint via ``~/devel/OctoPrint/venv/bin/octoprint`` or just ``octoprint`` if you activated the virtual
environment.
.. _sec-development-environment-windows:
Windows
.......
This assumes you'll host your OctoPrint development checkout at ``C:\Devel\OctoPrint``. If you want to use a different
location, please substitute accordingly.
First download & install:
* `Python 2.7.12 Windows x86 MSI installer <https://www.python.org/downloads/release/python-2712/>`_
* make sure to have the installer add Python to the ``PATH`` and have it install ``pip`` too
* `Microsoft Visual C++ Compiler for Python 2.7 <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`_
* `Git for Windows <https://git-for-windows.github.io/>`_
Open the Git Bash you just installed and in that:
.. code-block:: none
pip install virtualenv
cd /c/Devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/bin/activate
pip install --upgrade pip
pip install -e .[develop]
You can then start OctoPrint via ``/c/Devel/OctoPrint/venv/bin/octoprint`` or just ``octoprint`` if you activated the virtual
environment.
.. _sec-development-environment-mac:
Mac OS X
........
.. note::
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/>`_.
Please report back if it works for you, due to lack of access to a Mac I cannot test it myself. Thanks.
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
You'll need a user account with administrator privileges.
* Install the latest version of Xcode suitable for your OS. For example, OS X 10.11 (El Capitan) requires Xcode 7.
* Install Xcode's command line tools:
* ``xcode-select --install``
* ``sudo xcodebuild`` (ensure the license was accepted)
* If you have more than one Xcode installed: ``sudo xcode-select -s /Applications/Xcode.app/Contents/Developer``
* Install Homebrew and use that to install Python:
* ``ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"``
* ``brew install python``
* Install `virtualenv <https://virtualenv.pypa.io/>`_
* ``pip install virtualenv``
* Install OctoPrint
.. code-block:: none
cd ~/devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source venv/bin/activate
pip install -e .[develop]
You can then start OctoPrint via ``~/devel/OctoPrint/venv/bin/octoprint`` or just ``octoprint`` if you activated the virtual
environment.
.. _sec-development-environment-ides:
IDE Setup
---------
.. todo::
Using another IDE than the ones below? Please send a
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
.. _sec-development-environment-ides-pycharm:
PyCharm
.......
- "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
- "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...", select OctoPrint venv
folder (e.g. ``~/devel/OctoPrint/venv`` or ``C:\Devel\OctoPrint\venv``)
- Right click "src" in project tree, mark as source folder
- Add Run/Debug Configuration, select "Python":
* Name: OctoPrint server
* Script: path to ``run`` in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/run`` or ``C:\Devel\OctoPrint\run``)
* Script parameters: ``--debug``
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
.. note::
Make sure you are running a PyCharm version of 2016.1 or later, or manually fix
`a debugger bug contained in earlier versions <https://youtrack.jetbrains.com/issue/PY-18365>`_ or plugin management
will not work in your developer install when running OctoPrint from PyCharm in debug mode.
environment.rst
virtual_printer.rst
+127
View File
@@ -0,0 +1,127 @@
.. _sec-development-virtual-printer:
Setting up the virtual printer for debugging
============================================
OctoPrint includes, by default, a virtual printer plugin. 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.
.. _sec-development-virtual-printer-enable:
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.
.. _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.
Please see the relevant :ref:`config.yaml section <sec-configuration-config_yaml-devel>` for the full details.
.. _sec-development-virtual-printer-log:
Log file
--------
Once activated, the virtual printer will log all serial communication in the ``plugin_virtual_printer_serial.log`` file
that can be found in the OctoPrint settings folder.
.. _sec-development-virtual-printer-debug:
Debug commands
--------------
You can simulate certain conditions and communications through the terminal tab in OctoPrint's interface.
All commands start with ``!!DEBUG:`` and are followed by the command you want to execute. For instance, sending
``!!DEBUG:action_disconnect`` will disconnect the printer. Sending ``!!DEBUG`` without command will show a help
message with all the available commands:
.. code-block:: none
OctoPrint Virtual Printer debug commands
help
?
| This help.
# Action Triggers
action_pause
| Sends a "// action:pause" action trigger to the host.
action_resume
| Sends a "// action:resume" action trigger to the host.
action_disconnect
| Sends a "// action:disconnect" action trigger to the
| host.
action_custom <action>[ <parameters>]
| Sends a custom "// action:<action> <parameters>"
| action trigger to the host.
# Communication Errors
dont_answer
| Will not acknowledge the next command.
go_awol
| Will completely stop replying
trigger_resend_lineno
| Triggers a resend error with a line number mismatch
trigger_resend_checksum
| Triggers a resend error with a checksum mismatch
trigger_missing_checksum
| Triggers a resend error with a missing checksum
trigger_missing_lineno
| Triggers a "no line number with checksum" error w/o resend request
drop_connection
| Drops the serial connection
prepare_ok <broken ok>
| Will cause <broken ok> to be enqueued for use,
| will be used instead of actual "ok"
# Reply Timing / Sleeping
sleep <int:seconds>
| Sleep <seconds> s
sleep_after <str:command> <int:seconds>
| Sleeps <seconds> s after each execution of <command>
sleep_after_next <str:command> <int:seconds>
| Sleeps <seconds> s after execution of next <command>
# SD printing
start_sd <str:file>
| Select and start printing file <file> from SD
select_sd <str:file>
| Select file <file> from SD, don't start printing it yet. Use
| start_sd to start the print
cancel_sd
| Cancels an ongoing SD print
# Misc
send <str:message>
| Sends back <message>
reset
| Simulates a reset. Internal state will be lost.
+167 -58
View File
@@ -6,15 +6,6 @@ Events
.. contents::
.. note::
With release of OctoPrint 1.1.0, the payload data has been harmonized, it is now a key-value-map for all events.
Additionally, the format of the placeholders in both system command and gcode command triggers has been changed to
accommodate for this new format. Last but not least, the way of specifying event hooks has changed, OctoPrint no longer
separates hooks into two sections (gcodeCommandTrigger and systemCommandTrigger) but instead event hooks are now typed
to indicate what to do with the command contained.
.. _sec-events-configuration:
Configuration
@@ -47,6 +38,13 @@ Example
- event: PrintDone
command: python ~/growl.py -t mygrowlserver -d "Completed {file}" -a OctoPrint -i http://raspi/Octoprint_logo.png
type: system
- event:
- PrintStarted
- PrintFailed
- PrintDone
- PrintCancelled
command: python ~/growl.py -t mygrowlserver -d "Event {__eventname} ({name})" -a OctoPrint -i http://raspi/Octoprint_logo.png
type: system
- event: Connected
command:
- M115
@@ -62,6 +60,7 @@ Placeholders
You can use the following generic placeholders in your event hooks:
* ``{__currentZ}``: the current Z position of the head if known, -1 if not available
* ``{__eventname}`` : the name of the event hook being triggered
* ``{__filename}`` : name of currently selected file, or ``NO FILE`` if no file is selected
* ``{__filepath}`` : path in origin location of currently selected file, or ``NO FILE`` if no file is selected
* ``{__fileorigin}`` : origin of currently selected file, or ``NO FILE`` if no file is selected
@@ -85,6 +84,12 @@ and its origin via the placeholder ``{origin}``.
Available Events
================
.. note::
Plugins may add additional events via the :ref:`octoprint.events.register_custom_events hook <sec-plugins-hook-events-register_custom_events>`.
.. _sec-events-available_events-server:
Server
------
@@ -110,6 +115,16 @@ ClientClosed
* ``remoteAddress``: the remote address (IP) of the client that disconnected
ConnectivityChanged
The server's internet connectivity changed
Payload:
* ``old``: Old connectivity value (true for online, false for offline)
* ``new``: New connectivity value (true for online, false for offline)
.. _sec-events-available_events-printer_commmunication:
Printer communication
---------------------
@@ -133,7 +148,8 @@ Disconnected
The server has disconnected from the printer
Error
An error has occurred in the printer communication.
An unrecoverable error has been encountered, either as reported by the firmware (e.g. a thermal runaway) or
on the connection.
Payload:
@@ -148,11 +164,13 @@ PrinterStateChanged
:func:`~octoprint.printer.PrinterInterface.get_state_id` for possible values.
* ``state_string``: Text representation of the new state.
.. _sec-events-available_events-file_handling:
File handling
-------------
Upload
A file has been uploaded.
A file has been uploaded through the web interface.
Payload:
* ``name``: the file's name
@@ -161,23 +179,76 @@ Upload
.. deprecated:: 1.3.0
* ``file``: the file's path within its storage location
* ``file``: the file's path within its storage location. To be removed in 1.4.0.
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
FileAdded
A file has been added to a storage.
Payload:
* ``storage``: the storage's identifier
* ``path``: the file's path within its storage location
* ``name``: the file's name
* ``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]``
.. note::
A copied file triggers this for its new path. A moved file first triggers ``FileRemoved`` for its original
path and then ``FileAdded`` for the new one.
FileRemoved
A file has been removed from a storage.
Payload:
* ``storage``: the storage's identifier
* ``path``: the file's path within its storage location
* ``name``: the file's name
* ``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]``
.. note::
A moved file first triggers ``FileRemoved`` for its original path and then ``FileAdded`` for the new one.
FolderAdded
A folder has been added to a storage.
Payload:
* ``storage``: the storage's identifier
* ``path``: the folder's path within its storage location
* ``name``: the folder's name
.. note::
A copied folder triggers this for its new path. A moved folder first triggers ``FolderRemoved`` for its original
path and then ``FolderAdded`` for the new one.
FolderRemoved
A folder has been removed from a storage.
Payload:
* ``storage``: the storage's identifier
* ``path``: the folder's path within its storage location
* ``name``: the folder's name
.. note::
A moved folder first triggers ``FolderRemoved`` for its original path and then ``FolderAdded`` for the new one.
UpdatedFiles
A file list was modified.
Payload:
* ``type``: the type of file list that was modified. Currently only ``printables`` and ``gcode`` (DEPRECATED) are supported here.
* ``type``: the type of file list that was modified. Only ``printables`` is supported here. See the deprecation
note below.
.. note::
.. deprecated:: 1.2.0
The ``gcode`` modification type has been superseded by ``printables``. It is currently still available for
reasons of backwards compatibility and will also be sent on modification of ``printables``. It will however
be removed with 1.4.0.
The type ``gcode`` has been renamed to ``printables`` with the introduction of a new file management layer that
supports STL files as first class citizens as well. For reasons of backwards compatibility the ``UpdatedFiles``
event for printable files will be fired twice, once with ``type`` set to ``gcode``, once set to ``printables``.
Support for the ``gcode`` type will be removed in the next release after version 1.2.0.
MetadataAnalysisStarted
The metadata analysis of a file has started.
@@ -190,9 +261,7 @@ MetadataAnalysisStarted
.. deprecated:: 1.3.0
* ``file``: the file's path within its storage location
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
* ``file``: the file's path within its storage location. To be removed in 1.4.0.
MetadataAnalysisFinished
The metadata analysis of a file has finished.
@@ -202,13 +271,11 @@ MetadataAnalysisFinished
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the file's origin storage location
* ``result``: the analysis result -- this is a python object currently only available for internal use
* ``result``: the analysis result -- this is a Python object currently only available for internal use
.. deprecated:: 1.3.0
* ``file``: the file's path within its storage location
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
* ``file``: the file's path within its storage location. To be removed in 1.4.0.
FileSelected
A file has been selected for printing.
@@ -221,10 +288,8 @@ FileSelected
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``)
* ``filename``: the file's name
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
FileDeselected
No file is selected any more for printing.
@@ -248,6 +313,8 @@ TransferDone
* ``local``: the file's name as stored locally
* ``remote``: the file's name as stored on SD
.. _sec-events-available_events-printing:
Printing
--------
@@ -259,13 +326,14 @@ PrintStarted
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``user``: the user who started the print job (if available)
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``)
* ``filename``: the file's name
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
PrintFailed
A print failed.
@@ -275,13 +343,15 @@ PrintFailed
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``time``: the elapsed time of the print when it failed, in seconds (float)
* ``reason``: the reason the print failed, either ``cancelled`` or ``error``
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``)
* ``filename``: the file's name
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
PrintDone
A print completed successfully.
@@ -291,24 +361,42 @@ PrintDone
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``time``: the time needed for the print, in seconds (float)
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``)
* ``filename``: the file's name
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
PrintCancelled
The print has been cancelled via the cancel button.
PrintCancelling
The print is about to be cancelled.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``position``: the print head position at the time of cancelling, if available
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``user``: the user who cancelled the print job (if available)
* ``firmwareError``: the firmware error that caused cancelling the print job, if any
PrintCancelled
The print has been cancelled.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``time``: the elapsed time of the print when it was cancelled, in seconds (float)
* ``user``: the user who cancelled the print job (if available)
* ``position``: the print head position at the time of cancelling (if available, not available if recording of the
position on cancel is disabled)
* ``position.x``: x coordinate, as reported back from the firmware through `M114`
* ``position.y``: y coordinate, as reported back from the firmware through `M114`
* ``position.z``: z coordinate, as reported back from the firmware through `M114`
@@ -322,10 +410,8 @@ PrintCancelled
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``)
* ``filename``: the file's name
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
PrintPaused
The print has been paused.
@@ -335,7 +421,11 @@ PrintPaused
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``position``: the print head position at the time of pausing, if available
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``user``: the user who paused the print job (if available)
* ``position``: the print head position at the time of pausing (if available, not available if the recording of
the position on pause is disabled or the pause is completely handled by the printer's firmware)
* ``position.x``: x coordinate, as reported back from the firmware through `M114`
* ``position.y``: y coordinate, as reported back from the firmware through `M114`
* ``position.z``: z coordinate, as reported back from the firmware through `M114`
@@ -349,10 +439,8 @@ PrintPaused
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``)
* ``filename``: the file's name
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
PrintResumed
The print has been resumed.
@@ -362,13 +450,16 @@ PrintResumed
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``user``: the user who resumed the print job (if available)
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``)
* ``filename``: the file's name
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
Still available for reasons of backwards compatibility. Will be removed with 1.4.0.
.. _sec-events-available_events-gcode_processing:
GCODE processing
----------------
@@ -422,6 +513,17 @@ PositionUpdate
* ``t``: last tool selected *through OctoPrint*
* ``f``: last feedrate for move commands ``G0``, ``G1`` or ``G28`` sent *through OctoPrint*
ToolChange
A tool change command was sent to the printer. The payload contains the former current tool index and the
new current tool index.
Payload:
* ``old``: old tool index
* ``new``: new tool index
.. _sec-events-available_events-timelapses:
Timelapses
----------
@@ -476,6 +578,8 @@ MovieFailed
returned a non-0 return code, ``no_frames`` if no frames were captured that could be rendered
to a timelapse, or ``unknown`` for any other reason of failure to render.
.. _sec-events-available_events-slicing:
Slicing
-------
@@ -547,8 +651,13 @@ SlicingProfileDeleted
* ``slicer``: the slicer for which the profile was deleted
* ``profile``: the profile that was deleted
.. _sec-events-available_events-settings:
Settings
--------
SettingsUpdated
The internal settings were updated.
The settings were updated via the REST API.
This event may also be triggered if calling code of :py:class:`octoprint.settings.Settings.save` or
:py:class:`octoprint.plugin.PluginSettings.save` sets the ``trigger_event`` parameter to ``True``.
+10 -4
View File
@@ -21,17 +21,23 @@ Commands, which are admin-only.
If Access Control is disabled, everything is directly accessible. **That also
includes all administrative functionality as well as full control over the
printer!**
printer**, and without the need for an :ref:`API key <sec-api-general-authorization>`!
Upon first start a configuration wizard is provided which allows configuration
of the first administrator account or alternatively disabling Access Control
(which is **NOT** recommended for systems that are directly accessible via the
Internet!).
internet or other untrusted networks!).
.. hint::
If you plan to have your OctoPrint instance accessible over the internet,
**always enable Access Control**.
**always enable Access Control** and ideally **don't make it accessible to
everyone over the internet but instead use a VPN** or at the very least
HTTP basic authentication on a layer above OctoPrint.
A physical device that includes heaters and stepper motors really should not be
publicly reachable by everyone with an internet connection, even with access
control enabled.
.. _sec-features-access_control-rerunning_wizard:
@@ -39,7 +45,7 @@ Rerunning the wizard
--------------------
In case Access Control was disabled in the configuration wizard, it is
possibly to re-run it by editing ``config.yaml`` [#f1]_ and setting ``firstRun``
possible to re-run it by editing ``config.yaml`` [#f1]_ and setting ``firstRun``
in the ``server`` section and ``enabled`` in the ``accessControl`` section to
``true``:
+22 -3
View File
@@ -21,16 +21,35 @@ Action commands are a feature defined for the GCODE based RepRap communication p
OctoPrint out of the box supports handling of the above mentioned commands:
cancel
When this command is received from the printer, OctoPrint will cancel a current print job like if the
"Cancel" button had been clicked.
pause
When this command is received from the printer, OctoPrint will pause streaming of a current print job just like if the
When this command is received from the printer, OctoPrint will pause a current print job just like if the
"Pause" button had been clicked.
paused
When this command is received from the printer, OctoPrint will pause a current print job but *without* triggering
any GCODE scripts or sending SD print control commands to the printer. This might be interesting for firmware
that wants to signal to OctoPrint that a print should be paused but without any control interference from
OctoPrint, e.g. in case of a filament change fully managed by the firmware.
resume
When this command is received from the printer, OctoPrint will resume streaming of a current print job just like if
When this command is received from the printer, OctoPrint will resume a current print job just like if
the "Resume" button had been clicked.
resumed
When this command is received from the printer, OctoPrint will resume a current print job but *without* triggering
any GCODE scripts or sending SD print control commands to the printer. This might be interesting for firmware
that wants to signal to OctoPrint that a print should be resumed but without any control interference from
OctoPrint, e.g. in case of a filament change fully managed by the firmware.
disconnect
When this command is Received from the printer, OctoPrint will immediately disconnect from it.
When this command is received from the printer, OctoPrint will immediately disconnect from it.
If the bundled :ref:`Action Command Prompt Support Plugin <sec-bundledplugins-action_command_prompt>` is enabled (which
should be the case by default), OctoPrint will also interactive dialog creation through its :ref:`supported commands <sec-bundledplugins-action_command_prompt-action_commands>`.
Support for additional commands may be added by plugins by implementing a handler for the
:ref:`octoprint.comm.protocol.action <sec-plugins-hook-comm-protocol-action>` hook.
+30
View File
@@ -0,0 +1,30 @@
.. _sec-features-atcommands:
@ Commands
==========
@ commands (also known as host commands elsewhere) are special commands you may include in GCODE files streamed
through OctoPrint to your printer or send as part of GCODE scripts, through the Terminal Tab, the API or plugins.
Contrary to other commands they will never be sent to the printer but instead trigger functions inside OctoPrint.
They are always of the form ``@<command>[ <parameters>]``, e.g. ``@pause`` or ``@custom_command with some parameters``.
Out of the box OctoPrint supports handling of these commands starting with version 1.3.7:
@cancel
OctoPrint will cancel the current print job like if the "Cancel" button had been clicked. This command doesn't
take any parameters.
@abort
Same as ``cancel``.
@pause
OctoPrint will pause the current print job just like if the "Pause" button had been clicked. This command doesn't
take any parameters.
@resume
OctoPrint will resume the current print job just like if the "Resume" button had been clicked. This command doesn't
take any parameters.
Support for additional commands may be added by plugins by implementing a handler for one of the
:ref:`octoprint.comm.protocol.atcommand <sec-plugins-hook-comm-protocol-atcommand-phase>` hooks.
+4
View File
@@ -166,6 +166,10 @@ Controls
clicked. This allows to override the direct sending of the command or commands to the printer with more
sophisticated behaviour. The JavaScript snippet is ``eval``'d and processed in a context where the control
it is part of is provided as local variable ``data`` and the ``ControlViewModel`` is available as ``self``.
* - ``additionalClasses``
- (Optional) Additional classes to apply to the button of a ``command``, ``commands``, ``script`` or ``javascript``
control, other than the default ``btn``. Can be used to visually style the button, e.g. set to ``btn-danger`` to
turn the button red.
* - ``enabled``
- (Optional) A JavaScript snippet returning either ``true`` or ``false`` determining whether the control
should be enabled or not. This allow to override the default logic for this (disabled if printer is offline
+114 -13
View File
@@ -13,11 +13,19 @@ Unless :ref:`configured otherwise <sec-configuration-config_yaml-folder>`, OctoP
the ``scripts/gcode`` folder in OctoPrint configuration directory (per default ``~/.octoprint`` on Linux, ``%APPDATA%\OctoPrint``
on Windows and ``~/Library/Application Support/OctoPrint`` on MacOS).
These GCODE scripts are backed by the templating engine `Jinja2 <http://jinja.pocoo.org/>`_, allowing more than just
These GCODE scripts are backed by the templating engine Jinja2, allowing more than just
simple "send-as-is" scripts but making use of a full blown templating language in order to create your scripts. To
this end, OctoPrint injects a couple of variables into the :ref:`template rendering context <sec-features-gcode_scripts-context>`
this end, OctoPrint injects some variables into the :ref:`template rendering context <sec-features-gcode_scripts-context>`
as described below.
You can find the docs on the Jinja templating engine as used in OctoPrint at `jinja.octoprint.org <http://jinja.octoprint.org/templates.html>`_.
.. note::
Due to backwards compatibility issues with Jinja versions 2.9+, OctoPrint currently only supports Jinja 2.8. For this
reason use the template documentation at `jinja.octoprint.org <http://jinja.octoprint.org/templates.html>`_ instead of the
documentation of current stable Jinja versions.
.. _sec-features-gcode_scripts-predefined:
Predefined Scripts
@@ -58,25 +66,44 @@ Context
All GCODE scripts have access to the following template variables through the template context:
* ``printer_profile``: The currently selected Printer Profile, including
* ``printer_profile``: The currently selected :ref:`Printer Profile <sec-modules-printer-profile>`, including
information such as the extruder count, the build volume size, the filament diameter etc.
* ``last_position``: Last position reported by the printer via `M114` (might be unset if no `M114` was sent so far!)
* ``last_position``: Last position reported by the printer via `M114` (might be unset if no `M114` was sent so far!).
Consists of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and
current tool ``t`` taken from commands sent through OctoPrint. All of these coordinates might be ``None`` if no
position could be retrieved from the printer or the values could not be tracked (in case of ``f`` and ``t``)!
* ``last_temperature``: Last actual and target temperature reported for all available tools and if available the
heated bed. This is a dictionary of key-value pairs. The keys are the indices of the available tools (``0``, ``1``,
...) and ``b`` for the heated bed. The values are a dictionary consisting of ``actual`` and ``target`` keys mapped
to the corresponding temperature in degrees Celsius. Note that not all tools your printer has must necessarily be
present here, neither must the heated bed - it depends on whether OctoPrint has values for a tool or the bed. Also
note that ``actual`` and ``target`` might be ``None``.
* ``script``: An object wrapping the script's type (``gcode``) and name (e.g. ``afterPrintCancelled``) as ``script.type``
and ``script.name`` respectively.
* ``plugins``: An object containing variables provided by plugins (e.g ``plugins.myplugin.myvariable``)
There are a couple of additional template variables available for the following specific scripts:
There are a few additional template variables available for the following specific scripts:
* ``afterPrintPaused`` and ``beforePrintResumed``
* ``pause_position``: Position reported by the printer via ``M114`` immediately before the print was paused. Consists
of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and current tool
``t`` taken from commands sent through OctoPrint.
* ``pause_position``: Position reported by the printer via ``M114`` immediately before the print was paused. See
``last_position`` above for the structure to expect here.
**Please note:** This will not be available if you disable
"Log position on pause" under Settings > Serial > Advanced options!
* ``pause_temperature``: Last known temperature values when the print was paused. See ``last_temperature`` above
for the structure to expect here.
* ``afterPrintCancelled``
* ``cancel_position``: Position reported by the printer via ``M114`` immediately before the print was cancelled.
Consists of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and
current tool ``t`` taken from commands sent through OctoPrint.
See ``last_position`` above for the structure to expect here.
**Please note:** This will not be available if you disable
"Log position on cancel" under Settings > Serial > Advanced options!
* ``cancel_temperature``: Last known temperature values when the print was cancelled. See ``last_temperature`` above
for the structure to expect here.
.. warning::
@@ -120,7 +147,7 @@ Out of the box, OctoPrint defaults to the following script setup for ``afterPrin
;disable all heaters
{% snippet 'disable_hotends' %}
[% snippet 'disable_bed' %}
{% snippet 'disable_bed' %}
;disable fan
M106 S0
@@ -130,9 +157,13 @@ The ``disable_hotends`` snippet is defined as follows:
.. code-block:: jinja
:caption: Default ``disable_hotends`` snippet
{% if printer_profile.extruder.sharedNozzle %}
M104 T0 S0
{% else %}
{% for tool in range(printer_profile.extruder.count) %}
M104 T{{ tool }} S0
{% endfor %}
{% endif %}
The ``disable_bed`` snippet is defined as follows:
@@ -148,8 +179,78 @@ As you can see, the ``disable_hotends`` and ``disable_bed`` snippets utilize the
extruders and set their temperature to 0, and to also set the bed temperature
to 0 if a heated bed is configured.
.. _sec-features-gcode_scripts-examples:
Examples
--------
.. _sec-features-gcode_scripts-examples-more_nifty_pause_and_resume:
More nifty pause and resume
...........................
If you do not have a multi-extruder setup, aren't printing from SD and have "Log position on pause" enabled under
Settings > Serial > Advanced options, the following ``afterPrintPaused`` and
``beforePrintResumed`` scripts might be interesting for you. With something like them in place, OctoPrint will move your print head
out of the way to a safe rest position (here ``G1 X0 Y0``, you might want to adjust that) on pause and move it back
to the persisted pause position on resume, making sure to also reset the extruder and feedrate.
.. code-block:: jinja
:caption: ``afterPrintPaused`` script
{% if pause_position.x is not none %}
; relative XYZE
G91
M83
; retract filament, move Z slightly upwards
G1 Z+5 E-5 F4500
; absolute XYZE
M82
G90
; move to a safe rest position, adjust as necessary
G1 X0 Y0
{% endif %}
.. code-block:: jinja
:caption: ``beforePrintResumed`` script
{% if pause_position.x is not none %}
; relative extruder
M83
; prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500
; absolute E
M82
; absolute XYZ
G90
; reset E
G92 E{{ pause_position.e }}
; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500
; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}
{% endif %}
.. warning::
As mentioned in the warning above and the description of the example itself, this will *only* work if you are
not printing from SD and not using multiple extruders since OctoPrint will only then be able to track the
necessary position data and print parameters due to firmware limitations.
.. seealso::
`Jinja Template Designer Documentation <http://jinja.pocoo.org/docs/dev/templates/>`_
`Jinja Template Designer Documentation <http://jinja.octoprint.org/templates.html>`_
Jinja's Template Designer Documentation describes the syntax and semantics of the template language used
also by OctoPrint's GCODE scripts.
also by OctoPrint's GCODE scripts. Linked here are the docs for Jinja 2.8.1, which OctoPrint still
relies on for backwards compatibility reasons.
+1
View File
@@ -15,5 +15,6 @@ Features
custom_controls.rst
gcode_scripts.rst
action_commands.rst
atcommands.rst
plugins.rst
safemode.rst
+1 -1
View File
@@ -46,7 +46,7 @@ Manual Installation
If you don't want or can't use the Plugin Manager, plugins may also be installed manually either by copying and
unpacking them into one of the configured plugin folders (regularly those are ``<octoprint source root>/plugins`` and
``<octoprint config folder>/plugins`` [#f1]_ or by installing them as regular python modules via ``pip`` [#f2]_.
``<octoprint config folder>/plugins`` [#f1]_ or by installing them as regular Python modules via ``pip`` [#f2]_.
For a plugin available on the Python Package Index (PyPi), the process is as simple as issuing a
+30 -5
View File
@@ -16,6 +16,9 @@ Additionally, OctoPrint allows uninstalling plugins in this mode, allowing recov
a third party plugin causes the server to not start up or the web interface to not render or function
correctly anymore.
Whenever reporting an issue with OctoPrint, please always attempt to reproduce it in safe mode as well to
ensure it really is an issue in OctoPrint itself and now caused by one of your installed third party plugins.
.. _sec-features-safemode-how:
How to start OctoPrint in safe mode
@@ -23,15 +26,37 @@ How to start OctoPrint in safe mode
There exist three ways to start OctoPrint in safe mode:
* since OctoPrint 1.3.2: by selecting "Restart OctoPrint in safe mode" from the "System" menu,
if the "Restart OctoPrint" server command has been correctly configured (see :numref:`fig-features-safemode-systemmenu`).
* by starting OctoPrint with the command line parameter ``--safe``, e.g. ``octoprint serve --safe``
* by setting the option ``server.startOnceInSafeMode`` in :ref:`config.yaml <sec-configuration-config_yaml>`
to ``true`` and restarting
* by selecting "Restart OctoPrint in safe mode" from the "System" menu,
if the "Restart OctoPrint" server command has been correctly configured (since OctoPrint 1.3.2,
see :numref:`fig-features-safemode-systemmenu`)
* by setting the flag ``server.startOnceInSafeMode`` in :ref:`config.yaml <sec-configuration-config_yaml>`
to ``true`` and restarting. To set this flag you have the following options:
* from command line run ``octoprint safemode`` (since OctoPrint 1.3.6)
* from command line run ``octoprint config set --bool server.startOnceInSafeMode true`` (fixed in OctoPrint 1.3.6)
* use the `Yamlpatcher Plugin <http://plugins.octoprint.org/plugins/yamlpatcher/>`_ and enter & apply the patch
``[["set", "server.startOnceInSafeMode", true]]``
* edit ``config.yaml`` manually with a text editor, locate the ``server`` block if it already exists or create it
if it doesn't and add ``startOnceInSafeMode: true`` to it:
.. code-block:: yaml
# ...
server:
startOnceInSafeMode: true
# ...
Please also refer to the :ref:`YAML primer <sec-configuration-yaml>`.
* by starting OctoPrint with the command line parameter ``--safe``, e.g. ``octoprint serve --safe`` (don't forget to
shutdown OctoPrint first before doing this)
The last two options will have OctoPrint enable safe mode only for the next server start - once you
restart OctoPrint again, safe mode will be disabled again.
.. note::
**OctoPi users**: For you that's ``~/oprint/bin/octoprint`` wherever it says just ``octoprint``.
.. _fig-features-safemode-systemmenu:
.. figure:: ../images/features-safemode-systemmenu.png
:align: center
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 24 KiB

+18 -3
View File
@@ -6,9 +6,24 @@ Welcome to OctoPrint's documentation!
:alt: The OctoPrint Logo
:align: right
This documentation is still in the process of being migrated from
`OctoPrint's wiki <https://github.com/foosel/OctoPrint/wiki>`_, so also take
a look there!
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/>`_.
The community forum is available at `community.octoprint.org <https://community.octoprint.org/>`_.
The FAQ can be accessed by following `faq.octoprint.org <https://faq.octoprint.org/>`_.
The official plugin repository can be reached at `plugins.octoprint.org <https://plugins.octoprint.org/>`_.
OctoPrint's development wouldn't be possible without the `financial support by its community <https://octoprint.org/support-octoprint/>`_.
If you enjoy OctoPrint, please consider becoming a regular supporter!
.. note::
This documentation currently focuses primarily on developers and less on end users. If you are interested in
helping to change this, please get in touch `on the forum <https://community.octoprint.org/>`_!
Contents
========
+2 -2
View File
@@ -119,7 +119,7 @@
:param string method: The HTTP method to use for the request (optional)
:param string url: The URL to perform the request against (optional)
:param object data: The data to send in the request body (optional)
:param object opts: Additonal options to use for the request (optional)
:param object opts: Additional options to use for the request (optional)
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.get(url, opts)
@@ -417,7 +417,7 @@
Creates a custom exception class. ``name`` may be either a function in which case it will be used
as constructor for the new exception class, or a string, in which case a constructor with proper
``name``, ``message`` and ``stack`` attributes will be created. The class hierarchy will be propery
``name``, ``message`` and ``stack`` attributes will be created. The class hierarchy will be properly
setup to subclass ``Error``.
**Example:**
+1 -1
View File
@@ -189,7 +189,7 @@
A boolean value, specifies whether to immediately start printing the file after the upload
completes (true) or not (false, default)
userdata
An optional object or a serialized JSON string of additional user supplised data to associate with
An optional object or a serialized JSON string of additional user supplied data to associate with
the uploaded file.
See :ref:`Upload file or create folder <sec-api-fileops-uploadfile>` for more details on the file upload API and
+11 -7
View File
@@ -14,7 +14,7 @@ If you are using it from a web page hosted on OctoPrint as a Jinja2 template, yo
methods to embed it instead of manually entering the URL, in order to have OctoPrint take care of setting the
correct URL prefix:
.. code-block:: html
.. code-block:: html+jinja
<!--
full client library or all individual files, depending
@@ -32,10 +32,10 @@ correct URL prefix:
-->
<script type="text/javascript" src="{{ url_for("static", filename="js/app/client/<component>.js") }}"></script>
Regardless of which way you use to include the library, you'll also need to make sure you included JQuery and lodash,
Regardless of which way you use to include the library, you'll also need to make sure you included jQuery and lodash,
because the library depends on those to be available (as ``$`` and ``_``). You can embed those like this:
.. code-block:: html
.. code-block:: html+jinja
<script src="{{ url_for("static", filename="js/lib/jquery/jquery.min.js") }}"></script>
<script src="{{ url_for("static", filename="js/lib/lodash.min.js") }}"></script>
@@ -45,7 +45,7 @@ number of components, make sure to at the very least include that one to be able
When you import the client library as described above, a global variable ``OctoPrint`` will become available, which is
a prepared instance of the ``OctoPrintClient`` class the library assembles from registered components. You can directly
used that singular ``OctoPrint`` instance if you only need to talk to one OctoPrint server:
use that singular ``OctoPrint`` instance if you only need to talk to one OctoPrint server:
.. code-block:: javascript
@@ -80,9 +80,13 @@ connection options (``baseurl`` and ``apikey``) directly in the constructor or s
.. seealso::
`OctoPrint-ForceLogin <https://github.com/OctoPrint/OctoPrint-ForceLogin>`_
A plugin that disables anonymous access to the regular OctoPrint UI by implementing a custom UI. Utilizes the
client library's :ref:`browser component <sec-jsclientlib-browser>` to login the user.
:ref:`Application Key Plugin <sec-bundledplugins-appkeys>`
A bundled plugin that implements an authorization workflow for third party clients. It adds various additional
methods to the JS Client Library.
:ref:`ForceLogin Plugin <sec-bundledplugins-forcelogin>`
A bundled plugin that disables anonymous access to the regular OctoPrint UI by implementing a custom UI and
various hooks. Utilizes the client library's :ref:`browser component <sec-jsclientlib-browser>` to login the
user.
.. toctree::
:maxdepth: 3
+1 -1
View File
@@ -64,7 +64,7 @@
.. js:function:: OctoPrintClient.job.resume(opts)
Resumes the current job if it's currently pause, does nothing if it's running.
Resumes the current job if it's currently paused, does nothing if it's running.
See :ref:`Issue a job command <sec-api-jobs-command>` for details.
+1 -1
View File
@@ -5,7 +5,7 @@
.. note::
All methods here require that the used API token or a the existing browser session
All methods here require that the used API token or the existing browser session
has admin rights.
.. js:function:: OctoPrintClient.languages.list(opts)
+5 -33
View File
@@ -3,37 +3,9 @@
:mod:`OctoPrintClient.logs`
---------------------------
.. note::
All methods here require that the used API token or a the existing browser session
has admin rights.
.. js:function:: OctoPrintClient.logs.list(opts)
Retrieves a list of log files.
See :ref:`Retrieve a list of available log files <sec-api-logs-list>` for details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.logs.delete(path, opts)
Deletes the specified log ``path``.
See :ref:`Delete a specific log file <sec-api-logs-delete>` for details.
:param string path: The path to the log file to delete
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.logs.download(path, opts)
Downloads the specified log ``file``.
See :js:func:`OctoPrint.download` for more details on the underlying library download mechanism.
:param string path: The path to the log file to download
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
Log file management (and logging configuration) was moved into a bundled plugin in OctoPrint 1.3.7. Refer to
:ref:`the Logging's plugins JS Client Library <sec-bundledplugins-logging-jsclientlib>` for the JS Client documentation.
The former module ``OctoPrintClient.logs`` and its methods are marked as deprecated but still work for now. New
client implementations should directly use the new module provided by the bundled plugin. Existing implementations
should adapt their used module as soon as possible.
+59 -1
View File
@@ -174,7 +174,7 @@
Sets the given temperature on the printer's heated bed (if available).
``target`` is expected to be a the target temperature as a float value.
``target`` is expected to be the target temperature as a float value.
**Example:**
@@ -210,6 +210,64 @@
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.printer.getChamberState(data, opts)
Retrieves the current printer chamber state/temperature information, and optionally also the temperature
history.
The ``flags`` object can be used to specify the data to retrieve further via the following
properties:
* ``history``: a boolean value to specify whether the temperature history should be included (``true``)
or not (``false``), defaults to it not being included
* ``limit``: an integer value to specify how many history entries to include
See :ref:`Retrieve the current bed state <sec-api-printer-chamberstate>` for more details.
:param object flags: Flags that further specify which data to retrieve, see above for details
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.printer.setChamberTargetTemperature(target, opts)
Sets the given temperature on the printer's heated chamber (if available).
``target`` is expected to be the target temperature as a float value.
**Example:**
Set the chamber to 50°C.
.. code-block:: javascript
OctoPrint.printer.setChamberTargetTemperature(50.0);
See the ``target`` command in :ref:`Issue a chamber command <sec-api-printer-chambercommand>` for more details.
:param float target: The target to set
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.printer.setChamberTemperatureOffset(offset, opts)
Sets the given temperature offset for the printer's heated chamber (if available).
``offset`` is expected to be the temperature offset to set.
**Example:**
Set the offset for the chamber to -5°C.
.. code-block:: javascript
OctoPrint.printer.setChamberTemperatureOffset(-5);
See the ``offset`` command in :ref:`Issue a chamber command <sec-api-printer-chambercommand>` for more details.
:param object offsets: The offsets to set
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.printer.jog(amounts, opts)
Jogs the specified axes by the specified ``amounts``.
+7
View File
@@ -35,6 +35,13 @@
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.settings.generateApiKey(opts)
Generate a new system wide API key.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. seealso::
:ref:`Settings API <sec-api-settings>`
+1 -1
View File
@@ -85,7 +85,7 @@
.. js:function:: OctoPrintClient.socket.onRateTooHigh(measured, maximum)
Called by the socket client when the last measured round trip time was higher than the
current upper procesisng limit, indicating that the messages are now processed slower than
current upper processing limit, indicating that the messages are now processed slower than
the current rate requires and a slower rate might be necessary.
Can be overwritten with custom handler methods. The default implementation will call
+2 -2
View File
@@ -5,7 +5,7 @@
.. note::
All methods here require that the used API token or a the existing browser session
All methods here require that the used API token or the existing browser session
has admin rights.
.. js:function:: OctoPrintClient.system.getCommands(opts)
@@ -35,4 +35,4 @@
.. seealso::
:ref:`System API <sec-api-system>`
Documentation of the underlying system API
Documentation of the underlying system API.
+1 -1
View File
@@ -15,7 +15,7 @@
.. js:function:: OctoPrintClient.timelapse.list(opts)
Get the lists of rendered and unrendered timelapses. The returned promis
Get the lists of rendered and unrendered timelapses. The returned promise
will be resolved with an object containing the properties ``rendered``
which will have the list of rendered timelapses, and ``unrendered`` which
will have the list of unrendered timelapses.
+1 -1
View File
@@ -5,7 +5,7 @@
.. note::
Most methods here require that the used API token or a the existing browser session
Most methods here require that the used API token or the existing browser session
has admin rights *or* corresponds to the user to be modified. Some methods
definitely require admin rights.
+54 -4
View File
@@ -5,7 +5,7 @@
.. note::
All methods here require that the used API token or a the existing browser session
All methods here require that the used API token or the existing browser session
has admin rights.
.. js:function:: OctoPrintClient.util.test(command, parameters, opts)
@@ -21,7 +21,7 @@
.. js:function:: OctoPrintClient.util.testPath(path, additional, opts)
Test the provided ``path`` for existance. More test criteria supported by the :ref:`path test command <sec-api-util-test-path>`
Test the provided ``path`` for existence. More test criteria supported by the :ref:`path test command <sec-api-util-test-path>`
can be provided via the ``additional`` object.
**Example 1**
@@ -126,8 +126,16 @@
.done(function(response) {
if (response.result) {
// check passed
var content = response.response.content;
var mimeType = "image/jpeg";
var headers = response.response.headers;
if (headers && headers["content-type"]) {
mimeType = headers["content-type"].split(";")[0];
}
var image = $("#someimage");
image.
image.src = "data:" + mimeType + ";base64," + content;
} else {
// check failed
}
@@ -153,7 +161,49 @@
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.util.testServer(host, port, additional, opts)
Test if a server is reachable. More options supported by the :ref:`server test command <sec-api-util-test-server>`
can be provided via the ``additional`` object.
**Example 1**
Test if ``8.8.8.8`` is reachable on port 53 within the default timeout.
.. code-block:: javascript
OctoPrint.util.testServer("8.8.8.8", 53)
.done(function(response) {
if (response.result) {
// check passed
} else {
// check failed
}
});
**Example 2**
Test if ``127.0.0.1`` is reachable on port 1234 and UDP.
.. code-block:: javascript
OctoPrint.util.testUrl("127.0.0.1", 1234, {"protocol": "udp"})
.done(function(response) {
if (response.result) {
// check passed
} else {
// check failed
}
});
:param string url: Host to test
:param int port: Port to test
:param object additional: Additional parameters for the test command
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. seealso::
:ref:`Util API <sec-api-util>`
Documentation of the underlying util API
Documentation of the underlying util API.
+1 -1
View File
@@ -5,7 +5,7 @@
.. note::
All methods here require that the used API token or a the existing browser session
All methods here require that the used API token or the existing browser session
has admin rights.
.. js:function:: OctoPrintClient.wizard.get(opts)
+1
View File
@@ -14,4 +14,5 @@ Internal Modules
server.rst
settings.rst
slicing.rst
users.rst
util.rst
+7
View File
@@ -4,3 +4,10 @@ octoprint.printer
-----------------
.. automodule:: octoprint.printer
.. _sec-modules-printer-profile:
octoprint.printer.profile
-------------------------
.. automodule:: octoprint.printer.profile
+9
View File
@@ -0,0 +1,9 @@
.. _sec-modules-users:
octoprint.access.users
----------------------
.. automodule:: octoprint.access.users
:members:
+6
View File
@@ -6,4 +6,10 @@ octoprint.util
.. automodule:: octoprint.util
:members:
.. _sec-modules-util-commandline:
octoprint.util.commandline
--------------------------
.. automodule:: octoprint.util.commandline
:members:
+3 -3
View File
@@ -23,9 +23,9 @@ Lifecycle
There are three sources of installed plugins that OctoPrint will check during start up:
* it's own ``octoprint/plugins`` folder (this is where the bundled plugins reside),
* its own ``octoprint/plugins`` folder (this is where the bundled plugins reside),
* the ``plugins`` folder in its configuration directory (e.g. ``~/.octoprint/plugins`` on Linux),
* any python packages registered for the entry point ``octoprint.plugin``.
* any Python packages registered for the entry point ``octoprint.plugin``.
Each plugin that OctoPrint finds it will first load, then enable. On enabling a plugin, OctoPrint will
register its declared :ref:`hook handlers <sec-plugins-hooks>` and :ref:`helpers <sec-plugins-helpers>`, apply
@@ -36,7 +36,7 @@ any :ref:`settings overlays <sec-plugins-controlproperties-plugin_settings_overl
On disabling a plugin, its hook handlers, helpers, mixin implementations and settings overlays will be de-registered again.
Some plugin types require a reload of the frontend or a restart of OctoPrint for enabling/disabling them. You
can recognized such plugins by their implementations implementing :class:`~octoprint.plugin.ReloadNeedingPlugin` or
can recognize such plugins by their implementations implementing :class:`~octoprint.plugin.ReloadNeedingPlugin` or
:class:`~octoprint.plugin.RestartNeedingPlugin` or providing handlers for one of the hooks marked correspondingly.
.. image:: ../images/plugins_lifecycle.png
+15
View File
@@ -13,6 +13,7 @@ plugin subsystem about themselves. These are simple package attributes defined i
# ...
__plugin_name__ = "My Plugin"
__plugin_pythoncompat__ = ">=2.7,<4"
def __plugin_load__():
# whatever you need to do to load your plugin, if anything at all
pass
@@ -52,6 +53,20 @@ The following properties are recognized:
``__plugin_license__``
License of your plugin, optional, overrides the license specified in ``setup.py`` if provided.
.. _sec-plugins-controlproperties-plugin_pythoncompat:
``__plugin_pythoncompat__``
Python compatibility string of your plugin, optional, defaults to ``>=2.7,<3`` if not set and thus Python 2 but no
Python 3 compatibility.
If your plugin is compatible to Python 3, you should set this to ``>=2.7,<4``, otherwise your plugin will not load
on OctoPrint instances installed under Python 3.
.. code-block:: python
__plugin_pythoncompat__ = ">=2.7,<4"
.. _sec-plugins-controlproperties-plugin_implementation:
``__plugin_implementation__``
+59 -42
View File
@@ -20,7 +20,7 @@ development environment::
$ virtualenv venv
[...]
$ source venv/bin/activate
(venv) $ pip install -e[develop]
(venv) $ pip install -e .[develop,plugins]
[...]
(venv) $ octoprint --help
Usage: octoprint [OPTIONS] COMMAND [ARGS]...
@@ -41,13 +41,21 @@ development environment::
[...]
We'll start at the most basic form a plugin can take - just a couple of simple lines of Python code:
.. important::
This tutorial assumes you are running OctoPrint 1.3.0 and up. Please make sure your version of
OctoPrint is up to date before proceeding. If you did a fresh checkout, that should already
be the case but if not you might have to update first. You can check your version of OctoPrint
by running ``octoprint --version`` or by taking a look into the lower left corner in OctoPrint's
web interface.
We'll start at the most basic form a plugin can take - just a few simple lines of Python code:
.. code-block:: python
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
__plugin_name__ = "Hello World"
__plugin_version__ = "1.0.0"
@@ -81,8 +89,8 @@ Apart from being discovered by OctoPrint, our plugin does nothing yet. We want t
:emphasize-lines: 4-8,13
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -108,7 +116,7 @@ used :func:`~octoprint.plugin.StartupPlugin.on_startup` instead, in which case o
up and ready to serve requests.
You'll also note that we are using ``self._logger`` for logging. Where did that one come from? OctoPrint's plugin system
injects :ref:`a couple of useful objects <sec-plugins-mixins-injectedproperties>` into our plugin implementation classes,
injects :ref:`a some useful objects <sec-plugins-mixins-injectedproperties>` into our plugin implementation classes,
one of those being a fully instantiated `python logger <https://docs.python.org/2/library/logging.html>`_ ready to be
used by your plugin. As you can see in the log output above, that logger uses the namespace ``octoprint.plugins.helloworld``
for our little plugin here, or more generally ``octoprint.plugins.<plugin identifier>``.
@@ -126,14 +134,15 @@ as a simple python file following the naming convention ``<plugin identifier>.py
``~/.octoprint/plugins`` folder. You already know how that works. But let's say you have more than just a simple plugin
that can be done in one file. Distributing multiple files and getting your users to install them in the right way
so that OctoPrint will be able to actually find and load them is certainly not impossible, but we want to do it in the
best way possible, meaning we want to make our plugin a fully installable python module that your users will be able to
best way possible, meaning we want to make our plugin a fully installable Python module that your users will be able to
install directly via `OctoPrint's built-in Plugin Manager <https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager>`_
or alternatively manually utilizing Python's standard package manager ``pip`` directly.
So let's begin. We'll use the `cookiecutter <https://github.com/audreyr/cookiecutter>`_ template for OctoPrint plugins here,
so we'll first need to install that::
So let's begin. We'll use the `cookiecutter <https://github.com/audreyr/cookiecutter>`_ template for OctoPrint plugins
here. This should already be installed if you used the ``plugins`` extra while installing OctoPrint. However,
you may install it with::
(venv) $ pip install cookiecutter
(venv) $ pip install "cookiecutter>=1.4,<1.7"
Then we can use the ``octoprint dev plugin:new`` command [#f1]_ to generate a new OctoPrint plugin skeleton for us::
@@ -273,15 +282,15 @@ of information now defined twice:
plugin_version = "1.0.0"
plugin_description = "A quick \"Hello World\" example plugin for OctoPrint"
The nice thing about our plugin now being a proper python package is that OctoPrint can and will access the metadata defined
The nice thing about our plugin now being a proper Python package is that OctoPrint can and will access the metadata defined
within ``setup.py``! So, we don't really need to define all this data twice. Remove ``__plugin_name__``, ``__plugin_version__``
and ``__plugin_description__`` from ``__init__.py``:
.. code-block:: python
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -305,8 +314,8 @@ Our "Hello World" Plugin still gets detected fine, but it's now listed under the
:emphasize-lines: 10
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -353,8 +362,8 @@ add the :class:`TemplatePlugin` to our ``HelloWorldPlugin`` class:
:emphasize-lines: 7
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -401,8 +410,8 @@ Now look at that!
Settings Galore: How to make parts of your plugin user adjustable
-----------------------------------------------------------------
Remember that Wikipedia link we added to our little link in the navigation bar? It links to the english Wikipedia. But
what if we want to allow our users to adjust that according to their wishes, e.g. to link to the german language node
Remember that Wikipedia link we added to our little link in the navigation bar? It links to the English Wikipedia. But
what if we want to allow our users to adjust that according to their wishes, e.g. to link to the German language node
about "Hello World" programs instead?
To allow your users to customized the behaviour of your plugin you'll need to implement the :class:`~octoprint.plugin.SettingsPlugin`
@@ -419,8 +428,8 @@ Let's take a look at how all that would look in our plugin's ``__init__.py``:
:emphasize-lines: 8, 10, 12-13
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -453,8 +462,8 @@ Adjust your plugin's ``__init__.py`` like this:
:emphasize-lines: 15-16
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -482,7 +491,7 @@ Also adjust your plugin's ``templates/helloworld_navbar.jinja2`` like this:
OctoPrint injects the template variables that your plugin defines prefixed with ``plugin_<plugin identifier>_`` into
the template renderer, so your ``url`` got turned into ``plugin_helloworld_url`` which you can now use as a simple
`Jinja2 Variable <http://jinja.pocoo.org/docs/dev/templates/#variables>`_ in your plugin's template.
`Jinja2 Variable <http://jinja.octoprint.org/templates.html#variables>`_ in your plugin's template.
Restart OctoPrint and shift-reload the page in your browser (to make sure you really get a fresh copy). The link should
still work and point to the URL we defined as default.
@@ -500,7 +509,7 @@ section doesn't yet exist in the file, create it):
# [...]
Restart OctoPrint. Not only should the URL displayed in the log file have changed, but also the link should now (after
a proper shift-reload) point to the german Wikipedia node about "Hello World" programs::
a proper shift-reload) point to the German Wikipedia node about "Hello World" programs::
2015-01-30 11:47:18,634 - octoprint.plugins.helloworld - INFO - Hello World! (more: https://de.wikipedia.org/wiki/Hallo-Welt-Programm)
@@ -560,8 +569,8 @@ again since we don't use that anymore:
:emphasize-lines: 15-19
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -657,8 +666,8 @@ like so:
:emphasize-lines: 9,22-25
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -811,12 +820,10 @@ Put something like the following into ``helloworld.css``:
.. code-block:: css
:linenos:
#tab_plugin_helloworld {
iframe {
width: 100%;
height: 600px;
border: 1px solid #808080;
}
#tab_plugin_helloworld iframe {
width: 100%;
height: 600px;
border: 1px solid #808080;
}
Don't forget to remove the ``style`` attribute from the ``iframe`` tag in ``helloworld_tab.jinja2``:
@@ -839,8 +846,8 @@ a reference to our CSS file:
:emphasize-lines: 26
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -924,8 +931,8 @@ Then adjust our returned assets to include our LESS file as well:
:emphasize-lines: 27
:linenos:
# coding=utf-8
from __future__ import absolute_import
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import octoprint.plugin
@@ -1070,8 +1077,14 @@ For some insight on how to create plugins that react to various events within Oc
add support for a slicer, OctoPrint's own bundled `CuraEngine plugin <https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura>`_
might give some hints. For extending OctoPrint's interface, the `NavbarTemp plugin <https://github.com/imrahil/OctoPrint-NavbarTemp>`_
might show what's possible with a few lines of code already. Finally, just take a look at the
`list of available plugins <https://github.com/foosel/OctoPrint/wiki#plugins>`_ on the OctoPrint wiki if you are
looking for examples.
`official Plugin Repository <http://plugins.octoprint.org>`_ if you are looking for examples.
.. seealso::
`Jinja Template Designer Documentation <http://jinja.octoprint.org/templates.html>`_
Jinja's Template Designer Documentation describes the syntax and semantics of the template language used
by OctoPrint's frontend. Linked here are the docs for Jinja 2.8.1, which OctoPrint still
relies on for backwards compatibility reasons [#f3]_.
.. rubric:: Footnotes
@@ -1084,3 +1097,7 @@ looking for examples.
.. [#f2] Refer to the `LESS documentation <http://lesscss.org/#using-less>`_ on how to do that. If you are developing
your plugin under Windows you might also want to give `WinLESS <http://winless.org/>`_ a look which will run
in the background and keep your CSS files up to date with your various project's LESS files automatically.
.. [#f3] Please always consult the Jinja documentation at `jinja.octoprint.org <http://jinja.octoprint.org>`_ instead of
the current stable documentation available at Jinja's project page. The reason for that is that for backwards
compatibility reasons OctoPrint currently sadly has to rely on an older version of Jinja. The documentation
available at `jinja.octoprint.org <http://jinja.octoprint.org>`_ matches that older version.
+3 -3
View File
@@ -3,12 +3,12 @@
Helpers
=======
Helpers are methods that plugin can exposed to other plugins in order to make common functionality available on the
Helpers are methods that plugins can expose to other plugins in order to make common functionality available on the
system. They are registered with the OctoPrint plugin system through the use of the control property ``__plugin_helpers__``.
An example for providing a couple of helper functions to the system can be found in the
An example for providing some helper functions to the system can be found in the
`Discovery Plugin <https://github.com/foosel/OctoPrint/wiki/Plugin:-Discovery>`_,
which provides it's SSDP browsing and Zeroconf browsing and publishing functions as helper methods.
which provides its SSDP browsing and Zeroconf browsing and publishing functions as helper methods.
.. code-block:: python
:linenos:
+710 -42
View File
@@ -28,6 +28,7 @@ or as ``postfix`` (after the existing lines).
.. code-block:: python
:linenos:
from past import basestring
self._gcode_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.scripts")
# ...
@@ -35,7 +36,7 @@ or as ``postfix`` (after the existing lines).
for hook in self._gcodescript_hooks:
try:
retval = self._gcodescript_hooks[hook](self, "gcode", scriptName)
except:
except Exception:
self._logger.exception("Error while processing gcodescript hook %s" % hook)
else:
if retval is None:
@@ -44,10 +45,8 @@ or as ``postfix`` (after the existing lines).
continue
def to_list(data):
if isinstance(data, str):
data = map(str.strip, data.split("\n"))
elif isinstance(data, unicode):
data = map(unicode.strip, data.split("\n"))
if isinstance(data, basestring):
data = map(x.strip() for x in data.split("\n"))
if isinstance(data, (list, tuple)):
return list(data)
@@ -66,7 +65,7 @@ the general type of script for which to look for additions ("gcode") and the scr
return a 2-tuple of prefix and postfix if has something for either of those, otherwise ``None``. OctoPrint will then take
care to add prefix and suffix as necessary after a small round of preprocessing.
Plugins can easily add their own hooks too. For example, the `Software Update Plugin <https://github.com/OctoPrint/OctoPrint-SoftwareUpdate>`_
Plugins can easily add their own hooks too. For example, the `Software Update Plugin <https://github.com/foosel/OctoPrint/tree/master/src/octoprint/plugins/softwareupdate>`_
declares a custom hook "octoprint.plugin.softwareupdate.check_config" which other plugins can add handlers for in order
to register themselves with the Software Update Plugin by returning their own update check configuration.
@@ -79,7 +78,7 @@ property instead, manually instantiate your implementation instance and then add
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_action_command.py
:linenos:
:tab-width: 4
:caption: `custom_action_command.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/custom_action_command.py>`_
:caption: `custom_action_command.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/custom_action_command.py>`__
:name: sec-plugin-concepts-hooks-example
.. _sec-plugins-hooks-ordering:
@@ -201,30 +200,36 @@ Available plugin hooks
.. contents::
:local:
.. _sec-plugins-hook-accesscontrol-appkey:
.. _sec-plugins-hook-accesscontrol-keyvalidator:
octoprint.accesscontrol.appkey
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
octoprint.accesscontrol.keyvalidator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: acl_appkey_hook(*args, **kwargs)
.. py:function:: acl_keyvalidator_hook(apikey, *args, **kwargs)
By handling this hook plugins may register additional :ref:`App session key providers <sec-api-apps-sessionkey>`
within the system.
Via this hook plugins may validate their own customized API keys to be used to access OctoPrint's API.
Overrides this to return your additional app information to be used for validating app session keys. You'll
need to return a list of 3-tuples of the format (id, version, public key).
``apikey`` will be the API key as read from the request headers.
The ``id`` should be the (unique) identifier of the app. Using a domain prefix might make sense here, e.g.
``org.octoprint.example.MyApp``.
Hook handlers are expected to return a :class:`~octoprint.access.users.User` instance here that will then be considered that
user making the request. By returning ``None`` or nothing at all, hook handlers signal that they do not handle the
provided key.
``version`` should be a string specifying the version of the app for which the public key is valid. You can
provide the string ``any`` here, in which case the provided public key will be valid for all versions of the
app for which no specific public key is defined.
**Example:**
Finally, the public key is expected to be provided as a PKCS1 string without newlines.
Allows using a user's id as their API key (for obvious reasons this is NOT recommended in production environments
and merely provided for educational purposes):
:return: A list of 3-tuples as described above
:rtype: list
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_keyvalidator.py
:linenos:
:tab-width: 4
:caption: `custom_keyvalidator.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/custom_keyvalidator.py>`_
.. versionadded:: 1.3.6
:param str apikey: The API key to validate
:return: The user in whose name the request will be processed further
:rtype: :class:`~octoprint.access.users.User`
.. _sec-plugins-hook-cli-commands:
@@ -349,6 +354,66 @@ octoprint.cli.commands
OctoPrint's CLI.
:rtype: list
.. _sec-plugins-hook-comm-protocol-firmware-info:
octoprint.comm.protocol.firmware.info
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: firmware_info_hook(comm_instance, firmware_name, firmware_data, *args, **kwargs)
Be notified of firmware information received from the printer following an ``M115``.
Hook handlers may use this to react/adjust behaviour based on reported firmware data. OctoPrint parses the received
report line and provides the parsed ``firmware_name`` and additional ``firmware_data`` contained therein. A
response line ``FIRMWARE_NAME:Some Firmware Name FIRMWARE_VERSION:1.2.3 PROTOCOL_VERSION:1.0`` for example will
be turned into a ``dict`` looking like this:
.. code-block:: python
dict(FIRMWARE_NAME="Some Firmware Name",
FIRMWARE_VERSION="1.2.3",
PROTOCOL_VERSION="1.0")
``firmware_name`` will be ``Some Firmware Name`` in this case.
.. warning::
Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as
you will effectively block the receive loop, causing the communication with the printer to stall.
This includes I/O of any kind.
:param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
:param str firmware_name: The name of the parsed capability
:param dict firmware_data: All data contained in the ``M115`` report
.. _sec-plugins-hook-comm-protocol-firmware-capabilities:
octoprint.comm.firmware.protocol.capabilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: firmware_capability_hook(comm_instance, capability, enabled, already_defined, *args, **kwargs)
Be notified of capability report entries received from the printer.
Hook handlers may use this to react to custom firmware capabilities. OctoPrint parses the received capability
line and provides the parsed ``capability`` and whether it's ``enabled`` to the handler. Additionally all already
parsed capabilities will also be provided.
Note that hook handlers will be called once per received capability line.
.. warning::
Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as
you will effectively block the receive loop, causing the communication with the printer to stall.
This includes I/O of any kind.
:param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
:param str capability: The name of the parsed capability
:param bool enabled: Whether the capability is reported as enabled or disabled
:param dict already_defined: Already defined capabilities (capability name mapped to enabled flag)
.. _sec-plugins-hook-comm-protocol-action:
octoprint.comm.protocol.action
@@ -358,11 +423,18 @@ octoprint.comm.protocol.action
React to a :ref:`action command <sec-features-action_commands>` received from the printer.
Hook handlers may use this to react to react to custom firmware messages. OctoPrint parses the received action
Hook handlers may use this to react to custom firmware messages. OctoPrint parses the received action
command ``line`` and provides the parsed ``action`` (so anything after ``// action:``) to the hook handler.
No returned value is expected.
.. warning::
Make sure to not perform any computationally expensive or otherwise long running actions within your handlers as
you will effectively block the receive loop, causing the communication with the printer to stall.
This includes I/O of any kind.
**Example:**
Logs if the ``custom`` action (``// action:custom``) is received from the printer's firmware.
@@ -370,13 +442,59 @@ octoprint.comm.protocol.action
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_action_command.py
:linenos:
:tab-width: 4
:caption: `custom_action_command.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/custom_action_command.py>`_
:caption: `custom_action_command.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/custom_action_command.py>`__
:param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
:param str line: The complete line as received from the printer, format ``// action:<command>``
:param str action: The parsed out action command, so for a ``line`` like ``// action:some_command`` this will be
``some_command``
.. _sec-plugins-hook-comm-protocol-atcommand-phase:
octoprint.comm.protocol.atcommand.<phase>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This describes actually two hooks:
* ``octoprint.comm.protocol.atcommand.queuing``
* ``octoprint.comm.protocol.atcommand.sending``
.. py:function:: protocol_atcommandphase_hook(comm_instance, phase, command, parameters, tags=None, *args, **kwargs)
Trigger on :ref:`@ commands <sec-features-atcommands>` as they progress through the ``queuing`` and ``sending``
phases of the comm layer. See :ref:`the gcode phase hook <sec-plugins-hook-comm-protocol-gcode-phase>` for a
detailed description of each of these phases.
Hook handlers may use this to react to arbitrary :ref:`@ commands <sec-features-atcommands>` included in GCODE files
streamed to the printer or sent as part of GCODE scripts, through the API or plugins.
Please note that these hooks do not allow to rewrite, suppress or expand @ commands, they are merely callbacks to
trigger the *actual execution* of whatever functionality lies behind a given @ command, similar to
:ref:`the action command hook <sec-plugins-hook-comm-protocol-action>`.
.. warning::
Make sure to not perform any computationally expensive or otherwise long running actions within your handlers as
you will effectively block the send/receive loops, causing the communication with the printer to stall.
This includes I/O of any kind.
**Example**
Pause the print on ``@wait`` (this mirrors the implementation of the built-in ``@pause`` command, just with a
different name).
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/custom_atcommand.py
:linenos:
:tab-width: 4
:caption: `custom_action_command.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/custom_atcommand.py>`__
:param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
:param str phase: The current phase in the command progression, either ``queuing`` or ``sending``. Will always
match the ``<phase>`` of the hook.
:param str cmd: The @ command without the leading @
:param str parameters: Any parameters provided to the @ command. If none were provided this will be an empty string.
.. _sec-plugins-hook-comm-protocol-gcode-phase:
octoprint.comm.protocol.gcode.<phase>
@@ -389,14 +507,15 @@ This describes actually four hooks:
* ``octoprint.comm.protocol.gcode.sending``
* ``octoprint.comm.protocol.gcode.sent``
.. py:function:: protocol_gcodephase_hook(comm_instance, phase, cmd, cmd_type, gcode, *args, **kwargs)
.. py:function:: protocol_gcodephase_hook(comm_instance, phase, cmd, cmd_type, gcode, subcode=None, tags=None, *args, **kwargs)
Pre- and postprocess commands as they progress through the various phases of being sent to the printer. The phases
are the following:
* ``queuing``: This phase is triggered just before the command is added to the send queue of the communication layer. This
corresponds to the moment a command is being read from a file that is currently being printed. Handlers
may suppress or change commands or their command type here.
may suppress or change commands or their command type here. This is the only phase that supports multi command
expansion by having the handler return a list, see below for details.
* ``queued``: This phase is triggered just after the command was added to the send queue of the communication layer.
No manipulation is possible here anymore (returned values will be ignored).
* ``sending``: This phase is triggered just before the command is actually being sent to the printer. Right afterwards
@@ -411,7 +530,39 @@ This describes actually four hooks:
the communication layer or before they are actually sent over the serial port, or to react to the queuing or sending
of commands after the fact. The hook handler will be called with the processing ``phase``, the ``cmd`` to be sent to
the printer as well as the ``cmd_type`` parameter used for enqueuing (OctoPrint will make sure that the send queue
will never contain more than one line with the same ``cmd_type``) and the detected gcode command (if it is one).
will never contain more than one line with the same ``cmd_type``) and the detected ``gcode`` command (if it is one)
as well as its ``subcode`` (if it has one). OctoPrint will also provide any ``tags`` attached to the command throughout
its lifecycle.
Tags are arbitrary strings that can be attached to a command as it moves through the various phases and can be used to e.g.
distinguish between commands that originated in a printed file (``source:file``) vs. a configured GCODE script
(``source:script``) vs. an API call (``source:api``) vs. a plugin (``source:plugin`` or ``source:rewrite`` and
``plugin:<plugin identifier>``). If during development you want to get an idea of the various possible tags, set
the logger ``octoprint.util.comm.command_phases`` to ``DEBUG``, connect to a printer (real or virtual) and take a
look at your ``octoprint.log`` during serial traffic:
.. code-block:: none
2018-02-16 18:20:31,213 - octoprint.util.comm.command_phases - DEBUG - phase: queuing | command: T0 | gcode: T | tags: [ api:printer.command, source:api, trigger:printer.commands ]
2018-02-16 18:20:31,216 - octoprint.util.comm.command_phases - DEBUG - phase: queued | command: M117 Before T! | gcode: M117 | tags: [ api:printer.command, phase:queuing, plugin:multi_gcode_test, source:api, source:rewrite, trigger:printer.commands ]
2018-02-16 18:20:31,217 - octoprint.util.comm.command_phases - DEBUG - phase: sending | command: M117 Before T! | gcode: M117 | tags: [ api:printer.command, phase:queuing, plugin:multi_gcode_test, source:api, source:rewrite, trigger:printer.commands ]
2018-02-16 18:20:31,217 - octoprint.util.comm.command_phases - DEBUG - phase: queued | command: T0 | gcode: T | tags: [ api:printer.command, source:api, trigger:printer.commands ]
2018-02-16 18:20:31,219 - octoprint.util.comm.command_phases - DEBUG - phase: queued | command: M117 After T! | gcode: M117 | tags: [ api:printer.command, phase:queuing, plugin:multi_gcode_test, source:api, source:rewrite, trigger:printer.commands ]
2018-02-16 18:20:31,220 - octoprint.util.comm.command_phases - DEBUG - phase: sent | command: M117 Before T! | gcode: M117 | tags: [ api:printer.command, phase:queuing, plugin:multi_gcode_test, source:api, source:rewrite, trigger:printer.commands ]
2018-02-16 18:20:31,230 - tornado.access - INFO - 204 POST /api/printer/command (127.0.0.1) 23.00ms
2018-02-16 18:20:31,232 - tornado.access - INFO - 200 POST /api/printer/command (127.0.0.1) 25.00ms
2018-02-16 18:20:31,232 - octoprint.util.comm.command_phases - DEBUG - phase: sending | command: T0 | gcode: T | tags: [ api:printer.command, source:api, trigger:printer.commands ]
2018-02-16 18:20:31,234 - octoprint.util.comm.command_phases - DEBUG - phase: sent | command: T0 | gcode: T | tags: [ api:printer.command, source:api, trigger:printer.commands ]
2018-02-16 18:20:31,242 - octoprint.util.comm.command_phases - DEBUG - phase: sending | command: M117 After T! | gcode: M117 | tags: [ api:printer.command, phase:queuing, plugin:multi_gcode_test, source:api, source:rewrite, trigger:printer.commands ]
2018-02-16 18:20:31,243 - octoprint.util.comm.command_phases - DEBUG - phase: sent | command: M117 After T! | gcode: M117 | tags: [ api:printer.command, phase:queuing, plugin:multi_gcode_test, source:api, source:rewrite, trigger:printer.commands ]
2018-02-16 18:20:38,552 - octoprint.util.comm.command_phases - DEBUG - phase: queuing | command: G91 | gcode: G91 | tags: [ api:printer.printhead, source:api, trigger:printer.commands, trigger:printer.jog ]
2018-02-16 18:20:38,552 - octoprint.util.comm.command_phases - DEBUG - phase: queued | command: G91 | gcode: G91 | tags: [ api:printer.printhead, source:api, trigger:printer.commands, trigger:printer.jog ]
2018-02-16 18:20:38,553 - octoprint.util.comm.command_phases - DEBUG - phase: sending | command: G91 | gcode: G91 | tags: [ api:printer.printhead, source:api, trigger:printer.commands, trigger:printer.jog ]
2018-02-16 18:20:38,553 - octoprint.util.comm.command_phases - DEBUG - phase: queuing | command: G1 X10 F6000 | gcode: G1 | tags: [ api:printer.printhead, source:api, trigger:printer.commands, trigger:printer.jog ]
2018-02-16 18:20:38,555 - octoprint.util.comm.command_phases - DEBUG - phase: queued | command: G1 X10 F6000 | gcode: G1 | tags: [ api:printer.printhead, source:api, trigger:printer.commands, trigger:printer.jog ]
2018-02-16 18:20:38,556 - octoprint.util.comm.command_phases - DEBUG - phase: sent | command: G91 | gcode: G91 | tags: [ api:printer.printhead, source:api, trigger:printer.commands, trigger:printer.jog ]
2018-02-16 18:20:38,556 - octoprint.util.comm.command_phases - DEBUG - phase: queuing | command: G90 | gcode: G90 | tags: [ api:printer.printhead, source:api, trigger:printer.commands, trigger:printer.jog ]
2018-02-16 18:20:38,558 - octoprint.util.comm.command_phases - DEBUG - phase: queued | command: G90 | gcode: G90 | tags: [ api:printer.printhead, source:api, trigger:printer.commands, trigger:printer.jog ]
Defining a ``cmd_type`` other than None will make sure OctoPrint takes care of only having one command of that type
in its sending queue. Predefined types are ``temperature_poll`` for temperature polling via ``M105`` and
@@ -425,7 +576,7 @@ This describes actually four hooks:
* ``None``: Don't change anything. Note that Python functions will also automatically return ``None`` if
an empty ``return`` statement is used or just nothing is returned explicitly from the handler. Hence, the following
examples are all falling into this category:
examples are all falling into this category and equivalent:
.. code-block:: python
@@ -450,6 +601,36 @@ This describes actually four hooks:
should use this option.
* A 2-tuple consisting of a rewritten version of the ``cmd`` and the ``cmd_type``, e.g. ``return "M105", "temperature_poll"``.
Handlers which wish to rewrite both the command and the command type should use this option.
* A 3-tuple consisting of a rewritten version of the ``cmd``, the ``cmd_type`` and any additional ``tags`` you might
want to attach to the lifecycle of the command in a set, e.g. ``return "M105", "temperature_poll", {"my_custom_tag"}``
* **"queuing" phase only**: A list of any of the above to allow for expanding one command into
many. The following example shows how any queued command could be turned into a sequence of a temperature query,
line number reset, display of the ``gcode`` on the printer's display and finally the actual command (this example
does not make a lot of sense to be quite honest):
.. code-block:: python
def rewrite_foo(self, comm_instance, phase, cmd, cmd_type, gcode, subcode=None, tags=None *args, **kwargs):
if gcode or not cmd.startswith("@foo"):
return
return [("M105", "temperature_poll"), # 2-tuple, command & command type
("M110",), # 1-tuple, just the command
"M117 echo foo: {}".format(cmd)] # string, just the command
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.queuing": rewrite_foo
}
Note: Only one command of a given ``cmd_type`` (other than None) may be queued at a time. Trying to rewrite the ``cmd_type``
to one already in the queue will give an error.
.. warning::
Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as
you will effectively block the send loop, causing the communication with the printer to stall.
This includes I/O of any kind.
**Example**
@@ -469,6 +650,9 @@ This describes actually four hooks:
:param str cmd_type: Type of command, e.g. ``temperature_poll`` for temperature polling or ``sd_status_poll`` for SD
printing status polling.
:param str gcode: Parsed GCODE command, e.g. ``G0`` or ``M110``, may also be None if no known command could be parsed
:param str subcode: Parsed subcode of the GCODE command, e.g. ``1`` for ``M80.1``. Will be None if no subcode was provided
or no command could be parsed.
:param tags: Tags attached to the command
:return: None, 1-tuple, 2-tuple or string, see the description above for details.
.. _sec-plugins-hook-comm-protocol-gcode-received:
@@ -479,10 +663,17 @@ octoprint.comm.protocol.gcode.received
.. py:function:: gcode_received_hook(comm_instance, line, *args, **kwargs)
Get the returned lines sent by the printer. Handlers should return the received line or in any case, the modified
version of it. If the the handler returns None, processing will be aborted and the communication layer will get an
version of it. If the handler returns None, processing will be aborted and the communication layer will get an
empty string as the received line. Note that Python functions will also automatically return ``None`` if an empty
``return`` statement is used or just nothing is returned explicitly from the handler.
.. warning::
Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as
you will effectively block the receive loop, causing the communication with the printer to stall.
This includes I/O of any kind.
**Example:**
Looks for the response of an ``M115``, which contains information about the ``MACHINE_TYPE``, among other things.
@@ -497,6 +688,43 @@ octoprint.comm.protocol.gcode.received
:return: The received line or in any case, a modified version of it.
:rtype: str
.. _sec-plugins-hook-comm-protocol-gcode-error:
octoprint.comm.protocol.gcode.error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: gcode_error_hook(comm_instance, error_message, *args, **kwargs)
Get the messages of any errors messages sent by the printer, with the leading ``Error:`` or ``!!`` already
stripped. Handlers should return True if they handled that error internally and it should not be processed by
the system further. Normal processing of these kinds of errors - depending on the configuration of error
handling - involves canceling the ongoing print and possibly also disconnecting.
Plugins might utilize this hook to handle errors generated by the printer that are recoverable in one way or
the other and should not trigger the normal handling that assumes the worst.
.. warning::
Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as
you will effectively block the receive loop, causing the communication with the printer to stall.
This includes I/O of any kind.
**Example:**
Looks for error messages containing "fan error" or "bed missing" (ignoring case) and marks them as handled by the
plugin.
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/comm_error_handler_test.py
:linenos:
:tab-width: 4
:caption: `comm_error_handler_test.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/comm_error_handler_test.py>`_
:param MachineCom comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
:param str error_message: The error message received from the printer.
:return: True if the error was handled in the plugin and should not be processed further, False (or None) otherwise.
:rtype: bool
.. _sec-plugins-hook-comm-protocol-scripts:
octoprint.comm.protocol.scripts
@@ -504,19 +732,20 @@ octoprint.comm.protocol.scripts
.. py:function:: protocol_scripts_hook(comm_instance, script_type, script_name, *args, **kwargs)
Return a prefix to prepend and a postfix to append to the script ``script_name`` of type ``type``. Handlers should
Return a prefix to prepend, postfix to append, and optionally a dictionary of variables to provide to the script ``script_name`` of type ``type``. Handlers should
make sure to only proceed with returning additional scripts if the ``script_type`` and ``script_name`` match
handled scripts. If not, None should be returned directly.
If the hook handler has something to add to the specified script, it may return a 2-tuple, with the first entry
defining the prefix (what to *prepend* to the script in question) and the last entry defining the postfix (what to
*append* to the script in question). Both prefix and postfix can be None to signify that nothing should be prepended
If the hook handler has something to add to the specified script, it may return a 2-tuple, a 3-tuple or a 4-tuple with the first entry
defining the prefix (what to *prepend* to the script in question), the second entry defining the postfix (what to
*append* to the script in question), and finally if desired a dictionary of variables to be made available to the script on third and additional tags to set on the
commands on fourth position. Both prefix and postfix can be None to signify that nothing should be prepended
respectively appended.
The returned entries may be either iterables of script lines or a string including newlines of the script lines (which
The returned prefix and postfix entries may be either iterables of script lines or a string including newlines of the script lines (which
will be split by the caller if necessary).
**Example:**
**Example 1:**
Appends an ``M117 OctoPrint connected`` to the configured ``afterPrinterConnected`` GCODE script.
@@ -525,12 +754,54 @@ octoprint.comm.protocol.scripts
:tab-width: 4
:caption: `message_on_connect.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/message_on_connect.py>`_
**Example 2:**
Provides the variable ``myvariable`` to the configured ``beforePrintStarted`` GCODE script.
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/gcode_script_variables.py
:linenos:
:tab-width: 4
:caption: `gcode_script_variables.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/gcode_script_variables.py>`_
:param MachineCom comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
:param str script_type: The type of the script for which the hook was called, currently only "gcode" is supported here.
:param str script_name: The name of the script for which the hook was called.
:return: A 2-tuple in the form ``(prefix, postfix)`` or None
:return: A 2-tuple in the form ``(prefix, postfix)``, 3-tuple in the form ``(prefix, postfix, variables)``, or None
:rtype: tuple or None
.. _sec-plugins-hook-comm-protocol-temperatures-received:
octoprint.comm.protocol.temperatures.received
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: protocol_temperatures_received_hook(comm_instance, parsed_temperatures, *args, **kwargs)
Get the parsed temperatures returned by the printer, allowing handlers to modify them prior to handing them off
to the system. Handlers are expected to either return ``parsed_temperatures`` as-is or a modified copy thereof.
``parsed_temperatures`` is a dictionary mapping from tool/bed identifier (``B``, ``T0``, ``T1``) to a 2-tuple of
actual and target temperature, e.g. ``{'B': (45.2, 50.0), 'T0': (178.9, 210.0), 'T1': (21.3, 0.0)}``.
This hook can be useful in cases where a printer e.g. is prone to returning garbage data from time to time, allowing
additional sanity checking to be applied and invalid values to be filtered out. If a handler returns an empty
dictionary or ``None``, no further processing will take place.
.. warning::
Make sure to not perform any computationally expensive or otherwise long running actions within these handlers as
you will effectively block the receive loop, causing the communication with the printer to stall.
This includes I/O of any kind.
**Example**
The following example shows how to filter out actual temperatures that are outside a sane range of 1°C to 300°C.
.. onlineinclude:: https://raw.githubusercontent.com/OctoPrint/Plugin-Examples/master/sanitize_temperatures.py
:linenos:
:tab-width: 4
:caption: `sanitize_temperatures.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/sanitize_temperatures.py>`_
.. _sec-plugins-hook-comm-transport-serial-factory:
octoprint.comm.transport.serial.factory
@@ -607,6 +878,72 @@ octoprint.comm.transport.serial.factory
:rtype: A serial instance implementing implementing the methods ``readline(...)``, ``write(...)``, ``close()`` and
optionally ``baudrate`` and ``timeout`` attributes as described above.
.. _sec-plugins-hook-events-register_custom_events:
octoprint.events.register_custom_events
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: register_custom_events_hook(*args, **kwargs)
Return a list of custom :ref:`events <sec-events>` to register in the system for your plugin.
Should return a list of strings which represent the custom events. Their name on the `octoprint.events.Events` object
will be the returned value transformed into upper case ``CAMEL_CASE`` and prefixed with ``PLUGIN_<IDENTIFIER>``. Their
value will be prefixed with ``plugin_<identifier>_``.
Example:
Consider the following hook part of a plugin with the identifier ``myplugin``. It will register two custom events
in the system, ``octoprint.events.Events.PLUGIN_MYPLUGIN_MY_CUSTOM_EVENT`` with value ``plugin_myplugin_my_custom_event``
and ``octoprint.events.Events.PLUGIN_MYPLUGIN_MY_OTHER_CUSTOM_EVENT`` with value ``plugin_myplugin_my_other_custom_event``.
.. code-block:: python
:linenos:
def register_custom_events(*args, **kwargs):
return ["my_custom_event", "my_other_custom_event"]
:return: A list of custom events to register
:rtype: list
.. _sec-plugins-hook-filemanager-analysis-factory:
octoprint.filemanager.analysis.factory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: analysis_queue_factory_hook(*args, **kwargs)
Return additional (or replacement) analysis queue factories used for analysing uploaded files.
Should return a dictionary to merge with the existing dictionary of factories, mapping from extension tree leaf
to analysis queue factory. Analysis queue factories are expected to be :class:`~octoprint.filemanager.analysis.AbstractAnalysisQueue`
subclasses or factory methods taking one argument (the finish callback to be used by the queue implementation
to signal that an analysis has been finished to the system). See the source of :class:`~octoprint.filemanager.analysis.GcodeAnalysisQueue`
for an example.
By default, only one analysis queue factory is registered in the system, for file type ``gcode``: :class:`~octoprint.filemanager.analysis.GcodeAnalysisQueue`.
This can be replaced by plugins using this hook, allowing other approaches to file analysis.
This is useful for plugins wishing to provide (alternative) methods of metadata analysis for printable files.
**Example:**
The following handler would replace the existing analysis queue for ``gcode`` files with a custom implementation:
.. code-block:: python
:linenos:
from octoprint.filemanager.analysis import AbstractAnalysisQueue
class MyCustomGcodeAnalysisQueue(AbstractAnalysisQueue):
# ... custom implementation here ...
def custom_gcode_analysis_queue(*args, **kwargs):
return dict(gcode=MyCustomGcodeAnalysisQueue)
:return: A dictionary of analysis queue factories, mapped by their targeted file type.
:rtype: dict
.. _sec-plugins-hook-filemanager-extensiontree:
octoprint.filemanager.extension_tree
@@ -657,7 +994,7 @@ octoprint.filemanager.preprocessor
``file_object`` will be a subclass of :class:`~octoprint.filemanager.util.AbstractFileWrapper`. Handlers may
access the raw data of the file via :func:`~octoprint.filemanager.util.AbstractFileWrapper.stream`, e.g.
to wrap it further. Handlers which do not wish to handle the `file_object`
to wrap it further. Handlers which do not wish to handle the `file_object` should just return it untouched.
**Example**
@@ -695,20 +1032,198 @@ octoprint.printer.factory
* ``analysis_queue``: The :class:`~octoprint.filemanager.analysis.AnalysisQueue`
* ``slicing_manager``: The :class:`~octoprint.slicing.SlicingManager`
* ``file_manager``: The :class:`~octoprint.filemanager.FileManager`
* ``app_session_manager``: The :class:`~octoprint.server.util.flask.AppSessionManager`
* ``plugin_lifecycle_manager``: The :class:`~octoprint.server.LifecycleManager`
* ``user_manager``: The :class:`~octoprint.users.UserManager`
* ``user_manager``: The :class:`~octoprint.access.users.UserManager`
* ``preemptive_cache``: The :class:`~octoprint.server.util.flask.PreemptiveCache`
If the factory returns anything but ``None``, it will be assigned to the global ``printer`` instance.
If no of the registered factories return a printer instance, the default :class:`~octoprint.printer.standard.Printer`
If none of the registered factories return a printer instance, the default :class:`~octoprint.printer.standard.Printer`
class will be instantiated.
:param dict components: System components to use for printer instance initialization
:return: The ``printer`` instance to use globally.
:rtype: PrinterInterface subclass or None
.. _sec-plugins-hook-printer-estimation-factory:
octoprint.printer.estimation.factory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: print_time_estimator_factory(*args, **kwargs)
Return a :class:`~octoprint.printer.estimation.PrintTimeEstimator` subclass (or factory) to use for print time
estimation. This will be called on each start of a print or streaming job with a single parameter ``job_type``
denoting the type of job that was just started: ``local`` meaning a print of a local file through the serial connection,
``sdcard`` a print of a file stored on the printer's SD card, ``stream`` the streaming of a local file to the
printer's SD card.
This is useful for plugins wishing to provide alternative methods of live print time estimation.
If none of the registered factories return a ``PrintTimeEstimator`` subclass, the default :class:`~octoprint.printer.estimation.PrintTimeEstimator`
will be used.
**Example:**
The following example would replace the stock print time estimator with (a nonsensical) one that always estimates
two hours of print time left:
.. code-block:: python
from octoprint.printer.estimation import PrintTimeEstimator
class CustomPrintTimeEstimator(PrintTimeEstimator):
def __init__(self, job_type):
pass
def estimate(self, progress, printTime, cleanedPrintTime, statisticalTotalPrintTime, statisticalTotalPrintTimeType):
# always reports 2h as printTimeLeft
return 2 * 60 * 60, "estimate"
def create_estimator_factory(*args, **kwargs):
return CustomPrintTimeEstimator
__plugin_hooks__ = {
"octoprint.printer.estimation.factory": create_estimator_factory
}
:return: The :class:`~octoprint.printer.estimation.PrintTimeEstimator` class to use, or a factory method
:rtype: class or function
.. _sec-plugins-hook-octoprint-printer-sdcardupload:
octoprint.printer.sdcardupload
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: sd_card_upload_hook(printer, filename, path, start_callback, success_callback, failure_callback, *args, **kwargs)
Via this hook plugins can change the way files are being uploaded to the sd card of the printer.
Implementations **must** call the provided ``start_callback`` on start of the file transfer and either the ``success_callback``
or ``failure_callback`` on the end of the file transfer, depending on whether it was successful or not.
The ``start_callback`` has the following signature:
.. code-block:: python
def start_callback(local_filename, remote_filename):
# ...
``local_filename`` must be the name of the file on the ``local`` storage, ``remote_filename`` the name of the file
to be created on the ``sdcard`` storage.
``success_callback`` and ``failure_callback`` both have the following signature:
.. code-block:: python
def success_or_failure_callback(local_filename, remote_filename, elapsed):
# ...
``local_filename`` must be the name of the file on the ``local`` storage, ``remote_filename`` the name of the file
to be created on the ``sdcard`` storage. ``elapsed`` is the elapsed time in seconds.
If the hook is going to handle the upload, it must return the (future) remote filename of the file on the ``sdcard``
storage. If it returns ``None`` (or an otherwise falsy value), OctoPrint will interpret this as the hook not going to
handle the file upload, in which case the next hook or - if no other hook is registered - the default implementation
will be called.
**Example**
The following example creates a dummy SD card uploader that does nothing but sleep for ten seconds when a file
is supposed to be uploaded. Note that the long running process of sleeping for ten seconds is extracted into its
own thread, which is important in order to not block the main application!
.. code-block:: python
import threading
import logging
import time
def nop_upload_to_sd(printer, filename, path, sd_upload_started, sd_upload_succeeded, sd_upload_failed, *args, **kwargs):
logger = logging.getLogger(__name__)
remote_name = printer._get_free_remote_name(filename)
logger.info("Starting dummy SDCard upload from {} to {}".format(filename, remote_name))
sd_upload_started(filename, remote_name)
def process():
logger.info("Sleeping 10s...")
time.sleep(10)
logger.info("And done!")
sd_upload_succeeded(filename, remote_name, 10)
thread = threading.Thread(target=process)
thread.daemon = True
thread.start()
return remote_name
__plugin_name__ = "No-op SDCard Upload Test"
__plugin_hooks__ = {
"octoprint.printer.sdcardupload": nop_upload_to_sd
}
.. versionadded:: 1.3.11
:param object printer: the :py:class:`~octoprint.printer.PrinterInterface` instance the hook was called from
:param str filename: filename on the ``local`` storage
:param str path: path of the file in the local file system
:param function sd_upload_started: callback for when the upload started
:param function sd_upload_success: callback for successful finish of upload
:param function sd_upload_failure: callback for failure of upload
:return: the name of the file on the ``sdcard`` storage or ``None``
:rtype: string or ``None``
.. _sec-plugins-hook-server-http-after_request:
octoprint.server.api.after_request
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: after_request_handlers_hook(*args, **kwargs)
Allows adding additional after-request-handlers to API endpoints defined by OctoPrint itself and installed plugins.
Your plugin might need this to further restrict access to API methods. See the bundled "Force Login" plugin for a
usage example.
.. important::
Implementing this hook will make your plugin require a restart of OctoPrint for enabling/disabling it fully.
.. _sec-plugins-hook-server-http-before_request:
octoprint.server.api.before_request
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: after_request_handlers_hook(*args, **kwargs)
Allows adding additional before-request-handlers to API endpoints defined by OctoPrint itself and installed plugins.
Your plugin might need this to further restrict access to API methods. See the bundled "Force Login" plugin for a
usage example.
.. important::
Implementing this hook will make your plugin require a restart of OctoPrint for enabling/disabling it fully.
.. _sec-plugins-hook-server-http-access_validator:
octoprint.server.http.access_validator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: access_validator_hook(request, *args, **kwargs)
Allows adding additional access validators to the default tornado routers.
Your plugin might need to this to restrict acccess to downloads and webcam snapshots further. See the bundled
"Force Login" plugin for a usage example.
.. important::
Implementing this hook will make your plugin require a restart of OctoPrint for enabling/disabling it fully.
.. _sec-plugins-hook-server-http-bodysize:
octoprint.server.http.bodysize
@@ -783,6 +1298,14 @@ octoprint.server.http.routes
view of the blueprint will thus not be reachable since processing of the request will directly be handed over
to your defined handler class.
.. important::
If you want your route to support CORS if it's enabled in OctoPrint, your `RequestHandler <http://tornado.readthedocs.org/en/branch4.0/web.html#request-handlers>`_
needs to implement the :class:`~octoprint.server.util.tornado.CorsSupportMixin` for this to work. Note that all of
:class:`~octoprint.server.util.tornado.LargeResponseHandler`, :class:`~octoprint.server.util.tornado.UrlProxyHandler`,
:class:`~octoprint.server.util.tornado.StaticDataHandler` and :class:`~octoprint.server.util.tornado.DeprecatedEndpointHandler`
already implement this mixin.
.. important::
Implementing this hook will make your plugin require a restart of OctoPrint for enabling/disabling it fully.
@@ -804,12 +1327,91 @@ octoprint.server.http.routes
that allows delivery of the requested resource as attachment and access validation through an optional callback.
:class:`~octoprint.server.util.tornado.UrlForwardHandler`
`tornado.web.RequestHandler <http://tornado.readthedocs.org/en/branch4.0/web.html#request-handlers>`_ that proxies
requests to a preconfigured url and returns the response.
requests to a preconfigured URL and returns the response.
:param list server_routes: read-only list of the currently configured server routes
:return: a list of 3-tuples with additional routes as defined above
:rtype: list
.. _sec-plugins-hook-server-sockjs-authed:
octoprint.server.sockjs.authed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: socket_authed_hook(socket, user, *args, **kwargs):
Allows plugins to be notified that a user got authenticated or deauthenticated on the socket (e.g. due to logout).
See the bundled :ref:`Forcelogin Plugin <sec-bundledplugins-forcelogin>` for an example on how to utilize this.
:param object socket: the socket object which is about to be registered
:param object user: the user that got authenticated on the socket, or None if the user got deauthenticated
.. _sec-plugins-hook-server-sockjs-register:
octoprint.server.sockjs.register
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: socket_registration_hook(socket, user, *args, **kwargs):
Allows plugins to prevent a new :ref:`push socket client <sec-api-push>` to be registered to the system.
Handlers should return either ``True`` or ``False``. ``True`` signals to proceed with normal registration. ``False``
signals to not register the client.
See the bundled :ref:`Forcelogin Plugin <sec-bundledplugins-forcelogin>` for an example on how to utilize this.
:param object socket: the socket object which is about to be registered
:param object user: the user currently authenticated on the socket - might be None
:return: whether to proceed with registration (``True``) or not (``False``)
:rtype: boolean
.. _sec-plugins-hook-server-sockjs-emit:
octoprint.server.sockjs.emit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: socket_emit_hook(socket, user, message, payload, *args, **kwargs):
Allows plugins to prevent any messages to be emitted on an existing :ref:`push connection <sec-api-push>`.
Handlers should return either ``True`` to allow the message to be emitted, or ``False`` to prevent it.
See the bundled :ref:`Forcelogin Plugin <sec-bundledplugins-forcelogin>` for an example on how to utilize this.
:param object socket: the socket object on which a message is about to be emitted
:param object user: the user currently authenticated on the socket - might be None
:param string message: the message type about to be emitted
:param dict payload: the payload of the message about to be emitted (may be None)
:return: whether to proceed with sending the message (``True``) or not (``False``)
:rtype: boolean
.. _sec-plugins-hook-timelapse-extensions:
octoprint.timelapse.extensions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: timelapse_extension_hook(*args, **kwargs)
Allows extending the set of supported file extensions for timelapse files. Handlers must return a list of
additional file extensions.
**Example**
Allow the management of timelapse GIFs with extension ``gif``.
.. code-block:: python
def get_timelapse_extensions(*args, **kwargs):
return ["gif"]
__plugin_hooks__ = {
"octoprint.timelapse.extensions": get_timelapse_extensions
}
:return: a list of additional file extensions
:rtype: list
.. _sec-plugins-hook-ui-web-templatetypes:
octoprint.ui.web.templatetypes
@@ -922,3 +1524,69 @@ octoprint.ui.web.templatetypes
:param dict template_sorting: read-only dictionary of currently configured template sorting specifications
:return: a list of 3-tuples (template type, rule, sorting spec)
:rtype: list
.. _sec-plugins-hook-users-factory:
octoprint.access.users.factory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: user_manager_factory_hook(components, settings, *args, **kwargs)
Return a :class:`~octoprint.access.users.UserManager` instance to use as global user manager object. This will
be called only once during initial server startup.
The provided ``components`` is a dictionary containing the already initialized system components:
* ``plugin_manager``: The :class:`~octoprint.plugin.core.PluginManager`
* ``printer_profile_manager``: The :class:`~octoprint.printer.profile.PrinterProfileManager`
* ``event_bus``: The :class:`~octoprint.events.EventManager`
* ``analysis_queue``: The :class:`~octoprint.filemanager.analysis.AnalysisQueue`
* ``slicing_manager``: The :class:`~octoprint.slicing.SlicingManager`
* ``file_manager``: The :class:`~octoprint.filemanager.FileManager`
* ``plugin_lifecycle_manager``: The :class:`~octoprint.server.LifecycleManager`
* ``preemptive_cache``: The :class:`~octoprint.server.util.flask.PreemptiveCache`
If the factory returns anything but ``None``, it will be assigned to the global ``userManager`` instance.
If none of the registered factories return a user manager instance, the class referenced by the ``config.yaml``
entry ``accessControl.userManager`` will be initialized if possible, otherwise a stock
:class:`~octoprint.access.users.FilebasedUserManager` will be instantiated, linked to the default user storage
file ``~/.octoprint/users.yaml``.
:param dict components: System components to use for user manager instance initialization
:param SettingsManager settings: The global settings manager instance to fetch configuration values from if necessary
:return: The ``userManager`` instance to use globally.
:rtype: UserManager subclass or None
.. _sec-plugins-hook-timelapse-capture-pre:
octoprint.timelapse.capture.pre
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: capture_pre_hook(filename)
Perform specific actions prior to capturing a timelapse frame.
``filename`` will be the future path of the frame to be saved.
:param str filename: The future path of the frame to be saved.
:return: None
:rtype: None
.. _sec-plugins-hook-timelapse-capture-post:
octoprint.timelapse.capture.post
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: capture_post_hook(filename, success)
Perform specific actions after capturing a timelapse frame.
``filename`` will be the path of the frame that should have been saved.
``sucesss`` indicates whether the capture was successful or not.
:param str filename: The path of the frame that should have been saved.
:param boolean success: Indicates whether the capture was successful or not.
:return: None
:rtype: None
+4 -4
View File
@@ -41,15 +41,15 @@ An overview of these properties follows.
OctoPrint's file manager, an instance of :class:`octoprint.filemanager.FileManager`.
``self._printer``
OctoPrint's printer management object, an instance of :class:`octoprint.printer.PrinterInterface`.
``self._app_session_manager``
OctoPrint's application session manager, an instance of :class:`octoprint.server.util.flask.AppSessionManager`.
``self._user_manager``
OctoPrint's user manager, an instance of :class:`octoprint.users.UserManager`.
OctoPrint's user manager, an instance of :class:`octoprint.access.users.UserManager`.
``self._connectivity_checker``
OctoPrint's connectivity checker, an instance of :class:`octoprint.util.ConnectivityChecker`.
.. seealso::
:class:`~octoprint.plugin.core.Plugin` and :class:`~octoprint.plugin.types.OctoPrintPlugin`
Class documentation also containing the properties shared among all mixing implementations.
Class documentation also containing the properties shared among all mixin implementations.
:ref:`Available Mixins <sec-plugins-mixins-available>`
Some mixin types trigger the injection of additional properties.
+45 -10
View File
@@ -68,11 +68,14 @@ calls are done is as follows:
* Plugins with a return value that is not ``None`` for :meth:`~octoprint.plugin.core.SortablePlugin.get_sorting_key`
for the provided sorting context will be ordered among each other first. If the returned order number is equal for
two or more implementations, the plugin's identifier will be the next sorting criteria.
* After that follow plugins which returned ``None`` (the default). They are sorted by their identifier.
two or more implementations, they will be sorted first by whether they come bundled with OctoPrint or not, then by
their identifier.
* After that follow plugins which returned ``None`` (the default). They are first sorted by whether they come bundled
with OctoPrint or not, then by their identifier.
Example: Consider three plugin implementations implementing the :class:`~octoprint.plugin.StartupPlugin` mixin, called
``plugin_a``, ``plugin_b`` and ``plugin_c``. ``plugin_a`` doesn't override :meth:`~octoprint.plugin.core.SortablePlugin.get_sorting_key`.
Example: Consider four plugin implementations implementing the :class:`~octoprint.plugin.StartupPlugin` mixin, called
``plugin_a``, ``plugin_b``, ``plugin_c`` and ``plugin_d``, the latter coming bundled with OctoPrint. ``plugin_a``
and ``plugin_d`` don't override :meth:`~octoprint.plugin.core.SortablePlugin.get_sorting_key`.
``plugin_b`` and ``plugin_c`` both return ``1`` for the sorting context ``StartupPlugin.on_startup``, ``None`` otherwise:
.. code-block:: python
@@ -99,7 +102,7 @@ Example: Consider three plugin implementations implementing the :class:`~octopri
class PluginB(octoprint.plugin.StartupPlugin):
def get_sorting_key(context):
def get_sorting_key(self, context):
if context == "StartupPlugin.on_startup":
return 1
return None
@@ -120,7 +123,7 @@ Example: Consider three plugin implementations implementing the :class:`~octopri
class PluginC(octoprint.plugin.StartupPlugin):
def get_sorting_key(context):
def get_sorting_key(self, context):
if context == "StartupPlugin.on_startup":
return 1
return None
@@ -134,13 +137,45 @@ Example: Consider three plugin implementations implementing the :class:`~octopri
__plugin_implementation__ = PluginC()
.. code-block:: python
:linenos:
:caption: plugin_d.py
# in this example this is bundled with OctoPrint
import octoprint.plugin
class PluginD(octoprint.plugin.StartupPlugin):
def on_startup(self, *args, **kwargs):
self._logger.info("PluginD starting up")
def on_after_startup(self, *args, **kwargs):
self._logger.info("PluginD started up")
__plugin_implementation__ = PluginD()
OctoPrint will detect that ``plugin_b`` and ``plugin_c`` define a order number, and since it's identical for both (``1``)
will order both plugins based on their plugin identifier. ``plugin_a`` doesn't define a sort key and hence will be
put after the other two. The execution order of the ``on_startup`` method will hence be ``plugin_b``, ``plugin_c``, ``plugin_a``.
will order both plugins based first on their bundling status and then on their plugin identifier.
``plugin_a`` and ``plugin_d`` don't define a sort key and hence will be
put after the other two, with ``plugin_d`` coming *before* ``plugin_a`` since it comes bundled with OctoPrint.
The execution order of the ``on_startup`` method will hence be ``plugin_b``, ``plugin_c``, ``plugin_d``, ``plugin_a``.
Now, the execution order of the ``on_after_startup`` method will be determined based on another sorting context,
``StartupPlugin.on_after_startup`` for which all of the plugins return ``None``. Hence, the execution order of the
``on_after_startup`` method will be purely ordered by plugin identifier, ``plugin_a``, ``plugin_b``, ``plugin_c``.
``on_after_startup`` method will be ordered first by bundle status, then by plugin identifier: ``plugin_d``, ``plugin_a``, ``plugin_b``, ``plugin_c``.
This will result in the following messages to be generated:
.. code-block:: plain
Plugin B starting up
Plugin C starting up
Plugin D starting up
Plugin A starting up
Plugin D started up
Plugin A started up
Plugin B started up
Plugin C started up
.. _sec-plugins-mixins-injectedproperties:
@@ -153,7 +188,7 @@ An overview of these properties can be found in the section :ref:`Injected Prope
.. seealso::
:class:`~octoprint.plugin.core.Plugin` and :class:`~octoprint.plugin.types.OctoPrintPlugin`
Class documentation also containing the properties shared among all mixing implementations.
Class documentation also containing the properties shared among all mixin implementations.
.. _sec-plugins-mixins-available:
Loaded 100 of 611 files, more files were not shown because too many files have changed in this diff. Show more