diff --git a/.versioneer-lookup b/.versioneer-lookup index acbff62a1..640949a91 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -20,14 +20,14 @@ HEAD # maintenance is currently the branch for preparation of maintenance release 1.3.9 # so are any fix/... and improve/... branches -maintenance 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev -fix/.* 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev -improve/.* 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev +maintenance 1.3.10 fdf0f75ffa5731fee406c6e761e84a9d2b47aa43 pep440-dev +fix/.* 1.3.10 fdf0f75ffa5731fee406c6e761e84a9d2b47aa43 pep440-dev +improve/.* 1.3.10 fdf0f75ffa5731fee406c6e761e84a9d2b47aa43 pep440-dev # staging/maintenance is currently the branch for preparation of 1.3.7rc5 # so is regressionfix/... -staging/maintenance 1.3.7rc5 e5caa3d0bf77ed23f04c1d96ab0fa997d19d2006 pep440-dev -regressionfix/.* 1.3.7rc5 e5caa3d0bf77ed23f04c1d96ab0fa997d19d2006 pep440-dev +staging/maintenance 1.3.9rc2 fdf0f75ffa5731fee406c6e761e84a9d2b47aa43 pep440-dev +regressionfix/.* 1.3.9rc2 fdf0f75ffa5731fee406c6e761e84a9d2b47aa43 pep440-dev # every other branch is a development branch and thus gets resolved to 1.4.0-dev for now .* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev diff --git a/AUTHORS.md b/AUTHORS.md index 0745d43e0..4a75bc80d 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -91,6 +91,7 @@ date of first contribution): * [Daniele Forsi](https://github.com/dforsi) * [Ganey](https://github.com/ganey) * [Sven Lohrmann](https://github.com/malnvenshorn) + * [Andy Castille](https://github.com/klikini) * [Zachary Nofzinger](https://github.com/ZachNo) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by diff --git a/CHANGELOG.md b/CHANGELOG.md index 7660f4901..c780ca0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,133 @@ # OctoPrint Changelog +## 1.3.9rc1 (2018-06-20) + +### Note for upgraders running NGINX as reverse proxy: Be sure to configure HTTP protocol version 1.1 + +OctoPrint 1.3.8 updates the internal webserver Tornado from 4.0.2 to 4.5.3. Among many many fixes and improvements this also includes a change (actually a fix) in the websocket implementation that requires you to tell your NGINX to use HTTP 1.1 instead of the default 1.0 to talk to OctoPrint. You can do this by simply adding + +``` +proxy_http_version 1.1; +``` + +to the `location` config. The [configuration examples](https://github.com/foosel/OctoPrint/wiki/Reverse-proxy-configuration-examples) have been adjusted accordingly. See also [#2526](https://github.com/foosel/OctoPrint/issues/2526). + +### Note for plugin authors + +As [announced with the release of OctoPrint 1.3.6](https://octoprint.org/blog/2017/12/12/new-release-1.3.6/), the legacy plugin bundling flag has now been removed again. [Make sure to check your plugins](https://octoprint.org/blog/2017/12/01/heads-up-plugin-authors/) if you haven't done that so far! + +### Improvements + + * [#652](https://github.com/foosel/OctoPrint/issues/652) & [#1545](https://github.com/foosel/OctoPrint/issues/1545) - Added name of user who started a job to job info (see also [#2576](https://github.com/foosel/OctoPrint/pull/2576)). + * [#1203](https://github.com/foosel/OctoPrint/issues/1203) & [#1905](https://github.com/foosel/OctoPrint/issues/1905) & [#1797](https://github.com/foosel/OctoPrint/issues/1797) & [#2514](https://github.com/foosel/OctoPrint/issues/2514) - Added support for plugins to override GCODE analysis provider and live print time estimation with their own implementations through two new hooks [`octoprint.filemanager.analysis.factory`](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-filemanager-analysis-factory) and [`octoprint.printer.estimation.factory`](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-printer-estimation-factory). + * [#1217](https://github.com/foosel/OctoPrint/issues/1217) - Software Update Plugin: Block the UI in general when an update is in progress (even in browser windows that didn't start it and logged in as user) so that no prints can be accidentally started during that. + * [#1513](https://github.com/foosel/OctoPrint/issues/1513) - Option to allow sending `M0`/`M1` to the printer instead of swallowing it. + * [#2318](https://github.com/foosel/OctoPrint/issues/2318) - Gcode Viewer: Visualize "current" print head location with a marker. + * [#2351](https://github.com/foosel/OctoPrint/issues/2351) - Support for binding to IPv6 addresses. OctoPrint will now default to binding to `::` if IPv6 support is detected, and to `0.0.0.0` if not. Both the intermediary server and Tornado are instructed to bind their sockets to both IP versions. Positive IPv6 support detection relies on + * `socket.has_ipv6` being `True` + * `socket.IPPROTO_IPV6` and `socket.IPV6_V6ONLY` being available (or redefined in case of Windows) in order to ensure dual stack binding for the intermediary server) + * [#2379](https://github.com/foosel/OctoPrint/issues/2379) - File and plugin list now use the browser's native scrollbar instead of slimscroll. Slimscroll is still bundled though, in case third party plugins might depend on it. + * [#2487](https://github.com/foosel/OctoPrint/issues/2487) - Improved documentation of system command configuration (see also [#2498](https://github.com/foosel/OctoPrint/pull/2498)). + * [#2495](https://github.com/foosel/OctoPrint/pull/2495) - Removed unneeded filter from a template. + * [#2498](https://github.com/foosel/OctoPrint/pull/2498) - Improved documentation of the `async` flags of custom system commands. + * [#2512](https://github.com/foosel/OctoPrint/issues/2512) - Log files will now contain client IP as provided by first entry in X-Forwarded-For header (or more if `server.reverseProxy.trustDownstream` is configured accordingly). + * [#2518](https://github.com/foosel/OctoPrint/issues/2518) - Display absolute file upload date and time on hover (see also [#2630](https://github.com/foosel/OctoPrint/pull/2630)). + * [#2522](https://github.com/foosel/OctoPrint/issues/2522) - Perform logging to disk asynchronously to avoid slow downs caused by it. + * [#2541](https://github.com/foosel/OctoPrint/pull/2541) - Added link to instructions to reset passwords. Part of solving [#1239](https://github.com/foosel/OctoPrint/issues/1239). + * [#2543](https://github.com/foosel/OctoPrint/pull/2543) - Added `--no-cache-dir` to pip calls to work around `MemoryErrors`. See also [#2535](https://github.com/foosel/OctoPrint/pull/2535) and [pypa/pip#2984](https://github.com/pypa/pip/issues/2984) for more details. + * [#2558](https://github.com/foosel/OctoPrint/issues/2558) - Have the watched folder processor ignore hidden files. + * [#2572](https://github.com/foosel/OctoPrint/issues/2572) - More error resilience in `ItemListHelper` against empty child elements. + * [#2573](https://github.com/foosel/OctoPrint/pull/2573) - Added `M118` to commands to never automatically upper case. + * [#2583](https://github.com/foosel/OctoPrint/issues/2583) - Handle scripts that are part of a job like other lines coming from a job and thus allow them to be kept back using `job_on_hold`. + * [#2597](https://github.com/foosel/OctoPrint/issues/2597) - Disabled animation on cancel print confirmation. + * [#2463](https://github.com/foosel/OctoPrint/issues/2463) - Added documentation for `printingarea` and `dimensions` in `gcodeAnalysis` data model (see also [#2540](https://github.com/foosel/OctoPrint/pull/2540)). + * [#2615](https://github.com/foosel/OctoPrint/issues/2615) - Allowed more granular control over components to be upgraded through the software update plugin in its settings dialog. + * [#2620](https://github.com/foosel/OctoPrint/pull/2620) - Save `ItemListHelper` page sizes to local storage. + * [#2642](https://github.com/foosel/OctoPrint/pull/2642) - Added methods for adding and updating items to `ItemListHelper`. + * [#2644](https://github.com/foosel/OctoPrint/issues/2644) - Detect broken symlinks in configured folders on startup (see also further below). + * [#2648](https://github.com/foosel/OctoPrint/pull/2648) - Allowed class methods as callbacks in view models. + * A new API endpoint [`/api/settings/templates`](http://docs.octoprint.org/en/maintenance/api/settings.html#fetch-template-data) allows (admin only) access to information regarding the loaded templates and their order in the UI. That should allow plugins wishing to offer modification of ordering of tabs, sidebar components and so on to retrieve the data they need for that. + * Have the watched folder processor handle vanished files gracefully. + * Removed [`legacyPluginAssets` flag](https://octoprint.org/blog/2017/12/01/heads-up-plugin-authors/). + * Improved requirement detection in `octoprint_setuptools`, added unit tests for that. + * Bundled `sockjs-tornado` dependency. It hasn't been updated by the author in a while although there exist a number of issues plus patches for them, so we now vendor it. + * Disabled position logging on cancel by default. If you need this, please explicitly enable it, it is causing too many issues in the field with misbehaving firmware. + * Extended URL test API to allow whitelist/blacklist check for the returned content type, used that to verify that the webcam snapshot URL actually returns images. + * Added timeout for position logging on pause/cancel. This should work around firmware which doesn't provide a proper `M114` resport that might be unparseable so we won't get stuck in those cases. + * Migrated file storage metadata to json instead of YAML since it performs way way better. + * Added `missing linenumber` to recognized non-fatal error messages. + * Got rid of some Python 2 only code. + * Added sanity checks for configured folders (see also [#2644](https://github.com/foosel/OctoPrint/issues/2644)): + * on startup: check they are writable, if not revert to defaults + * on settings save: check they are writable, if not return an HTTP 400 + * in the settings dialog: allow quick check of writability via test buttons + * Never send referrers with links + * Confirmation dialog helper now supports an HTML body. + * Sort serial ports naturally (e.g. `tty1`, `tty2`, ..., `tty10` instead of `tty1`, `tty10`, ...) + * Added `paused` and `resumed` action commands, [see here for details](http://docs.octoprint.org/en/maintenance/features/action_commands.html). + * Added two new hooks for firmware information, [`octoprint.comm.firmware.info`](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-comm-firmware-info) and [`octoprint.comm.firmware.capabilities`](http://docs.octoprint.org/en/maintenance/plugins/hooks.html#octoprint-comm-firmware-capabilities). + * Added view model list to `OctoPrint.coreui` UI module. + * Improved logging of `FatalStartupError`s. + * Updated some dependencies: + * Tornado to 4.5. Version 5 sadly has issues with web socket handling when access behind `haproxy`. So far no solution has been found, so we stay at 4.5 for now. + * jQuery to 3.3.1 + * Several other Python dependencies + * Announcement Plugin: Don't reload all notifications if one is marked as read. + * Printer Safety Plugin: Added new detected firmwares: + * Anycubic Mega + * Malyan M200 + * CR-10S + * all Repetier firmware versions prior to 0.92 + * any firmware that reports the `THERMAL_PROTECTION` capability as disabled to thermal protection warning (see also [MarlinFirmware/Marlin#10465](https://github.com/MarlinFirmware/Marlin/pull/10465)) + * Software Update Plugin: Default to `force_base = False` for version checks. + * Virtual Printer Plugin: Allow defining custom `M114` response formats. + +### Bug fixes + + * [#2333](https://github.com/foosel/OctoPrint/issues/2333) (Part 3/3) - Updated to PySerial 3.4 and utilize read and write cancelling to work around disconnect delays. + * [#2355](https://github.com/foosel/OctoPrint/issues/2355) - Fixed non deterministic sorting of files with missing fields (e.g. date for SD card files) in OctoPrint's frontend. + * [#2496](https://github.com/foosel/OctoPrint/issues/2496) - Fixed files API not allowing to walk through the directory tree unless fetching the full listing recursively by making sure that first level children nodes are always provided. + * [#2502](https://github.com/foosel/OctoPrint/pull/2502) - Fixed some invalid HTML + * [#2504](https://github.com/foosel/OctoPrint/pull/2504) & [#2532](https://github.com/foosel/OctoPrint/pull/2532) & [#2552](https://github.com/foosel/OctoPrint/pull/2552) - Fixed various typos + * [#2505](https://github.com/foosel/OctoPrint/issues/2505) - Fixed user switch to `_api` user on use of the global API key inside the browser. + * [#2509](https://github.com/foosel/OctoPrint/issues/2509) - Properly handle a printer reset while printing and don't get stuck in "Cancelling" state + * [#2517](https://github.com/foosel/OctoPrint/issues/2517) - Fixed baudrate negotiation with printers that need a bit of a delay between connection establishment and probing (e.g. Prusa MK3). + * [#2520](https://github.com/foosel/OctoPrint/issues/2520) - Fixed temperature presets being saved as strings instead of numbers. + * [#2533](https://github.com/foosel/OctoPrint/pull/2533) - Fixed API key copy button being enabled and generate button being disabled when no API key is set. + * [#2534](https://github.com/foosel/OctoPrint/issues/2534) - Fixed stale data in API key/user editor. See also [#2604](https://github.com/foosel/OctoPrint/pull/2604). + * [#2539](https://github.com/foosel/OctoPrint/issues/2539) - Made serial and baud rate lists consistent between connection panel and settings (see also [#2606](https://github.com/foosel/OctoPrint/pull/2606)). + * [#2547](https://github.com/foosel/OctoPrint/issues/2547) - Fixed `PrintFailed` being triggered in case of an error while processing the `afterPrintJobDone` GCODE script through introduction of `Resuming` and `Finishing` states. + * [#2549](https://github.com/foosel/OctoPrint/issues/2549) - Fixed "uninstall plugin" icon in Plugin Manager staying clickable even if disabled. + * [#2549](https://github.com/foosel/OctoPrint/issues/2549) - Fixed issue with detection uninstallation of disabled plugins (see also [#2650](https://github.com/foosel/OctoPrint/pull/2650)). + * [#2551](https://github.com/foosel/OctoPrint/issues/2551) - Fixed `0` being allowed for various intervals and timeouts where that values doesn't make sense. + * [#2554](https://github.com/foosel/OctoPrint/pull/2554) - Fixed a JSON example in the docs. + * [#2568](https://github.com/foosel/OctoPrint/pull/2568) - Fixed a dead link in the plugin hooks documentation in the docs. + * [#2579](https://github.com/foosel/OctoPrint/issues/2579) - Fixed print time left of "a couple of seconds" even after the print job has finished. + * [#2581](https://github.com/foosel/OctoPrint/issues/2581) & [#2587](https://github.com/foosel/OctoPrint/issues/2587) - Fixed OctoPrint getting stuck in "Pausing" or "Cancelling" state due to a race condition. + * [#2589](https://github.com/foosel/OctoPrint/issues/2589) - Added missing `typePath` field on API response for files on the printer's SD card. + * [#2591](https://github.com/foosel/OctoPrint/pull/2591) - Fixed markup of some HTML labels. + * [#2595](https://github.com/foosel/OctoPrint/pull/2595) - Fixed some UI appearance issues. + * [#2601](https://github.com/foosel/OctoPrint/issues/2601) - Properly handle relative paths for selection via `printer.select_file`. + * [#2621](https://github.com/foosel/OctoPrint/issues/2621) - Fixed framerate not being read from config for rendering unrendered timelapses. + * [#2625](https://github.com/foosel/OctoPrint/issues/2625) - Fixed incompatibility of OctoPrint's plugin subsystem with Python wheels, which are the default mode of installing plugins from pip version 10.0.0 onward. + * [#2632](https://github.com/foosel/OctoPrint/issues/2632) - Fixed race condition in resend handling on missing `ok`s. + * [#2675](https://github.com/foosel/OctoPrint/issues/2675) - Fixed a possible division by zero on SD upload. + * [#2683](https://github.com/foosel/OctoPrint/pull/2683) - Fixed two missing spaces in the german translation. + * Properly handle absolute paths for recovery data comparison. + * Fixed snapshot test button not resetting on error. + * Fixed decoupling of metadata logs in the file manager. + * Fixed "remember me" and IPv4/IPv6 sessions. This might also solve [#1881](https://github.com/foosel/OctoPrint/issues/1881). + * Removed Repetier resend repetition detection and handling code. It was buggy and introducing issues. + * Fixed script order: `beforePrint*` should always precede any commands from the print job. + +### Special thanks to all the contributors! + +Special thanks to everyone who contributed to this release candidate, especially [@benlye](https://github.com/benlye), [@dadosch](https://github.com/dadosch), [@dforsi](https://github.com/dforsi), [@ganey](https://github.com/ganey),[@malnvenshorn](https://github.com/malnvenshorn), [@ntoff](https://github.com/ntoff), [@tedder](https://github.com/tedder) and [@vitormhenrique](https://github.com/vitormhenrique) for their PRs. + +### More information + + * [Commits](https://github.com/foosel/OctoPrint/compare/1.3.8...1.3.9rc1) + ## 1.3.8 (2018-04-13) ### Bug fixes diff --git a/SUPPORTERS.md b/SUPPORTERS.md index 6159d8f79..3448ce8d2 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -12,6 +12,7 @@ thanks to everyone who contributed! * Brad Jackson * Brian E. Tyler * Christian Petropolis + * Christian Wolf * COLLE+McVOY * D Brian Kimmel * DeltaMaker 3D Printers @@ -19,14 +20,16 @@ thanks to everyone who contributed! * Ernesto Martinez * F. Kunsmann * Frank Sander - * Gary Deen + * George Robles * günter weber + * Hydra Research LLC * James Seigel * Jeff Moe * Jeff Renfer * Jefferson Hunt * Jeremiah Avery * Josh Daniels + * Joshua Wills * Kaile Riser * Kale Stedman * Kazuhiro Ogura @@ -38,14 +41,13 @@ thanks to everyone who contributed! * Michael Aumock * Miles Flavel * mitchell hirsch - * Mohammed khorakiwala * Noe Ruiz * Patrick McGinnis - * Peter Schmehl * Randy C. Will * Robert Gusek * Roger Strolz * Roy Cortes + * Rudolff Vang * Samer Najia * Simon Hallam * Stefan Krister @@ -53,6 +55,7 @@ thanks to everyone who contributed! * Sven Mueller * Symbiotic Devices * Thomas Hatley + * Timothy D Hoogland * Trent Shumay -and 1233 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file +and 1334 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file diff --git a/docs/api/settings.rst b/docs/api/settings.rst index 466cb839a..902127ab8 100644 --- a/docs/api/settings.rst +++ b/docs/api/settings.rst @@ -86,6 +86,266 @@ Regenerate the system wide API key :status 200: No error :status 403: No admin rights +.. _sec-api-settings-fetchtemplaatedata: + +Fetch template data +=================== + +.. http:get:: /api/settings/templates + + Fetch data (currently only the sorting order) of all registered template components in the system. + + Use this to get a full list of the identifiers of all UI components provided either by core OctoPrint or any + currently active plugins. + + Example: + + .. sourcecode:: http + + GET /api/settings/templates HTTP/1.1 + Host: example.com + X-Api-Key: abcdef... + + .. sourcecode:: http + + HTTP/1.1 200 OK + Content-Type: application/json + + { + "order": { + "about": [ + { + "id": "about", + "name": "About OctoPrint" + }, + { + "id": "supporters", + "name": "Supporters" + }, + { + "id": "authors", + "name": "Authors" + }, + { + "id": "changelog", + "name": "Changelog" + }, + { + "id": "license", + "name": "OctoPrint License" + }, + { + "id": "thirdparty", + "name": "Third Party Licenses" + }, + { + "id": "plugin_pluginmanager", + "name": "Plugin Licenses", + "plugin_id": "pluginmanager", + "plugin_name": "Plugin Manager" + } + ], + "generic": [ + { + "id": "plugin_announcements", + "name": "plugin_announcements", + "plugin_id": "announcements", + "plugin_name": "Announcement Plugin" + } + ], + "navbar": [ + { + "id": "settings", + "name": "settings" + }, + { + "id": "systemmenu", + "name": "systemmenu" + }, + { + "id": "plugin_announcements", + "name": "plugin_announcements", + "plugin_id": "announcements", + "plugin_name": "Announcement Plugin" + }, + { + "id": "login", + "name": "login" + } + ], + "plugin_pluginmanager_about_thirdparty": [], + "settings": [ + { + "id": "section_printer", + "name": "Printer" + }, + { + "id": "serial", + "name": "Serial Connection" + }, + { + "id": "printerprofiles", + "name": "Printer Profiles" + }, + { + "id": "temperatures", + "name": "Temperatures" + }, + { + "id": "terminalfilters", + "name": "Terminal Filters" + }, + { + "id": "gcodescripts", + "name": "GCODE Scripts" + }, + { + "id": "section_features", + "name": "Features" + }, + { + "id": "features", + "name": "Features" + }, + { + "id": "webcam", + "name": "Webcam & Timelapse" + }, + { + "id": "accesscontrol", + "name": "Access Control" + }, + { + "id": "gcodevisualizer", + "name": "GCODE Visualizer" + }, + { + "id": "api", + "name": "API" + }, + { + "id": "section_octoprint", + "name": "OctoPrint" + }, + { + "id": "server", + "name": "Server" + }, + { + "id": "folders", + "name": "Folders" + }, + { + "id": "appearance", + "name": "Appearance" + }, + { + "id": "plugin_logging", + "name": "Logging", + "plugin_id": "logging", + "plugin_name": "Logging" + }, + { + "id": "plugin_pluginmanager", + "name": "Plugin Manager", + "plugin_id": "pluginmanager", + "plugin_name": "Plugin Manager" + }, + { + "id": "plugin_softwareupdate", + "name": "Software Update", + "plugin_id": "softwareupdate", + "plugin_name": "Software Update" + }, + { + "id": "plugin_announcements", + "name": "Announcements", + "plugin_id": "announcements", + "plugin_name": "Announcement Plugin" + }, + { + "id": "section_plugins", + "name": "Plugins" + }, + { + "id": "plugin_action_command_prompt", + "name": "Action Command Prompt", + "plugin_id": "action_command_prompt", + "plugin_name": "Action Command Prompt Support" + }, + { + "id": "plugin_cura", + "name": "CuraEngine (<= 15.04)", + "plugin_id": "cura", + "plugin_name": "CuraEngine (<= 15.04)" + } + ], + "sidebar": [ + { + "id": "plugin_printer_safety_check", + "name": "Printer Safety Warning", + "plugin_id": "printer_safety_check", + "plugin_name": "Printer Safety Check" + }, + { + "id": "connection", + "name": "Connection" + }, + { + "id": "state", + "name": "State" + }, + { + "id": "files", + "name": "Files" + } + ], + "tab": [ + { + "id": "temperature", + "name": "Temperature" + }, + { + "id": "control", + "name": "Control" + }, + { + "id": "gcodeviewer", + "name": "GCode Viewer" + }, + { + "id": "terminal", + "name": "Terminal" + }, + { + "id": "timelapse", + "name": "Timelapse" + } + ], + "usersettings": [ + { + "id": "access", + "name": "Access" + }, + { + "id": "interface", + "name": "Interface" + } + ], + "wizard": [] + } + } + + Requires admin rights. + + .. warning:: + + This API endpoint is in beta. Things might change. If you happen to want to develop against it, you should drop + me an email to make sure I can give you a heads-up when something changes in an backwards incompatible way. + + :status 200: No error + :status 403: No admin rights + .. _sec-api-settings-datamodel: Data model diff --git a/docs/configuration/config_yaml.rst b/docs/configuration/config_yaml.rst index b387af622..0f2a30453 100644 --- a/docs/configuration/config_yaml.rst +++ b/docs/configuration/config_yaml.rst @@ -209,7 +209,7 @@ appearance or to modify the order and presence of the various UI components: tab: - plugin_helloworld - OctoPrint will then turn this into the order ``plugin_helloworld``, ``temperature``, ``control``, ``gcodeviewer``, + OctoPrint will then display the tabs in the order ``plugin_helloworld``, ``temperature``, ``control``, ``gcodeviewer``, ``terminal``, ``timelapse`` plus any other plugins. @@ -617,15 +617,16 @@ Settings pertaining to the server side GCODE analysis implementation. .. code-block:: yaml - # Maximum number of extruders to support/to sanity check for - maxExtruders: 10 + gcodeAnalysis: + # Maximum number of extruders to support/to sanity check for + maxExtruders: 10 - # Pause between each processed GCODE line in normal priority mode, seconds - throttle_normalprio: 0.01 + # Pause between each processed GCODE line in normal priority mode, seconds + throttle_normalprio: 0.01 - # Pause between each processed GCODE line in high priority mode (e.g. on fresh - # uploads), seconds - throttle_highprio: 0.0 + # Pause between each processed GCODE line in high priority mode (e.g. on fresh + # uploads), seconds + throttle_highprio: 0.0 .. _sec-configuration-config_yaml-gcodeviewer: @@ -636,16 +637,17 @@ Settings pertaining to the built in GCODE Viewer. .. code-block:: yaml - # Whether to enable the GCODE viewer in the UI - enabled: true + gcodeViewer: + # Whether to enable the GCODE viewer in the UI + enabled: true - # Maximum size a GCODE file may have on mobile devices to automatically be loaded - # into the viewer, defaults to 2MB - mobileSizeThreshold: 2097152 + # Maximum size a GCODE file may have on mobile devices to automatically be loaded + # into the viewer, defaults to 2MB + mobileSizeThreshold: 2097152 - # Maximum size a GCODE file may have to automatically be loaded into the viewer, - # defaults to 20MB - sizeThreshold: 20971520 + # Maximum size a GCODE file may have to automatically be loaded into the viewer, + # defaults to 20MB + sizeThreshold: 20971520 .. _sec-configuration-config_yaml-plugins: diff --git a/docs/development/virtual_printer.rst b/docs/development/virtual_printer.rst index 479cdc198..85d35c50e 100644 --- a/docs/development/virtual_printer.rst +++ b/docs/development/virtual_printer.rst @@ -57,60 +57,71 @@ You can simulate certain conditions and communications through the terminal tab All commands start with ``!!DEBUG:`` and are followed by the command you want to execute. For instance, sending ``!!DEBUG:action_disconnect`` will disconnect the printer. Sending ``!!DEBUG`` without command will show a help -message with all the available commands. +message with all the available commands: -Action Triggers -............... +.. code-block:: none -``action_pause`` -Sends a "// action:pause" action trigger to the host. + OctoPrint Virtual Printer debug commands -``action_resume`` -Sends a "// action:resume" action trigger to the host. + help + ? + | This help. -``action_disconnect`` -Sends a "// action:disconnect" action trigger to the host. + # Action Triggers -``action_custom [ ]`` -Sends a custom "// action: " action trigger to the host. + action_pause + | Sends a "// action:pause" action trigger to the host. + action_resume + | Sends a "// action:resume" action trigger to the host. + action_disconnect + | Sends a "// action:disconnect" action trigger to the + | host. + action_custom [ ] + | Sends a custom "// action: " + | action trigger to the host. -Communication Errors -.................... + # Communication Errors -``dont_answer`` -Will not acknowledge the next command. + dont_answer + | Will not acknowledge the next command. + go_awol + | Will completely stop replying + trigger_resend_lineno + | Triggers a resend error with a line number mismatch + trigger_resend_checksum + | Triggers a resend error with a checksum mismatch + trigger_missing_checksum + | Triggers a resend error with a missing checksum + trigger_missing_lineno + | Triggers a "no line number with checksum" error w/o resend request + drop_connection + | Drops the serial connection + prepare_ok + | Will cause to be enqueued for use, + | will be used instead of actual "ok" -``go_awol`` -Will completely stop replying. + # Reply Timing / Sleeping -``trigger_resend_lineno`` -Triggers a resend error with a line number mismatch + sleep + | Sleep s + sleep_after + | Sleeps s after each execution of + sleep_after_next + | Sleeps s after execution of next -``trigger_resend_checksum`` -Triggers a resend error with a checksum mismatch + # SD printing -``drop_connection`` -Drops the serial connection + start_sd + | Select and start printing file from SD + select_sd + | Select file from SD, don't start printing it yet. Use + | start_sd to start the print + cancel_sd + | Cancels an ongoing SD print -``prepare_ok `` -Will cause to be enqueued for use, will be used instead of actual "ok" + # Misc -Reply Timing / Sleeping -....................... -``sleep `` -Sleep s - -``sleep_after `` -Sleeps s after each execution of - -``sleep_after_next `` -Sleeps s after execution of next - -Misc -.... - -``help`` -Show the available commands. - -``send `` -Sends back + send + | Sends back + reset + | Simulates a reset. Internal state will be lost. diff --git a/setup.py b/setup.py index f783049cb..08ddb4b92 100644 --- a/setup.py +++ b/setup.py @@ -16,8 +16,8 @@ import octoprint_setuptools INSTALL_REQUIRES = [ "flask>=0.12,<0.13", "werkzeug>=0.11.1,<0.12", - "tornado>=4.5.3,<5", - "Jinja2>=2.8,<2.9", # Jinja 2.9 has breaking changes WRT template scope - we can't + "tornado==4.5.3", + "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 #"sockjs-tornado>=1.0.3,<1.1", # current version is incompatible to tornado 5, we use a @@ -29,25 +29,26 @@ INSTALL_REQUIRES = [ "Flask-Assets>=0.12,<0.13", "markdown>=2.6.4,<2.7", "pyserial>=3.4,<3.5", - "netaddr>=0.7.17,<0.8", + "netaddr>=0.7.19,<0.8", "watchdog>=0.8.3,<0.9", - "sarge>=0.1.4,<0.2", - "netifaces>=0.10,<0.11", + "sarge==0.1.4", # 0.1.5 introduced a breaking change with regards to the async keyword. Pinning + # to 0.1.4 for now to work around this. + "netifaces>=0.10.6,<0.11", "pylru>=1.0.9,<1.1", "rsa>=3.4,<3.5", "pkginfo>=1.4.2,<1.5", "requests>=2.18.4,<3", "semantic_version>=2.6.0,<2.7", - "psutil>=5.4.5,<5.5", + "psutil>=5.4.6,<5.5", "Click>=6.7,<6.8", "awesome-slugify>=1.6.5,<1.7", "feedparser>=5.2.1,<5.3", "chainmap>=1.0.2,<1.1", - "future>=0.15,<0.16", + "future>=0.15.2,<0.16", "scandir>=1.3,<1.4", - "websocket-client>=0.40,<0.41", - "python-dateutil>=2.6,<2.7", - "wrapt>=1.10.10,<1.11", + "websocket-client>=0.40.0,<0.41", + "python-dateutil>=2.6.1,<2.7", + "wrapt>=1.10.11,<1.11", "futures>=3.1.1,<3.2", "emoji>=0.4.5,<0.5", "monotonic>=1.3,<1.4", diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index 45a8328a1..31566ff46 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -50,15 +50,24 @@ del version_info #~~ custom exceptions -class FatalStartupError(BaseException): - pass +class FatalStartupError(Exception): + def __init__(self, message, cause=None): + self.cause = cause + Exception.__init__(self, message) + + def __str__(self): + result = Exception.__str__(self) + if self.cause: + return "{}: {}".format(result, str(self.cause)) + else: + return result #~~ init methods to bring up platform def init_platform(basedir, configfile, use_logging_file=True, logging_file=None, logging_config=None, debug=False, verbosity=0, uncaught_logger=None, uncaught_handler=None, safe_mode=False, ignore_blacklist=False, after_preinit_logging=None, - after_settings=None, after_logging=None, after_safe_mode=None, + after_settings_init=None, after_logging=None, after_safe_mode=None, after_settings_valid=None, after_event_manager=None, after_connectivity_checker=None, after_plugin_manager=None, after_environment_detector=None): kwargs = dict() @@ -70,55 +79,80 @@ def init_platform(basedir, configfile, use_logging_file=True, logging_file=None, if callable(after_preinit_logging): after_preinit_logging(**kwargs) - settings = init_settings(basedir, configfile) + try: + settings = init_settings(basedir, configfile) + except Exception as ex: + raise FatalStartupError("Could not initialize settings manager", cause=ex) kwargs["settings"] = settings - if callable(after_settings): - after_settings(**kwargs) + if callable(after_settings_init): + after_settings_init(**kwargs) + + try: + logger = init_logging(settings, + use_logging_file=use_logging_file, + logging_file=logging_file, + default_config=logging_config, + debug=debug, + verbosity=verbosity, + uncaught_logger=uncaught_logger, + uncaught_handler=uncaught_handler) + except Exception as ex: + raise FatalStartupError("Could not initialize logging", cause=ex) - logger = init_logging(settings, - use_logging_file=use_logging_file, - logging_file=logging_file, - default_config=logging_config, - debug=debug, - verbosity=verbosity, - uncaught_logger=uncaught_logger, - uncaught_handler=uncaught_handler) kwargs["logger"] = logger - if callable(after_logging): after_logging(**kwargs) settings_safe_mode = settings.getBoolean(["server", "startOnceInSafeMode"]) safe_mode = safe_mode or settings_safe_mode kwargs["safe_mode"] = safe_mode - if callable(after_safe_mode): after_safe_mode(**kwargs) - event_manager = init_event_manager(settings) + # now before we continue, let's make sure *all* our folders are sane + try: + settings.sanity_check_folders() + except Exception as ex: + raise FatalStartupError("Configured folders didn't pass sanity check", cause=ex) + if callable(after_settings_valid): + after_settings_valid(**kwargs) + + try: + event_manager = init_event_manager(settings) + except Exception as ex: + raise FatalStartupError("Could not initialize event manager", cause=ex) kwargs["event_manager"] = event_manager if callable(after_event_manager): after_event_manager(**kwargs) - connectivity_checker = init_connectivity_checker(settings, event_manager) + try: + connectivity_checker = init_connectivity_checker(settings, event_manager) + except Exception as ex: + raise FatalStartupError("Could not initialize connectivity checker", cause=ex) kwargs["connectivity_checker"] = connectivity_checker if callable(after_connectivity_checker): after_connectivity_checker(**kwargs) - plugin_manager = init_pluginsystem(settings, - safe_mode=safe_mode, - ignore_blacklist=ignore_blacklist, - connectivity_checker=connectivity_checker) - kwargs["plugin_manager"] = plugin_manager + try: + plugin_manager = init_pluginsystem(settings, + safe_mode=safe_mode, + ignore_blacklist=ignore_blacklist, + connectivity_checker=connectivity_checker) + except Exception as ex: + raise FatalStartupError("Could not initialize settings manager", cause=ex) + kwargs["plugin_manager"] = plugin_manager if callable(after_plugin_manager): after_plugin_manager(**kwargs) - environment_detector = init_environment_detector(plugin_manager) - kwargs["environment_detector"] = environment_detector + try: + environment_detector = init_environment_detector(plugin_manager) + except Exception as ex: + raise FatalStartupError("Could not initialize environment detector", cause=ex) + kwargs["environment_detector"] = environment_detector if callable(after_environment_detector): after_environment_detector(**kwargs) diff --git a/src/octoprint/cli/server.py b/src/octoprint/cli/server.py index 1e7a98f19..5fed71e5a 100644 --- a/src/octoprint/cli/server.py +++ b/src/octoprint/cli/server.py @@ -86,8 +86,13 @@ def run_server(basedir, configfile, host, port, debug, allow_root, logging_confi settings, _, safe_mode, event_manager, connectivity_checker, plugin_manager, environment_detector = components except FatalStartupError as e: - click.echo(e.message, err=True) - click.echo("There was a fatal error starting up OctoPrint.", err=True) + logger = logging.getLogger("octoprint.startup").fatal + echo = lambda x: click.echo(x, err=True) + + for method in logger, echo: + method(str(e)) + method("There was a fatal error starting up OctoPrint.") + else: from octoprint.server import Server octoprint_server = Server(settings=settings, diff --git a/src/octoprint/plugins/action_command_prompt/__init__.py b/src/octoprint/plugins/action_command_prompt/__init__.py index 0dd9a4be2..5ce3e348d 100644 --- a/src/octoprint/plugins/action_command_prompt/__init__.py +++ b/src/octoprint/plugins/action_command_prompt/__init__.py @@ -7,6 +7,7 @@ __copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms import octoprint.plugin from octoprint.server import user_permission +from octoprint.access import USER_GROUP import flask from flask_babel import gettext @@ -46,6 +47,17 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin, def initialize(self): self._selection_command = self._settings.get([b"selection_command"]) + # Additional permissions hook + + def get_additional_permissions(self): + return [ + dict(key="INTERACT", + name="Interact with printer prompts", + description=gettext("Allows to see and interact with printer prompts"), + default_groups=[USER_GROUP], + roles=["interact"]) + ] + #~ AssetPlugin def get_assets(self): @@ -162,5 +174,6 @@ __plugin_disabling_discouraged__ = gettext("Without this plugin your printer wil __plugin_license__ = "AGPLv3" __plugin_implementation__ = ActionCommandPromptPlugin() __plugin_hooks__ = { - b"octoprint.comm.protocol.action": __plugin_implementation__.action_command_handler + b"octoprint.comm.protocol.action": __plugin_implementation__.action_command_handler, + b"octoprint.access.permissions": __plugin_implementation__.get_additional_permissions } diff --git a/src/octoprint/plugins/action_command_prompt/static/js/action_command_prompt.js b/src/octoprint/plugins/action_command_prompt/static/js/action_command_prompt.js index 6298a5338..e5f8c1244 100644 --- a/src/octoprint/plugins/action_command_prompt/static/js/action_command_prompt.js +++ b/src/octoprint/plugins/action_command_prompt/static/js/action_command_prompt.js @@ -29,11 +29,12 @@ $(function() { var self = this; self.loginState = parameters[0]; + self.access = parameters[1]; self._modal = undefined; self.requestData = function() { - if (!self.loginState.isUser()) return; + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_PROMPT_INTERACT)) return; OctoPrint.plugins.action_command_prompt.get() .done(self.fromResponse); @@ -78,7 +79,7 @@ $(function() { }; self.onDataUpdaterPluginMessage = function(plugin, data) { - if (!self.loginState.isUser()) return; + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_PROMPT_INTERACT)) return; if (plugin !== "action_command_prompt") { return; } @@ -99,6 +100,6 @@ $(function() { OCTOPRINT_VIEWMODELS.push({ construct: ActionCommandPromptViewModel, - dependencies: ["loginStateViewModel"] + dependencies: ["loginStateViewModel", "accessViewModel"] }); }); diff --git a/src/octoprint/plugins/announcements/static/js/announcements.js b/src/octoprint/plugins/announcements/static/js/announcements.js index e4fc58f33..ece0a9367 100644 --- a/src/octoprint/plugins/announcements/static/js/announcements.js +++ b/src/octoprint/plugins/announcements/static/js/announcements.js @@ -67,9 +67,11 @@ $(function() { return link; }; - self.markRead = function(channel, until) { + self.markRead = function(channel, until, reload) { if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ANNOUNCEMENTS_READ)) return; + reload = !!reload; + var url = PLUGIN_BASEURL + "announcements/channels/" + channel; var payload = { @@ -84,7 +86,9 @@ $(function() { data: JSON.stringify(payload), contentType: "application/json; charset=UTF-8", success: function() { - self.retrieveData() + if (reload) { + self.retrieveData() + } } }) }; diff --git a/src/octoprint/plugins/announcements/templates/announcements.jinja2 b/src/octoprint/plugins/announcements/templates/announcements.jinja2 index 524e8850a..47bf0952e 100644 --- a/src/octoprint/plugins/announcements/templates/announcements.jinja2 +++ b/src/octoprint/plugins/announcements/templates/announcements.jinja2 @@ -28,7 +28,7 @@
diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js index 64e1c066b..9a0631f18 100644 --- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js +++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js @@ -400,8 +400,6 @@ $(function() { }; self.performCheck = function(showIfNothingNew, force, ignoreSeen) { - if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_SOFTWAREUPDATE_CHECK) && !self.settings.settings.plugins.softwareupdate.notify_users()) return; - self.checking(true); OctoPrint.plugins.softwareupdate.check(force) .done(function(data) { @@ -582,7 +580,7 @@ $(function() { }; self._showWorkingDialog = function(title) { - if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_SOFTWAREUPDATE_UPDATE)) { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_SOFTWAREUPDATE_CHECK)) { return; } diff --git a/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 b/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 index 68b61d78a..106d64bc5 100644 --- a/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 +++ b/src/octoprint/plugins/softwareupdate/templates/softwareupdate_settings.jinja2 @@ -111,7 +111,9 @@