Merge branch 'devel' into dev/commRefactoringNG

# Conflicts:
#	src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
#	src/octoprint/printer/standard.py
#	src/octoprint/templates/dialogs/settings/serialconnection.jinja2
#	translations/de/LC_MESSAGES/messages.po
#	translations/messages.pot
This commit is contained in:
Gina Häußge committed 2019-09-20 16:13:07 +02:00
commit 6c75ff6c98
124 files changed
+5076 -5609

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
# These are supported funding model platforms
github: [foosel]
patreon: foosel
custom: https://octoprint.org/support-octoprint/
+3 -2
View File
@@ -16,8 +16,9 @@ checklist:
made sure your changes don't interfere with current development by
talking it through with the maintainers, e.g. through a
Brainstorming ticket
* [ ] Your PR targets OctoPrint's devel branch, or maintenance if it's
a bug fix for an issue present in the current stable version (no PRs
* [ ] Your PR targets OctoPrint's devel branch if it's a completely
new feature, or maintenance if it's a bug fix or improvement of
existing functionality for the current stable version (no PRs
against master or anything else please)
* [ ] Your PR was opened from a custom branch on your repository
(no PRs from your version of master, maintenance or devel please),
+7 -7
View File
@@ -18,16 +18,16 @@ prerelease
HEAD
\(detached.*
# maintenance is currently the branch for preparation of maintenance release 1.3.12
# maintenance is currently the branch for preparation of maintenance release 1.3.13
# so are any fix/... and improve/... branches
maintenance 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
fix/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
improve/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
maintenance 1.3.13 2a42f02aecaedf2c55579984e0bc94e44402cc15 pep440-dev
fix/.* 1.3.13 2a42f02aecaedf2c55579984e0bc94e44402cc15 pep440-dev
improve/.* 1.3.13 2a42f02aecaedf2c55579984e0bc94e44402cc15 pep440-dev
# staging/maintenance is currently the branch for preparation of 1.3.11rc4
# staging/maintenance is currently the branch for preparation of 1.3.12rc3
# so is regressionfix/...
staging/maintenance 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev
regressionfix/.* 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev
staging/maintenance 1.3.12rc3 c4258c5bb0eae30595e6463281f266582096ad48 pep440-dev
regressionfix/.* 1.3.12rc3 c4258c5bb0eae30595e6463281f266582096ad48 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
+6
View File
@@ -105,6 +105,12 @@ date of first contribution):
* [Jack Wilsdon](https://github.com/jackwilsdon)
* [Ryan Finnie](https://github.com/rfinnie)
* [Timur Duehr](https://github.com/tduehr)
* [Nicolai Nielsen](https://github.com/dovecode)
* [Janne Mäntyharju](https://github.com/JanneMantyharju)
* [Steven Spungin](https://github.com/flamenco)
* [Piotr Usewicz](https://github.com/pusewicz)
* [Aliaksei Pilko](https://github.com/aliaksei135)
* [Ben Yarmis](https://github.com/byarmis)
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
+106
View File
@@ -1,5 +1,111 @@
# OctoPrint Changelog
## 1.3.12rc2 (2019-09-17)
### Improvements
* [#3271](https://github.com/foosel/OctoPrint/issues/3271) - Extend safemode to also disable third party language packs
### Bug fixes
* [#3270](https://github.com/foosel/OctoPrint/issues/3270) - Properly escape translation strings in single/double quoted template locations
* [#3272](https://github.com/foosel/OctoPrint/issues/3272) (regression) - GCODE viewer: Fix out-of-sync & layer slider issue
* [#3273](https://github.com/foosel/OctoPrint/issues/3273) (regression) - Fix minimum pip version for OctoPi 0.15.1, which turns out is 9.0.3, not 10.0.1 as on OctoPi 0.15.0 due to a bug related version pin back then when.
### Special thanks to all the contributors!
Special thanks to everyone who contributed to this release candidate and provided full, analysable bug reports!
### More information
* [Commits](https://github.com/foosel/OctoPrint/compare/1.3.12rc1...1.3.12rc2)
## 1.3.12rc1 (2019-09-10)
### Improvements
* [#1239](https://github.com/foosel/OctoPrint/issues/1239) & [#3227](https://github.com/foosel/OctoPrint/pull/3227) - Add command line interface for user management. Via `octoprint user [add_user|remove_user|change_password]` it is now possible to add & remove users or change their passwords right from the command line instead of just through the web interface. That should also make password recovery easier and as simple as `octoprint user change_password username`.
* [#2896](https://github.com/foosel/OctoPrint/issues/2896) - Add confirmation dialog when removing a plugin (see also [#3179](https://github.com/foosel/OctoPrint/pull/3179)).
* [#3075](https://github.com/foosel/OctoPrint/issues/3075) - Calculate filament usage for all extruders in `M605` duplicate/mirror setup (see also [#3181](https://github.com/foosel/OctoPrint/pull/3181)).
* [#3101](https://github.com/foosel/OctoPrint/issues/3101) - Support tags on GCODE script hook and add `plugin:<plugin id>` to script parts from plugins.
* [#2669](https://github.com/foosel/OctoPrint/issues/2669) - Add option for disabling filters on search results in the file list (see also [#3126](https://github.com/foosel/OctoPrint/pull/3126)).
* [#3131](https://github.com/foosel/OctoPrint/pull/3131) - Allow subscribing to multiple events in one yaml based event subscription.
* [#3133](https://github.com/foosel/OctoPrint/issues/3133) - Adjust wording in case of file upload errors to also hint at permission problems.
* [#3134](https://github.com/foosel/OctoPrint/pull/3134) - Add support for logging in (and creating users) through `REMOTE_USER` header supplied by a reverse proxy in front of OctoPrint.
* [#3147](https://github.com/foosel/OctoPrint/pull/3147) - Forcelogin: Add autofocus to the username
* [#3161](https://github.com/foosel/OctoPrint/issues/3161) - Plugin manager: Reduce height of plugin list.
* [#3162](https://github.com/foosel/OctoPrint/issues/3162) - Make closing behaviour of dialogs adjustable: default behaviour is to close on click outside of dialog, this can now be disabled.
* [#3167](https://github.com/foosel/OctoPrint/pull/3167) - Make it configurable whether to perform the parity double open workaround on serial needed for (some?) debian based systems. Solves issues for FreeBSD systems & Klipper.
* [#3180](https://github.com/foosel/OctoPrint/pull/3180) - Add button to terminal tab to clear the log.
* [#3188](https://github.com/foosel/OctoPrint/issues/3188) - Suppress scary `WebSocketClosedError` messages in the log simply caused by closing the browser.
* [#3171](https://github.com/foosel/OctoPrint/issues/3171) & [#3204](https://github.com/foosel/OctoPrint/issues/3204) - Action command prompts: Add close button to prompts triggered through action commands by the firmware. Wouldn't have been necessary if firmware wasn't already abusing this feature created for *interactive prompts* as non interactive fire&forget notification dialogs 🙄
* [#3174](https://github.com/foosel/OctoPrint/issues/3174) - Include upload date & time in State panel to make file refreshs clearer.
* [#3191](https://github.com/foosel/OctoPrint/pull/3191) - Docs: Clarify that a target temperature value of 0 turns heaters off.
* [#3198](https://github.com/foosel/OctoPrint/issues/3198) - Clarify execution order of GCODE scripts.
* [#3199](https://github.com/foosel/OctoPrint/issues/3199) - Hardening against corrupt print recovery data.
* [#3203](https://github.com/foosel/OctoPrint/issues/3203) - Add documentation for `printTimeLeftOrigin` field.
* [#3206](https://github.com/foosel/OctoPrint/issues/3206) - Better resilience against garbage on the line on initial connect to the printer due to more handshake attempts.
* [#3207](https://github.com/foosel/OctoPrint/issues/3207) - Try to guess the mimetype if there is none during the webcam stream test.
* [#3218](https://github.com/foosel/OctoPrint/pull/3218) - Small refactoring in comm layer
* [#3225](https://github.com/foosel/OctoPrint/pull/3225) - Quote arguments in `pip install` to avoid issues with shells other than bash.
* [#3249](https://github.com/foosel/OctoPrint/pull/3249) & [#3263](https://github.com/foosel/OctoPrint/pull/3263) - Printer profile events are now properly triggered.
* [#3250](https://github.com/foosel/OctoPrint/issues/3250) - Add optional confirmation dialog for starting a print.
* Make emergency codes configurable.
* Detect endless resend requests of the same line. If the printer keeps requesting the same line over and over again, something is either seriously wrong with the line or with the connection. In any case, log an error and disconnect.
* Send `M112` on disconnect due to an error (configurable) to try to disable heaters and such.
* More type annotations throughout the code.
* Re-add missing `minHeight` support to modals.
* Ensure line breaks on copy of terminal contents.
* Error Tracking: Further limit events that go out, this time by fqcn of callback methods, if needed.
* GCODE viewer: Increase logging.
* Plugin Manager: Prevent plugin installs while throttled due to undervoltage or overheating.
* Software Update: Consider an empty restart command an unset one.
* Software Update: Prevent updates while throttled due to undervoltage or overheating.
* Tracking: Track plugins & versions once every 24h. This is a feature requested repeatedly by plugin developers and will also allow the compilation of something like a Top-10-list.
* Tracking: Track slicing events
### Bug fixes
* [#3022](https://github.com/foosel/OctoPrint/issues/3022) & [#3236](https://github.com/foosel/OctoPrint/issues/3236) - Ignore `NaN` and `Inf` values in GCODE analysis result, don't allow `NaN` on APIs.
* [#3095](https://github.com/foosel/OctoPrint/issues/3095) - Fix a small error in the frontend through bootstrap update.
* [#3096](https://github.com/foosel/OctoPrint/issues/3096) - Fix handling of `Empty` exception in send loop.
* [#3104](https://github.com/foosel/OctoPrint/issues/3104) - `M112` and other emergency codes must *always* jump the internal command queue even when printing and be sent immediately.
* [#3107](https://github.com/foosel/OctoPrint/issues/3107) - Prevent issues if `hash` field on file metadata is unset.
* [#3109](https://github.com/foosel/OctoPrint/issues/3109) - Fix some unicode issues on the API.
* [#3114](https://github.com/foosel/OctoPrint/issues/3114) - Virtual printer: Fix handling of closed connection.
* [#3137](https://github.com/foosel/OctoPrint/issues/3137) - Do not invert axes in GCODE viewer. The axis inversion is only relevant to the control panel (depends on how the print head is positioned), NOT the rendition of the GCODE.
* [#3142](https://github.com/foosel/OctoPrint/issues/3142) - Only do autologin if not actively logged out.
* [#3143](https://github.com/foosel/OctoPrint/issues/3143) - Fix layers vanishing from GCODE viewer on settings access.
* [#3153](https://github.com/foosel/OctoPrint/issues/3153) - Fix wrong variable name in an exception handler.
* [#3154](https://github.com/foosel/OctoPrint/issues/3154) - Strip interface tags from IPv6 addresses in local address check.
* [#3155](https://github.com/foosel/OctoPrint/issues/3155) - Backup: Make sure `exclude` is always a list.
* [#3156](https://github.com/foosel/OctoPrint/issues/3156) - Tracking: Fix error if tracked time is `None`.
* [#3157](https://github.com/foosel/OctoPrint/issues/3157) - Plugin manager: Better handling of unexpected repository format (e.g. in case of a misconfigured repository URL).
* [#3166](https://github.com/foosel/OctoPrint/issues/3166) & [#3211](https://github.com/foosel/OctoPrint/issues/3211) - Fix caching behaviour in case of active wizards.
* [#3171](https://github.com/foosel/OctoPrint/issues/3171) - Action command prompts: Remove prompts on disconnect from the printer.
* [#3176](https://github.com/foosel/OctoPrint/issues/3176) - Forcelogin: Don't touch static endpoints.
* [#3177](https://github.com/foosel/OctoPrint/issues/3177) - Always report all tools in shared nozzle setups to avoid inconsistencies.
* [#3190](https://github.com/foosel/OctoPrint/issues/3190) - Plugin Manager: Refresh the repository list on cache timeout, not just on server restart and/or connectivity events.
* [#3194](https://github.com/foosel/OctoPrint/issues/3194) & [#3196](https://github.com/foosel/OctoPrint/issues/3196) - Fix typo causing a `KeyError` on starting a second consecutive print of a file (see also [#3195](https://github.com/foosel/OctoPrint/pull/3195)).
* [#3217](https://github.com/foosel/OctoPrint/pull/3217) - Docs: Fix typo in chambers documentation
* [#3220](https://github.com/foosel/OctoPrint/issues/3220) - Fix `_long_running_command` flag for `M191` on comm layer.
* [#3224](https://github.com/foosel/OctoPrint/issues/3224) - Fix file selection not being cleared in the frontend on printer disconnect.
* [#3247](https://github.com/foosel/OctoPrint/issues/3247) - Fix scoping issue in JavaScript for custom commands with `javascript`/`enabled` fields.
* [#3253](https://github.com/foosel/OctoPrint/issues/3253) - Software Update: Fix error in python version detection (see also [#3256](https://github.com/foosel/OctoPrint/pull/3256)).
* [#3257](https://github.com/foosel/OctoPrint/issues/3257) - Appkeys: Ignore empty username on `request` endpoint to avoid later issues.
* Fix broken filtering of valid tools
* Properly clear out user data from user management dialogs
* Appkeys: Fix handling of empty request body, should return `400 Bad Request` instead of `500 Internal Server Error`.
* Printer safety: Anycubic 1.1.2 is already safe (off by one error, used to only detect >1.1.2 instead of >=1.1.2)
### Special thanks to all the contributors!
Special thanks to everyone who contributed to this release candidate and provided full, analyzable bug reports and pull requests, especially [@aliaksei135](https://github.com/aliaksei135), [@AndyQ](https://github.com/AndyQ), [@dmweis](https://github.com/dmweis), [@esver](https://github.com/esver), [@gdombiak](https://github.com/gdombiak), [@jackwilsdon](https://github.com/jackwilsdon), [@JanneMantyharju](https://github.com/JanneMantyharju), [@kevans91](https://github.com/kevans91), [@pusewicz](https://github.com/pusewicz), [@rfinnie](https://github.com/rfinnie) and [@tduehr](https://github.com/tduehr) for their PRs.
### More information
* [Commits](https://github.com/foosel/OctoPrint/compare/1.3.11...1.3.12rc1)
## 1.3.11 (2019-05-14)
### Heads-up: 1.3.11 unbundles the Cura plugin
+5 -4
View File
@@ -31,7 +31,7 @@ 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
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.
@@ -39,7 +39,7 @@ able to help you with any questions you might have.
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
in the [bug tracker](https://github.com/foosel/OctoPrint/issues), support of other users on
[the community forum at community.octoprint.org](https://community.octoprint.org)
and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
@@ -65,14 +65,15 @@ you already have Python 2.7, 3.6 or 3.7, pip and virtualenv set up on your syste
1. Checkout OctoPrint: `git clone https://github.com/foosel/OctoPrint.git`
2. Change into the OctoPrint folder: `cd OctoPrint`
3. Create a user-owned virtual environment therein: `virtualenv venv`
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`.
4. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install .`
You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octoprint`, see [Usage](#usage)
for details.
After installation, please make sure you follow the first-run wizard and set up
access control as necessary.
access control as necessary.
## Dependencies
+5 -3
View File
@@ -8,8 +8,8 @@ thanks to everyone who contributed!
* Andre Bubel
* Andrew Moorby
* ANTONIO AUGUSTO DE LIMA PONTES
* Arnljot Arntsen
* Bjorn Breckenridge
* Boris Hussein
* Brad Jackson
* Christian Petropolis
@@ -27,7 +27,6 @@ thanks to everyone who contributed!
* Jeff Renfer
* Jefferson Hunt
* Jeremiah Avery
* Joseph Payne
* Joshua Wills
* Justin Kaufman
* Kaile Riser
@@ -41,9 +40,11 @@ thanks to everyone who contributed!
* Miles Flavel
* Mosaic Manufacturing
* OMER MEHMET SUTAS
* Patrick Glyré
* Patrick McGinnis
* Prof Yuh Wen Chen
* Randy C. Will
* Ranjib Dey
* Robert Gusek
* Samer Najia
* Shawn Lewis
@@ -53,5 +54,6 @@ thanks to everyone who contributed!
* TEVO 3D Printers
* Trent Shumay
* Ulrich Kempken
* Vladislav Kuzemchik
and 1544 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 1587 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
+11
View File
@@ -218,6 +218,17 @@ Progress information
- 1
- Integer
- Estimate of time left to print, in seconds
* - ``printTimeLeftOrigin``
- 1
- String
- Origin of the current time left estimate. Can currently be either of:
* ``linear``: based on an linear approximation of the progress in file in bytes vs time
* ``analysis``: based on an analysis of the file
* ``estimate``: calculated estimate after stabilization of linear estimation
* ``average``: based on the average total from past prints of the same model against the same printer profile
* ``mixed-analysis``: mixture of ``estimate`` and ``analysis``
* ``mixed-average``: mixture of ``estimate`` and ``average``
.. _sec-api-datamodel-files:
+5 -5
View File
@@ -350,7 +350,7 @@ Issue a tool command
Sets the given target temperature on the printer's tools. Additional parameters:
* ``targets``: Target temperature(s) to set, properties must match the format ``tool{n}`` with ``n`` being the
tool's index starting with 0.
tool's index starting with 0. A value of `0` will turn the heater off.
offset
Sets the given temperature offset on the printer's tools. Additional parameters:
@@ -630,7 +630,7 @@ Issue a bed command
target
Sets the given target temperature on the printer's bed. Additional parameters:
* ``target``: Target temperature to set.
* ``target``: Target temperature to set. A value of `0` will turn the heater off.
offset
Sets the given temperature offset on the printer's bed. Additional parameters:
@@ -770,7 +770,7 @@ Retrieve the current bed state
Issue a chamber command
=======================
.. http:post:: /api/printer/bed
.. http:post:: /api/printer/chamber
Chamber commands allow setting the temperature and temperature offsets for the printer's heated chamber. Available commands
are:
@@ -778,7 +778,7 @@ Issue a chamber command
target
Sets the given target temperature on the printer's chamber. Additional parameters:
* ``target``: Target temperature to set.
* ``target``: Target temperature to set. A value of `0` will turn the heater off.
offset
Sets the given temperature offset on the printer's chamber. Additional parameters:
@@ -790,7 +790,7 @@ Issue a chamber command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
If no heated chambed is configured for the currently selected printer profile, the resource will return
If no heated chamber is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires user rights.
+1 -2
View File
@@ -425,8 +425,7 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# Lines to send on simulated reset
resetLines:
- start
- Marlin: Virtual Marlin!
- "\x80"
- "Marlin: Virtual Marlin!"
- "SD card ok"
# Initial set of prepared oks to use instead of regular ok (e.g. to simulate
+17 -1
View File
@@ -588,6 +588,7 @@ SlicingStarted
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
@@ -599,6 +600,7 @@ SlicingDone
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
@@ -611,6 +613,7 @@ SlicingCancelled
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
@@ -621,6 +624,7 @@ SlicingFailed
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
@@ -636,7 +640,7 @@ SlicingProfileAdded
* ``profile``: the profile that was added
SlicingProfileModified
A new slicing profile was modified.
A slicing profile was modified.
Payload:
@@ -661,3 +665,15 @@ SettingsUpdated
This event may also be triggered if calling code of :py:class:`octoprint.settings.Settings.save` or
:py:class:`octoprint.plugin.PluginSettings.save` sets the ``trigger_event`` parameter to ``True``.
.. _sec-events-available_events-printer_profile:
Printer Profile
--------
PrinterProfileModified
A printer profile was modified.
Payload:
* ``identifier``: the identifier of the modified printer profile
+17 -10
View File
@@ -5,19 +5,20 @@ Safe mode
*********
With the advent of support for plugins in OctoPrint, it quickly became apparent that some of the bugs
reported on OctoPrint's bug tracker were actually bugs with installed third party plugins instead of
OctoPrint itself.
reported on OctoPrint's bug tracker were actually bugs with installed third party plugins or language
packs instead of OctoPrint itself.
To allow an easier identification of these cases, OctoPrint 1.3.0 introduced safe mode. Starting
OctoPrint in safe mode disables all plugins that are not bundled with OctoPrint, allowing to easier
identify most cases where a third party plugin is the culprit of an observed issue.
OctoPrint in safe mode disables all plugins (and starting with 1.3.13 also all language packs) that are
not bundled with OctoPrint, allowing to easier identify most cases where a third party plugin or language
pack is the culprit of an observed issue.
Additionally, OctoPrint allows uninstalling plugins in this mode, allowing recovery from cases where
a third party plugin causes the server to not start up or the web interface to not render or function
correctly anymore.
Additionally, OctoPrint allows uninstalling plugins and language packs in this mode, allowing recovery
from cases where a third party addition causes the server to not start up or the web interface to not
render or function correctly anymore.
Whenever reporting an issue with OctoPrint, please always attempt to reproduce it in safe mode as well to
ensure it really is an issue in OctoPrint itself and now caused by one of your installed third party plugins.
ensure it really is an issue in OctoPrint itself and now caused by one of your installed third party additions.
.. _sec-features-safemode-how:
@@ -73,11 +74,17 @@ When OctoPrint is running in safe mode the following changes to its normal opera
* OctoPrint will not enable any of the installed third party plugins. OctoPrint considers all plugins third
party plugins that do not ship with OctoPrint's sources, so any plugins installed either via `pip` or
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint`` (Windows) and
``~/Library/Application Support/OctoPrint`` (MacOS).
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint/plugins`` (Windows) and
``~/Library/Application Support/OctoPrint/plugins`` (MacOS).
* OctoPrint will not enable any of the installed third party language packs. OctoPrint considers all language packs
third party language packs that do not ship with OctoPrint's sources, so any language plugins installed
through the language pack manager within settings and/or stored in the language pack folder at
``~/.octoprint/translations`` (Linux), ``%APPDATA%/OctoPrint/translations`` (Windows) or
``~/Library/Application Support/OctoPrint/translations`` (MacOS).
* OctoPrint will still allow to uninstall third party plugins through the built-in Plugin Manager.
* OctoPrint will still allow to disable (bundled) plugins that are still enabled.
* OctoPrint will not allow to enable third party plugins.
* OctoPrint will still allow to manage language packs.
* OctoPrint's web interface will display a notification to remind you that it is running in
safe mode.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 58 KiB

+3 -1
View File
@@ -58,7 +58,8 @@ INSTALL_REQUIRES = [
"wrapt>=1.11.1,<1.12",
"emoji>=0.5.1,<0.6",
"frozendict>=1.2,<1.3",
"sentry-sdk==0.7.7"
"sentry-sdk==0.7.7",
"filetype>=1.0.5,<2"
]
# Python 2 specific requirements
@@ -93,6 +94,7 @@ EXTRA_REQUIRES = dict(
"sphinxcontrib-httpdomain",
"sphinxcontrib-mermaid>=0.3",
"sphinx_rtd_theme",
"readthedocs-sphinx-ext==0.5.7"
],
# Dependencies for developing OctoPrint plugins
+45 -20
View File
@@ -19,15 +19,18 @@ import logging
# noinspection PyCompatibility
from builtins import range, bytes
from octoprint.settings import settings
from octoprint.settings import settings as s
from octoprint.util import atomic_write, to_bytes, deprecated, monotonic_time
from octoprint.util import get_fully_qualified_classname as fqcn
from octoprint.access.permissions import Permissions, OctoPrintPermission
from octoprint.access.groups import GroupChangeListener, Group
from past.builtins import basestring
class UserManager(GroupChangeListener, object):
def __init__(self, group_manager):
def __init__(self, group_manager, settings=None):
self._group_manager = group_manager
self._group_manager.register_listener(self)
@@ -36,6 +39,10 @@ class UserManager(GroupChangeListener, object):
self._sessionids_by_userid = dict()
self._enabled = True
if settings is None:
settings = s()
self._settings = settings
self._login_status_listeners = []
def register_login_status_listener(self, listener):
@@ -92,7 +99,8 @@ class UserManager(GroupChangeListener, object):
try:
listener.on_user_logged_in(user)
except Exception:
self._logger.exception("Error in on_user_logged_in on {!r}".format(listener))
self._logger.exception("Error in on_user_logged_in on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
self._logger.debug("Logged in user: %r" % user)
@@ -124,7 +132,8 @@ class UserManager(GroupChangeListener, object):
try:
listener.on_user_logged_out(user)
except Exception:
self._logger.exception("Error in on_user_logged_out on {!r}".format(listener))
self._logger.exception("Error in on_user_logged_out on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
self._logger.debug("Logged out user: %r" % user)
@@ -136,16 +145,18 @@ class UserManager(GroupChangeListener, object):
self.logout_user(user)
@staticmethod
def create_password_hash(password, salt=None):
def create_password_hash(password, salt=None, settings=None):
if not salt:
salt = settings().get(["accessControl", "salt"])
if settings is None:
settings = s()
salt = settings.get(["accessControl", "salt"])
if salt is None:
import string
from random import choice
chars = string.ascii_lowercase + string.ascii_uppercase + string.digits
salt = "".join(choice(chars) for _ in range(32))
settings().set(["accessControl", "salt"], salt)
settings().save()
settings.set(["accessControl", "salt"], salt)
settings.save()
return hashlib.sha512(to_bytes(password, encoding="utf-8", errors="replace") + to_bytes(salt)).hexdigest()
@@ -154,13 +165,16 @@ class UserManager(GroupChangeListener, object):
if not user:
return False
hash = UserManager.create_password_hash(password)
hash = UserManager.create_password_hash(password,
settings=self._settings)
if user.check_password(hash):
# new hash matches, correct password
return True
else:
# new hash doesn't match, but maybe the old one does, so check that!
oldHash = UserManager.create_password_hash(password, salt="mvBUTvwzBzD3yPwvnJ4E4tXNf3CGJvvW")
oldHash = UserManager.create_password_hash(password,
salt="mvBUTvwzBzD3yPwvnJ4E4tXNf3CGJvvW",
settings=self._settings)
if user.check_password(oldHash):
# old hash matches, we migrate the stored password hash to the new one and return True since it's the correct password
self.change_user_password(username, password)
@@ -261,7 +275,8 @@ class UserManager(GroupChangeListener, object):
for user in users:
listener.on_user_modified(user)
except Exception:
self._logger.exception("Error in on_user_modified on {!r}".format(listener))
self._logger.exception("Error in on_user_modified on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
def on_group_subgroups_changed(self, group, added=None, removed=None):
users = self.find_sessions_for(lambda u: group in u.groups)
@@ -271,7 +286,8 @@ class UserManager(GroupChangeListener, object):
for user in users:
listener.on_user_modified(user)
except Exception:
self._logger.exception("Error in on_user_modified on {!r}".format(listener))
self._logger.exception("Error in on_user_modified on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
def _trigger_on_user_modified(self, user):
if isinstance(user, basestring):
@@ -300,14 +316,16 @@ class UserManager(GroupChangeListener, object):
for user in users:
listener.on_user_modified(user)
except Exception:
self._logger.exception("Error in on_user_modified on {!r}".format(listener))
self._logger.exception("Error in on_user_modified on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
def _trigger_on_user_removed(self, username):
for listener in self._login_status_listeners:
try:
listener.on_user_removed(username)
except Exception:
self._logger.exception("Error in on_user_removed on {!r}".format(listener))
self._logger.exception("Error in on_user_removed on {!r}".format(listener),
extra=dict(callback=fqcn(listener)))
#~~ Deprecated methods follow
@@ -428,13 +446,13 @@ class LoginStatusListener(object):
##~~ FilebasedUserManager, takes available users from users.yaml file
class FilebasedUserManager(UserManager):
def __init__(self, group_manager, path=None):
UserManager.__init__(self, group_manager)
def __init__(self, group_manager, path=None, settings=None):
UserManager.__init__(self, group_manager, settings=settings)
if path is None:
path = settings().get(["accessControl", "userfile"])
path = self._settings.get(["accessControl", "userfile"])
if path is None:
path = os.path.join(settings().getBaseFolder("base"), "users.yaml")
path = os.path.join(s().getBaseFolder("base"), "users.yaml")
self._userfile = path
@@ -537,7 +555,13 @@ class FilebasedUserManager(UserManager):
if username in self._users and not overwrite:
raise UserAlreadyExists(username)
self._users[username] = User(username, UserManager.create_password_hash(password), active, permissions, groups, apikey=apikey)
self._users[username] = User(username,
UserManager.create_password_hash(password,
settings=self._settings),
active,
permissions,
groups,
apikey=apikey)
self._dirty = True
self._save()
@@ -670,7 +694,8 @@ class FilebasedUserManager(UserManager):
if not username in self._users:
raise UnknownUser(username)
passwordHash = UserManager.create_password_hash(password)
passwordHash = UserManager.create_password_hash(password,
settings=self._settings)
user = self._users[username]
if user._passwordHash != passwordHash:
user._passwordHash = passwordHash
+2 -1
View File
@@ -138,9 +138,10 @@ from .dev import dev_commands
from .client import client_commands
from .config import config_commands
from .analysis import analysis_commands
from .user import user_commands
@click.group(name="octoprint", invoke_without_command=True, cls=click.CommandCollection,
sources=[server_commands, plugin_commands, dev_commands, client_commands, config_commands, analysis_commands])
sources=[server_commands, plugin_commands, dev_commands, client_commands, config_commands, analysis_commands, user_commands])
@standard_options()
@legacy_options
@click.version_option(version=octoprint.__version__, allow_from_autoenv=False)
+184
View File
@@ -0,0 +1,184 @@
# 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) 2019 The OctoPrint Project - Released under terms of the AGPLv3 License"
import click
import logging
from octoprint import init_settings
from octoprint.cli import get_ctx_obj_option
from octoprint.access.groups import FilebasedGroupManager
from octoprint.access.users import FilebasedUserManager, UnknownUser, UserAlreadyExists
from octoprint.util import get_class
click.disable_unicode_literals_warning = True
#~~ "octoprint user" commands
@click.group()
def user_commands():
pass
@user_commands.group(name="user")
@click.pass_context
def user(ctx):
"""
User management.
Note that this currently only supports managing user accounts stored in the configured user manager, not any
user managers added through plugins and the "octoprint.users.factory" hook.
"""
try:
logging.basicConfig(level=logging.DEBUG if get_ctx_obj_option(ctx, "verbosity", 0) > 0 else logging.WARN)
settings = init_settings(get_ctx_obj_option(ctx, "basedir", None), get_ctx_obj_option(ctx, "configfile", None))
group_manager_name = settings.get(["accessControl", "groupManager"])
try:
clazz = get_class(group_manager_name)
group_manager = clazz()
except AttributeError:
click.echo("Could not instantiate group manager {}, "
"falling back to FilebasedGroupManager!".format(group_manager_name), err=True)
group_manager = FilebasedGroupManager()
ctx.obj.group_manager = group_manager
name = settings.get(["accessControl", "userManager"])
try:
clazz = get_class(name)
user_manager = clazz(group_manager=group_manager, settings=settings)
except Exception:
click.echo("Could not instantiate user manager {}, falling back to FilebasedUserManager!".format(name), err=True)
user_manager = FilebasedUserManager(group_manager, settings=settings)
finally:
user_manager.enabled = settings.getBoolean(["accessControl", "enabled"])
ctx.obj.user_manager = user_manager
except Exception:
click.echo("Could not instantiate user manager", err=True)
return
@user.command(name="list")
@click.pass_context
def list_users_command(ctx):
"""Lists user information"""
users = ctx.obj.user_manager.get_all_users()
_print_list(users)
@user.command(name="add")
@click.argument("username", type=click.STRING, required=True)
@click.password_option("--password", "password", help="Password for the user")
@click.option("-g", "--group", "groups", multiple=True,
help="Groups to set on the user")
@click.option("-p", "--permission", "permissions", multiple=True,
help="Individual permissions to set on the user")
@click.option("--admin", "is_admin", type=click.BOOL, is_flag=True, default=False,
help="Adds user to admin group")
@click.pass_context
def add_user_command(ctx, username, password, groups, permissions, is_admin):
"""Add a new user."""
if not groups:
groups = []
if is_admin:
groups.append(ctx.obj.group_manager.admin_group)
try:
ctx.obj.user_manager.add_user(username,
password,
groups=groups,
permissions=permissions,
active=True)
user = ctx.obj.user_manager.find_user(username)
if user:
click.echo("User created:")
click.echo("\t{}".format(_user_to_line(user.as_dict())))
except UserAlreadyExists:
click.echo("A user with the name {} does already exist!".format(username), err=True)
@user.command(name="remove")
@click.argument("username", type=click.STRING)
@click.pass_context
def remove_user_command(ctx, username):
"""Remove an existing user."""
confirm = click.prompt("This is will irreversibly destroy the user account! Enter 'yes' to confirm",
type=click.STRING)
if confirm.lower() == "yes":
ctx.obj.user_manager.remove_user(username)
click.echo("User {} removed.".format(username))
else:
click.echo("User {} not removed.".format(username))
@user.command(name="password")
@click.argument("username", type=click.STRING)
@click.password_option("--password", "password", help="New password for user")
@click.pass_context
def change_password_command(ctx, username, password):
"""Change an existing user's password."""
try:
ctx.obj.user_manager.change_user_password(username, password)
click.echo("Password changed for user {}.".format(username))
except UnknownUser:
click.echo("User {} does not exist!".format(username), err=True)
@user.command(name="activate")
@click.argument("username", type=click.STRING)
@click.pass_context
def activate_command(ctx, username):
"""Activate a user account."""
try:
ctx.obj.user_manager.change_user_activation(username, True)
click.echo("User {} activated.".format(username))
user = ctx.obj.user_manager.find_user(username)
if user:
click.echo("User created:")
click.echo("\t{}".format(_user_to_line(user.asDict())))
except UnknownUser:
click.echo("User {} does not exist!".format(username), err=True)
@user.command(name="deactivate")
@click.argument("username", type=click.STRING)
@click.pass_context
def deactivate_command(ctx, username):
"""Activate a user account."""
try:
ctx.obj.user_manager.change_user_activation(username, False)
click.echo("User {} activated.".format(username))
user = ctx.obj.user_manager.find_user(username)
if user:
click.echo("User created:")
click.echo("\t{}".format(_user_to_line(user.asDict())))
except UnknownUser:
click.echo("User {} does not exist!".format(username), err=True)
def _print_list(users):
click.echo("{} users registered in the system:".format(len(users)))
for user in sorted(map(lambda x: x.as_dict(), users), key=lambda x: x.get("name")):
click.echo("\t{}".format(_user_to_line(user)))
def _user_to_line(user):
return "{name}" \
"\n\t\tactive: {active}" \
"\n\t\tgroups: {groups}" \
"\n\t\tpermissions: {permissions}".format(name=user.get("name"),
active=user.get("active", "False"),
groups=", ".join(user.get("groups", [])),
permissions=", ".join(user.get("permissions", [])))
+24 -16
View File
@@ -17,6 +17,7 @@ from octoprint.events import eventManager, Events
from .destinations import FileDestinations
from .analysis import QueueEntry, AnalysisQueue
from .util import AbstractFileWrapper, StreamWrapper, DiskFileWrapper
from octoprint.util import get_fully_qualified_classname as fqcn
from collections import namedtuple
@@ -330,16 +331,18 @@ class FileManager(object):
printer_profile_id, callback, callback_args, _error=None, _cancelled=False, _analysis=None):
try:
if _error:
eventManager().fire(Events.SLICING_FAILED, dict(stl=source_path,
stl_location=source_location,
gcode=dest_path,
gcode_location=dest_location,
reason=_error))
eventManager().fire(Events.SLICING_FAILED, dict(slicer=slicer_name,
stl=source_path,
stl_location=source_location,
gcode=dest_path,
gcode_location=dest_location,
reason=_error))
elif _cancelled:
eventManager().fire(Events.SLICING_CANCELLED, dict(stl=source_path,
stl_location=source_location,
gcode=dest_path,
gcode_location=dest_location))
eventManager().fire(Events.SLICING_CANCELLED, dict(slicer=slicer_name,
stl=source_path,
stl_location=source_location,
gcode=dest_path,
gcode_location=dest_location))
else:
source_meta = self.get_metadata(source_location, source_path)
hash = source_meta.get("hash", "n/a")
@@ -357,11 +360,12 @@ class FileManager(object):
printer_profile=printer_profile, analysis=_analysis)
end_time = octoprint.util.monotonic_time()
eventManager().fire(Events.SLICING_DONE, dict(stl=source_path,
stl_location=source_location,
gcode=dest_path,
gcode_location=dest_location,
time=end_time - start_time))
eventManager().fire(Events.SLICING_DONE, dict(slicer=slicer_name,
stl=source_path,
stl_location=source_location,
gcode=dest_path,
gcode_location=dest_location,
time=end_time - start_time))
if callback is not None:
if callback_args is None:
@@ -382,7 +386,8 @@ class FileManager(object):
slicer = self._slicing_manager.get_slicer(slicer_name)
start_time = octoprint.util.monotonic_time()
eventManager().fire(Events.SLICING_STARTED, {"stl": source_path,
eventManager().fire(Events.SLICING_STARTED, {"slicer": slicer_name,
"stl": source_path,
"stl_location": source_location,
"gcode": dest_path,
"gcode_location": dest_location,
@@ -428,7 +433,8 @@ class FileManager(object):
try:
callback.sendSlicingProgress(slicer, source_location, source_path, dest_location, dest_path, progress_int)
except Exception:
self._logger.exception("Exception while pushing slicing progress")
self._logger.exception("Exception while pushing slicing progress",
extra=dict(callback=fqcn(callback)))
if progress_int:
def call_plugins(slicer, source_location, source_path, dest_location, dest_path, progress):
@@ -663,6 +669,8 @@ class FileManager(object):
try:
with io.open(self._recovery_file, 'rt', encoding='utf-8') as f:
data = yaml.safe_load(f)
if not isinstance(data, dict) or not all(map(lambda x: x in data, ("origin", "path", "pos", "date"))):
raise ValueError("Invalid recovery data structure")
return data
except Exception:
self._logger.exception("Could not read recovery data from file {}".format(self._recovery_file))
+6 -1
View File
@@ -19,6 +19,7 @@ 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
class QueueEntry(collections.namedtuple("QueueEntry", "name, path, type, location, absolute_path, printer_profile, analysis")):
@@ -109,7 +110,11 @@ class AnalysisQueue(object):
def _analysis_finished(self, entry, result):
for callback in self._callbacks:
callback(entry, result)
try:
callback(entry, result)
except:
self._logger.exception(u"Error while pushing analysis data to callback {}".format(callback),
extra=dict(callback=fqcn(callback)))
eventManager().fire(Events.METADATA_ANALYSIS_FINISHED, {"name": entry.name,
"path": entry.path,
"origin": entry.location,
@@ -82,6 +82,8 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
def on_event(self, event, payload):
if event == Events.CONNECTED and self._enable == "always" and self._enable_signal_support:
self._printer.commands(["{command} P1".format(command=self._command)])
elif event == Events.DISCONNECTED:
self._close_prompt()
#~ SettingsPlugin
@@ -226,7 +228,7 @@ __plugin_name__ = "Action Command Prompt Support"
__plugin_description__ = "Allows your printer to trigger prompts 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"
"confirmation or selection prompts in OctoPrint")
" confirmation or selection prompts in OctoPrint")
__plugin_license__ = "AGPLv3"
__plugin_implementation__ = ActionCommandPromptPlugin()
__plugin_hooks__ = {
@@ -5,7 +5,17 @@ $(function() {
self.loginState = parameters[0];
self.access = parameters[1];
self._modal = undefined;
self.modal = ko.observable(undefined);
self.text = ko.observable();
self.buttons = ko.observableArray([]);
self.active = ko.pureComputed(function() {
return self.text() !== undefined;
});
self.visible = ko.pureComputed(function() {
return self.modal() !== undefined;
});
self.requestData = function() {
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_PROMPT_INTERACT)) return;
@@ -16,26 +26,35 @@ $(function() {
self.fromResponse = function(data) {
if (data.hasOwnProperty("text") && data.hasOwnProperty("choices")) {
self._showPrompt(data.text, data.choices);
self.text(data.text);
self.buttons(data.choices);
self.showPrompt();
} else {
self.text(undefined);
self.buttons([]);
}
};
self._showPrompt = function(text, buttons) {
self.showPrompt = function() {
var text = self.text();
var buttons = self.buttons();
var opts = {
title: gettext("Message from your printer"),
message: text,
selections: buttons,
maycancel: true, // see #3171
onselect: function(index) {
if (index > -1) {
self._select(index);
}
},
onclose: function() {
self._modal = undefined;
self.modal(undefined);
}
};
self._modal = showSelectionDialog(opts)
self.modal(showSelectionDialog(opts));
};
self._select = function(index) {
@@ -43,8 +62,9 @@ $(function() {
};
self._closePrompt = function() {
if (self._modal) {
self._modal.modal("hide");
var modal = self.modal();
if (modal) {
modal.modal("hide");
}
};
@@ -60,10 +80,14 @@ $(function() {
switch (data.action) {
case "show": {
self._showPrompt(data.text, data.choices);
self.text(data.text);
self.buttons(data.choices);
self.showPrompt();
break;
}
case "close": {
self.text(undefined);
self.buttons([]);
self._closePrompt();
break;
}
@@ -74,6 +98,7 @@ $(function() {
OCTOPRINT_VIEWMODELS.push({
construct: ActionCommandPromptViewModel,
dependencies: ["loginStateViewModel", "accessViewModel"]
dependencies: ["loginStateViewModel", "accessViewModel"],
elements: ["#navbar_plugin_action_command_prompt"]
});
});
@@ -0,0 +1,3 @@
<a id="navbar_show_prompt" class="pull-right" style="display: none" href="javascript:void(0)" data-bind="click: function() { showPrompt(); }, visible: active() && !visible()" title="{{ _('Message from your printer')|edq }}">
<i class="fa fa-commenting-o"></i>
</a>
@@ -1,3 +1,3 @@
<a id="navbar_show_announcements" class="pull-right" href="javascript:void(0)" data-bind="click: function() { showAnnouncementDialog(); }" title="{{ _('Announcements') }}">
<a id="navbar_show_announcements" class="pull-right" href="javascript:void(0)" data-bind="click: function() { showAnnouncementDialog(); }" title="{{ _('Announcements')|edq }}">
<i class="fa" data-bind="css: {'fa-bell-o': !unread(), 'fa-bell': unread()}"></i>
</a>
+20 -1
View File
@@ -45,6 +45,12 @@ class PendingDecision(object):
user_id=self.user_id,
user_token=self.user_token)
def __repr__(self):
return u"PendingDecision({!r}, {!r}, {!r}, {!r}, timeout_callback=...)".format(self.app_id,
self.app_token,
self.user_id,
self.user_token)
class ReadyDecision(object):
def __init__(self, app_id, app_token, user_id):
@@ -56,6 +62,11 @@ class ReadyDecision(object):
def for_pending(cls, pending, user_id):
return cls(pending.app_id, pending.app_token, user_id)
def __repr__(self):
return u"ReadyDecision({!r}, {!r}, {!r})".format(self.app_id,
self.app_token,
self.user_id)
class ActiveKey(object):
def __init__(self, app_id, api_key, user_id):
@@ -76,6 +87,11 @@ class ActiveKey(object):
def for_internal(cls, internal, user_id):
return cls(internal["app_id"], internal["api_key"], user_id)
def __repr__(self):
return u"ActiveKey({!r}, {!r}, {!r})".format(self.app_id,
self.api_key,
self.user_id)
class AppKeysPlugin(octoprint.plugin.AssetPlugin,
octoprint.plugin.BlueprintPlugin,
@@ -135,12 +151,15 @@ class AppKeysPlugin(octoprint.plugin.AssetPlugin,
@no_firstrun_access
def handle_request(self):
data = flask.request.json
if data is None:
return flask.make_response("Missing key request", 400)
if not "app" in data:
return flask.make_response("No app name provided", 400)
app_name = data["app"]
user_id = None
if "user" in data:
if "user" in data and data["user"]:
user_id = data["user"]
app_token, user_token = self._add_pending_decision(app_name, user_id=user_id)
@@ -40,8 +40,8 @@
<tr>
<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') }}" 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') }}" class="fa fa-trash-o" data-bind="click: function() { $parent.revokeKey($data.api_key, $data.user_id) }"></a></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>
</tr>
</tbody>
</table>
@@ -13,8 +13,8 @@
</thead>
<tbody data-bind="foreach: keys.paginatedItems">
<tr>
<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') }}" 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') }}" class="fa fa-trash-o" data-bind="click: function() { $parent.revokeKey($data.api_key) }"></a></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) }"></a></td>
</tr>
</tbody>
</table>
+2
View File
@@ -633,6 +633,8 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
try:
if exclude is None:
exclude = []
if not isinstance(exclude, list):
exclude = list(exclude)
if "timelapse" in exclude:
exclude.append("timelapse_tmp")
@@ -197,10 +197,10 @@ $(function() {
self.loglines.push({line: " ", stream: "message"});
self.loglines.push({line: gettext("Restore successful! The server will now be restarted!"), stream: "message"});
self.restoreInProgress(false);
} else if (data.type === "install_plugin") {
} else if (data.type === "installing_plugin") {
self.loglines.push({line: " ", stream: "message"});
self.loglines.push({
line: _.sprintf(gettext("Installing plugin \"%(plugin)s}\"..."), {plugin: data.plugin.name}),
line: _.sprintf(gettext("Installing plugin \"%(plugin)s\"..."), {plugin: data.plugin}),
stream: "message"
});
} else if (data.type === "plugin_incompatible") {
@@ -46,7 +46,7 @@
<td class="settings_plugin_backup_name" data-bind="text: name"></td>
<td class="settings_plugin_backup_date" data-bind="text: formatDate(date)"></td>
<td class="settings_plugin_backup_size" data-bind="text: formatSize(size)"></td>
<td class="settings_plugin_backup_actions"><a href="javascript:void(0)" title="{{ _('Delete') }}" class="fa fa-trash-o" data-bind="click: function() { $parent.removeBackup($data.name) }, css: {disabled: $root.backupInProgress() || $root.restoreInProgress()"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Download') }}" class="fa fa-download" data-bind="attr: {href: url}"></a><span data-bind="visible: $parent.restoreSupported()">&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Restore') }}" data-bind="click: function() { $parent.restoreBackup($data.name) }, css: {disabled: $root.backupInProgress() || $root.restoreInProgress()"><i class="fa fa-refresh"></i></a></span></td>
<td class="settings_plugin_backup_actions"><a href="javascript:void(0)" title="{{ _('Delete')|edq }}" class="fa fa-trash-o" data-bind="click: function() { $parent.removeBackup($data.name) }, css: {disabled: $root.backupInProgress() || $root.restoreInProgress()"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Download')|edq }}" class="fa fa-download" data-bind="attr: {href: url}"></a><span data-bind="visible: $parent.restoreSupported()">&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Restore')|edq }}" data-bind="click: function() { $parent.restoreBackup($data.name) }, css: {disabled: $root.backupInProgress() || $root.restoreInProgress()"><i class="fa fa-refresh"></i></a></span></td>
</tr>
</tbody>
</table>
@@ -29,7 +29,7 @@
<p>{% trans %}
Finally, please decide on whether to enable or disable the connectivity check. You may change the configuration at
any time to a later date through Settings > Server right from within OctoPrint.
any time through Settings > Server right from within OctoPrint.
{% endtrans %}</p>
<div class="row-fluid">
@@ -7,13 +7,14 @@ __copyright__ = "Copyright (C) 2019 The OctoPrint Project - Released under terms
import octoprint.plugin
import logging
from octoprint.util import get_fully_qualified_classname as fqcn
from octoprint.util.version import get_octoprint_version_string, is_released_octoprint_version
from flask import jsonify
from flask_babel import gettext
SENTRY_URL_SERVER = "https://4069187705ab4e76921eb19db2e9ccbb@sentry.io/1373987"
SENTRY_URL_COREUI = "https://a4ab48f27daf4c129392b78be15412b8@sentry.io/1374096"
SENTRY_URL_SERVER = "https://2eecd116552e4d498caa75d2e67edc5a@sentry.io/1373987"
SENTRY_URL_COREUI = "https://f5e6d16d17d64d588b5d8221eb9eeb39@sentry.io/1374096"
SETTINGS_DEFAULTS = dict(enabled=False,
enabled_unreleased=False,
@@ -29,19 +30,24 @@ import tornado.websocket
IGNORED_EXCEPTIONS = [
# serial exceptions in octoprint.util.comm
(serial.SerialException, lambda exc, logger, plugin: logger == "octoprint.util.comm"),
(serial.SerialException, lambda exc, logger, plugin, cb: logger == "octoprint.util.comm"),
# isp errors during port auto detection in octoprint.util.comm
(octoprint.util.avr_isp.ispBase.IspError, lambda exc, logger, plugin: logger == "octoprint.util.comm"),
(octoprint.util.avr_isp.ispBase.IspError, lambda exc, logger, plugin, cb: logger == "octoprint.util.comm"),
# IOErrors of any kind due to a full file system
(IOError, lambda exc, logger, plugin: getattr(exc, "errno") and exc.errno in (getattr(errno, "ENOSPC"),)),
(IOError, lambda exc, logger, plugin, cb: getattr(exc, "errno") and exc.errno in (getattr(errno, "ENOSPC"),)),
# RequestExceptions of any kind
requests.exceptions.RequestException,
# Tornado WebSocketErrors of any kind
tornado.websocket.WebSocketError
tornado.websocket.WebSocketError,
# Anything triggered by or in third party plugin Astroprint
(Exception, lambda exc, logger, plugin, cb: logger.startswith("octoprint.plugins.astroprint")
or plugin == "astroprint"
or cb.startswith("octoprint_astroprint."))
]
try:
@@ -138,6 +144,7 @@ def _enable_errortracking():
handled = True
logger = event.get("logger", "")
plugin = event.get("extra", dict()).get("plugin", None)
callback = event.get("extra", dict()).get("callback", None)
for ignore in IGNORED_EXCEPTIONS:
if isinstance(ignore, tuple):
@@ -147,8 +154,8 @@ def _enable_errortracking():
matcher = lambda *args: True
exc = hint["exc_info"][1]
if isinstance(exc, ignored_exc) and matcher(exc, logger, plugin):
# exception ignored for logger
if isinstance(exc, ignored_exc) and matcher(exc, logger, plugin, callback):
# exception ignored for logger, plugin and/or callback
return None
elif isinstance(ignore, type):
@@ -25,7 +25,7 @@
</div>
</div>
<div class="control-group">
<label class="control-label" title="{{ _('Random unique instance ID') }}">{{ _('Instance ID') }}</label>
<label class="control-label" title="{{ _('Random unique instance ID')|edq }}">{{ _('Instance ID') }}</label>
<div class="controls">
<span style="padding-top: 5px; margin-bottom: 5px; display: inline-block" data-bind="text: settings.plugins.errortracking.unique_id() || 'N/A'"></span>
</div>
@@ -84,7 +84,7 @@
</select>
</div>
<div class="span1">
<a title="{{ _('Remove') }}" class="btn btn-danger" data-bind="click: $parent.removeLogger"><i class="icon-trash"></i></a>
<a title="{{ _('Remove')|edq }}" class="btn btn-danger" data-bind="click: $parent.removeLogger"><i class="icon-trash"></i></a>
</div>
</div>
</div>
@@ -103,7 +103,7 @@
</select>
</div>
<div class="span1">
<a title="{{ _('Add') }}" class="btn btn-primary" data-bind="click: $root.addLogger"><i class="icon-plus"></i></a>
<a title="{{ _('Add')|edq }}" class="btn btn-primary" data-bind="click: $root.addLogger"><i class="icon-plus"></i></a>
</div>
</div>
</div>
+1 -1
View File
@@ -305,7 +305,7 @@ __plugin_name__ = "Pi Support Plugin"
__plugin_author__ = "Gina Häußge"
__plugin_description__ = "Provides additional information about your Pi in the UI."
__plugin_disabling_discouraged__ = gettext("Without this plugin OctoPrint will no longer be able to "
"provide additional information about your Pi,"
"provide additional information about your Pi, "
"which will make it more tricky to help you if you need support.")
__plugin_license__ = "AGPLv3"
@@ -1,4 +1,4 @@
<a href="https://faq.octoprint.org/pi-issues" target="_blank" rel="noopener noreferrer" data-bind="visible: currentIssue() || pastIssue(), popover: { placement: 'bottom', title: '{{ _('What do the symbols mean?') }}', html: true, content: popoverContent, trigger: 'hover' }" style="display: none">
<span data-bind="visible: currentUndervoltage() || pastUndervoltage(), css: {'pi_support_state_pulsate': currentUndervoltage}" title="{{ _('Undervoltage') }}"><i class="fa fa-bolt"></i><i class="fa fa-exclamation"></i></span>
<span data-bind="visible: currentOverheat() || pastOverheat(), css: {'pi_support_state_pulsate': currentOverheat}" title="{{ _('Overheat') }}"><i class="fa fa-thermometer-full"></i><i class="fa fa-exclamation"></i></span>
<a href="https://faq.octoprint.org/pi-issues" target="_blank" rel="noopener noreferrer" data-bind="visible: currentIssue() || pastIssue(), popover: { placement: 'bottom', title: '{{ _('What do the symbols mean?')|esq }}', html: true, content: popoverContent, trigger: 'hover' }" style="display: none">
<span data-bind="visible: currentUndervoltage() || pastUndervoltage(), css: {'pi_support_state_pulsate': currentUndervoltage}" title="{{ _('Undervoltage')|edq }}"><i class="fa fa-bolt"></i><i class="fa fa-exclamation"></i></span>
<span data-bind="visible: currentOverheat() || pastOverheat(), css: {'pi_support_state_pulsate': currentOverheat}" title="{{ _('Overheat')|edq }}"><i class="fa fa-thermometer-full"></i><i class="fa fa-exclamation"></i></span>
</a>
@@ -40,6 +40,9 @@ _DATA_FORMAT_VERSION = "v2"
def map_repository_entry(entry):
if not isinstance(entry, dict):
return None
result = copy.deepcopy(entry)
if not "follow_dependency_links" in result:
@@ -113,20 +116,26 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
self._repository_plugins = []
self._repository_cache_path = None
self._repository_cache_ttl = 0
self._repository_mtime = None
self._notices = dict()
self._notices_available = False
self._notices_cache_path = None
self._notices_cache_ttl = 0
self._notices_mtime = None
self._console_logger = None
self._get_throttled = lambda: False
def initialize(self):
self._console_logger = logging.getLogger("octoprint.plugins.pluginmanager.console")
self._repository_cache_path = os.path.join(self.get_plugin_data_folder(), "plugins.json")
self._repository_cache_ttl = self._settings.get_int(["repository_ttl"]) * 60
self._notices_cache_path = os.path.join(self.get_plugin_data_folder(), "notices.json")
self._notices_cache_ttl = self._settings.get_int(["notices_ttl"]) * 60
self._confirm_uninstall = self._settings.global_get_boolean(["confirm_uninstall"])
self._confirm_disable = self._settings.global_get_boolean(["confirm_disable"])
self._pip_caller = LocalPipCaller(force_user=self._settings.get_boolean(["pip_force_user"]))
self._pip_caller.on_log_call = self._log_call
@@ -169,6 +178,10 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
self._console_logger.setLevel(logging.DEBUG)
self._console_logger.propagate = False
helpers = self._plugin_manager.get_helpers("pi_support", "get_throttled")
if helpers and "get_throttled" in helpers:
self._get_throttled = helpers["get_throttled"]
# decouple repository fetching from server startup
self._fetch_all_data(do_async=True)
@@ -182,6 +195,8 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
notices_ttl=6*60,
pip_args=None,
pip_force_user=False,
confirm_uninstall=True,
confirm_disable=False,
dependency_links=False,
hidden=[]
)
@@ -192,6 +207,8 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
self._repository_cache_ttl = self._settings.get_int(["repository_ttl"]) * 60
self._notices_cache_ttl = self._settings.get_int(["notices_ttl"]) * 60
self._pip_caller.force_user = self._settings.get_boolean(["pip_force_user"])
self._confirm_uninstall = self._settings.global_get_boolean(["confirm_uninstall"])
self._confirm_disable = self._settings.global_get_boolean(["confirm_disable"])
##~~ AssetPlugin
@@ -288,11 +305,11 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
from octoprint.server import safe_mode
refresh_repository = request.values.get("refresh_repository", "false") in valid_boolean_trues
if refresh_repository:
if refresh_repository or not self._is_repository_cache_valid():
self._repository_available = self._refresh_repository()
refresh_notices = request.values.get("refresh_notices", "false") in valid_boolean_trues
if refresh_notices:
if refresh_notices or not self._is_notices_cache_valid():
self._notices_available = self._refresh_notices()
def view():
@@ -375,6 +392,12 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
return self.command_toggle(plugin, command)
def command_install(self, url=None, path=None, force=False, reinstall=None, dependency_links=False):
throttled = self._get_throttled()
if throttled and isinstance(throttled, dict) and throttled.get("current_issue", False):
# currently throttled, we refuse to run
return make_response("System is currently throttled, refusing to install "
"anything due to possible stability issues", 409)
if url is not None:
if not any(map(lambda scheme: url.startswith(scheme + "://"), self.URL_SCHEMES)):
raise ValueError("Invalid URL to pip install from")
@@ -801,16 +824,23 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
else:
run()
def _is_repository_cache_valid(self, mtime=None):
import time
if mtime is None:
mtime = self._repository_mtime
return mtime + self._repository_cache_ttl >= time.time() > mtime
def _fetch_repository_from_disk(self):
repo_data = None
if os.path.isfile(self._repository_cache_path):
import time
mtime = os.path.getmtime(self._repository_cache_path)
if mtime + self._repository_cache_ttl >= time.time() > mtime:
if self._is_repository_cache_valid(mtime=mtime):
try:
import json
with io.open(self._repository_cache_path, 'rt', encoding='utf-8') as f:
repo_data = json.load(f)
self._repository_mtime = mtime
self._logger.info("Loaded plugin repository data from disk, was still valid")
except Exception:
self._logger.exception("Error while loading repository data from {}".format(self._repository_cache_path))
@@ -828,17 +858,27 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
r.raise_for_status()
self._logger.info("Loaded plugin repository data from {}".format(repository_url))
except Exception as e:
self._logger.exception("Could not fetch plugins from repository at {repository_url}: {message}".format(repository_url=repository_url, message=str(e)))
self._logger.exception("Could not fetch plugins from repository at {repository_url}: {message}".format(repository_url=repository_url, message=e))
return None
repo_data = r.json()
try:
repo_data = r.json()
except Exception as e:
self._logger.exception("Error while reading repository data: {}".format(e))
return None
# validation
if not isinstance(repo_data, (list, tuple)):
self._logger.warn("Invalid repository data: expected a list, got {!r}".format(repo_data))
return None
try:
import json
with octoprint.util.atomic_write(self._repository_cache_path, mode='wb') as f:
f.write(to_bytes(json.dumps(repo_data)))
self._repository_mtime = os.path.getmtime(self._repository_cache_path)
except Exception as e:
self._logger.exception("Error while saving repository data to {}: {}".format(self._repository_cache_path, str(e)))
self._logger.exception("Error while saving repository data to {}: {}".format(self._repository_cache_path, e))
return repo_data
@@ -848,19 +888,27 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
if repo_data is None:
return False
self._repository_plugins = list(map(map_repository_entry, repo_data))
self._repository_plugins = list(filter(lambda x: x is not None,
map(map_repository_entry, repo_data)))
return True
def _is_notices_cache_valid(self, mtime=None):
import time
if mtime is None:
mtime = self._notices_mtime
return mtime + self._notices_cache_ttl >= time.time() > mtime
def _fetch_notices_from_disk(self):
notice_data = None
if os.path.isfile(self._notices_cache_path):
import time
mtime = os.path.getmtime(self._notices_cache_path)
if mtime + self._notices_cache_ttl >= time.time() > mtime:
if self._is_notices_cache_valid(mtime=mtime):
try:
import json
with io.open(self._notices_cache_path, 'rt', encoding='utf-8') as f:
notice_data = json.load(f)
self._notices_mtime = mtime
self._logger.info("Loaded notice data from disk, was still valid")
except Exception:
self._logger.exception("Error while loading notices from {}".format(self._notices_cache_path))
@@ -887,6 +935,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
import json
with octoprint.util.atomic_write(self._notices_cache_path, mode="wb") as f:
f.write(to_bytes(json.dumps(notice_data)))
self._notices_mtime = os.path.getmtime(self._notices_cache_path)
except Exception as e:
self._logger.exception("Error while saving notices to {}: {}".format(self._notices_cache_path, str(e)))
return notice_data
@@ -1 +1 @@
#settings_plugin_pluginmanager_pluginlist{display:block;width:auto;height:500px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_name,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a.disabled,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px 10px 5px 5px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_empty,#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable{overflow:hidden;width:100%;height:300px;background-image:url(../img/repo_unavailable.png);text-align:center;display:table}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_empty div,#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable div{display:table-cell;vertical-align:middle}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list{width:auto;height:300px;overflow-x:hidden;overflow-y:scroll;padding-right:2px}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry{border-bottom:1px solid #ddd;padding:5px}#settings_plugin_pluginmanager_workingdialog_output .message{font-weight:700}#settings_plugin_pluginmanager_workingdialog_output .error{font-weight:700;color:#900}#settings_plugin_pluginmanager_workingdialog_output .stdout{color:#333}#settings_plugin_pluginmanager_workingdialog_output .stderr{color:#900}#settings_plugin_pluginmanager_workingdialog_output .call{color:#009}
#settings_plugin_pluginmanager_pluginlist{display:block;width:auto;height:400px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_name,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a.disabled,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px 10px 5px 5px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_empty,#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable{overflow:hidden;width:100%;height:300px;background-image:url(../img/repo_unavailable.png);text-align:center;display:table}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_empty div,#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable div{display:table-cell;vertical-align:middle}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list{width:auto;height:300px;overflow-x:hidden;overflow-y:scroll;padding-right:2px}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry{border-bottom:1px solid #ddd;padding:5px}#settings_plugin_pluginmanager_workingdialog_output .message{font-weight:700}#settings_plugin_pluginmanager_workingdialog_output .error{font-weight:700;color:#900}#settings_plugin_pluginmanager_workingdialog_output .stdout{color:#333}#settings_plugin_pluginmanager_workingdialog_output .stderr{color:#900}#settings_plugin_pluginmanager_workingdialog_output .call{color:#009}
@@ -8,12 +8,17 @@ $(function() {
self.systemViewModel = parameters[3];
self.access = parameters[4];
// optional
self.piSupport = parameters[4];
self.config_repositoryUrl = ko.observable();
self.config_repositoryTtl = ko.observable();
self.config_noticesUrl = ko.observable();
self.config_noticesTtl = ko.observable();
self.config_pipAdditionalArgs = ko.observable();
self.config_pipForceUser = ko.observable();
self.config_confirmUninstall = ko.observable();
self.config_confirmDisable = ko.observable();
self.configurationDialog = $("#settings_plugin_pluginmanager_configurationdialog");
@@ -165,9 +170,13 @@ $(function() {
};
self.enableRepoInstall = function(data) {
return self.enableManagement() && self.pipAvailable() && !self.safeMode() && self.online() && self.isCompatible(data);
return self.enableManagement() && self.pipAvailable() && !self.safeMode() && !self.throttled() && self.online() && self.isCompatible(data);
};
self.throttled = ko.pureComputed(function() {
return self.piSupport && self.piSupport.currentIssue();
});
self.invalidUrl = ko.pureComputed(function() {
// supported pip install URL schemes, according to https://pip.pypa.io/en/stable/reference/pip_install/
var allowedUrlSchemes = ["http", "https",
@@ -192,6 +201,7 @@ $(function() {
return self.enableManagement()
&& self.pipAvailable()
&& !self.safeMode()
&& !self.throttled()
&& self.online()
&& url !== undefined
&& url.trim() !== ""
@@ -217,6 +227,7 @@ $(function() {
return self.enableManagement()
&& self.pipAvailable()
&& !self.safeMode()
&& !self.throttled()
&& name !== undefined
&& name.trim() !== ""
&& !self.invalidArchive();
@@ -395,12 +406,13 @@ $(function() {
.done(onSuccess)
.fail(onError);
} else {
var perform = function() {
var performDisabling = function() {
OctoPrint.plugins.pluginmanager.disable(data.key)
.done(onSuccess)
.fail(onError);
};
// always warn if plugin is marked "disabling discouraged"
if (data.disabling_discouraged) {
var message = _.sprintf(gettext("You are about to disable \"%(name)s\"."), {name: data.name})
+ "</p><p>" + data.disabling_discouraged;
@@ -410,10 +422,21 @@ $(function() {
question: gettext("Do you still want to disable it?"),
cancel: gettext("Keep enabled"),
proceed: gettext("Disable anyway"),
onproceed: perform
})
onproceed: performDisabling
});
}
// warn if global "warn disabling" setting is set"
else if (self.settingsViewModel.settings.plugins.pluginmanager.confirm_disable()) {
showConfirmationDialog({
message: _.sprintf(gettext("You are about to disable \"%(name)s\""), {name: data.name}),
cancel: gettext("Keep enabled"),
proceed: gettext("Disable plugin"),
onproceed: performDisabling,
nofade: true
});
} else {
perform();
// otherwise just go ahead and disable...
performDisabling();
}
}
};
@@ -447,6 +470,10 @@ $(function() {
return;
}
if (self.throttled()) {
return;
}
if (url === undefined) {
url = self.installUrl();
}
@@ -512,23 +539,41 @@ $(function() {
if (data.bundled) return;
if (data.key == "pluginmanager") return;
self._markWorking(gettext("Uninstalling plugin..."), _.sprintf(gettext("Uninstalling plugin \"%(name)s\""), {name: data.name}));
// defining actual uninstall logic as functor in order to handle
// the confirm/no-confirm logic without duplication of logic
var performUninstall = function() {
self._markWorking(gettext("Uninstalling plugin..."), _.sprintf(gettext("Uninstalling plugin \"%(name)s\""), {name: data.name}));
OctoPrint.plugins.pluginmanager.uninstall(data.key)
.done(function() {
self.requestData();
})
.fail(function() {
new PNotify({
title: gettext("Something went wrong"),
text: gettext("Please consult octoprint.log for details"),
type: "error",
hide: false
OctoPrint.plugins.pluginmanager.uninstall(data.key)
.done(function() {
self.requestData();
})
.fail(function() {
new PNotify({
title: gettext("Something went wrong"),
text: gettext("Please consult octoprint.log for details"),
type: "error",
hide: false
});
})
.always(function() {
self._markDone();
});
})
.always(function() {
self._markDone();
};
if (self.settingsViewModel.settings.plugins.pluginmanager.confirm_uninstall()) {
// confirmation needed. Show confirmation dialog and call performUninstall if user clicks Yes
showConfirmationDialog({
message: _.sprintf(gettext("You are about to uninstall the plugin \"%(name)s\""), {name: data.name}),
cancel: gettext("Keep installed"),
proceed: gettext("Uninstall"),
onproceed: performUninstall,
nofade: true
});
} else {
// no confirmation needed, just go ahead and uninstall
performUninstall();
}
};
self.refreshRepository = function() {
@@ -597,7 +642,9 @@ $(function() {
notices: notices,
notices_ttl: noticesTtl,
pip_args: pipArgs,
pip_force_user: self.config_pipForceUser()
pip_force_user: self.config_pipForceUser(),
confirm_uninstall: self.config_confirmUninstall(),
confirm_disable: self.config_confirmDisable(),
}
}
};
@@ -615,6 +662,8 @@ $(function() {
self.config_noticesTtl(self.settingsViewModel.settings.plugins.pluginmanager.notices_ttl());
self.config_pipAdditionalArgs(self.settingsViewModel.settings.plugins.pluginmanager.pip_args());
self.config_pipForceUser(self.settingsViewModel.settings.plugins.pluginmanager.pip_force_user());
self.config_confirmUninstall(self.settingsViewModel.settings.plugins.pluginmanager.confirm_uninstall());
self.config_confirmDisable(self.settingsViewModel.settings.plugins.pluginmanager.confirm_disable());
};
self.installed = function(data) {
@@ -1080,7 +1129,8 @@ $(function() {
OCTOPRINT_VIEWMODELS.push({
construct: PluginManagerViewModel,
dependencies: ["loginStateViewModel", "settingsViewModel", "printerStateViewModel", "systemViewModel", "accessViewModel"],
dependencies: ["loginStateViewModel", "settingsViewModel", "printerStateViewModel", "systemViewModel", "accessViewModel", "piSupportViewModel"],
optional: ["piSupportViewModel"],
elements: ["#settings_plugin_pluginmanager"]
});
});
@@ -1,7 +1,7 @@
#settings_plugin_pluginmanager_pluginlist {
display: block;
width: auto;
height: 500px;
height: 400px;
overflow-x: hidden;
overflow-y: scroll;
padding-right: 2px;
@@ -20,6 +20,13 @@
{% endtrans %}</div>
{% endmacro %}
{% macro pluginmanager_throttled() %}
<div class="alert" data-bind="visible: throttled">{% trans %}
The system OctoPrint is running on is currently throttled. Due to that it's not possible to install new
plugins in order to avoid possible issues caused by system instability.
{% endtrans %}</div>
{% endmacro %}
{% macro pluginmanager_offline() %}
<div class="alert" data-bind="visible: !online()">{% trans %}
It looks like OctoPrint has currently no connection to the internet. Due to that it's not possible
@@ -30,9 +37,10 @@
{{ pluginmanager_printing() }}
{{ pluginmanager_nopip() }}
{{ pluginmanager_safemode() }}
{{ pluginmanager_throttled() }}
<div class="pull-right">
<button class="btn btn-small" data-bind="click: function() { $root.showPluginSettings(); }" title="{{ _('Plugin Configuration') }}"><i class="fa fa-wrench"></i></button>
<button class="btn btn-small" data-bind="click: function() { $root.showPluginSettings(); }" title="{{ _('Plugin Configuration')|edq }}"><i class="fa fa-wrench"></i></button>
</div>
<h3>{{ _('Installed Plugins') }}</h3>
@@ -48,7 +56,7 @@
<tbody data-bind="foreach: plugins.paginatedItems">
<tr>
<td class="settings_plugin_plugin_manager_plugins_name">
<div data-bind="css: {muted: !enabled}"><span data-bind="text: name"></span> <span data-bind="visible: version">(<span data-bind="text: version"></span>)</span> <i title="{{ _('Bundled with OctoPrint') }}" class="fa fa-th-large" data-bind="visible: bundled"></i> <i class="fa fa-lock" title="{{ _('Cannot be uninstalled through OctoPrint') }}" data-bind="visible: !managable"></i> <i title="{{ _('Restart of OctoPrint needed for changes to take effect') }}" class="fa fa-refresh" data-bind="visible: pending_enable || pending_disable || pending_install || pending_uninstall"></i> <i title="{{ _('Pending install') }}" class="fa fa-plus" data-bind="visible: pending_install"></i> <i title="{{ _('Pending uninstall') }}" class="fa fa-minus" data-bind="visible: pending_uninstall"></i> <i title="{{ _('Disabled due to safe mode') }}" class="fa fa-medkit" data-bind="visible: safe_mode_victim"></i> <i class="fa fa-exclamation-triangle" title="{{ _('There are notices available regarding this plugin') }}" data-bind="visible: notifications && notifications.length"></i> <i class="fa fa-ban" title="{{ _('This plugin is blacklisted') }}" data-bind="visible: blacklisted"></i></div>
<div data-bind="css: {muted: !enabled}"><span data-bind="text: name"></span> <span data-bind="visible: version">(<span data-bind="text: version"></span>)</span> <i title="{{ _('Bundled with OctoPrint')|edq }}" class="fa fa-th-large" data-bind="visible: bundled"></i> <i class="fa fa-lock" title="{{ _('Cannot be uninstalled through OctoPrint')|edq }}" data-bind="visible: !managable"></i> <i title="{{ _('Restart of OctoPrint needed for changes to take effect')|edq }}" class="fa fa-refresh" data-bind="visible: pending_enable || pending_disable || pending_install || pending_uninstall"></i> <i title="{{ _('Pending install')|edq }}" class="fa fa-plus" data-bind="visible: pending_install"></i> <i title="{{ _('Pending uninstall')|edq }}" class="fa fa-minus" data-bind="visible: pending_uninstall"></i> <i title="{{ _('Disabled due to safe mode')|edq }}" class="fa fa-medkit" data-bind="visible: safe_mode_victim"></i> <i class="fa fa-exclamation-triangle" title="{{ _('There are notices available regarding this plugin')|edq }}" data-bind="visible: notifications && notifications.length"></i> <i class="fa fa-ban" title="{{ _('This plugin is blacklisted')|edq }}" data-bind="visible: blacklisted"></i></div>
<div data-bind="visible: notifications && notifications.length"><a href="javascript:void(0)" class="text-error" style="text-decoration: underline" data-bind="click: function() { $root.showPluginNotifications($data) }, text: $root.showPluginNotificationsLinkText($data)"></a></div>
<div><small class="muted" data-bind="text: description">&nbsp;</small></div>
<div data-bind="css: {muted: !enabled}">
@@ -59,7 +67,7 @@
</div>
</td>
<td class="settings_plugin_plugin_manager_plugins_actions">
<a href="#" data-bind="css: $root.toggleButtonCss($data), attr: {title: $root.toggleButtonTitle($data)}, enable: $root.enableToggle($data), click: function() { $root.togglePlugin($data) }"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-trash-o" title="{{ _('Uninstall Plugin') }}" data-bind="css: {disabled: !$root.enableUninstall($data)}, enable: $root.enableUninstall($data), click: function() { $root.uninstallPlugin($data) }"></a>
<a href="#" data-bind="css: $root.toggleButtonCss($data), attr: {title: $root.toggleButtonTitle($data)}, enable: $root.enableToggle($data), click: function() { $root.togglePlugin($data) }"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-trash-o" title="{{ _('Uninstall Plugin')|edq }}" data-bind="css: {disabled: !$root.enableUninstall($data)}, enable: $root.enableUninstall($data), click: function() { $root.uninstallPlugin($data) }"></a>
</td>
</tr>
</tbody>
@@ -122,6 +130,7 @@
{{ pluginmanager_printing() }}
{{ pluginmanager_nopip() }}
{{ pluginmanager_safemode() }}
{{ pluginmanager_throttled() }}
{{ pluginmanager_offline() }}
<h4 style="position: relative">
{{ _('... from the <a href="%(url)s" target="_blank">Plugin Repository</a>', url='https://plugins.octoprint.org') }}
@@ -142,7 +151,7 @@
</h4>
<form class="form-search" data-bind="submit: performRepositorySearch">
<input type="text" class="input-block search-query" data-bind="value: repositorySearchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...') }}">
<input type="text" class="input-block search-query" data-bind="value: repositorySearchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...')|edq }}">
</form>
<div data-bind="visible: repositoryAvailable() && repositoryplugins.paginatedItems().length > 0">
@@ -191,7 +200,7 @@
<form class="form-inline">
<div class="control-group row-fluid" data-bind="css: {error: invalidUrl}">
<div class="span9">
<input type="text" class="input-block-level" data-bind="value: installUrl, valueUpdate: 'input'" placeholder="{{ _('Enter URL...') }}" >
<input type="text" class="input-block-level" data-bind="value: installUrl, valueUpdate: 'input'" placeholder="{{ _('Enter URL...')|edq }}" >
</div>
<button class="btn btn-primary span3" data-bind="enable: enableUrlInstall, css: {disabled: !enableUrlInstall()}, click: function() { if (enableUrlInstall()) { $root.installPlugin(); } }">{{ _('Install') }}</button>
</div>
@@ -241,18 +250,37 @@
</div>
<div class="modal-body">
<form class="form-horizontal">
<fieldset>
<legend>{{ _('Confirmations') }}</legend>
<div class="control-group" title="{{ _('Confirm before uninstalling a plugin')|edq }}">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: config_confirmUninstall"> {{ _('Confirm before uninstalling a plugin') }}
</label>
</div>
</div>
<div class="control-group" title="{{ _('Confirm before disabling a plugin')|edq }}">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: config_confirmDisable"> {{ _('Confirm before disabling a plugin') }}
</label>
</div>
</div>
</fieldset>
<p>{% trans %}You should normally <strong>not</strong> have to change <strong>any</strong> of the following settings, they are purely provided for convenience here.{% endtrans %}</p>
<fieldset>
<legend>{{ _('Plugin repository configuration') }}</legend>
<div class="control-group" title="{{ _('URL of the Plugin Repository to use. You should normally not have to change this.') }}">
<div class="control-group" title="{{ _('URL of the Plugin Repository to use. You should normally not have to change this.')|edq }}">
<label class="control-label">{{ _('Repository URL') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: config_repositoryUrl">
</div>
</div>
<div class="control-group" title="{{ _('How long to cache repository data, in minutes. You should normally not have to change this.') }}">
<div class="control-group" title="{{ _('How long to cache repository data, in minutes. You should normally not have to change this.')|edq }}">
<label class="control-label">{{ _('Repository cache TTL') }}</label>
<div class="controls">
<div class="input-append">
@@ -266,13 +294,13 @@
<fieldset>
<legend>{{ _('Notices configuration') }}</legend>
<div class="control-group" title="{{ _('URL of the Notices source to use. You should normally not have to change this.') }}">
<div class="control-group" title="{{ _('URL of the Notices source to use. You should normally not have to change this.')|edq }}">
<label class="control-label">{{ _('Notices URL') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: config_noticesUrl">
</div>
</div>
<div class="control-group" title="{{ _('How long to cache notices, in minutes. You should normally not have to change this.') }}">
<div class="control-group" title="{{ _('How long to cache notices, in minutes. You should normally not have to change this.')|edq }}">
<label class="control-label">{{ _('Notices cache TTL') }}</label>
<div class="controls">
<div class="input-append">
@@ -286,7 +314,7 @@
<fieldset>
<legend>{{ _('pip configuration') }}</legend>
<div class="control-group" title="{{ _('Additional arguments for the pip command. You should normally not have to change this.') }}">
<div class="control-group" title="{{ _('Additional arguments for the pip command. You should normally not have to change this.')|edq }}">
<label class="control-label">{{ _('Additional arguments') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: config_pipAdditionalArgs">
@@ -189,7 +189,7 @@ __plugin_author__ = "Gina Häußge"
__plugin_url__ = "http://docs.octoprint.org/en/master/bundledplugins/printer_safety_check.html"
__plugin_description__ = "Checks for unsafe printers/printer firmwares"
__plugin_disabling_discouraged__ = gettext("Without this plugin OctoPrint will no longer be able to "
"check if the printer it is connected to has a known safety"
"check if the printer it is connected to has a known safety "
"issue and inform you about that fact.")
__plugin_license__ = "AGPLv3"
__plugin_implementation__ = PrinterSafetyCheckPlugin()
@@ -68,7 +68,7 @@ class AnycubicCheck(Check):
def _broken_version(self, line):
version_str = line[len(self.VERSION):]
version = get_comparable_version(version_str, base=True)
if version is not None and version <= self.FIXED_VERSION:
if version is not None and version < self.FIXED_VERSION:
return True
else:
return False
@@ -35,9 +35,10 @@ from octoprint.util.pip import LocalPipCaller
import octoprint.settings
# OctoPi 0.15+
MINIMUM_PYTHON = "2.7.9"
MINIMUM_SETUPTOOLS = "5.5.1"
MINIMUM_PIP = "9.0.1"
MINIMUM_SETUPTOOLS = "39.0.1"
MINIMUM_PIP = "9.0.3"
##~~ Plugin
@@ -77,6 +78,8 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
self._console_logger = None
self._get_throttled = lambda: False
def initialize(self):
self._console_logger = logging.getLogger("octoprint.plugins.softwareupdate.console")
@@ -119,6 +122,10 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
self._console_logger.setLevel(logging.DEBUG)
self._console_logger.propagate = False
helpers = self._plugin_manager.get_helpers("pi_support", "get_throttled")
if helpers and "get_throttled" in helpers:
self._get_throttled = helpers["get_throttled"]
def on_after_startup(self):
self._check_environment()
self.get_current_versions()
@@ -591,6 +598,12 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
@no_firstrun_access
@Permissions.PLUGIN_SOFTWAREUPDATE_UPDATE.require(403)
def perform_update(self):
throttled = self._get_throttled()
if throttled and isinstance(throttled, dict) and throttled.get("current_issue", False):
# currently throttled, we refuse to run
return flask.make_response("System is currently throttled, refusing to update "
"anything due to possible stability issues", 409)
if self._printer.is_printing() or self._printer.is_paused():
# do not update while a print job is running
return flask.make_response("Printer is currently printing or paused", 409)
@@ -6,6 +6,11 @@ $(function() {
self.printerState = parameters[1];
self.settings = parameters[2];
self.access = parameters[3];
// optional
self.piSupport = parameters[3]; // might be null!
self.popup = undefined;
self.updateInProgress = false;
@@ -52,7 +57,7 @@ $(function() {
});
self.enableUpdate = ko.pureComputed(function() {
return !self.updateInProgress && self.environmentSupported();
return !self.updateInProgress && self.environmentSupported() && !self.printerState.isPrinting() && !self.throttled();
});
self.enable_configSave = ko.pureComputed(function() {
@@ -92,6 +97,10 @@ $(function() {
return _.filter(self.versions.items(), function(info) { return info.updateAvailable && info.updatePossible; });
});
self.throttled = ko.pureComputed(function() {
return self.piSupport && self.piSupport.currentIssue();
});
self.onUserPermissionsChanged = self.onUserLoggedIn = self.onUserLoggedOut = function() {
if (self.loginState.hasPermission(self.access.permissions.PLUGIN_SOFTWAREUPDATE_CHECK)) {
self.performCheck();
@@ -476,36 +485,46 @@ $(function() {
type: "error"
});
self._updateClicked = false;
} else {
var html = "<p>" + gettext("This will update the following components and restart the server:") + "</p>";
html += "<ul>";
_.each(items, function(item) {
html += "<li>"
+ "<span class=\"name\" title=\"" + item.fullNameRemote + "\">" + item.fullNameRemote + "</span>";
if (item.releaseNotes) {
html += "<br><a href=\"" + item.releaseNotes + "\" target=\"_blank\" rel=\"noreferrer noopener\">" + gettext("Release Notes") + "</a>"
}
html += "</li>";
});
html += "</ul>";
html += "<p>" + gettext("Be sure to read through any linked release notes, especially those for OctoPrint since they might contain important information you need to know <strong>before</strong> upgrading.") + "</p>"
+ "<p><strong>" + gettext("This action may disrupt any ongoing print jobs.") + "</strong></p>"
+ "<p>" + gettext("Depending on your printer's controller and general setup, restarting OctoPrint may cause your printer to be reset.") + "</p>"
+ "<p>" + gettext("Are you sure you want to proceed?") + "</p>";
showConfirmationDialog({
title: gettext("Are you sure you want to update now?"),
html: html,
proceed: gettext("Proceed"),
onproceed: function() {
self.performUpdate((force === true),
_.map(items, function(info) { return info.key }));
},
onclose: function() {
self._updateClicked = false;
}
});
return;
}
if (self.piSupport && self.piSupport.currentIssue()) {
self._showPopup({
title: gettext("Can't update while throttled"),
text: gettext("Your system is currently throttled. OctoPrint refuses to run updates while in this state due to possible stability issues."),
type: "error"
});
self._updateClicked = false;
return;
}
var html = "<p>" + gettext("This will update the following components and restart the server:") + "</p>";
html += "<ul>";
_.each(items, function(item) {
html += "<li>"
+ "<span class=\"name\" title=\"" + item.fullNameRemote + "\">" + item.fullNameRemote + "</span>";
if (item.releaseNotes) {
html += "<br><a href=\"" + item.releaseNotes + "\" target=\"_blank\" rel=\"noreferrer noopener\">" + gettext("Release Notes") + "</a>"
}
html += "</li>";
});
html += "</ul>";
html += "<p>" + gettext("Be sure to read through any linked release notes, especially those for OctoPrint since they might contain important information you need to know <strong>before</strong> upgrading.") + "</p>"
+ "<p><strong>" + gettext("This action may disrupt any ongoing print jobs.") + "</strong></p>"
+ "<p>" + gettext("Depending on your printer's controller and general setup, restarting OctoPrint may cause your printer to be reset.") + "</p>"
+ "<p>" + gettext("Are you sure you want to proceed?") + "</p>";
showConfirmationDialog({
title: gettext("Are you sure you want to update now?"),
html: html,
proceed: gettext("Proceed"),
onproceed: function() {
self.performUpdate((force === true),
_.map(items, function(info) { return info.key }));
},
onclose: function() {
self._updateClicked = false;
}
});
};
self._showWorkingDialog = function(title) {
@@ -781,7 +800,8 @@ $(function() {
OCTOPRINT_VIEWMODELS.push({
construct: SoftwareUpdateViewModel,
dependencies: ["loginStateViewModel", "printerStateViewModel", "settingsViewModel", "accessViewModel"],
dependencies: ["loginStateViewModel", "printerStateViewModel", "settingsViewModel", "accessViewModel", "piSupportViewModel"],
optional: ["piSupportViewModel"],
elements: ["#settings_plugin_softwareupdate", "#softwareupdate_confirmation_dialog", "#wizard_plugin_softwareupdate"]
});
});
@@ -32,9 +32,29 @@
Please take a look at <a href="https://faq.octoprint.org/unsupported-python-environment" target="_blank">this FAQ entry on how to proceed</a>.
</p>
{% endtrans %}</div>
<div class="alert" data-bind="visible: throttled()">{% trans %}
<p>
<strong>OctoPrint is running on a throttled system, updates are disabled.</strong>
</p>
<p>
To reduce the likelihood of running into update problems on throttled and hence potentially unstable systems
as seen in the past, OctoPrint doesn't support updating under such conditions. Please fix the current issue
before trying to update. Take a look at the displayed warning in the navigation bar to learn about what is
wrong and to get hints on how to solve the problem.
</p>
{% endtrans %}</div>
<div class="alert" data-bind="visible: printerState.isPrinting()">{% trans %}
<p>
<strong>OctoPrint is currently printing, updates are disabled.</strong>
</p>
<p>
Running updates is not supported while printing in order to not risk any kind of disruption to the print job.
Please let the print finish before trying to update.
</p>
{% endtrans %}</div>
<div class="pull-right">
<button class="btn btn-small" data-bind="click: function() { $root.showPluginSettings(); }" title="{{ _('Plugin Configuration') }}"><i class="fa fa-wrench"></i></button>
<button class="btn btn-small" data-bind="click: function() { $root.showPluginSettings(); }" title="{{ _('Plugin Configuration')|edq }}"><i class="fa fa-wrench"></i></button>
</div>
<h3>{{ _('Current versions') }}</h3>
@@ -44,10 +64,10 @@
<tbody data-bind="foreach: versions.paginatedItems">
<tr data-bind="attr: {title: displayName}">
<td class="settings_plugin_softwareupdate_column_update">
<span data-bind="invisible: !updateAvailable"><i class="fa fa-bell-o" title="{{ _('Update available') }}"></i></span>
<span data-bind="invisible: !updateAvailable"><i class="fa fa-bell-o" title="{{ _('Update available')|edq }}"></i></span>
</td>
<td class="settings_plugin_softwareupdate_column_information">
<a href="javascript:void(0)" data-bind="click: function() { $root.update(false, [$data]) }, visible: updateAvailable && updatePossible" class="btn btn-primary pull-right">{{ _('Update') }}</a>
<a href="javascript:void(0)" data-bind="click: function() { $root.update(false, [$data]) }, visible: $root.enableUpdate() && updateAvailable && updatePossible" class="btn btn-primary pull-right">{{ _('Update') }}</a>
<strong data-bind="text: displayName"></strong>: <span data-bind="text: displayVersion"></span> <span data-bind="invisible: updatePossible"><i class="fa fa-exclamation-triangle" data-bind="css: {'fa-unlink': !online && information && information.needs_online, 'fa-exclamation-triangle': !(!online && information && information.needs_online)}, attr: {title: $root.iconTitleForEntry($data)}"></i></span><br>
<small class="muted">
<span class="line">{{ _('Installed:') }} <span data-bind="text: information.local.name"></span></span>
@@ -69,7 +89,7 @@
<div class="hide">
<small class="muted" style="display: block">{{ _('Last cache refresh:') }} <span data-bind="text: cacheTimestampText"></span></small>
<button class="btn btn-block" data-bind="click: function() { $root.performCheck(true, true, true); }, enable: !checking(), css: {disabled: checking()}"><i class="fa fa-spinner fa-spin" data-bind="visible: checking"></i> {{ _('Force check for update (overrides cache used for update checks)') }}</button>
<button class="btn btn-block btn-danger" data-bind="visible: CONFIG_DEBUG, click: function() { $root.update(true); }, enable: !checking(), css: {disabled: checking()}"><i class="fa fa-spinner fa-spin" data-bind="visible: checking"></i> {{ _('Force update now (even if no new versions are available)') }}</button>
<button class="btn btn-block btn-danger" data-bind="visible: CONFIG_DEBUG, click: function() { $root.update(true); }, enable: enableUpdate() && !checking(), css: {disabled: !enableUpdate() || checking()}"><i class="fa fa-spinner fa-spin" data-bind="visible: checking"></i> {{ _('Force update now (even if no new versions are available)') }}</button>
</div>
</div>
+52 -13
View File
@@ -44,6 +44,7 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
self._printer_connection_parameters = None
self._url = None
self._ping_worker = None
self._pong_worker = None
self._executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
self._record_next_firmware_info = False
@@ -60,14 +61,17 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
unique_id=None,
server=TRACKING_URL,
ping=15*60,
events=dict(startup=True,
pong=24*60*60,
events=dict(pong=True,
startup=True,
printjob=True,
commerror=True,
plugin=True,
update=True,
printer=True,
printer_safety_check=True,
throttled=True))
throttled=True,
slicing=True))
def get_settings_restricted_paths(self):
return dict(admin=[["enabled"], ["unique_id"], ["events"]],
@@ -121,6 +125,9 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
self._record_next_firmware_info = False
self._track_printer_event(event, payload)
elif event in (Events.SLICING_STARTED,):
self._track_slicing_event(event, payload)
elif hasattr(Events, "PLUGIN_PLUGINMANAGER_INSTALL_PLUGIN") and \
event in (Events.PLUGIN_PLUGINMANAGER_INSTALL_PLUGIN, Events.PLUGIN_PLUGINMANAGER_UNINSTALL_PLUGIN,
Events.PLUGIN_PLUGINMANAGER_ENABLE_PLUGIN, Events.PLUGIN_PLUGINMANAGER_DISABLE_PLUGIN):
@@ -168,11 +175,17 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
return
if self._ping_worker is None:
ping = self._settings.get_int(["ping"])
if ping:
self._ping_worker = RepeatedTimer(ping, self._track_ping, run_first=True)
ping_interval = self._settings.get_int(["ping"])
if ping_interval:
self._ping_worker = RepeatedTimer(ping_interval, self._track_ping, run_first=True)
self._ping_worker.start()
if self._pong_worker is None:
pong_interval = self._settings.get(["pong"])
if pong_interval:
self._pong_worker = RepeatedTimer(pong_interval, self._track_pong, run_first=True)
self._pong_worker.start()
if self._helpers_get_throttle_state is None:
# cautiously look for the get_throttled helper from pi_support
pi_helper = self._plugin_manager.get_helpers("pi_support", "get_throttled")
@@ -189,6 +202,18 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
uptime = int(monotonic_time() - self._startup_time)
self._track("ping", octoprint_uptime=uptime)
def _track_pong(self):
if not self._settings.get_boolean(["events", "pong"]):
return
plugins = self._plugin_manager.enabled_plugins
plugins_thirdparty = [plugin for plugin in plugins.values() if not plugin.bundled]
payload = dict(plugins=",".join(map(lambda x: "{}:{}".format(x.key.lower(),
x.version.lower() if x.version else "?"),
plugins_thirdparty)))
self._track("pong", body=True, **payload)
def _track_startup(self):
if not self._settings.get_boolean(["events", "startup"]):
return
@@ -305,7 +330,7 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
elapsed = int(payload.get("time", 0))
if elapsed:
args["elapsed"] = elapsed
except ValueError:
except (ValueError, TypeError):
pass
track_event = "print_done"
elif event == Events.PRINT_FAILED:
@@ -313,7 +338,7 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
elapsed = int(payload.get("time", 0))
if elapsed:
args["elapsed"] = elapsed
except ValueError:
except (ValueError, TypeError):
pass
args["reason"] = payload.get("reason", "unknown")
@@ -326,7 +351,7 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
elapsed = int(payload.get("time", 0))
if elapsed:
args["elapsed"] = elapsed
except ValueError:
except (ValueError, TypeError):
pass
track_event = "print_cancelled"
@@ -363,13 +388,20 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
printer_safety_warning_type=payload.get("warning_type", "unknown"),
printer_safety_check_name=payload.get("check_name", "unknown"))
def _track_slicing_event(self, event, payload):
if not self._settings.get_boolean(["events", "slicing"]):
return
self._track("slicing_started",
slicer=payload.get(b"slicer", "unknown"))
def _track(self, event, **kwargs):
if not self._settings.get_boolean(["enabled"]):
return
self._executor.submit(self._do_track, event, **kwargs)
def _do_track(self, event, **kwargs):
def _do_track(self, event, body=False, **kwargs):
if not self._connectivity_checker.online:
return
@@ -389,10 +421,17 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
try:
params = urlencode(kwargs, doseq=True).replace("+", "%20")
requests.get(url,
params=params,
timeout=3.1,
headers=headers)
if body:
requests.post(url,
data=params,
timeout=3.1,
headers=headers)
else:
requests.get(url,
params=params,
timeout=3.1,
headers=headers)
self._logger.info("Sent tracking event {}, payload: {!r}".format(event, kwargs))
except Exception:
if self._logger.isEnabledFor(logging.DEBUG):
@@ -11,16 +11,19 @@
</div>
</div>
<div class="control-group">
<label class="control-label" title="{{ _('Random unique instance ID') }}">{{ _('Instance ID') }}</label>
<label class="control-label" title="{{ _('Random unique instance ID')|edq }}">{{ _('Instance ID') }}</label>
<div class="controls">
<span style="padding-top: 5px; margin-bottom: 5px; display: inline-block" data-bind="text: settings.plugins.tracking.unique_id() || 'N/A'"></span>
</div>
</div>
<div class="control-group">
<label class="control-label" title="{{ _('Events to track. The ping is mandatory.') }}">{{ _('Tracked events') }}</label>
<label class="control-label" title="{{ _('Events to track. The ping is mandatory.')|edq }}">{{ _('Tracked events') }}</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" checked="checked" disabled="disabled"> {{ _('Regular ping') }}
<input type="checkbox" checked="checked" disabled="disabled"> {{ _('Regular ping every 15min (incl. uptime)') }}
</label>
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.tracking.events.pong"> {{ _('Regular pong every 24h (incl. plugin list)') }}
</label>
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.tracking.events.startup"> {{ _('Server startup & shutdown') }}
@@ -46,6 +49,9 @@
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.tracking.events.throttled"> {{ _('System got throttled/unthrottled (currently only detected on RPis)') }}
</label>
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.tracking.events.slicing"> {{ _('Onboard slicing actions') }}
</label>
</div>
</div>
</form>
@@ -146,7 +146,7 @@ class VirtualPrinter(object):
self._temperature_reporter = None
self._sdstatus_reporter = None
self.currentLine = 0
self.current_line = 0
self.lastN = 0
self._incoming_lock = threading.RLock()
@@ -155,6 +155,7 @@ class VirtualPrinter(object):
self._debug_sleep = 0
self._sleepAfterNext = dict()
self._sleepAfter = dict()
self._rerequest_last = False
self._dont_answer = False
@@ -217,7 +218,7 @@ class VirtualPrinter(object):
self._heatingUp = False
self.currentLine = 0
self.current_line = 0
self.lastN = 0
self._debug_awol = False
@@ -325,10 +326,10 @@ class VirtualPrinter(object):
checksum = int(data[data.rfind(b"*") + 1:])
data = data[:data.rfind(b"*")]
if not checksum == self._calculate_checksum(data):
self._triggerResend(expected=self.currentLine + 1)
self._triggerResend(expected=self.current_line + 1)
continue
self.currentLine += 1
self.current_line += 1
elif settings().getBoolean(["devel", "virtualPrinter", "forceChecksum"]):
self._send(self._error("checksum_missing"))
continue
@@ -337,7 +338,7 @@ class VirtualPrinter(object):
if data.startswith(b"N") and b"M110" in data:
linenumber = int(re.search(b"N([0-9]+)", data).group(1))
self.lastN = linenumber
self.currentLine = linenumber
self.current_line = linenumber
self._triggerResendAt100 = True
self._triggerResendWithTimeoutAt105 = True
@@ -379,6 +380,9 @@ class VirtualPrinter(object):
elif isinstance(prepared, basestring):
self._send(prepared)
continue
elif self._rerequest_last:
self._triggerResend(actual=linenumber)
continue
else:
self.lastN = linenumber
data = data.split(None, 1)[1].strip()
@@ -831,6 +835,8 @@ class VirtualPrinter(object):
prepare_ok <broken ok>
| Will cause <broken ok> to be enqueued for use,
| will be used instead of actual "ok"
rerequest_last
| Will cause the last line number + 1 to be rerequest add infinitum
# Reply Timing / Sleeping
@@ -892,6 +898,9 @@ class VirtualPrinter(object):
elif data == "go_awol":
self._send("// Going AWOL")
self._debug_awol = True
elif data == "rerequest_last":
self._send("// Entering rerequest loop")
self._rerequest_last = True
elif data == "cancel_sd":
if self._sdPrinting and self._sdPrinter:
self._pauseSdPrint()
+21 -4
View File
@@ -320,14 +320,21 @@ class PrinterProfileManager(object):
except InvalidProfileError:
return None
def remove(self, identifier):
def remove(self, identifier, trigger_event=False):
if self._current is not None and self._current["id"] == identifier:
return False
elif settings().get(["printerProfiles", "default"]) == identifier:
return False
return self._remove_from_path(self._get_profile_path(identifier))
def save(self, profile, allow_overwrite=False, make_default=False):
removed = self._remove_from_path(self._get_profile_path(identifier))
if removed and trigger_event:
from octoprint.events import eventManager, Events
payload = dict(identifier=identifier)
eventManager().fire(Events.PRINTER_PROFILE_DELETED, payload=payload)
return removed
def save(self, profile, allow_overwrite=False, make_default=False, trigger_event=False):
if "id" in profile:
identifier = profile["id"]
elif "name" in profile:
@@ -342,7 +349,10 @@ class PrinterProfileManager(object):
profile = dict_sanitize(profile, self.__class__.default)
profile = dict_merge(self.__class__.default, profile)
self._save_to_path(self._get_profile_path(identifier), profile, allow_overwrite=allow_overwrite)
path = self._get_profile_path(identifier)
is_overwrite = os.path.exists(path)
self._save_to_path(path, profile, allow_overwrite=allow_overwrite)
if make_default:
settings().set(["printerProfiles", "default"], identifier)
@@ -350,6 +360,13 @@ class PrinterProfileManager(object):
if self._current is not None and self._current["id"] == identifier:
self.select(identifier)
from octoprint.events import eventManager, Events
if trigger_event:
payload = dict(identifier=identifier)
event = Events.PRINTER_PROFILE_MODIFIED if is_overwrite else Events.PRINTER_PROFILE_ADDED
eventManager().fire(event, payload=payload)
return self.get(identifier)
def is_default_unmodified(self):
+11 -5
View File
@@ -32,6 +32,7 @@ from octoprint.settings import settings
from octoprint.util import InvariantContainer
from octoprint.util import to_unicode
from octoprint.util import monotonic_time
from octoprint.util import get_fully_qualified_classname as fqcn
from octoprint.util import dict_merge
from octoprint.comm.protocol import ProtocolListener, FileAwareProtocolListener, PositionAwareProtocolListener, ProtocolState
@@ -206,28 +207,32 @@ class Printer(PrinterInterface,
try:
callback.on_printer_add_temperature(data)
except Exception:
self._logger.exception("Exception while adding temperature data point to callback {}".format(callback))
self._logger.exception("Exception while adding temperature data point to callback {}".format(callback),
extra=dict(callback=fqcn(callback)))
def _send_add_log_callbacks(self, data):
for callback in self._callbacks:
try:
callback.on_printer_add_log(data)
except Exception:
self._logger.exception("Exception while adding communication log entry to callback {}".format(callback))
self._logger.exception("Exception while adding communication log entry to callback {}".format(callback),
extra=dict(callback=fqcn(callback)))
def _send_add_message_callbacks(self, data):
for callback in self._callbacks:
try:
callback.on_printer_add_message(data)
except Exception:
self._logger.exception("Exception while adding printer message to callback {}".format(callback))
self._logger.exception("Exception while adding printer message to callback {}".format(callback),
extra=dict(callback=fqcn(callback)))
def _send_current_data_callbacks(self, data):
for callback in self._callbacks:
try:
callback.on_printer_send_current_data(copy.deepcopy(data))
except Exception:
self._logger.exception("Exception while pushing current data to callback {}".format(callback))
self._logger.exception("Exception while pushing current data to callback {}".format(callback),
extra=dict(callback=fqcn(callback)))
#~~ callback from metadata analysis event
@@ -1182,7 +1187,8 @@ class Printer(PrinterInterface,
messages=list(self._messages)))
callback.on_printer_send_initial_data(data)
except Exception:
self._logger.exception("Error while trying to send initial state update")
self._logger.exception(u"Error while pushing initial state update to callback {}".format(callback),
extra=dict(callback=fqcn(callback)))
def _get_state_flags(self):
return self._dict(operational=self.is_operational(),
+15 -1
View File
@@ -283,7 +283,11 @@ class Server(object):
# monkey patch some stuff
util.tornado.fix_json_encode()
util.flask.fix_flask_jsonify()
util.flask.enable_additional_translations(additional_folders=[self._settings.getBaseFolder("translations")])
additional_translation_folders = []
if not safe_mode:
additional_translation_folders += [self._settings.getBaseFolder("translations")]
util.flask.enable_additional_translations(additional_folders=additional_translation_folders)
# setup app
self._setup_app(app)
@@ -1116,10 +1120,20 @@ class Server(object):
return "<{tag}>{content}</a>".format(tag=tag, content=content)
return html_link_regex.sub(repl, text)
single_quote_regex = re.compile("(?<!\\\\)'")
def escape_single_quote(text):
return single_quote_regex.sub("\\'", text)
double_quote_regex = re.compile('(?<!\\\\)"')
def escape_double_quote(text):
return double_quote_regex.sub('\\"', text)
app.jinja_env.filters["regex_replace"] = regex_replace
app.jinja_env.filters["offset_html_headers"] = offset_html_headers
app.jinja_env.filters["offset_markdown_headers"] = offset_markdown_headers
app.jinja_env.filters["externalize_links"] = externalize_links
app.jinja_env.filters["escape_single_quote"] = app.jinja_env.filters["esq"] = escape_single_quote
app.jinja_env.filters["escape_double_quote"] = app.jinja_env.filters["edq"] = escape_double_quote
# configure additional template folders for jinja2
import jinja2
+10
View File
@@ -469,7 +469,17 @@ def _test_url(data):
response_result = dict(headers=dict(response.headers),
content_type=content_type)
if not content_type and data.get("content_type_guess") in valid_boolean_trues:
content = response.content
content_type = util.guess_mime_type(bytearray(content))
if not content_type:
content_type = "application/octet-stream"
response_result = dict(assumed_content_type=content_type)
parsed_content_type = util.parse_mime_type(content_type)
in_whitelist = content_type_whitelist is None or any(
map(lambda x: util.mime_type_matches(parsed_content_type, x), content_type_whitelist))
in_blacklist = content_type_blacklist is not None and any(
+3 -1
View File
@@ -525,7 +525,9 @@ def _delete_chamber(x):
def _delete_from_data(x, key_matcher):
data = dict(x)
for k in data.keys():
# must make list of keys first to avoid
# RuntimeError: dictionary changed size during iteration
for k in list(data.keys()):
if key_matcher(k):
del data[k]
return data
+5 -3
View File
@@ -94,7 +94,8 @@ def printerProfilesAdd():
return make_response("Profile does not contain mandatory 'name' field", 400)
try:
saved_profile = printerProfileManager.save(profile, allow_overwrite=False, make_default=make_default)
saved_profile = printerProfileManager.save(profile, allow_overwrite=False, make_default=make_default,
trigger_event=True)
except InvalidProfileError:
return make_response("Profile is invalid", 400)
except CouldNotOverwriteError:
@@ -126,7 +127,7 @@ def printerProfilesDelete(identifier):
if default_profile and default_profile["id"] == identifier:
return make_response("Cannot delete default profile: {}".format(identifier), 409)
printerProfileManager.remove(identifier)
printerProfileManager.remove(identifier, trigger_event=True)
return NO_CONTENT
@api.route("/printerprofiles/<string:identifier>", methods=["PATCH"])
@@ -162,7 +163,8 @@ def printerProfilesUpdate(identifier):
merged_profile["id"] = identifier
try:
saved_profile = printerProfileManager.save(merged_profile, allow_overwrite=True, make_default=make_default)
saved_profile = printerProfileManager.save(merged_profile, allow_overwrite=True, make_default=make_default,
trigger_event=True)
except InvalidProfileError:
return make_response("Profile is invalid", 400)
except CouldNotOverwriteError:
+12 -1
View File
@@ -96,7 +96,8 @@ def getSettings():
"colorIcon": s.getBoolean(["appearance", "colorIcon"]),
"defaultLanguage": s.get(["appearance", "defaultLanguage"]),
"showFahrenheitAlso": s.getBoolean(["appearance", "showFahrenheitAlso"]),
"fuzzyTimes": s.getBoolean(["appearance", "fuzzyTimes"])
"fuzzyTimes": s.getBoolean(["appearance", "fuzzyTimes"]),
"closeModalsWithClick": s.getBoolean(["appearance", "closeModalsWithClick"])
},
"printer": {
"defaultExtrusionLength": s.getInt(["printerParameters", "defaultExtrusionLength"])
@@ -128,6 +129,7 @@ def getSettings():
"keyboardControl": s.getBoolean(["feature", "keyboardControl"]),
"pollWatched": s.getBoolean(["feature", "pollWatched"]),
"modelSizeDetection": s.getBoolean(["feature", "modelSizeDetection"]),
"printStartConfirmation": s.getBoolean(["feature", "printStartConfirmation"]),
"printCancelConfirmation": s.getBoolean(["feature", "printCancelConfirmation"]),
"g90InfluencesExtruder": s.getBoolean(["feature", "g90InfluencesExtruder"]),
"autoUppercaseBlacklist": s.get(["feature", "autoUppercaseBlacklist"])
@@ -177,6 +179,8 @@ def getSettings():
"ignoreIdenticalResends": s.getBoolean(["serial", "ignoreIdenticalResends"]),
"firmwareDetection": s.getBoolean(["serial", "firmwareDetection"]),
"blockWhileDwelling": s.getBoolean(["serial", "blockWhileDwelling"]),
"useParityWorkaround": s.get(["serial", "useParityWorkaround"]),
"sendM112OnError": s.getBoolean(["serial", "sendM112OnError"]),
"maxTimeoutsIdle": s.getInt(["serial", "maxCommunicationTimeouts", "idle"]),
"maxTimeoutsPrinting": s.getInt(["serial", "maxCommunicationTimeouts", "printing"]),
"maxTimeoutsLong": s.getInt(["serial", "maxCommunicationTimeouts", "long"]),
@@ -391,6 +395,7 @@ def _saveSettings(data):
if "defaultLanguage" in data["appearance"]: s.set(["appearance", "defaultLanguage"], data["appearance"]["defaultLanguage"])
if "showFahrenheitAlso" in data["appearance"]: s.setBoolean(["appearance", "showFahrenheitAlso"], data["appearance"]["showFahrenheitAlso"])
if "fuzzyTimes" in data["appearance"]: s.setBoolean(["appearance", "fuzzyTimes"], data["appearance"]["fuzzyTimes"])
if "closeModalsWithClick" in data["appearance"]: s.setBoolean(["appearance", "closeModalsWithClick"], data["appearance"]["closeModalsWithClick"])
if "printer" in data:
if "defaultExtrusionLength" in data["printer"]: s.setInt(["printerParameters", "defaultExtrusionLength"], data["printer"]["defaultExtrusionLength"])
@@ -422,6 +427,7 @@ def _saveSettings(data):
if "keyboardControl" in data["feature"]: s.setBoolean(["feature", "keyboardControl"], data["feature"]["keyboardControl"])
if "pollWatched" in data["feature"]: s.setBoolean(["feature", "pollWatched"], data["feature"]["pollWatched"])
if "modelSizeDetection" in data["feature"]: s.setBoolean(["feature", "modelSizeDetection"], data["feature"]["modelSizeDetection"])
if "printStartConfirmation" in data["feature"]: s.setBoolean(["feature", "printStartConfirmation"], data["feature"]["printStartConfirmation"])
if "printCancelConfirmation" in data["feature"]: s.setBoolean(["feature", "printCancelConfirmation"], data["feature"]["printCancelConfirmation"])
if "g90InfluencesExtruder" in data["feature"]: s.setBoolean(["feature", "g90InfluencesExtruder"], data["feature"]["g90InfluencesExtruder"])
if "autoUppercaseBlacklist" in data["feature"] and isinstance(data["feature"]["autoUppercaseBlacklist"], (list, tuple)): s.set(["feature", "autoUppercaseBlacklist"], data["feature"]["autoUppercaseBlacklist"])
@@ -468,6 +474,11 @@ def _saveSettings(data):
if "ignoreIdenticalResends" in data["serial"]: s.setBoolean(["serial", "ignoreIdenticalResends"], data["serial"]["ignoreIdenticalResends"])
if "firmwareDetection" in data["serial"]: s.setBoolean(["serial", "firmwareDetection"], data["serial"]["firmwareDetection"])
if "blockWhileDwelling" in data["serial"]: s.setBoolean(["serial", "blockWhileDwelling"], data["serial"]["blockWhileDwelling"])
if "useParityWorkaround" in data["serial"]:
value = data["serial"]["useParityWorkaround"]
if value in ("always", "detect", "never"):
s.set(["serial", "useParityWorkaround"], value)
if "sendM112OnError" in data["serial"]: s.setBoolean(["serial", "sendM112OnError"], data["serial"]["sendM112OnError"])
if "logPositionOnPause" in data["serial"]: s.setBoolean(["serial", "logPositionOnPause"], data["serial"]["logPositionOnPause"])
if "logPositionOnCancel" in data["serial"]: s.setBoolean(["serial", "logPositionOnCancel"], data["serial"]["logPositionOnCancel"])
if "abortHeatupOnCancel" in data["serial"]: s.setBoolean(["serial", "abortHeatupOnCancel"], data["serial"]["abortHeatupOnCancel"])
+33 -3
View File
@@ -1149,19 +1149,49 @@ def check_lastmodified(lastmodified):
def add_revalidation_response_headers(response):
response.headers["Cache-Control"] = "no-cache, must-revalidate"
import werkzeug.http
cache_control = werkzeug.http.parse_dict_header(response.headers.get("Cache-Control", ""))
if "no-cache" not in cache_control:
cache_control["no-cache"] = None
if "must-revalidate" not in cache_control:
cache_control["must-revalidate"] = None
response.headers["Cache-Control"] = werkzeug.http.dump_header(cache_control)
return response
def add_non_caching_response_headers(response):
response.headers["Cache-Control"] = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0"
import werkzeug.http
cache_control = werkzeug.http.parse_dict_header(response.headers.get("Cache-Control", ""))
if "no-store" not in cache_control:
cache_control["no-store"] = None
if "no-cache" not in cache_control:
cache_control["no-cache"] = None
if "must-revalidate" not in cache_control:
cache_control["must-revalidate"] = None
if "post-check" not in cache_control or cache_control["post-check"] != "0":
cache_control["post-check"] = "0"
if "pre-check" not in cache_control or cache_control["pre-check"] != "0":
cache_control["pre-check"] = "0"
if "max-age" not in cache_control or cache_control["max-age"] != "0":
cache_control["max-age"] = "0"
response.headers["Cache-Control"] = werkzeug.http.dump_header(cache_control)
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "-1"
return response
def add_no_max_age_response_headers(response):
response.headers["Cache-Control"] = "max-age=0"
import werkzeug.http
cache_control = werkzeug.http.parse_dict_header(response.headers.get("Cache-Control", ""))
if "max-age" not in cache_control or cache_control["max-age"] != "0":
cache_control["max-age"] = "0"
response.headers["Cache-Control"] = werkzeug.http.dump_header(cache_control)
return response
+4 -3
View File
@@ -201,9 +201,10 @@ def index():
default_additional_etag = [enable_accesscontrol,
enable_gcodeviewer,
enable_timelapse] + sorted(["{}:{}".format(to_unicode(k, errors="replace"),
to_unicode(v, errors="replace"))
for k, v in _plugin_vars.items()])
enable_timelapse,
wizard_active(_templates.get(locale))] + sorted(["{}:{}".format(to_unicode(k, errors="replace"),
to_unicode(v, errors="replace"))
for k, v in _plugin_vars.items()])
def get_preemptively_cached_view(key, view, data=None, additional_request_data=None, additional_unless=None):
if (data is None and additional_request_data is None) or g.locale is None:
+5
View File
@@ -150,6 +150,9 @@ default_settings = {
"supportFAsCommand": False,
"firmwareDetection": True,
"blockWhileDwelling": False,
"useParityWorkaround": "detect",
"maxConsecutiveResends": 10,
"sendM112OnError": True,
"capabilities": {
"autoreport_temp": True,
@@ -270,6 +273,7 @@ default_settings = {
"keyboardControl": True,
"pollWatched": False,
"modelSizeDetection": True,
"printStartConfirmation": False,
"printCancelConfirmation": True,
"autoUppercaseBlacklist": ["M117", "M118"],
"g90InfluencesExtruder": False
@@ -314,6 +318,7 @@ default_settings = {
"defaultLanguage": "_default",
"showFahrenheitAlso": False,
"fuzzyTimes": True,
"closeModalsWithClick": True,
"components": {
"order": {
"navbar": ["settings", "systemmenu", "plugin_announcements", "plugin_pi_support", "login"],
@@ -73,13 +73,13 @@ GCODE.gCodeReader = (function(){
return tmpModel;
};
var prepareLinesIndex = function(){
var prepareLinesIndex = function(m){
percentageTree = undefined;
for (var l = 0; l < model.length; l++) {
if (model[l] === undefined) continue;
for (var i = 0; i < model[l].length; i++) {
var percentage = model[l][i].percentage;
for (var l = 0; l < m.length; l++) {
if (m[l] === undefined) continue;
for (var i = 0; i < m[l].length; i++) {
var percentage = m[l][i].percentage;
var value = {layer: l, cmd: i};
if (!percentageTree) {
percentageTree = new AVLTree({key: percentage, value: value}, "key");
@@ -178,11 +178,12 @@ GCODE.gCodeReader = (function(){
},
passDataToRenderer: function(){
var m = model;
var m = _.cloneDeep(model);
if (gCodeOptions["sortLayers"]) m = sortLayers(m);
if (gCodeOptions["purgeEmptyLayers"]) m = purgeLayers(m);
prepareLinesIndex();
prepareLinesIndex(m);
GCODE.renderer.doRender(m, 0);
return m;
},
processLayerFromWorker: function(msg){
+3 -2
View File
@@ -59,7 +59,7 @@ GCODE.ui = (function(){
setProgress("done", 100);
GCODE.gCodeReader.processAnalyzeModelDone(data.msg);
GCODE.gCodeReader.passDataToRenderer();
var activeModel = GCODE.gCodeReader.passDataToRenderer();
if (uiOptions["onModelLoaded"]) {
uiOptions.onModelLoaded({
@@ -70,7 +70,8 @@ GCODE.ui = (function(){
printTime: data.msg.printTime,
layerHeight: data.msg.layerHeight,
layersPrinted: data.msg.layerCnt,
layersTotal: data.msg.layerTotal
layersTotal: data.msg.layerTotal,
layersActive: activeModel.length
});
}
switchLayer(0);
+3 -2
View File
@@ -156,7 +156,7 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
if (self._safeModePopup) self._safeModePopup.remove();
if (data["safe_mode"]) {
// safe mode is active, let's inform the user
log.info("Safe mode is active. Third party plugins are disabled and cannot be enabled.");
log.info("Safe mode is active. Third party plugins and language packs are disabled and cannot be enabled.");
log.info("Reason for safe mode: " + data["safe_mode"]);
var reason = gettext("Unknown");
@@ -177,7 +177,7 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
self._safeModePopup = new PNotify({
title: gettext("Safe mode is active"),
text: _.sprintf(gettext("<p>The server is currently running in safe mode. Third party plugins are disabled and cannot be enabled.</p><p>Reason: %(reason)s</p>"), {reason: reason}),
text: _.sprintf(gettext("<p>The server is currently running in safe mode. Third party plugins and language packs are disabled and cannot be enabled.</p><p>Reason: %(reason)s</p>"), {reason: reason}),
hide: false
});
}
@@ -278,6 +278,7 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) {
break;
}
case "resend":
case "resend_loop":
case "timeout": {
title = gettext("Communication error");
text = _.sprintf(gettext("There was a communication error while talking to your printer. Please consult the terminal output and octoprint.log for details. Error: %(error)s"), payload);
+12 -2
View File
@@ -576,9 +576,19 @@ function formatFuzzyPrintTime(totalSeconds) {
return _.sprintf(text, replacements);
}
function formatDate(unixTimestamp) {
function formatDate(unixTimestamp, options) {
if (!options) {
options = { seconds: false };
}
if (!unixTimestamp) return "-";
return moment.unix(unixTimestamp).format(gettext(/* L10N: Date format */ "YYYY-MM-DD HH:mm"));
var format = gettext(/* L10N: Date format */ "YYYY-MM-DD HH:mm");
if (options.seconds) {
format = gettext(/* L10N: Date format with seconds */ "YYYY-MM-DD HH:mm:ss");
}
return moment.unix(unixTimestamp).format(format);
}
function formatTimeAgo(unixTimestamp) {
+10
View File
@@ -718,6 +718,16 @@ $(function() {
viewModelMap["settingsViewModel"].requestData()
.done(function() {
var adjustModalDefaultBehaviour = function() {
if (viewModelMap["settingsViewModel"].appearance_closeModalsWithClick()) {
$.fn.modal.defaults.backdrop = true;
} else {
$.fn.modal.defaults.backdrop = "static";
}
};
adjustModalDefaultBehaviour();
viewModelMap["settingsViewModel"].appearance_closeModalsWithClick.subscribe(adjustModalDefaultBehaviour);
// There appears to be an odd race condition either in JQuery's AJAX implementation or
// the browser's implementation of XHR, causing a second GET request from inside the
// completion handler of the very same request to never get its completion handler called
@@ -208,9 +208,8 @@ $(function() {
});
}
var js;
if (control.hasOwnProperty("javascript")) {
js = control.javascript;
var js = control.javascript;
// if js is a function everything's fine already, but if it's a string we need to eval that first
if (!_.isFunction(js)) {
@@ -221,12 +220,12 @@ $(function() {
}
if (control.hasOwnProperty("enabled")) {
js = control.enabled;
var enabled = control.enabled;
// if js is a function everything's fine already, but if it's a string we need to eval that first
if (!_.isFunction(js)) {
if (!_.isFunction(enabled)) {
control.enabled = function (data) {
return eval(js);
return eval(enabled);
}
}
}
@@ -200,7 +200,7 @@ $(function() {
};
self.highlightFilename = function(filename) {
if (filename === undefined) {
if (filename === undefined || filename === null) {
self.listHelper.selectNone();
} else {
self.listHelper.selectItem(function(item) {
@@ -476,7 +476,20 @@ $(function() {
var withinPrintDimensions = self.evaluatePrintDimensions(data, true);
var print = printAfterLoad && withinPrintDimensions;
OctoPrint.files.select(data.origin, data.path, print);
if (print && self.settingsViewModel.feature_printStartConfirmation()) {
showConfirmationDialog({
message: gettext("This will start a new print job. Please check that the print bed is clear."),
question: gettext("Do you want to start the print job now?"),
cancel: gettext("No"),
proceed: gettext("Yes"),
onproceed: function() {
OctoPrint.files.select(data.origin, data.path, print);
},
nofade: true
});
} else {
OctoPrint.files.select(data.origin, data.path, print);
}
}
};
@@ -532,7 +532,7 @@ $(function() {
self.ui_modelInfo(output.join("<br>"));
self.maxLayer = model.layersPrinted - 1;
self.maxLayer = model.layersActive - 1;
if (self.layerSlider !== undefined) {
self.layerSlider.slider("enable");
self.layerSlider.slider("setMax", self.maxLayer);
@@ -45,9 +45,10 @@ $(function() {
self.filename = ko.observable(undefined);
self.filepath = ko.observable(undefined);
self.filedisplay = ko.observable(undefined);
self.progress = ko.observable(undefined);
self.filesize = ko.observable(undefined);
self.filepos = ko.observable(undefined);
self.filedate = ko.observable(undefined);
self.progress = ko.observable(undefined);
self.printTime = ko.observable(undefined);
self.printTimeLeft = ko.observable(undefined);
self.printTimeLeftOrigin = ko.observable(undefined);
@@ -77,7 +78,7 @@ $(function() {
if (self.estimatedPrintTime())
return fmt(self.estimatedPrintTime());
return "-";
}
};
self.estimatedPrintTimeString = ko.pureComputed(function() {
return estimatedPrintTimeStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration);
});
@@ -110,7 +111,7 @@ $(function() {
} else {
return fmt(self.printTimeLeft());
}
}
};
self.printTimeLeftString = ko.pureComputed(function() {
return printTimeLeftStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration);
});
@@ -209,6 +210,15 @@ $(function() {
return (user ? user : (file ? "-" : ""));
});
self.dateString = ko.pureComputed(function() {
var date = self.filedate();
if (!date) {
return "";
}
return formatDate(date, {seconds:true});
});
self.fromCurrentData = function(data) {
self._fromData(data);
};
@@ -260,12 +270,14 @@ $(function() {
self.filepath(data.file.path);
self.filesize(data.file.size);
self.filedisplay(data.file.display);
self.filedate(data.file.date);
self.sd(data.file.origin === "sdcard");
} else {
self.filename(undefined);
self.filepath(undefined);
self.filesize(undefined);
self.filedisplay(undefined);
self.filedate(undefined);
self.sd(undefined);
}
@@ -325,7 +337,21 @@ $(function() {
}
});
} else {
OctoPrint.job.start();
if (!self.settings.feature_printStartConfirmation()) {
OctoPrint.job.start();
} else {
showConfirmationDialog({
message: gettext("This will start a new print job. Please check that the print bed is clear."),
question: gettext("Do you want to start the print job now?"),
cancel: gettext("No"),
proceed: gettext("Yes"),
onproceed: function() {
OctoPrint.job.start();
},
nofade: true
});
}
}
};
@@ -119,6 +119,7 @@ $(function() {
self.appearance_defaultLanguage = ko.observable();
self.appearance_showFahrenheitAlso = ko.observable(undefined);
self.appearance_fuzzyTimes = ko.observable(undefined);
self.appearance_closeModalsWithClick = ko.observable(undefined);
self.printer_defaultExtrusionLength = ko.observable(undefined);
@@ -149,6 +150,7 @@ $(function() {
self.feature_keyboardControl = ko.observable(undefined);
self.feature_pollWatched = ko.observable(undefined);
self.feature_modelSizeDetection = ko.observable(undefined);
self.feature_printStartConfirmation = ko.observable(undefined);
self.feature_printCancelConfirmation = ko.observable(undefined);
self.feature_g90InfluencesExtruder = ko.observable(undefined);
self.feature_autoUppercaseBlacklist = ko.observable(undefined);
@@ -191,6 +193,7 @@ $(function() {
self.serial_ignoreIdenticalResends = ko.observable(undefined);
self.serial_firmwareDetection = ko.observable(undefined);
self.serial_blockWhileDwelling = ko.observable(undefined);
self.serial_useParityWorkaround = ko.observable(undefined);
self.serial_supportResendsWithoutOk = ko.observable(undefined);
self.serial_logPositionOnPause = ko.observable(undefined);
self.serial_logPositionOnCancel = ko.observable(undefined);
@@ -202,6 +205,7 @@ $(function() {
self.serial_capAutoreportSdStatus = ko.observable(undefined);
self.serial_capBusyProtocol = ko.observable(undefined);
self.serial_capEmergencyParser = ko.observable(undefined);
self.serial_sendM112OnError = ko.observable(undefined);
self.connection_log_connection = ko.observable(undefined);
self.connection_log_commdebug = ko.observable(undefined);
@@ -367,7 +371,8 @@ $(function() {
response: "bytes",
timeout: self.webcam_snapshotTimeout(),
validSsl: self.webcam_snapshotSslValidation(),
content_type_whitelist: ["image/*"]
content_type_whitelist: ["image/*"],
content_type_guess: true
})
.done(function(response) {
if (!response.result) {
@@ -391,7 +396,7 @@ $(function() {
}
var content = response.response.content;
var contentType = response.response.content_type
var contentType = response.response.assumed_content_type;
var mimeType = "image/jpeg";
if (contentType) {
@@ -401,7 +406,7 @@ $(function() {
var text = gettext("If you see your webcam snapshot picture below, the entered snapshot URL is ok.");
showMessageDialog({
title: gettext("Snapshot test"),
message: $('<p>' + text + '</p><p><img src="data:' + mimeType + ';base64,' + content + '" /></p>'),
message: $('<p>' + text + '</p><p><img src="data:' + mimeType + ';base64,' + content + '" style="border: 1px solid black" /></p>'),
onclose: function() {
self.testWebcamSnapshotUrlBusy(false);
}
@@ -339,6 +339,10 @@ $(function() {
copyToClipboard(lines.join("\n"));
};
self.clearAllLogs = function() {
self.log([]);
self.plainLogLines([]);
};
// command matching regex
// (Example output for inputs G0, G1, G28.1, M117 test)
// - 1: code including optional subcode. Example: G0, G1, G28.1, M117
@@ -10,7 +10,7 @@
<label class="control-label" for="settings-apikey">{{ _('API Key') }}</label>
<div class="controls">
<div class="input-append input-block-level">
<input type="text" readonly="readonly" id="settings-apikey" data-bind="value: api_key, attr: {placeholder: '{{ _('N/A') }}'}">
<input type="text" readonly="readonly" id="settings-apikey" data-bind="value: api_key, attr: {placeholder: '{{ _('N/A')|esq }}'}">
<a class="btn add-on" title="Copy API Key to clipboard" data-bind="click: copyApiKey, css: {'disabled': !api_key()}"><i class="fa fa-copy"></i></a>
<a class="btn add-on" title="Generate new API Key" data-bind="click: generateApiKey"><i class="fa fa-refresh"></i></a>
</div>
@@ -1,25 +1,25 @@
<form class="form-horizontal">
<div class="control-group" title="{{ _('Name of this OctoPrint instance, will be shown in the navigation bar and broadcast on the network') }}">
<div class="control-group" title="{{ _('Name of this OctoPrint instance, will be shown in the navigation bar and broadcast on the network')|edq }}">
<label class="control-label" for="settings-appearanceName">{{ _('Title') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: appearance_name" id="settings-appearanceName">
</div>
</div>
<div class="control-group" title="{{ _('Personalize the color of the navigation bar - maybe to match your printer?') }}">
<div class="control-group" title="{{ _('Personalize the color of the navigation bar - maybe to match your printer?')|edq }}">
<label class="control-label" for="settings-appearanceColor">{{ _('Color') }}</label>
<div class="controls">
<select id="settings-appearanceColor" data-bind="value: appearance_color, options: appearance_available_colors, optionsText: 'name', optionsValue: 'key'">
</select>
</div>
</div>
<div class="control-group" title="{{ _('For acrylic printers ;)') }}">
<div class="control-group" title="{{ _('For acrylic printers ;)')|edq }}">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: appearance_colorTransparent"> {{ _('Transparent color') }}
</label>
</div>
</div>
<div class="control-group" title="{{ _('Also personalize the icon of the browser tab') }}">
<div class="control-group" title="{{ _('Also personalize the icon of the browser tab')|edq }}">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: appearance_colorIcon"> {{ _('Colorize favicon (in supported browsers)') }}
@@ -57,6 +57,13 @@
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: appearance_closeModalsWithClick" id="settings-appearanceCloseModalsWithClick"> {{ _('Close dialogs by clicking outside') }}
</label>
</div>
</div>
</form>
<div id="settings_appearance_managelanguagesdialog" class="modal hide fade">
@@ -13,6 +13,13 @@
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: feature_printStartConfirmation" id="settings-printStartConfirmation"> {{ _('Confirm before starting a print') }}
</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
@@ -42,7 +49,7 @@
</label>
</div>
</div>
<div class="control-group" title="{{ _('Commands to not completely auto uppercase in the terminal tab') }}">
<div class="control-group" title="{{ _('Commands to not completely auto uppercase in the terminal tab')|edq }}">
<label class="control-label" for="settings-featureAutoUppercaseBlacklist">{{ _('Terminal Auto Uppercase Blacklist') }}</label>
<div class="controls">
<input type="text" class="input-block-level" id="settings-featureAutoUppercaseBlacklist" data-bind="value: feature_autoUppercaseBlacklist">
@@ -3,42 +3,49 @@
<label class="control-label">{{ _('Before print job starts') }}</label>
<div class="controls">
<textarea rows="4" class="block" data-bind="value: scripts_gcode_beforePrintStarted"></textarea>
<small>{{ _('Anything you put here will be executed <em>before</em> any lines in your files.') }}</small>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('After print job completes') }}</label>
<div class="controls">
<textarea rows="4" class="block" data-bind="value: scripts_gcode_afterPrintDone"></textarea>
<small>{{ _('Anything you put here will be executed <em>after</em> any lines in your files.') }}</small>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('After print job is cancelled') }}</label>
<div class="controls">
<textarea rows="4" class="block" data-bind="value: scripts_gcode_afterPrintCancelled"></textarea>
<small>{{ _('Anything you put here will be executed <em>after</em> any lines in your files.') }}</small>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('After print job is paused') }}</label>
<div class="controls">
<textarea rows="4" class="block" data-bind="value: scripts_gcode_afterPrintPaused"></textarea>
<small>{{ _('Anything you put here will be executed <em>after</em> any lines in your files.') }}</small>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Before print job is resumed') }}</label>
<div class="controls">
<textarea rows="4" class="block" data-bind="value: scripts_gcode_beforePrintResumed"></textarea>
<small>{{ _('Anything you put here will be executed <em>before</em> any lines in your files.') }}</small>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Before tool change') }}</label>
<div class="controls">
<textarea rows="4" class="block" data-bind="value: scripts_gcode_beforeToolChange"></textarea>
<small>{{ _('Anything you put here will be executed <em>before</em> any tool change commands <code>Tn</code>.') }}</small>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('After tool change') }}</label>
<div class="controls">
<textarea rows="4" class="block" data-bind="value: scripts_gcode_afterToolChange"></textarea>
<small>{{ _('Anything you put here will be executed <em>after</em> any tool change commands <code>Tn</code>.') }}</small>
</div>
</div>
<div class="control-group">
@@ -51,7 +58,7 @@
<label class="control-label">{{ _('Before connection to printer is closed') }}</label>
<div class="controls">
<textarea rows="4" class="block" data-bind="value: scripts_gcode_beforePrinterDisconnected"></textarea>
<small>{{ _('This will only be executed when closing the connection actively. If the connection to the printer is suddenly lost nothing will be sent.') }}</small>
<small>{{ _('Anything you put here will only be executed when closing the connection actively. If the connection to the printer is suddenly lost nothing will be sent.') }}</small>
</div>
</div>
</form>
@@ -6,7 +6,7 @@
</label>
</div>
</div>
<div class="control-group" title="{{ _('Maximum size the GCodeViewer autoloads the file for preview') }}">
<div class="control-group" title="{{ _('Maximum size the GCodeViewer autoloads the file for preview')|edq }}">
<label class="control-label" for="settings-featureSizeThreshold">{{ _('GCode Visualizer file size threshold') }}</label>
<div class="controls">
<div class="input-append">
@@ -13,26 +13,26 @@
<div class="control-group">
<label class="control-label">{{ _('Slicer') }}</label>
<div class="controls">
<select data-bind="options: matchingSlicers, optionsText: 'name', optionsValue: 'key', optionsCaption: '{{ _('Select a slicer...') }}', value: slicer, valueAllowUnset: true"></select>
<select data-bind="options: matchingSlicers, optionsText: 'name', optionsValue: 'key', optionsCaption: '{{ _('Select a slicer...')|esq }}', value: slicer, valueAllowUnset: true"></select>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Runs locally') }}</label>
<div class="controls">
<strong data-bind="text: slicerSameDevice() ? gettext('Yes') : gettext('No')"></strong>
<span class="help-block"><small>{{ _('For performance reasons locally run slicers are disabled while printing') }}</small></span>
<span class="help-block"><small>{{ _('For performance reasons locally run slicers are disabled while printing')|esq }}</small></span>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Slicing Profile') }}</label>
<div class="controls">
<select data-bind="options: profiles, optionsText: 'name', optionsValue: 'key', optionsCaption: '{{ _('Select a slicing profile...') }}', value: profile, valueAllowUnset: true"></select>
<select data-bind="options: profiles, optionsText: 'name', optionsValue: 'key', optionsCaption: '{{ _('Select a slicing profile...')|esq }}', value: profile, valueAllowUnset: true"></select>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ _('Printer Profile') }}</label>
<div class="controls">
<select data-bind="options: printerProfiles.profiles.items, optionsText: 'name', optionsValue: 'id', value: printerProfile, optionsCaption: '{{ _('Select a printer profile...') }}'"></select>
<select data-bind="options: printerProfiles.profiles.items, optionsText: 'name', optionsValue: 'id', value: printerProfile, optionsCaption: '{{ _('Select a printer profile...')|esq }}'"></select>
</div>
</div>
<div class="control-group">
@@ -16,12 +16,12 @@
<label class="control-label">{{ _('New Offset') }}</label>
<div class="controls">
<div class="input-prepend input-append">
<button type="button" class="btn btn-input-dec" data-bind="click: $root.decrementChangeOffset" title="{{ _('-1') }}"><i class="fa fa-minus"></i></button>
<button type="button" class="btn btn-input-dec" data-bind="click: $root.decrementChangeOffset" title="{{ _('-1')|edq }}"><i class="fa fa-minus"></i></button>
<input type="number" min="-50" max="50" class="input-mini input-nospin" style="width: 30px" data-bind="value: changingOffset.newOffset, event: { focus: function(d, e) {$root.handleFocus(e, 'target', changingOffset.item);}, keyup: function(d, e) {$root.handleEnter(e, 'offset', changingOffset.item);} }">
<span class="add-on">&deg;C</span>
<button type="button" class="btn btn-input-inc" data-bind="click: $root.incrementChangeOffset" title="{{ _('+1') }}"><i class="fa fa-plus"></i></button>
<button type="button" class="btn btn-input-inc" data-bind="click: $root.incrementChangeOffset" title="{{ _('+1')|edq }}"><i class="fa fa-plus"></i></button>
</div>
<button type="button" class="btn" data-bind="click: $root.deleteChangeOffset" title="{{ _('Delete Offset') }}"><i class="fa fa-trash"></i></button>
<button type="button" class="btn" data-bind="click: $root.deleteChangeOffset" title="{{ _('Delete Offset')|edq }}"><i class="fa fa-trash"></i></button>
<span class="help-block">{{ _('Hint: Hitting <kbd>Enter</kbd> in the input field will also submit the form') }}</span>
</div>
</div>
@@ -24,7 +24,7 @@
<label class="control-label" for="userSettings-access_apikey">{{ _('Current API Key') }}</label>
<div class="controls">
<div class="input-append input-block-level">
<input type="text" readonly="readonly" id="userSettings-access_apikey" data-bind="value: access_apikey, attr: {placeholder: '{{ _('N/A') }}'}">
<input type="text" readonly="readonly" id="userSettings-access_apikey" data-bind="value: access_apikey, attr: {placeholder: '{{ _('N/A')|esq }}'}">
<a class="btn add-on" title="Copy API Key to clipboard" data-bind="click: copyApikey, css: {'disabled': !access_apikey()}"><i class="fa fa-copy"></i></a>
<a class="btn add-on" title="Generate new API Key" data-bind="click: generateApikey"><i class="fa fa-refresh"></i></a>
<a class="btn btn-danger add-on" title="Delete API Key" data-bind="click: deleteApikey, css: {'disabled': !access_apikey()}"><i class="fa fa-trash-o"></i></a>
+2 -1
View File
@@ -173,8 +173,9 @@
<div class="alert alert-error" style="display: none" data-bind="visible: login_error, text: login_error"></div>
<input type="text" data-bind="value: login_username" class="input-block-level" placeholder="{{ _('Username') }}">
<input type="text" data-bind="value: login_username" class="input-block-level" placeholder="{{ _('Username') }} autofocus">
<input type="password" data-bind="value: login_password" class="input-block-level" placeholder="{{ _('Password') }}">
<span class="pull-right"><small><a href="https://faq.octoprint.org/forgotten-password" id="login-forgotpassword" target="_blank" tabindex="-1">{{ _('Forgot password?') }}</a></small></span>
<label class="checkbox">
<input type="checkbox" data-bind="value: login_remember"> {{ _('Remember me') }}
</label>
+2 -2
View File
@@ -5,10 +5,10 @@
<div id="login_dropdown_loggedout" style="padding: 15px" class="dropdown-menu" data-bind="css: {hide: loginState.loggedIn(), 'dropdown-menu': !loginState.loggedIn()}">
<form id="loginForm" data-bind="event: {'submit': loginState.prepareLogin }" onsubmit="return false; // this gets overwritten on view model bind">
<label for="login_user">{{ _('Username') }}</label>
<input type="text" id="login_user" name="username" data-bind="valueWithInit: loginState.loginUser" placeholder="{{ _('Username') }}" autocapitalize="none" autocorrect="off">
<input type="text" id="login_user" name="username" data-bind="valueWithInit: loginState.loginUser" placeholder="{{ _('Username')|edq }}" autocapitalize="none" autocorrect="off">
<span class="pull-right"><small><a href="https://faq.octoprint.org/forgotten-password" target="_blank" rel="noreferrer noopener" tabindex="-1">{{ _('Forgot password?') }}</a></small></span>
<label for="login_pass">{{ _('Password') }}</label>
<input type="password" id="login_pass" name="password" data-bind="valueWithInit: loginState.loginPass" placeholder="{{ _('Password') }}">
<input type="password" id="login_pass" name="password" data-bind="valueWithInit: loginState.loginPass" placeholder="{{ _('Password')|edq }}">
<label class="checkbox">
<input type="checkbox" id="login_remember" data-bind="checked: loginState.loginRemember"> {{ _('Remember me') }}
</label>
@@ -1,3 +1,3 @@
<a id="navbar_show_settings" title="{{ _('Settings') }}" class="pull-right" href="#settings_dialog" data-bind="click: function() { $root.show(); }">
<a id="navbar_show_settings" title="{{ _('Settings')|edq }}" class="pull-right" href="#settings_dialog" data-bind="click: function() { $root.show(); }">
<i class="fa fa-wrench"></i>
</a>
@@ -1,4 +1,4 @@
<a href="javascript:void(0)" title="{{ _('System') }}" class="dropdown-toggle" data-toggle="dropdown" data-bind="visible: system.systemActions().length > 0">
<a href="javascript:void(0)" title="{{ _('System')|edq }}" class="dropdown-toggle" data-toggle="dropdown" data-bind="visible: system.systemActions().length > 0">
<i class="fa fa-power-off"></i>
<b class="caret"></b>
</a>
@@ -11,7 +11,7 @@
web interface now by clicking the button below.
{% endtrans %}</p>
<p>
<button class="btn btn-primary btn-large" title="{{ _('Reload now') }}" onclick="var event = arguments[0] || window.event; var source = event.target || event.srcElement; if (source.disabled) return; source.disabled = true; source.className += ' disabled'; source.firstChild.style.display = ''; location.reload(true); return false;"><i class="fa fa-spinner fa-spin" style="display: none"></i> {{ _('Reload now') }}</button>
<button class="btn btn-primary btn-large" title="{{ _('Reload now')|edq }}" onclick="var event = arguments[0] || window.event; var source = event.target || event.srcElement; if (source.disabled) return; source.disabled = true; source.className += ' disabled'; source.firstChild.style.display = ''; location.reload(true); return false;"><i class="fa fa-spinner fa-spin" style="display: none"></i> {{ _('Reload now') }}</button>
</p>
</div>
</div>
@@ -1,5 +1,5 @@
<div class="refresh-trigger accordion-heading-button btn-group" data-bind="visible: $root.refreshVisible">
<a href="#" data-bind="click: function() { $root.requestData(); }" title="{{ _('Refresh connection options') }}">
<a href="#" data-bind="click: function() { $root.requestData(); }" title="{{ _('Refresh connection options')|edq }}">
<i class="fa fa-refresh"></i>
</a>
</div>
+9 -9
View File
@@ -1,6 +1,6 @@
<form class="form-search" data-bind="submit: performSearch">
<div class="search-query-with-clear" data-bind="css: {'active-clear': searchQuery}">
<input type="search" class="input-block search-query" data-bind="value: searchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...') }}">
<input type="search" class="input-block search-query" data-bind="value: searchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...')|edq }}">
<span class="search-clear" data-bind="click: clearSearchQuery"><i class="fa fa-remove"></i></span>
</div>
</form>
@@ -21,11 +21,11 @@
<div class="size">{{ _('Size') }}: <span data-bind="text: formatSize(size)"></span></div>
<div class="additionalInfo hide" data-bind="html: $root.getAdditionalData($data)"></div>
<div class="btn-group action-buttons">
<div class="btn btn-mini toggleAdditionalData" data-bind="click: function() { if ($root.enableAdditionalData($data)) { $root.toggleAdditionalData($data); } else { return; } }, css: { disabled: !$root.enableAdditionalData($data) }" title="{{ _('Additional data') }}"><i class="fa fa-chevron-down"></i></div>
<a class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DOWNLOAD), attr: {href: $root.downloadLink($data)}, css: {disabled: !$root.downloadLink($data)}" title="{{ _('Download') }}"><i class="fa fa-download"></i></a>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DELETE), click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove') }}"><i class="fa fa-trash-o"></i></div>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_SELECT), click: function() { if ($root.enableSelect($data)) { $root.loadFile($data, false); } else { return; } }, css: {disabled: !$root.enableSelect($data)}" title="{{ _('Load') }}"><i class="fa fa-folder-open"></i></div>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.PRINT), click: function() { if ($root.enableSelectAndPrint($data)) { $root.loadFile($data, true); } else { return; } }, css: {disabled: !$root.enableSelectAndPrint($data)}" title="{{ _('Load and Print') }}"><i class="fa fa-print"></i></div>
<div class="btn btn-mini toggleAdditionalData" data-bind="click: function() { if ($root.enableAdditionalData($data)) { $root.toggleAdditionalData($data); } else { return; } }, css: { disabled: !$root.enableAdditionalData($data) }" title="{{ _('Additional data')|edq }}"><i class="fa fa-chevron-down"></i></div>
<a class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DOWNLOAD), attr: {href: $root.downloadLink($data)}, css: {disabled: !$root.downloadLink($data)}" title="{{ _('Download')|edq }}"><i class="fa fa-download"></i></a>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DELETE), click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove')|edq }}"><i class="fa fa-trash-o"></i></div>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_SELECT), click: function() { if ($root.enableSelect($data)) { $root.loadFile($data, false); } else { return; } }, css: {disabled: !$root.enableSelect($data)}" title="{{ _('Load')|edq }}"><i class="fa fa-folder-open"></i></div>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.PRINT), click: function() { if ($root.enableSelectAndPrint($data)) { $root.loadFile($data, true); } else { return; } }, css: {disabled: !$root.enableSelectAndPrint($data)}" title="{{ _('Load and Print')|edq }}"><i class="fa fa-print"></i></div>
</div>
</script>
@@ -35,9 +35,9 @@
<div class="uploaded">{{ _('Uploaded') }}: <span data-bind="text: formatTimeAgo(date), attr: {title: formatDate(date)}"></span></div>
<div class="size">{{ _('Size') }}: <span data-bind="text: formatSize(size)"></span></div>
<div class="btn-group action-buttons">
<a class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DOWNLOAD), attr: {href: $root.downloadLink($data), css: {disabled: !$root.downloadLink($data)}}" title="{{ _('Download') }}"><i class="fa fa-download"></i></a>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DELETE), click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove') }}"><i class="fa fa-trash-o"></i></div>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.SLICE), click: function() { if ($root.enableSlicing($data)) { $root.sliceFile($data); } else { return; } }, css: {disabled: !$root.enableSlicing($data)}" title="{{ _('Slice') }}"><i class="fa fa-magic"></i></div>
<a class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DOWNLOAD), attr: {href: $root.downloadLink($data), css: {disabled: !$root.downloadLink($data)}}" title="{{ _('Download')|edq }}"><i class="fa fa-download"></i></a>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.FILES_DELETE), click: function(data, event) { if ($root.enableRemove($data)) { $root.removeFile($data, event); } else { return; } }, css: {disabled: !$root.enableRemove($data)}" title="{{ _('Remove')|edq }}"><i class="fa fa-trash-o"></i></div>
<div class="btn btn-mini" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.SLICE), click: function() { if ($root.enableSlicing($data)) { $root.sliceFile($data); } else { return; } }, css: {disabled: !$root.enableSlicing($data)}" title="{{ _('Slice')|edq }}"><i class="fa fa-magic"></i></div>
</div>
</script>
@@ -1,5 +1,5 @@
<div class="settings-trigger accordion-heading-button btn-group" data-bind="visible: $root.filesListVisible">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" title="{{ _('File list settings') }}">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" title="{{ _('File list settings')|edq }}">
<span class="fa fa-wrench"></span>
</a>
<ul class="dropdown-menu">
@@ -33,14 +33,14 @@
</div>
<div class="refresh-trigger accordion-heading-button btn-group" data-bind="visible: $root.filesListVisible">
<a href="#" data-bind="click: function() { $root.requestData({force: true}); }" title="{{ _('Refresh file list') }}">
<a href="#" data-bind="click: function() { $root.requestData({force: true}); }" title="{{ _('Refresh file list')|edq }}">
<i class="fa fa-refresh"></i>
</a>
</div>
{% if enableSdSupport %}
<div class="sd-trigger accordion-heading-button btn-group" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.CONTROL) && $root.filesListVisible()">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" title="{{ _('SD Card operations') }}">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" title="{{ _('SD Card operations')|edq }}">
<span class="icon-sd-black-14"></span>
</a>
<ul class="dropdown-menu">
+11 -10
View File
@@ -1,20 +1,21 @@
<span title="{{ _('Current printer state') }}">{{ _('State') }}</span>: <strong data-bind="text: stateString"></strong><br>
<span title="{{ _('Current printer state')|edq }}">{{ _('State') }}</span>: <strong data-bind="text: stateString"></strong><br>
<hr>
<span title="{{ _('Name of file currently selected for printing') }}">{{ _('File') }}</span>: <strong data-bind="text: filedisplay, attr: {title: filepath}"></strong>&nbsp;<strong data-bind="visible: sd">(SD)</strong><br>
<span title="{{ _('Name of file currently selected for printing')|edq }}">{{ _('File') }}</span>: <strong data-bind="text: filedisplay, attr: {title: filepath}"></strong>&nbsp;<strong data-bind="visible: sd">(SD)</strong><br>
<span title="{{ _('Upload date of the file currently selected or printing')|edq }}">{{ _('Uploaded') }}</span>: <strong data-bind="text: dateString"></strong><br>
<!-- ko if: userString -->
<span title="{{ _('User who selected this file for printing') }}">{{ _('User') }}</span>: <strong data-bind="text: userString"></strong><br>
<span title="{{ _('User who selected this file for printing')|edq }}">{{ _('User') }}</span>: <strong data-bind="text: userString"></strong><br>
<!-- /ko -->
<!-- ko if: settings.webcam_timelapseEnabled -->
<span title="{{ _('Current timelapse configuration') }}">{{ _('Timelapse') }}</span>: <strong data-bind="text: timelapseString"></strong><br>
<span title="{{ _('Current timelapse configuration')|edq }}">{{ _('Timelapse') }}</span>: <strong data-bind="text: timelapseString"></strong><br>
<!-- /ko -->
<!-- ko foreach: filament -->
<span data-bind="text: 'Filament (' + name() + '): ', title: 'Filament usage for ' + name()"></span><strong data-bind="text: formatFilament(data())"></strong><br>
<!-- /ko -->
<span title="{{ _('Estimated total print time based on analysis of the file or past prints') }}">{{ _('Approx. Total Print Time') }}</span>: <strong data-bind="text: estimatedPrintTimeString, attr: {title: estimatedPrintTimeExactString}"></strong><br>
<span title="{{ _('Estimated total print time based on analysis of the file or past prints')|edq }}">{{ _('Approx. Total Print Time') }}</span>: <strong data-bind="text: estimatedPrintTimeString, attr: {title: estimatedPrintTimeExactString}"></strong><br>
<hr>
<span title="{{ _('Total print time so far') }}">{{ _('Print Time') }}</span>: <strong data-bind="text: printTimeString"></strong><br>
<span title="{{ _('Estimated time until the print job is done. This is only an estimate and accuracy depends heavily on various factors!') }}">{{ _('Print Time Left') }}</span>: <strong data-bind="text: printTimeLeftString, attr: {title: printTimeLeftExactString}"></strong> <span id="state_printtimeleft_popover" style="display: none" data-bind="visible: printTimeLeftOrigin, attr: {title: printTimeLeftOriginString}, css: printTimeLeftOriginClass">&#9679;</span><br>
<span title="{{ _('Bytes printed vs total bytes of file') }}">{{ _('Printed') }}</span>: <strong data-bind="text: byteString"></strong><br>
<span title="{{ _('Total print time so far')|edq }}">{{ _('Print Time') }}</span>: <strong data-bind="text: printTimeString"></strong><br>
<span title="{{ _('Estimated time until the print job is done. This is only an estimate and accuracy depends heavily on various factors!')|edq }}">{{ _('Print Time Left') }}</span>: <strong data-bind="text: printTimeLeftString, attr: {title: printTimeLeftExactString}"></strong> <span id="state_printtimeleft_popover" style="display: none" data-bind="visible: printTimeLeftOrigin, attr: {title: printTimeLeftOriginString}, css: printTimeLeftOriginClass">&#9679;</span><br>
<span title="{{ _('Bytes printed vs total bytes of file')|edq }}">{{ _('Printed') }}</span>: <strong data-bind="text: byteString"></strong><br>
<div class="progress progress-text-centered">
@@ -25,7 +26,7 @@
</div>
<div class="row-fluid print-control" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.PRINT)">
<button class="btn btn-primary span4" data-bind="click: print, enable: enablePrint, css: {'btn-danger': isPaused()}, attr: {title: titlePrintButton}" id="job_print"><i class="fa" data-bind="css: {'fa-print': !isPaused(), 'fa-undo': isPaused()}"></i> <span data-bind="text: (isPaused() ? '{{ _('Restart') }}' : '{{ _('Print') }}')">{{ _('Print') }}</span></button>
<button class="btn btn-primary span4" data-bind="click: print, enable: enablePrint, css: {'btn-danger': isPaused()}, attr: {title: titlePrintButton}" id="job_print"><i class="fa" data-bind="css: {'fa-print': !isPaused(), 'fa-undo': isPaused()}"></i> <span data-bind="text: (isPaused() ? '{{ _('Restart')|esq }}' : '{{ _('Print')|esq }}')">{{ _('Print')|esq }}</span></button>
<button class="btn span4" id="job_pause" data-bind="click: function() { isPaused() ? onlyResume() : onlyPause(); }, enable: enablePause, css: {active: isPaused()}, attr: {title: titlePauseButton}"><i class="fa" data-bind="css: {'fa-pause': !isPaused(), 'fa-play': isPaused()}"></i> <span data-bind="visible: !isPaused()">{{ _('Pause') }}</span><span data-bind="visible: isPaused()">{{ _('Resume') }}</span></button>
<button class="btn span4" id="job_cancel" data-bind="click: cancel, enable: enableCancel" title="{{ _('Cancels the print job') }}"><i class="fa fa-stop"></i> {{ _('Cancel') }}</button>
<button class="btn span4" id="job_cancel" data-bind="click: cancel, enable: enableCancel" title="{{ _('Cancels the print job')|edq }}"><i class="fa fa-stop"></i> {{ _('Cancel') }}</button>
</div>
@@ -3,7 +3,7 @@
<tr>
<td class="settings_accesscontrol_groups_list_checkbox"><input type="checkbox" data-bind="checkedValue: key, checked: $parents[1].editor.groups, enable: toggleable"></td>
<td class="settings_accesscontrol_groups_list_name" style="cursor: pointer" data-bind="click: function() { if ($data.toggleable) { $parents[1].editor.toggleGroup($data.key) } }, attr: {title: description}">
<span class="name" data-bind="text: name, style: { fontWeight: ($parents[1].editor.groupSelected($data.name)) ? 'bold' : 'normal' }"></span> <small class="label label-info" data-bind="visible: !$data.toggleable" title="{{ _('Fixed groups can\'t be added or removed to users.') }}">{{ _('Fixed') }}</small><br>
<span class="name" data-bind="text: name, style: { fontWeight: ($parents[1].editor.groupSelected($data.name)) ? 'bold' : 'normal' }"></span> <small class="label label-info" data-bind="visible: !$data.toggleable" title="{{ _('Fixed groups can\'t be added or removed to users.')|edq }}">{{ _('Fixed') }}</small><br>
<small class="description" data-bind="text: description"></small><br>
<small class="permissions muted" data-bind="text: $parents[1].editor.joinedGroupPermissions($data)"></small>
</td>
@@ -9,7 +9,7 @@
</thead>
<tbody data-bind="foreach: $root.access.groups.listHelper.paginatedItems">
<tr>
<td class="settings_groups_default"><span class="fa fa-star" data-bind="invisible: !$data.default" title="{{ _('Default group') }}"></span></td>
<td class="settings_groups_default"><span class="fa fa-star" data-bind="invisible: !$data.default" title="{{ _('Default group')|edq }}"></span></td>
<td class="settings_groups_name">
<span data-bind="text: name"></span><br>
<small class="muted" data-bind="text: description"></small>
@@ -27,7 +27,7 @@
</table>
</td>
<td class="settings_groups_actions">
<a href="#" class="fa fa-pencil" title="{{ _('Update group') }}" data-bind="enable: changeable, css: {disabled: !changeable}, click: function() { $root.access.groups.showEditGroupDialog($data); }"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-trash-o" title="{{ _('Delete group') }}" data-bind="enable: removable, css: {disabled: !removable}, click: function() { $root.access.groups.removeGroup($data); }"></a>
<a href="#" class="fa fa-pencil" title="{{ _('Update group')|edq }}" data-bind="enable: changeable, css: {disabled: !changeable}, click: function() { $root.access.groups.showEditGroupDialog($data); }"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-trash-o" title="{{ _('Delete group') }}" data-bind="enable: removable, css: {disabled: !removable}, click: function() { $root.access.groups.removeGroup($data); }"></a>
</td>
</tr>
</tbody>
@@ -44,7 +44,7 @@
</ul>
</div>
<button title="{{ _('Add group') }}" class="btn pull-right" data-bind="click: $root.access.groups.showAddGroupDialog"><i class="fa fa-plus"></i> {{ _('Add group...') }}</button>
<button title="{{ _('Add group')|edq }}" class="btn pull-right" data-bind="click: $root.access.groups.showAddGroupDialog"><i class="fa fa-plus"></i> {{ _('Add group...') }}</button>
<!-- Modals for group management -->
@@ -3,7 +3,7 @@
<tr>
<td class="settings_accesscontrol_subgroups_list_checkbox"><input type="checkbox" data-bind="checkedValue: key, checked: $parents[1].editor.subgroups, enable: toggleable"></td>
<td class="settings_accesscontrol_subgroups_list_name" style="cursor: pointer" data-bind="click: function() { if ($data.toggleable) { $parents[1].editor.toggleSubgroup($data.key) } }, attr: {title: description}">
<span class="name" data-bind="text: name, style: { fontWeight: ($parents[1].editor.subgroupSelected($data.name)) ? 'bold' : 'normal' }"></span> <small class="label label-info" data-bind="visible: !$data.toggleable" title="{{ _('Fixed groups can\'t be added or removed to other groups.') }}">{{ _('Fixed') }}</small><br>
<span class="name" data-bind="text: name, style: { fontWeight: ($parents[1].editor.subgroupSelected($data.name)) ? 'bold' : 'normal' }"></span> <small class="label label-info" data-bind="visible: !$data.toggleable" title="{{ _('Fixed groups can\'t be added or removed to other groups.')|edq }}">{{ _('Fixed') }}</small><br>
<small class="description" data-bind="text: description"></small><br>
<small class="permissions muted" data-bind="text: $parents[1].editor.joinedGroupPermissions($data)"></small>
</td>
@@ -22,13 +22,13 @@
</tr>
<tr data-bind="visible: apikey">
<th class="settings_users_details_key">{{ _('API Key') }}</th>
<td class="settings_users_details_value"><span data-bind="text: apikey"></span> <a href="javascript:void(0)" title="{{ _('Copy API Key to clipboard') }}" data-bind="click: function() { copyToClipboard(apikey) }"><i class="fa fa-copy"></i></a></td>
<td class="settings_users_details_value"><span data-bind="text: apikey"></span> <a href="javascript:void(0)" title="{{ _('Copy API Key to clipboard')|edq }}" data-bind="click: function() { copyToClipboard(apikey) }"><i class="fa fa-copy"></i></a></td>
</tr>
</table>
</td>
<td class="settings_users_active"><i class="fa" data-bind="css: { 'fa-check-square-o': active, 'fa-square-o': !active }"></i></td>
<td class="settings_users_actions">
<a href="#" class="fa fa-pencil" title="{{ _('Update User') }}" data-bind="click: function() { $root.access.users.showEditUserDialog($data); }"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-key" title="{{ _('Change password') }}" data-bind="click: function() { $root.access.users.showChangePasswordDialog($data); }"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-trash-o" title="{{ _('Delete user') }}" data-bind="click: function() { $root.access.users.removeUser($data); }"></a>
<a href="#" class="fa fa-pencil" title="{{ _('Update User')|edq }}" data-bind="click: function() { $root.access.users.showEditUserDialog($data); }"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-key" title="{{ _('Change password') }}" data-bind="click: function() { $root.access.users.showChangePasswordDialog($data); }"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-trash-o" title="{{ _('Delete user') }}" data-bind="click: function() { $root.access.users.removeUser($data); }"></a>
</td>
</tr>
</tbody>
@@ -45,7 +45,7 @@
</ul>
</div>
<button title="{{ _('Add user') }}" class="btn pull-right" data-bind="click: $root.access.users.showAddUserDialog"><i class="fa fa-plus"></i> {{ _('Add user...') }}</button>
<button title="{{ _('Add user')|edq }}" class="btn pull-right" data-bind="click: $root.access.users.showAddUserDialog"><i class="fa fa-plus"></i> {{ _('Add user...') }}</button>
<!-- Modals for user management -->
@@ -156,7 +156,7 @@
<label class="control-label">{{ _('Current API Key') }}</label>
<div class="controls">
<div class="input-append input-block-level ">
<input type="text" readonly="readonly" data-bind="value: $root.access.users.editor.apikey, valueUpdate: 'input', attr: {placeholder: '{{ _('N/A') }}'}">
<input type="text" readonly="readonly" data-bind="value: $root.access.users.editor.apikey, valueUpdate: 'input', attr: {placeholder: '{{ _('N/A')|esq }}'}">
<a class="btn add-on" title="Copy API Key to clipboard" data-bind="click: $root.access.users.copyApikey, css: {'disabled': !$root.access.users.editor.apikey()}"><i class="fa fa-copy"></i></a>
<a class="btn add-on" title="Generate new API Key" data-bind="click: function() { $root.access.users.confirmGenerateApikey(); }"><i class="fa fa-refresh"></i></a>
<a class="btn add-on btn-danger" title="Delete API Key" data-bind="click: function() { $root.access.users.confirmDeleteApikey(); }, css: {'disabled': !$root.access.users.editor.apikey()}"><i class="fa fa-trash-o"></i></a>
@@ -11,7 +11,7 @@
<td class="settings_printerProfiles_profiles_name"><span class="fa fa-star" data-bind="invisible: !isdefault()"></span> <span data-bind="text: name, style: { 'font-weight': iscurrent() ? 'bold' : 'normal' }"></span></td>
<td class="settings_printerProfiles_profiles_model" data-bind="text: model"></td>
<td class="settings_printerProfiles_profiles_action">
<a href="#" class="fa fa-star" title="{{ _('Set as default profile') }}" data-bind="click: function() { if ($root.printerProfiles.canMakeDefault($data) && !$root.printerProfiles.requestInProgress()) { $root.printerProfiles.makeDefault($data); } }, css: {disabled: !$root.printerProfiles.canMakeDefault($data) || $root.printerProfiles.requestInProgress()}, enabled: $root.printerProfile.canMakeDefault($data) && !$root.printerProfiles.requestInProgress()"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-pencil" title="{{ _('Edit Profile') }}" data-bind="click: function() { if (!$root.printerProfiles.requestInProgress()) { $root.printerProfiles.showEditProfileDialog($data); } }, css: {disabled: $root.printerProfiles.requestInProgress()}, enabled: !$root.printerProfiles.requestInProgress()"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-trash-o" title="{{ _('Delete Profile') }}" data-bind="click: function() { if ($root.printerProfiles.canRemove($data) && !$root.printerProfiles.requestInProgress()) { $root.printerProfiles.removeProfile($data); } }, css: {disabled: !$root.printerProfiles.canRemove($data) || $root.printerProfiles.requestInProgress()}, enabled: $root.printerProfiles.canRemove($data) && !$root.printerProfiles.requestInProgress()"></a>
<a href="#" class="fa fa-star" title="{{ _('Set as default profile')|edq }}" data-bind="click: function() { if ($root.printerProfiles.canMakeDefault($data) && !$root.printerProfiles.requestInProgress()) { $root.printerProfiles.makeDefault($data); } }, css: {disabled: !$root.printerProfiles.canMakeDefault($data) || $root.printerProfiles.requestInProgress()}, enabled: $root.printerProfile.canMakeDefault($data) && !$root.printerProfiles.requestInProgress()"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-pencil" title="{{ _('Edit Profile')|edq }}" data-bind="click: function() { if (!$root.printerProfiles.requestInProgress()) { $root.printerProfiles.showEditProfileDialog($data); } }, css: {disabled: $root.printerProfiles.requestInProgress()}, enabled: !$root.printerProfiles.requestInProgress()"></a>&nbsp;|&nbsp;<a href="#" class="fa fa-trash-o" title="{{ _('Delete Profile')|edq }}" data-bind="click: function() { if ($root.printerProfiles.canRemove($data) && !$root.printerProfiles.requestInProgress()) { $root.printerProfiles.removeProfile($data); } }, css: {disabled: !$root.printerProfiles.canRemove($data) || $root.printerProfiles.requestInProgress()}, enabled: $root.printerProfiles.canRemove($data) && !$root.printerProfiles.requestInProgress()"></a>
</td>
</tr>
</tbody>
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('Command to restart the OctoPrint server') }}">
<div class="control-group" title="{{ _('Command to restart the OctoPrint server')|edq }}">
<label class="control-label" for="settings-serverRestartCommand">{{ _('Restart OctoPrint') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: server_commands_serverRestartCommand" id="settings-serverRestartCommand">
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('Command to restart the system OctoPrint is running on') }}">
<div class="control-group" title="{{ _('Command to restart the system OctoPrint is running on')|edq }}">
<label class="control-label" for="settings-systemRestartCommand">{{ _('Restart system') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: server_commands_systemRestartCommand" id="settings-systemRestartCommand">
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('Command to shut down the system OctoPrint is running on') }}">
<div class="control-group" title="{{ _('Command to shut down the system OctoPrint is running on')|edq }}">
<label class="control-label" for="settings-systemShutdownCommand">{{ _('Shutdown system') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: server_commands_systemShutdownCommand" id="settings-systemShutdownCommand">
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('Host against which to check for internet connectivity') }}" data-bind="css: {error: server_onlineCheckBroken, success: server_onlineCheckOk}">
<div class="control-group" title="{{ _('Host against which to check for internet connectivity')|edq }}" data-bind="css: {error: server_onlineCheckBroken, success: server_onlineCheckOk}">
<label class="control-label" for="settings-serverOnlineCheckHost">{{ _('Host IP') }}</label>
<div class="controls">
<input type="text" class="input-small" data-bind="value: server_onlineCheck_host" id="settings-serverOnlineCheckHost">
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('Interval in which to check for internet connectivity') }}">
<div class="control-group" title="{{ _('Interval in which to check for internet connectivity')|edq }}">
<label class="control-label" for="settings-serverOnlineCheckInterval">{{ _('Check interval') }}</label>
<div class="controls">
<span class="input-append">
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('Port against which to check for internet connectivity') }}" data-bind="css: {error: server_onlineCheckBroken, success: server_onlineCheckOk}">
<div class="control-group" title="{{ _('Port against which to check for internet connectivity')|edq }}" data-bind="css: {error: server_onlineCheckBroken, success: server_onlineCheckOk}">
<label class="control-label" for="settings-serverOnlineCheckPort">{{ _('Port') }}</label>
<div class="controls">
<input type="number" min="1" max="65535" step="1" class="input-small" data-bind="value: server_onlineCheck_port" id="settings-serverOnlineCheckPort">
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('Test') }}" data-bind="css: {error: server_onlineCheckBroken, success: server_onlineCheckOk}">
<div class="control-group" title="{{ _('Test')|edq }}" data-bind="css: {error: server_onlineCheckBroken, success: server_onlineCheckOk}">
<div class="controls">
<button class="btn" data-bind="click: testOnlineConnectivityConfig, enable: server_onlineCheck_host() && server_onlineCheck_port() && !testOnlineConnectivityConfigBusy(), css: {disabled: !server_onlineCheck_host() || !server_onlineCheck_port() || testOnlineConnectivityConfigBusy()}"><i class="fa fa-spinner fa-spin" data-bind="visible: testOnlineConnectivityConfigBusy"></i> {{ _('Test host & port') }}</button>
<span class="help-block" data-bind="visible: server_onlineCheckBroken() || server_onlineCheckOk(), text: server_onlineCheckText"></span>
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('How long to cache the blacklist, in minutes. You should normally not have to change this.') }}">
<div class="control-group" title="{{ _('How long to cache the blacklist, in minutes. You should normally not have to change this.')|edq }}">
<label class="control-label" for="settings-serverPluginBlacklistTtl">{{ _('Blacklist cache TTL') }}</label>
<div class="controls">
<div class="input-append">
@@ -1,4 +1,4 @@
<div class="control-group" title="{{ _('Plugin blacklist URL. You should normally not have to change this.') }}">
<div class="control-group" title="{{ _('Plugin blacklist URL. You should normally not have to change this.')|edq }}">
<label class="control-label" for="settings-serverPluginBlacklistUrl">{{ _('Blacklist URL') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: server_pluginBlacklist_url" id="settings-serverPluginBlacklistUrl">
Loaded 100 of 124 files, more files were not shown because too many files have changed in this diff. Show more