Compare commits

...
349 Commits
Author SHA1 Message Date
Gina Häußge 3ab84ed7e4 Merge branch 'master' into staging/maintenance 2020-08-04 10:34:21 +02:00
Gina Häußge 3f7bc1ebb5 🔖 Preparing release of 1.4.1 2020-08-04 10:27:21 +02:00
Gina Häußge 57b8d0b88e 🔖 staging/maintenance is now 1.4.1rc5.dev 2020-07-29 12:20:33 +02:00
Gina Häußge 458ab91f91 🔖 Preparing release of 1.4.1rc4 2020-07-29 10:35:49 +02:00
Gina Häußge ab8ad72bc3 🥅 PMGR: Ensure validity of latest release data
Closes #3661
2020-07-28 19:33:48 +02:00
Gina Häußge e9b6d22932 👷‍️ Trigger for docker builds 2020-07-28 14:15:28 +02:00
Gina Häußge 57b085ff5c 🐛 Remove accidentally committed debug code
See #3653
2020-07-27 16:00:39 +02:00
Gina Häußge 0cfc08748b 🐛 Set closed state even if not yet open
And also ensure we only attempt serial auto detect if we are still in
the correct state for it.

Closes #3653
2020-07-27 15:59:47 +02:00
Gina Häußge 0188745d05 🐛 Fix 500 on /api/files/local
Closes #3655
2020-07-27 12:08:39 +02:00
Gina Häußge 5246e2ccb4 🐛 Fix for some bugs in auto detection
Probably related to #3653
2020-07-27 11:35:07 +02:00
Gina Häußge f1d4cb670a 🐛 Fix held back messages not actually being sent
Probably part of #3653
2020-07-27 11:35:07 +02:00
Gina Häußge 9dd1e95eae 🐛 Fix a potential race condition
If the comm layer starts sending state changes (e.g. to auto detect)
before the constructor returns, self._comm in the printer interface is
still None and thus states can't be decoded.

Probably part of #3653
2020-07-27 11:34:55 +02:00
Gina Häußge 6083943e03 🚸 Improve disconnect response while not operational
We don't want to try to send our beforeDisconnect script if we aren't
properly connected, as that will severely delay Disconnect execution, so
we now limit that to operational states and thus allow a quick(er)
connection abort during auto detection or connection attempt.
2020-07-24 13:55:03 +02:00
Gina Häußge a8ba43308e 🐛 Don't drop state messages due to rate limits
Instead hold them back until the next slot.

Otherwise we might never get the final switch to Offline as after that
there are no current data upgrades anymore.
2020-07-24 13:54:56 +02:00
Gina Häußge 4511d8667b ✅ E2E: Add basic upload test 2020-07-22 14:02:36 +02:00
Gina Häußge af3a63fd9b 🐛 Fix a duplicated id 2020-07-21 17:50:12 +02:00
Gina Häußge 93e54f57e0 🔖 staging/maintenance is now 1.4.1rc4.dev 2020-07-15 14:21:32 +02:00
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 e33b3b5883 📝 Update dev environment docs 2020-07-15 11:25:31 +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 b150989286 👷‍️ Add workflow_dispatch trigger for install test 2020-07-07 11:35:58 +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 504137d249 Merge branch 'rc/maintenance' into staging/maintenance 2020-03-03 12:37:34 +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 38e8878ded Merge branch 'rc/maintenance' into staging/maintenance 2020-03-02 13:08:45 +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 e0b09857c4 Merge branch 'staging/maintenance' into maintenance 2020-02-11 14:38:25 +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
276 changed files with 17366 additions and 48036 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
+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]'
---
+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: ''
+79
View File
@@ -0,0 +1,79 @@
name: Test install of branches and latest release twice per day
on:
push:
branches:
- master
workflow_dispatch:
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'
+18
View File
@@ -0,0 +1,18 @@
name: Trigger docker build
on:
release:
types:
- released
- prereleased
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: 🚀 Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.DOCKER_ACCESS_TOKEN }}
repository: OctoPrint/docker
event-type: octoprint-release
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "event-name": "${{ github.event_name }}", "event-type": "${{ github.event.action }}"}'
+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
+5 -5
View File
@@ -24,13 +24,13 @@ 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.4.0rc6
# staging/maintenance is currently the branch for preparation of 1.4.1rc5
# so is regressionfix/...
staging/maintenance 1.4.0rc6 73f7c4d8a11a7aea7b0ece474d3bf37ad53c65d4 pep440-dev
regressionfix/.* 1.4.0rc6 73f7c4d8a11a7aea7b0ece474d3bf37ad53c65d4 pep440-dev
staging/maintenance 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev
regressionfix/.* 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev
# staging/devel is currently inactive (but has the 1.4.0rc6 namespace)
staging/devel 1.4.0rc6 73f7c4d8a11a7aea7b0ece474d3bf37ad53c65d4 pep440-dev
# staging/devel is currently inactive (but has the 1.4.1rc4 namespace)
staging/devel 1.4.1rc4 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
+7
View File
@@ -115,6 +115,13 @@ date of first contribution):
* [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
+1 -1
View File
@@ -1,4 +1,4 @@
# Changelog
See [the releases on Github](https://github.com/foosel/OctoPrint/releases) for detailed changelogs for all releases
See [the releases on Github](https://github.com/OctoPrint/OctoPrint/releases) for detailed changelogs for all releases
and release candidates.
+26 -23
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,12 +62,18 @@ 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` if your system default python version is
python 2.7, otherwise you need to specify the version explicitly, e.g. `virtualenv --python=python2.7 venv`.
3. Create a user-owned virtual environment therein: `virtualenv venv`
4. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install .`
You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octoprint`, see [Usage](#usage)
@@ -78,11 +85,7 @@ 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.
@@ -90,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
+14 -11
View File
@@ -1,23 +1,23 @@
# 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
* Alex Krilov
* Andrew Moorby
* Arnljot Arntsen
* Ash King
* BigTreeTech
* Boris Hussein
* Brad Jackson
* BuildBee
* Christian Petropolis
* Christian Wolf
* D Brian Kimmel
* DeltaMaker 3D Printers
* Dennis Breining
* Dorian Gray
* Eric Betts
* Ernesto Martinez
* Franziska Kunsmann
@@ -27,13 +27,15 @@ thanks to everyone who contributed!
* Hog Duske
* Hugh Blemings
* jean-claude migneault
* Jeff Renfer
* Jeremiah Avery
* 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
@@ -41,7 +43,7 @@ thanks to everyone who contributed!
* Lee Dohm
* Makespace Madrid
* Mark Walker
* Martin Majewski
* Marvin Nahmias
* Michael Aumock
* Miles Flavel
* Mosaic Manufacturing
@@ -49,6 +51,7 @@ thanks to everyone who contributed!
* Patrick Glyré
* Patrick McGinnis
* Prof Yuh Wen Chen
* Raise3D
* Randy C. Will
* Ranjib Dey
* Richard Michaud
@@ -56,11 +59,11 @@ thanks to everyone who contributed!
* Robert Gusek
* Ronald Griehsler
* Sacha Telgenhof
* Simon Hallam
* Sebastien Andrivet
* Stefan Krister
* Steve Thompson
* Stewart Danos
* Sven Mueller
* Trent Shumay
* Ulrich Kempken
and 1741 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)!
and 1932 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."
+4 -2
View File
@@ -572,7 +572,8 @@ 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.
@@ -768,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.
+57
View File
@@ -99,6 +99,14 @@ 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!
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.
@@ -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
-----------
+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
@@ -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``.
+5
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
file_check.rst
firmware_check.rst
gcodeviewer.rst
logging.rst
loginui.rst
pluginmanager.rst
printer_safety_check.rst
softwareupdate.rst
virtual_printer.rst
@@ -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``.
+93 -19
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,10 +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.
* ``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:
@@ -233,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.
@@ -273,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
@@ -329,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 --------------------------------------------------
+40 -170
View File
@@ -283,184 +283,20 @@ 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
# enable or disable the loading animation
showLoadingAnimation: 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!"
- "SD card ok"
# Initial set of prepared oks to use instead of regular ok (e.g. to simulate
# mis-sent oks). Can also be filled at runtime via the debug command prepare_ok
preparedOks: []
# Format string for ok response.
#
# Placeholders:
# - lastN: last acknowledged line number
# - buffer: empty slots in internal command buffer
#
# Example format string for "extended" ok format:
# ok N{lastN} P{buffer}
okFormatString: ok
# Format string for M115 output.
#
# Placeholders:
# - firmare_name: The firmware name as defined in firmwareName
m115FormatString: "FIRMWARE_NAME: {firmware_name} PROTOCOL_VERSION:1.0"
# Whether to include capability report in M115 output
m115ReportCapabilites: false
# Capabilities to report if capability report is enabled
capabilities:
AUTOREPORT_TEMP: true
# Simulated ambient temperature in °C
ambientTemperature: 21.3
.. _sec-configuration-config_yaml-estimation:
Estimation
@@ -1025,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
@@ -1126,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
+3 -3
View File
@@ -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>`.
+99 -68
View File
@@ -19,16 +19,22 @@ below.
* Checkout the OctoPrint sources from their Git repository:
* ``git clone -b devel https://github.com/foosel/OctoPrint.git``
* ``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):
* Create virtual environments in the checked out source folder for both Python 2 and Python 3 to use for
installing and running OctoPrint and its dependencies. Creating virtual environments avoids potential versioning
issues for the dependencies with system wide installed instances:
* 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)
@@ -41,52 +47,48 @@ below.
* 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]``
* ``pip install -e '.[develop,plugins]'``
When the virtual environment is activated you can then:
* run the OctoPrint server via ``octoprint serve``
* run the test suite from the checked out source folder via ``nosetests --with-doctest``
* build the documentation from the ``docs`` sub folder of the checked out sources via ``sphinx-build -b html . _build``
* run the test suite from the checked out source folder via ``pytest``
To switch the activated virtual environment, simply activate the new environment as described above.
To deactivate the virtual environment and return to the system's default Python: ``deactivate``.
If you also want to be able to build the documentation that resides in the ``docs`` subfolder, you need to activate
the *Python 3* environment and install the docs dependencies as well:
* ``source venv3/bin/activate`` (Linux, macOS) or ``source venv3/Scripts/activate`` (Git Bash under Windows, see below)
* ``pip install -e .[develop,plugins,docs]``
You can then build the documentation:
* ``sphinx-build -b html . _build``
.. _sec-development-environment-source-linux:
Linux
.....
.. todo::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
First make sure you have python including its header files, pip, setuptools, virtualenv, git and some build requirements
First make sure you have python 2 and 3 including their header files, pip, setuptools, virtualenv, git and some build requirements
installed:
* On apt based distributions (e.g. Debian, Ubuntu, ...):
.. code-block:: none
sudo apt-get install python python-pip python-dev python-setuptools python-virtualenv git libyaml-dev build-essential
* On zypper based distributions (example below for SLES 12 SP2):
.. code-block:: none
sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/python/SLE_12_SP2/ python_devel
sudo zypper ref
sudo zypper in python python-pip python-devel python-setuptools python-virtualenv git libyaml-devel
sudo zypper in -t pattern Basis-Devel
sudo apt-get install python python-pip python-dev python-setuptools python-virtualenv python3 python3-virtualenv python3-dev git libyaml-dev build-essential
.. 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
Using a Linux distribution that doesn't use ``apt``? Please send a
`Pull Request <https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
Then:
@@ -94,36 +96,42 @@ Then:
.. code-block:: none
cd ~/devel
git clone -b devel https://github.com/foosel/OctoPrint.git
git clone https://github.com/OctoPrint/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/bin/activate
virtualenv --python=python2 venv2
virtualenv --python=python3 venv3
source ./venv2/bin/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
source ./venv3/bin/activate
pip install --upgrade pip
pip install -e .[develop,plugins,docs]
You can then start OctoPrint via ``~/devel/OctoPrint/venv/bin/octoprint`` or just ``octoprint`` if you activated the virtual
environment.
You can then start OctoPrint via ``octoprint`` after activating one of the two virtual environments.
.. _sec-development-environment-windows:
Windows
.......
.. todo::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
This assumes you'll host your OctoPrint development checkout at ``C:\Devel\OctoPrint``. If you want to use a different
location, please substitute accordingly.
First download & install:
* `Python 2.7.15 Windows x86 MSI installer <https://www.python.org/downloads/release/python-2715/>`_
* `Git for Windows <https://git-for-windows.github.io/>`_
* `Latest *stable* Python 2.7 and Python 3.8 releases from python.org <https://www.python.org/downloads/windows/>`_
(at the time of writing those are ``2.7.18`` and ``3.8.4``)
* make sure to have the installer add Python to the ``PATH`` and have it install ``pip`` too
* it's recommended to install Python 2.7 into ``C:\Python27`` and Python 3 into ``C:\Python38`` - if you select
different install locations please substitute accordingly
* `Microsoft Visual C++ Compiler for Python 2.7 <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`_
* `Git for Windows <https://git-for-windows.github.io/>`_
* `Build Tools For Visual Studio 2019 <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019>`_
* install "C++ build tools" and ensure the latest versions of "MSVCv142 - VS 2019 C++ x64/x86 build tools" and
"Windows 10 SDK" are checked.
Open the Git Bash you just installed and in that:
@@ -131,12 +139,16 @@ 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
virtualenv --python=C:\Python27\python.exe venv2
virtualenv --python=C:\Python38\python.exe venv3
source ./venv2/Scripts/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
source ./venv3/Scripts/activate
pip install --upgrade pip
pip install -e .[develop,plugins,docs]
.. _sec-development-environment-mac:
@@ -145,12 +157,14 @@ 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::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
This guide is not yet adapted to the concurrent use of Python 2 and 3 environments during development. Please send a
`Pull Request <https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
@@ -178,7 +192,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
@@ -190,14 +204,10 @@ You'll need a user account with administrator privileges.
IDE Setup
---------
.. todo::
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
.. todo::
Using another IDE than the ones below? Please send a
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
`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:
@@ -206,49 +216,70 @@ PyCharm
.......
- "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
- **(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``)
- Register virtual environments:
- **(Linux, Windows)** "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...",
select OctoPrint ``venv2`` folder (e.g. ``~/devel/OctoPrint/venv2`` or ``C:\Devel\OctoPrint\venv2``).
- **(macOS)** "PyCharm" > "Preferences ..." > "Project: OctoPrint" > "Project Interpreter" > "Add ..." >
"Virtualenv Environment > "Existing Environment", select OctoPrint ``venv2`` folder (e.g. ``~/devel/OctoPrint/venv2``).
Repeat for the ``venv3`` folder.
- 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``
* Parameters: ``serve --debug``
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Python interpreter: Project Default
* 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$``
Note that sadly that seems to cause some hiccups on current PyCharm versions due to ``$PyInterpreterDirectory$``
being empty sometimes, so if this fails to run on your installation, you should update your dependencies manually
for now.
- Add Run/Debug Configuration, select "Python tests" and therein "pytest":
* Name: OctoPrint tests
* Target: Custom
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Python interpreter: Project Default
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
* Just like with the run configuration for the server you can also have the dependencies auto-update on run of
the tests, see above on how to set this up.
- Add Run/Debug Configuration, select "Python docs" and therein "Sphinx task"
- Add Run/Debug Configuration, select "Python":
* Name: OctoPrint docs
* Command: ``html``
* Input: the ``docs`` folder in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/docs`` or
``C:\Devel\OctoPrint\docs``)
* Output: the ``docs/_build`` folder in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/docs/_build`` or
``C:\Devel\OctoPrint\docs\_build``)
* Module name: ``sphinx.cmd.build``
* Parameters: ``-v -T -E ./docs ./docs/_build -b html``
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Python interpreter: ``venv3`` environment (the docs build requires Python 3)
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
* Just like with the run configuration for the server you can also have the dependencies auto-update when building
the documentation, see above on how to set this up.
Note that this requires you to also have installed the additional ``docs`` dependencies into the Python 3 venv as
described above via ``pip install -e .[develop,plugins,docs]``.
To switch between Python 2 and 3, all you need to do now is change the Project Default Interpreter and restart
OctoPrint. On current PyCharm versions you can do that right from a small selection field in the footer of the IDE.
Otherwise go through Settings.
.. note::
Make sure you are running a PyCharm version of 2016.1 or later, or manually fix
+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:
+4 -1
View File
@@ -197,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
+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.]+)``).
+3 -10
View File
@@ -18,13 +18,7 @@ simple "send-as-is" scripts but making use of a full blown templating language i
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:
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 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.
+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:
+3 -3
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
@@ -143,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
@@ -1091,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
+29 -10
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.
@@ -215,7 +215,7 @@ octoprint.access.permissions
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``,
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 _.
@@ -472,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)
@@ -890,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
@@ -907,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:**
+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.
+34 -6
View File
@@ -70,7 +70,7 @@ Then create an editable install of your plugin, start the server and start testi
.. note::
If you want to migrate your existing OctoPrint install *on OctoPi* to Python 3, I suggest to first make a
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):
@@ -79,7 +79,7 @@ Then create an editable install of your plugin, start the server and start testi
mv ~/oprint ~/oprint.py2
virtualenv --python=/usr/bin/python3 oprint
source ~/oprint/bin/activate
pip install "OctoPrint>=1.4.0rc1"
pip install "OctoPrint>=1.4.0"
sudo service octoprint restart
.. _sec-plugins-python3-markup:
@@ -218,7 +218,7 @@ 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-imports:
.. _sec-plugins-python3-pitfalls-absolute-imports:
Absolute imports
................
@@ -246,6 +246,33 @@ 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
@@ -312,13 +339,14 @@ As a summary, follow this checklist to migrate your plugin to be compatible to b
* 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, update your
registration file in the Official Plugin Repository to include the correct Python compatibility information as well:
* 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,<3"
python: ">=2.7,<4"
.. _sec-plugins-python3-furtherreading:
+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)
+4 -5
View File
@@ -12,6 +12,7 @@ from contextlib import closing
from sphinx.directives.code import LiteralIncludeReader, LiteralInclude, dedent_lines, \
nodes, parselinenos, logger, container_wrapper
from sphinx.util.nodes import set_source_info
if False:
# For type annotation
@@ -53,22 +54,20 @@ 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)
self.set_source_info(retnode)
set_source_info(self, retnode)
if self.options.get('diff'): # if diff is set, set udiff
retnode['language'] = 'udiff'
elif 'language' in self.options:
+22
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/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
+71 -54
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
@@ -19,66 +18,72 @@ PYTHON_REQUIRES = ">=2.7.9, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
# Requirements for setup.py
SETUP_REQUIRES = [
"markdown>=3.1,<3.2",
"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
"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-Babel>=0.12,<0.13",
"Flask-Assets>=0.12,<0.13",
"blinker>=1.4,<1.5", # dependency of the now vendor bundled flask_principal
"werkzeug>=0.16,<0.17",
"cachelib>=0.1,<0.2",
"PyYAML>=5.1,<6",
"markdown>=3.1,<3.2",
"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.22.0,<3",
"semantic_version>=2.8,<2.9",
"psutil>=5.6.5,<5.7",
"Click>=7,<8",
"awesome-slugify>=1.6.5,<1.7",
"feedparser>=5.2.1,<5.3",
"future>=0.18.2,<0.19",
"websocket-client>=0.56,<0.57",
"wrapt>=1.11.2,<1.12",
"emoji>=0.5.4,<0.6",
"frozendict>=1.2,<1.3",
"sentry-sdk==0.13.2",
"filetype>=1.0.5,<2"
"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.3,<3.4",
"monotonic>=1.5,<1.6",
"scandir>=1.10,<1.11",
"chainmap>=1.0.3,<1.1",
"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.3",
"appdirs>=1.4.4",
]
# Additional requirements for optional install options
@@ -87,25 +92,30 @@ EXTRA_REQUIRES = dict(
develop=[
# Testing dependencies - SEE ALSO tox.ini
"mock>=3.0.5,<4",
"pytest==4.6.6",
"pytest-doctest-custom>=1.0.0,<1.1",
"pytest==4.6.10",
"pytest-doctest-custom>=1.0.0,<2",
"ddt",
# linter
"flake8",
# Documentation dependencies
"sphinx>=1.8.5,<2",
"sphinxcontrib-httpdomain",
"sphinxcontrib-mermaid>=0.3.1",
"sphinx_rtd_theme",
"readthedocs-sphinx-ext==0.5.17" # Later versions require Jinja >= 2.9
# 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
@@ -171,6 +181,9 @@ def md_to_html_build_py_factory(files, baseclass):
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
@@ -194,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()
@@ -247,7 +264,7 @@ def params():
"Funding": "https://donate.octoprint.org"
}
packages = find_packages(where="src")
packages = setuptools.find_packages(where="src")
package_dir = {
"": "src",
}
@@ -261,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": [
@@ -274,4 +291,4 @@ def params():
return locals()
setup(**params())
setuptools.setup(**params())
+16 -2
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
@@ -559,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
+83 -45
View File
@@ -43,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
@@ -62,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)
@@ -164,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"])
@@ -188,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)
@@ -214,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)
@@ -227,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))
@@ -238,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:
+6 -3
View File
@@ -298,12 +298,14 @@ 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",
@@ -312,7 +314,8 @@ class Permissions(with_metaclass(PermissionsMetaClass)):
RoleNeed("files_download"),
default_groups=[USER_GROUP, READONLY_GROUP])
FILES_DELETE = OctoPrintPermission("File Delete",
gettext("Allows users to delete files"),
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",
+14 -2
View File
@@ -240,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]
@@ -474,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:
+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):
+6 -6
View File
@@ -50,12 +50,12 @@ def run_server(basedir, configfile, host, port, v6_only, debug, allow_root, logg
from octoprint import urllib3_ssl
if not urllib3_ssl:
logging.getLogger("octoprint.server")\
.warn("requests/urllib3 will run in an insecure SSL environment. "
"You might see corresponding warnings logged later "
"(\"InsecurePlatformWarning\"). It is recommended to either "
"update to a Python version >= 2.7.9 or alternatively "
"install PyOpenSSL plus its dependencies. For details see "
"https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl")
.warning("requests/urllib3 will run in an insecure SSL environment. "
"You might see corresponding warnings logged later "
"(\"InsecurePlatformWarning\"). It is recommended to either "
"update to a Python version >= 2.7.9 or alternatively "
"install PyOpenSSL plus its dependencies. For details see "
"https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl")
logger.info(get_divider_line("*"))
def log_register_rollover(safe_mode=None, plugin_manager=None, environment_detector=None, **kwargs):
+3
View File
@@ -675,6 +675,9 @@ class FileManager(object):
self._logger.exception("Could not read recovery data from file {}".format(self._recovery_file))
self.delete_recovery_data()
def get_additional_metadata(self, destination, path, key):
self._storage(destination).get_additional_metadata(path, key)
def set_additional_metadata(self, destination, path, key, data, overwrite=False, merge=False):
self._storage(destination).set_additional_metadata(path, key, data, overwrite=overwrite, merge=merge)
+13 -4
View File
@@ -19,7 +19,8 @@ import time
from octoprint.events import Events, eventManager
from octoprint.settings import settings
from octoprint.util import monotonic_time
from octoprint.util import get_fully_qualified_classname as fqcn
from octoprint.util import get_fully_qualified_classname as fqcn, dict_merge
from octoprint.util.platform import CLOSE_FDS
class QueueEntry(collections.namedtuple("QueueEntry", "name, path, type, location, absolute_path, printer_profile, analysis")):
@@ -345,8 +346,12 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
import sys
import yaml
if self._current.analysis:
if self._current.analysis and all(map(lambda x: x in self._current.analysis, ("printingArea",
"dimensions",
"estimatedPrintTime",
"filament"))):
return self._current.analysis
try:
throttle = settings().getFloat(["gcodeAnalysis", "throttle_highprio"]) if high_priority \
else settings().getFloat(["gcodeAnalysis", "throttle_normalprio"])
@@ -370,7 +375,7 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
self._logger.info("Invoking analysis command: {}".format(" ".join(command)))
self._aborted = False
p = sarge.run(command, async_=True, stdout=sarge.Capture())
p = sarge.run(command, close_fds=CLOSE_FDS, async_=True, stdout=sarge.Capture())
while len(p.commands) == 0:
# somewhat ugly... we can't use wait_events because
@@ -421,7 +426,11 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
"length": analysis["extrusion_length"][i],
"volume": analysis["extrusion_volume"][i]
}
return result
if self._current.analysis and isinstance(self._current.analysis, dict):
return dict_merge(result, self._current.analysis)
else:
return result
finally:
self._gcode = None
+20 -2
View File
@@ -24,7 +24,7 @@ from contextlib import contextmanager
from past.builtins import basestring
from emoji import demojize
from slugify import Slugify
from octoprint.vendor.awesome_slugify import Slugify
import octoprint.filemanager
@@ -307,6 +307,15 @@ class StorageInterface(object):
"""
raise NotImplementedError()
def get_additional_metadata(self, path, key):
"""
Fetches additional metadata at ``key`` from the metadata of ``path``.
:param path: the virtual path to the file for which to fetch additional metadata
:param key: key of metadata to fetch
"""
raise NotImplementedError()
def set_additional_metadata(self, path, key, data, overwrite=False, merge=False):
"""
Adds additional metadata to the metadata of ``path``. Metadata in ``data`` will be saved under ``key``.
@@ -488,7 +497,7 @@ class LocalFileStorage(StorageInterface):
self._persisted_metadata_lock_mutex = threading.RLock()
self._persisted_metadata_locks = dict()
self._metadata_cache = pylru.lrucache(10)
self._metadata_cache = pylru.lrucache(100)
self._old_metadata = None
self._initialize_metadata()
@@ -877,6 +886,15 @@ class LocalFileStorage(StorageInterface):
path, name = self.sanitize(path)
self._delete_history(name, path, index)
def get_additional_metadata(self, path, key):
path, name = self.sanitize(path)
metadata = self._get_metadata(path)
if not name in metadata:
return
return metadata[name].get(key)
def set_additional_metadata(self, path, key, data, overwrite=False, merge=False):
path, name = self.sanitize(path)
metadata = self._get_metadata(path)
+16 -15
View File
@@ -71,7 +71,7 @@ class StreamWrapper(AbstractFileWrapper):
A wrapper allowing processing of one or more consecutive streams.
Arguments:
*streams (io.IOBase): One or more streams to process one after another to save to storage.
*streams: One or more :py:`io.IOBase` streams to process one after another to save to storage.
"""
def __init__(self, filename, *streams):
if not len(streams) > 0:
@@ -88,7 +88,7 @@ class StreamWrapper(AbstractFileWrapper):
import shutil
with atomic_write(path, mode='wb') as dest:
with self.stream() as source:
for source in self.streams:
shutil.copyfileobj(source, dest)
def stream(self):
@@ -107,7 +107,7 @@ class MultiStream(io.RawIOBase):
their contents in the order they are provided to the constructor.
Arguments:
*streams (io.RawIOBase): One or more streams to concatenate.
*streams: One or more :py:`io.IOBase` streams to concatenate.
"""
def __init__(self, *streams):
io.RawIOBase.__init__(self)
@@ -170,31 +170,32 @@ class LineProcessorStream(io.RawIOBase):
def __init__(self, input_stream):
io.RawIOBase.__init__(self)
self.input_stream = io.BufferedReader(input_stream)
self.leftover = None
self.leftover = bytearray()
def read(self, n=-1):
if n == 0:
return b''
result = b''
result = bytearray()
while len(result) < n or n == -1:
# add left over from previous loop
bytes_left = (n - len(result)) if n != -1 else -1
if self.leftover is not None:
if bytes_left != -1 and bytes_left < len(self.leftover):
result += self.leftover[:bytes_left]
self.leftover = self.leftover[bytes_left:]
break
else:
result += self.leftover
self.leftover = None
if bytes_left != -1 and bytes_left < len(self.leftover):
# only s
result += self.leftover[:bytes_left]
self.leftover = self.leftover[bytes_left:]
break
else:
result += self.leftover
self.leftover = bytearray()
# read one line from the underlying stream
processed_line = None
while processed_line is None:
line = self.input_stream.readline()
if not line:
break
processed_line = self.process_line(line)
if processed_line is None:
break
@@ -206,7 +207,7 @@ class LineProcessorStream(io.RawIOBase):
else:
result += processed_line
return result
return bytes(result)
def readinto(self, b):
n = len(b)
+4 -1
View File
@@ -20,8 +20,11 @@ def log_to_handler(logger, handler, level, msg, exc_info=None, extra=None, *args
extra: optional extra data
*args: log args
"""
from logging import _srcfile
import sys
try:
from logging import _srcfile
except ImportError:
_srcfile = None
# this is just the same as logging.Logger._log
+7
View File
@@ -16,6 +16,9 @@ class AsyncLogHandlerMixin(logging.Handler):
super(AsyncLogHandlerMixin, self).__init__(*args, **kwargs)
def emit(self, record):
if getattr(self._executor, "_shutdown", False):
return
try:
self._executor.submit(self._emit, record)
except Exception:
@@ -25,6 +28,10 @@ class AsyncLogHandlerMixin(logging.Handler):
# noinspection PyUnresolvedReferences
super(AsyncLogHandlerMixin, self).emit(record)
def close(self):
self._executor.shutdown(wait=True)
super(AsyncLogHandlerMixin, self).close()
class CleaningTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler):
+7 -1
View File
@@ -38,7 +38,7 @@ def _validate_plugin(phase, plugin_info):
def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_entry_points=None, plugin_disabled_list=None,
plugin_blacklist=None, plugin_restart_needing_hooks=None, plugin_obsolete_hooks=None,
plugin_validators=None, compatibility_ignored_list=None):
plugin_considered_bundled=None, plugin_validators=None, compatibility_ignored_list=None):
"""
Factory method for initially constructing and consecutively retrieving the :class:`~octoprint.plugin.core.PluginManager`
singleton.
@@ -63,6 +63,8 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
to logging handlers
plugin_obsolete_hooks (list): A list of hooks that have been declared obsolete. Plugins implementing them will
not be enabled since they might depend on functionality that is no longer available.
plugin_considered_bundled (list): A list of plugin identifiers that are considered bundled plugins even if
installed separately.
plugin_validators (list): A list of additional plugin validators through which to process each plugin.
compatibility_ignored_list (list): A list of plugin keys for which it will be ignored if they are flagged as
incompatible. This is for development purposes only and should not be used in production.
@@ -95,6 +97,9 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
if plugin_obsolete_hooks is None:
plugin_obsolete_hooks = ["octoprint.comm.protocol.gcode"]
if plugin_considered_bundled is None:
plugin_considered_bundled = ["firmware_check", "file_check"]
if plugin_validators is None:
plugin_validators = [_validate_plugin]
else:
@@ -108,6 +113,7 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
plugin_blacklist=plugin_blacklist,
plugin_restart_needing_hooks=plugin_restart_needing_hooks,
plugin_obsolete_hooks=plugin_obsolete_hooks,
plugin_considered_bundled=plugin_considered_bundled,
plugin_validators=plugin_validators,
compatibility_ignored_list=compatibility_ignored_list)
else:
+13 -8
View File
@@ -119,21 +119,21 @@ class PluginInfo(object):
""" Module attribute from which to retrieve the plugin's license. """
attr_pythoncompat = '__plugin_pythoncompat__'
"""
Module attribute from which to retrieve the plugin's python compatibility string.
"""
Module attribute from which to retrieve the plugin's python compatibility string.
If unset a default of ``>=2.7,<3`` will be assumed, meaning that the plugin will be considered compatible to
Python 2 but not Python 3.
To mark a plugin as Python 3 compatible, a string of ``>=2.7,<4`` is recommended.
Bundled plugins will automatically be assumed to be compatible.
"""
attr_hidden = '__plugin_hidden__'
"""
Module attribute from which to determine if the plugin's hidden or not.
Only evaluated for bundled plugins, in order to hide them from the Plugin Manager
and similar places.
"""
@@ -649,7 +649,8 @@ class PluginManager(object):
def __init__(self, plugin_folders, plugin_bases, plugin_entry_points, logging_prefix=None,
plugin_disabled_list=None, plugin_blacklist=None, plugin_restart_needing_hooks=None,
plugin_obsolete_hooks=None, plugin_validators=None, compatibility_ignored_list=None):
plugin_obsolete_hooks=None, plugin_considered_bundled=None, plugin_validators=None,
compatibility_ignored_list=None):
self.logger = logging.getLogger(__name__)
if logging_prefix is None:
@@ -666,6 +667,8 @@ class PluginManager(object):
plugin_blacklist = []
if compatibility_ignored_list is None:
compatibility_ignored_list = []
if plugin_considered_bundled is None:
plugin_considered_bundled = []
self.plugin_folders = plugin_folders
self.plugin_bases = plugin_bases
@@ -677,6 +680,7 @@ class PluginManager(object):
self.plugin_validators = plugin_validators
self.logging_prefix = logging_prefix
self.compatibility_ignored_list = compatibility_ignored_list
self.plugin_considered_bundled = plugin_considered_bundled
self.enabled_plugins = dict()
self.disabled_plugins = dict()
@@ -878,7 +882,8 @@ class PluginManager(object):
# plugin is already defined or marked as uninstalled, ignore it
continue
kwargs = dict(module_name=module_name, version=version)
bundled = key in self.plugin_considered_bundled
kwargs = dict(module_name=module_name, version=version, bundled=bundled)
package_name = entry_point.dist.project_name
try:
entry_point_metadata = EntryPointMetadata(entry_point)
@@ -0,0 +1,132 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
import octoprint.plugin
from octoprint.access import USER_GROUP
from octoprint.access.permissions import Permissions
from octoprint.events import Events
import flask
from flask_babel import gettext
import time
class ActionCommandNotificationPlugin(octoprint.plugin.AssetPlugin,
octoprint.plugin.SettingsPlugin,
octoprint.plugin.SimpleApiPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.EventHandlerPlugin):
def __init__(self):
self._notifications = []
# Additional permissions hook
def get_additional_permissions(self):
return [
dict(key="SHOW",
name="Show printer notifications",
description=gettext("Allows to see printer notifications"),
default_groups=[USER_GROUP],
roles=["show"]),
dict(key="CLEAR",
name="Clear printer notifications",
description=gettext("Allows to clear printer notifications"),
default_groups=[USER_GROUP],
roles=["clear"])
]
#~ AssetPlugin
def get_assets(self):
return dict(js=["js/action_command_notification.js"],
clientjs=["clientjs/action_command_notification.js"],
css=["css/action_command_notification.css"])
#~ EventHandlerPlugin
def on_event(self, event, payload):
if event == Events.DISCONNECTED:
self._clear_notifications()
#~ SettingsPlugin
def get_settings_defaults(self):
return dict(enable=True,
enable_popups=False)
#~ SimpleApiPlugin
def on_api_get(self, request):
if not Permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW.can():
return flask.abort(403, "Insufficient permissions")
return flask.jsonify(notifications=[dict(timestamp=notification[0],
message=notification[1]) for notification in self._notifications])
def get_api_commands(self):
return dict(clear=[])
def on_api_command(self, command, data):
if command == "clear":
if not Permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR.can():
return flask.abort(403, "Insufficient permissions")
self._clear_notifications()
#~ TemplatePlugin
def get_template_configs(self):
return [
dict(type="settings",
name=gettext("Printer Notifications"),
custom_bindings=False),
dict(type="sidebar",
name=gettext("Printer Notifications"),
icon="bell-o",
styles_wrapper=["display: none"],
data_bind="visible: loginState.hasPermissionKo(access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW)"
" && settings.settings.plugins.action_command_notification.enable()")
]
#~ action command handler
def action_command_handler(self, comm, line, action, *args, **kwargs):
if not self._settings.get_boolean(["enable"]):
return
parts = action.split(None, 1)
if len(parts) == 1:
action = parts[0]
parameter = ""
else:
action, parameter = parts
if action != "notification":
return
message = parameter.strip()
self._notifications.append((time.time(), message))
self._plugin_manager.send_plugin_message(self._identifier, dict(message=message))
self._logger.info("Got a notification: {}".format(message))
def _clear_notifications(self):
self._notifications = []
self._plugin_manager.send_plugin_message(self._identifier, dict())
self._logger.info("Notifications cleared")
__plugin_name__ = "Action Command Notification Support"
__plugin_description__ = "Allows your printer to trigger notifications via action commands on the connection"
__plugin_author__ = "Gina Häußge"
__plugin_disabling_discouraged__ = gettext("Without this plugin your printer will no longer be able to trigger"
" notifications in OctoPrint")
__plugin_license__ = "AGPLv3"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = ActionCommandNotificationPlugin()
__plugin_hooks__ = {
"octoprint.comm.protocol.action": __plugin_implementation__.action_command_handler,
"octoprint.access.permissions": __plugin_implementation__.get_additional_permissions
}
@@ -0,0 +1,22 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["OctoPrintClient"], factory);
} else {
factory(global.OctoPrintClient);
}
})(this, function(OctoPrintClient) {
var OctoPrintActionCommandNotificationClient = function(base) {
this.base = base;
};
OctoPrintActionCommandNotificationClient.prototype.get = function(refresh, opts) {
return this.base.get(this.base.getSimpleApiUrl("action_command_notification"), opts);
};
OctoPrintActionCommandNotificationClient.prototype.clear = function(opts) {
return this.base.simpleApiCommand("action_command_notification", "clear", {}, opts);
};
OctoPrintClient.registerPluginComponent("action_command_notification", OctoPrintActionCommandNotificationClient);
return OctoPrintActionCommandNotificationClient;
});
@@ -0,0 +1,5 @@
.sidebar_plugin_action_command_notification_entry {
padding: 5px;
line-height: 20px;
border-bottom: 1px solid #ddd;
}
@@ -0,0 +1,65 @@
$(function() {
function ActionCommandNotificationViewModel(parameters) {
var self = this;
self.loginState = parameters[0];
self.access = parameters[1];
self.settings = parameters[2];
self.notifications = ko.observableArray([]);
self.toDateTimeString = function(timestamp) {
return formatDate(timestamp);
};
self.requestData = function() {
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW)) return;
OctoPrint.plugins.action_command_notification.get()
.done(self.fromResponse)
};
self.fromResponse = function(response) {
self.notifications(response.notifications);
};
self.clear = function() {
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR)) return;
OctoPrint.plugins.action_command_notification.clear();
};
self.onStartup = self.onUserLoggedIn = self.onUserLoggedOut = function() {
self.requestData();
};
self.onDataUpdaterPluginMessage = function(plugin, data) {
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW)) return;
if (plugin !== "action_command_notification") {
return;
}
self.requestData();
if (data.message && self.settings.settings.plugins.action_command_notification.enable_popups()) {
new PNotify({
title: gettext("Printer Notification"),
text: data.message,
hide: false,
icon: "fa fa-bell-o",
buttons: {
sticker: false,
closer: true
}
});
}
};
}
OCTOPRINT_VIEWMODELS.push({
construct: ActionCommandNotificationViewModel,
dependencies: ["loginStateViewModel", "accessViewModel", "settingsViewModel"],
elements: ["#sidebar_plugin_action_command_notification_wrapper"]
});
});
@@ -0,0 +1,19 @@
<h3>{{ _('Action Command Notification Settings') }}</h3>
<form class="form-horizontal">
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.action_command_notification.enable"> {{ _('Enable') }}
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.action_command_notification.enable_popups"> {{ _('Enable popups') }}
<span class="help-block">{{ _("Check this if you want notifications to also show up as popups in addition to the notification list in the sidebar") }}</span>
</label>
</div>
</div>
</form>
@@ -0,0 +1,12 @@
<div style="display: none" data-bind="visible: notifications().length > 0">
<div class="scroll-wrapper" data-bind="foreach: notifications">
<div class="sidebar_plugin_action_command_notification_entry">
<div class="sidebar_plugin_action_command_notification_entry_timestamp"><small class="muted" data-bind="text: $root.toDateTimeString($data.timestamp)"></small></div>
<div class="sidebar_plugin_action_command_notification_entry_message" data-bind="text: message"></div>
</div>
</div>
<button class="btn btn-block" data-bind="click: clear, visible: loginState.hasPermission(access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR)">{{ _('Clear notifications') }}</button>
</div>
<div style="display: none" data-bind="visible: notifications().length == 0">
{{ _('There are currently no notifications from your printer.') }}
</div>
@@ -50,8 +50,8 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
self._prompt = None
self._enable = "detected"
self._command = None
self._enable_emergency_sending = False
self._enable_signal_support = False
self._enable_emergency_sending = True
self._enable_signal_support = True
self._cap_prompt_support = False
def initialize(self):
@@ -130,7 +130,7 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
#~ TemplatePlugin
def get_template_configs(self):
return [dict(type="settings", name=gettext("Action Command Prompt"), custom_bindings=False)]
return [dict(type="settings", name=gettext("Printer Dialogs"), custom_bindings=False)]
#~ action command handler
@@ -223,7 +223,7 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
if "{choice}" in self._command:
self._printer.commands([self._command.format(choice=choice)])
else:
self._printer.commands(["{command} S{choice}".format(command=self._command,
self._printer.commands(["{command} S{choice}".format(command=self._command,
choice=choice)])
@@ -233,6 +233,7 @@ __plugin_author__ = "Gina Häußge"
__plugin_disabling_discouraged__ = gettext("Without this plugin your printer will no longer be able to trigger"
" confirmation or selection prompts in OctoPrint")
__plugin_license__ = "AGPLv3"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = ActionCommandPromptPlugin()
__plugin_hooks__ = {
"octoprint.comm.protocol.action": __plugin_implementation__.action_command_handler,
@@ -42,7 +42,7 @@ class AnnouncementPlugin(octoprint.plugin.AssetPlugin,
self._cached_channel_configs = None
self._cached_channel_configs_mutex = threading.RLock()
from slugify import Slugify
from octoprint.vendor.awesome_slugify import Slugify
self._slugify = Slugify()
self._slugify.safe_chars = "-_."
@@ -149,7 +149,7 @@ class AnnouncementPlugin(octoprint.plugin.AssetPlugin,
def get_template_configs(self):
return [
dict(type="settings", name=gettext("Announcements"), template="announcements_settings.jinja2", custom_bindings=True),
dict(type="navbar", template="announcements_navbar.jinja2", styles=["display: none"], data_bind="visible: loginState.hasPermission(access.permissions.PLUGIN_ANNOUNCEMENTS_ANNOUNCEMENT)")
dict(type="navbar", template="announcements_navbar.jinja2", styles=["display: none"], data_bind="visible: loginState.hasPermission(access.permissions.PLUGIN_ANNOUNCEMENTS_READ)")
]
# Blueprint Plugin
@@ -536,6 +536,7 @@ __plugin_description__ = "Announcements all around OctoPrint"
__plugin_disabling_discouraged__ = gettext("Without this plugin you might miss important announcements "
"regarding security or other critical issues concerning OctoPrint.")
__plugin_license__ = "AGPLv3"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = AnnouncementPlugin()
__plugin_hooks__ = {
+8 -1
View File
@@ -256,7 +256,12 @@ class AppKeysPlugin(octoprint.plugin.AssetPlugin,
if not app_name:
return flask.abort(400)
self._add_api_key(user_id, app_name.strip())
selected_user_id = data.get("user", user_id)
if selected_user_id != user_id and not Permissions.PLUGIN_APPKEYS_ADMIN.can():
return flask.abort(403)
key = self._add_api_key(selected_user_id, app_name.strip())
return flask.jsonify(user_id=selected_user_id, app_id=app_name, api_key=key)
return NO_CONTENT
@@ -437,6 +442,8 @@ __plugin_description__ = "Implements a workflow for third party clients to obtai
__plugin_author__ = "Gina Häußge, Aldo Hoeben"
__plugin_disabling_discouraged__ = gettext("Without this plugin third party clients will no longer be able to "
"obtain an API key without you manually copy-pasting it.")
__plugin_license__ = "AGPLv3"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = AppKeysPlugin()
__plugin_hooks__ = {
"octoprint.accesscontrol.keyvalidator": __plugin_implementation__.validate_api_key,
@@ -21,6 +21,10 @@
return this.base.simpleApiCommand("appkeys", "generate", {"app": app}, opts);
};
OctoPrintAppKeysClient.prototype.generateKeyForUser = function(user, app, opts) {
return this.base.simpleApiCommand("appkeys", "generate", {"app": app, "user": user}, opts);
};
OctoPrintAppKeysClient.prototype.revokeKey = function(key, opts) {
return this.base.simpleApiCommand("appkeys", "revoke", {"key": key}, opts);
};
@@ -1 +1 @@
#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_actions,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_actions{width:75px;text-align:center}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_actions a,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_actions a{color:#000}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_user,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_user{width:100px}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_checkbox,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_checkbox{text-align:center;width:10px}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_checkbox input[type=checkbox],#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_checkbox input[type=checkbox]{margin-top:0}
#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_actions,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_actions{width:75px;text-align:center}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_actions a,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_actions a{color:#000}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_user,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_user{width:100px}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_checkbox,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_checkbox{text-align:center;width:10px}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_checkbox input[type=checkbox],#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_checkbox input[type=checkbox]{margin-top:0}#plugin_appkeys_keygenerated .control-text{display:inline-block}
@@ -1,7 +1,49 @@
$(function() {
function AppKeysDialogViewModel(parameters) {
var self = this;
self.dialog = undefined;
self.onStartup = function() {
self.dialog = $("#plugin_appkeys_keygenerated");
};
self.showDialog = function(title, data) {
if (self.dialog === undefined) return;
var qrcode = {
text: data.api_key,
size: 180,
fill: "#000",
background: null,
label: "",
fontname: "sans",
fontcolor: "#000",
radius: 0,
ecLevel: "L"
};
self.dialog.find("#plugin_appkeys_keygenerated_title").text(title);
self.dialog.find("#plugin_appkeys_keygenerated_user").text(data.user_id);
self.dialog.find("#plugin_appkeys_keygenerated_app").text(data.app_id);
self.dialog.find("#plugin_appkeys_keygenerated_key_text").text(data.api_key);
self.dialog.find("#plugin_appkeys_keygenerated_key_copy")
.off()
.click(function() {
copyToClipboard(data.api_key);
});
self.dialog.find("#plugin_appkeys_keygenerated_key_qrcode")
.empty()
.qrcode(qrcode);
self.dialog.modal("show");
}
}
function UserAppKeysViewModel(parameters) {
var self = this;
self.loginState = parameters[0];
self.dialog = parameters[0];
self.loginState = parameters[1];
self.keys = new ItemListHelper(
"plugin.appkeys.userkeys",
@@ -144,7 +186,9 @@ $(function() {
function AllAppKeysViewModel(parameters) {
var self = this;
self.loginState = parameters[0];
self.dialog = parameters[0];
self.loginState = parameters[1];
self.access = parameters[2];
self.keys = new ItemListHelper(
"plugin.appkeys.allkeys",
@@ -170,14 +214,21 @@ $(function() {
self.users = ko.observableArray([]);
self.apps = ko.observableArray([]);
self.editorApp = ko.observable();
self.editorUser = ko.observable();
self.markedForDeletion = ko.observableArray([]);
self.onSettingsShown = function() {
self.requestData();
self.editorUser(self.loginState.username());
self.editorApp("");
};
self.onUserLoggedIn = function() {
self.requestData();
self.editorUser(self.loginState.username());
self.editorApp("");
};
self.requestData = function() {
@@ -204,6 +255,18 @@ $(function() {
self.apps(apps);
};
self.generateKey = function() {
return OctoPrint.plugins.appkeys.generateKeyForUser(self.editorUser(), self.editorApp())
.done(self.requestData)
.done(function() {
self.editorUser(self.loginState.username());
self.editorApp("");
})
.done(function(data) {
self.dialog.showDialog(gettext("New key generated!"), data);
});
}
self.revokeKey = function(key) {
var perform = function() {
OctoPrint.plugins.appkeys.revokeKey(key)
@@ -294,15 +357,21 @@ $(function() {
};
}
OCTOPRINT_VIEWMODELS.push([
AppKeysDialogViewModel,
[],
[]
]);
OCTOPRINT_VIEWMODELS.push([
UserAppKeysViewModel,
["loginStateViewModel"],
["appKeysDialogViewModel", "loginStateViewModel"],
["#usersettings_plugin_appkeys"]
]);
OCTOPRINT_VIEWMODELS.push([
AllAppKeysViewModel,
["loginStateViewModel"],
["appKeysDialogViewModel", "loginStateViewModel", "accessViewModel"],
["#settings_plugin_appkeys"]
])
});
@@ -22,3 +22,9 @@
}
}
}
#plugin_appkeys_keygenerated {
.control-text {
display: inline-block;
}
}
@@ -0,0 +1,39 @@
<div id="plugin_appkeys_keygenerated" class="modal hide fade">
<div class="modal-header">
<a href="javascript:void(0)" class="close" data-dismiss="modal" aria-hidden="true">&times;</a>
<h3 id="plugin_appkeys_keygenerated_title"></h3>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label">{{ _('User') }}</label>
<div class="controls">
<strong id="plugin_appkeys_keygenerated_user" class="control-text"></strong>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Application identifier') }}</label>
<div class="controls">
<strong id="plugin_appkeys_keygenerated_app" class="control-text"></strong>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('API Key') }}</label>
<div class="controls">
<strong id="plugin_appkeys_keygenerated_key_text" class="control-text"></strong>
<a href="javascript:void(0)" id="plugin_appkeys_keygenerated_key_copy" title="{{ _('Copy API Key to clipboard')|edq }}" class="control-text"><i class="fa fa-copy"></i></a>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('QR Code') }}</label>
<div class="controls">
<div id="plugin_appkeys_keygenerated_key_qrcode"></div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</button>
</div>
</div>
@@ -1,3 +1,5 @@
<legend>{{ _('Registered application keys') }}</legend>
<div data-bind="visible: keys.allSize() <= 0">
<p>{{ _('There are no application keys registered yet.') }}</p>
</div>
@@ -41,7 +43,7 @@
<td class="settings_plugin_appkeys_checkbox"><input type="checkbox" data-bind="value: api_key, checked: $root.markedForDeletion"></td>
<td class="settings_plugin_appkeys_user"><span data-bind="text: user_id"></span></td>
<td class="settings_plugin_appkeys_app"><span data-bind="text: app_id"></span><br /><small class="muted">{{ _('API Key') }}: <span data-bind="text: api_key"></span> <a href="javascript:void(0)" title="{{ _('Copy API Key to clipboard')|edq }}" data-bind="click: function() { copyToClipboard(api_key) }"><i class="fa fa-copy"></i></a></small></td>
<td class="settings_plugin_appkeys_actions"><a href="javascript:void(0)" title="{{ _('Revoke')|edq }}" class="fa fa-trash-o" data-bind="click: function() { $parent.revokeKey($data.api_key, $data.user_id) }"></a></td>
<td class="settings_plugin_appkeys_actions"><a href="javascript:void(0)" title="{{ _('Revoke')|edq }}" class="fa fa-trash-o" data-bind="click: function() { $parent.revokeKey($data.api_key, $data.user_id) }"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Details')|edq }}" class="fa fa-search" data-bind="click: function() { $parent.dialog.showDialog(gettext('Details'), $data) }"></a></td>
</tr>
</tbody>
</table>
@@ -56,4 +58,26 @@
<li data-bind="css: {disabled: keys.currentPage() === keys.lastPage()}"><a href="javascript:void(0)" data-bind="click: keys.nextPage">»</a></li>
</ul>
</div>
<legend>{{ _('Manually generate an application key') }}</legend>
<form class="form-horizontal" onsubmit="return false;">
<div class="control-group">
<label class="control-label">{{ _('User') }}</label>
<div class="controls">
<select data-bind="options: access.users.listHelper.items, optionsText: 'name', optionsValue: 'name', value: editorUser"></select>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Application identifier') }}</label>
<div class="controls">
<input type="text" data-bind="value: editorApp">
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary" data-bind="click: generateKey">Generate</button>
</div>
</div>
</form>
</div>
+51 -14
View File
@@ -61,7 +61,8 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.AssetPlugin,
octoprint.plugin.BlueprintPlugin,
octoprint.plugin.StartupPlugin):
octoprint.plugin.StartupPlugin,
octoprint.plugin.WizardPlugin):
_pip_caller = None
@@ -99,7 +100,8 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
##~~ TemplatePlugin
def get_template_configs(self):
return [dict(type="settings", name=gettext("Backup & Restore"))]
return [dict(type="settings", name=gettext("Backup & Restore")),
dict(type="wizard", name=gettext("Restore Backup?"))]
##~~ BlueprintPlugin
@@ -210,9 +212,10 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
return NO_CONTENT
@octoprint.plugin.BlueprintPlugin.route("/restore", methods=["POST"])
@no_firstrun_access
@Permissions.PLUGIN_BACKUP_ACCESS.require(403)
def perform_restore(self):
if not Permissions.PLUGIN_BACKUP_ACCESS.can() and not self._settings.global_get(["server", "firstRun"]):
return flask.abort(403)
if not is_os_compatible(["!windows"]):
return flask.make_response("Invalid request, the restores are not supported on the underlying operating system", 400)
@@ -249,14 +252,14 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
compatible = octoprint_compatible and os_compatible
if not compatible:
if not octoprint_compatible and not os_compatible:
self._logger.warn("Cannot install plugin {}, it is incompatible to this version "
"of OctoPrint and the underlying operating system".format(plugin["id"]))
self._logger.warning("Cannot install plugin {}, it is incompatible to this version "
"of OctoPrint and the underlying operating system".format(plugin["id"]))
elif not octoprint_compatible:
self._logger.warn("Cannot install plugin {}, it is incompatible to this version "
"of OctoPrint".format(plugin["id"]))
self._logger.warning("Cannot install plugin {}, it is incompatible to this version "
"of OctoPrint".format(plugin["id"]))
elif not os_compatible:
self._logger.warn("Cannot install plugin {}, it is incompatible to the underlying "
"operating system".format(plugin["id"]))
self._logger.warning("Cannot install plugin {}, it is incompatible to the underlying "
"operating system".format(plugin["id"]))
self._send_client_message("plugin_incompatible", dict(plugin=plugin["id"],
octoprint_compatible=octoprint_compatible,
os_compatible=os_compatible))
@@ -325,6 +328,14 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
def is_blueprint_protected(self):
return False
##~~ WizardPlugin
def is_wizard_required(self):
return self._settings.global_get(["server", "firstRun"]) and is_os_compatible(["!windows"])
def get_wizard_details(self):
return dict(required=self.is_wizard_required())
##~~ tornado hook
def route_hook(self, *args, **kwargs):
@@ -355,15 +366,21 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
@click.option("--exclude", multiple=True,
help="Identifiers of data folders to exclude, e.g. 'uploads' to exclude uploads or "
"'timelapse' to exclude timelapses.")
def backup_command(exclude):
@click.option("--path", type=click.Path(), default=None,
help="Specify full path to backup file to be created")
def backup_command(exclude, path):
"""
Creates a new backup.
"""
backup_file = build_backup_filename()
settings = octoprint.plugin.plugin_settings_for_settings_plugin("backup", self, settings=cli_group.settings)
datafolder = os.path.join(settings.getBaseFolder("data"), "backup")
if path is not None:
datafolder, backup_file = os.path.split(os.path.abspath(path))
else:
backup_file = build_backup_filename()
datafolder = os.path.join(settings.getBaseFolder("data"), "backup")
if not os.path.isdir(datafolder):
os.makedirs(datafolder)
@@ -374,6 +391,7 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
plugin_manager=cli_group.plugin_manager,
datafolder=datafolder)
click.echo("Done.")
click.echo("Backup located at {}".format(os.path.join(datafolder, backup_file)))
@click.command("restore")
@click.argument("path")
@@ -796,12 +814,25 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
try:
if callable(on_log_progress):
on_log_progress("Unpacking backup to {}...".format(temp))
abstemp = os.path.abspath(temp)
dirs = {}
for member in zip.infolist():
abspath = os.path.abspath(os.path.join(temp, member.filename))
if abspath.startswith(abstemp):
date_time = time.mktime(member.date_time + (0, 0, -1))
zip.extract(member, temp)
if os.path.isdir(abspath):
dirs[abspath] = date_time
else:
os.utime(abspath, (date_time, date_time))
# set time on folders
for abspath, date_time in dirs.items():
os.utime(abspath, (date_time, date_time))
# sanity check
configfile = os.path.join(temp, "basedir", "config.yaml")
if not os.path.exists(configfile):
@@ -929,6 +960,9 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
os.remove(path)
# restart server
if not restart_command:
restart_command = configdata.get("server", dict()).get("commands", dict()).get("serverRestartCommand")
if restart_command:
import sarge
@@ -938,7 +972,7 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
on_restore_done(path)
try:
sarge.run(restart_command, async_=True)
sarge.run(restart_command, close_fds=True, async_=True)
except Exception:
if callable(on_log_error):
on_log_error("Error while restarting via command {}".format(restart_command),
@@ -949,6 +983,8 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
else:
if callable(on_restore_done):
on_restore_done(path)
if callable(on_log_error):
on_log_error("No restart command configured. Please restart OctoPrint manually.")
return True
@@ -970,6 +1006,7 @@ __plugin_description__ = "Backup & restore your OctoPrint settings and data"
__plugin_disabling_discouraged__ = gettext("Without this plugin you will no longer be able to backup "
"& restore your OctoPrint settings and data.")
__plugin_license__ = "AGPLv3"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = BackupPlugin()
__plugin_hooks__ = {
"octoprint.server.http.routes": __plugin_implementation__.route_hook,
@@ -29,9 +29,10 @@ $(function() {
self.backupInProgress = ko.observable(false);
self.restoreSupported = ko.observable(true);
self.backupUploadButton = $("#settings-backup-upload");
self.backupUploadData = undefined;
self.backupUploadButton.fileupload({
self.backupUploadName = ko.observable();
var backupFileuploadOptions = {
dataType: "json",
maxNumberOfFiles: 1,
autoUpload: false,
@@ -49,8 +50,11 @@ $(function() {
self.backupUploadName(undefined);
self.backupUploadData = undefined;
}
});
self.backupUploadName = ko.observable();
};
$("#settings-backup-upload").fileupload(backupFileuploadOptions);
$("#wizard-backup-upload").fileupload(backupFileuploadOptions);
self.restoreInProgress = ko.observable(false);
self.restoreTitle = ko.observable();
self.restoreDialog = undefined;
@@ -284,6 +288,6 @@ $(function() {
OCTOPRINT_VIEWMODELS.push({
construct: BackupViewModel,
dependencies: ["loginStateViewModel", "settingsViewModel"],
elements: ["#settings_plugin_backup"]
elements: ["#settings_plugin_backup", "#wizard_plugin_backup"]
});
});
@@ -96,26 +96,8 @@
<p>{{ _('Restore settings & files from an uploaded backup archive.') }}</p>
<form class="form-horizontal">
<div class="control-group">
<label class="control-label">{{ _('Backup file') }}</label>
<div class="controls">
<div class="input-prepend">
<span class="btn fileinput-button">
<span>{{ _('Browse...') }}</span>
<input id="settings-backup-upload" type="file" name="file" data-url="{{ url_for("plugin.backup.perform_restore") }}" accept=".zip">
</span>
<span class="add-on" data-bind="text: backupUploadName"></span>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary" data-bind="enable: !backupInProgress() && !restoreInProgress(), click: performRestoreFromUpload"><i class="fa fa-spinner fa-spin" data-bind="visible: restoreInProgress"></i> {{ _('Upload & restore') }}</button>
</div>
</div>
</form>
{% set plugin_backup_upload_form_id='settings-backup-upload' %}
{% include "snippets/plugin/backup/backup_plugin_upload_form.jinja2" %}
</div>
<div data-bind="visible: !restoreSupported()">
@@ -0,0 +1,8 @@
<h3>{{ _('Restore from a backup?') }}</h3>
{% trans %}<p>
If you would like to restore OctoPrint configuration from a backup now is the time.
</p>{% endtrans %}
{% set plugin_backup_upload_form_id='wizard-backup-upload' %}
{% include "snippets/plugin/backup/backup_plugin_upload_form.jinja2" %}
@@ -0,0 +1,20 @@
<form class="form-horizontal">
<div class="control-group">
<label class="control-label">{{ _('Backup file') }}</label>
<div class="controls">
<div class="input-prepend">
<span class="btn fileinput-button">
<span>{{ _('Browse...') }}</span>
<input id="{{ plugin_backup_upload_form_id }}" type="file" name="file" data-url="{{ url_for("plugin.backup.perform_restore") }}" accept=".zip">
</span>
<span class="add-on" data-bind="text: backupUploadName"></span>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary" data-bind="enable: !backupInProgress() && !restoreInProgress(), click: performRestoreFromUpload"><i class="fa fa-spinner fa-spin" data-bind="visible: restoreInProgress"></i> {{ _('Upload & restore') }}</button>
</div>
</div>
</form>
@@ -123,4 +123,5 @@ __plugin_description__ = "Provides wizard dialogs for core components and functi
__plugin_disabling_discouraged__ = gettext("Without this plugin OctoPrint will no longer be able to perform "
"setup steps that might be required after an update.")
__plugin_license__ = "AGPLv3"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_implementation__ = CoreWizardPlugin()
@@ -107,7 +107,7 @@ class OnlineCheckSubwizard(object):
return dict(required=self._is_onlinecheck_wizard_required())
def _get_onlinecheck_wizard_name(self):
return gettext("Online connectivity check")
return gettext("Online Connectivity Check")
def _get_onlinecheck_additional_wizard_template_data(self):
return dict(mandatory=self._is_onlinecheck_wizard_required())
@@ -125,7 +125,7 @@ class PluginBlacklistSubwizard(object):
return dict(required=self._is_pluginblacklist_wizard_required())
def _get_pluginblacklist_wizard_name(self):
return gettext("Plugin blacklist")
return gettext("Plugin Blacklist")
def _get_pluginblacklist_additional_wizard_template_data(self):
return dict(mandatory=self._is_pluginblacklist_wizard_required())
Loaded 100 of 276 files, more files were not shown because too many files have changed in this diff. Show more