Compare commits

...
Author SHA1 Message Date
Gina Häußge a884888caa ⬆️ Ensure current versions of itsdangerous 2020-07-15 12:33:13 +02:00
Gina Häußge c40ae9f181 🐛 Don't show restore wizard on Windows
Restore doesn't work on Windows, so the wizard also shouldn't be shown.
2020-07-15 12:11:18 +02:00
Gina Häußge 1da4c2b7ab 🔖 Preparing release of 1.4.1rc3 2020-07-15 10:49:29 +02:00
Gina Häußge c5baa05b5e 🐛 Fix file list title in case of CSS :after
Compare eyal0/OctoPrint-PrintTimeGenius#202

Closes #3642
2020-07-14 21:26:25 +02:00
Gina Häußge 719c3e3b0b 💚 And now REALLY reenable them 😅 2020-07-14 18:23:15 +02:00
Gina Häußge 123266d0ff 💚 Forgot to re-enable some E2E tests 2020-07-14 17:52:42 +02:00
Gina Häußge aa0ba6881c 💚 Improve E2E tests
Way less flaky now, and sprinkled with some helpers to ensure stuff has
loaded fine before trying to fire off tests 🥳
2020-07-14 17:48:36 +02:00
Gina Häußge b8246d41e3 💚 Improving testability of UI in E2E tests 2020-07-14 17:44:58 +02:00
Gina Häußge 7d037ab1a4 🐛 Fix potential race condition
Static assets where being sent with session cookies. That doesn't make
sense and might actually cause issues if an asset takes *just* long
enough to load to be overtaken by a login request from something like
the loginui.

Found with the E2E tests, which turned out to be less flaky themselves
than thought 🥳
2020-07-14 17:43:01 +02:00
Gina Häußge 01940bbb10 💚 (Hopefully) fix & re-enable E2E tests
We now wait for full app initialization (OctoPrint.coreui.startedUp &
OctoPrint.loginui.startedUp) before trying to test against things.

At least in local test runs that solved the flakiness.
2020-07-13 16:06:28 +02:00
Gina Häußge 6ef5b5001e 💚 Disable E2E for now
They sadly are flaky due to some weird race condition issues inside
cypress. Need to investigate.
2020-07-13 14:27:14 +02:00
Gina Häußge 2a4853bbd4 ✨ New flag devel.webassets.minify_plugins
As suggested in @b-morgan in #3638, to allow plugin authors to detect
minification issues with their code during development.

See also #3640
2020-07-13 14:22:29 +02:00
Gina Häußge 6bac39c193 🥅 Disable minification only for third party plugins
Better solution than 7915e6c04e.

Closes #3640
2020-07-10 18:55:40 +02:00
Gina Häußge 7915e6c04e 🥅 Disable minification again by default
It might cause SyntaxErrors in third party plugins that cannot be
caught by the system and which then nuke ALL other third party plugins.

See Sebclem/OctoPrint-SimpleEmergencyStop#14 and
FormerLurker/Octolapse#567

This change can manually be applied by setting

``` yaml
devel:
  webassets:
    minify: false
```

in config.yaml
2020-07-10 18:32:26 +02:00
Gina Häußge d2a23c3dc7 ♻ Improve timeout handling during auto connect
That should work around issues when the printer takes longer to boot up
and respond properly.

See #3627
2020-07-08 18:19:20 +02:00
Gina Häußge 27191f5202 🐛 Don't trigger error handling on autodetect failure
See #3627
2020-07-08 14:15:09 +02:00
Gina Häußge 87cd6de96c 🔖 staging/maintenance is now 1.4.1rc3.dev 2020-07-08 13:58:20 +02:00
Gina Häußge 650d54d188 📌 rsa 4.1+ requires python 3
I really wish people would adhere to semver...
2020-07-08 10:02:54 +02:00
Gina Häußge a2510cf32a 🔖 Preparing release of 1.4.1rc2 2020-07-08 09:47:24 +02:00
Gina Häußge 42abcd7009 📝 Fix docs for virtual printer 2020-07-07 12:01:11 +02:00
Gina Häußge 736dca4d07 💚 Disable login tests for now
They aren't stable and currently can't be relied upon. For some reason
the page sometimes just doesn't reload in the test browsers.
2020-07-06 22:56:58 +02:00
Gina Häußge f2ca247731 💚 Fix cypress login test's wobbliness
Hopefully at least...
2020-07-06 22:30:36 +02:00
Gina Häußge fa148a8b7e 🐛 Fix async issue with logging on shutdown
Asynchronous components might be active after on_shutdown, and
AsyncLogHandlerMixin should be able to cope with logs generated by
them.

Closes #3629
2020-07-06 21:56:43 +02:00
Gina Häußge 20a3700a2c 🐛 Fix busy loop
Closes #3633
2020-07-06 21:49:18 +02:00
Gina Häußge f1cc40a87c 🐛 PMGR: Fix single file plugins under Py2.7
filetype dependency requires paths as str, so we need to make sure
we provide what will be identified as a native str type under both
py2 and 3.

Closes #3630
2020-07-06 18:31:30 +02:00
Gina Häußge a19c9366ed 🐛 Fix german translation
Contains some mismatched/broken tags causing severe rendering issues.

Closes #3628
2020-07-06 18:17:28 +02:00
Gina Häußge 46203fd43c 🐛 Fix auto detect with auto port and set baudrate
Closes #3627
2020-07-06 15:34:14 +02:00
Gina Häußge 38f1c74379 👷‍ Enable pypi push for releases 2020-07-06 15:12:08 +02:00
Gina Häußge 113dcd3fc9 🔖 staging/maintenance is now 1.4.1rc2.dev 2020-07-06 14:32:23 +02:00
Gina Häußge 0b471aae9e Merge branch 'rc/maintenance' into staging/maintenance 2020-07-06 14:29:56 +02:00
Gina Häußge 42769dad7d 🐛 Fix a bug during users.yaml migration 2020-07-06 11:52:24 +02:00
Gina Häußge d2110c3013 🔖 Prepare release of 1.4.1rc1 2020-07-06 09:53:06 +02:00
Gina Häußge 32b655451c 🔧 Update errortracking DSNs for 1.4.1rc1 2020-07-04 13:06:44 +02:00
Gina Häußge 0bc2bd6e40 💬 Update german translation 2020-07-04 13:05:51 +02:00
Gina Häußge 0ff72a3510 👷‍️ Remove travis 2020-07-02 19:09:02 +02:00
Gina Häußge b61b75e015 📝 New badges in readme 2020-07-02 19:08:43 +02:00
Gina Häußge 7339cb5d7b 👷‍️ ci/cd -> build 2020-07-02 18:41:38 +02:00
Gina Häußge 78b503239e 👷‍️ CI/CD: Add pytest & flake8 to workflow 2020-07-02 18:33:55 +02:00
Gina Häußge 2da5799677 👷‍️ e2e needs build 2020-07-02 18:21:52 +02:00
Gina Häußge ee74453839 👷‍️ e2e: integrate into build 2020-07-02 18:18:46 +02:00
Gina Häußge 7fe5af0466 👷‍️ e2e: Back to VIRTUAL
Turns out github action runners have /dev/ttyS* 😅
2020-07-02 18:07:07 +02:00
Gina Häußge 9f68900dc5 👷‍️ e2e: Switch to auto detect & wait for profiles 2020-07-02 18:03:43 +02:00
Gina Häußge 7c4e0b2344 👷‍️ Combine connect & disconnect 2020-07-02 17:52:54 +02:00
Gina Häußge 75c1b02760 👷‍️ e2e: Add connection test 2020-07-02 17:38:31 +02:00
Gina Häußge fd1ddab50f 👷‍️ Let's see if waiting helps 2020-07-02 16:56:28 +02:00
Gina Häußge 940909c0f8 👷‍️ Test if chrome works better 2020-07-02 16:46:27 +02:00
Gina Häußge 622aad07dc 👷‍️ First throw at E2E testing 2020-07-02 15:19:39 +02:00
Gina Häußge 9921887047 📝 Fix a link in the docs & remove an obsolete note 2020-07-02 14:06:51 +02:00
Gina Häußge e3a83ccb00 🐛 Action Command Notification: Fix binding 2020-07-01 13:59:49 +02:00
Gina Häußge 13c575b3bc 📝 Fix two links 2020-07-01 13:55:52 +02:00
Gina Häußge 0c9c25fb41 📝 Fix two image links 2020-07-01 13:55:38 +02:00
Gina Häußge ff67171d46 Merge branch 'improve/extractGcodeViewer' into maintenance
# Conflicts:
#	docs/bundledplugins/index.rst
2020-07-01 13:30:35 +02:00
Gina Häußge f6fef5e61f 📝 Add firmware & file check plugins to docs 2020-07-01 13:28:02 +02:00
Gina Häußge ff552daf31 ♻ GCode viewer: Extract into bundled plugin 2020-07-01 13:26:55 +02:00
Gina Häußge cf9de3d11c 📝 Add missing picture 2020-06-30 18:25:43 +02:00
Gina Häußge 637f34162f 🐛 Fix sorting of permissions in ETag calculation 2020-06-30 17:53:50 +02:00
Gina Häußge 3846a55c5e 📝 Update docs for Action Command Prompt plugin 2020-06-30 17:53:27 +02:00
Gina Häußge 6cc0a5ae34 📝 Docs for Action Command Notification plugin 2020-06-30 17:53:08 +02:00
Gina Häußge e88bd1f441 🐛 Action Command Notification: Fix visibility bug 2020-06-30 17:48:54 +02:00
Gina Häußge 4fc5aa7c3a ♻ Reduce code duplication & bundle in VM 2020-06-30 16:43:46 +02:00
FedericoNembrini ca493459b3 Add application button for temperature profiles
Add "setTargetFromProfile" and "setTargetToZero" wrapper for setting entire profiles
Add helper function to retrieve the temperature profiles description
2020-06-28 13:43:44 +02:00
Gina Häußge a01128b273 🏁 Fix startup under Python 3.8 and Windows
Python 3.8 makes proactor event loop the default on Windows, Tornado
doesn't like that.

See also tornadoweb/tornado#2608
2020-06-26 20:52:21 +02:00
Gina Häußge 727c69bb3f 🐛 logging: Fix request frequency & serial.log update 2020-06-26 19:08:24 +02:00
Gina Häußge 43fc028e2e 🔇 error tracking: Disable reports for KeyboardInterrupt 2020-06-26 18:55:42 +02:00
Gina Häußge 2e4c3fed24 ♻️ error tracking: better integration with UI 2020-06-26 18:54:39 +02:00
Gina Häußge 805159b07f ⬆️ Upgrade Sentry 2020-06-26 18:53:02 +02:00
Gina Häußge 27d2e22433 📝 Update third party license document 2020-06-26 11:54:31 +02:00
Gina Häußge bbab42cacd 💄 Add discord link & update supporter links 2020-06-26 11:54:10 +02:00
Gina Häußge 9b6a14cf19 💄 Column layout for supporters & authors in about 2020-06-26 11:52:33 +02:00
Gina Häußge 9a48342ce2 🚸 Make safe mode more visible in client log 2020-06-26 11:51:19 +02:00
Gina Häußge eb8eeae418 📝 Remove docs for SWU last_modified version check
It was merged into `header`
2020-06-26 11:50:50 +02:00
Gina Häußge 331cc3614a 🚸 UI indicator that serial.log is active 2020-06-26 11:13:14 +02:00
Gina Häußge 5287dca4e5 🐛 Flask login changed from user_id to _user_id
Thanks to @bzed for the heads-up.
2020-06-26 10:16:50 +02:00
Gina Häußge ced1bbf53d 👷‍♂️ Fix a typo 2020-06-24 16:23:49 +02:00
Gina Häußge d114551bd1 👷‍♂️ Build & release automation 2020-06-24 16:21:25 +02:00
Gina Häußge 8d32f65c5b Merge branch 'master' into maintenance 2020-06-24 16:18:28 +02:00
Gina Häußge ada121d2ec 🐛 Fix link to repo 2020-06-24 15:59:18 +02:00
Gina Häußge eac45562f8 ♻ logger.warn => logger.warning
`warn` is deprecated
2020-06-24 15:19:45 +02:00
Gina Häußge 0461992496 🐛 Gracefully handle lack of installed profiler
Just because we run with `--debug` doesn't mean we also have installed
the development dependencies. So in case we can't import `pyinstrument`
we should handle that gracefully even if `perfprofile` is requested.
2020-06-24 14:18:32 +02:00
Gina Häußge 7224970e2c ☂ SWU: GH release name can apparently be empty 2020-06-24 10:37:08 +02:00
Gina Häußge a0c0b2d8af 🐛 Image path is relative to manifest 2020-06-23 17:00:15 +02:00
Gina Häußge e9f9ad3a0d Merge branch 'pr/3609' into maintenance 2020-06-23 16:59:46 +02:00
Gina Häußge 9deabb895a ♻ Slight refactoring of file move UI
We actually also support moving folders, so why not reflect that in the
UI. And instead of introducing a new permission, we should stick to
what a move actually is - a (re)upload and a delete, so if both of these
permissions are granted, moving is allowed as well. Also make sure to
disable the move action for anything not on local storage, also
visually. Finally, make current (source) folder visible and use it to
preselect entry from folder list, which should also be calculated from
the existing data instead of requiring another file list fetch.
2020-06-23 16:59:33 +02:00
Gina Häußge c2705a96f1 ✨ Bundle file check plugin
Will check uploaded files for common issues. Currently only checks
for presence of `{travel_speed}` placeholder in GCODE.

Implements #3410
2020-06-22 18:02:39 +02:00
Gina Häußge a370f1e42f 🐛 Make sure po file actually exists 2020-06-22 17:27:17 +02:00
Gina Häußge 5b022a7321 💄 PMGR: Move author & homepage under title
Just like in the repository browser
2020-06-22 10:12:36 +02:00
Gina Häußge 063ad6cb3b 🎨 Minor code style fixes 2020-06-22 10:12:36 +02:00
Gina Häußge 8bf0ef5ddb ♻ Prompt support: Default to emergency sending & signal on
But only if reported as supported by firmware.
2020-06-22 10:12:35 +02:00
Gina Häußge 4ac8476f74 ♻ Make sure we read at least 1 byte
See comment to 7290a6d350
2020-06-22 10:12:35 +02:00
Gina Häußge 86925a43c4 Merge pull request #3608 from CharlesWillis3/dev/doc-fix-capabilities-name
fix firmware capabilities hook name
2020-06-22 09:53:13 +02:00
jneilliii 70ba9d56ab remove current path from select list 2020-06-20 12:40:13 -04:00
jneilliii f3327eb3aa add move file capabilities 2020-06-20 05:40:41 -04:00
Charles Willis 22177092be fix firmware capabilities hook name 2020-06-19 15:24:24 +01:00
Gina Häußge f9387a46c3 ✨ Add get_additional_metadata to file manager
Allows to look up a specific key. Counter part to
set_additional_metadata.
2020-06-19 16:03:41 +02:00
Gina Häußge 8e13e4fcc0 ✨ Allow sorting of file list by last print date
part 1/2 of #3433
2020-06-19 15:07:18 +02:00
Gina Häußge a81e2cd983 ✨ Add Web App Manifest
As defined in https://www.w3.org/TR/appmanifest/

Implements #3420
2020-06-19 14:58:54 +02:00
Gina Häußge 987b2e858f 💄 PGMR: Use birthday cake icon for pubdate 2020-06-19 14:21:31 +02:00
Gina Häußge 6396d5ede0 🔥 PGMR: Remove "new installs"
It doesn't really add that much information and the UI is already
crowded.
2020-06-19 14:18:59 +02:00
Gina Häußge 6d8a131c6d 💄 PMGR: More space for the repo browser 2020-06-19 14:07:13 +02:00
Gina Häußge a4eb739a95 ✨ PMGR: Display more stats from plugin repo
We now also include publication date, last push date, release & release
date and github stars in the UI (if available), allow sorting by all
that and also visually highlight abandoned/disabled/incompatible
plugins. Also there's a now a filter to hide abandoned plugins and an
indicator of how many plugins of all available ones are being shown with
the currently active filters and search.

Implements #3606
2020-06-19 13:16:50 +02:00
Gina Häußge 533039619e 🙈 Add .vscode 2020-06-19 09:52:02 +02:00
Gina Häußge 6e6af0203d 🙈 Add some test folders 2020-06-19 09:50:46 +02:00
Gina Häußge 2e4b5ebef6 🙈 Add some build artifacts to .gitignore 2020-06-19 09:46:44 +02:00
Gina Häußge 82b07ae8f2 ✨ Add print, select and userdata to Upload event
Implements #3604
2020-06-18 15:41:16 +02:00
Gina Häußge a9440eea88 ✏ Backup: Slight rewording 2020-06-18 15:21:38 +02:00
Gina Häußge eeaac73a5d ☂ Make sure _srcfile exists 2020-06-18 15:21:19 +02:00
Gina Häußge 0ac205cdf2 Merge branch 'pr/3607' into maintenance 2020-06-18 15:14:57 +02:00
Gina Häußge b399ce6fbc ✨ Backup: allow to specify path on CLI & echo back
Addon to #3607
2020-06-18 15:14:44 +02:00
Gina Häußge 9d1633ae65 🐛 Don't log plugin system warnings on CLI 2020-06-18 15:07:09 +02:00
Gina Häußge def106f409 🐛 Fix a JS error due to misnaming 2020-06-18 14:12:59 +02:00
Gina Häußge 462f2e602b ☂ SWU: Minimum free storage requirement
We now need to have at least 150MB (configurable) of free disk space on
all of site-packages, plugins and temp folder locations available in
order to enable updates.

Closes #2312
2020-06-18 13:50:32 +02:00
cp2004 a6fc4b6c7f Display entire path to backup on CLI command 2020-06-18 10:16:22 +01:00
Gina Häußge 6625f81b6e ✏ Remove references to wiki & update generic setup 2020-06-18 10:50:20 +02:00
Gina Häußge 7290a6d350 ♻ Refactor buffered readline & add null byte logging
As suggested in #2454
2020-06-17 17:01:54 +02:00
Gina Häußge 4555200027 ✏ Change wording 2020-06-17 13:59:43 +02:00
Gina Häußge 4415481604 Add notice about where to find old wiki content 2020-06-17 13:44:20 +02:00
Gina Häußge 0aed3c05cb 📝 Fix some intersphinx issues 2020-06-16 18:09:42 +02:00
Gina Häußge 1903a7a319 🐛 Backport TemporaryDirectory to Py2 2020-06-16 11:42:39 +02:00
Gina Häußge 4689e87a1f ♻ Fix a unit test 2020-06-15 18:41:18 +02:00
Gina Häußge 165b3421f1 ♻ Increase size of LRU cache 2020-06-15 18:10:12 +02:00
Gina Häußge 80aa7933ab ♻ Move to bytearray for performance reasons 2020-06-15 13:35:49 +02:00
Gina Häußge 5dd1b19373 🐛 PGMR: Fix affected version list in notices 2020-06-15 11:59:28 +02:00
Gina Häußge 2f630f69de 🐛 warnings.warning => warnings.warn 2020-06-15 11:50:59 +02:00
Gina Häußge 0a9e9ef3a3 🐛 Fix handling of shared nozzle reporting w/ only T0
Fixes #3467
2020-06-12 13:55:57 +02:00
Gina Häußge 143cffd060 💚 Fix discord CI message format 2020-06-12 12:10:35 +02:00
Gina Häußge 1d48d49453 👷‍♂️ Use build matrix for test installs 2020-06-12 11:52:20 +02:00
Gina Häußge 0a5f9dfc00 ♻ SWU: etag/lastmodified => httpheader
We now have a unified version check for any kind of HTTP headers. Makes
things easier.
2020-06-12 11:33:32 +02:00
Gina Häußge 607e4b376c ♻ We no longer build on RTD 2020-06-12 10:31:13 +02:00
Gina Häußge 9042442bea Merge branch 'master' into maintenance 2020-06-12 10:21:17 +02:00
Gina Häußge 55dafd511b 🐛 Fix auth on tornado endpoints again
Broke thanks to a breaking change hidden in the new flask-login version.
Just use semver, people, please!

Fixes #3600
2020-06-12 10:16:51 +02:00
Gina Häußge ddb88ea737 👷‍♂️ Add docs build trigger
We are switching docs.octoprint.org over to Github Actions, build
in a separate repository at OctoPrint/docs.octoprint.org
2020-06-11 16:14:11 +02:00
Gina Häußge 31e98b8949 ✨ SWU: Update capability for single file plugins
Also added a bunch of new version checks for that usecase.
2020-06-10 19:44:55 +02:00
Gina Häußge 37526800c1 ♻ Move download_file into octoprint.util.net
We can use it elsewhere.
2020-06-10 15:16:00 +02:00
Gina Häußge eef51b1cb9 🐛 Mark all bundled plugins py3 compatible
That somehow got forgotten. Wasn't needed since bundled always get
loaded, however now that we display that kind of information in the
plugin manager it should reflect reality.
2020-06-10 15:02:46 +02:00
Gina Häußge 8e662fea9e ✨ PMGR: single file validation & install from upload 2020-06-10 14:38:27 +02:00
Gina Häußge 4c73774104 💚 Fix flake8 2020-06-09 19:05:28 +02:00
Gina Häußge b675ec6137 ✨ PMGR: allow installing single file plugins
Only throw URL for now though.
2020-06-09 18:53:01 +02:00
Gina Häußge 0c5a458759 🐛 Fix first run wizard
Got broken during introduction of DNS check
2020-06-09 16:30:14 +02:00
Gina Häußge ff47314d76 ♻ Return from connect if already connected 2020-06-09 16:01:54 +02:00
Gina Häußge 86d442a1e3 Merge branch 'master' into maintenance
# Conflicts:
#	setup.py
2020-06-08 15:30:48 +02:00
Gina Häußge a819b5d2ca 💚 Fix docs build, part 2 2020-06-08 15:21:52 +02:00
Gina Häußge 379c969a9f 💚 Fix docs build
A bundled sphinx extension (silently) broken and caused build issues.

We now require Python 3 to build the docs.
2020-06-08 15:16:08 +02:00
Gina Häußge c3d2b31232 💚 ignore vendored sources in flake8 run 2020-06-05 18:05:14 +02:00
Gina Häußge a909be7f49 Merge remote-tracking branch 'origin/maintenance' into maintenance 2020-06-05 17:53:07 +02:00
Gina Häußge 207da9cda1 🐛 Vendor bundle awesome-slugify
Otherwise there's a namespace clash with python-slugify which now is
required by cookiecutter.
2020-06-05 17:51:53 +02:00
Gina Häußge 23f2b6c7d0 🐛 Fix fallback transports in sockjs-tornado
Also port some fixes from upstream and future proof by removing
usage of deprecated functionality.
2020-06-05 17:38:52 +02:00
Gina Häußge 6fc415bb67 🔧 Fix editor config for bundled sockjs-tornado sources 2020-06-05 17:02:30 +02:00
Gina Häußge e4f8448d26 Merge pull request #3575 from eyal0/patch-4
Add single quotes around pip install command
2020-06-05 13:18:06 +02:00
Gina Häußge 72ebf6f4c4 Merge branch 'improve/port_detection_refactoring' into maintenance 2020-06-05 12:34:34 +02:00
Gina Häußge 5cbba2b2b7 ✨ virtual printer: fake port/baudrate properties 2020-06-05 12:28:21 +02:00
Gina Häußge eb3d73bcf3 ✨ better auto detect logging 2020-06-05 10:53:39 +02:00
Gina Häußge 12cca448c7 Merge pull request #3590 from osubuu/relative-extrusion
Add M83 and M82 commands to support firmware that decouple XYZ from E relatives
2020-06-04 22:40:38 +02:00
Gina Häußge a4d6e24dad ♻ Isolate virtual printer fully into plugin 2020-06-04 19:02:25 +02:00
Gina Häußge 2206b84f3e ✨ Add hook to extend serial port names 2020-06-04 18:58:09 +02:00
Gina Häußge 488a75737c ✨ Add port/baudrate blacklisting
Allows to blacklist port patterns and individual baudrates so they don't
get offered by OctoPrint to connect to and/or used in auto detection.
2020-06-04 17:17:58 +02:00
Gina Häußge 2570b296ca ♻️ Rewrite port/baudrate detection
Now they no longer are separate processes but one merged one.

Port detection now will only test the two most common baudrates plus
any additionally configured ones if there is more than one port to test,
that way the additional overhead of having to cycle through both port
and baudrate should be greatly reduced.

As a consequence all avr_isp references have been finally removed.

Closes #3394
2020-06-04 15:45:00 +02:00
Gina Häußge a2c38dbc12 Merge branch 'pr/3579' into maintenance 2020-06-04 10:44:08 +02:00
Gina Häußge fb43bc0e25 🐛 Fix another Py3 bug 2020-06-04 10:31:28 +02:00
Gina Häußge 839dc3e07f 🐛 Fix templates after jinja upgrade
Current Jinja versions no longer allow modifying variables set outside
of for loops inside them. So something like:

  {% set mark_active = True %}
  {% for item in items %}
      # do something
      {% if mark_active %}
          # do something more
          {% set mark_active = False %}
      {% endif %}
  {% endfor %}

no longer works - mark_active will be reset on every iteration of the
loop to its initial value False. The fix is to use namespaces to
hold the modifiable values instead:

  {% set ns = namespace(mark_active = True) %}
  {% for item in items %}
      # do something
      {% if ns.mark_active %}
          # do something more
          {% set ns.mark_active = False %}
      {% endif %}
  {% endfor %}

See also #1697 and
https://jinja.palletsprojects.com/en/2.11.x/templates/#assignments

The Jinja dependency upgrade thus introduces a breaking change for
plugins as well. However, it was necessary for security reasons: older
versions have a bug that could allow template authors to break out of
the template sandbox. Not a huge risk in the context of OctoPrint
(plugins already have a lot more power than jinja would give them),
but still overdue to fix.
2020-06-04 10:31:15 +02:00
Gina Häußge 2bbe566f72 🐛 Fix login initialization
Got broken by the flask-login upgrade in f88b5e8
2020-06-04 10:02:59 +02:00
Gina Häußge 23a4a581a5 Merge branch 'master' into maintenance 2020-06-03 18:43:09 +02:00
Gina Häußge 80f94946e3 Revert "➕➖ Switch from awesome-slugify to python-slugify"
This reverts commit 73fbd15b

The change causes a full rescan for renaming on the uploads folder.
Unintended, needs to be looked at closer at a later date.
2020-06-03 18:42:48 +02:00
Gina Häußge 42943050fe 👷‍♂️ Different approach to be dependabot compatible 2020-06-03 17:51:53 +02:00
Gina Häußge dac60a6783 Revert "👷‍♂️ Make setup.py parseable by dependabot"
This reverts commit 1a37f020
2020-06-03 17:44:05 +02:00
Gina Häußge 1a37f0209c 👷‍♂️ Make setup.py parseable by dependabot
Hopefully at least...
2020-06-03 17:24:16 +02:00
Gina Häußge db46b4fb6f 💚 Markdown 3.2* needs py3 2020-06-03 15:27:56 +02:00
Gina Häußge 2b527f333f ➖ Remove tox 2020-06-03 15:17:21 +02:00
Gina Häußge 73fbd15bca ➕➖ Switch from awesome-slugify to python-slugify 2020-06-03 15:13:00 +02:00
Gina Häußge f88b5e8142 ⬆️ Upgrade dependencies 2020-06-03 14:49:53 +02:00
Gina Häußge a934075407 👷‍♂️ Reduce locking runs to once per day
Now that we've processed our backlog, once per day totally suffices.
2020-06-01 15:35:14 +02:00
Khoi 2e5d97e99c Send M83 and M82 in extrusion commands to support firmware that decoupled XYZ from E relatives 2020-05-29 16:34:44 -04:00
Gina Häußge 499b9130dd 💚 Ignore flake8 F523 for now
We didn't change any code between the last working build and the current
state since this is the master branch, so stop complaining. We'll
fix this in maintenance/1.4.1 in one way or the other.
2020-05-28 21:41:29 +02:00
Gina Häußge fd640c6962 👷‍♂️ Don't comment on locking, too spammy
At least not while processing the backlog.
2020-05-28 21:30:34 +02:00
Gina Häußge 1eb022e42b 👷‍♂️ Trigger cron at 5min after every hour 2020-05-28 21:02:09 +02:00
Gina Häußge 6751d683f3 👷‍♂️ Action to lock outdated issues & PRs
Anything that's been closed for over a year definitely is outdated.
We really don't want people to play necromancer on ancient tickets,
it just causes support overhead (having to explain that code has
changed a ton since then and issue is likely a different one) or
user frustration (no reply).
2020-05-28 20:59:35 +02:00
Shawn Bruce 1f5391fc2c Fix issue introduced by 9e3cf58bc9 which prevents _api user from connecting to SockJS. 2020-05-26 16:40:32 -04:00
Eyal 5533263e91 Add single quotes around pip install command
zsh reqiures this and it shouldn't affect other shells
2020-05-25 21:02:32 -06:00
Gina Häußge 65a66b11eb ✨ pgmr: include recent installs in repo browser
Also allow sorting by it.
2020-05-20 20:05:37 +02:00
Gina Häußge 052f81275b 🚸 pgmr: Dedicated error message on general failure
If we can't load stuff from the backend, don't get stuck in "pip not
available" mode (which confuses people terribly) but instead show a
dedicated error.
2020-05-19 17:50:40 +02:00
Gina Häußge e0a5751d9f 💄 pgmr: Slight restyling of repository browser
Make sure icons don't get separated from their text and reduce
amount of unused space.
2020-05-19 17:36:24 +02:00
Gina Häußge 8a18963a72 ✨ pgmr: Add sort by plugin popularity
Uses data from the anonymous usage tracking pulled from the repo.
2020-05-19 17:34:57 +02:00
Gina Häußge 12d674882a 🚸 Only unset feed/flow rate after request completion 2020-05-15 19:10:37 +02:00
Gina Häußge b0d3c4a512 🚸 Reflect on UI that feed/flow rate are ephemeral
We can't query the setting from the firmware, and we also can't reliably
track it through OctoPrint as it could be modified through GCODE
triggered through a file on the SD card and/or interactions with the
controller. Hence we now properly reflect that this value is write only
by emptying it 5s after focus loss (with a little opacity pulse to warn
about that) and immediately on sending.

That should hopefully make it a bit clearer that this value cannot be
trusted and will never reflect the firmware value unless query commands
or status reports are added for that in firmware.

Closes #3569 (though in a different way than intended by OP)
2020-05-15 17:32:15 +02:00
Gina Häußge 97483bc0cb Merge branch 'pr/3411' into maintenance 2020-05-15 14:46:07 +02:00
Gina Häußge 92cfa98d88 💚 Remove unused format and make flake happy 2020-05-15 14:13:30 +02:00
Gina Häußge 6d501c84c5 ♻ Cancel socket connect timeout before viewmodel trigger
Possible solution for #3502
2020-05-15 14:10:42 +02:00
Gina Häußge 58a6649157 Revert "☂ Increase sockjsConnectTimeout to 60s"
This reverts commit 3387b220
2020-05-15 14:09:35 +02:00
Gina Häußge 3387b22040 ☂ Increase sockjsConnectTimeout to 60s
Should reduce likelihood of running into #3502
2020-05-15 13:29:16 +02:00
Gina Häußge 52d3b9cf13 Merge branch 'pr/3567' into maintenance 2020-05-15 13:25:36 +02:00
Gina Häußge b763c0516d Merge branch 'pr/3566' into maintenance 2020-05-15 13:13:50 +02:00
Gina Häußge f4ba30b4ce 🐛 swu: really delete check_providers
As mentioned in #3566
2020-05-15 13:08:27 +02:00
Gina Häußge 6367ab8bf9 ✨ pgmr: Display installation stats from repo
Based on tracking data, coming full circle here.
2020-05-14 00:18:40 +02:00
Shawn Bruce d99d2581aa Workaround for #2166 is no longer required as of Firefox 57.0.2 2020-05-12 22:48:17 -04:00
Shawn Bruce 1d2e82644c Use global_remove instead of global_set in octoprint.plugins.pluginmanager._cleanup_settings.
SeenWizards plugin data should be removed during cleanup.
2020-05-12 15:46:35 -04:00
Gina Häußge 4d8a6faac3 Merge pull request #3557 from fieldOfView/feature_recursive_watched_folder
Add support for subfolders in the watched folder list
2020-05-12 13:09:10 +02:00
Gina Häußge 3fd88b4f13 👷‍♂️ Switch to public discord for CI notification 2020-05-08 15:28:35 +02:00
fieldOfView 2baea4e5de Add support for subfolders in the watched folder list
Contributes to https://github.com/OctoPrint/OctoPrint/issues/2451
2020-05-07 07:39:41 -07:00
Gina Häußge d71b8e9e82 💬 Update README
Added Discord link & updated installation instructions
2020-05-07 13:39:23 +02:00
Gina Häußge 2bd29a7cb2 👷 Fix indentation 2020-05-06 17:57:19 +02:00
Gina Häußge 5c1271a56e 👷 Add discord notification 2020-05-06 17:51:42 +02:00
Gina Häußge bbbebe35fd 👷 Limit to master branch 2020-05-06 16:23:36 +02:00
Gina Häußge 3e777dd43c 👷 Only install basic app 2020-05-06 16:22:49 +02:00
Gina Häußge f862473969 👷 Github action to regularly install under py2
We want to know when the installation starts to fail
2020-05-06 16:19:19 +02:00
Gina Häußge f016bb1e0c 📝 Reworded code comment 2020-05-06 15:50:59 +02:00
Gina Häußge 85de9d5f45 Merge branch 'pr/3555' into maintenance 2020-05-06 15:49:52 +02:00
Gina Häußge ed1b02dcb2 Merge branch 'pr/3553' into maintenance 2020-05-06 15:42:52 +02:00
Gina Häußge 4ba94c3ce9 📝 Fix code comment
In the hopes that #2585 will not rear its ugly head again we update
to the last Tornado version we can use with Py2 and 3.
2020-05-06 15:38:35 +02:00
Gina Häußge 679713f169 Merge branch 'maintenance' into pr/3551 2020-05-06 15:33:43 +02:00
Gina Häußge 1b66edcb2e ☂ Remove file version for users file again
It's causing issues on rollback (integer can't be accessed like a dict).
We don't actually need it at the moment, so remove it for now and
instead add some sanity checking to the file reader.
2020-05-06 15:13:51 +02:00
Gina Häußge 9e3cf58bc9 🐛 Better session validation
Removed side effects for login behaviour after server restart
2020-05-06 13:06:54 +02:00
Gina Häußge 84e6ea99f3 Merge branch 'fix/3554' into maintenance 2020-05-06 11:57:37 +02:00
Gina Häußge 2281b6e8e9 ☂ Versioning for group/user storage incl migration
Also use version info to restore standard "default" setting for default
groups nuked by #3554
2020-05-06 11:42:19 +02:00
Gina Häußge 90b94c265d 🐛 Fix edited group being sent incompletely to API
Closes #3554
2020-05-06 11:22:54 +02:00
lachyc e62d50eb21 Update AUTHORS.md 2020-05-06 12:57:00 +10:00
lachyc 4ddaf350b4 Update setup.py
Markupsafe 2.0 install currently fails, Jinja require >= 1.1
2020-05-06 12:54:32 +10:00
Gina Häußge 8330a1d05f 🐛 Fix readonly group behaviour
User group is no longer enforced on all users. It is pre-checked
for new users (unless made non default) but can be disabled. That
makes it possible to have users without groups (and thus no
permissions) so beware!

TODO: Issue with default=False being written to groups.yaml,
causing the users group to not be enabled by default. Will be
solved in another commit.

Closes #3547
2020-05-05 19:01:10 +02:00
Shawn Bruce 3bc4ae14cc Fix issue where _simulateTemps may never reach target temp but instead be stuck within 0.5C(delta) 2020-05-05 12:24:05 -04:00
Gina Häußge 51f5ff4193 🐛 Fix user lookup 2020-05-05 10:01:14 +02:00
Shawn Bruce 8bae5ace0f Update Tornado to 5.1.1
Use tornado.gen.coroutine as tornado.web.asynchronous is now deprecated
tornado.ioloop.PeriodicCallback no longer supports the io_loop argument.
tornado.httputil.HTTPServerRequest.supports_http_1_1 is now depricated use tornado.httputil.HTTPServerRequest.version attribute instead
2020-05-01 13:03:23 -04:00
David Rifkind 553f8ce28f Show retracts, moves, and head position only for current layer 2020-04-30 10:26:32 -07:00
Gina Häußge fb8ef4e7fa ☂ Recommend the use of appkeys over the global key 2020-04-28 15:14:44 +02:00
Gina Häußge 15f5873cc2 ✨ appkeys: support manual generation in settings
Also add a detail view for individual keys, also shown after
generation of a new key.
2020-04-28 15:14:10 +02:00
Gina Häußge ef3c8bb6c2 👷 Remove workflows again, don't work like that
Needs more testing on a testing repo...
2020-04-27 15:40:32 +02:00
Gina Häußge 87b20ddfe9 👷 Access name attribute on label 2020-04-27 15:26:52 +02:00
Gina Häußge 7bd781e7d2 👷 Fix string formatting 2020-04-27 15:22:36 +02:00
Gina Häußge fa2153f3e3 👷 Fix variable name 2020-04-27 15:19:54 +02:00
Gina Häußge c766e99743 👷 First throw at project automation through labels 2020-04-27 15:12:03 +02:00
Gina Häußge d97fdb5ce8 🐛 Persist file list style in local storage
It's not a regular sorting option, so it so far got skipped.

See https://community.octoprint.org/t/file-list-sort-by-defaults/18938
2020-04-27 15:01:41 +02:00
Gina Häußge a96167729c 🚸 Link to default cancel GCODE script
People tend to delete it, then run into issues, and then don't know
where to find the defaults anymore.
2020-04-27 10:23:03 +02:00
Gina Häußge 52f990b9cb Merge branch 'master' into maintenance 2020-04-24 19:05:45 +02:00
Gina Häußge 403b638eb6 📝 Fix an error in the docs 2020-04-24 19:05:08 +02:00
Gina Häußge 0a889dc7e6 🐛 Fix permissions on /api/status
Now requires the STATUS permission.

Fixes #3492
2020-04-24 18:21:25 +02:00
Gina Häußge 81e1ad2ee7 🐛 Only use supplied analysis if it's complete
We might not get the full set of data we want from the add_file
call and thus need to enrich the data further with our own
analysis results.

Whatever we get supplied from the caller will always win.
2020-04-24 18:11:23 +02:00
Gina Häußge 6aa2fc51f9 💬 Update German translation 2020-04-24 11:40:16 +02:00
Gina Häußge 127bd37e29 🐛 Fix babel.cfg
* Run with silent=false to catch issues in templates, such as missing
    extensions
  * Add missing extensions to fix compile errors
  * Fix formatting (can't apply settings to multiple headers, need to
    reapply, ini format!)
2020-04-24 11:33:52 +02:00
Gina Häußge e3d360a51a 🙈 Add doc build dir to .gitignore 2020-04-24 11:33:52 +02:00
Gina Häußge 45aff52c81 Merge pull request #3534 from flaviut/add-request-profiling
Add request profiling
2020-04-24 10:25:57 +02:00
Flaviu Tamas 65b960f0f0 Add request profiling code
To profile a given request, just add ?perfprofile to the url. Instead of
returning the actual results, an HTML presentation of the profiling
results is returned.

This is only enabled when debug mode is enabled.
2020-04-23 19:16:48 -04:00
Gina Häußge 1c371a24fb ⏪ Revert "🐛 Use raw strings for regex patterns"
This reverts commit bec4d04c
2020-04-21 15:55:44 +02:00
Gina Häußge 2d8904e2cf 💬 Action Command Prompt -> Printer Dialogs in settings 2020-04-21 15:33:52 +02:00
Gina Häußge 5b92be5889 ✨ New bundled plugin action_command_notification
Implements support for //action:notification messages from the printer.
2020-04-21 15:31:08 +02:00
Gina Häußge bec4d04c15 🐛 Use raw strings for regex patterns 2020-04-20 21:23:52 +02:00
Gina Häußge a871766175 Merge branch 'master' into maintenance 2020-04-20 21:19:15 +02:00
Gina Häußge 97a82c0cc1 📝 Fix docs of some modules 2020-04-20 21:19:00 +02:00
Gina Häußge 5cb7fa4dc9 💚 Fix unit test 2020-04-20 21:18:05 +02:00
Gina Häußge e6336c62ab ☂ Drop file descriptors on all subprocesses
At least if possible (close_fds + stdout/stderr redirection is not
supported on win32 in Python <= 3.7).

Closes #3378
2020-04-20 21:05:57 +02:00
Gina Häußge 582c3739e7 Merge pull request #3526 from joshfriend/systemd-lang-env
Set LC_ALL and LANG when starting octoprint
2020-04-20 18:24:03 +02:00
Gina Häußge 258250131f ✨ Allow disabling of tool sanity check
Should work around rare cases where the firmware reports invalid
tools that aren't invalid. Should usually not be needed, but there
are enough people with broken configs out there that this might
actually help people to stay running, as meh as it is.
2020-04-20 16:52:29 +02:00
Gina Häußge 2cb8b03f7b 🐛 Return 409 on select command if print is ongoing
Closes #3525
2020-04-20 13:39:58 +02:00
Josh Friend fedbbdf3fb Set LC_ALL and LANG when starting octoprint
Fixes errors from Click about ASCII encoding:

    RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment
    This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the follow
        export LC_ALL=C.UTF-8
        export LANG=C.UTF-8
2020-04-18 19:12:43 -04:00
Gina Häußge aab012d530 ✨ Also test if DNS works in connectivity check
Should hopefully unearth cases where the system has a connection to the
internet but name resolution is broken in some way.

We default to resolving octoprint.org.
2020-04-17 14:21:12 +02:00
Gina Häußge b930fb0edb 🐛 Fix origin check in tornado.websocket
It was not comparing scheme (which it should), it was doing the hostname
check case sensitively (which it shouldn't) and it didn't take into
account default ports.

Should close #3519
2020-04-16 18:04:34 +02:00
Gina Häußge 8fd3ec6d6a 👷 Add title tag to request template 2020-04-15 17:44:37 +02:00
Gina Häußge d215715b52 👷 Slight rewording of issue link 2020-04-15 17:12:52 +02:00
Gina Häußge 2519c764c3 🐛 Fix location 2020-04-15 17:06:31 +02:00
Gina Häußge dcd0a8499e 👷 Issue form configuration 2020-04-15 17:04:52 +02:00
Gina Häußge 09823115af 💚 Fix unit tests 2020-04-15 15:44:42 +02:00
Gina Häußge 6b379fbef3 ✨ Make rjsmin use configurable again 2020-04-15 14:12:23 +02:00
Gina Häußge 00a5243ec9 ✨ config flag to configure SameSite and Secure cookie headers
Provides one part of the solution to #3482. The other part is sadly
on the shoulders of the user, who needs to setup either a whole domain
hierarchy to not run into "third party page" issues that would trigger
SameSite=Lax blocking, or needs to reconfigure their setup to use
https and make sure to set Secure to true.

Closes #3482 (there's nothing else I can do here)
2020-04-15 13:27:56 +02:00
Gina Häußge 2bed65d819 🐛 Fix woff/woff2 preload URLs 2020-04-14 16:12:35 +02:00
Gina Häußge ae16dcc16a ♻ Warn if we should use .gz asset but can't
Don't silently fail. Should rarely happen anyhow but would indicate
issue with install or setup.

As noted by @flaviut in comment on fde070665d
2020-04-14 15:40:23 +02:00
Gina Häußge d513459c63 Merge branch 'pr/3517' into maintenance 2020-04-14 14:34:50 +02:00
Gina Häußge 63e915c8cc 📝 docs: Update install OctoPi instructions 2020-04-14 14:34:29 +02:00
Gina Häußge bd2a72d178 📝 docs: Minor changes for version specific imports
Also fixed a section that got misplaced by the PR.
2020-04-14 14:33:42 +02:00
Gina Häußge a55eeaf794 Merge branch 'pr/3516' into maintenance 2020-04-14 13:25:52 +02:00
Gina Häußge e366bbb588 📝 docs: update devenv setup 2020-04-14 13:25:15 +02:00
Gina Häußge 31161e7a08 📝 docs: minor fixes in octoprint.util 2020-04-14 13:15:40 +02:00
Gina Häußge e6b747aef5 📝 docs: link to python docs for encoding & errors parameters
We don't want to try to duplicate python docs, let's use what already
exists and just make it easier to find.
2020-04-14 13:06:24 +02:00
Gina Häußge c5759e3349 Merge remote-tracking branch 'origin/maintenance' into maintenance 2020-04-13 18:44:26 +02:00
OllisGit 2fc094a563 Changed doc for html-generation 2020-04-12 11:43:06 +02:00
OllisGit 99efba4fc3 Update python3_migration.rst
Added "Explicit imports" description
2020-04-12 11:31:14 +02:00
OllisGit 43fe5cd8be Update __init__.py
Copied the description about errors-argument from Pyh-Doc (https://docs.python.org/3/howto/unicode.html).
Im not sure how to create the HTML-Doc out of this file. So, I could not test the doc-output.
2020-04-12 11:11:22 +02:00
Gina Häußge 2b603b6f60 Merge pull request #3514 from matsahm/patch-1
Update messages.po
2020-04-11 11:45:08 +02:00
matsahm 26feb27b83 Update messages.po
Alle Farben außer weiß sind großgeschrieben. Habe weiß angepasst.
2020-04-10 22:55:30 +02:00
Gina Häußge 45b9fcefd2 🐛 Fix gzip encoding under Python 2
gzip.compress doesn't exist in Py2, replace with gzip.open.

Introduced by #3497
2020-04-07 19:18:19 +02:00
Gina Häußge 5ad06bc602 🐛 Remove zero length .gz in case of error
Otherwise the page won't load at all because the js/css/less files are
taken from the gz versions which are empty.

Introduced by #3497

TODO: Fix gzip encoding under Python 2 (gzip.compress doesn't exist)
2020-04-07 19:11:23 +02:00
Gina Häußge 40a0913fa4 🐛 Fix visibility of unformatted site during preload
Introduced by #3497
2020-04-07 18:55:03 +02:00
Gina Häußge f66421c1a8 🐛 Fix template variable name 2020-04-07 18:53:41 +02:00
Gina Häußge ff09cd0e54 🐛 Fix ordering of replacement tabs
Order definition might contain either the plugin identifier or the
identifier of the component it replaces. Take that into account when
resolving order mapping.

Closes #3403
2020-04-07 18:26:54 +02:00
Gina Häußge 810ee2f6d0 Merge branch 'pr/3503' into maintenance
# Conflicts:
#	AUTHORS.md
2020-04-07 15:34:56 +02:00
Gina Häußge 09b07274ab ✨ Remove feed/flow rate upper limits altogether
Gets rid of sliders as well (since those don't work without an upper
limit) and adds a note to both that they are "write-only" as we don't
have a way to query the current values from the firmware (yay...).

Modifies #3503

Also fixes a bug in #3503, which only adjusted the client side
boundaries but forgot about the server side.
2020-04-07 15:33:55 +02:00
Gina Häußge 8604b5c105 Merge branch 'maintenance' into pr/3497 2020-04-07 12:45:30 +02:00
Gina Häußge fde070665d ♻ Minor refactoring/fixing prior to merge of #3497
* url_for in preload instead of (potentially wrong due to prefixes)
    absolute URLs to /static/...
  * error resilience in case of any issues during .gz generation
  * bug fix in mime type detection
  * code formatting & naming here and there
2020-04-07 12:45:25 +02:00
Gina Häußge ebe2c53de7 🐛 Make sockjs connection timeout configurable
Used to default to 5s, now set by default to 10s, can be completely
disabled by settings devel.sockJsConnectTimeout to 0.

Might be a possible solution for #3502.
2020-04-07 11:58:32 +02:00
Gina Häußge 3fccee1bc2 ♻ Minor refactoring 2020-04-06 19:17:26 +02:00
kerber 0a658e1b2e Restoring from backup preserves original file datestamps. 2020-04-06 19:17:26 +02:00
Mike Ryan 02ec6c5a47 Memoize settings hashes to speed up cache refresh
Memoize `settings.config_hash` and `settings.effective_hash`. The
hashes will only be calculated on the first call to the respective
functions. These memoized values are invalidated when the settings
object becomes dirty, or the settings are loaded from the config file.

Reason for change: During a refresh of the root route (/), the hash of
`settings.effective.yaml` is calculated 5 times. Each call lead to a
large configuration object to be serialized to a YAML string, which would
then be hashed. As it turns out, serializing to YAML is expensive.

Note: while I do not see `settings.config_hash` hit during a refresh,
but making a change to it was easy and appropriate. It's possible that
other areas of the application may see some benefit.

Performance (on my 2016 Macbook Pro:
- building of initial cache on startup:
  - before: ~3.4s
  - after:  ~2.9s
- loading `http://octoprint/?_refresh=1`
  - before: ~1100ms
  - after:  ~200ms
2020-04-06 19:01:34 +02:00
Mike Ryan 01574aadfe Improve performance of etag calculation for /
- Only compute etag once (rather than twice) per request.
- Only stat files once per request.
  - Avoid calling `isdir` or `isfile` in `collect_files`.
  - Leave it to `compute_lastmodified` to stat files, which tells us if
  the path exists, if it is a file, and it's last modified.
  - Reduces the number of stat systemcalls by 50%.
2020-04-06 19:01:34 +02:00
Gina Häußge 93f78efed4 📝 Update docs 2020-04-06 18:41:05 +02:00
Gina Häußge 7c66f51395 Merge branch 'pr/3506' into maintenance 2020-04-06 16:39:38 +02:00
Gina Häußge 46d4a73955 ♻ minor refactorings
* validate custom identifiers for as_dict method
  * minor performance improvement
2020-04-06 16:39:28 +02:00
Gina Häußge c4c4d055ea ✨ Add auto detection for UM2 for sd print detection
See also #3479
2020-04-03 18:38:54 +02:00
Gina Häußge 8ee6b9fdf1 ✨ Add setting to disable SD print detection
Some firmware variants (Ultimaker 2/2+, maybe others) send a file
selected message while just scrolling through the SD file list on the
integrated controller unit. M27 polling right after file selection might
cause issues for them. This patch allows to work around that.

Closes #3479

See also #1407
2020-04-03 18:24:54 +02:00
Gina Häußge 0da0e6cf8b ✨ pmgr: Add Python version to plugin list 2020-04-03 16:59:12 +02:00
jneilliii 79cd98d467 Added modifications to allow for the injection of additional temperature data. 2020-04-03 09:34:11 -04:00
Gina Häußge 7767c16916 Merge pull request #3494 from tedder/ted/3493/nonecheck
fix NoneType comparison error, closes #3493
2020-04-03 15:12:27 +02:00
Gina Häußge 014d32b83b 💬 foosel/OctoPrint => OctoPrint/OctoPrint
Also fixed some links while at it.
2020-04-03 15:00:53 +02:00
Gina Häußge ee70e9d546 🚸 Include Python version in footer
As suggested in https://community.octoprint.org/t/17819
2020-04-02 18:03:53 +02:00
Gina Häußge 2cc0e91c38 🐛 announcements: Fix wrong permission name 2020-04-02 17:53:47 +02:00
Tobias Schürg 596a01ab30 Update documentation for factor. 2020-04-01 23:06:16 +02:00
Tobias Schürg 0861e6f176 Add Tobias Schürg to AUTHORS.md
... as requested in PR checklist.
2020-04-01 23:00:53 +02:00
Tobias Schürg 3dfbad68c9 Allow feedrate between 25 and 300 percent.
Allow feedrate slider to move between 25 and 300 percent.
2020-04-01 22:46:07 +02:00
Gina Häußge f99ba720a8 ♻ backup: remove code repetition 2020-04-01 19:24:45 +02:00
Gina Häußge 7e4c29befb ✨ backup: Add first run wizard
Bypasses permissions in first run mode, allows
to restore existing backup.

Closes #3496
2020-04-01 18:58:39 +02:00
Gina Häußge ef7a247df3 Merge remote-tracking branch 'kantlivelong/restore_wizard_poc' into improve/firstrun_restore 2020-04-01 16:11:00 +02:00
Shawn Bruce b63eec3e91 restore from backup wizard proof of concept 2020-03-30 22:43:09 -04:00
Gina Häußge 5596daf346 📝 foosel/OctoPrint -> OctoPrint/OctoPrint
The github repository has moved to the organization, update README accordingly.
2020-03-30 15:41:26 +02:00
Flaviu Tamas 99072cd63d Bump modernizer version & remove extra tests
It's 2020, and that version was from 2013. Lots of stuff changes in that
time.

Also, get rid of some tests that are now universally supported, as well
as tests that are enabled and never used

This also signficantly improves performance, since the new version is
much simpler.
2020-03-29 09:47:10 -04:00
Flaviu Tamas eec9a5c6e9 Strip whitespace from JS bundle 2020-03-29 09:47:10 -04:00
Flaviu Tamas 669668a134 Include less.js in javascript library bundle 2020-03-29 09:47:10 -04:00
Flaviu Tamas 698c13b2f1 Preload js & css 2020-03-29 09:47:10 -04:00
Flaviu Tamas 00057e997d Use minified jq & sockjs 2020-03-29 09:47:10 -04:00
Flaviu Tamas 851539cc6f Pre-compress static assets
This compresses the static assets with gzip on server startup, and then
serves them up compressed to clients.

The compression is done at server startup because some boards have very
anemic CPUs and slow "disks", so loading from disk pre-compressed and
avoiding CPU usage is a big win.
2020-03-29 09:47:10 -04:00
Gina Häußge 761a0fdb61 ♻ Extract printer safety warning into dependency
Renamed to firmware check, published to PyPI, on a different release
cycle and version number scheme than core OctoPrint but still considered
bundled via a new mechanism to mark external plugins as such.

This will speed up deployment of new firmware checks in case of new
printers with disabled thermal runaway protection, or stuff like the CBD
firmware.
2020-03-27 15:42:06 +01:00
ted 85ce90ca52 fix NoneType comparison error, closes #3493 2020-03-26 12:03:12 -07:00
Gina Häußge 8a01d89049 ✨ Detect ZWLF variant of CBD firmware 2020-03-25 16:03:42 +01:00
Gina Häußge 610a7ed8a8 ✨ printer_safety_warning: Detect broken cbd firmware 2020-03-24 17:05:02 +01:00
Gina Häußge 27bbab9582 🐛 Don't mess with EOL style of GCODE files
Fixes issue with lag in progress reporting on files that have CRLF EOLs.

See also https://community.octoprint.org/t/curious-issue-with-print-progress/16304/
2020-03-23 16:04:33 +01:00
Gina Häußge 05cbe89d87 🚸 Keep load&print button active if file's already loaded
For some reason people just don't seem to see the big fat blue "Print"
button on their loaded print job and then get confused when they can't
reprint the same file that's already loaded. So let's work around this.
2020-03-19 16:45:02 +01:00
Gina Häußge 9781d5c1ff 🚸 Rewording of buttons in cancel confirmation
Closes #3471
2020-03-05 15:41:30 +01:00
Gina Häußge 86751249be Merge branch 'master' into maintenance 2020-03-04 13:01:53 +01:00
Gina Häußge 5b795014e2 Merge branch 'master' into staging/maintenance 2020-03-04 13:01:15 +01:00
Gina Häußge 6232a04e52 🔖 Preparing release of 1.4.0
OMG OMG
2020-03-03 16:28:51 +01:00
Gina Häußge edfa786514 🐛 self._user might not be a SessionUser
If the socket is already logged out it will be an AnonymousUser
and thus not a SessionUser.

We shouldn't actually be pushing this without a round over an RC but
frankly I don't want to postpone the release for two weeks (as next week
is kinda busy) just to solve this obvious issue with zero side effects.

So here I am doing things I shouldn't.
2020-03-03 16:28:10 +01:00
Gina Häußge 504137d249 Merge branch 'rc/maintenance' into staging/maintenance 2020-03-03 12:37:34 +01:00
Gina Häußge b818042fc5 📝 More work on the Py3 migration guide 2020-03-03 12:37:22 +01:00
Gina Häußge c37f83c6c3 ♻ tracking: Send environment with pong
Gets us more up to date stats regarding used hardware than on the
startup event.
2020-03-02 15:53:46 +01:00
Gina Häußge fe7894fb5f Merge branch 'rc/maintenance' into staging/maintenance 2020-03-02 13:46:29 +01:00
Gina Häußge f57afca557 📝 Add example to iterator point 2020-03-02 13:45:37 +01:00
Gina Häußge 38e8878ded Merge branch 'rc/maintenance' into staging/maintenance 2020-03-02 13:08:45 +01:00
Gina Häußge 230740708b 📝 Guide on migrating plugins to Python 3 2020-03-02 12:51:49 +01:00
Gina Häußge 0c3b0b8a40 Merge branch 'staging/maintenance' into maintenance 2020-02-26 15:31:34 +01:00
Gina Häußge cf560a47d5 🔖 staging/maintenance is now 1.4.0rc7.dev 2020-02-26 15:31:03 +01:00
Gina Häußge d99af420ac 🐛 loginui: fix reload not triggering right after first run setup 2020-02-26 12:01:24 +01:00
Gina Häußge 73c2baa39e 🔖 Preparing release of 1.4.0rc6 2020-02-26 10:08:34 +01:00
Gina Häußge 054df68741 📝 Fix year 2020-02-26 09:13:44 +01:00
Gina Häußge f7756698e9 🐛 Don't protect blueprints before first run setup 2020-02-25 17:03:51 +01:00
Gina Häußge 453ef0cb97 ♻ Remove implicit blueprint protection in favour of explicit one 2020-02-25 17:03:29 +01:00
Gina Häußge 5015422086 🐛 py3 list vs iterator 2020-02-25 15:48:01 +01:00
Gina Häußge 2d85d8acf8 ♻ is_(anonymous|active)() => is_(anonymous|active) 2020-02-25 15:41:38 +01:00
Gina Häußge 2af589a823 ♻ Remove remnants of old login ui 2020-02-25 15:37:51 +01:00
Gina Häußge 20c55f4d3d 🐛 Fix missing protection for blueprint plugins
is_blueprint_protected should mean a requirement of a logged in non
anonymous user. Implemented accordingly. Got forgotten during switch to
granular permission system.
2020-02-25 15:37:50 +01:00
Gina Häußge b7fdc82d30 🐛 Fix buggy implementation of (before|after)_request hooks 2020-02-25 15:37:48 +01:00
Gina Häußge 770ebf2cf9 📝 Docs for new access control situation 2020-02-25 15:34:17 +01:00
Gina Häußge a75c641c18 ♻ Implement login dialog through UiPlugin
Otherwise alternative UIs might still be wide open, and caching and such
was also really painful to solve before.

The LoginUI Plugin is pretty much just a distilled ForceLogin plugin.

Also declared it as hidden so it won't show up/be manageable by the
plugin manager.
2020-02-25 15:33:42 +01:00
Gina Häußge 38c09153ac ♻ Fix deprecated method names 2020-02-24 14:16:09 +01:00
Gina Häußge e30e18e431 📝 Docs for reauthRequired push message 2020-02-24 12:49:12 +01:00
Gina Häußge 249d19f55b 🐛 Reauth for stale sessions instead of active logout
Fixes #3459
2020-02-24 12:49:04 +01:00
Gina Häußge 2e043ecf5b 📝 Explicitly document LineProcessorStream behaviour under py3
Make absolutely clear that processLine will be called with a byte & not
a unicode string.

See #3454
2020-02-18 15:57:01 +01:00
Gina Häußge 831edf234d 🐛 Fix a firmware info reporting bug
It was not reported if firmware detection was disabled, even though one
should not have anything to do with the other.

Not a regression, but considering that it negatively impacts the printer
safety plugin that relies on firmware info it'll go into 1.4.0
regardless.
2020-02-17 17:34:19 +01:00
Gina Häußge b42c753d3f 🐛 Fix a Py3 bug with the self._printer wrapper in plugins 2020-02-17 17:32:20 +01:00
Gina Häußge e0b09857c4 Merge branch 'staging/maintenance' into maintenance 2020-02-11 14:38:25 +01:00
Gina Häußge 924cd5cb4c 🔖 rc/maintenance is now 1.4.0rc6.dev 2020-02-11 14:37:43 +01:00
Gina Häußge 73f7c4d8a1 🔖 Preparing release of 1.4.0rc5 2020-02-10 17:02:07 +01:00
Gina Häußge 0d035496f5 🐛 Fix caching on /api/files
We were calculating the last modified date for the internal file cache
wrong and that led to returning stale data.

Should fix #3422
2020-02-07 19:28:11 +01:00
Gina Häußge 10079b8d9d 🐛 PGMR: Fix UI representation of incompatible plugins
Second part of fixing #3442
2020-02-04 15:53:56 +01:00
Gina Häußge c31566a626 🐛 Fix incompatible plugins to be marked as compatible
First part of fixing #3442
2020-02-04 15:52:53 +01:00
Gina Häußge 0cfc7a2976 Merge remote-tracking branch 'origin/staging/maintenance' into staging/maintenance 2020-02-04 13:17:11 +01:00
Gina Häußge de5a10163e 🐛 Reintroduce message backlog on socket
Was present in forcelogin and made sure that plugins triggering a
message on the socket immediately after connect would get through right
after auth.

Without this a lot of plugins out there run into issues, so this is a
backwards compatibility fix for a regression in 1.4.x.

See also #3400
2020-02-04 13:15:44 +01:00
Gina Häußge 0a22c4e66c ♻ Fix a duplicated line of code 2020-01-31 14:28:27 +01:00
Gina Häußge a88d95af77 🐛 Fix autologin
We need to actually try to identify the user just like we used to do
with the forcelogin plugin. Just checking permissions will only work
if we already have a session.

Closes #3434
2020-01-29 11:37:07 +01:00
Gina Häußge 010221ab5b 🐛 Fix handling of unset remote addresses 2020-01-29 11:35:56 +01:00
Gina Häußge 6471a04a86 staging/maintenance is now 1.4.0rc5.dev
And maintenance is now 1.4.1.dev
2020-01-28 15:16:19 +01:00
Gina Häußge 7b2762c590 🐛 Remove accidentally commited debug statement 2020-01-27 18:06:02 +01:00
Gina Häußge de0b97b99c 🐛 Fix first run setup 2020-01-27 17:32:52 +01:00
Gina Häußge 60d2bd1ac1 🔖 Preparing release of 1.4.0rc4 2020-01-27 15:51:27 +01:00
Gina Häußge 4d716647e5 🐛 Fix socket connect timeout handling
Was triggering even though it should have been cleared due to a
self vs this issue.

Also protect against undefined connection deferred.
2020-01-27 15:03:18 +01:00
Gina Häußge 43ab47a260 ✨ pi support: Permission check for API endpoint 2020-01-27 13:46:09 +01:00
Gina Häußge 88ecfbdb65 🐛 Fix another py2 vs 3 issue
Closes #3431
2020-01-27 11:58:17 +01:00
Gina Häußge 8087967683 🐛 Fix behaviour when page cached & server down
E.g. in Firefox reopen tab while server is down - FF will use a cached
copy and for some reason sockjs won't notice that stuff is down. So now
we have a timeout of 5s for initial connection that takes care of that.
2020-01-24 16:54:52 +01:00
Gina Häußge cb43197105 🐛 Fix endpoint in docs 2020-01-24 13:08:10 +01:00
Gina Häußge b1b9329614 ♻ Move /api/access/user to /api/currentuser
Update documentation accordingly.

See also #3418
2020-01-24 13:05:06 +01:00
Gina Häußge 7317814ce0 📝 Document needed permissions & fix some stuff 2020-01-23 13:21:52 +01:00
Gina Häußge 66ef7b66bb 📝 Documentation for the access API 2020-01-22 18:39:32 +01:00
Gina Häußge be3ff5f043 ✨ API endpoint to retrieve info about current user
As suggested by @fieldOfView.

Implements #3418
2020-01-22 14:58:29 +01:00
Gina Häußge c36fa6da90 🐛 Fix readonly group permissions
Those were accidentally stripped.
2020-01-22 14:55:35 +01:00
Gina Häußge aadcf650c7 🐛 Fix UI caching again
Was broken by 3f3cb556a7 in between server
restarts due to the wrong stuff being fetched by the preemptive cache.
2020-01-21 17:26:45 +01:00
Gina Häußge 95c3fa0b04 🐛 Readd requires line that somehow got missing
Addendum to 3f3cb556a7

Closes #3425
2020-01-21 16:03:48 +01:00
Gina Häußge 1d0829a1db 🐛 Introduce ClientAuthed event
May act as entry point for any kind of push messages a plugin might
wish to send to the client after a connect happened. Since depending
on the current permission configuration this might only be possible
once the client has authenticated on the socket, this is required.

Should close #3400
2020-01-21 15:53:52 +01:00
Gina Häußge 8d31d6687e 🐛 Also trigger login dialog eval on permission change
Not just on logout.

Follow-up to #3425
2020-01-21 15:00:20 +01:00
Gina Häußge 3f3cb556a7 🐛 Fix guest access to settings
Needed its own permission, which in turn needed some changes in how the
whole "guest without read permission" situation is handled. I've
reintroduced a custom login view since the main UI would not be able
to fully load up without settings access. Said login view will override
the default UI view if the account in question does not have
Permissions.STATUS and also Permissions.SETTINGS_READ. It pretty much is
the forcelogin plugin from 1.3.x.

Closes #3425
2020-01-21 14:49:46 +01:00
Gina Häußge 4460c8bee0 🐛 env needs to be native strings
So, bytes under py2 and unicode under py3.

Closes #3428
2020-01-20 13:36:02 +01:00
Gina Häußge 89b597a656 🐛 Fix remember me checkbox
Closes #3426
2020-01-17 16:34:13 +01:00
Gina Häußge e1a25a8913 🐛 Fix caching issue for freshly rendered timelapses
Closes #3396
2020-01-16 12:13:38 +01:00
Gina Häußge 482c2f7115 🐛 Fix timelapse progress under Py3
Closes #3409
2020-01-15 16:53:54 +01:00
Gina Häußge 7fa4ebd1ec Merge pull request #3414 from fieldOfView/fix_allows_multiple_needs
Fix checking against multiple Needs on OctoPrintPermission
2020-01-14 12:44:18 +01:00
Gina Häußge 9c3b552aa8 🔥 Remove unused leftover code 2020-01-14 11:24:22 +01:00
Gina Häußge 3229e65a8d ♻ Remove assumptions about UI from permission model
Implements #3419
2020-01-14 11:22:54 +01:00
fieldOfView 7191d39b51 Fix multiple Needs on OctoPrintPermission
fixes #3398
2020-01-03 08:41:59 -08:00
Gina Häußge 58bc5171ee ✏ Adjusted plugin tutorial for py3 2019-12-13 13:43:29 +01:00
Gina Häußge 74f3bc9ae6 🔖 staging/devel is now 1.4.0rc4.dev 2019-12-12 15:01:53 +01:00
Gina Häußge 464d9c0757 🔖 Preparing release of 1.4.0rc3 2019-12-12 13:00:35 +01:00
Gina Häußge 94ae90ab80 ♻ Cleaned up a pre-py3 leftover comment 2019-12-12 12:43:45 +01:00
Gina Häußge 33b89550a4 🐛 Fix a unicode issue under win32
subprocess env must not contain unicode strings but could now after some
py3 related refactorings.
2019-12-12 12:43:13 +01:00
Gina Häußge 9661469532 🐛 Fix some permission bindings
Closes #3388
2019-12-11 15:01:57 +01:00
Gina Häußge b06c222a7d 🐛 Fix checksum calculation in stk500v2 under py3
See #3382
2019-12-11 10:50:40 +01:00
Gina Häußge 9f85b54681 🐛 Convert decoded header to unicode
See #3382
2019-12-11 10:28:32 +01:00
Gina Häußge 5d1ad5d75d 🐛 Add blinker dependency for flask_principal
Was forgotten in 928d62a517
2019-12-10 16:35:07 +01:00
Gina Häußge dc32f955b7 🐛 Fix forwarding of HTTPExceptions on SimpleApiPlugins
Part of #3375
2019-12-10 16:16:40 +01:00
Gina Häußge 220592c267 🐛 IspError should be a proper Exception
Otherwise our try-catch-blocks won't catch it anymore.
2019-12-10 12:56:23 +01:00
Gina Häußge 0faa6879b4 ☂ Resilience against issue in Printoid
Closes #3381
2019-12-10 12:55:47 +01:00
Gina Häußge 71b5de91bf 🐛 Fix 403 response
Dumping string representations of the permission objects doesn't make
sense, and neither does rewriting the error description in the first
place.
2019-12-09 19:06:53 +01:00
Gina Häußge 928d62a517 ♻ Vendoring flask_principal
It no longer seems to be maintained and there's an issue in the code
we need fixed.
2019-12-09 19:06:52 +01:00
Gina Häußge 78bd3b1a52 🐛 "remember" does not need to be set on session
Be able to deal with that.

Follow up to #3370
2019-12-09 19:06:51 +01:00
Gina Häußge b9bab0577b ♻ Remove monkey patch that's no longer needed 2019-12-09 17:32:31 +01:00
Gina Häußge c41551a643 🐛 Fix wrong handling of session protection signal
We should only clear out the identity when the session has actually
been deemed deleted, not just on staleness due to e.g. a client IP
change.

Closes #3370
2019-12-09 17:31:53 +01:00
Gina Häußge 6c92dd1303 🐛 PNotify needs position:fixed
Closes #3377
2019-12-09 14:19:16 +01:00
Gina Häußge 124f01ca2d 🐛 py3: ensure an int as rolling window size
Closes #3371
2019-12-06 13:40:03 +01:00
Gina Häußge 0dece85fa7 🐛 Fix notifications being visible w/ needed login 2019-12-04 15:24:08 +01:00
Gina Häußge caebf90ee9 🐛 Fix short UI flicker before loading animation 2019-12-04 14:37:16 +01:00
Gina Häußge 0c77014903 ☔ Make sure js/css mime types are always correct
Even if we are running on windows and something is borked in the
registry...

Closes #3367
2019-12-03 18:03:11 +01:00
Gina Häußge 231a796200 ☔ Limit legal plugin permission keys 2019-12-03 17:26:29 +01:00
Gina Häußge fe755405e8 📝 Add docs for octoprint.access.permissions hook
As mentioned in #3365
2019-12-03 17:14:00 +01:00
Gina Häußge 2200f2186c 🐛 Fix permissions of global API key
Closes #3365
2019-12-03 14:55:32 +01:00
Gina Häußge b57b7cb606 🐛 appkeys: fix key gen under Python 2
And refactor key generation to be located in ONE central utility method
to avoid issues like that in the future.

Closes #3366
2019-12-03 12:56:14 +01:00
Gina Häußge f2b2496e58 🔖 staging/devel is now 1.4.0rc3.dev 2019-12-02 16:23:02 +01:00
Gina Häußge e603b98d0d 🔖 Preparing release of 1.4.0rc2 2019-12-02 14:11:43 +01:00
Gina Häußge e235fc299f 🐛 Make sure data is set
Closes #3364
2019-12-02 14:07:41 +01:00
Gina Häußge 4f25ed546e 🐛 Only proceed if children is set AND truthy
Closes #3363
2019-12-02 13:55:04 +01:00
Gina Häußge f72b9db6a9 🐛 Fix wrong escape
Closes #3362
2019-12-02 12:24:48 +01:00
Gina Häußge 80e8e33283 🐛 Don't logout always-logged-in AdminUser
If ACL is disabled it doesn't make sense to log it out and it's causing
issues further down the line due to different handling.

Fixes #3361
2019-12-02 12:24:44 +01:00
Gina Häußge 00d0396417 🐛 Fix autologin
Closes #3357
2019-11-29 12:50:16 +01:00
Gina Häußge 59e39662f1 🐛 timelapse: fix accessed event payload field
Closes #3354
2019-11-28 18:02:34 +01:00
Gina Häußge 038e1b9a57 🐛 appkeys: Fix a deprecation warning 2019-11-26 18:42:36 +01:00
Gina Häußge bbefeeeb02 🐛 appkeys: generate string api keys
Instead of binaries.

Closes #3350
2019-11-26 18:35:32 +01:00
Gina Häußge 2801da5c51 💚 Fix unit tests by fixing mocked functions
Closes #3348
2019-11-26 16:22:08 +01:00
Gina Häußge 471dab9406 🐛 Don't try to write None values into upload body
Closes #3349
2019-11-26 15:34:14 +01:00
Gina Häußge 1deb247ce5 🐛 Let functools.wraps do its job
Closes #3348
2019-11-26 15:14:24 +01:00
Gina Häußge 4469a2d84a 🔖 staging/devel is now 1.4.0rc2.dev, devel 1.5.0.dev 2019-11-26 10:36:18 +01:00
Gina Häußge 2da7aa358d 🔖 Preparing release of 1.4.0rc1 2019-11-25 11:57:30 +01:00
Gina Häußge cbb083d7f6 ♻ Do not invalidate / cache on hard reload if printing
Less radical follow-up to #3344 while the kinks for actually needed
UI refreshs are ironed out on that one.
2019-11-25 10:00:03 +01:00
Gina Häußge d68de2c3c7 Revert "Do not refresh on no-cache in request"
This reverts commit 3b1874e
2019-11-25 09:46:50 +01:00
Gina Häußge 454c5e494a Merge pull request #3344 from justfalter/disable-refresh-on-no-cache
Do not refresh on no-cache in request
2019-11-22 12:18:13 +01:00
Mike Ryan 3b1874ea25 Do not refresh on no-cache in request
Remove code that would lead to a refresh upon receiving a
'Cache-Control: no-cache' or 'Pragma: no-cache' in a request. The
purpose of these headers is to invalidate intermdiate proxy caches, not
that of an application server. A refresh in octoprint would lead to
several seconds of high CPU utilization on lower-power systems (like the
Raspberry Pi), leading to stuttering in print jobs.

It is still possible to explicitly cause a refresh by including
`_refresh` in the query parameters of a request.
2019-11-21 08:48:44 -06:00
Gina Häußge e0233dee13 🐛 SWU: Restart after pip update too 2019-11-21 14:27:52 +01:00
Gina Häußge 84a99e1b53 ⬇ Downgrade readthedocs-sphinx-ext
Current versions require jinja2>=2.9 which we can't upgrade to due to
compatibility issues.
2019-11-20 16:02:34 +01:00
Gina Häußge b7e0e89bb4 ⚡️ Precompile markdown & remove changelog
We already have Github's releases with all the changes, we don't need to
keep everything twice.

Instead of the changelog included in the about dialog there's now a link
to the release list, that should suffice.

Implements #3342
2019-11-20 15:35:44 +01:00
Gina Häußge d8c3063813 ⬆️ Update 3rd party deps 2019-11-20 15:30:36 +01:00
Gina Häußge 1485050234 ☔ Add noscript tag
If the user's browser has JS disabled, we should tell them instead of
displaying a non functional UI.

As suggested in https://community.octoprint.org/t/i-forgot-my-octoprint-password-how-can-i-reset-it/215/8?u=foosel
2019-11-15 16:46:06 +01:00
Gina Häußge 6d7721f8f5 ✨ PMGR: More cleanup options
Additional "clean up all leftovers" feature to clean up anything left
over by plugins already uninstalled.

Also takes care of entries in the disabled plugin list now.

See also #3299
2019-11-15 16:28:27 +01:00
Gina Häußge e3ae71eabd 🐛 PMGR: Apparently mtime can sometimes still be None
Handle that.

See https://community.octoprint.org/t/plugins-pip-error-on-fresh-octopi-0-17-0-install/13466
for an example.
2019-11-15 10:43:34 +01:00
Gina Häußge e88041c59e 🐛 PMGR: Remove access attempts on removed field 2019-11-15 10:43:34 +01:00
Gina Häußge e17db4e1cf 📝 SWU: document new pypi_release check type 2019-11-15 10:43:34 +01:00
Gina Häußge 766a64c8f6 Merge pull request #3337 from CapnBry/allowbackanal
Setting to allow gcode analysis to continue during printing
2019-11-12 17:24:14 +01:00
Bryan Mayland 8485d2c9a7 Fix tests failing due to no Settings 2019-11-12 16:07:57 +00:00
Bryan Mayland 397e691a6a Update setting caption for analyzeGcode.runAt 2019-11-12 15:53:06 +00:00
Bryan Mayland 6481f7cf6b webui setting for gcodeAnalysis.runAt 2019-11-12 15:47:54 +00:00
Bryan Mayland 46c527d24a Switch setting to fully control background gcode analysis queueing 2019-11-12 15:28:41 +00:00
Gina Häußge 5392f39cc4 Merge branch 'pr/3335' into devel 2019-11-12 15:28:47 +01:00
Bryan Mayland 4a324b4f5e Setting to allow gcode analysis to continue during printing 2019-11-12 13:49:54 +00:00
Kelly Anderson 2855b0e7a7 Add cbxbiker61 to AUTHORS.md 2019-11-09 00:59:38 -07:00
Kelly Anderson 39e4cd3136 fix another dictionary changed size during iteration exception, possibly triggered only under python3 2019-11-09 00:54:41 -07:00
Gina Häußge 8fefa63c8c 🐛 Fix whitespace issue 2019-11-08 15:15:20 +01:00
Gina Häußge 10532b9118 🐛 SWU: Fix doctest 2019-11-08 14:55:31 +01:00
Gina Häußge 7f2eb470e4 Merge branch 'maintenance' into devel 2019-11-08 14:52:20 +01:00
Gina Häußge 8955b8e0b6 🐛 Fix a unicode bug 2019-11-08 14:48:45 +01:00
Gina Häußge ee9d5048e2 ✨ SWU: Optional pip auto update
Since we can't guarantee for compatibility with future versions of pip
we'll stick to the updater for that being opt-in.
2019-11-08 14:48:29 +01:00
Gina Häußge 09bb74b6c6 ✨ SWU: New check type pypi_release 2019-11-08 14:45:51 +01:00
Gina Häußge 493dddf66e 🐛 to_bytes/to_unicode should pass through None 2019-11-08 14:45:17 +01:00
Gina Häußge 8173f8d0c4 🐛 gcode viewer: Fix swapped G2/G3
Closes #3334
2019-11-08 09:40:09 +01:00
Gina Häußge 01feec47d7 Merge pull request #3330 from dforsi/fix-typos
Fix typos
2019-11-07 12:40:38 +01:00
Daniele Forsi 2b60dbc7e1 Fix typos
Those typos were found with codespell which is available from
https://github.com/lucasdemarchi/codespell.git
2019-11-07 00:02:05 +01:00
Gina Häußge 32f5f36e5a Merge pull request #3328 from balassy/fix/backup-plugin-typo
Fixed a doc typo in the restore command name of the Backup plugin
2019-11-06 19:55:12 +01:00
György Balássy 96294df710 Fixed a typo in the restore command name of the Backup plugin 2019-11-05 22:25:25 +01:00
Gina Häußge ef54cbb148 ☔ Set close_exec flag on serial handle
Possible fix for #3212
2019-11-05 15:41:51 +01:00
Gina Häußge 9cd597a467 🐛 Fix invalid use of 401 response code
Leftovers from fixing #2297.

Fixes #3327
2019-11-05 13:21:49 +01:00
Gina Häußge 2263ebde72 🐛 Fixed ok tracking
Repositioning of clear_to_send clearing removes synchronization issues.

Big thanks to @KevinOConnor for pointing this out!
2019-11-05 12:38:02 +01:00
Gina Häußge 1fd8d597ab Merge pull request #3326 from DominikPalo/feature/support-android-theme-color
Automatically set the toolbar color on Android
2019-11-05 10:57:28 +01:00
Gina Häußge 2aec0b3a75 Merge pull request #3325 from DominikPalo/feature/polish-mac-os-docs
Polish the documentation for macOS (PyCharm setup, macOS naming)
2019-11-05 09:48:47 +01:00
Dominik Palo 47d10a6d3e Set the toolbar color on Android 2019-11-03 11:24:50 +01:00
Dominik Palo ee216ddc93 Merge remote-tracking branch 'upstream/devel' into devel 2019-11-03 09:33:23 +01:00
Dominik Palo 7756d312e2 Update AUTHORS.md 2019-11-03 09:24:51 +01:00
Dominik Palo 19e03eeeb2 Revert a line break 2019-11-03 09:24:51 +01:00
Dominik Palo e73aeba03b Unify macOS naming across docs 2019-11-03 09:23:04 +01:00
Dominik Palo 87f3c5acce Fix documentation for venv step on macOS 2019-11-03 09:19:24 +01:00
Dominik Palo a38a3e67c9 Merge pull request #1 from foosel/maintenance
Maintenance
2019-11-03 09:11:54 +01:00
Gina Häußge 547ae9e13e ♻ SWU: Do not persist check providers
There really is no reason for that
2019-11-01 13:04:20 +01:00
Gina Häußge b031092f07 ✨ PMGR: plugin data cleanup functions
Plugin data can now be cleaned up

  * on a plugin's uninstall through the plugin manager
  * manually through a new action button in the plugin manager

Implements #3299

Ideas for further improvement:

  * Management interface to show "orphaned" plugin data and delete
    on request.
2019-11-01 13:03:47 +01:00
Gina Häußge 6e6dd2c34e 🐛 port can be None 2019-10-31 17:09:49 +01:00
Gina Häußge 759f4f8ea2 🐛 Default checkbox should always be enabled
See #3302
2019-10-31 12:07:31 +01:00
Gina Häußge bee82bcde9 🐛 Treat port=None as port=AUTO on autoconnect
Potential fix for #3267
2019-10-31 11:09:54 +01:00
Gina Häußge 888fb97e66 💡 Clarify Error event in docs
Closes #3210
2019-10-31 09:57:57 +01:00
Gina Häußge 9c775bd899 🐛 Fix overzealous filtering of history entries
Closes #3309
2019-10-30 18:28:53 +01:00
Gina Häußge 4bf3445eef 💡 Fix a doc bug
Closes #3233
2019-10-30 18:23:57 +01:00
Gina Häußge 47b3f51a3f ♻ Speed up the analyser a bit
Closes #3318

Thanks at @jmfrank63 for the heads-up!
2019-10-30 18:10:52 +01:00
Gina Häußge 2e6b85990d 💚 Fix tests 2019-10-30 17:40:49 +01:00
Gina Häußge 30a4b9e9ab Merge branch 'maintenance' into devel
# Conflicts:
#	src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
#	src/octoprint/plugins/virtual_printer/virtual.py
2019-10-30 15:59:30 +01:00
Gina Häußge 81a259e51b ☔ virtual printer: parameter existence checks
Closes #3319
2019-10-30 15:45:36 +01:00
Gina Häußge e85e9661e0 🤷‍♀️ PMGR/SWU: Flag to ignore throttle state
Will allow people to circumvent the
shoot-yourself-in-the-foot-countermeasures by editing config.yaml.

If they do that and stuff then fails due to platform instability it's
their problem.
2019-10-30 15:43:52 +01:00
Gina Häußge 1d60250942 🐛 Only detect sd printing on byte pos change
Should fix #3301, or at least make it way less likely to happen.

The problem seems to have been made worse by `M25` not being blocking
on Klipper and thus the SD printing not being guaranteed to have stopped
yet after its return, meaning the following `M26 S0` will be denied,
causing the file position to not be properly reset and hence the issue
to arise in the first place.
2019-10-30 12:47:40 +01:00
Gina Häußge e11463f6ce ♻ Remove stuff deprecated with 1.4.0
See #1852
2019-10-29 13:12:28 +01:00
Gina Häußge 1146a1bb6f ✨ New events UserLogged(In|Out) & modified ClientOpened
On the push socket only available for admin users.

ClientOpened now also get the remoteAddress stripped from the payload
for guests on the push socket.

Implements #783
2019-10-29 12:39:45 +01:00
Gina Häußge 311fdd5aca 🚸 No connection requirement for timelapse config
No, this doesn't mean that you can start timelapses manually or
anything, only that you do not need to be connected to a printer in
order to change the default timelapse configuration.
2019-10-28 18:13:53 +01:00
Gina Häußge 6ddc55bf80 🚸 Fix timelapse progress bar for missing progress
Closes #2713
2019-10-28 18:10:44 +01:00
Gina Häußge 2c930ef069 🚸 allow wrapping on buttons in selection dialogs
Implements #3292
2019-10-25 15:47:18 +02:00
Gina Häußge 3739bbc652 💄 pmgr/swu: dynamic size for scrollables 2019-10-25 14:26:46 +02:00
Gina Häußge 8d544e63f4 ✨ pmgr: more plugin filters
Implements #3288
2019-10-25 14:18:04 +02:00
Gina Häußge 7e4cf6c5dc ✏️ Fix a help text
Closes #3311
2019-10-25 12:56:31 +02:00
Gina Häußge c8d162c999 ✏️ Clarify use of printer profile fields 2019-10-25 11:46:56 +02:00
Gina Häußge 017515dcc1 🚸 Display errors during loading
Also allow disabling loading screen.

Implements #3298
2019-10-24 17:14:33 +02:00
Gina Häußge d8bd684f96 Merge branch 'maintenance' into devel 2019-10-23 14:04:09 +02:00
Gina Häußge aad5c70eb0 🐛 Fix an escaping bug 2019-10-23 14:01:35 +02:00
Gina Häußge ea2f0a9b17 ♻ Minor refactoring & cleanup 2019-10-23 13:39:03 +02:00
Gina Häußge c4131d5e4b 🐛 Fix anonymous users on tornado endpoints
Closes #2779
2019-10-23 13:38:46 +02:00
Gina Häußge 21127bcf2a Merge branch 'maintenance' into devel 2019-10-23 12:30:06 +02:00
Gina Häußge 04da8afb07 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2019-10-23 12:00:30 +02:00
Gina Häußge c38f06cce2 Merge branch 'staging/maintenance' into maintenance 2019-10-23 11:48:57 +02:00
Gina Häußge 968f952f69 Merge branch 'rc/maintenance' into staging/maintenance 2019-10-22 12:13:00 +02:00
Gina Häußge 8409fdaa48 Merge branch 'rc/maintenance' 2019-10-21 12:27:16 +02:00
Gina Häußge f29e736427 🔖 Preparing release of 1.3.12 2019-10-21 12:26:04 +02:00
Gina Häußge ac3b6f6df8 🐛 Fix broken sv helper 2019-10-14 17:56:45 +02:00
Gina Häußge a4444ccb68 Merge pull request #3305 from RyuzakiKK/fix/systemd_doc
Fix systemd service documentation path
2019-10-14 16:23:51 +02:00
Ludovico de Nittis 270a0dcb1f Fix systemd service documentation path
The previously suggested `service` folder is not available in a canonical
systemd installation. Instead new services should be placed in
`/etc/systemd/system/`
2019-10-11 22:41:58 +02:00
Gina Häußge a889bec4d8 🐛 Solve sorted issues under Python 3.x
sorted does no longer support sorting None values under Python 3. This
patch introduces a utility function that ensures that None values are
replaced by a configurable default value ("" by default) and utilizes
it in places where sorted gets called with a custom sorting key that
can potentially consist of None values.

Closes #3300
2019-10-10 14:54:07 +02:00
Gina Häußge 7ee9bc32eb ☔ Aggressive escaping 2019-10-09 15:51:38 +02:00
Gina Häußge fd62c1fa3d ☔ Set some more headers, remove CDN URL & remove unused JSESSIONID
* Set X-Content-Type-Options to nosniff
  * Set X-Frame-Options to sameorigin (if not configured otherwise)
  * SockJS iframe fallback no longer embeds sockjs library from a CDN
  * SockJS no longer rewrites the unused JSESSIONID cookie
2019-10-08 16:41:42 +02:00
Gina Häußge a445cfe65e Merge pull request #3297 from mkobler/fix-typo
Fix minor typos
2019-10-08 11:21:17 +02:00
Gina Häußge e20a9925dd Merge pull request #3287 from FHeilmann/patch-2
ActionPrompts: More flexibility for selection_command
2019-10-08 11:20:54 +02:00
Gina Häußge 09a4fb2515 🐛 Fix merge error & add escaping
Closes #3296
2019-10-06 18:52:15 +02:00
Gina Häußge cce7389a42 ✨ SWU: More configuration options
Allow to select github_commit tracking, branch and pip target via UI.

Closes #3295
2019-10-06 18:32:19 +02:00
Gina Häußge b138ea7a47 🐛 SWU: Fix OctoPrint version reporting
See #3295
2019-10-06 16:46:34 +02:00
Gina Häußge 3b708ce079 🔗 Fix a link
As mentioned in #3295
2019-10-06 16:45:13 +02:00
Gina Häußge 4441618be5 🐛 Fix a concurrent modification issue 2019-10-06 16:29:37 +02:00
Mike Kobler 0525c9ab40 Fix minor typos 2019-10-05 18:55:15 -05:00
Gina Häußge 0035e7c3ff 🐛 Fix a merge error 2019-10-02 22:34:39 +02:00
Gina Häußge 073060d253 ✨ PMGR: Search box
Implements #3288
2019-09-26 20:26:47 +02:00
Florian Heilmann 55980a1c2c Update AUTHORS.md 2019-09-25 22:12:51 +02:00
Florian Heilmann 852a2cf157 Fix indentation 2019-09-25 22:11:11 +02:00
Florian Heilmann 2e6ee57162 ActionPrompts: More flexibility for selection_command
Allow users to control how and where the choice is inserted into the response by explicitly including "{choice}" in the selection_command
2019-09-25 22:09:20 +02:00
Gina Häußge 5c54f16ece 🐛 Don't trigger pause on SD cancel
Trying to trigger pausing due to the M25 on an SD cancel could lead
to a dead lock, see #3125
2019-09-25 12:05:03 +02:00
Gina Häußge 04a13268ad 🚸 PMGR: Filter for plugin list
We can now filter all/bundled/3rdparty. Should improve overview.
2019-09-24 11:07:45 +02:00
Gina Häußge 49fdac7528 Merge branch 'maintenance' into devel 2019-09-23 15:26:18 +02:00
Gina Häußge 75f6ef4bae Merge branch 'staging/maintenance' into maintenance
# Conflicts:
#	.versioneer-lookup
2019-09-23 15:25:54 +02:00
Gina Häußge 9fd608691b 🔖 staging is now 1.3.12rc4.dev 2019-09-23 15:24:55 +02:00
Gina Häußge a70a45f062 Merge branch 'staging/maintenance' into rc/maintenance 2019-09-23 12:59:49 +02:00
Gina Häußge 61b0845f19 🔖 Preparing release of 1.3.12rc3 2019-09-23 12:55:39 +02:00
Gina Häußge 30d618267f ☔ Protect against broken language packs 2019-09-20 13:20:46 +02:00
Gina Häußge b9665a8af4 🐛 Don't try to trigger M112 on connection errors
Doesn't make sense, we don't HAVE a connection yet.
2019-09-19 10:19:19 +02:00
Gina Häußge 204d212323 Merge branch 'maintenance' of github.com:foosel/OctoPrint into maintenance 2019-09-18 14:28:15 +02:00
Gina Häußge 04528a635b 🐛 PMGR: Disable plugin mgmt while printer is busy
Not just when only actively printing.

Closes #3278
2019-09-18 14:27:10 +02:00
Gina Häußge 15522a98b0 🐛 GCODE viewer: get rid of deep clone
Fixes #3277
2019-09-18 13:45:01 +02:00
Gina Häußge db1c18075f ☔ Some more escaping 2019-09-17 17:38:55 +02:00
Gina Häußge 3b556e9d79 Merge branch 'maintenance' into devel 2019-09-17 17:34:34 +02:00
Gina Häußge 8761273636 Merge branch 'staging/maintenance' into maintenance 2019-09-17 17:22:10 +02:00
Gina Häußge 08efe80304 🔖 staging/maintenance is now 1.3.12rc3.dev 2019-09-17 17:21:45 +02:00
Gina Häußge c4258c5bb0 🔖 Preparing release of 1.3.12rc2, part 2 2019-09-17 16:20:44 +02:00
Gina Häußge 58799888b7 🐛 SWU: Fix wrong version check
Fixes #3273
2019-09-17 16:18:07 +02:00
Gina Häußge fb6d57963b 🔖 Preparing release of 1.3.12rc2 2019-09-17 14:19:32 +02:00
Gina Häußge 03f228c0ef ☔ Extend safemode to language packs
Cherry-picked from cc1d88c

Implements #3271
2019-09-16 14:35:04 +02:00
Gina Häußge 93ae368f58 🐛 Escape single/double quotes in l10n strings
Cherry-picked from 72eef3e

Closes #3270
2019-09-16 14:34:21 +02:00
Gina Häußge 378752e155 🐛 GCODE viewer: Fix out-of-sync & slider issue, part 2
Now with all files...

Fixes #3272
2019-09-16 14:32:08 +02:00
Gina Häußge bec307900d 🐛 GCODE viewer: Fix out-of-sync & slider issue
Fixes #3272
2019-09-16 14:27:30 +02:00
Gina Häußge cc1d88c4c8 ☔ Extend safemode to language packs
Implements #3271
2019-09-13 16:04:32 +02:00
Gina Häußge 72eef3e224 🐛 Escape single/double quotes in l10n strings
Closes #3270
2019-09-13 15:42:59 +02:00
Gina Häußge 84f6833597 🚨 Fix unused variable issue 2019-09-12 21:05:00 +02:00
Gina Häußge 2a94abdc49 Merge remote-tracking branch 'origin/devel' into devel 2019-09-12 20:51:06 +02:00
Gina Häußge fab5f34aaa 🔀 Rebuilt CSS 2019-09-12 20:50:46 +02:00
Gina Häußge 76f79e5380 🔀 Migrate forcelogin changes to built-in login 2019-09-12 19:20:55 +02:00
Gina Häußge 1b25029207 🔀 Migrate user CLI to new access control 2019-09-12 17:44:33 +02:00
Gina Häußge 8df2a5436b Merge branch 'maintenance' into devel
# Conflicts:
#	setup.py
#	src/octoprint/filemanager/__init__.py
#	src/octoprint/plugins/action_command_prompt/static/js/action_command_prompt.js
#	src/octoprint/plugins/forcelogin/__init__.py
#	src/octoprint/plugins/forcelogin/templates/forcelogin_index.jinja2
#	src/octoprint/plugins/pluginmanager/__init__.py
#	src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
#	src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
#	src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js
#	src/octoprint/plugins/tracking/__init__.py
#	src/octoprint/printer/standard.py
#	src/octoprint/server/views.py
#	src/octoprint/static/js/app/viewmodels/printerstate.js
#	src/octoprint/static/js/app/viewmodels/users.js
#	src/octoprint/timelapse.py
#	src/octoprint/users.py
#	src/octoprint/util/comm.py
2019-09-12 09:30:28 +02:00
Gina Häußge 72f005b7fe 🔖 maintenance is now 1.3.13.dev 2019-09-10 16:55:06 +02:00
Gina Häußge 0eac10d5a6 🔖 staging/maintenance is now 1.3.12rc2.dev 2019-09-10 16:54:20 +02:00
Gina Häußge 2a42f02aec ⬆️ Require newer environment for future upgrades
This is the last version that supports stock OctoPi 0.14, catering
towards the ancient setuptools and pip versions found on it becomes
more and more unjustifiable overhead.
2019-09-10 13:45:18 +02:00
Gina Häußge 7c48cfd0f7 🔖 Preparing 1.3.12rc1 2019-09-09 18:00:13 +02:00
Gina Häußge bba796d551 ☔ errortracking: filter specific callbacks
We don't want to get swamped by third party plugin error messages on
sentry as that costs money.

Blacklist astroprint messages since they caused issues in the past.
2019-09-09 13:51:54 +02:00
Gina Häußge a855f3e62c ☔ Add fqcn of callbacks to exception loggers
Will allow us to filter for them.
2019-09-09 13:45:22 +02:00
Gina Häußge 5079e7e891 🐛 Clear user management dialogs on close 2019-09-09 12:54:03 +02:00
Gina Häußge ddc948fa94 🔖 errortracking: new DSNs for 1.3.12rc1 2019-09-06 17:09:11 +02:00
Gina Häußge f88f2b25ea 🐛 tracking: Only track plugins in pong event 2019-09-06 16:55:27 +02:00
Gina Häußge ea59dab7ab ✨ Optional print start confirmation
Implements #3250
2019-09-05 14:51:51 +02:00
Gina Häußge f0914c2214 🐛 appkeys: empty user_id = unset user_id
Also some more debug logging

Closes #3257
2019-09-05 14:40:40 +02:00
Gina Häußge b3e76c3ecc 🐛 plugin.version can be None, episode 2 2019-09-05 14:25:17 +02:00
Gina Häußge a4d5acb0b8 Merge pull request #3263 from gdombiak/printer_profiles_add_del_events
All printer profile events are now triggered
2019-09-05 09:34:12 +02:00
Gaston Dombiak 79b66f17b6 Events PRINTER_PROFILE_ADDED and PRINTER_PROFILE_DELETED are now triggered 2019-09-04 22:57:17 -07:00
Gina Häußge bcb6c7a1d4 Create SECURITY.md 2019-09-04 18:03:02 +02:00
Gina Häußge 36198c684f 🐛 Fix scoping issue
Closes #3247
2019-09-04 16:22:31 +02:00
Gina Häußge a3a60c5967 ☔ appkeys: better handling of empty request body 2019-09-04 10:59:03 +02:00
Gina Häußge 6df3cb5c12 🐛 plugin.version may be None 2019-09-04 10:33:42 +02:00
Gina Häußge 0611329a6d Merge pull request #3256 from byarmis/fix/byarmis/3253
Resolve error detecting Python version
2019-09-04 10:01:43 +02:00
Gina Häußge 2f90fca5ce Merge pull request #3249 from gdombiak/printer_profile_events
Printer profile events
2019-09-04 09:51:01 +02:00
Ben Yarmis e4e97190da Resolving issue #3253
Added myself to the AUTHORS.md file
2019-08-25 01:48:11 -05:00
Gaston Dombiak 9c748a85b4 removed ' to march master 2019-08-12 20:40:17 -07:00
Gaston Dombiak 78c2199d89 Fire PRINTER_PROFILE_MODIFIED when printer profile was modified 2019-08-12 20:32:42 -07:00
Gina Häußge 0e67906d1e ♻ tracking: Send plugin list only once per day 2019-07-29 17:38:18 +02:00
Gina Häußge 4c602cba2e ☔ Further hardening against corrupt recovery data 2019-07-29 16:55:32 +02:00
Gina Häußge 89255e2ec9 ☔ Harden against corrupt recovery data
Closes #3199
2019-07-29 16:52:05 +02:00
Gina Häußge 372b3662e9 📝 Add docs for printTimeLeftOrigin field
Closes #3203
2019-07-29 16:37:52 +02:00
Gina Häußge e007dbaf4c 🐛 Fix file selection not being cleared on disconnect
Closes #3224
2019-07-29 13:27:08 +02:00
Gina Häußge dbe07af426 Merge pull request #3202 from cbxbiker61/devel
fix RuntimeError: dictionary changed size during iteration
2019-07-25 10:17:45 +02:00
Gina Häußge f67f9b9399 🐛 Fix --admin flag on add command 2019-07-22 15:06:09 +02:00
Gina Häußge c6c5328418 ✨ Add list/activate/deactivate commands 2019-07-22 15:05:51 +02:00
Gina Häußge accbfc2b45 🐛 Fix settings passing 2019-07-22 15:04:27 +02:00
Gina Häußge 9976f2b7a3 🐛 Fix a broken import 2019-07-22 14:00:54 +02:00
Gina Häußge f249563b2c 🐛 At least use configured user manager class
Making the plugin hook work would be a ton of overhead due to the
components dictionary that needs to be supplied to it for user manager
initialization, however at the very least we should support
configuration of the used user manager class.

Both features are rarely used if at all, but we should be aware of this.

Also changed some wording, fixed to unicode and removed redundancy from
the sub commands (e.g. just "add" instead of "add_user") and flags.
2019-07-22 14:00:43 +02:00
Aliaksei Pilko 09e023917c Amend settings ref 2019-07-19 18:08:31 +01:00
Aliaksei Pilko 799b86b287 Update copyright 2019-07-18 15:41:32 +01:00
Aliaksei Pilko ea1bcf8e5d Add user accounts cli
Add forgot password link at login

Update AUTHORS.md
2019-07-17 19:54:21 +01:00
Piotr Usewicz ee93e25ffd Rename currentLine to current_line 2019-07-16 11:02:52 +02:00
Gina Häußge d25f664be3 🐛 printer safety: Anycubic 1.1.2 is already safe
Fix off by one error.

See also https://community.octoprint.org/t/octoprint-tells-me-that-my-printers-firmware-lacks-mandatory-safety-features-what-does-this-mean/350/61
2019-07-16 10:47:42 +02:00
Gina Häußge 3bffe4f7cb Merge pull request #3225 from eyal0/patch-4
Quote arguments in pip install
2019-07-11 11:20:20 +02:00
Eyal f140dd9d44 Quote arguments in pip install
If the argument is not quoted, the shell will interpret the braces.
2019-07-08 21:20:08 -04:00
Gina Häußge d44747b39a 🐛 Fix long_running_command flag for M191
Closes #3220
2019-07-08 11:26:02 +02:00
Gina Häußge f2da9d8d7d Merge pull request #3217 from gdombiak/docs_typo
Fixed typo in chambers documentation
2019-07-05 11:16:24 +02:00
Gaston Dombiak 5483ef7cd4 Fixed typo in chambers documentation 2019-07-04 23:19:35 -07:00
Gina Häußge 85d212ba97 ☔ More resilience against garbage on the line on initial connect
We'll now send the hello command twice, and a third time if we run into
a timeout during initial connect.

Closes #3206
2019-07-02 16:35:57 +02:00
Gina Häußge 44af09580a 🚸 Make clear when GCODE scripts are executed
Closes #3198
2019-07-02 13:56:19 +02:00
Gina Häußge 530fca95e4 ☔ Include wizard flag in etag
Additional protection against #3211 and #3166
2019-07-02 13:48:28 +02:00
Gina Häußge 59ae7e39f2 ☔ Only set relevant cache control headers
We don't want to accidentally overwrite anything again.
2019-07-02 13:43:57 +02:00
Gina Häußge 72167d14d2 🐛 Fix caching headers on / in case of wizards
Revalidation header from ceade46dd7 was
overwriting custom header in case of active wizards, causing the browser
to cache HTML code with enabled wizards.

This fixes this by checking if the headers in question actually need to
be set and aren't already there.
2019-07-02 12:44:29 +02:00
Gina Häußge 2c6568acd1 ✨ Mimetype guessing for the webcam test
Related to #3207
2019-07-01 17:17:34 +02:00
Gina Häußge e27c216a05 Merge branch 'master' into maintenance 2019-06-27 10:19:12 +02:00
Gina Häußge 7b4c148dd7 ✨ tracking: track slicing events
Gives us some numbers the next time someone complains about
slicer support.
2019-06-26 19:27:57 +02:00
Gina Häußge a924520dd6 ✨ tracking: track plugins & versions on startup
Requested feature by plugin developers, will also allow us to compile
stuff like top10 lists.
2019-06-26 18:32:33 +02:00
Kelly Anderson 1c3e463ac6 fix RuntimeError: dictionary changed size during iteration 2019-06-22 18:11:36 -06:00
Gina Häußge e88eb6dd85 ☔ PMGR: Prevent installs while throttled 2019-06-19 15:48:18 +02:00
Gina Häußge 59dfa994bd ☔ SWU: Prevent updates while throttled 2019-06-19 15:41:11 +02:00
Gina Häußge 6959ce4d38 💚 Try to fix doc build by pinning a dep, 2nd try 2019-06-19 11:52:06 +02:00
Gina Häußge 08bc0082cf 💚 Try to fix doc build by pinning a dep 2019-06-19 11:46:53 +02:00
Gina Häußge 6069d74a54 💚 Fix unit tests 2019-06-18 13:35:21 +02:00
Gina Häußge 68ee7030f1 ☔ Send M112 on disconnect due to error (configurable)
Try to disable heaters and such. Might fail, but worth a try at least.
Only do that if we are not SD printing though.
2019-06-17 18:35:44 +02:00
Gina Häußge 81342acccc ☔ Detect endless resend requests & abort
If the printer keeps requesting the same line over and over again,
something is either seriously wrong with the line or with the connection

In any case, log an error and disconnect.
2019-06-17 18:35:44 +02:00
Gina Häußge e029f33901 Merge pull request #3195 from dmweis/patch-2
Fix typo
2019-06-11 10:41:33 +02:00
David Weis 7bd8cff137 Fix typo 2019-06-08 14:14:58 +01:00
Gina Häußge 055dcfa0e1 Merge pull request #3192 from dovecode/translatable-string-fixes
Various translatable text fixes and fixed plugin install message during restore
2019-06-05 13:32:10 +02:00
Nicolai Nielsen 8acf417383 Removed extra curly brace in plugin install message during restore
Fixed plugin install message for UI (never worked!)
Fixed grammar in connectivity initial setup
Added space at end of lines for several multiline messages
2019-06-04 11:47:41 -05:00
Gina Häußge b50e1aee8a 🚨 More consistent whitespace 2019-06-04 15:20:27 +02:00
Gina Häußge c714bce17e Merge pull request #3191 from Flamenco/my_maintenance
Add documentation when target temperature is set to 0
2019-06-04 15:19:23 +02:00
Steven Spungin a9a8e48489 Add new author 2019-06-04 09:00:35 -04:00
Steven Spungin 9dec840818 Add documentation when target temperature is set to 0 2019-06-04 08:57:10 -04:00
Gina Häußge 9af125ca6d 🚨 Consistent whitespace 2019-06-03 13:25:02 +02:00
Gina Häußge 1f4fabe6ef 🐛 PMGR: Refresh data from server if needed on endpoint GET
Closes #3190
2019-06-03 12:17:03 +02:00
Gina Häußge 121f36704d Merge pull request #3184 from dovecode/action_prompt_warning_missing_space
Add space in disable warning message
2019-05-29 18:13:51 +02:00
Nicolai Nielsen 85ff545c07 Add space in disable warning message 2019-05-29 10:10:52 -05:00
Gina Häußge 3662c84de5 Merge branch 'pr/3183' into maintenance 2019-05-28 16:35:00 +02:00
Gina Häußge 79558fdfbf Merge pull request #3179 from dovecode/uninstall_plugin_confirmation
Added confirmation dialog before uninstalling plugin
2019-05-28 16:21:44 +02:00
Nicolai Nielsen 11040f272a Added confirmation dialog before uninstalling plugin
Added confirmation dialog before disabling plugin
Added configuration options to control the confirmation dialogs
Defaults are not to confirm for disabling but confirm for uninstalling
2019-05-27 19:03:29 -05:00
Janne Mäntyharju fa2716c65c Calculate filament usage for all extruders is M605 duplicate/mirror command is used (Issue #3075) 2019-05-27 22:02:34 +03:00
Gina Häußge 768b06e35a ✨ Allow disabling of closing dialogs by click outside
New setting: Settings > Appearance > Close dialogs by clicking outside

Implements #3162
2019-05-27 16:58:45 +02:00
Gina Häußge 0820c23aea Merge pull request #3180 from AndyQ/clear_term_patch
Added button to terminal window to all log window to be cleared out
2019-05-27 16:26:34 +02:00
Gina Häußge 361fbaa366 🐛 pmgr: Smaller height for plugin list
Should work around #3161
2019-05-27 16:22:50 +02:00
Gina Häußge a91359f2af 🚸 Change icon & wording 2019-05-27 16:21:03 +02:00
AndyQ 4bfabf82ae Fixed typo and changed link to clearAllLogs
Both logs (fancy and plain) cleared out at same time
2019-05-27 15:01:14 +01:00
Gina Häußge c90f556fe9 📝 github meta: Clarify devel vs maintenance base 2019-05-27 11:14:31 +02:00
AndyQ 352b190a72 Added button to terminal window to all log window to be cleared out 2019-05-26 12:49:03 +01:00
Gina Häußge e9b0bd9e65 Create FUNDING.yml 2019-05-23 13:08:50 +02:00
Gina Häußge c8ea808d93 🚸 Include seconds in upload date
See #3174
2019-05-21 15:18:24 +02:00
Gina Häußge d40c3e6241 🚸 Add upload date to selected file information
Should make it more clear when an update due to a new upload happens.

Closes #3174
2019-05-21 15:05:28 +02:00
Gina Häußge e94f789b72 🐛 Always report all tools in sharedNozzle setups
Fixes #3177

See also https://community.octoprint.org/t/9620/4
2019-05-21 14:29:15 +02:00
Gina Häußge 9ff44c49a6 🐛 Fix broken tool filtering 2019-05-21 14:20:41 +02:00
Gina Häußge c7b933ba00 🐛 forcelogin: Do not touch static endpoints
Closes #3176
2019-05-21 12:07:39 +02:00
Gina Häußge 6765b25803 🚸 action prompt: show icon for dismissed prompts in navbar 2019-05-21 10:37:47 +02:00
Gina Häußge 59b60f5dad 🐛 action prompt: close & delete prompt on disconnect
As mentioned in #3171
2019-05-20 19:55:10 +02:00
Gina Häußge 2822992843 🚸 action prompt: allow to cancel dialogs
Closes #3171
2019-05-20 19:49:06 +02:00
Gina Häußge 1b82aa859f 🐛 Fix accidental test code commit 2019-05-20 16:48:00 +02:00
Gina Häußge 12be637f85 ✨ Add setting for parity double open workaround
Can now be set to be applied if possibly needed (OS is a Debian Linux),
always or never.

Closes #3169, enhances #3167
2019-05-20 16:46:45 +02:00
Kyle Evans 3bd9d11fc3 comm: Don't open twice on FreeBSD
Originally introduced by PR #673 to fix reconnect issues on pyserial,
OctoPrint will first open the serial port with PARITY_ODD then close it
again and reopen with the desired PARITY_NONE. This works around issues
likely sitting somewhere in the linux tty layer, at least on some
distributions, that don't necessarily exist on other platforms.

Stop doing the workaround on FreeBSD to start with, as this is the only
platform I can effectively test. I suspect MacOS/Windows likely also don't
need to do this.
2019-05-17 22:43:13 -05:00
Gina Häußge e864d6b03e 🚸 Ensure line breaks on copy of terminal contents 2019-05-15 17:35:57 +02:00
Gina Häußge 547db7c1f5 ☔ pmgr: better handling of unexpected repository format
Closes #3157 and Sentry SERVER-116
2019-05-15 17:34:54 +02:00
Gina Häußge d6516e4a4c 🐛 tracking: handle time==None case
Closes #3156 and Sentry SERVER-WR
2019-05-15 15:19:57 +02:00
Gina Häußge 2387b4a771 🐛 backup: make sure exclude is always a list
Closes #3155 and Sentry SERVER-119
2019-05-15 15:15:25 +02:00
Gina Häußge b03d43156d 🐛 Strip interface tags from addresses on local check
Closes #3143 and Sentry SERVER-11B
2019-05-15 13:19:14 +02:00
Gina Häußge 07423712a6 🐛 Fix wrong variable name in exception handler
Closes #3153 & Sentry SERVER-11A
2019-05-15 11:48:45 +02:00
Gina Häußge 81735d07c9 Merge branch 'rc/maintenance' 2019-05-13 14:54:51 +02:00
Gina Häußge 03e328fd13 📝 Fix a documentation issue
Fixes #3117
2019-04-10 17:13:29 +02:00
Gina Häußge 7efcf00baf Merge pull request #3106 from hlovdal/explicit_python_version
README: Use explicit python version for virtualenv
2019-04-05 09:47:52 +02:00
Håkon Løvdal a3254466f7 Whitespace fixes 2019-04-05 01:10:30 +02:00
Håkon Løvdal f8dc504773 Add example of using explicit python version 2019-04-05 01:10:30 +02:00
393 changed files with 26158 additions and 51729 deletions

No files matched your search

+4
View File
@@ -13,6 +13,10 @@ trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
[src/octoprint/vendor/sockjs/**.py]
indent_style = space
indent_size = 4
[src/octoprint/static/js/app/**.js]
indent_style = space
indent_size = 4
+5
View File
@@ -0,0 +1,5 @@
# These are supported funding model platforms
github: [foosel]
patreon: foosel
custom: https://octoprint.org/support-octoprint/
+4
View File
@@ -0,0 +1,4 @@
contact_links:
- name: Have questions or need support?
url: https://community.octoprint.org
about: Please get in touch on the OctoPrint Community Forum!
@@ -1,6 +1,7 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[Request]'
---
+3 -2
View File
@@ -16,8 +16,9 @@ checklist:
made sure your changes don't interfere with current development by
talking it through with the maintainers, e.g. through a
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
* [ ] Your PR targets OctoPrint's devel branch if it's a completely
new feature, or maintenance if it's a bug fix or improvement of
existing functionality for the current stable version (no PRs
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),
+18
View File
@@ -0,0 +1,18 @@
accessControl:
salt: zXmvzI3uWuTLkSPOEfA2ZLwn3f3sGUNS
plugins:
virtual_printer:
enabled: true
tracking:
enabled: false
server:
firstRun: false
onlineCheck:
enabled: false
pluginBlacklist:
enabled: false
secretKey: rrdHjvmeGMPSdYWg2NGdiM7mpz9pjekk
seenWizards:
backup: null
corewizard: 3
tracking: null
+22
View File
@@ -0,0 +1,22 @@
admin:
active: true
apikey: null
groups:
- admins
- users
password: 3033587f3b040680c77ce4fb7e8d61422878ef49a2a784227689f3b44ce66ada7f6161f8b2b037267f0d37b783a5600276eb88e1d224d24915f64e187a49a89f
permissions: []
roles:
- user
- admin
settings: {}
user:
active: true
apikey: null
groups:
- users
password: 3033587f3b040680c77ce4fb7e8d61422878ef49a2a784227689f3b44ce66ada7f6161f8b2b037267f0d37b783a5600276eb88e1d224d24915f64e187a49a89f
permissions: []
roles:
- user
settings: {}
+175
View File
@@ -0,0 +1,175 @@
name: Build
on:
push:
release:
types: [published, prereleased]
jobs:
build:
name: 🔨 Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🏗 Install build dependencies
run: |
python -m pip install wheel --user
- name: 🔨 Build a binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
- name: ⬆ Upload build result
uses: actions/upload-artifact@v1
with:
name: dist
path: dist
test-unit:
name: 🧪 Unit tests
strategy:
matrix:
python: ["2.7", "3.7", "3.8"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏗 Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: 🏗 Set up test dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run test suite
run: |
pytest
test-flake8:
name: 🧪 Flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🏗 Set up test dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run test suite
run: |
flake8 src/ tests setup.py
test-install:
name: 🧪 Installation tests
needs: build
strategy:
matrix:
python: ["2.7", "3.7", "3.8"]
installable: ["wheel", "sdist"]
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v1
with:
name: dist
path: dist
- name: 🏗 Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: 🚀 Install wheel
if: matrix.installable == 'wheel'
run: |
pip install dist/OctoPrint-*-py2.py3-none-any.whl
- name: 🚀 Install source tarball
if: matrix.installable == 'sdist'
run: |
pip install dist/OctoPrint-*.tar.gz
test-e2e:
name: 🧪 E2E tests
needs: build
runs-on: ubuntu-16.04
steps:
- name: ⬇ Checkout code
uses: actions/checkout@v2
- name: ⬇ Download build result
uses: actions/download-artifact@v1
with:
name: dist
path: dist
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🚀 Install wheel
run: |
pip install dist/OctoPrint-*-py2.py3-none-any.whl
- name: 🏗 Create base config for test server
run: |
mkdir e2econfig
cp -r .github/fixtures/with_acl/* e2econfig
- name: 🚀 Run Cypress
uses: cypress-io/github-action@v2
with:
working-directory: tests/cypress
browser: chrome
start: 'octoprint -b ${{ github.workspace }}/e2econfig serve --host 127.0.0.1 --port 5000'
wait-on: 'http://127.0.0.1:5000/online.txt'
- name: ⬆ Upload screenshots
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: tests/cypress/screenshots
- name: ⬆ Upload videos
uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos
path: tests/cypress/videos
publish-on-testpypi:
name: 📦 Publish on TestPyPI
if: github.event_name == 'release'
needs:
- test-unit
- test-install
- test-e2e
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v1
with:
name: dist
path: dist
- name: 📦 Publish to index
uses: pypa/gh-action-pypi-publish@master
continue-on-error: true
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
publish-on-pypi:
name: 📦 Publish tagged releases to PyPI
if: github.event_name == 'release'
needs: publish-on-testpypi
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v1
with:
name: dist
path: dist
- name: 📦 Publish to index
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
+16
View File
@@ -0,0 +1,16 @@
name: 'Lock outdated issues & PRs'
on:
schedule:
- cron: '0 0 * * *'
jobs:
lock:
runs-on: ubuntu-latest
steps:
- name: 🔒 Lock issues & PRs closed over a year
uses: dessant/lock-threads@v2
with:
github-token: ${{ github.token }}
issue-lock-comment: ''
pr-lock-comment: ''
+75
View File
@@ -0,0 +1,75 @@
name: Test install of branches and latest release twice per day
on:
schedule:
- cron: '0 */12 * * *'
jobs:
install-branch:
name: Install branch
strategy:
matrix:
os: ["ubuntu-latest"]
python: ["2.7", "3.7", "3.8"]
branch: ["master"]
runs-on: ${{ matrix.os }}
steps:
- name: 🐍 Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: ⬇ Checkout code
uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
fetch-depth: 0
- name: 👷 Build and install checkout
run: |
pip install .
- name: 📧 Discord success notification
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
args: '☑️ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` was successful'
- name: 📧 Discord failure notification
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
args: '🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` failed'
install-latest:
name: Install latest release
strategy:
matrix:
os: ["ubuntu-latest"]
python: ["2.7", "3.7", "3.8"]
runs-on: ${{ matrix.os }}
steps:
- name: 👀 Determine latest release
id: latest
uses: foosel/github-action-get-latest-release@master
with:
repository: "OctoPrint/OctoPrint"
- name: 🐍 Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: 👷 Build and install latest release
run: |
pip install https://github.com/OctoPrint/OctoPrint/archive/${{ steps.latest.outputs.release }}.zip
- name: 📧 Discord success notification
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
args: '☑️ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ steps.latest.outputs.release }}` was successful'
- name: 📧 Discord failure notification
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
args: '🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ steps.latest.outputs.release }}` failed'
+19
View File
@@ -0,0 +1,19 @@
name: Trigger doc build
on:
push:
release:
types:
- released
- prereleased
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: 🚀 Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.DOCS_ACCESS_TOKEN }}
repository: OctoPrint/docs.octoprint.org
event-type: docs
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
+15 -12
View File
@@ -2,6 +2,7 @@ src/octoprint/templates/_data/AUTHORS.md
src/octoprint/templates/_data/CHANGELOG.md
src/octoprint/templates/_data/SUPPORTERS.md
src/octoprint/templates/_data/THIRDPARTYLICENSES.md
docs/_build
devtools
@@ -19,24 +20,26 @@ linux-Cura-*
Printrun
=======
.idea
.vscode
.DS_Store
Cura/current_profile.ini
Cura/preferences.ini
build
dist
pypy
OctoPrint.egg-info
*.orig
*.orig
*.codekit
venv
venv2
venv3
venv26
venv27
venv33
venv34
venv35
venv36
venv37
*.egg-info
.eggs
.mypy_cache
.pytest_cache
.tox
venv*
testconf*
node_modules
tests/cypress/screenshots
tests/cypress/videos
-22
View File
@@ -1,22 +0,0 @@
---
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:
- 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 -9
View File
@@ -18,16 +18,19 @@ prerelease
HEAD
\(detached.*
# maintenance is currently the branch for preparation of maintenance release 1.3.12
# maintenance is currently the branch for preparation of maintenance release 1.4.1
# so are any fix/... and improve/... branches
maintenance 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
fix/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
improve/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
maintenance 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
fix/.* 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
improve/.* 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
# staging/maintenance is currently the branch for preparation of 1.3.11rc4
# staging/maintenance is currently the branch for preparation of 1.4.1rc3
# so is regressionfix/...
staging/maintenance 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev
regressionfix/.* 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev
staging/maintenance 1.4.1rc3 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev
regressionfix/.* 1.4.1rc3 650d54d1885409fa1d411eb54b9e8c7ff428910f 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
# staging/devel is currently inactive (but has the 1.4.1rc3 namespace)
staging/devel 1.4.1rc3 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev
# every other branch is a development branch and thus gets resolved to 1.5.0-dev for now
.* 1.5.0 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
+17
View File
@@ -105,6 +105,23 @@ date of first contribution):
* [Jack Wilsdon](https://github.com/jackwilsdon)
* [Ryan Finnie](https://github.com/rfinnie)
* [Timur Duehr](https://github.com/tduehr)
* [Nicolai Nielsen](https://github.com/dovecode)
* [Janne Mäntyharju](https://github.com/JanneMantyharju)
* [Steven Spungin](https://github.com/flamenco)
* [Piotr Usewicz](https://github.com/pusewicz)
* [Aliaksei Pilko](https://github.com/aliaksei135)
* [Ben Yarmis](https://github.com/byarmis)
* [Florian Heilmann](https://github.com/FHeilmann)
* [Ludovico de Nittis](https://github.com/RyuzakiKK)
* [Dominik Paľo](https://github.com/DominikPalo)
* [Kelly Anderson](https://github.com/cbxbiker61)
* [Jim Neill](https://github.com/jneilliii)
* [Dustin Kerber](https://github.com/kerber)
* [Tobias Schürg](https://github.com/tobiasschuerg)
* [Josh Friend](https://github.com/joshfriend)
* [Lachlan Cresswell](https://github.com/lachyc)
* [Khoi Pham](https://github.com/osubuu)
* [Federico Nembrini](https://github.com/FedericoNembrini)
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
+3 -1172
View File
File diff suppressed because it is too large. Load diff
+26 -22
View File
@@ -1,10 +1,11 @@
# OctoPrint
![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)
![GitHub release](https://img.shields.io/github/v/release/OctoPrint/OctoPrint?logo=github&logoColor=white)
![PyPI](https://img.shields.io/pypi/v/OctoPrint?logo=python&logoColor=white)
![Build status](https://img.shields.io/github/workflow/status/OctoPrint/OctoPrint/Build)
[![Community Forum](https://img.shields.io/discourse/users?logo=discourse&logoColor=white&server=https%3A%2F%2Fcommunity.octoprint.org)](https://community.octoprint.org)
[![Discord](https://img.shields.io/discord/704958479194128507?label=discord&logo=discord&logoColor=white)](https://discord.octoprint.org)
[![Twitter Follow](https://img.shields.io/twitter/follow/OctoPrint3d.svg?style=social&label=Follow)](https://twitter.com/OctoPrint3d)
@@ -13,9 +14,9 @@ and released under the [GNU Affero General Public License V3](http://www.gnu.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 community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme). It also serves as central knowledge base.
The official IRC channel is [#octoprint on freenode](https://chat.octoprint.org). Its logs can be found [here](https://freenode.logbot.info/octoprint).
An invite to the Discord server can be found at [discord.octoprint.org](https://discord.octoprint.org).
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
@@ -30,17 +31,17 @@ If you enjoy OctoPrint, please consider becoming a regular supporter!**
You are currently looking at the source code repository of OctoPrint. If you already installed it
(e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only
want to find out how to use it, [the documentation](http://docs.octoprint.org/) and [the public wiki](https://github.com/foosel/OctoPrint/wiki)
might be of more interest for you. You might also want to subscribe to join
want to find out how to use it, [the documentation](http://docs.octoprint.org/) might be of more interest for you. You might also want to subscribe to join
[the community forum at community.octoprint.org](https://community.octoprint.org) where there are other active users who might be
able to help you with any questions you might have.
## Contributing
Contributions of all kinds are welcome, not only in the form of code but also with regards to the
[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), debugging help
in the [bug tracker](https://github.com/foosel/OctoPrint/issues), support of other users on
[the community forum at community.octoprint.org](https://community.octoprint.org)
[official documentation](http://docs.octoprint.org/), debugging help
in the [bug tracker](https://github.com/OctoPrint/OctoPrint/issues), support of other users on
[the community forum at community.octoprint.org](https://community.octoprint.org) or
[the official discord at discord.octoprint.org](https://discord.octoprint.org)
and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
If you think something is bad about OctoPrint or its documentation the way it is, please help
@@ -48,12 +49,12 @@ in any way to make it better instead of just complaining about it -- this is an
after all :)
For information about how to go about submitting bug reports or pull requests, please see the project's
[Contribution Guidelines](https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md).
[Contribution Guidelines](https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md).
## Installation
Installation instructions for installing from source for different operating
systems can be found [on the wiki](https://github.com/foosel/OctoPrint/wiki#assorted-guides).
systems can be found [on the forum](https://community.octoprint.org/tags/c/support/guides/15/setup).
If you want to run OctoPrint on a Raspberry Pi, you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi)
which is a custom SD card image that includes OctoPrint plus dependencies.
@@ -61,9 +62,16 @@ which is a custom SD card image that includes OctoPrint plus dependencies.
The generic steps that should basically be done regardless of operating system
and runtime environment are the following (as *regular
user*, please keep your hands *off* of the `sudo` command here!) - this assumes
you already have Python 2.7, 3.6 or 3.7, pip and virtualenv set up on your system:
you already have Python 2.7, 3.6 or 3.7, pip and virtualenv and their dependencies set up on your system:
1. Checkout OctoPrint: `git clone https://github.com/foosel/OctoPrint.git`
1. Create a user-owned virtual environment therein: `virtualenv venv`. If you want to specify a specific python
to use instead of whatever version your system defaults to, you can also explicitly require that via the `--python`
parameter, e.g. `virtualenv --python=python3 venv`.
2. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install OctoPrint`
Or alternatively, for an install from source:
1. Checkout OctoPrint: `git clone https://github.com/OctoPrint/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/pip install .`
@@ -72,16 +80,12 @@ You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octopri
for details.
After installation, please make sure you follow the first-run wizard and set up
access control as necessary.
access control as necessary.
## Dependencies
OctoPrint depends on a few python modules to do its job. Those are automatically installed when installing
OctoPrint via `pip`:
pip install .
You should do this every time after pulling from the repository, since the dependencies may have changed.
OctoPrint via `pip`.
OctoPrint currently supports Python 2.7, 3.6 and 3.7.
@@ -89,7 +93,7 @@ OctoPrint currently supports Python 2.7, 3.6 and 3.7.
Running the pip install via
pip install .
pip install OctoPrint
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
+11
View File
@@ -0,0 +1,11 @@
# Security Policy
## Supported Versions
Always update to the latest version of OctoPrint to keep up with security patches.
## Reporting a Vulnerability
Email to security@octoprint.org.
For the sake of the userbase of OctoPrint please always disclose responsibly and with a 90+ day window.
+31 -19
View File
@@ -1,57 +1,69 @@
# Supporters
# Supporters
Development of this version of OctoPrint wouldn't have been possible without
[the financial support by the community](https://octoprint.org/support-octoprint/) -
[the financial support by the community](https://support.octoprint.org) -
thanks to everyone who contributed!
## Patreon Patrons
## Patrons & Sponsors
* Andre Bubel
* Andrew Moorby
* Arnljot Arntsen
* Bjorn Breckenridge
* Ash King
* BigTreeTech
* Boris Hussein
* Brad Jackson
* Christian Petropolis
* Christian Wolf
* COLLE+McVOY
* D Brian Kimmel
* DeltaMaker 3D Printers
* Dennis Breining
* Dorian Gray
* E3D BigBox
* Eric Betts
* Ernesto Martinez
* Franziska Kunsmann
* GadgetAngel
* George Robles
* Greg Holloway
* Hog Duske
* Hugh Blemings
* jean-claude migneault
* Jeff Renfer
* Jefferson Hunt
* Jeremiah Avery
* Joseph Payne
* Jeremy Cole
* Joe Pasqua
* John Robinson
* Joshua Wills
* Justin Kaufman
* Kaile Riser
* Kale Stedman
* Kazuhiro Ogura
* Kelly C McNiece
* Kenneth Jiang
* Kurt Wubbels
* Kyle Menigoz
* LA 3D Printer Repair
* LulzBot®
* Lee Dohm
* Makespace Madrid
* Mark Walker
* Marvin Nahmias
* Michael Aumock
* Miles Flavel
* Mosaic Manufacturing
* OMER MEHMET SUTAS
* Neil R. Goldberg
* Patrick Glyré
* Patrick McGinnis
* Prof Yuh Wen Chen
* Raise3D
* Randy C. Will
* Ranjib Dey
* Richard Michaud
* Rigid3D
* Robert Gusek
* Samer Najia
* Shawn Lewis
* Simon Hallam
* Ronald Griehsler
* Sacha Telgenhof
* Sebastien Andrivet
* Stefan Krister
* Steve Thompson
* Stewart Danos
* Sven Mueller
* TEVO 3D Printers
* Trent Shumay
* Ulrich Kempken
and 1544 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 1886 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)!
+11 -1
View File
@@ -24,10 +24,12 @@
* [LESS](http://lesscss.org): Apache License 2.0
* [lodash](https://lodash.com): MIT
* [Loglevel](https://github.com/pimterry/loglevel): MIT
* [md5.js](https://blueimp.github.io/JavaScript-MD5/): MIT
* [Modernizr](http://modernizr.com): MIT
* [Moment.js](http://momentjs.com/): MIT
* [PNotify](http://sciactive.com/pnotify/): GPL, LGPL, MPL (triple licensed)
* [pusher.color.js](http://cache.preserve.io/5g18q0pw/index.html) (original link dead): MIT
* [ResizeSensor.js](https://github.com/procurios/ResizeSensor): MIT
* [SockJS](https://github.com/sockjs/sockjs-client): MIT
* [sprintf-js](http://alexei.ro/): BSD
@@ -39,12 +41,14 @@
* [Click](http://click.pocoo.org/): BSD
* [emoji](https://github.com/carpedm20/emoji/): BSD
* [feedparser](https://github.com/kurtmckee/feedparser): BSD
* [filetype](https://h2non.github.io/filetype.py/): MIT
* [Flask](http://flask.pocoo.org/): BSD
* [Flask-Assets](http://github.com/miracle2k/flask-assets): BSD
* [Flask-Babel](http://github.com/mitsuhiko/flask-babel): BSD
* [Flask-Login](https://github.com/maxcountryman/flask-login): MIT
* [Flask-Markdown](http://github.com/dcolish/flask-markdown): BSD
* [Flask-Principal](http://packages.python.org/Flask-Principal/): MIT
* [frozendict](https://github.com/slezica/python-frozendict): MIT
* [future](https://python-future.org/): MIT
* [futures](https://github.com/agronholm/pythonfutures): Python
* [monotonic](https://github.com/atdt/monotonic): Apache License 2.0
@@ -58,19 +62,25 @@
* [requests](http://python-requests.org/): Apache License 2.0
* [rsa](http://stuvel.eu/rsa): Apache License 2.0
* [sarge](http://sarge.readthedocs.org/): BSD
* [sentry-sdk](https://github.com/getsentry/sentry-python): BSD
* [scandir](https://github.com/benhoyt/scandir): BSD
* [semantic_version](https://github.com/rbarrois/python-semanticversion): BSD
* [SockJS-Tornado](http://github.com/mrjoes/sockjs-tornado/): MIT
* [Tornado](http://www.tornadoweb.org/): Apache License 2.0
* [typing](https://pypi.org/project/typing/): Python
* [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)
* [cookiecutter](https://github.com/cookiecutter/cookiecutter): BSD
* [ddt](https://github.com/txels/ddt): MIT
* [flake8](https://gitlab.com/pycqa/flake8): MIT
* [mock](https://github.com/testing-cabal/mock): BSD
* [nose](http://pythonhosted.org/nose/): LGPL
* [pyinstrument](https://github.com/joerick/pyinstrument): BSD
* [pytest](https://docs.pytest.org/en/latest/): MIT
* [pytest-doctest-custom](http://github.com/danilobellini/pytest-doctest-custom): 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
+8 -1
View File
@@ -1,8 +1,15 @@
[python: src/octoprint/**.py]
[jinja2: src/octoprint/templates/**.jinja2]
silent=false
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension, jinja2.ext.do, octoprint.util.jinja.trycatch
[jinja2: src/octoprint/plugins/**.jinja2]
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension
silent=false
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension, jinja2.ext.do, octoprint.util.jinja.trycatch
[javascript: src/octoprint/static/js/app/**.js]
extract_messages = gettext, ngettext
[javascript: src/octoprint/plugins/**.js]
extract_messages = gettext, ngettext
-177
View File
@@ -1,177 +0,0 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/OctoPrint.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OctoPrint.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/OctoPrint"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/OctoPrint"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
+529
View File
@@ -0,0 +1,529 @@
.. _sec-api-access:
**************
Access control
**************
.. contents::
.. _sec-api-access-permissions:
Permissions
===========
.. _sec-api-access-permissions-list:
List all permissions
--------------------
.. http:get:: /api/access/permissions
Retrieves all permissions available in the system.
Will return a :http:statuscode:`200` with a :ref:`permission list <sec-api-access-datamodel-permissions-list>`
as body.
:status 200: No error
.. _sec-api-access-groups:
Groups
======
.. _sec-api-access-groups-list:
Get group list
--------------
.. http:get:: /api/access/groups
Retrieves all groups registered in the system.
Will return a :http:statuscode:`200` with a :ref:`group list <sec-api-access-datamodel-groups-list>`
as body.
Requires the ``SETTINGS`` permission.
:status 200: No error
.. _sec-api-access-groups-add:
Add a new group
---------------
.. http:post:: /api/access/groups
Adds a new group to the system.
Expects a :ref:`group registration request <sec-api-access-datamodel-groups-addgrouprequest>` as request body.
Will return a :ref:`group list response <sec-api-access-datamodel-groups-list>` on success.
Requires the ``SETTINGS`` permission.
:json key: The group's identifier
:json name: The user's name
:json description: A human readable description of the group
:json permissions: The permissions to assign to the group
:json subgroups: Subgroups assigned to the group
:json default: Whether the group should be assigned to new users by default or not
:status 200: No error
:status 400: If any of the mandatory fields is missing or the request is otherwise
invalid
:status 409: A group with the provided key does already exist
.. _sec-api-access-groups-retrieve:
Retrieve a group
----------------
.. http:get:: /api/access/groups/(string:key)
Retrieves an individual group record.
Will return a :http:statuscode:`200` with a :ref:`group record <sec-api-access-datamodel-groups-grouprecord>`
as body.
Requires the ``SETTINGS`` permission.
:status 200: No error
.. _sec-api-access-groups-modify:
Update a group
--------------
.. http:put:: /api/access/groups/(string:key)
Updates an existing group.
Expects a :ref:`group update request <sec-api-access-datamodel-groups-updategrouprequest>` as request body.
Will return a :ref:`group list response <sec-api-access-datamodel-groups-list>` on success.
Requires the ``SETTINGS`` permission.
:json description: A human readable description of the group
:json permissions: The permissions to assign to the group
:json subgroups: Subgroups assigned to the group
:json default: Whether the group should be assigned to new users by default or not
:status 200: No error
:status 400: If any of the mandatory fields is missing or the request is otherwise
invalid
.. _sec-api-access-groups-delete:
Delete a group
--------------
.. http:delete:: /api/access/groups/(string:key)
Deletes a group.
Will return a :ref:`group list response <sec-api-access-datamodel-groups-list>` on success.
Requires the ``SETTINGS`` permission.
:status 200: No error
.. _sec-api-access-users:
Users
=====
.. _sec-api-access-users-list:
Retrieve a list of users
========================
.. http:get:: /api/access/users
Retrieves a list of all registered users in OctoPrint.
Will return a :http:statuscode:`200` with a :ref:`user list response <sec-api-access-datamodel-users-userlistresponse>`
as body.
Requires the ``SETTINGS`` permission.
:status 200: No error
.. _sec-api-access-users-retrieve:
Retrieve a user
---------------
.. http:get:: /api/access/users/(string:username)
Retrieves information about a user.
Will return a :http:statuscode:`200` with a :ref:`user record <sec-api-access-datamodel-users-userrecord>`
as body.
Requires either the ``SETTINGS`` permission or to be logged in as the user.
:param username: Name of the user which to retrieve
:status 200: No error
:status 404: Unknown user
.. _sec-api-access-users-add:
Add a new user
--------------
.. http:post:: /api/access/users
Adds a user to OctoPrint.
Expects a :ref:`user registration request <sec-api-access-datamodel-users-adduserrequest>`
as request body.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-access-users-list>`.
Requires the ``SETTINGS`` permission.
:json name: The user's name
:json password: The user's password
:json active: Whether to activate the account (true) or not (false)
:json admin: Whether to give the account admin rights (true) or not (false)
:status 200: No error
:status 400: If any of the mandatory fields is missing or the request is otherwise
invalid
:status 409: A user with the provided name does already exist
.. _sec-api-access-users-modify:
Update a user
-------------
.. http:put:: /api/access/users/(string:username)
Updates a user record.
Expects a :ref:`user update request <sec-api-access-datamodel-users-updateuserrequest>`
as request body.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-access-users-list>`.
Requires the ``SETTINGS`` permission.
:param username: Name of the user to update
:json admin: Whether to mark the user as admin (true) or not (false), can be left out (no change)
:json active: Whether to mark the account as activated (true) or deactivated (false), can be left out (no change)
:status 200: No error
:status 404: Unknown user
.. _sec-api-access-users-delete:
Delete a user
-------------
.. http:delete:: /api/access/users/(string:username)
Delete a user record.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-access-users-list>`.
Requires the ``SETTINGS`` permission.
:param username: Name of the user to delete
:status 200: No error
:status 404: Unknown user
.. _sec-api-access-users-password:
Change a user's password
------------------------
.. http:put:: /api/access/users/(string:username)/password
Changes the password of a user.
Expects a JSON object with a single property ``password`` as request body.
Requires the ``SETTINGS`` permission or to be logged in as the user.
:param username: Name of the user to change the password for
:json password: The new password to set
:status 200: No error
:status 400: If the request doesn't contain a ``password`` property or the request
is otherwise invalid
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-access-users-settings-get:
Get a user's settings
---------------------
.. http:get:: /api/access/users/(string:username)/settings
Retrieves a user's settings.
Will return a :http:statuscode:`200` with a JSON object representing the user's
personal settings (if any) as body.
Requires the ``SETTINGS`` permission or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 200: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-access-users-settings-set:
Update a user's settings
------------------------
.. http:patch:: /api/access/users/(string:username)/settings
Updates a user's settings.
Expects a new settings JSON object to merge with the current settings as
request body.
Requires the ``SETTINGS`` permission or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 204: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-access-users-apikey-generate:
Regenerate a user's api key
---------------------------
.. http:post:: /api/access/users/(string:username)/apikey
Generates a new API key for the user.
Does not expect a body. Will return the generated API key as ``apikey``
property in the JSON object contained in the response body.
Requires the ``SETTINGS`` permission or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 200: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-access-users-apikey-delete:
Delete a user's api key
-----------------------
.. http:delete:: /api/access/users/(string:username)/apikey
Deletes a user's personal API key.
Requires the ``SETTINGS`` permission or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 204: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-access-datamodel:
Data model
==========
.. _sec-api-access-datamodel-permissions:
Permissions
-----------
.. _sec-api-access-datamodel-permissions-list:
Permission list response
~~~~~~~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``permissions``
- 0..n
- List of :ref:`permission records <sec-api-datamodel-access-permissions>`
- The list of permissions
.. _sec-api-access-datamodel-groups:
Groups
------
.. _sec-api-access-datamodel-groups-list:
Group list response
~~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``groups``
- 0..n
- List of :ref:`group records <sec-api-datamodel-access-groups>`
- The list of groups
.. _sec-api-access-datamodel-groups-addgrouprequest:
Group registration request
~~~~~~~~~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``key``
- 1
- string
- The group's identifier
* - ``name``
- 1
- string
- The group's name
* - ``description``
- 0..1
- string
- The group's description. Set to empty if not provided.
* - ``permissions``
- 1..n
- List of string
- A list of identifier's of permissions to assign to the group
* - ``subgroups``
- 0..n
- List of string
- A list of identifier's of groups to assign to the group as subgroups
* - ``default``
- 0..1
- boolean
- Whether to assign the group to new users by default (true) or not (false, default value)
.. _sec-api-access-datamodel-groups-updategrouprequest:
Group update request
~~~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``description``
- 0..1
- string
- The group's description. Set to empty if not provided.
* - ``permissions``
- 1..n
- List of string
- A list of identifier's of permissions to assign to the group
* - ``subgroups``
- 0..n
- List of string
- A list of identifier's of groups to assign to the group as subgroups
* - ``default``
- 0..1
- boolean
- Whether to assign the group to new users by default (true) or not (false, default value)
.. _sec-api-access-datamodel-users:
Users
-----
.. _sec-api-access-datamodel-users-userlistresponse:
User list response
~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``users``
- 0..n
- List of :ref:`user records <sec-api-datamodel-access-users>`
- The list of users
.. _sec-api-access-datamodel-users-adduserrequest:
User registration request
~~~~~~~~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The user's name
* - ``password``
- 1
- string
- The user's password
* - ``active``
- 1
- bool
- Whether to activate the account (true) or not (false)
* - ``groups``
- 0..n
- List of string
- A list of identifiers of groups to assign to the user
* - ``permissions``
- 0..n
- List of string
- A list of identifiers of permissions to assign to the user
.. _sec-api-access-datamodel-users-updateuserrequest:
User update request
~~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``active``
- 0..1
- bool
- If present will set the user's active flag to the provided value. True for
activating the account, false for deactivating it.
* - ``groups``
- 0..n
- List of string
- A list of identifiers of groups to assign to the user
* - ``permissions``
- 0..n
- List of string
- A list of identifiers of permissions to assign to the user
+3 -1
View File
@@ -16,6 +16,8 @@ Get connection settings
Retrieve the current connection settings, including information regarding the available baudrates and
serial ports and the current connection state.
Requires the ``STATUS`` permission.
**Example**
.. sourcecode:: http
@@ -81,7 +83,7 @@ Issue a connection command
for the lost acknowledgment should always be properly investigated and removed instead of depending on this
"symptom solver".
Requires user rights.
Requires the ``CONNECTION`` permission.
**Example Connect Request**
+181
View File
@@ -218,6 +218,17 @@ Progress information
- 1
- Integer
- Estimate of time left to print, in seconds
* - ``printTimeLeftOrigin``
- 1
- String
- Origin of the current time left estimate. Can currently be either of:
* ``linear``: based on an linear approximation of the progress in file in bytes vs time
* ``analysis``: based on an analysis of the file
* ``estimate``: calculated estimate after stabilization of linear estimation
* ``average``: based on the average total from past prints of the same model against the same printer profile
* ``mixed-analysis``: mixture of ``estimate`` and ``analysis``
* ``mixed-average``: mixture of ``estimate`` and ``average``
.. _sec-api-datamodel-files:
@@ -469,3 +480,173 @@ References
- URL
- The model from which this file was generated (e.g. an STL, currently not used). Never present for
folders.
.. _sec-api-datamodel-access:
Access control
==============
.. _sec-api-datamodel-access-users:
User record
-----------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The user's name
* - ``active``
- 1
- bool
- Whether the user's account is active (true) or not (false)
* - ``user``
- 1
- bool
- Whether the user has user rights. Should always be true. Deprecated as of 1.4.0, use the ``users`` group instead.
* - ``admin``
- 1
- bool
- Whether the user has admin rights (true) or not (false). Deprecated as of 1.4.0, use the ``admins`` group instead.
* - ``apikey``
- 0..1
- string
- The user's personal API key
* - ``settings``
- 1
- object
- The user's personal settings, might be an empty object.
* - ``groups``
- 1..n
- List of string
- Groups assigned to the user
* - ``needs``
- 1
- :ref:`Needs object <sec-api-datamodel-access-needs>`
- Effective needs of the user
* - ``permissions``
- 0..n
- List of :ref:`Permissions <sec-api-datamodel-access-permissions>`
- The list of permissions assigned to the user (note: this does not include implicit permissions inherit from groups).
.. _sec-api-datamodel-access-permissions:
Permission record
-----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``key``
- 1
- string
- The permission's identifier
* - ``name``
- 1
- string
- The permission's name
* - ``dangerous``
- 1
- boolean
- Whether the permission should be considered dangerous due to a high reponsibility (true) or not (false).
* - ``default_groups``
- 1
- List of string
- List of group identifiers for which this permission is enabled by default
* - ``description``
- 1
- string
- Human readable description of the permission
* - ``needs``
- 1
- :ref:`Needs object <sec-api-access-datamodel-general-needs>`
- Needs assigned to the permission
.. _sec-api-datamodel-access-groups:
Group record
------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``key``
- 1
- string
- The group's identifier
* - ``name``
- 1
- string
- The group's name
* - ``description``
- 1
- string
- A human readable description of the group
* - ``permissions``
- 0..n
- List of :ref:`Permissions <sec-api-datamodel-access-permissions>`
- The list of permissions assigned to the group (note: this does not include implicit permissions inherited from
subgroups).
* - ``subgroups``
- 0..n
- List of :ref:`Groups <sec-api-datamodel-access-groups>`
- Subgroups assigned to the group
* - ``needs``
- 1
- :ref:`Needs object <sec-api-datamodel-access-needs>`
- Effective needs of the group
* - ``default``
- 1
- boolean
- Whether this is a default group (true) or not (false)
* - ``removable``
- 1
- boolean
- Whether this group can be removed (true) or not (false)
* - ``changeable``
- 1
- boolean
- Whether this group can be modified (true) or not (false)
* - ``toggleable``
- 1
- boolean
- Whether this group can be assigned to users or other groups (true) or not (false)
.. _sec-api-datamodel-access-needs:
Needs
-----
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``role``
- 0..1
- List of string
- List of ``role`` needs
* - ``group``
- 0..1
- List of string
- List of ``group`` needs
+19 -5
View File
@@ -21,6 +21,8 @@ Retrieve all files
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
Requires the ``FILES_LIST`` permission.
**Example 1**:
Fetch only the files and folders from the root folder.
@@ -250,6 +252,8 @@ Retrieve files from specific location
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
Requires the ``FILES_LIST`` permission.
**Example**:
.. sourcecode:: http
@@ -327,7 +331,7 @@ Upload file or create folder
Returns a :http:statuscode:`201` response with a ``Location`` header set to the management URL of the uploaded
file and an :ref:`Upload Response <sec-api-fileops-datamodel-uploadresponse>` as the body upon successful completion.
Requires user rights.
Requires the ``FILES_UPLOAD`` permission.
**Example for uploading a file**
@@ -504,6 +508,8 @@ Retrieve a specific file's or folder's information
On success, a :http:statuscode:`200` is returned, with a :ref:`file information item <sec-api-datamodel-files-file>`
as the response body.
Requires the ``FILES_LIST`` permission.
**Example**
.. sourcecode:: http
@@ -566,7 +572,10 @@ Issue a file command
is not operational when this parameter is present and set to ``true``, the request will fail with a response
of ``409 Conflict``.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned. If there already is an
active print job, a :http:statuscode:`409` is returned.
Requires the ``FILES_SELECT`` permission.
slice
Slices an STL file into GCODE. Note that this is an asynchronous operation that will take place in the background
@@ -598,6 +607,8 @@ Issue a file command
Upon success, a status code of :http:statuscode:`202` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
body will be returned.
Requires the ``SLICE`` permission.
copy
Copies the file or folder to a new ``destination`` on the same ``location``. Additional parameters are:
@@ -609,6 +620,8 @@ Issue a file command
Upon success, a status code of :http:statuscode:`201` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
body will be returned.
Requires the ``FILES_UPLOAD`` permission.
move
Moves the file or folder to a new ``destination`` on the same ``location``. Additional parameters are:
@@ -622,7 +635,7 @@ Issue a file command
Upon success, a status code of :http:statuscode:`201` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
body will be returned.
Requires user rights.
Requires the ``FILES_UPLOAD`` permission.
**Example Select Request**
@@ -756,7 +769,8 @@ Issue a file command
:statuscode 400: If the ``command`` is unknown or the request is otherwise invalid
:statuscode 415: If a ``slice`` command was issued against something other than an STL file.
:statuscode 404: If ``location`` is neither ``local`` nor ``sdcard`` or the requested file was not found
:statuscode 409: If a selected file is supposed to start printing directly but the printer is not operational or
:statuscode 409: If a selected file is supposed to start printing directly but the printer is not operational
or if a file is to be selected but the printer is already printing or
if a file to be sliced is supposed to be selected or start printing directly but the printer
is not operational or already printing.
@@ -773,7 +787,7 @@ Delete file
Returns a :http:statuscode:`204` after successful deletion.
Requires user rights.
Requires the ``FILES_DELETE`` permission.
**Example Request**
+56 -33
View File
@@ -148,8 +148,14 @@ Login
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.
login, whether active or passive. The active (username/password) login may also return a :http:statuscode:`403` in
case of a username/password mismatch, unknown user or a deactivated account.
.. warning::
Previous versions of this API endpoint did return a :http:statuscode:`401` in case of a username/password
mismatch or an unknown user. That was incompatible with basic authentication since it was a wrong use of
the :http:statuscode:`401` code and got therefore changed as part of a bug fix.
: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
@@ -157,8 +163,7 @@ Login
: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
:status 403: Username/password mismatch, unknown user or deactivated account
.. _sec-api-general-logout:
@@ -175,6 +180,20 @@ Logout
:status 204: No error
.. _sec-api-general-currentuser:
Current User
============
.. http:get:: /api/currentuser
Retrieves information about the current user.
Will return a :http:statuscode:`200` with a :ref:`current user object <sec-api-general-datamodel-currentuser>`
as body.
:status 200: No error
.. _sec-api-general-datamodel:
Data model
@@ -185,6 +204,30 @@ Data model
Login response
--------------
The Login response is a :ref:`user record <sec-api-datamodel-access-users>` extended by the following fields:
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``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.
.. _sec-api-general-datamodel-currentuser:
Current user
------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
@@ -196,32 +239,12 @@ Login response
* - ``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.
- The id of the current user. Unset if guest.
* - ``permissions``
- 0..n
- List of :ref:`permission records <sec-api-datamodel-access-permissions>`
- The effective list of permissions assigned to the user
* - ``groups``
- 0..n
- List of :ref:`permission records <sec-api-datamodel-access-groups>`
- The list of groups assigned to the user
+1 -2
View File
@@ -9,7 +9,6 @@ REST API
general.rst
version.rst
apps.rst
connection.rst
files.rst
job.rst
@@ -21,7 +20,7 @@ REST API
slicing.rst
system.rst
timelapse.rst
users.rst
access.rst
util.rst
wizard.rst
push.rst
+3 -1
View File
@@ -57,7 +57,7 @@ Issue a job command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
Requires the ``PRINT`` permission.
**Example Start Request**
@@ -180,6 +180,8 @@ Retrieve information about the current job
Returns a :http:statuscode:`200` with a :ref:`sec-api-job-datamodel-response` in the body.
Requires the ``STATUS`` permission.
**Example**
.. sourcecode:: http
+1 -1
View File
@@ -6,7 +6,7 @@ Languages
.. note::
All language pack management operations require admin rights.
All language pack management operations require the ``SETTINGS`` permission.
.. contents::
+59 -11
View File
@@ -80,6 +80,8 @@ Retrieve the current printer state
Returns a :http:statuscode:`200` with a :ref:`Full State Response <sec-api-printer-datamodel-fullstate>` in the
body upon success.
Requires the ``STATUS`` permission.
**Example 1**
Include temperature history data, but limit it to two entries.
@@ -241,7 +243,7 @@ Issue a print head command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
Requires the ``CONTROL`` permission.
**Example Jog Request**
@@ -350,7 +352,7 @@ Issue a tool command
Sets the given target temperature on the printer's tools. Additional parameters:
* ``targets``: Target temperature(s) to set, properties must match the format ``tool{n}`` with ``n`` being the
tool's index starting with 0.
tool's index starting with 0. A value of `0` will turn the heater off.
offset
Sets the given temperature offset on the printer's tools. Additional parameters:
@@ -380,7 +382,7 @@ Issue a tool command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
Requires the ``CONTROL`` permission.
**Example Target Temperature Request**
@@ -555,6 +557,8 @@ Retrieve the current tool state
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
Requires the ``STATUS`` permission.
.. note::
If you want both tool and bed temperature information at the same time, take a look at
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
@@ -630,7 +634,7 @@ Issue a bed command
target
Sets the given target temperature on the printer's bed. Additional parameters:
* ``target``: Target temperature to set.
* ``target``: Target temperature to set. A value of `0` will turn the heater off.
offset
Sets the given temperature offset on the printer's bed. Additional parameters:
@@ -645,7 +649,7 @@ Issue a bed command
If no heated bed is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires user rights.
Requires the ``CONTROL`` permission.
**Example Target Temperature Request**
@@ -714,6 +718,8 @@ Retrieve the current bed state
If no heated bed is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires the ``STATUS`` permission.
.. 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>`.
@@ -770,7 +776,7 @@ Retrieve the current bed state
Issue a chamber command
=======================
.. http:post:: /api/printer/bed
.. http:post:: /api/printer/chamber
Chamber commands allow setting the temperature and temperature offsets for the printer's heated chamber. Available commands
are:
@@ -778,7 +784,7 @@ Issue a chamber command
target
Sets the given target temperature on the printer's chamber. Additional parameters:
* ``target``: Target temperature to set.
* ``target``: Target temperature to set. A value of `0` will turn the heater off.
offset
Sets the given temperature offset on the printer's chamber. Additional parameters:
@@ -790,10 +796,10 @@ Issue a chamber command
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
If no heated chamber is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires user rights.
Requires the ``CONTROL`` permission.
**Example Target Temperature Request**
@@ -862,6 +868,8 @@ Retrieve the current chamber state
If no heated chamber is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires the ``STATUS`` permission.
.. 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>`.
@@ -944,7 +952,7 @@ Issue an SD command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
Requires the ``CONTROL`` permission.
**Example Init Request**
@@ -1022,6 +1030,8 @@ Retrieve the current SD state
Returns a :http:statuscode:`200` with an :ref:`SD State Response <sec-api-printer-datamodel-sdstate>` in the body
upon success.
Requires the ``STATUS`` permission.
**Example**
Read the current state of the SD card.
@@ -1058,7 +1068,7 @@ Send an arbitrary command to the printer
If successful returns a :http:statuscode:`204` and an empty body.
Requires user rights.
Requires the ``CONTROL`` permission.
**Example for sending a single command**
@@ -1101,6 +1111,26 @@ Send an arbitrary command to the printer
:json string commands: List of commands to send to the printer, mutually exclusive with ``command``.
:statuscode 204: No error
.. _sec-api-printer-customcontrols:
Retrieve custom controls
========================
.. http:get:: /api/printer/command/custom
Retrieves the :ref:`custom controls <sec-features-custom_controls>` as configured in
:ref:`config.yaml <sec-configuration-config_yaml>`.
Please refer to the documentation of :ref:`custom controls <sec-features-custom_controls>` on what
data structure to expect here.
Returns a :http:statuscode:`200` with an :ref:`Custom Controls Response <sec-api-printer-datamodel-customcontrols>`
in the body upon success.
Requires the ``CONTROL`` permission.
:statuscode 200: No error
.. _sec-api-printer-datamodel:
Data model
@@ -1211,3 +1241,21 @@ Arbitrary Command Request
- 0..1
- Map of key value pairs
- (only if ``script`` is set) additional template variables to provide to the script renderer
.. _sec-api-printer-datamodel-customcontrols:
Custom Controls Response
------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``controls``
- 0..n
- List of :ref:`custom controls <sec-features-custom_controls>`
- A list of custom control definitions as defined in ``config.yaml``.
+21 -3
View File
@@ -21,6 +21,8 @@ Retrieve all printer profiles
Returns a :http:statuscode:`200` with a list of :ref:`profiles <sec-api-printerprofiles-datamodel-profile>`.
Requires the ``CONNECTION`` permission.
**Example**
.. sourcecode:: http
@@ -124,6 +126,22 @@ Retrieve all printer profiles
}
.. _sec-api-printerprofiles-get:
Retrieve a single printer profile
=================================
.. http:get:: /api/printerprofiles/(string:identifier)
Retrieves an existing single printer profile.
Returns a :http:statuscode:`200` with a :ref:`profile <sec-api-printerprofiles-datamodel-profile>`.
Requires the ``CONNECTION`` permission.
:statuscode 200: No error
:statuscode 404: The profile does not exist
.. _sec-api-printerprofiles-add:
Add a new printer profile
@@ -143,7 +161,7 @@ Add a new printer profile
Returns a :http:statuscode:`200` with the saved profile as property ``profile``
in the JSON body upon success.
Requires admin rights.
Requires the ``SETTINGS`` permission.
**Example 1**
@@ -314,7 +332,7 @@ Update an existing printer profile
Returns a :http:statuscode:`200` with the saved profile as property ``profile``
in the JSON body upon success.
Requires admin rights.
Requires the ``SETTINGS`` permission.
**Example**
@@ -400,7 +418,7 @@ Remove an existing printer profile
Returns a :http:statuscode:`204` an empty body upon success.
Requires admin rights.
Requires the ``SETTINGS`` permission.
**Example**
+5 -3
View File
@@ -29,6 +29,9 @@ following message types are currently available for usage by 3rd party clients:
* ``connected``: Initial connection information, sent only right after establishing the socket connection. See
:ref:`the payload data model <sec-api-push-datamodel-connected>`.
* ``reauthRequired``: A reauthentication of the current login session is required. The ``reason`` parameter in the
payload defines whether a full active login is necessary (values ``logout`` and ``removed``) or a simple passive
login will suffice (all other values).
* ``current``: Rate limited general state update, payload contains information about the printer's state, job progress,
accumulated temperature points and log lines since last update. OctoPrint will send these updates when new information
is available, but not more often than twice per second in order to not flood the client with messages (e.g.
@@ -51,9 +54,8 @@ OctoPrint's SockJS socket also accepts two commands from the client to the serve
* ``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.
any kind of messages, since the permission system will prevent any kind of status messages to be sent to connected
clients lacking the ``STATUS`` permission.
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>`.
+3 -1
View File
@@ -21,6 +21,8 @@ Retrieve current settings
The :ref:`data model <sec-api-settings-datamodel>` is similar to what can be found in
:ref:`config.yaml <sec-configuration-config_yaml>`, see below for details.
Requires the ``SETTINGS_READ`` permission.
.. _sec-api-settings-save:
Save settings
@@ -36,7 +38,7 @@ Save settings
Returns the currently active settings on success, as part of a :http:statuscode:`200` response.
Requires admin rights.
Requires the ``SETTINGS`` permission.
**Example**
+62 -2
View File
@@ -28,6 +28,8 @@ List All Slicers and Slicing Profiles
Returns a :http:statuscode:`200` response with a :ref:`Slicer list <sec-api-slicing-datamodel-slicerlist>`
as the body upon successful completion.
Requires the ``SLICE`` permission.
**Example**
.. sourcecode:: http
@@ -77,6 +79,8 @@ List Slicing Profiles of a Specific Slicer
Returns a :http:statuscode:`200` response with a :ref:`Profile list <sec-api-slicing-datamodel-profilelist>`
as the body upon successful completion.
Requires the ``SLICE`` permission.
**Example**
.. sourcecode:: http
@@ -121,6 +125,8 @@ Retrieve Specific Profile
Returns a :http:statuscode:`200` response with a :ref:`full Profile <sec-api-slicing-datamodel-profile>`
as the body upon successful completion.
Requires the ``SLICE`` permission.
**Example**
.. sourcecode:: http
@@ -168,7 +174,7 @@ Add Slicing Profile
Returns a :http:statuscode:`201` and an :ref:`abridged Profile <sec-api-slicing-datamodel-profile>` in the body
upon successful completion.
Requires admin rights.
Requires the ``SETTINGS`` permission.
**Example**
@@ -206,6 +212,31 @@ Add Slicing Profile
:statuscode 201: No error
:statuscode 404: If the ``slicer`` was unknown to the system.
.. _sec-api-slicing-patch:
Update Slicing Profile
======================
.. http:patch:: /api/slicing/(string:slicer)/profiles/(string:key)
Updates the slicing profile identified by ``key`` for the slicer ``slicer``.
Expects a :ref:`profile update request <sec-api-slicing-datamodel-profileupdate>` as body.
Returns a :http:statuscode:`201` and an :ref:`abridged Profile <sec-api-slicing-datamodel-profile>` in the body
upon successful completion.
Requires the ``SETTINGS`` permission.
:param slicer: The identifying key of the slicer for which to update the profile
:param key: The identifying key of the profile to update
:json data: New profile overrides to apply
:json displayName: New display name
:json description: New description
:json default: Whether to make the profile default (true) or not (false) for the slicer
:statuscode 200: No error
:statuscode 404: Slicer or profile do not exist
.. _sec-api-slicing-delete:
Delete Slicing Profile
@@ -216,7 +247,7 @@ Delete Slicing Profile
Delete the slicing profile identified by ``key`` for the slicer ``slicer``. If the profile doesn't exist, the
request will succeed anyway.
Requires admin rights.
Requires the ``SETTINGS`` permission.
:param slicer: The identifying key of the slicer for which to delete the profile
:param key: The identifying key of the profile to delete
@@ -340,3 +371,32 @@ Profile
only the keys differing from the defaults when saving/updating a profile. The keys to be found in here a slicer
specific. Will be left out for list responses.
.. _sec-api-slicing-datamodel-profileupdate:
Profile Update Request
----------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``data``
- 0..1
- Object
- The profile data
* - ``displayName``
- 0..1
- ``string``
- The new display name for the profile
* - ``description``
- 0..1
- ``string``
- The new description for the profile
* - ``default``
- 0..1
- ``boolean``
- Whether to mark the profile as default for the slicer (true) or not (false)
+3 -1
View File
@@ -6,7 +6,7 @@ System
.. note::
All system operations require admin rights.
All system operations require the ``SYSTEM`` permission.
.. _sec-api-system-command-list:
@@ -20,6 +20,8 @@ List all registered system commands
A :http:statuscode:`200` with a :ref:`List all response <sec-api-system-commands-listall>`
will be returned.
Requires the ``SYSTEM`` permission.
**Example**
.. sourcecode:: http
+6 -4
View File
@@ -18,6 +18,8 @@ Retrieve a list of timelapses and the current config
Returns a :ref:`timelapse list <sec-api-timelapse-datamodel-list>` in the
response body.
Requires the ``TIMELAPSE_LIST`` permission.
:param unrendered: If provided and true, also include unrendered timelapses
.. _sec-api-timelapse-delete:
@@ -29,7 +31,7 @@ Delete a timelapse
Delete the timelapse ``filename``.
Requires user rights.
Requires the ``TIMELAPSE_DELETE`` permission.
.. _sec-api-timelapse-render:
@@ -41,7 +43,7 @@ Issue a command for an unrendered timelapse
Current only supports to render the unrendered timelapse ``name`` via the
``render`` command.
Requires user rights.
Requires the ``TIMELAPSE_ADMIN`` permission.
:json command: The command to issue, currently only ``render`` is supported
@@ -54,7 +56,7 @@ Delete an unrendered timelapse
Delete the unrendered timelapse ``name``.
Requires user rights.
Requires the ``TIMELAPSE_DELETE`` permission.
.. _sec-api-timelapse-saveconfig:
@@ -67,7 +69,7 @@ Change current timelapse config
The configuration is expected as the request body.
Requires user rights.
Requires the ``TIMELAPSE_ADMIN`` permission.
.. _sec-api-timelapse-datamodel:
+2 -307
View File
@@ -4,311 +4,6 @@
User
****
.. contents::
.. note::
.. _sec-api-users-list:
Retrieve a list of users
========================
.. http:get:: /api/users
Retrieves a list of all registered users in OctoPrint.
Will return a :http:statuscode:`200` with a :ref:`user list response <sec-api-users-datamodel-userlistresponse>`
as body.
Requires admin rights.
:status 200: No error
.. _sec-api-users-retrieve:
Retrieve a user
===============
.. http:get:: /api/users/(string:username)
Retrieves information about a user.
Will return a :http:statuscode:`200` with a :ref:`user record <sec-api-users-datamodel-userrecord>`
as body.
Requires either admin rights or to be logged in as the user.
:param username: Name of the user which to retrieve
:status 200: No error
:status 404: Unknown user
.. _sec-api-users-add:
Add a user
==========
.. http:post:: /api/users
Adds a user to OctoPrint.
Expects a :ref:`user registration request <sec-api-users-datamodel-adduserrequest>`
as request body.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
Requires admin rights.
:json name: The user's name
:json password: The user's password
:json active: Whether to activate the account (true) or not (false)
:json admin: Whether to give the account admin rights (true) or not (false)
:status 200: No error
:status 400: If any of the mandatory fields is missing or the request is otherwise
invalid
:status 409: A user with the provided name does already exist
.. _sec-api-users-update:
Update a user
=============
.. http:put:: /api/users/(string:username)
Updates a user record.
Expects a :ref:`user update request <sec-api-users-datamodel-updateuserrequest>`
as request body.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
Requires admin rights.
:param username: Name of the user to update
:json admin: Whether to mark the user as admin (true) or not (false), can be left out (no change)
:json active: Whether to mark the account as activated (true) or deactivated (false), can be left out (no change)
:status 200: No error
:status 404: Unknown user
.. _sec-api-users-delete:
Delete a user
=============
.. http:delete:: /api/users/(string:username)
Delete a user record.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
Requires admin rights.
:param username: Name of the user to delete
:status 200: No error
:status 404: Unknown user
.. _sec-api-users-resetpassword:
Reset a user's password
=======================
.. http:put:: /api/users/(string:username)/password
Changes the password of a user.
Expects a JSON object with a single property ``password`` as request body.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to change the password for
:json password: The new password to set
:status 200: No error
:status 400: If the request doesn't contain a ``password`` property or the request
is otherwise invalid
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-getsettings:
Retrieve a user's settings
==========================
.. http:get:: /api/users/(string:username)/settings
Retrieves a user's settings.
Will return a :http:statuscode:`200` with a JSON object representing the user's
personal settings (if any) as body.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 200: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-updatesettings:
Update a user's settings
========================
.. http:patch:: /api/users/(string:username)/settings
Updates a user's settings.
Expects a new settings JSON object to merge with the current settings as
request body.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 204: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-generateapikey:
Regenerate a user's personal API key
====================================
.. http:post:: /api/users/(string:username)/apikey
Generates a new API key for the user.
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 or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 200: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-deleteapikey:
Delete a user's personal API key
================================
.. http:delete:: /api/users/(string:username)/apikey
Deletes a user's personal API key.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 204: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-datamodel:
Data model
==========
.. _sec-api-users-datamodel-userlistresponse:
User list response
------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``users``
- 0..n
- List of :ref:`user records <sec-api-users-datamodel-userrecord>`
- The list of registered users
.. _sec-api-users-datamodel-userrecord:
User record
-----------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The user's name
* - ``active``
- 1
- bool
- Whether the user's account is active (true) or not (false)
* - ``user``
- 1
- bool
- Whether the user has user rights. Should always be true.
* - ``admin``
- 1
- bool
- Whether the user has admin rights (true) or not (false)
* - ``apikey``
- 0..1
- string
- The user's personal API key
* - ``settings``
- 1
- object
- The user's personal settings, might be an empty object.
.. _sec-api-users-datamodel-adduserrequest:
User registration request
-------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The user's name
* - ``password``
- 1
- string
- The user's password
* - ``active``
- 1
- bool
- Whether to activate the account (true) or not (false)
* - ``admin``
- 0..1
- bool
- Whether to give the user admin rights (true) or not (false or not present)
.. _sec-api-users-datamodel-updateuserrequest:
User update request
-------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``active``
- 0..1
- bool
- If present will set the user's active flag to the provided value. True for
activating the account, false for deactivating it.
* - ``admin``
- 0..1
- bool
- If present will set the user's admin flag to the provided value. True for
admin rights, false for no admin rights.
This API endpoint has been moved and is now part of :ref:`Access Control <sec-api-access-users>`.
+58 -1
View File
@@ -99,7 +99,15 @@ Test paths or URLs
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.
resolution
Tests whether a provided hostname can be resolved (via DNS lookup). Supported parameters are:
* ``name``: The host name to test. Mandatory.
The ``resolution`` command returns :http:statuscode:`200` with a :ref:`Resolution test result <sec-api-util-datamodel-resolutiontestresult>`
when the test could be performed. The status code of the response does NOT reflect the test result!
Requires the ``ADMIN`` permission.
**Example 1**
@@ -286,6 +294,32 @@ Test paths or URLs
"result": true
}
**Example 7**
Test whether a host name can be resolved successfully.
.. sourcecode:: http
POST /api/util/test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"command": "resolution",
"name": "octoprint"
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "octoprint.org",
"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``
@@ -302,6 +336,7 @@ Test paths or URLs
: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
:json name: ``resolution`` command only: the host name to test
:statuscode 200: No error occurred
.. _sec-api-util-datamodel:
@@ -409,3 +444,25 @@ Server test result
- 1
- bool
- ``true`` if the check passed.
.. _sec-api-util-datamodel-resolutiontestresult:
Resolution test result
----------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The host name that was tested.
* - ``result``
- 1
- bool
- ``true`` if the check passed.
+1 -1
View File
@@ -6,7 +6,7 @@ Wizard
.. note::
All wizard operations require either admin rights or the ``firstRun`` flag to be ``true``.
All wizard operations require either the ``ADMIN`` permission or the ``firstRun`` flag to be ``true``.
.. contents::
@@ -0,0 +1,61 @@
.. _sec-bundledplugins-action_command_notification:
Action Command Notification support
===================================
The OctoPrint Action Command Notification Support Plugin comes bundled with OctoPrint (starting with 1.4.1).
It allows firmware to trigger notifications users with the ``PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW`` permission
using :ref:`action commands <sec-features-action_commands>` about relevant events. These notifications will be shown
in the sidebar and if configured also as popup messages. The notifications in the sidebar panel can also be cleared
by users with the ``PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR` permission.
.. _fig-bundledplugins-action_command_notification-example:
.. figure:: ../images/bundledplugins-action_command_notification-example.png
:align: center
:alt: Simple notification example
A simple notification example triggered by the firmware
.. _sec-bundledplugins-action_command_notification-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``enable``: Whether to enable the support of notifications (enabled by default).
* ``enable_popup``: Whether to enable the additional display of notifications as popups in the UI (disabled by default).
You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``.
.. _sec-bundledplugins-action_command_notification-action_commands:
Supported action commands
-------------------------
notification <message>
Displays the notification ``<message>``
.. _sec-bundledplugins-action_command_prompt-example:
Example communication with the firmware
---------------------------------------
.. _sec-bundledplugins-action_command_prompt-sourcecode:
To display the :ref:`above notification <fig-bundledplugins-action_command_notification-example>` the firmware sent this action command:
.. code-block:: none
//action:notification Hello World!
.. _sec-bundledplugins-action_command_notification-sourcecode:
Source code
-----------
The source of the Action Command Prompt Notification plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/action_command_notification``.
+9 -14
View File
@@ -19,17 +19,6 @@ placeholder for the selected option's index.
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
@@ -37,7 +26,13 @@ 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}``.
* ``enable``: Whether to always enable (``always``), disable (``never``) or ``detect`` support.
* ``enable_emergency_sending``: Will make the selection command be sent as an emergency command to jump the internal
send queue and even be sent to the printer if it's not signaling to be able to received. Only done if this is true
and the printer signals support for emergency command processing. Defaults to ``true``.
* ``enable_signaling``: If enabled, will send the configured command with the ``P1`` parameter to the printer to
signal prompt support of the host. Defaults to ``true``.
* ``command``: The command to send to the firmware on choice, defaults to ``M876``.
You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``.
@@ -69,8 +64,6 @@ prompt_end
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
@@ -103,6 +96,8 @@ This would produce the following output:
If the user selects "Abort print", OctoPrint will send ``2`` as selected choice.
.. _sec-bundledplugins-action_command_prompt-sourcecode:
Source code
-----------
+1 -1
View File
@@ -27,7 +27,7 @@ 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``.
It adds two new commands, ``backup:backup`` and ``backup:restore``.
.. code-block:: none
+1 -1
View File
@@ -14,7 +14,7 @@ network running Microsoft Windows. You will be able to just double click on the
OctoPrint instance icon in "Networks > Other Devices" in your Windows Explorer,
which will take you directly to the web frontend.
The ZeroConf support allows OctoPrint to announce itself to Safari on MacOS X
The ZeroConf support allows OctoPrint to announce itself to Safari on macOS
on the same network.
Linux users should install `Avahi <http://avahi.org>`_ and can then use one
+7
View File
@@ -0,0 +1,7 @@
.. _sec-bundledplugins-file_check:
File Check
==========
The file check plugin - while considered bundled with OctoPrint - is a separate project on its own release
cycle and documented on `its Github repository <https://github.com/OctoPrint/OctoPrint-FileCheck>`_.
+7
View File
@@ -0,0 +1,7 @@
.. _sec-bundledplugins-firmware_check:
Firmware Check
==============
The firmware check plugin - while considered bundled with OctoPrint - is a separate project on its own release
cycle and documented on `its Github repository <https://github.com/OctoPrint/OctoPrint-FirmwareCheck>`_.
-35
View File
@@ -1,35 +0,0 @@
.. _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``.
+35
View File
@@ -0,0 +1,35 @@
.. _sec-bundledplugins-gcodeviewer:
GCode Viewer Plugin
===================
The GCode Viewer plugin provides a GCode viewer based on `Alex Ustyantsev's work <https://github.com/hudbrog/gCodeViewer>`_.
.. _fig-bundledplugins-gcodeviewer-example:
.. figure:: ../images/bundledplugins-gcodeviewer-example.png
:align: center
:alt: OctoPrint GCode Viewer Plugin
An example of the GCode Viewer in action.
The viewer has been included in OctoPrint ever since the first releases back in 2013, however as of
OctoPrint 1.4.1 it has been extracted into its own bundled plugin.
.. _sec-bundledplugins-gcodeviewer-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``mobileSizeThreshold``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases
or release candidates). Defaults to ``false``.
* ``sizeThreshold``: Unique instance identifier, auto generated on first activation
.. _sec-bundledplugins-gcodeviewer-sourcecode:
Source Code
-----------
The source of the GCode Viewer plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/gcodeviewer``.
+6 -1
View File
@@ -7,6 +7,7 @@ Bundled Plugins
.. toctree::
:maxdepth: 2
action_command_notification.rst
action_command_prompt.rst
announcements.rst
tracking.rst
@@ -14,8 +15,12 @@ Bundled Plugins
backup.rst
discovery.rst
errortracking.rst
forcelogin.rst
file_check.rst
firmware_check.rst
gcodeviewer.rst
logging.rst
loginui.rst
pluginmanager.rst
printer_safety_check.rst
softwareupdate.rst
virtual_printer.rst
+66
View File
@@ -0,0 +1,66 @@
.. _sec-bundledplugins-loginui:
Login UI
========
The Login UI plugin has been bundled since OctoPrint 1.4.0 and replaces the ForceLogin plugin bundled with prior
versions since 1.3.10.
If anonymous read-only access is disabled in the :ref:`Access Control settings <sec-features-access_control>`
it provides a stand alone login dialog that gets displayed instead of OctoPrint's regular UI.
.. _fig-bundledplugins-loginui:
.. figure:: ../images/bundledplugins-loginui-dialog.png
:align: center
:alt: Login dialog
OctoPrint's login dialog.
The plugin allows theming of the dialog through :ref:`a plugin hook <sec-bundledplugins-loginui-hooks-theming>`.
.. warning::
Since the plugin is absolutely required for the case of anonymous read-only access because in this case the
UI itself could not even fully initialize due to a lack of permissions required to do so, it is hidden in the plugin
manager and cannot be disabled through that.
.. _sec-bundledplugins-loginui-hooks:
Hooks
-----
.. _sec-bundledplugins-loginui-hooks-theming:
octoprint.plugin.loginui.theming
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: loginui_theming_hook(*args, **kwargs)
Support theming of the login dialog, just in case the core UI is themed as well. Use to return a list of additional
CSS file URLs to inject into the login dialog HTML.
Example usage by a plugin:
.. code-block:: python
def loginui_theming():
from flask import url_for
return [url_for("plugin.myplugin.static", filename="css/loginui_theme.css")]
__plugin_hooks__ = {
"octoprint.plugin.loginui.theming": loginui_theming
}
Only a list of ready-made URLs to CSS files is supported, neither LESS nor JS. Best use
url_for like in the example above to be prepared for any configured prefix URLs.
:return: A list of additional CSS URLs to inject into the login dialog.
:rtype: A list of strings.
.. _sec-bundledplugins-loginui-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/loginui``.
@@ -1,52 +0,0 @@
.. _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``.
+96 -18
View File
@@ -37,9 +37,9 @@ There you can adjust the following settings:
* **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>`_.
"Stable". `Read more about Release Channels here <https://community.octoprint.org/t/how-to-use-the-release-channels-to-help-test-release-candidates/402>`_.
* **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>`_).
(``/home/pi/OctoPrint`` for OctoPi or `manual installs following the Raspberry Pi setup guide <https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337/>`_).
Note that since OctoPrint 1.3.6 you will no longer need to set this to be able to update to releases, only if you
want to be able to update against some bleeding edge git branch.
* **Version cache TTL**: The "time to live" of the cache OctoPrint will use to temporarily persist the version information
@@ -133,7 +133,7 @@ Configuring the Plugin
user: foosel
repo: OctoPrint
method: pip
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
pip: 'https://github.com/OctoPrint/OctoPrint/archive/{target_version}.zip'
# further checks may be defined here
@@ -146,6 +146,9 @@ Configuring the Plugin
Version checks
++++++++++++++
Version check types are configured through the ``type`` parameter. The following
types are currently recognized:
* ``github_release``: Checks against releases published on Github. Additional
config parameters:
@@ -196,6 +199,28 @@ Version checks
* ``checkout_folder``: (mandatory) The full path to the folder with a valid git
repository to check.
* ``pypi_release``: Checks `pypi.org <https://pypi.org>`_ for new releases of a specified package. Additional
config parameters:
* ``package``: (mandatory) Name of the package which to check.
* ``httpheader``: Checks an HTTP header on a defined URL for changes. This can be used for easy checks
against things like ``ETag`` or ``Last-Modified`` headers. Additional
config parameters:
* ``header_url`` or ``url``: (mandatory) URL to check. ``url`` can be used to avoid duplication in case of updater
methods such as ``single_file_plugin``.
* ``header_name``: (mandatory) HTTP header to check, case-insensitive, e.g. ``ETag`` or ``Last-Modified``.
* ``header_method``: HTTP request method to use for the check, defaults to ``HEAD``.
* ``header_prefix``: Prefix to use for the obtained value in the version display. If not provided ``header_name``
will be used. If set to an empty string, no prefix will be added.
* ``jsondata``: Checks the provided JSON endpoint for changes. The JSON endpoint must return an object with the
property ``version``, which should contain the latest version, e.g. ``{"version":"1.2.3"}``. Additional
config parameters:
* ``jsondata``: (mandatory) URL from which to fetch the JSON data
* ``command_line``: Uses a provided script to determine whether an update
is available. Additional config parameters:
@@ -229,20 +254,42 @@ Version checks
Update methods
++++++++++++++
* ``pip``: An URL to provide to ``pip install`` in order to perform the
update. May contain a placeholder ``{target}`` which will be the most
recent version specifier as retrieved from the update check.
* ``update_script``: A script to execute in order to perform the update. May
contain placeholders ``{target}`` (for the most recent version specified
as retrieved from the update check), ``{branch}`` for the branch to switch
to to access the release, ``{folder}`` for the working directory
of the script and ``{python}`` for the python executable OctoPrint is
running under. The working directory must be specified either by an
``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
which performs the update, see below for details.
Update methods are specified via the ``method`` parameter. Some update methods are assigned implicitly
through the presence of their mandatory configuration parameters. The following methods are currently
supported:
* ``pip``: Update by ``pip install``ing the supplied URL. May contain a
placeholder ``{target}`` which will be the most recent version specifier as retrieved from the update check.
Additional config parameters:
* ``pip``: The URL to use for installing. Presence implies ``method: pip``.
* ``single_file_plugin``: Update a single file plugin by re-downloading it from a configured URL.
Additional config parameters:
* ``url``: (mandatory) The URL from which to install the single file plugin. Must be a single self contained
python file.
* ``update_script``: Update by executing a script.
Additional config parameters:
* ``update_script``: (mandatory) The path of the script to run. May
contain placeholders ``{target}`` (for the most recent version specified
as retrieved from the update check), ``{branch}`` for the branch to switch
to to access the release, ``{folder}`` for the working directory
of the script and ``{python}`` for the python executable OctoPrint is
running under. Presence implies ``method: update_script``.
* ``update_folder`` or ``checkout_folder``: (mandatory) The working directory.
``checkout_folder`` can be used to avoid duplication in case of check
types such as ``git_commit``.
* ``python_updater``: Update by executing a custom python callable.
Additional config parameters:
* ``python_updater``: (mandatory) Can only be specified by plugins through the
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. A Python callable
which performs the update, see below for details. Presence implies ``method: python_updater``.
* ``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.
@@ -269,7 +316,7 @@ Update methods
user: foosel
repo: OctoPrint
method: pip
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
pip: 'https://github.com/OctoPrint/OctoPrint/archive/{target_version}.zip'
update_script: '{python} "/path/to/octoprint-update.py" --python="{python}" "{folder}" "{target}"'
checkout_folder: /path/to/octoprint/checkout/folder
@@ -325,6 +372,37 @@ The same, but tracking all commits pushed to branch ``devel`` (thus allowing
branch: devel
pip: 'https://github.com/someUser/OctoPrint-SomePlugin/archive/{target}.zip'
Single file plugin hosted in a gist ``https://gist.github.com/someUser/somegist`` and updated whenever there are changes:
.. code-block:: yaml
plugins:
softwareupdate:
checks:
some_plugin:
type: httpheader
header_name: ETag
url: 'https://gist.github.com/someUser/somegist/raw/some_plugin.py'
method: single_file_plugin
The same but updated when a ``version.json`` hosted alongside gets updated with a new version can be found at
.. code-block:: yaml
plugins:
softwareupdate:
checks:
some_plugin:
type: jsondata
jsondata: 'https://gist.github.com/someUser/somegist/raw/version.json'
url: 'https://gist.github.com/someUser/somegist/raw/some_plugin.py'
method: single_file_plugin
Note that for gist hosted single file plugins, you need to use the "Raw" install link but should remove the
commit identifier. E.g. ``https://gist.githubusercontent.com/<user>/<gistid>/raw/my_plugin.py`` instead of
``https://gist.githubusercontent.com/<user>/<gistid>/raw/<commit>/my_plugin.py``. Note that these URLs will
be cached by Github for a bit, so an update will not be immediately picked up.
.. _sec-bundledplugins-softwareupdate-events:
Events
+26
View File
@@ -0,0 +1,26 @@
.. _sec-bundledplugins-virtual_printer:
Virtual Printer
===============
The Virtual Printer plugin provides a virtual printer to connect to during development. It is able to simulate various
firmware quirks, communication issues and can be heavily configured through ``config.yaml``. See
:ref:`the development documentation on details and usage <sec-development-virtual-printer>`.
The virtual printer has been included in OctoPrint ever since the first releases back in 2013, however as of
OctoPrint 1.4.1 it has finally been fully extracted into its own bundled plugin.
.. _sec-bundledplugins-virtual_printer-configuration:
Configuring the plugin
----------------------
Please refer to :ref:`the development documentation <sec-development-virtual-printer-config>`.
.. _sec-bundledplugins-virtual_printer-sourcecode:
Source Code
-----------
The source of the Virtual Printer plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/virtual_printer``.
+9 -10
View File
@@ -35,8 +35,11 @@ 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', 'sphinxcontrib.mermaid']
'sphinx.ext.napoleon', 'sphinxcontrib.mermaid', 'sphinx.ext.intersphinx']
todo_include_todos = True
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
'python2': ('https://docs.python.org/2', None),
'pyserial': ('https://pythonhosted.org/pyserial', None)}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -104,13 +107,9 @@ numfig = True
# -- Options for HTML output ---------------------------------------------------
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of built-in themes.
@@ -146,7 +145,7 @@ if not on_rtd: # only import and set the theme if we're building docs locally
html_static_path = ['_static']
def setup(app):
app.add_stylesheet("theme_overrides.css")
app.add_css_file("theme_overrides.css")
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
@@ -190,7 +189,7 @@ def setup(app):
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'OctoPrintdoc'
htmlhelp_basename = 'OctoPrintDoc'
# -- Options for LaTeX output --------------------------------------------------
+43 -171
View File
@@ -5,7 +5,7 @@ config.yaml
If not specified via the command line, the main configuration file ``config.yaml`` for OctoPrint is expected in its
settings folder, which unless defined differently via the command line is located at ``~/.octoprint`` on Linux, at
``%APPDATA%/OctoPrint`` on Windows and at ``~/Library/Application Support/OctoPrint`` on MacOS. If the file is not there,
``%APPDATA%/OctoPrint`` on Windows and at ``~/Library/Application Support/OctoPrint`` on macOS. If the file is not there,
you can just create it - it will only get created by OctoPrint once you save settings that deviate from the default
settings.
@@ -283,181 +283,19 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# false, no minification will take place regardless of the minify setting below.
bundle: true
# If set to true, OctoPrint will minify its viewmodels (that includes those of plugins). Note: if bundle is
# If set to true, OctoPrint will the core and library javascript assets. Note: if bundle is
# set to false, no minification will take place either.
minify: true
# If set to true, OctoPrint will also minify the third party plugin javascript assets. Note: if bundle or
# minify are set to false, no minification of the plugin assets will take place either.
minify_plugins: false
# Whether to delete generated web assets on server startup (forcing a regeneration)
clean_on_startup: true
# Settings for the virtual printer
virtualPrinter:
# Whether to enable the virtual printer and include it in the list of available serial connections.
# Defaults to false.
enabled: true
# Whether to send an additional "ok" after a resend request (like Repetier)
okAfterResend: false
# Whether to force checksums and line number in the communication (like Repetier), if set to true
# printer will only accept commands that come with linenumber and checksum and throw an error for
# lines that don't. Defaults to false
forceChecksum: false
# Whether to send "ok" responses with the line number that gets acknowledged by the "ok". Defaults
# to false.
okWithLinenumber: false
# Number of extruders to simulate on the virtual printer. Map from tool id (0, 1, ...) to temperature
# in °C
numExtruders: 1
# Allows pinning certain hotends to a fixed temperature
pinnedExtruders: null
# Whether to include the current tool temperature in the M105 output as separate T segment or not.
#
# True: > M105
# < ok T:23.5/0.0 T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
# False: > M105
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
includeCurrentToolInTemps: true
# Whether to include the selected filename in the M23 File opened response.
#
# True: > M23 filename.gcode
# < File opened: filename.gcode Size: 27
# False: > M23 filename.gcode
# > File opened
includeFilenameInOpened: true
# Whether the simulated printer should also simulate a heated bed or not
hasBed: true
# Whether the simulated printer should also simulate a heated chamber or not
hasChamber: false
# If enabled, reports the set target temperatures as separate messages from the firmware
#
# True: > M109 S220.0
# < TargetExtr0:220.0
# < ok
# > M105
# < ok T0:34.3 T1:23.5 B:43.2
# False: > M109 S220.0
# < ok
# > M105
# < ok T0:34.3/220.0 T1:23.5/0.0 B:43.2/0.0
repetierStyleTargetTemperature: false
# If enabled, uses repetier style resends, sending multiple resends for the same line
# to make sure nothing gets lost on the line
repetierStyleResends: false
# If enabled, ok will be sent before a commands output, otherwise after or inline (M105)
#
# True: > M20
# < ok
# < Begin file list
# < End file list
# False: > M20
# < Begin file list
# < End file list
# < ok
okBeforeCommandOutput: false
# If enabled, reports the first extruder in M105 responses as T instead of T0
#
# True: > M105
# < ok T:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
# False: > M105
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
smoothieTemperatureReporting: false
# Whether M20 responses will include filesize or not
#
# True: <filename> <filesize in bytes>
# False: <filename>
extendedSdFileList: false
# Forced pause for retrieving from the outgoing buffer
throttle: 0.01
# Whether to send "wait" responses every "waitInterval" seconds when serial rx buffer is empty
sendWait: false
# Interval in which to send "wait" lines when rx buffer is empty
waitInterval: 1
# Size of the simulated RX buffer in bytes, when it's full a send from OctoPrint's
# side will block
rxBuffer: 64
# Size of simulated command buffer, number of commands. If full, buffered commands will block
# until a slot frees up
commandBuffer: 4
# Whether to support the M112 command with simulated kill
supportM112: true
# Whether to send messages received via M117 back as "echo:" lines
echoOnM117: true
# Whether to simulate broken M29 behaviour (missing ok after response)
brokenM29: true
# Whether F is supported as individual command
supportF: false
# Firmware name to report (useful for testing firmware detection)
firmwareName: Virtual Marlin 1.0
# Simulate a shared nozzle
sharedNozzle: false
# Send "busy" messages if busy processing something
sendBusy: false
# Simulate a reset on connect
simulateReset: true
# Lines to send on simulated reset
resetLines:
- start
- Marlin: Virtual Marlin!
- "\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
# enable or disable the loading animation
showLoadingAnimation: true
.. _sec-configuration-config_yaml-estimation:
@@ -1023,6 +861,25 @@ Use the following settings to configure the server:
- 192.168.1.254
- 192.168.23.42
# Whether to allow OctoPrint to be embedded in a frame or not. Note that depending on your setup you might
# have to set SameSite to None, Secure to true and serve OctoPrint through a reverse proxy that enables https
# for cookies and thus logging in to work
allowFraming: true
# Settings for further configuration of the cookies that OctoPrint sets (login, remember me, ...)
cookies:
# SameSite setting to use on the cookies. Possible values are None, Lax and Strict. Defaults to None but
# be advised that browsers will soon force this to Lax unless also being set as Secure and served over
# https, which will cause issues with embedding OctoPrint in frames.
#
# See also https://www.chromestatus.com/feature/5088147346030592,
# https://www.chromestatus.com/feature/5633521622188032 and issue #3482
samesite: lax
# Whether to set the Secure flag to true on cookies. Defaults to false. Only set to true if you are running
# OctoPrint behind a reverse proxy taking care of SSL termination.
secure: false
# 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
@@ -1124,9 +981,24 @@ 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 some
`into OctoPrint's wiki <https://community.octoprint.org/t/reverse-proxy-configuration-examples/1107>`_ for some
examples on how to configure this.
.. note::
If you want to embed OctoPrint in a frame, you'll need to set ``allowFraming`` to ``true`` or your browser will
prevent this.
In future browser builds you will also have to make sure you frame is on the same domain as OctoPrint or that
OctoPrint is served via https through a reverse proxy and has set ``cookies.secure`` to ``true`` or your browser
will refuse to persist cookies and logging in will not work.
See also `Cookies default to SameSite=Lax <https://www.chromestatus.com/feature/5088147346030592>`_ and
`Reject insecure SameSite=None cookies <https://www.chromestatus.com/feature/5633521622188032>`_ as well as
`this ticket <https://github.com/OctoPrint/OctoPrint/issues/3482>`_,
and `this twitter thread <https://twitter.com/foosel/status/1022030752349913088>`_ on why OctoPrint cannot
solve this on its own/ship with https that doesn't cause scary warnings in your browser.
.. _sec-configuration-config_yaml-slicing:
Slicing
+4 -4
View File
@@ -5,7 +5,7 @@ logging.yaml
The logging configuration file ``logging.yaml`` for OctoPrint is expected in its settings folder, which unless defined
differently on the command line is located at ``~/.octoprint`` on Linux, at ``%APPDATA%/OctoPrint`` on Windows and at
``~/Library/Application Support/OctoPrint`` on MacOS.
``~/Library/Application Support/OctoPrint`` on macOS.
You can use it to change the log levels of the individual components within OctoPrint, which might be necessary to help
in debugging issues you are experiencing, or to change the configuration of the logging handlers themselves, e.g. in
@@ -81,8 +81,8 @@ used for the ``serial.log`` and the ``console`` handler used for the output to s
maxBytes: 2097152 # 2 * 1024 * 1024 = 2 MB in bytes
filename: /path/to/octoprints/logs/serial.log
You can find more information on the used logging handlers in the
`Python documentation on logging handlers <https://docs.python.org/2/library/logging.handlers.html>`_.
You can find more information on the used logging handlers in the Python documentation on
:py:mod:`logging.handlers`.
Changing logging formatters
---------------------------
@@ -97,4 +97,4 @@ expressed in YAML as follows:
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
The possible keys for the logging format can be found in the
`Python documentation on LogRecord attributes <https://docs.python.org/2/library/logging.html#logrecord-attributes>`_.
:ref:`Python documentation on LogRecord attributes <logrecord-attributes>`.
+48 -24
View File
@@ -17,22 +17,37 @@ below.
* `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``
* Checkout the OctoPrint sources from their Git repository:
* ``git clone https://github.com/OctoPrint/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``
* PY2: ``virtualenv --python=python2 venv2``
* PY3: ``virtualenv --python=python3 venv3``
.. note::
This assumes that `python2` and `python3` are binaries available directly on your ``PATH``. If your Python 2 and 3
binaries cannot be found on your ``PATH`` like this you'll need to specify the full paths to them here,
e.g. ``virtualenv --python=/path/to/python2/bin/python venv2``
* 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)
* 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]``
including its regular *and* development and plugin development dependencies:
* ``pip install -e '.[develop,plugins]'``
When the virtual environment is activated you can then:
@@ -77,7 +92,7 @@ installed:
.. 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
`Pull Request <https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
Then:
@@ -85,7 +100,7 @@ Then:
.. code-block:: none
cd ~/devel
git clone -b devel https://github.com/foosel/OctoPrint.git
git clone -b devel https://github.com/OctoPrint/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/bin/activate
@@ -122,7 +137,7 @@ Open the Git Bash you just installed and in that:
pip install virtualenv
cd /c/Devel
git clone https://github.com/foosel/OctoPrint.git
git clone https://github.com/OctoPrint/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/Scripts/activate
@@ -136,7 +151,7 @@ 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/>`_.
This guide is based on the `Setup Guide for Mac OS X on OctoPrint's Community Forum <https://community.octoprint.org/t/setting-up-octoprint-on-macos/13425>`_.
Please report back if it works for you, due to lack of access to a Mac I cannot test it myself. Thanks.
.. todo::
@@ -169,7 +184,7 @@ You'll need a user account with administrator privileges.
.. code-block:: none
cd ~/devel
git clone https://github.com/foosel/OctoPrint.git
git clone https://github.com/OctoPrint/OctoPrint.git
cd OctoPrint
virtualenv venv
source venv/bin/activate
@@ -188,7 +203,7 @@ 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
`Pull Request <https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
.. _sec-development-environment-ides-pycharm:
@@ -197,28 +212,37 @@ 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
- **(Linux, Windows)** "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...", select OctoPrint venv
folder (e.g. ``~/devel/OctoPrint/venv`` or ``C:\Devel\OctoPrint\venv``)
- **(macOS)** "PyCharm" > "Preferences ..." > "Project: OctoPrint" > "Project Interpreter" > "Add ..." >
"Virtualenv Environment > "Existing Environment", select OctoPrint venv folder (e.g. ``~/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``
* Module name: ``octoprint``
* Module 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" > "+"
* If you want build artifacts to be cleaned up on run (recommended): "Before Launch" > "+" > "Run external tool" > "+"
* Name: Update OctoPrint dependencies
* Program: ``$PyInterpreterDirectory$/pip`` (or ``$PyInterpreterDirectory$/pip.exe`` on Windows)
* Parameters: ``install -e .[develop,plugins]``
* Name: Clean build directory
* Program: ``$ModuleSdkPath$``
* Parameters: ``setup.py clean``
* Working directory: ``$ProjectFileDir$``
- Add Run/Debug Configuration, select "Python tests" and therein "Nosetests":
* If you want dependencies to auto-update on run if necessary (recommended): "Before Launch" > "+" > "Run external tool" > "+"
* Name: OctoPrint nosetests
* Target: Path, ``.``
* Name: Update OctoPrint dependencies
* Program: ``$ModuleSdkPath$``
* Parameters: ``-m pip install -e .[develop,plugins]``
* Working directory: ``$ProjectFileDir$``
- Add Run/Debug Configuration, select "Python tests" and therein "pytest":
* Name: OctoPrint pytest
* Target: Custom
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
+1
View File
@@ -9,3 +9,4 @@ Development
environment.rst
virtual_printer.rst
profiling.rst
+20
View File
@@ -0,0 +1,20 @@
.. _sec-request-profiling:
Profiling requests
==================
Once you have a development environment set up, you will need to launch
OctoPrint using ``serve --debug`` as parameters.
At this point, you are able to make the exact same requests as before. To
profile a specific request, just add ``?perfprofile`` or ``&perfprofile`` to the
request parameters. The request will be rendered as usual, but you will receive
an html document with the profiling results instead of the contents of the
response.
Errors
------
If you receive a ``500: Internal Server Error`` and a ``ModuleNotFoundError: No
module named 'pyinstrument'`` in the console, you didn't install development
dependencies. Do that now using ``pip install -e '.[develop]'``.
+175 -22
View File
@@ -3,7 +3,7 @@
Setting up the virtual printer for debugging
============================================
OctoPrint includes, by default, a virtual printer plugin. This plugin allows you to debug OctoPrint's serial
OctoPrint includes, by default, a :ref:`virtual printer plugin <sec-bundledplugins-virtual_printer>`. This plugin allows you to debug OctoPrint's serial
communication without connecting to an actual printer. Furthermore, it is possible to create certain edge conditions
that may be hard to reproduce with a real printer.
@@ -12,33 +12,186 @@ that may be hard to reproduce with a real printer.
Enabling the virtual printer
----------------------------
The virtual printer is enabled by editing OctoPrint's config.yaml file. Details on the configuration file can
be found in the full :ref:`config.yaml documentation <sec-configuration-config_yaml>`.
The steps to take are as follows:
* Find config.yaml in the OctoPrint settings folder. Usually in ``~/.octoprint`` on Linux, in ``%APPDATA%/OctoPrint`` on Windows and in ``~/Library/Application Support/OctoPrint`` on MacOS.
* Add or extend the ``devel`` section with:
.. code-block:: yaml
devel:
virtualPrinter:
enabled: true
* Restart OctoPrint.
* In the connection panel, a new option will appear in the Serial Port dropdown labeled ``VIRTUAL``.
* Select this option and click ``connect``.
* The virtual printer is now active.
The virtual printer can be enabled through its Settings pane.
.. _sec-development-virtual-printer-config:
Virtual printer configuration options
-------------------------------------
The config.yaml file has many configuration options for the virtual printer that allow you to fine-tune its behavior.
There many configuration options via ``config.yaml`` for the virtual printer that allow you to fine-tune its behavior:
Please see the relevant :ref:`config.yaml section <sec-configuration-config_yaml-devel>` for the full details.
.. code-block:: yaml
plugins:
# Settings for the virtual printer
virtual_printer:
# Whether to enable the virtual printer and include it in the list of available serial connections.
# Defaults to false.
enabled: true
# Whether to send an additional "ok" after a resend request (like Repetier)
okAfterResend: false
# Whether to force checksums and line number in the communication (like Repetier), if set to true
# printer will only accept commands that come with linenumber and checksum and throw an error for
# lines that don't. Defaults to false
forceChecksum: false
# Whether to send "ok" responses with the line number that gets acknowledged by the "ok". Defaults
# to false.
okWithLinenumber: false
# Number of extruders to simulate on the virtual printer. Map from tool id (0, 1, ...) to temperature
# in °C
numExtruders: 1
# Allows pinning certain hotends to a fixed temperature
pinnedExtruders: null
# Whether to include the current tool temperature in the M105 output as separate T segment or not.
#
# True: > M105
# < ok T:23.5/0.0 T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
# False: > M105
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
includeCurrentToolInTemps: true
# Whether to include the selected filename in the M23 File opened response.
#
# True: > M23 filename.gcode
# < File opened: filename.gcode Size: 27
# False: > M23 filename.gcode
# > File opened
includeFilenameInOpened: true
# Whether the simulated printer should also simulate a heated bed or not
hasBed: true
# Whether the simulated printer should also simulate a heated chamber or not
hasChamber: false
# If enabled, reports the set target temperatures as separate messages from the firmware
#
# True: > M109 S220.0
# < TargetExtr0:220.0
# < ok
# > M105
# < ok T0:34.3 T1:23.5 B:43.2
# False: > M109 S220.0
# < ok
# > M105
# < ok T0:34.3/220.0 T1:23.5/0.0 B:43.2/0.0
repetierStyleTargetTemperature: false
# If enabled, uses repetier style resends, sending multiple resends for the same line
# to make sure nothing gets lost on the line
repetierStyleResends: false
# If enabled, ok will be sent before a commands output, otherwise after or inline (M105)
#
# True: > M20
# < ok
# < Begin file list
# < End file list
# False: > M20
# < Begin file list
# < End file list
# < ok
okBeforeCommandOutput: false
# If enabled, reports the first extruder in M105 responses as T instead of T0
#
# True: > M105
# < ok T:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
# False: > M105
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
smoothieTemperatureReporting: false
# Whether M20 responses will include filesize or not
#
# True: <filename> <filesize in bytes>
# False: <filename>
extendedSdFileList: false
# Forced pause for retrieving from the outgoing buffer
throttle: 0.01
# Whether to send "wait" responses every "waitInterval" seconds when serial rx buffer is empty
sendWait: false
# Interval in which to send "wait" lines when rx buffer is empty
waitInterval: 1
# Size of the simulated RX buffer in bytes, when it's full a send from OctoPrint's
# side will block
rxBuffer: 64
# Size of simulated command buffer, number of commands. If full, buffered commands will block
# until a slot frees up
commandBuffer: 4
# Whether to support the M112 command with simulated kill
supportM112: true
# Whether to send messages received via M117 back as "echo:" lines
echoOnM117: true
# Whether to simulate broken M29 behaviour (missing ok after response)
brokenM29: true
# Whether F is supported as individual command
supportF: false
# Firmware name to report (useful for testing firmware detection)
firmwareName: Virtual Marlin 1.0
# Simulate a shared nozzle
sharedNozzle: false
# Send "busy" messages if busy processing something
sendBusy: false
# Simulate a reset on connect
simulateReset: true
# Lines to send on simulated reset
resetLines:
- start
- "Marlin: Virtual Marlin!"
- "SD card ok"
# Initial set of prepared oks to use instead of regular ok (e.g. to simulate
# mis-sent oks). Can also be filled at runtime via the debug command prepare_ok
preparedOks: []
# Format string for ok response.
#
# Placeholders:
# - lastN: last acknowledged line number
# - buffer: empty slots in internal command buffer
#
# Example format string for "extended" ok format:
# ok N{lastN} P{buffer}
okFormatString: ok
# Format string for M115 output.
#
# Placeholders:
# - firmare_name: The firmware name as defined in firmwareName
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-development-virtual-printer-log:
@@ -46,7 +199,7 @@ 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.
that can be found in the OctoPrint logs folder.
.. _sec-development-virtual-printer-debug:
+53 -7
View File
@@ -100,20 +100,44 @@ Shutdown
The server is shutting down.
ClientOpened
A client has connected to the web server.
A client has connected to the push socket.
Payload:
* ``remoteAddress``: the remote address (IP) of the client that connected
* ``remoteAddress``: the remote address (IP) of the client that connected. On the push socket only available with
a valid login session.
**Note:** Name changed in version 1.1.0
ClientClosed
A client has disconnected from the webserver
ClientAuthed
A client has authenticated a user session on the push socket.
Payload:
* ``remoteAddress``: the remote address (IP) of the client that disconnected
* ``remoteAddress``: the remote address (IP) of the client that authed. On the push socket only available with a
valid login session.
* ``username``: the name of the user who authed. On the push socket only available with a valid login session.
ClientClosed
A client has disconnected from the push socket.
Payload:
* ``remoteAddress``: the remote address (IP) of the client that disconnected. On the push socket only available
with a valid login session.
UserLoggedIn
A user logged in. On the push socket only available with a valid login session with admin rights.
Payload:
* ``username``: the name of the user who logged in
UserLoggedOut
A user logged out. On the push socket only available with a valid login session with admin rights.
Payload:
* ``username``: the name of the user who logged out
ConnectivityChanged
The server's internet connectivity changed
@@ -151,6 +175,9 @@ Error
An unrecoverable error has been encountered, either as reported by the firmware (e.g. a thermal runaway) or
on the connection.
Note that this event will not fire for error messages from the firmware that are handled (and as such recovered from)
either by OctoPrint or a plugin.
Payload:
* ``error``: the error string
@@ -170,12 +197,15 @@ File handling
-------------
Upload
A file has been uploaded through the web interface.
A file has been uploaded through the :ref:`REST API <sec-api-fileops-uploadfile>`.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``target``: the target storage location to which the file was uploaded, either ``local`` or ``sdcard``
* ``select``: whether the file will immediately be selected, as requested on the API by the corresponding parameter
* ``print``: whether the file will immediately start printing, as requested on the API by the corresponding parameter
* ``userdata``: optional ``userdata`` if provided on the API, will only be present if supplied in the upload request
.. deprecated:: 1.3.0
@@ -588,6 +618,7 @@ SlicingStarted
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
@@ -599,6 +630,7 @@ SlicingDone
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
@@ -611,6 +643,7 @@ SlicingCancelled
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
@@ -621,6 +654,7 @@ SlicingFailed
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
@@ -636,7 +670,7 @@ SlicingProfileAdded
* ``profile``: the profile that was added
SlicingProfileModified
A new slicing profile was modified.
A slicing profile was modified.
Payload:
@@ -661,3 +695,15 @@ SettingsUpdated
This event may also be triggered if calling code of :py:class:`octoprint.settings.Settings.save` or
:py:class:`octoprint.plugin.PluginSettings.save` sets the ``trigger_event`` parameter to ``True``.
.. _sec-events-available_events-printer_profile:
Printer Profile
---------------
PrinterProfileModified
A printer profile was modified.
Payload:
* ``identifier``: the identifier of the modified printer profile
+39 -4
View File
@@ -3,8 +3,20 @@
Access Control
==============
When Access Control is enabled, anonymous users (not logged in) will only see
the read-only parts of the UI which are the following:
OctoPrint's bundled access control feature allows granular permission control
over which users or user groups are allowed to access which parts of OctoPrint.
The default permissions will deny any kind of access to anonymous (not logged in)
users out of the box.
.. warning::
Please note that OctoPrint does *not* control the webcam and merely embeds it, and
thus also cannot limit access to it. If an anonymous user correctly guesses the
webcam URL, they will thus be able to see it.
If read-only access for anonymous users is enabled, anonymous users will have
read-only access to the following parts of the UI:
* printer state
* available gcode files and stats (upload is disabled)
@@ -16,8 +28,8 @@ the read-only parts of the UI which are the following:
* any components provided through plugins which are enabled for anonymous
users
Logged in users will get access to everything besides the Settings and System
Commands, which are admin-only.
Logged in users without admin flag will be allowed to access everything besides the
Settings and System 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
@@ -39,6 +51,29 @@ internet or other untrusted networks!).
publicly reachable by everyone with an internet connection, even with access
control enabled.
.. _sec-features-access_control-hooks:
Available Extension Hooks
-------------------------
There are two hooks for plugins to utilize in order to
add new configurable permissions into the system and/or adjust the styling of the
login dialog.
.. _sec-features-access_control-hooks-permissions:
octoprint.access.permissions
............................
See :ref:`here <sec-plugins-hook-permissions>`.
.. _sec-features-access_control-hooks-loginui:
octoprint.plugin.loginui.theming
................................
See :ref:`here <sec-bundledplugins-loginui-hooks-theming>`.
.. _sec-features-access_control-rerunning_wizard:
Rerunning the wizard
+2 -2
View File
@@ -210,12 +210,12 @@ Controls
* - ``input.slider.step``
- (Optional) Step size per slider "tick", defaults to 1.
* - ``regex``
- (Optional) A `regular expression <https://docs.python.org/2/library/re.html#regular-expression-syntax>`_ to
- (Optional) A :ref:`regular expression <re-syntax>` to
match against lines received from the printer to retrieve information from it (e.g. specific output). Together
with ``template`` this allows rendition of received data from the printer within the UI.
* - ``template``
- (Optional) A template to use for rendering the match of ``regex``. May contain placeholders in
`Python Format String Syntax <https://docs.python.org/2/library/string.html#format-string-syntax>`_ for either named
:ref:`Python Format String Syntax <formatstrings>` for either named
groups within the regex (e.g. ``Temperature: {temperature}`` for a regex ``T:\s*(?P<temperature>\d+(\.\d*)``)
or positional groups within the regex (e.g. ``Position: X={0}, Y={1}, Z={2}, E={3}`` for a regex
``X:([0-9.]+) Y:([0-9.]+) Z:([0-9.]+) E:([0-9.]+)``).
+4 -11
View File
@@ -11,20 +11,14 @@ is clicked.
Unless :ref:`configured otherwise <sec-configuration-config_yaml-folder>`, OctoPrint expects scripts to be located in
the ``scripts/gcode`` folder in OctoPrint configuration directory (per default ``~/.octoprint`` on Linux, ``%APPDATA%\OctoPrint``
on Windows and ``~/Library/Application Support/OctoPrint`` on MacOS).
on Windows and ``~/Library/Application Support/OctoPrint`` on macOS).
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 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.
You can find the docs on the Jinja templating engine as used in OctoPrint `here <https://jinja.palletsprojects.com/en/2.11.x/templates/>`_.
.. _sec-features-gcode_scripts-predefined:
@@ -250,7 +244,6 @@ to the persisted pause position on resume, making sure to also reset the extrude
.. seealso::
`Jinja Template Designer Documentation <http://jinja.octoprint.org/templates.html>`_
`Jinja Template Designer Documentation <https://jinja.palletsprojects.com/en/2.11.x/templates/>`_
Jinja's Template Designer Documentation describes the syntax and semantics of the template language used
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.
also by OctoPrint's GCODE scripts.
+1 -1
View File
@@ -28,7 +28,7 @@ Finding Plugins
The official OctoPrint Plugin Repository can be found at `plugins.octoprint.org <http://plugins.octoprint.org>`_.
Some plugins may also be found in the list provided in `the OctoPrint wiki <https://github.com/foosel/OctoPrint/wiki#plugins>`_
Some plugins may also be found in the list provided in `the OctoPrint wiki <https://github.com/OctoPrint/OctoPrint/wiki#plugins>`_
and on the `OctoPrint organization Github page <https://github.com/OctoPrint>`_.
.. _sec-features-plugins-installing:
+17 -10
View File
@@ -5,19 +5,20 @@ Safe mode
*********
With the advent of support for plugins in OctoPrint, it quickly became apparent that some of the bugs
reported on OctoPrint's bug tracker were actually bugs with installed third party plugins instead of
OctoPrint itself.
reported on OctoPrint's bug tracker were actually bugs with installed third party plugins or language
packs instead of OctoPrint itself.
To allow an easier identification of these cases, OctoPrint 1.3.0 introduced safe mode. Starting
OctoPrint in safe mode disables all plugins that are not bundled with OctoPrint, allowing to easier
identify most cases where a third party plugin is the culprit of an observed issue.
OctoPrint in safe mode disables all plugins (and starting with 1.3.13 also all language packs) that are
not bundled with OctoPrint, allowing to easier identify most cases where a third party plugin or language
pack is the culprit of an observed issue.
Additionally, OctoPrint allows uninstalling plugins in this mode, allowing recovery from cases where
a third party plugin causes the server to not start up or the web interface to not render or function
correctly anymore.
Additionally, OctoPrint allows uninstalling plugins and language packs in this mode, allowing recovery
from cases where a third party addition 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.
ensure it really is an issue in OctoPrint itself and now caused by one of your installed third party additions.
.. _sec-features-safemode-how:
@@ -73,11 +74,17 @@ When OctoPrint is running in safe mode the following changes to its normal opera
* OctoPrint will not enable any of the installed third party plugins. OctoPrint considers all plugins third
party plugins that do not ship with OctoPrint's sources, so any plugins installed either via `pip` or
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint`` (Windows) and
``~/Library/Application Support/OctoPrint`` (MacOS).
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint/plugins`` (Windows) and
``~/Library/Application Support/OctoPrint/plugins`` (macOS).
* OctoPrint will not enable any of the installed third party language packs. OctoPrint considers all language packs
third party language packs that do not ship with OctoPrint's sources, so any language plugins installed
through the language pack manager within settings and/or stored in the language pack folder at
``~/.octoprint/translations`` (Linux), ``%APPDATA%/OctoPrint/translations`` (Windows) or
``~/Library/Application Support/OctoPrint/translations`` (macOS).
* OctoPrint will still allow to uninstall third party plugins through the built-in Plugin Manager.
* OctoPrint will still allow to disable (bundled) plugins that are still enabled.
* OctoPrint will not allow to enable third party plugins.
* OctoPrint will still allow to manage language packs.
* OctoPrint's web interface will display a notification to remind you that it is running in
safe mode.
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 58 KiB

+2 -2
View File
@@ -144,7 +144,7 @@
Sets the current flowrate multiplier.
``factor`` is expected to be a integer value between 75 and 125 representing the new flowrate percentage.
``factor`` is expected to be a integer value >0 representing the new flowrate percentage.
See the ``flowrate`` command in :ref:`Issue a tool command <sec-api-printer-toolcommand>` for more details.
@@ -325,7 +325,7 @@
Sets the feedrate multiplier to use.
``factor`` is expected to be a integer value between 0 and 200 representing the new feedrate percentage.
``factor`` is expected to be a integer value >0 representing the new feedrate percentage.
See the ``feedrate`` command in :ref:`Issue a print head command <sec-api-printer-printheadcommand>` for more details.
+1 -1
View File
@@ -42,7 +42,7 @@
To register for all message types, provide ``*`` as the type to register for.
``handler`` is expected to be a function accepting one object parameter ``eventObj``, consisting
of the received message as property ``key`` and the received payload (if any) as property ``data``.
of the received message as property ``event`` and the received payload (if any) as property ``data``.
.. code-block:: javascript
+25 -1
View File
@@ -187,7 +187,7 @@
.. code-block:: javascript
OctoPrint.util.testUrl("127.0.0.1", 1234, {"protocol": "udp"})
OctoPrint.util.testServer("127.0.0.1", 1234, {"protocol": "udp"})
.done(function(response) {
if (response.result) {
// check passed
@@ -203,6 +203,30 @@
: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.testResolution(name, additional, opts)
Test if a host name can be resolved.
**Example**
Test if ``octoprint.org`` can be resolved.
.. code-block:: javascript
OctoPrint.util.testResolution("octoprint.org")
.done(function(response) {
if (response.result) {
// check passed
} else {
// check failed
}
});
:param string name: Host name 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>`
-242
View File
@@ -1,242 +0,0 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\OctoPrint.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\OctoPrint.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %BUILDDIR%/..
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %BUILDDIR%/..
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end
+3
View File
@@ -4,6 +4,7 @@ octoprint.plugin
----------------
.. automodule:: octoprint.plugin
:members:
.. _sec-modules-plugin-core:
@@ -11,6 +12,7 @@ octoprint.plugin.core
---------------------
.. automodule:: octoprint.plugin.core
:members:
.. _sec-modules-plugin-types:
@@ -18,3 +20,4 @@ octoprint.plugin.types
----------------------
.. automodule:: octoprint.plugin.types
:members:
+2
View File
@@ -4,6 +4,7 @@ octoprint.printer
-----------------
.. automodule:: octoprint.printer
:members:
.. _sec-modules-printer-profile:
@@ -11,3 +12,4 @@ octoprint.printer.profile
-------------------------
.. automodule:: octoprint.printer.profile
:members:
+1
View File
@@ -4,3 +4,4 @@ octoprint.settings
------------------
.. automodule:: octoprint.settings
:members:
+3 -1
View File
@@ -4,10 +4,12 @@ octoprint.slicing
-----------------
.. automodule:: octoprint.slicing
:members:
.. _sec-modules-slicing-exceptions:
octoprint.slicing.exceptions
----------------------------
.. automodule:: octoprint.slicing.exceptions
.. automodule:: octoprint.slicing.exceptions
:members:
+8
View File
@@ -13,3 +13,11 @@ octoprint.util.commandline
.. automodule:: octoprint.util.commandline
:members:
.. _sec-modules-util-platform:
octoprint.util.platform
-----------------------
.. automodule:: octoprint.util.platform
:members:
+23 -6
View File
@@ -14,7 +14,7 @@ First of all let use make sure that you have OctoPrint checked out and set up fo
development environment::
$ cd ~/devel
$ git clone https://github.com/foosel/OctoPrint
$ git clone https://github.com/OctoPrint/OctoPrint
[...]
$ cd OctoPrint
$ virtualenv venv
@@ -41,6 +41,9 @@ development environment::
[...]
Setting up a local development environment will most likely be less painful than developing directly
on the Pi. So do yourself the favor and do that instead where possible.
.. important::
This tutorial assumes you are running OctoPrint 1.3.0 and up. Please make sure your version of
@@ -60,6 +63,7 @@ We'll start at the most basic form a plugin can take - just a few simple lines o
__plugin_name__ = "Hello World"
__plugin_version__ = "1.0.0"
__plugin_description__ = "A quick \"Hello World\" example plugin for OctoPrint"
__plugin_pythoncompat__ = ">=2.7,<4"
Saving this as ``helloworld.py`` in ``~/.octoprint/plugins`` yields you something resembling these log entries upon server startup::
@@ -75,7 +79,10 @@ Saving this as ``helloworld.py`` in ``~/.octoprint/plugins`` yields you somethin
OctoPrint found that plugin in the folder and took a look into it. The name and the version it displays in that log
entry it got from the ``__plugin_name__`` and ``__plugin_version__`` lines. It also read the description from
``__plugin_description__`` and stored it in an internal data structure, but we'll just ignore this for now.
``__plugin_description__`` and stored it in an internal data structure, but we'll just ignore this for now. Additionally
there is ``__plugin_pythoncompat__`` which tells OctoPrint here that your plugin can be run under any Python versions
between 2.7 and 4. That is necessary so that your plugin will be loadable in OctoPrint instances running under either
Python 2 or Python 3, and compatibility to both should be your goal.
.. _sec-plugins-gettingstarted-sayinghello:
@@ -86,7 +93,7 @@ Apart from being discovered by OctoPrint, our plugin does nothing yet. We want t
"Hello World!" to the log upon server startup. Modify our ``helloworld.py`` like this:
.. code-block:: python
:emphasize-lines: 4-8,13
:emphasize-lines: 4-8,14
:linenos:
# -*- coding: utf-8 -*-
@@ -101,6 +108,7 @@ Apart from being discovered by OctoPrint, our plugin does nothing yet. We want t
__plugin_name__ = "Hello World"
__plugin_version__ = "1.0.0"
__plugin_description__ = "A quick \"Hello World\" example plugin for OctoPrint"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
and restart OctoPrint. You now get this output in the log::
@@ -135,7 +143,7 @@ as a simple python file following the naming convention ``<plugin identifier>.py
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
install directly via `OctoPrint's built-in Plugin Manager <https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager>`_
install directly via `OctoPrint's built-in Plugin Manager <https://docs.octoprint.org/en/master/bundledplugins/pluginmanager.html>`_
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
@@ -284,7 +292,7 @@ of information now defined twice:
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``:
and ``__plugin_description__`` from ``__init__.py``, but leave ``__plugin_implementation__`` and ``__plugin_pythoncompat__``:
.. code-block:: python
:linenos:
@@ -298,6 +306,7 @@ and ``__plugin_description__`` from ``__init__.py``:
def on_after_startup(self):
self._logger.info("Hello World!")
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
and restart OctoPrint::
@@ -324,6 +333,7 @@ Our "Hello World" Plugin still gets detected fine, but it's now listed under the
self._logger.info("Hello World!")
__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
@@ -373,6 +383,7 @@ add the :class:`TemplatePlugin` to our ``HelloWorldPlugin`` class:
self._logger.info("Hello World!")
__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
Next, we'll create a sub folder ``templates`` underneath our ``octoprint_helloworld`` folder, and within that a file
@@ -443,6 +454,7 @@ Let's take a look at how all that would look in our plugin's ``__init__.py``:
return dict(url="https://en.wikipedia.org/wiki/Hello_world")
__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
Restart OctoPrint. You should see something like this::
@@ -480,6 +492,7 @@ Adjust your plugin's ``__init__.py`` like this:
return dict(url=self._settings.get(["url"]))
__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
Also adjust your plugin's ``templates/helloworld_navbar.jinja2`` like this:
@@ -590,6 +603,7 @@ again since we don't use that anymore:
]
__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
Restart OctoPrint and shift-reload your browser. Your link in the navigation bar should still point to the URL we
@@ -693,6 +707,7 @@ like so:
)
__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
Note how we did not add another entry to the return value of :func:`~octoprint.plugin.TemplatePlugin.get_template_configs`.
@@ -875,6 +890,7 @@ a reference to our CSS file:
)
__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
OctoPrint by default bundles all CSS, JavaScript and LESS files to reduce the amount of requests necessary to fully
@@ -961,6 +977,7 @@ Then adjust our returned assets to include our LESS file as well:
)
__plugin_name__ = "Hello World"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = HelloWorldPlugin()
@@ -1074,7 +1091,7 @@ you haven't seen yet, :ref:`take a look at the available plugin mixins <sec-plug
For some insight on how to create plugins that react to various events within OctoPrint,
`the Growl Plugin <https://github.com/OctoPrint/OctoPrint-Growl>`_ might be a good example to learn from. For how to
add support for a slicer, OctoPrint's own bundled `CuraEngine plugin <https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura>`_
add support for a slicer, the `CuraEngine Legacy plugin <https://github.com/OctoPrint/OctoPrint-CuraEngineLegacy>`_
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
`official Plugin Repository <http://plugins.octoprint.org>`_ if you are looking for examples.
+1 -1
View File
@@ -7,7 +7,7 @@ Helpers are methods that plugins can expose to other plugins in order to make co
system. They are registered with the OctoPrint plugin system through the use of the control property ``__plugin_helpers__``.
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>`_,
`Discovery Plugin <https://docs.octoprint.org/en/master/bundledplugins/discovery.html>`_,
which provides its SSDP browsing and Zeroconf browsing and publishing functions as helper methods.
.. code-block:: python
+140 -51
View File
@@ -65,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/foosel/OctoPrint/tree/master/src/octoprint/plugins/softwareupdate>`_
Plugins can easily add their own hooks too. For example, the `Software Update Plugin <https://docs.octoprint.org/en/master/bundledplugins/softwareupdate.html>`_
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.
@@ -200,6 +200,94 @@ Available plugin hooks
.. contents::
:local:
.. _sec-plugins-hook-permissions:
octoprint.access.permissions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: additional_permissions_hook(*args, **kwargs)
Return a list of additional permissions to register in the system on behalf of the plugin. Use this
to add granular permissions to your plugin which can be configured for users and user groups in the general
access control settings of OctoPrint.
Additional permissions must be modelled as ``dict``s with at least a ``key`` and ``name`` field. Possible
fields are as follows:
* ``key``: A key for the permission to be used for referring to it from source code. This will turned uppercase
and prefixed with ``PLUGIN_<PLUGIN IDENTIFIER>_`` before being made available on ``octoprint.access.permissions.Permissions``,
e.g. ``my_permission`` on the plugin with identifier ``example`` turns into ``PLUGIN_EXAMPLE_MY_PERMISSION`` and
can be accessed as ``octoprint.access.permissions.Permissions.PLUGIN_EXAMPLE_MY_PERMISSION`` on the server and
``permissions.PLUGIN_EXAMPLE_MY_PERMISSION`` on the ``AccessViewModel`` on the client. Must only contain a-z, A-Z, 0-9 and _.
* ``name``: A human readable name for the permission.
* ``description``: A human readable description of the permission.
* ``permissions``: A list of permissions this permission includes, by key.
* ``roles``: A list of roles this permission includes. Roles are simple strings you define. Usually one role will
suffice.
* ``dangerous``: Whether this permission should be considered dangerous (``True``) or not (``False``)
* ``default_groups``: A list of standard groups this permission should be apply to by default. Standard groups
are ``admins``, ``users``, ``readonly`` and ``guests``
The following example is based on some actual code included in the bundled Application Keys plugin and defines
one additional permission called ``ADMIN`` with a role ``admin`` which is marked as dangerous (since it gives
access to the management to other user's application keys) and by default will only be given to the standard admin
group:
.. code-block:: python
def get_additional_permissions(*args, **kwargs):
return [
dict(key="ADMIN",
name="Admin access",
description=gettext("Allows administrating all application keys"),
roles=["admin"],
dangerous=True,
default_groups=[ADMIN_GROUP])
]
__plugin_hooks__ = {
"octoprint.access.permissions": get_additional_permissions
}
Once registered it can be referenced under the key ``PLUGIN_APPKEYS_ADMIN``.
:return: A list of additional permissions to register in the system.
:rtype: A list of dicts.
.. _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-accesscontrol-keyvalidator:
octoprint.accesscontrol.keyvalidator
@@ -384,12 +472,12 @@ octoprint.comm.protocol.firmware.info
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 str firmware_name: The parsed name of the firmware
:param dict firmware_data: All data contained in the ``M115`` report
.. _sec-plugins-hook-comm-protocol-firmware-capabilities:
octoprint.comm.firmware.protocol.capabilities
octoprint.comm.protocol.firmware.capabilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: firmware_capability_hook(comm_instance, capability, enabled, already_defined, *args, **kwargs)
@@ -802,6 +890,25 @@ octoprint.comm.protocol.temperatures.received
:tab-width: 4
:caption: `sanitize_temperatures.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/sanitize_temperatures.py>`_
.. _sec-plugins-hook-comm-transport-serial-additonal-port-names:
octoprint.comm.transport.serial.additional_port_names
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. py:function:: additional_port_names_hook(candidates, *args, **kwargs)
Return additional port names (not glob patterns!) to use as a serial connection to the printer. Expected to be
``list`` of ``string``s.
Useful in combination with :ref:`octoprint.comm.transport.serial.factory <sec-plugins-hook-comm-transport-serial-factory>`
to implement custom serial-like ports through plugins.
For an example of use see the bundled ``virtual_printer`` plugin.
:param list candidates: The port names already found on the system available for connection.
:return: Additional port names to offer up for connection.
:rtype: list
.. _sec-plugins-hook-comm-transport-serial-factory:
octoprint.comm.transport.serial.factory
@@ -819,21 +926,21 @@ octoprint.comm.transport.serial.factory
closely if directly utilizing :class:`~octoprint.util.comm.MachineCom` functionality.
A valid serial instance is expected to provide the following methods, analogue to PySerial's
`serial.Serial <https://pythonhosted.org//pyserial/pyserial_api.html#serial.Serial>`_:
:py:class:`serial.Serial`:
readline(size=None, eol='\n')
Reads a line from the serial connection, compare `serial.Filelike.readline <https://pythonhosted.org//pyserial/pyserial_api.html#serial.FileLike.readline>`_.
Reads a line from the serial connection, compare :py:meth:`serial.Serial.readline`.
write(data)
Writes data to the serial connection, compare `serial.Filelike.write <https://pythonhosted.org//pyserial/pyserial_api.html#serial.FileLike.write>`_.
Writes data to the serial connection, compare :py:meth:`serial.Serial.write`.
close()
Closes the serial connection, compare `serial.Serial.close <https://pythonhosted.org//pyserial/pyserial_api.html#serial.Serial.close>`_.
Closes the serial connection, compare :py:meth:`serial.Serial.close`.
Additionally setting the following attributes need to be supported if baudrate detection is supposed to work:
baudrate
An integer describing the baudrate to use for the serial connection, compare `serial.Serial.baudrate <https://pythonhosted.org//pyserial/pyserial_api.html#serial.Serial.baudrate>`_.
An integer describing the baudrate to use for the serial connection, compare :py:attr:`serial.Serial.baudrate`.
timeout
An integer describing the read timeout on the serial connection, compare `serial.Serial.timeout <https://pythonhosted.org//pyserial/pyserial_api.html#serial.Serial.timeout>`_.
An integer describing the read timeout on the serial connection, compare :py:attr:`serial.Serial.timeout`.
**Example:**
@@ -1014,6 +1121,27 @@ octoprint.filemanager.preprocessor
:return: The `file_object` as passed in or None, or a replaced version to use instead for further processing.
:rtype: AbstractFileWrapper or None
.. _sec-plugins-hook-plugin-loginui-theming:
octoprint.plugin.loginui.theming
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See :ref:`here <sec-bundledplugins-loginui-hooks-theming>`.
.. _sec-plugins-hook-plugin-pluginmanager-reconnect:
octoprint.plugin.pluginmanager.reconnect_hooks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See :ref:`here <sec-bundledplugins-pluginmanager-hooks-reconnect_hooks>`.
.. _sec-plugins-hook-plugin-softwareupdate-check_config:
octoprint.plugin.softwareupdate.check_config
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See :ref:`here <sec-bundledplugins-softwareupdate-hooks-check_config>`.
.. _sec-plugins-hook-printer-factory:
octoprint.printer.factory
@@ -1185,8 +1313,7 @@ octoprint.server.api.after_request
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.
Your plugin might need this to further restrict access to API methods.
.. important::
@@ -1201,8 +1328,7 @@ octoprint.server.api.before_request
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.
Your plugin might need this to further restrict access to API methods.
.. important::
@@ -1217,8 +1343,7 @@ octoprint.server.http.access_validator
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.
Your plugin might need to this to restrict acccess to downloads and webcam snapshots further.
.. important::
@@ -1342,8 +1467,6 @@ octoprint.server.sockjs.authed
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
@@ -1525,40 +1648,6 @@ octoprint.ui.web.templatetypes
: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
+1
View File
@@ -16,3 +16,4 @@ Developing Plugins
viewmodels.rst
gettingstarted.rst
distributing.rst
python3_migration.rst
+1 -1
View File
@@ -22,7 +22,7 @@ An overview of these properties follows.
data files etc). Plugins should not access this property directly but instead utilize :func:`~octoprint.plugin.types.OctoPrintPlugin.get_plugin_data_folder`
which will make sure the path actually does exist and if not create it before returning it.
``self._logger``
A `python logger instance <https://docs.python.org/2/library/logging.html>`_ logging to the log target
A :py:class:`logging.Logger` instance logging to the log target
``octoprint.plugin.<plugin identifier>``.
``self._settings``
The plugin's personalized settings manager, injected only into plugins that include the :class:`~octoprint.plugin.SettingsPlugin` mixin.
+1 -1
View File
@@ -166,7 +166,7 @@ Now, the execution order of the ``on_after_startup`` method will be determined b
This will result in the following messages to be generated:
.. code-block:: plain
.. code-block:: none
Plugin B starting up
Plugin C starting up
+377
View File
@@ -0,0 +1,377 @@
.. _sec-plugins-python3:
Migrating to Python 3
=====================
Python 2 is now EOL as of January 1st 2020. With the release of 1.4.0 OctoPrint will be compatible to both Python 2 and
Python 3.
However, the same doesn't automatically hold true for all of the third party plugins for OctoPrint out there - it will
fall to their authors to ensure compatibility to both Python versions.
This guide is supposed to help plugin authors in making sure their plugins run under Python 2 as well as Python 3,
which for now is the goal for OctoPrint's ecosystem, as we'll have to live with existing legacy Python 2 installations
for a while to come (the plan is to stay Python 2 compatible until roughly a year after the release of 1.4.0).
.. contents::
:local:
.. _sec-plugins-python3-venv:
How to get a Python 3 virtual environment with OctoPrint
--------------------------------------------------------
In order to test your plugins for Python 3 compatibility and also to allow for ongoing maintenance against both Python
versions, you should create a Python 3 virtual environment next to your Python 2 one. You can then quickly switch between
Python 2 and Python 3 simply by ``activate``-ing whichever one you need.
You can create a Python 3 virtualenv next to your (existing) Python 2 virtualenv and then just activate which one you
currently want to use.
After installing Python 3 on your development system it's as easy as supplying ``--python=/path/to/python3executable``
to ``virtualenv``, e.g.:
.. code-block:: none
virtualenv --python=/usr/bin/python3 venv3
That will have the virtualenv be created based on Python 3, regardless of whether it's currently running under Python
2 or 3. The same works for Python 2 btw:
.. code-block:: none
virtualenv --python=/usr/bin/python2 venv2
After creating the virtual environment, make sure to activate & install OctoPrint into it:
.. code-block:: none
source venv3/bin/activate
pip install "OctoPrint>=1.4.0rc1"
Then create an editable install of your plugin, start the server and start testing:
.. code-block:: none
pip install -e path/to/your/plugin
octoprint serve --debug
.. note::
On Windows that will probably look something like this instead:
.. code-block:: none
virtualenv --python=C:/Python37/python.exe venv37
venv3/Script/activate.bat
pip install "OctoPrint>=1.4.0rc1"
pip install -e path/to/your/plugin
octoprint serve --debug
.. note::
If you want to migrate your existing OctoPrint install *on OctoPi 0.17.0* to Python 3, I suggest to first make a
:ref:`backup <sec-bundledplugins-backup>`, then move the existing venv ``/home/pi/oprint`` out of the way and
create a new one based on Python 3 (which should already be present on current OctoPi images):
.. code-block:: none
mv ~/oprint ~/oprint.py2
virtualenv --python=/usr/bin/python3 oprint
source ~/oprint/bin/activate
pip install "OctoPrint>=1.4.0"
sudo service octoprint restart
.. _sec-plugins-python3-markup:
Telling OctoPrint your plugin is Python 3 ready
-----------------------------------------------
In order for OctoPrint to even load your plugin when it's running under Python 3, it first needs to know your plugin is
compatible to a Python 3 environment. By default OctoPrint will assume your plugin isn't and refuse to load it when
running under Python 3 itself.
To tell OctoPrint about this, all you need is to set the ``__plugin_pythoncompat__`` property in your plugins's ``__init__.py``
accordingly, e.g.
.. code-block:: python
__plugin_pythoncompat__ = ">=2.7,<4"
This would tell OctoPrint that your plugin is compatible to all Python versions between 2.7 and 3.x. This should be
your target compatibility range for now.
If at a later date you want to go all-in on Python 3 and mark your plugin as no longer supporting Python 2, tell
OctoPrint about this as well:
.. code-block:: python
__plugin_pythoncompat__ = ">=3,<4"
.. note::
You can also tell OctoPrint to ignore the Python compatibility flags for a specific plugin via `config.yaml`:
.. code-block:: yaml
plugins:
_forcedCompatible:
- "myplugin"
- "anotherplugin"
Note that this should only be used temporarily during testing and migration, or to mark an important plugin
not under your own control that actually works fine under Python 3 out of the box as compatible while waiting
until the plugin author has pushed an update including the needed flags. Do not just blindly mark third party
plugins as compatible and then open support requests if that causes issues in your setup.
Once your plugin is ensured to be compatible and you've released a new version that includes the necessary compatibility
flag and changes, is done you also need to mark up your plugin in the Official Plugin Repository (if it's registered
therein) so that OctoPrint's built-in Plugin Manager will see that your plugin is compatible as well and allow users
to install it through it. In order to do that, you need to add a new flag compatibility.python to the front matter in
your plugin registration file and file a pull request for that. Adjust the markdown file so that it contains this:
.. code-block:: yaml
compatibility:
python: ">=2.7,<3"
The value here follows the same mechanism as the ``__plugin_pythoncompat__`` property, so ``>=2.7,<3`` for 2 and 3
support and ``>=3,<4`` for 3+ support.
.. warning::
Do **not** just mark your plugin as compatible without diligent testing that it actually does work as expected and
without flooding ``octoprint.log`` with warnings and errors!
.. _sec-plugins-python3-pitfalls:
Common pitfalls during migration
--------------------------------
Some of the changes in Python 3 compared to Python 2 are sadly backwards incompatible and usually cause a number of
common issues in code written for Python 2 when run under Python 3. By now they are pretty well documented and there
exist a number of helpful and comprehensive migration guides, three of which I want to mention here.
One is the official Python 3 porting guide `Porting Python 2 Code to Python 3 <https://docs.python.org/3/howto/pyporting.html>`__
which sums up all the important changes and also gives hints on how best to go about running a project which supports
both versions for now.
The second is the `Writing Python 2-3 compatible code <https://python-future.org/compatible_idioms.html>`__ cheat sheet
from the Python-Future project, which is a comprehensive list of idioms that are compatible to both Python 2 and 3 and
will make your code run under both, utilizing `future <https://python-future.org/>`__ and `six <https://six.readthedocs.io/>`__.
I can strongly recommend this cheat sheet, it's what primarily guided me during the migration phase as well.
The third one is the free online book `Support Python 3: An in-depth guide <http://python3porting.com/toc.html>`__, and
especially its chapter on `Common migration problems <http://python3porting.com/problems.html>`__ in which you'll find
extensive descriptions of the most troublesome changes in Python 3 and how to overcome them. Please note that with
regards to the contents of this book, we are aiming for the "Python 2 and Python 3 without conversion" strategy, so
code that runs in both environments. Sadly this book is a bit outdated by now and still references some long-out versions
as "upcoming", so with regards to compatible idioms to use, best stick to the Python-Future cheat sheet.
Looking at the issues encountered by some plugin authors and also my own experiences during the Python 3 migration of
OctoPrint's code, the most common problems for these scenarios seem to be byte vs unicode issues, trouble with absolute
imports, changes in integer division behaviour and the switch of map, filter and zip to return iterators instead of
lists and causing issues in the following code due to that.
.. _sec-plugins-python3-pitfalls-strings:
Bytes vs unicode
................
One of if not the most problematic change between Python 2 and 3 surely must be the change in string handling. Under
Python 2 your basic string was a byte string, but it could also magically turn into a unicode string depending on what
you wrote into it. That did cause some confusion, especially in APIs, and caused quite a mess, which is why the decision
was made to go for distinct text and binary types instead, and making the string literal always be a (unicode) text.
.. note::
Please note that these changes in string handling also affect several Python APIs that operate on files and streams
and thus might also affect parts of OctoPrint's plugin interface that inherit from these APIs. Currently only one such
case has been reported, as OctoPrint's :py:class:`~octoprint.filemanager.util.LineProcessorStream` will return bytes
instead of str on its ``process_line`` function under Python 3 - so here's a heads-up if your plugin happens to utilize that.
Obviously, that will lead to issues in code using "just strings" when run under Python 2 vs 3. The first step to solve
these problems would be to make your scripts behave the same under Python 2 and 3 by putting this right at the top of
all your plugin's python files:
.. code-block:: python
from __future__ import unicode_literals
That will make your files behave as if they were running under Python 3, even when run under Python 2, and your string
literals will now be the text data type, which - annoyingly - is a different one under Python 2 vs 3, ``unicode`` vs ``str`` to
be exact. Heads-up here - under Python 2 there's also a ``str`` type, but that one is for binary data. Yes, I know, this
ain't fun.
In any case, once you've done this, make sure that everything in your code that should be text is text (``unicode`` under
Python 2, ``str`` under Python 3), and everything that should be binary is binary (``str`` under Python 2, ``bytes`` under Python 3).
A good rule of thumb is that you usually want to use text as much as possible within your application and only convert
to/from bytes at the outskirts, e.g. when writing to a file, a socket or something else machine like. Note that you do
NOT need to convert to bytes when implementing API endpoints that return JSON, as that should use text with unicode
anyhow.
OctoPrint includes two utility methods you should use to ensure your strings enter/exit your code in the right format,
under both Python versions: :py:func:`octoprint.util.to_bytes` and :py:func:`octoprint.util.to_unicode`. Use them to ensure the correct data
types and to avoid weird conversion and encoding issues during runtime.
You can read more about this specific issue in the corresponding section of the
`Python porting guide <https://docs.python.org/3/howto/pyporting.html#text-versus-binary-data>`__ and also in the
`cheat sheet <https://python-future.org/compatible_idioms.html#strings-and-bytes>`__.
.. _sec-plugins-python3-pitfalls-absolute-imports:
Absolute imports
................
Python 3 now defaults to absolute imports, meaning that trying to import a sub package with a
.. code-block:: python
import my_sub_package
will now fail with an error. You'll need to explicitly make the import a relative one:
.. code-block:: python
from . import my_sub_package
To make your code behave the same in that regard unter both Python 2 and Python 3, you should add the corresponding
future import:
.. code-block:: python
from __future__ import absolute_imports
You can read more about this specific issue in the
`cheat sheet <https://python-future.org/compatible_idioms.html#imports-relative-to-a-package>`__ and also in
`the book <http://python3porting.com/problems.html#relative-import-problems>`__.
.. _sec-plugins-python3-pitfalls-version-specific-imports:
Version specific imports
........................
Sometimes it is necessary to use an import statement that is explicitly related to a specific Python version, e.g. due to
a package change between Python 2 and 3. You can do this by first trying the Python 3 import and if that doesn't work
out trying the Python 2 import instead:
.. code-block:: python
try:
import queue
except ImportError:
import Queue as queue
This should be the preferred method of handling situations like this. If you actually do need to do explicit version
specific imports that cannot be handled this way, you can check for the Python version like this:
.. code-block:: python
import sys
if sys.version[0] == '2':
# Python 2 specific imports
else:
# Python 3 specific imports
.. _sec-plugins-python3-pitfalls-intdiv:
Integer division
................
When you divide two integers in Python 2 you'll get back an integer, rounded down. In Python 3 however you'll now get
a float. That means you might have to revisit some places where you do integer divisions and might rely on the result
to be an integer as well (e.g. when using a calculation result as an index in an array or something like that).
Yet again there's a future-import to apply to your files in order to at least have them behave the same in that regard
under both Python 2 and Python 3:
.. code-block:: python
from __future__ import division
You can read more about this specific issue in the `Python porting guide <https://docs.python.org/3/howto/pyporting.html#division>`__
and in the `cheat sheet <https://python-future.org/compatible_idioms.html#division>`__.
.. _sec-plugins-python3-pitfalls-iterators:
Iterators instead of list from map, filter, zip
...............................................
The built-in functions ``map``, ``filter`` and ``zip`` return a ``list`` with their result in Python 2. In Python 3 they have been
switched to returning iterators. That can cause trouble with code handling the result (e.g. if you try to return it as
part of a JSON response on an API endpoint).
The easiest way to solve this is to make sure to wrap any ``map``/``filter``/``zip`` calls into a ``list`` constructor if the result is
to be used outside of the calling code (even though that comes with a small performance penalty under Python 2):
.. code-block:: python
result1 = filter(lambda x: x is not None, my_collection)
result2 = list(filter(lambda x: x is not None, my_collection))
assert(isinstance(result1, list)) # Python 2 passes, Python 3 fails
assert(isinstance(result2, list)) # Python 2 and 3 pass
There also exist further options, take a look at the `cheat sheet <https://python-future.org/compatible_idioms.html#map>`__.
.. _sec-plugins-python3-checklist:
Checklist
---------
As a summary, follow this checklist to migrate your plugin to be compatible to both Python 2 and 3:
* Create a Python 3 virtualenv and install OctoPrint and your plugin into it for testing.
* Tell OctoPrint your plugin is Python 2 and 3 compatible by adding a new property ``__plugin_pycompat__`` to its
``__init__.py``:
.. code-block:: python
__plugin_pythoncompat__ = ">=2.7,<4"
* Add a compatibility header to all `py` files to ensure similar basic behaviour under Python 2 and Python 3:
.. code-block:: python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
* Thorougly test your plugin under Python 3. Pay special attention to any kind of string handling issues, integer
division, relative imports from your plugin package and how the results of ``map``, ``filter`` and ``zip`` are
used in your code, as those have proven to be the biggest issues during past migrations.
* Once everything works under both Python versions and you've prepared a new release of your plugin (don't forget to
increment the version!), update your registration file in the Official Plugin Repository to include the correct
Python compatibility information as well:
.. code-block:: yaml
compatibility:
python: ">=2.7,<4"
.. _sec-plugins-python3-furtherreading:
Further reading
---------------
.. seealso::
`Porting Python 2 Code to Python 3 <https://docs.python.org/3/howto/pyporting.html>`__
The official Python 3 porting guide which sums up all the important changes and also gives hints on how best to
go about running a project which supports both versions for now.
`Cheat Sheet: Writing Python 2-3 compatible code <https://python-future.org/compatible_idioms.html>`__
A comprehensive list of idioms that are compatible to both Python 2 and 3 and will make your code run under both,
utilizing `future <https://python-future.org/>`__ and `six <https://six.readthedocs.io/>`__. Strongly recommended.
`Supporting Python 3: An in-depth guide <http://python3porting.com/bookindex.html>`__
A free online book on the switch to Python 3. Sadly seems a bit outdated by now, so with regards to compatible
idioms to use, best stick to the cheat sheet. Gives some interesting background however.
`Towards Python 3 and OctoPrint 1.4.0 <https://community.octoprint.org/t/towards-python-3-and-octoprint-1-4-0/12382?u=foosel>`__
Forum topic discussing OctoPrint 1.4.0's roadmap including Python 3 compatibility and time frame.
`Migrating plugins to Python 2 & 3 compatibility - experiences? <https://community.octoprint.org/t/migrating-plugins-to-python-2-3-compatibility-experiences/16294?u=foosel>`__
Forum topic collecting experiences by plugin developers in migrating their plugins to achieve Python 2 & 3
compatibility.
+1 -1
View File
@@ -438,7 +438,7 @@ Web interface reconnect
.. seealso::
`OctoPrint's core viewmodels <https://github.com/foosel/OctoPrint/tree/devel/src/octoprint/static/js/app/viewmodels>`_
`OctoPrint's core viewmodels <https://github.com/OctoPrint/OctoPrint/tree/master/src/octoprint/static/js/app/viewmodels>`_
OctoPrint's own view models use the same mechanisms for interacting with each other and the web application as
plugins. Their source code is therefore a good point of reference on how to achieve certain things.
`KnockoutJS documentation <http://knockoutjs.com/documentation/introduction.html>`_
+9 -4
View File
@@ -12,7 +12,7 @@ from sphinx.highlighting import PygmentsBridge
from sphinx.ext import doctest
from sphinx.util.texescape import tex_hl_escape_map_new
from docutils.nodes import General, FixedTextElement, literal_block, container
from docutils import nodes
from docutils.parsers.rst import directives
from six import text_type
@@ -22,6 +22,10 @@ from pygments.filters import VisibleWhitespaceFilter, ErrorToken
from pygments.lexers.python import PythonConsoleLexer
from pygments.util import ClassNotFound
if False:
# For type annotation
from typing import Any, Dict, List, Tuple # NOQA
def _merge_dict(a, b):
"""
Little helper to merge two dicts a and b on the fly.
@@ -30,7 +34,7 @@ def _merge_dict(a, b):
result.update(b)
return result
class literal_block_ext(General, FixedTextElement):
class literal_block_ext(nodes.General, nodes.FixedTextElement):
"""
Custom node which is basically the same as a :class:`literal_block`, just with whitespace support and introduced
in order to be able to have a custom visitor.
@@ -59,6 +63,7 @@ class CodeBlockExt(CodeBlock):
option_spec = _merge_dict(CodeBlock.option_spec, dict(whitespace=directives.flag))
def run(self):
# type: () -> List[nodes.Node]
# get result from parent implementation
code_block = CodeBlock.run(self)
@@ -67,7 +72,7 @@ class CodeBlockExt(CodeBlock):
Recursive method to turn all literal blocks located within a node into :class:`literal_block_ext`.
"""
if isinstance(node, container):
if isinstance(node, nodes.container):
# container node => handle all children
children = []
for child in node.children:
@@ -75,7 +80,7 @@ class CodeBlockExt(CodeBlock):
node.children = children
return node
elif isinstance(node, literal_block):
elif isinstance(node, nodes.literal_block):
# literal block => replace it
return self._wrap_literal_block(node)
+7 -9
View File
@@ -11,7 +11,8 @@ import requests
from contextlib import closing
from sphinx.directives.code import LiteralIncludeReader, LiteralInclude, dedent_lines, \
nodes, set_source_info, parselinenos, logger, container_wrapper
nodes, parselinenos, logger, container_wrapper
from sphinx.util.nodes import set_source_info
if False:
# For type annotation
@@ -39,11 +40,10 @@ class OnlineIncludeReader(LiteralIncludeReader):
return lines
except (IOError, OSError):
raise IOError(_('Include file %r not found or reading it failed') % filename)
raise IOError('Include file %r not found or reading it failed' % filename)
except UnicodeError:
raise UnicodeError(_('Encoding %r used for reading included file %r seems to '
'be wrong, try giving an :encoding: option') %
(self.encoding, filename))
raise UnicodeError('Encoding %r used for reading included file %r seems to '
'be wrong, try giving an :encoding: option' % (self.encoding, filename))
class OnlineIncludeDirective(LiteralInclude):
@@ -54,18 +54,16 @@ class OnlineIncludeDirective(LiteralInclude):
if not document.settings.file_insertion_enabled:
return [document.reporter.warning('File insertion disabled',
line=self.lineno)]
env = document.settings.env
# convert options['diff'] to absolute path
if 'diff' in self.options:
_, path = env.relfn2path(self.options['diff'])
_, path = self.env.relfn2path(self.options['diff'])
self.options['diff'] = path
try:
location = self.state_machine.get_source_and_line(self.lineno)
url = self.arguments[0]
reader = OnlineIncludeReader(url, self.options, env.config)
reader = OnlineIncludeReader(url, self.options, self.config)
text, lines = reader.read(location=location)
retnode = nodes.literal_block(text, text, source=url)
+23 -1
View File
@@ -4,14 +4,36 @@ Assumes OctoPrint is installed under user pi at /home/pi/OctoPrint/venv/bin/octo
setup you'll need to adjust octoprint.default (init) or octoprint.service (systemd) accordingly.
## init
Download the init.d files to the locations shown:
```
octoprint.default => /etc/default/octoprint
octoprint.init => /etc/init.d/octoprint
```
Next, enable and start the `octoprint` service:
```sh
# Enable octoprint service
sudo update-rc.d octoprint defaults
# and start it
sudo service octoprint start
```
## systemd
Download the systemd files to the locations shown:
```
octoprint.service => /etc/systemd/service/octoprint.service
octoprint.service => /etc/systemd/system/octoprint.service
```
Next, enable and start the `octoprint` service:
```sh
# Enable octoprint service
sudo systemctl enable octoprint
# and start it
sudo systemctl start octoprint
```
+2
View File
@@ -4,6 +4,8 @@ After=network-online.target
Wants=network-online.target
[Service]
Environment="LC_ALL=C.UTF-8"
Environment="LANG=C.UTF-8"
Type=simple
User=pi
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint
+10
View File
@@ -12,3 +12,13 @@ versionfile_build = octoprint/_version.py
tag_prefix =
parentdir_prefix =
lookupfile = .versioneer-lookup
[flake8]
ignore =
D
E
W
F401
F523
exclude =
src/octoprint/vendor
+98 -67
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env python2
# coding=utf-8
from setuptools import setup, find_packages
from distutils.command.build_py import build_py as _build_py
import os
import versioneer
@@ -17,88 +16,106 @@ import setuptools
# we test against 2.7, 3.6 and 3.7, so that's what we'll mark as supported
PYTHON_REQUIRES = ">=2.7.9, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4"
# Requirements for setup.py
SETUP_REQUIRES = [
"markdown>=3.1,<3.2" # newer versions require Python 3
]
# Requirements for our application
INSTALL_REQUIRES = [
# additional OctoPrint plugins that are maintained on a different release cycle
"OctoPrint-FirmwareCheck>=2020.06.22",
"OctoPrint-FileCheck>=2020.07.06",
# the following dependencies are non trivial to update since later versions introduce backwards incompatible
# changes that might affect plugins, or due to other observed problems
"flask>=0.12,<0.13", # newer versions require newer Jinja versions
"Jinja2>=2.8.1,<2.9", # Jinja 2.9 has breaking changes WRT template scope - we can't
# guarantee backwards compatibility for plugins and such with that
# version, hence we need to pin to a lower version for now. See #1697
"tornado==4.5.3", # a memory leak was observed in tornado >= 5, see #2585
"regex!=2018.11.6", # avoid broken 2018.11.6. See #2874
"markupsafe>=1.1,<2.0", # Jinja dependency, newer versions require Python 3
"tornado==5.1.1", # newer versions require Python 3
"markdown>=3.1,<3.2", # newer versions require Python 3
"rsa==4.0", # newer versions require Python 3
"regex!=2018.11.6", # avoid broken 2018.11.6. See #2874
# anything below this should be checked on releases for new versions
"Flask-Login>=0.4.1,<0.5",
"Flask-Principal>=0.4,<0.5",
"Flask-Babel>=0.12,<0.13",
"Flask-Assets>=0.12,<0.13",
"werkzeug>=0.15.1,<0.16",
"cachelib>=0.1,<0.2",
"PyYAML>=5.1,<6",
"markdown>=3.0,<3.1",
"pyserial>=3.4,<3.5",
"netaddr>=0.7.19,<0.8",
"watchdog>=0.9.0,<0.10",
"flask>=1.1.2,<2",
"Jinja2>=2.11.2,<3",
"Flask-Login>=0.5,<0.6", # flask-login doesn't use semver & breaks stuff on minor version increases
"Flask-Babel>=1.0,<2",
"Flask-Assets>=2.0,<3",
"werkzeug>=1.0.1,<2",
"itsdangerous>=1.1.0,<2",
"cachelib>=0.1,<1",
"PyYAML>=5.3.1,<6",
"pyserial>=3.4,<4",
"netaddr>=0.7.19,<1",
"watchdog>=0.10.2,<1",
"sarge==0.1.5post0",
"netifaces>=0.10.9,<0.11",
"pylru>=1.2,<1.3",
"rsa>=4.0,<5",
"pkginfo>=1.5.0.1,<1.6",
"requests>=2.21.0,<3",
"semantic_version>=2.6,<2.7",
"psutil>=5.6.1,<5.7",
"Click>=7,<8",
"awesome-slugify>=1.6.5,<1.7",
"feedparser>=5.2.1,<5.3",
"future>=0.17,<0.18",
"websocket-client>=0.56,<0.57",
"wrapt>=1.11.1,<1.12",
"emoji>=0.5.1,<0.6",
"frozendict>=1.2,<1.3",
"sentry-sdk==0.7.7"
"netifaces>=0.10.9,<1",
"pylru>=1.2,<2",
"pkginfo>=1.5.0.1,<2",
"requests>=2.23.0,<3",
"semantic_version>=2.8.5,<3",
"psutil>=5.7,<6",
"Click>=7.1.2,<8",
"feedparser>=5.2.1,<6",
"future>=0.18.2,<1",
"websocket-client>=0.57,<1",
"wrapt>=1.12.1,<2",
"emoji>=0.5.4,<1",
"frozendict>=1.2,<2",
"sentry-sdk>=0.15.1,<1",
"filetype>=1.0.7,<2",
# vendor bundle dependencies
"unidecode>=0.04.14,<0.05", # dependency of awesome-slugify
"blinker>=1.4,<2" # dependency of flask_principal
]
# Python 2 specific requirements
INSTALL_REQUIRES_PYTHON2 = [
"futures>=3.2,<3.3",
"monotonic>=1.5,<1.6",
"scandir>=1.10,<1.11",
"chainmap>=1.0.3,<1.1",
"typing>=3.6.6,<4"
"futures>=3.3,<4",
"monotonic>=1.5,<2",
"scandir>=1.10,<2",
"chainmap>=1.0.3,<2",
"typing>=3.7.4.1,<4"
]
# OSX specific requirements
INSTALL_REQUIRES_OSX = [
"appdirs>=1.4.0",
"appdirs>=1.4.4",
]
# Additional requirements for optional install options
EXTRA_REQUIRES = dict(
# Dependencies for developing OctoPrint
develop=[
# Testing dependencies
"mock>=2.0.0,<3",
"pytest>=4.2.1,<5.0",
"pytest-doctest-custom>=1.0.0,<1.1",
# Testing dependencies - SEE ALSO tox.ini
"mock>=3.0.5,<4",
"pytest==4.6.10",
"pytest-doctest-custom>=1.0.0,<2",
"ddt",
# linter
"flake8",
# Documentation dependencies
"sphinx>=1.6,<1.7",
"sphinxcontrib-httpdomain",
"sphinxcontrib-mermaid>=0.3",
"sphinx_rtd_theme",
# profiler
"pyinstrument",
],
# Dependencies for developing OctoPrint plugins
plugins=[
"cookiecutter>=1.6,<1.7"
]
"cookiecutter>=1.7.2,<1.8"
],
# Dependencies for building the documentation - Python 3 required!
docs=[
"sphinx>=3,<4",
"sphinxcontrib-httpdomain",
"sphinxcontrib-mermaid",
"sphinx_rtd_theme",
"readthedocs-sphinx-ext"
],
)
# Dependency links for any of the aforementioned dependencies
@@ -131,14 +148,14 @@ def read_file_contents(path):
with codecs.open(path, encoding="utf-8") as f:
return f.read()
def data_copy_build_py_factory(files, baseclass):
class data_copy_build_py(baseclass):
def md_to_html_build_py_factory(files, baseclass):
class md_to_html_build_py(baseclass):
files = dict()
def run(self):
import shutil
print("RUNNING md_to_html_build_py")
if not self.dry_run:
for directory, files in self.__class__.files.items():
for directory, files in self.files.items():
target_dir = os.path.join(self.build_lib, directory)
self.mkpath(target_dir)
@@ -146,18 +163,27 @@ def data_copy_build_py_factory(files, baseclass):
if isinstance(entry, tuple):
if len(entry) != 2:
continue
source, dest = entry
source, dest = entry[0], os.path.join(target_dir, entry[1])
else:
source = dest = entry
shutil.copy(source, os.path.join(target_dir, dest))
source = entry
dest = os.path.join(target_dir, source + ".html")
print("Rendering markdown from {} to {}".format(source, dest))
from markdown import markdownFromFile
markdownFromFile(input=source,
output=dest,
encoding="utf-8")
baseclass.run(self)
return type(data_copy_build_py)(data_copy_build_py.__name__,
(data_copy_build_py,),
dict(files=files))
return type(md_to_html_build_py)(md_to_html_build_py.__name__,
(md_to_html_build_py,),
dict(files=files))
def get_cmdclass():
# make sure these are always available, even when run by dependabot
global versioneer, octoprint_setuptools, md_to_html_build_py_factory
cmdclass = versioneer.get_cmdclass()
# add clean command
@@ -169,10 +195,9 @@ def get_cmdclass():
bundled_dir = os.path.join("src", "octoprint", "translations")
cmdclass.update(octoprint_setuptools.get_babel_commandclasses(pot_file=pot_file, output_dir=translation_dir, pack_name_prefix="OctoPrint-i18n-", pack_path_prefix="", bundled_dir=bundled_dir))
cmdclass["build_py"] = data_copy_build_py_factory({
cmdclass["build_py"] = md_to_html_build_py_factory({
"octoprint/templates/_data": [
"AUTHORS.md",
"CHANGELOG.md",
"SUPPORTERS.md",
"THIRDPARTYLICENSES.md",
]
@@ -182,6 +207,10 @@ def get_cmdclass():
def params():
# make sure these are always available, even when run by dependabot
global versioneer, get_cmdclass, read_file_contents, here, \
PYTHON_REQUIRES, SETUP_REQUIRES, INSTALL_REQUIRES, EXTRA_REQUIRES, DEPENDENCY_LINKS
name = "OctoPrint"
version = versioneer.get_version()
cmdclass = get_cmdclass()
@@ -191,6 +220,7 @@ def params():
long_description_content_type = "text/markdown"
python_requires = PYTHON_REQUIRES
setup_requires = SETUP_REQUIRES
install_requires = INSTALL_REQUIRES
extras_require = EXTRA_REQUIRES
dependency_links = DEPENDENCY_LINKS
@@ -215,6 +245,7 @@ def params():
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: JavaScript",
"Topic :: Printing",
@@ -233,7 +264,7 @@ def params():
"Funding": "https://donate.octoprint.org"
}
packages = find_packages(where="src")
packages = setuptools.find_packages(where="src")
package_dir = {
"": "src",
}
@@ -247,10 +278,10 @@ def params():
zip_safe = False
if os.environ.get('READTHEDOCS', None) == 'True':
# we can't tell read the docs to please perform a pip install -e .[develop], so we help
# we can't tell read the docs to please perform a pip install -e .[docs], so we help
# it a bit here by explicitly adding the development dependencies, which include our
# documentation dependencies
install_requires = install_requires + extras_require['develop']
install_requires = install_requires + extras_require['docs']
entry_points = {
"console_scripts": [
@@ -260,4 +291,4 @@ def params():
return locals()
setup(**params())
setuptools.setup(**params())
+19 -3
View File
@@ -47,6 +47,13 @@ if version_info.major == 2 and version_info.minor <= 7 and version_info.micro <
except ImportError:
pass
elif version_info.major == 3 and version_info.minor >= 8 and sys.platform == "win32":
# Python 3.8 makes proactor event loop the default on Windows, Tornado doesn't like that
#
# see https://github.com/tornadoweb/tornado/issues/2608
import asyncio
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
del version_info
#~~ custom exceptions
@@ -410,7 +417,9 @@ def init_pluginsystem(settings, safe_mode=False, ignore_blacklist=True, connecti
if not startup:
return
sorted_disabled_from_overlays = sorted([(key, value[0], value[1]) for key, value in disabled_from_overlays.items()], key=lambda x: (x[2] is None, x[2], x[0]))
from octoprint.util import sv
sorted_disabled_from_overlays = sorted([(key, value[0], value[1]) for key, value in disabled_from_overlays.items()], key=lambda x: (x[2] is None, sv(x[2]), sv(x[0])))
disabled_list = pm.plugin_disabled_list
already_processed = []
@@ -557,15 +566,22 @@ def init_connectivity_checker(settings, event_manager):
connectivityInterval = settings.getInt(["server", "onlineCheck", "interval"])
connectivityHost = settings.get(["server", "onlineCheck", "host"])
connectivityPort = settings.getInt(["server", "onlineCheck", "port"])
connectivityName = settings.get(["server", "onlineCheck", "name"])
def on_connectivity_change(old_value, new_value):
event_manager.fire(Events.CONNECTIVITY_CHANGED, payload=dict(old=old_value, new=new_value))
def on_connectivity_change(old_value, new_value, connection_working=None, resolution_working=None):
event_manager.fire(Events.CONNECTIVITY_CHANGED, payload=dict(old=old_value,
new=new_value,
connection=connection_working,
resolution=resolution_working))
connectivityChecker = ConnectivityChecker(connectivityInterval,
connectivityHost,
port=connectivityPort,
name=connectivityName,
enabled=connectivityEnabled,
on_change=on_connectivity_change)
connectivityChecker.check_immediately()
connectivityChecker.log_full_report()
return connectivityChecker
-4
View File
@@ -2,10 +2,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
#import sys
#if sys.version_info[0] >= 3:
# raise RuntimeError("Sorry, OctoPrint does not yet support Python 3")
if __name__ == "__main__":
import octoprint
octoprint.main()
+86 -73
View File
@@ -18,32 +18,7 @@ from octoprint.settings import settings
from octoprint.util import atomic_write
from octoprint.access import ADMIN_GROUP, USER_GROUP, GUEST_GROUP, READONLY_GROUP
from octoprint.access.permissions import Permissions, OctoPrintPermission
from flask_principal import Need, Permission
DEFAULT_ADMIN_PERMISSIONS = [Permissions.ADMIN]
"""Default admin permissions are the legacy permissions from before 1.4.0"""
DEFAULT_USER_PERMISSIONS = [Permissions.STATUS,
Permissions.CONNECTION,
Permissions.WEBCAM,
Permissions.FILES_UPLOAD,
Permissions.FILES_DOWNLOAD,
Permissions.FILES_DELETE,
Permissions.FILES_SELECT,
Permissions.PRINT,
Permissions.MONITOR_TERMINAL,
Permissions.CONTROL,
Permissions.SLICE,
Permissions.TIMELAPSE_LIST,
Permissions.TIMELAPSE_ADMIN]
"""Default user permissions are the legacy permissions from before 1.4.0"""
DEFAULT_GUEST_PERMISSIONS = [Permissions.STATUS,
Permissions.WEBCAM,
Permissions.FILES_DOWNLOAD,
Permissions.TIMELAPSE_LIST,
Permissions.MONITOR_TERMINAL]
"""Default guest permissions are the legacy permissions from before 1.4.0"""
from octoprint.vendor.flask_principal import Need, Permission
GroupNeed = partial(Need, 'group')
@@ -68,6 +43,8 @@ class GroupManager(object):
def __init__(self):
self._logger = logging.getLogger(__name__)
self._group_change_listeners = []
self._default_groups = []
self._init_defaults()
@property
@@ -87,39 +64,50 @@ class GroupManager(object):
return self.find_group(GUEST_GROUP)
def _init_defaults(self):
self.add_group(ADMIN_GROUP,
"Admins",
"Administrators",
self.default_permissions_for_group(ADMIN_GROUP),
[],
changeable=False,
removable=False,
save=False)
self.add_group(USER_GROUP,
"Users",
"All logged in users",
self.default_permissions_for_group(USER_GROUP),
[],
default=True,
removable=False,
toggleable=False,
save=False)
self.add_group(GUEST_GROUP,
"Guests",
"Anyone who is not currently logged in",
self.default_permissions_for_group(GUEST_GROUP),
[],
removable=False,
toggleable=False,
save=False),
self.add_group(READONLY_GROUP,
"Read-only Access",
"Group to gain read-only access",
self.default_permissions_for_group(READONLY_GROUP),
[],
changeable=False,
removable=False,
save=False)
self._default_groups = {
ADMIN_GROUP: dict(name="Admins",
description="Administrators",
permissions=self.default_permissions_for_group(ADMIN_GROUP),
subgroups=[],
changeable=False,
removable=False,
default=False,
toggleable=True),
USER_GROUP: dict(name="Operator",
description="Group to gain operator access",
permissions=self.default_permissions_for_group(USER_GROUP),
subgroups=[],
changeable=True,
default=True,
removable=False,
toggleable=True),
GUEST_GROUP: dict(name="Guests",
description="Anyone who is not currently logged in",
permissions=self.default_permissions_for_group(GUEST_GROUP),
subgroups=[],
changeable=True,
default=False,
removable=False,
toggleable=False),
READONLY_GROUP: dict(name="Read-only Access",
description="Group to gain read-only access",
permissions=self.default_permissions_for_group(READONLY_GROUP),
subgroups=[],
changeable=False,
removable=False,
default=False,
toggleable=True)
}
for key, g in self._default_groups.items():
self.add_group(key, g["name"], g["description"],
g["permissions"], g["subgroups"],
changeable=g.get("changeable", True),
removable=g.get("removable", True),
default=g.get("default", False),
toggleable=g.get("toggleable", True),
save=False)
def register_listener(self, listener):
self._group_change_listeners.append(listener)
@@ -151,8 +139,8 @@ class GroupManager(object):
return [group.key for group in groups]
def _to_groups(self, *groups):
return filter(lambda x: x is not None,
[self._to_group(g) for g in groups])
return list(filter(lambda x: x is not None,
[self._to_group(g) for g in groups]))
def _to_group(self, group):
# noinspection PyCompatibility
@@ -189,6 +177,8 @@ class GroupChangeListener(object):
class FilebasedGroupManager(GroupManager):
FILE_VERSION = 2
def __init__(self, path=None):
if path is None:
path = settings().get(["accessControl", "groupfile"])
@@ -213,23 +203,41 @@ class FilebasedGroupManager(GroupManager):
groups = data
data = dict(groups=groups)
file_version = data.get("_version", 1)
if file_version < self.FILE_VERSION:
# make sure we migrate the file on disk after loading
self._logger.info("Detected file version {} on group "
"storage, migrating to version {}".format(file_version, self.FILE_VERSION))
self._dirty = True
groups = data.get("groups", dict())
tracked_permissions = data.get("tracked", list())
for key, attributes in groups.items():
if key in self._groups:
# group is already there (from the defaults most likely)
if not self._groups[key].is_changeable():
if key in self._default_groups:
# group is a default group
if not self._default_groups[key].get("changeable", True):
# group may not be changed -> bail
continue
removable = self._groups[key].is_removable()
changeable = self._groups[key].is_changeable()
toggleable = self._groups[key].is_toggleable()
name = self._default_groups[key].get("name", "")
description = self._default_groups[key].get("description", "")
removable = self._default_groups[key].get("removable", True)
changeable = self._default_groups[key].get("changeable", True)
toggleable = self._default_groups[key].get("toggleable", True)
if file_version == 1:
# 1.4.0/file version 1 has a bug that resets default to True for users group on modification
set_default = self._default_groups[key].get("default", False)
else:
set_default = attributes.get("default", False)
else:
name = attributes.get("name", "")
description = attributes.get("description", "")
removable = True
changeable = True
toggleable = True
set_default = attributes.get("default", False)
permissions = self._to_permissions(*attributes.get("permissions", []))
default_permissions = self.default_permissions_for_group(key)
@@ -239,11 +247,11 @@ class FilebasedGroupManager(GroupManager):
subgroups = attributes.get("subgroups", [])
group = Group(key, attributes.get("name", ""),
description=attributes.get("description", ""),
group = Group(key, name,
description=description,
permissions=permissions,
subgroups=subgroups,
default=attributes.get("default", False),
default=set_default,
removable=removable,
changeable=changeable,
toggleable=toggleable)
@@ -252,6 +260,9 @@ class FilebasedGroupManager(GroupManager):
for group in self._groups.values():
group._subgroups = self._to_groups(*group._subgroups)
if self._dirty:
self._save()
except Exception:
self._logger.exception("Error while loading groups from file {}".format(self._groupfile))
@@ -263,14 +274,16 @@ class FilebasedGroupManager(GroupManager):
for key in self._groups.keys():
group = self._groups[key]
groups[key] = dict(
name=group._name,
description=group._description,
permissions=self._from_permissions(*group._permissions),
subgroups=self._from_groups(*group._subgroups),
default=group._default
)
if not key in self._default_groups:
groups[key]["name"] = group.get_name()
groups[key]["description"] = group.get_description()
data = dict(groups=groups,
data = dict(_version=self.FILE_VERSION,
groups=groups,
tracked=[x.key for x in Permissions.all()])
with atomic_write(self._groupfile, mode='wt', permissions=0o600, max_permissions=0o666) as f:
+41 -17
View File
@@ -8,7 +8,7 @@ __copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms
from future.utils import with_metaclass
from flask import g, abort
from flask_babel import gettext
from flask_principal import Permission, PermissionDenied, RoleNeed, Need
from octoprint.vendor.flask_principal import Permission, PermissionDenied, RoleNeed, Need
from functools import wraps
from collections import OrderedDict, defaultdict
@@ -79,6 +79,22 @@ class OctoPrintPermission(Permission):
def get_description(self):
return self._description
def allows(self, identity):
"""Whether the identity can access this permission.
Overridden from Permission.allows to make sure the Identity provides ALL
required needs instead of ANY required need.
:param identity: The identity
"""
if self.needs and len(self.needs.intersection(identity.provides)) != len(self.needs):
return False
if self.excludes and self.excludes.intersection(identity.provides):
return False
return True
def union(self, other):
"""Create a new OctoPrintPermission with the requirements of the union of this
and other.
@@ -259,8 +275,9 @@ class Permissions(with_metaclass(PermissionsMetaClass)):
default_groups=[ADMIN_GROUP])
STATUS = OctoPrintPermission("Status",
gettext("Allows to gather status information, e.g. job progress, "
"printer state, temperatures, ..."),
gettext("Allows to gather basic status information, e.g. job progress, "
"printer state, temperatures, ... Mandatory for the default UI "
"to work"),
RoleNeed("status"),
default_groups=[USER_GROUP, READONLY_GROUP])
@@ -281,38 +298,40 @@ class Permissions(with_metaclass(PermissionsMetaClass)):
dangerous=True)
FILES_LIST = OctoPrintPermission("File List",
gettext("Allows to retrieve a list of all uploaded files, including"
gettext("Allows to retrieve a list of all uploaded files and folders, including"
"their metadata (e.g. date, file size, analysis results, ...)"),
RoleNeed("files_list"),
default_groups=[USER_GROUP, READONLY_GROUP])
FILES_UPLOAD = OctoPrintPermission("File Upload",
gettext("Allows users to upload new files"),
gettext("Allows users to upload new files, create new folders and copy existing ones. If "
"the File Delete permission is also set, File Upload also allows "
"moving files and folders."),
RoleNeed("files_upload"),
default_groups=[USER_GROUP])
FILES_DOWNLOAD = OctoPrintPermission("File Download",
gettext("Allows users to download files. The GCODE viewer is "
"affected by this as well."),
RoleNeed("files_download"), FILES_LIST,
RoleNeed("files_download"),
default_groups=[USER_GROUP, READONLY_GROUP])
FILES_DELETE = OctoPrintPermission("File Delete",
gettext("Allows users to delete files"),
RoleNeed("files_delete"), FILES_LIST,
gettext("Allows users to delete files and folders. If the File Upload permission is "
"also set, File Delete also allows moving files and folders."),
RoleNeed("files_delete"),
default_groups=[USER_GROUP])
FILES_SELECT = OctoPrintPermission("File Select",
gettext("Allows to select a file for printing"),
RoleNeed("files_select"), FILES_LIST,
RoleNeed("files_select"),
default_groups=[USER_GROUP])
PRINT = OctoPrintPermission("Print",
gettext("Allows to start, pause and cancel a print job. Includes the \"Select\" "
"permission"),
RoleNeed("print"), FILES_SELECT,
gettext("Allows to start, pause and cancel a print job"),
RoleNeed("print"),
default_groups=[USER_GROUP])
GCODE_VIEWER = OctoPrintPermission("GCODE viewer",
gettext("Allows access to the GCODE viewer. Includes the \"File Download\""
"permission."),
RoleNeed("gcodeviewer"), FILES_DOWNLOAD,
gettext("Allows access to the GCODE viewer if the \"File Download\""
"permission is also set."),
RoleNeed("gcodeviewer"),
default_groups=[USER_GROUP, READONLY_GROUP])
MONITOR_TERMINAL = OctoPrintPermission("Terminal",
@@ -351,8 +370,13 @@ class Permissions(with_metaclass(PermissionsMetaClass)):
RoleNeed("timelapse_admin"), TIMELAPSE_LIST, TIMELAPSE_DOWNLOAD,
default_groups=[USER_GROUP])
SETTINGS = OctoPrintPermission("Settings",
gettext("Allows to manage settings"),
SETTINGS_READ = OctoPrintPermission("Settings Access",
gettext("Allows to read non sensitive settings. Mandatory for the "
"default UI to work."),
RoleNeed("settings_read"),
default_groups=[USER_GROUP, READONLY_GROUP])
SETTINGS = OctoPrintPermission("Settings Admin",
gettext("Allows to manage settings and also to read sensitive settings"),
RoleNeed("settings"),
dangerous=True)
+84 -36
View File
@@ -19,15 +19,18 @@ import logging
# noinspection PyCompatibility
from builtins import range, bytes
from octoprint.settings import settings
from octoprint.util import atomic_write, to_bytes, deprecated, monotonic_time
from octoprint.settings import settings as s
from octoprint.util import atomic_write, to_bytes, deprecated, monotonic_time, generate_api_key
from octoprint.util import get_fully_qualified_classname as fqcn
from octoprint.access.permissions import Permissions, OctoPrintPermission
from octoprint.access.groups import GroupChangeListener, Group
from past.builtins import basestring
class UserManager(GroupChangeListener, object):
def __init__(self, group_manager):
def __init__(self, group_manager, settings=None):
self._group_manager = group_manager
self._group_manager.register_listener(self)
@@ -36,6 +39,10 @@ class UserManager(GroupChangeListener, object):
self._sessionids_by_userid = dict()
self._enabled = True
if settings is None:
settings = s()
self._settings = settings
self._login_status_listeners = []
def register_login_status_listener(self, listener):
@@ -48,7 +55,10 @@ class UserManager(GroupChangeListener, object):
if self.enabled:
return AnonymousUser([self._group_manager.guest_group])
else:
return AdminUser([self._group_manager.admin_group])
return AdminUser([self._group_manager.admin_group, self._group_manager.user_group])
def api_user_factory(self):
return ApiUser([self._group_manager.admin_group, self._group_manager.user_group])
@property
def enabled(self):
@@ -92,14 +102,15 @@ class UserManager(GroupChangeListener, object):
try:
listener.on_user_logged_in(user)
except Exception:
self._logger.exception("Error in on_user_logged_in on {!r}".format(listener))
self._logger.exception("Error in on_user_logged_in on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
self._logger.debug("Logged in user: %r" % user)
self._logger.info("Logged in user: {}".format(user.get_id()))
return user
def logout_user(self, user):
if user is None or user.is_anonymous:
def logout_user(self, user, stale=False):
if user is None or user.is_anonymous or isinstance(user, AdminUser):
return
if isinstance(user, LocalProxy):
@@ -118,34 +129,41 @@ class UserManager(GroupChangeListener, object):
pass
if sessionid in self._session_users_by_session:
del self._session_users_by_session[sessionid]
try:
del self._session_users_by_session[sessionid]
except KeyError:
pass
for listener in self._login_status_listeners:
try:
listener.on_user_logged_out(user)
listener.on_user_logged_out(user, stale=stale)
except Exception:
self._logger.exception("Error in on_user_logged_out on {!r}".format(listener))
self._logger.exception("Error in on_user_logged_out on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
self._logger.debug("Logged out user: %r" % user)
self._logger.info("Logged out user: {}".format(user.get_id()))
def _cleanup_sessions(self):
for session, user in self._session_users_by_session.items():
for session, user in list(self._session_users_by_session.items()):
if not isinstance(user, SessionUser):
continue
if user.created + (24 * 60 * 60) < monotonic_time():
self.logout_user(user)
self._logger.info("Cleaning up user session {} for user {}".format(session, user.get_id()))
self.logout_user(user, stale=True)
@staticmethod
def create_password_hash(password, salt=None):
def create_password_hash(password, salt=None, settings=None):
if not salt:
salt = settings().get(["accessControl", "salt"])
if settings is None:
settings = s()
salt = settings.get(["accessControl", "salt"])
if salt is None:
import string
from random import choice
chars = string.ascii_lowercase + string.ascii_uppercase + string.digits
salt = "".join(choice(chars) for _ in range(32))
settings().set(["accessControl", "salt"], salt)
settings().save()
settings.set(["accessControl", "salt"], salt)
settings.save()
return hashlib.sha512(to_bytes(password, encoding="utf-8", errors="replace") + to_bytes(salt)).hexdigest()
@@ -154,13 +172,16 @@ class UserManager(GroupChangeListener, object):
if not user:
return False
hash = UserManager.create_password_hash(password)
hash = UserManager.create_password_hash(password,
settings=self._settings)
if user.check_password(hash):
# new hash matches, correct password
return True
else:
# new hash doesn't match, but maybe the old one does, so check that!
oldHash = UserManager.create_password_hash(password, salt="mvBUTvwzBzD3yPwvnJ4E4tXNf3CGJvvW")
oldHash = UserManager.create_password_hash(password,
salt="mvBUTvwzBzD3yPwvnJ4E4tXNf3CGJvvW",
settings=self._settings)
if user.check_password(oldHash):
# old hash matches, we migrate the stored password hash to the new one and return True since it's the correct password
self.change_user_password(username, password)
@@ -219,6 +240,13 @@ class UserManager(GroupChangeListener, object):
del self._session_users_by_session[session]
del self._sessionids_by_userid[username]
def validate_user_session(self, userid, session):
if session in self._session_users_by_session:
user = self._session_users_by_session[session]
return userid == user.get_id()
return False
def find_user(self, userid=None, session=None):
if session is not None and session in self._session_users_by_session:
user = self._session_users_by_session[session]
@@ -261,7 +289,8 @@ class UserManager(GroupChangeListener, object):
for user in users:
listener.on_user_modified(user)
except Exception:
self._logger.exception("Error in on_user_modified on {!r}".format(listener))
self._logger.exception("Error in on_user_modified on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
def on_group_subgroups_changed(self, group, added=None, removed=None):
users = self.find_sessions_for(lambda u: group in u.groups)
@@ -271,7 +300,8 @@ class UserManager(GroupChangeListener, object):
for user in users:
listener.on_user_modified(user)
except Exception:
self._logger.exception("Error in on_user_modified on {!r}".format(listener))
self._logger.exception("Error in on_user_modified on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
def _trigger_on_user_modified(self, user):
if isinstance(user, basestring):
@@ -300,14 +330,16 @@ class UserManager(GroupChangeListener, object):
for user in users:
listener.on_user_modified(user)
except Exception:
self._logger.exception("Error in on_user_modified on {!r}".format(listener))
self._logger.exception("Error in on_user_modified on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
def _trigger_on_user_removed(self, username):
for listener in self._login_status_listeners:
try:
listener.on_user_removed(username)
except Exception:
self._logger.exception("Error in on_user_removed on {!r}".format(listener))
self._logger.exception("Error in on_user_removed on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
#~~ Deprecated methods follow
@@ -415,7 +447,7 @@ class LoginStatusListener(object):
def on_user_logged_in(self, user):
pass
def on_user_logged_out(self, user):
def on_user_logged_out(self, user, stale=False):
pass
def on_user_modified(self, user):
@@ -428,13 +460,13 @@ class LoginStatusListener(object):
##~~ FilebasedUserManager, takes available users from users.yaml file
class FilebasedUserManager(UserManager):
def __init__(self, group_manager, path=None):
UserManager.__init__(self, group_manager)
def __init__(self, group_manager, path=None, settings=None):
UserManager.__init__(self, group_manager, settings=settings)
if path is None:
path = settings().get(["accessControl", "userfile"])
path = self._settings.get(["accessControl", "userfile"])
if path is None:
path = os.path.join(settings().getBaseFolder("base"), "users.yaml")
path = os.path.join(s().getBaseFolder("base"), "users.yaml")
self._userfile = path
@@ -449,14 +481,19 @@ class FilebasedUserManager(UserManager):
self._customized = True
with io.open(self._userfile, 'rt', encoding='utf-8') as f:
data = yaml.safe_load(f)
for name, attributes in data.items():
if not isinstance(attributes, dict):
continue
permissions = []
if "permissions" in attributes:
permissions = attributes["permissions"]
groups = {self._group_manager.user_group} # the user group is mandatory for all logged in users
if "groups" in attributes:
groups |= set(attributes["groups"])
groups = set(attributes["groups"])
else:
groups = {self._group_manager.user_group}
# migrate from roles to permissions
if "roles" in attributes and not "permissions" in attributes:
@@ -537,7 +574,13 @@ class FilebasedUserManager(UserManager):
if username in self._users and not overwrite:
raise UserAlreadyExists(username)
self._users[username] = User(username, UserManager.create_password_hash(password), active, permissions, groups, apikey=apikey)
self._users[username] = User(username,
UserManager.create_password_hash(password,
settings=self._settings),
active,
permissions,
groups,
apikey=apikey)
self._dirty = True
self._save()
@@ -670,7 +713,8 @@ class FilebasedUserManager(UserManager):
if not username in self._users:
raise UnknownUser(username)
passwordHash = UserManager.create_password_hash(password)
passwordHash = UserManager.create_password_hash(password,
settings=self._settings)
user = self._users[username]
if user._passwordHash != passwordHash:
user._passwordHash = passwordHash
@@ -718,7 +762,7 @@ class FilebasedUserManager(UserManager):
raise UnknownUser(username)
user = self._users[username]
user._apikey = ''.join('%02X' % z for z in bytes(uuid.uuid4().bytes))
user._apikey = generate_api_key()
self._dirty = True
self._save()
return user._apikey
@@ -1097,6 +1141,12 @@ class User(UserMixin):
def groups(self):
return list(self._groups)
@property
def effective_permissions(self):
if self._permissions is None:
return []
return list(filter(lambda p: p is not None and self.has_permission(p), Permissions.all()))
@property
def needs(self):
needs = set()
@@ -1115,8 +1165,6 @@ class User(UserMixin):
return self.has_needs(*permission.needs)
def has_needs(self, *needs):
if Permissions.ADMIN in self._permissions:
return True
return set(needs).issubset(self.needs)
def __repr__(self):
+2 -1
View File
@@ -138,9 +138,10 @@ from .dev import dev_commands
from .client import client_commands
from .config import config_commands
from .analysis import analysis_commands
from .user import user_commands
@click.group(name="octoprint", invoke_without_command=True, cls=click.CommandCollection,
sources=[server_commands, plugin_commands, dev_commands, client_commands, config_commands, analysis_commands])
sources=[server_commands, plugin_commands, dev_commands, client_commands, config_commands, analysis_commands, user_commands])
@standard_options()
@legacy_options
@click.version_option(version=octoprint.__version__, allow_from_autoenv=False)
+29 -2
View File
@@ -8,8 +8,34 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms
import click
click.disable_unicode_literals_warning = True
import logging
import logging.config
from octoprint.cli import pass_octoprint_ctx, OctoPrintContext, get_ctx_obj_option
from octoprint.util import dict_merge
LOGGING_CONFIG = {
"version": 1,
"formatters": {
"brief": {
"format": "%(message)s"
}
},
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "brief",
"stream": "ext://sys.stdout"
}
},
"loggers": {
"octoprint.plugin.core": {
"level": logging.ERROR
}
},
"root": {
"level": logging.WARNING
}
}
#~~ "octoprint plugin:command" commands
@@ -48,6 +74,9 @@ class OctoPrintPluginCommands(click.MultiCommand):
if ctx.obj is None:
ctx.obj = OctoPrintContext()
logging_config = dict_merge(LOGGING_CONFIG, dict(root=dict(level=logging.DEBUG if ctx.obj.verbosity > 0 else logging.WARNING)))
logging.config.dictConfig(logging_config)
# initialize settings and plugin manager based on provided
# context (basedir and configfile)
from octoprint import init_settings, init_pluginsystem, FatalStartupError
@@ -63,8 +92,6 @@ class OctoPrintPluginCommands(click.MultiCommand):
# fetch registered hooks
self.hooks = self.plugin_manager.get_hooks("octoprint.cli.commands")
logging.basicConfig(level=logging.DEBUG if ctx.obj.verbosity > 0 else logging.WARN)
self._initialized = True
def list_commands(self, ctx):
Loaded 100 of 393 files, more files were not shown because too many files have changed in this diff. Show more