Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a70a45f062 | ||
|
|
61b0845f19 | ||
|
|
b9665a8af4 | ||
|
|
15522a98b0 | ||
|
|
c4258c5bb0 | ||
|
|
58799888b7 | ||
|
|
fb6d57963b | ||
|
|
03f228c0ef | ||
|
|
93ae368f58 | ||
|
|
378752e155 | ||
|
|
bec307900d | ||
|
|
0eac10d5a6 | ||
|
|
2a42f02aec | ||
|
|
7c48cfd0f7 | ||
|
|
bba796d551 | ||
|
|
a855f3e62c | ||
|
|
5079e7e891 | ||
|
|
ddc948fa94 | ||
|
|
f88f2b25ea | ||
|
|
ea59dab7ab | ||
|
|
f0914c2214 | ||
|
|
b3e76c3ecc | ||
|
|
a4d5acb0b8 | ||
|
|
79b66f17b6 | ||
|
|
36198c684f | ||
|
|
a3a60c5967 | ||
|
|
6df3cb5c12 | ||
|
|
0611329a6d | ||
|
|
2f90fca5ce | ||
|
|
e4e97190da | ||
|
|
9c748a85b4 | ||
|
|
78c2199d89 | ||
|
|
0e67906d1e | ||
|
|
4c602cba2e | ||
|
|
89255e2ec9 | ||
|
|
372b3662e9 | ||
|
|
e007dbaf4c | ||
|
|
f67f9b9399 | ||
|
|
c6c5328418 | ||
|
|
accbfc2b45 | ||
|
|
9976f2b7a3 | ||
|
|
f249563b2c | ||
|
|
09e023917c | ||
|
|
799b86b287 | ||
|
|
ea1bcf8e5d | ||
|
|
ee93e25ffd | ||
|
|
d25f664be3 | ||
|
|
3bffe4f7cb | ||
|
|
f140dd9d44 | ||
|
|
d44747b39a | ||
|
|
f2da9d8d7d | ||
|
|
5483ef7cd4 | ||
|
|
85d212ba97 | ||
|
|
44af09580a | ||
|
|
530fca95e4 | ||
|
|
59ae7e39f2 | ||
|
|
72167d14d2 | ||
|
|
2c6568acd1 | ||
|
|
e27c216a05 | ||
|
|
7b4c148dd7 | ||
|
|
a924520dd6 | ||
|
|
e88eb6dd85 | ||
|
|
59dfa994bd | ||
|
|
6959ce4d38 | ||
|
|
08bc0082cf | ||
|
|
6069d74a54 | ||
|
|
68ee7030f1 | ||
|
|
81342acccc | ||
|
|
e029f33901 | ||
|
|
7bd8cff137 | ||
|
|
055dcfa0e1 | ||
|
|
8acf417383 | ||
|
|
b50e1aee8a | ||
|
|
c714bce17e | ||
|
|
a9a8e48489 | ||
|
|
9dec840818 | ||
|
|
9af125ca6d | ||
|
|
1f4fabe6ef | ||
|
|
121f36704d | ||
|
|
85ff545c07 | ||
|
|
3662c84de5 | ||
|
|
79558fdfbf | ||
|
|
11040f272a | ||
|
|
fa2716c65c | ||
|
|
768b06e35a | ||
|
|
0820c23aea | ||
|
|
361fbaa366 | ||
|
|
a91359f2af | ||
|
|
4bfabf82ae | ||
|
|
c90f556fe9 | ||
|
|
352b190a72 | ||
|
|
e9b0bd9e65 | ||
|
|
c8ea808d93 | ||
|
|
d40c3e6241 | ||
|
|
e94f789b72 | ||
|
|
9ff44c49a6 | ||
|
|
c7b933ba00 | ||
|
|
6765b25803 | ||
|
|
59b60f5dad | ||
|
|
2822992843 | ||
|
|
1b82aa859f | ||
|
|
12be637f85 | ||
|
|
3bd9d11fc3 | ||
|
|
e864d6b03e | ||
|
|
547db7c1f5 | ||
|
|
d6516e4a4c | ||
|
|
2387b4a771 | ||
|
|
b03d43156d | ||
|
|
07423712a6 | ||
|
|
2edd2ba887 | ||
|
|
fcef3a1bbd | ||
|
|
d1d24dba9a | ||
|
|
81735d07c9 | ||
|
|
2c640ff8b8 | ||
|
|
0331a25ae3 | ||
|
|
326422013a | ||
|
|
9b4da62e69 | ||
|
|
b46a66caa8 | ||
|
|
6711813fef | ||
|
|
7726e5c04e | ||
|
|
495d99fbe9 | ||
|
|
a35b7cddf2 | ||
|
|
f2af5e8b86 | ||
|
|
289c3a4d0f | ||
|
|
4cb67fe72c | ||
|
|
b79fc94a4e | ||
|
|
fca626a3d6 | ||
|
|
f5a04973c4 | ||
|
|
1c9ff91bae | ||
|
|
e1e521300b | ||
|
|
c1e8bc717a | ||
|
|
22d7392769 | ||
|
|
904e7d2ecd | ||
|
|
b3173386ae | ||
|
|
1e3b8dfb2c | ||
|
|
94d172ab67 | ||
|
|
7dac6ca433 | ||
|
|
9aeeb5fecc | ||
|
|
52f65b469d | ||
|
|
0843c0fbc7 | ||
|
|
11607fbc73 | ||
|
|
1521b76090 | ||
|
|
a33a7b4d67 | ||
|
|
c00fdbf73b | ||
|
|
af32858549 | ||
|
|
d1104ddbae | ||
|
|
e2519abbbe | ||
|
|
967b3bbff8 | ||
|
|
9721aec32a | ||
|
|
68952c20bd | ||
|
|
03e328fd13 | ||
|
|
9775d99feb | ||
|
|
bfcff9a1cd | ||
|
|
5ca286f4e3 | ||
|
|
7dae700215 | ||
|
|
58806a3d00 | ||
|
|
72cc1afb45 | ||
|
|
323131cbc5 | ||
|
|
f389773036 | ||
|
|
0a04043922 | ||
|
|
84fa3b6073 | ||
|
|
d6576306b0 | ||
|
|
8970fb42b1 | ||
|
|
55e8cc1118 | ||
|
|
43e2f79575 | ||
|
|
132e2cb244 | ||
|
|
de6d1afdd6 | ||
|
|
0a1cc68a6b | ||
|
|
f1309dad1d | ||
|
|
b353c4eee2 | ||
|
|
34c30ed73f | ||
|
|
c28faa8032 | ||
|
|
8da5bb2d42 | ||
|
|
54c885f1ad | ||
|
|
65fe048ade | ||
|
|
7efcf00baf | ||
|
|
a3254466f7 | ||
|
|
f8dc504773 | ||
|
|
3574c2ddf9 | ||
|
|
1dc0f1fb31 | ||
|
|
30ddbfd324 | ||
|
|
5c522d86ca | ||
|
|
f785c8180b | ||
|
|
18e7d2b72a | ||
|
|
410c3ee5f6 | ||
|
|
48825fd4c2 | ||
|
|
ff9c83ea25 | ||
|
|
2c18a40dcb | ||
|
|
0b6dd7e76e | ||
|
|
d68c7bfc67 | ||
|
|
c879ad27f4 | ||
|
|
d1914824c6 | ||
|
|
79196eeaf7 | ||
|
|
6491db730d | ||
|
|
bd07cda205 | ||
|
|
9c7ca0ab7a | ||
|
|
c4da5d6764 | ||
|
|
47187c233d | ||
|
|
982ed793d9 | ||
|
|
718306073e | ||
|
|
df6e94f7a3 | ||
|
|
1a2739c640 | ||
|
|
9d318a4031 | ||
|
|
292d608b97 | ||
|
|
2d7cb40633 | ||
|
|
ce9315850f | ||
|
|
b8dbc627cb |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [foosel]
|
||||
patreon: foosel
|
||||
custom: https://octoprint.org/support-octoprint/
|
||||
@@ -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
@@ -18,16 +18,16 @@ prerelease
|
||||
HEAD
|
||||
\(detached.*
|
||||
|
||||
# maintenance is currently the branch for preparation of maintenance release 1.3.11
|
||||
# maintenance is currently the branch for preparation of maintenance release 1.3.12
|
||||
# so are any fix/... and improve/... branches
|
||||
maintenance 1.3.11 e14c00f135bf2a955e54ac3f0a2928d8440055d2 pep440-dev
|
||||
fix/.* 1.3.11 e14c00f135bf2a955e54ac3f0a2928d8440055d2 pep440-dev
|
||||
improve/.* 1.3.11 e14c00f135bf2a955e54ac3f0a2928d8440055d2 pep440-dev
|
||||
maintenance 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
|
||||
fix/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
|
||||
improve/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
|
||||
|
||||
# staging/maintenance is currently the branch for preparation of 1.3.10rc5
|
||||
# staging/maintenance is currently the branch for preparation of 1.3.12rc2
|
||||
# so is regressionfix/...
|
||||
staging/maintenance 1.3.10rc5 e628aedbc11e2ef03ba4172b93e5be2a892b955b pep440-dev
|
||||
regressionfix/.* 1.3.10rc5 e628aedbc11e2ef03ba4172b93e5be2a892b955b pep440-dev
|
||||
staging/maintenance 1.3.12rc2 2a42f02aecaedf2c55579984e0bc94e44402cc15 pep440-dev
|
||||
regressionfix/.* 1.3.12rc2 2a42f02aecaedf2c55579984e0bc94e44402cc15 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
|
||||
@@ -99,6 +99,15 @@ date of first contribution):
|
||||
* [Daniel Joyce](https://github.com/DanielJoyce)
|
||||
* [Andy Qua](https://github.com/AndyQ)
|
||||
* [Fabio Santos](https://github.com/Fabi0San)
|
||||
* [Jack Wilsdon](https://github.com/jackwilsdon)
|
||||
* [Ryan Finnie](https://github.com/rfinnie)
|
||||
* [Timur Duehr](https://github.com/tduehr)
|
||||
* [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
|
||||
|
||||
+157
-10
@@ -1,19 +1,134 @@
|
||||
# OctoPrint Changelog
|
||||
|
||||
## 1.3.11rc1 (2019-03-28)
|
||||
## 1.3.12rc3 (2019-09-23)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* [#3277](https://github.com/foosel/OctoPrint/issues/3277) (regression) - GCODE viewer: Fix huge memory consumption due to misplaced deep clone.
|
||||
* [#3282](https://github.com/foosel/OctoPrint/issues/3282) (regression) - Don't trigger `M112` routine for firmware errors on a connection error when no connection has even been established yet.
|
||||
|
||||
### 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.12rc2...1.3.12rc3)
|
||||
|
||||
## 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
|
||||
|
||||
If you rely on the Cura Plugin for your workflow that so far was bundled with OctoPrint, be sure to install the [Cura Legacy plugin](https://github.com/OctoPrint/OctoPrint-CuraLegacy) that's now also available on the plugin repository.
|
||||
If you rely on the Cura Plugin for your workflow that so far was bundled with OctoPrint, be sure to install the [Cura Legacy plugin](https://github.com/OctoPrint/OctoPrint-CuraLegacy) that's now also [available on the plugin repository](https://plugins.octoprint.org/plugins/curalegacy/).
|
||||
|
||||
Once installed the Cura Legacy plugin will import the settings and profiles from the former bundled Cura plugin automatically on first start.
|
||||
|
||||
### Heads-up: 1.3.11 bundles a new Error Tracking plugin, please enable it on Release Candidates
|
||||
|
||||
The Error Tracking plugin is a completely separate plugin from the existing Anonymous Usage Tracking plugin. It's tracking is disabled by default. Its purpose is to collect error information from instances in order to allow better issue analysis especially during the Release Candidate phase, or when prompted after reporting a bug. Thus it will also ask you to enable it on start while subscribed to an RC release channel.
|
||||
|
||||
The plugin uses a [sentry.io](https://sentry.io) instance, kindly provided to OctoPrint by sentry.io.
|
||||
|
||||
### Improvements
|
||||
|
||||
* [#1938](https://github.com/foosel/OctoPrint/issues/1938) - Allow slicing parallel to printing on machines with more than one core.
|
||||
@@ -69,12 +184,23 @@ The plugin uses a [sentry.io](https://sentry.io) instance, kindly provided to Oc
|
||||
* Use `monotonic_time` for relative times everywhere.
|
||||
* Support for heated chamber firmware capabilities.
|
||||
* Remove `UI_API_KEY` and API disabling. With the inclusion of the ForceLogin plugin that doesn't serve a real purpose anymore in most cases, and it was only ever more of a rate limiting feature than an actual security measure anyhow. Plus it lead to a ton of false security alarms.
|
||||
* More resilience against broken configurations.
|
||||
* More resilience against platform startup issues during environment detection.
|
||||
* Don't confuse users with current `pip`'s "Python 2.7 is EOL" messages
|
||||
* Define empty `UI_API_KEY` for backwards compatibility with third party plugins
|
||||
* Add config flag `server.ignoredIncompleteStartup` to override incomplete startup detection
|
||||
* Hardening against errors triggered during print time estimation
|
||||
* Introduce setting to disable exclusive claim on serial port. There might be issues with this out there in the field, so having the option to disable it is a good thing.
|
||||
* Docs: Improve docs of connection API to avoid issues as encountered in [#3043](https://github.com/foosel/OctoPrint/issues/3043).
|
||||
* Action Command Prompt plugin: Set `M876` as default command as discussed in [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982).
|
||||
* Action Command Prompt plugin: Add `M876` to `EMERGENCY_PARSER` compliant commands, if configured accordingly. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982).
|
||||
* Action Command Prompt plugin: Signal support for action command prompts to firmware via `M876 P1`, if configured accordingly. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982).
|
||||
* Action Command Prompt plugin: Properly handle `PROMPT_SUPPORT` capability report from firmware and configure action command prompt support accordingly. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982).
|
||||
* Error Tracking plugin: New plugin utilizing [sentry.io](https://sentry.io) to track any kind of errors thrown in either backend or the default UI. Will ship disabled by default, has to be enabled by the user. Release Candidates will prompt users to enable it in order to improve on error detection during RC phase.
|
||||
* Error Tracking: Severely restrict what gets tracked:
|
||||
* we are only interested in handled core exceptions or unhandled exceptions
|
||||
* we are not interested at all in `SerialException`
|
||||
* Error Tracking: Further restriction of what gets tracked
|
||||
* Forcelogin plugin: Set sorting key to 0 to increase likelihood of coming before alternative UIs.
|
||||
* Forcelogin plugin: Add favicon meta tags.
|
||||
* Plugin Manager plugin, Softwareupdate plugin: Use scrollables instead of pagination.
|
||||
@@ -104,10 +230,26 @@ The plugin uses a [sentry.io](https://sentry.io) instance, kindly provided to Oc
|
||||
* [#3053](https://github.com/foosel/OctoPrint/pull/3053) - GCODE Viewer: Fix an issue with multi extruder files where only a higher extruder index is actually used and all prior ones are undefined.
|
||||
* [#3080](https://github.com/foosel/OctoPrint/issues/3080) - Virtual Printer plugin: Fix tracking of negative movements and homing.
|
||||
* [#3071](https://github.com/foosel/OctoPrint/issues/3071) - Application Keys plugin: Fix appkeys not working when access control is disabled.
|
||||
* [#3088](https://github.com/foosel/OctoPrint/issues/3088) (regression) - Fix 500 error on index rendering in case of plugins that use unicode in plugin vars.
|
||||
* [#3089](https://github.com/foosel/OctoPrint/issues/3089) (regression) - Fix missing `_chamberTemp` definition
|
||||
* [#3090](https://github.com/foosel/OctoPrint/issues/3090) (regression) - Fix missing method causing an exception on `/api/printer/tool` endpoint
|
||||
* [#3091](https://github.com/foosel/OctoPrint/issues/3091) (regression) - Printer Safety Check: Fix unicode errors in certain communication scenarios.
|
||||
* [#3092](https://github.com/foosel/OctoPrint/issues/3092) - Fix invalid tool parameter detection on `/api/printer/tool` endpoint.
|
||||
* [#3098](https://github.com/foosel/OctoPrint/issues/3098) - Backup: Exclude temporary timelapse files as well if timelapses are excluded from backup.
|
||||
* [#3105](https://github.com/foosel/OctoPrint/issues/3105) (regression) - Virtual printer: Fix an encoding issue
|
||||
* [#3108](https://github.com/foosel/OctoPrint/issues/3108) (regression) - Fix bug in port detection
|
||||
* [#3111](https://github.com/foosel/OctoPrint/issues/3111) (regression) - Refresh port list after disconnect to detect vanishing ports
|
||||
* [#3115](https://github.com/foosel/OctoPrint/issues/3115) (regression) - Fix extra newlines in `serial.log` and empty lines on terminal
|
||||
* [#3116](https://github.com/foosel/OctoPrint/issues/3116) - Fix potential division by zero
|
||||
* Fix a typo in an error message during startup.
|
||||
* `paused` action command must not trigger *any* local processing. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982).
|
||||
* Only use page size from local storage in `ItemListHelper` if configured.
|
||||
* Fix caching headers on main view.
|
||||
* Fix missing default value for `self._errorValue` in comm layer.
|
||||
* Don't read return code on async system commands, it won't work.
|
||||
* Fix wrong textual representation of `STARTING` state
|
||||
* Fix some potential encoding errors in the comm layer
|
||||
* Fix for the file list in the UI not getting refreshed after an SD list refresh from the printer.
|
||||
* Docs: Fix documentation for firmware info & capability plugin hooks.
|
||||
* Docs: Fix a formatting issue in the event docs, making it seem like events were deprecated when it was only payload entries that are deprecated.
|
||||
* Forcelogin plugin: Never handle the UI if ACL is disabled.
|
||||
@@ -116,11 +258,16 @@ The plugin uses a [sentry.io](https://sentry.io) instance, kindly provided to Oc
|
||||
|
||||
### Special thanks to all the contributors!
|
||||
|
||||
Special thanks to everyone who contributed to this release candidate, especially [@agrif](https://github.com/agrif), [@akraus53](https://github.com/akraus53), [@AndyQ](https://github.com/AndyQ), [@CapnBry](https://github.com/CapnBry), [@DanielJoyce](https://github.com/DanielJoyce), [@devildant](https://github.com/devildant), [@Fabi0San](https://github.com/Fabi0San), [@fake-name](https://github.com/fake-name), [@fieldOfView](https://github.com/fieldOfView), [@gloomyandy](https://github.com/gloomyandy), [@HarlemSquirrel](https://github.com/HarlemSquirrel), [@hgross](https://github.com/hgross), [@jubaleth](https://github.com/foosel/OctoPrint/commits?author=jubaleth), [@melgish](https://github.com/melgish), [@rgriebl](https://github.com/rgriebl) and [@tedder](https://github.com/tedder) for their PRs.
|
||||
Special thanks to everyone who contributed to this release, especially [@agrif](https://github.com/agrif), [@akraus53](https://github.com/akraus53), [@AndyQ](https://github.com/AndyQ), [@CapnBry](https://github.com/CapnBry), [@DanielJoyce](https://github.com/DanielJoyce), [@devildant](https://github.com/devildant), [@Fabi0San](https://github.com/Fabi0San), [@fake-name](https://github.com/fake-name), [@fieldOfView](https://github.com/fieldOfView), [@gloomyandy](https://github.com/gloomyandy), [@HarlemSquirrel](https://github.com/HarlemSquirrel), [@hgross](https://github.com/hgross), [@jubaleth](https://github.com/foosel/OctoPrint/commits?author=jubaleth), [@melgish](https://github.com/melgish), [@rgriebl](https://github.com/rgriebl) and [@tedder](https://github.com/tedder) for their PRs.
|
||||
|
||||
### More information
|
||||
|
||||
* [Commits](https://github.com/foosel/OctoPrint/compare/1.3.10...1.3.11rc1)
|
||||
* [Commits](https://github.com/foosel/OctoPrint/compare/1.3.10...1.3.11)
|
||||
* Release Candidates:
|
||||
* [1.3.11rc1](https://github.com/foosel/OctoPrint/releases/tag/1.3.11rc1)
|
||||
* [1.3.11rc2](https://github.com/foosel/OctoPrint/releases/tag/1.3.11rc2)
|
||||
* [1.3.11rc3](https://github.com/foosel/OctoPrint/releases/tag/1.3.11rc3)
|
||||
* A big **Thank you!** to everyone who reported back on these release candidates this time: [@arhi](https://github.com/arhi), [@b-morgan](https://github.com/b-morgan), [@CRCinAU](https://github.com/CRCinAU), [@devildant](https://github.com/devildant), [@evanquinnalaska](https://github.com/evanquinnalaska), [@FormerLurker](https://github.com/FormerLurker), [@gege2b](https://github.com/gege2b), [@isbric](https://github.com/isbric), [@JohnOCFII](https://github.com/JohnOCFII), [@kazibole](https://github.com/kazibole), [@nionio6915](https://github.com/nionio6915), [@reloxx13](https://github.com/reloxx13), [@schnello](https://github.com/schnello), [@trunzoc](https://github.com/trunzoc), [@vfrdirk](https://github.com/vfrdirk) & [@zeroflow](https://github.com/zeroflow)
|
||||
|
||||
## 1.3.10 (2018-12-10)
|
||||
|
||||
|
||||
@@ -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, pip and virtualenv set up on your system:
|
||||
|
||||
1. Checkout OctoPrint: `git clone https://github.com/foosel/OctoPrint.git`
|
||||
2. Change into the OctoPrint folder: `cd OctoPrint`
|
||||
3. Create a user-owned virtual environment therein: `virtualenv venv`
|
||||
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
|
||||
|
||||
@@ -142,5 +143,8 @@ be edited from OctoPrint's settings dialog.
|
||||
|
||||
## Special Thanks
|
||||
|
||||
Cross-browser testing services are kindly provided by [BrowserStack](http://www.browserstack.com/).
|
||||
Profiling is done with the help of [PyVmMonitor](http://www.pyvmmonitor.com).
|
||||
Cross-browser testing services are kindly provided by [BrowserStack](https://www.browserstack.com/).
|
||||
|
||||
Profiling is done with the help of [PyVmMonitor](https://www.pyvmmonitor.com).
|
||||
|
||||
Error tracking is powered and sponsored by [Sentry](https://sentry.io).
|
||||
+6
-5
@@ -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
|
||||
@@ -21,14 +21,12 @@ thanks to everyone who contributed!
|
||||
* E3D BigBox
|
||||
* Eric Betts
|
||||
* Ernesto Martinez
|
||||
* Frank Sander
|
||||
* Franziska Kunsmann
|
||||
* George Robles
|
||||
* Jared Go
|
||||
* jean-claude migneault
|
||||
* Jeff Renfer
|
||||
* Jefferson Hunt
|
||||
* Jeremiah Avery
|
||||
* Joseph Payne
|
||||
* Joshua Wills
|
||||
* Justin Kaufman
|
||||
* Kaile Riser
|
||||
@@ -42,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
|
||||
@@ -54,5 +54,6 @@ thanks to everyone who contributed!
|
||||
* TEVO 3D Printers
|
||||
* Trent Shumay
|
||||
* Ulrich Kempken
|
||||
* Vladislav Kuzemchik
|
||||
|
||||
and 1513 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)!
|
||||
@@ -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:
|
||||
|
||||
|
||||
+21
-10
@@ -11,9 +11,9 @@ General information
|
||||
Authorization
|
||||
=============
|
||||
|
||||
OctoPrint's API expects an API key to be supplied with each request. This API key can be either the globally
|
||||
configured one, a user specific one if "Access Control" is enabled or an app and user specific one as generated
|
||||
by the authorization workflow implemented by the bundled :ref:`Application Keys Plugin <sec-bundledplugins-appkeys>` (since 1.3.10).
|
||||
If :ref:`Access Control <sec-features-access_control>` is enabled OctoPrint's API expects an API key to be supplied with each request. This API
|
||||
key can be either the globally configured one, a user specific one or an app and user specific one as generated by the
|
||||
authorization workflow implemented by the bundled :ref:`Application Keys Plugin <sec-bundledplugins-appkeys>` (since 1.3.10).
|
||||
|
||||
Clients are advised to implement the :ref:`Application Keys Plugin workflow <sec-bundledplugins-appkeys-workflow>` first and
|
||||
fallback on directing the user to manually supply the the user specific API key. The global key should rarely be used.
|
||||
@@ -26,8 +26,6 @@ The API key must be supplied in the custom HTTP header ``X-Api-Key``, e.g.
|
||||
Host: example.com
|
||||
X-Api-Key: abcdef...
|
||||
|
||||
If it is missing or included but invalid, OctoPrint will directly return a response with status :http:statuscode:`403`.
|
||||
|
||||
For testing purposes it is also possible to supply the API key via a query parameter ``apikey``, e.g.
|
||||
|
||||
.. sourcecode:: http
|
||||
@@ -37,6 +35,24 @@ For testing purposes it is also possible to supply the API key via a query param
|
||||
|
||||
Please be advised that clients should use the header field variant if at all possible.
|
||||
|
||||
If the key is missing or invalid, OctoPrint will treat the request as it would any unauthenticated anonymous request to the endpoint.
|
||||
Consequently, if the bundled :ref:`ForceLogin plugin <sec-bundledplugins-forcelogin>` is active (which is the default), that means
|
||||
that any requests without or with an invalid API key targeting other API endpoints than :ref:`Login <sec-api-general-login>`
|
||||
will be denied with a :http:statuscode:`403`.
|
||||
|
||||
.. warning::
|
||||
|
||||
If :ref:`Access Control <sec-features-access_control>` is disabled, OctoPrint will treat any unauthenticated anonymous requests and thus also requests
|
||||
with an invalid or outright missing API key as requests with full admin rights!
|
||||
|
||||
.. note::
|
||||
|
||||
The API key requirements changed in 1.3.11. Up to that version, even if Access Control was disabled, all requests needed to
|
||||
be supplied with an API Key. To make the webinterface work under these circumstances, an unauthenticated anonymous API key was injected into the
|
||||
HTML page and also available on the :ref:`Push API <sec-api-push>`. The presence and ready availability of this unauthenticated
|
||||
anonymous "UI API key" caused confusion and false alarm among users and didn't contribute to the security of the platform in a
|
||||
meaningful way, so it was finally abandoned in 1.3.11.
|
||||
|
||||
.. _fig-api-general-globalapikey:
|
||||
.. figure:: ../images/settings-global-api-key.png
|
||||
:align: center
|
||||
@@ -58,11 +74,6 @@ Please be advised that clients should use the header field variant if at all pos
|
||||
|
||||
The API key options in the "Change password" dialog. Users can generate and revoke their custom API key here.
|
||||
|
||||
.. note::
|
||||
OctoPrint's web interface uses a custom API key that is freshly generated on every server start. This key is not
|
||||
intended to be used by any other client and would not be very useful in any case, since it basically represents
|
||||
a completely anonymous client.
|
||||
|
||||
.. _sec-api-general-contenttype:
|
||||
|
||||
Content Type
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -62,6 +62,18 @@ Use the following settings to enable access control:
|
||||
# header and login the user without further checks. Use with caution.
|
||||
checkBasicAuthenticationPassword: true
|
||||
|
||||
# Whether to trust remote user headers. If you have setup authentication in front of
|
||||
# OctoPrint and the user names you use there match OctoPrint accounts, by setting this to true users will
|
||||
# be logged into OctoPrint as the user provided in the header. Your should ONLY ENABLE THIS if your
|
||||
# OctoPrint instance is only accessible through a connection locked down through an authenticating reverse proxy!
|
||||
trustRemoteUser: false
|
||||
|
||||
# Header used by the reverse proxy to convey the authenticated user.
|
||||
remoteUserHeader: REMOTE_USER
|
||||
|
||||
# If a remote user is not found, add them. Use this only if all users from the remote system can use OctoPrint.
|
||||
addRemoteUsers: false
|
||||
|
||||
.. _sec-configuration-config_yaml-api:
|
||||
|
||||
API
|
||||
@@ -413,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
|
||||
@@ -952,6 +963,13 @@ Use the following settings to configure the server:
|
||||
# reset the setting to false
|
||||
startOnceInSafeMode: false
|
||||
|
||||
# Signals to OctoPrint that the last startup was incomplete. OctoPrint will then startup
|
||||
# in safe mode
|
||||
incompleteStartup: false
|
||||
|
||||
# Set this to true to make OctoPrint ignore incomplete startups. Helpful for development.
|
||||
ignoreIncompleteStartup: false
|
||||
|
||||
# Secret key for encrypting cookies and such, randomly generated on first run
|
||||
secretKey: someSecretKey
|
||||
|
||||
|
||||
+25
-1
@@ -38,6 +38,13 @@ Example
|
||||
- event: PrintDone
|
||||
command: python ~/growl.py -t mygrowlserver -d "Completed {file}" -a OctoPrint -i http://raspi/Octoprint_logo.png
|
||||
type: system
|
||||
- event:
|
||||
- PrintStarted
|
||||
- PrintFailed
|
||||
- PrintDone
|
||||
- PrintCancelled
|
||||
command: python ~/growl.py -t mygrowlserver -d "Event {__eventname} ({name})" -a OctoPrint -i http://raspi/Octoprint_logo.png
|
||||
type: system
|
||||
- event: Connected
|
||||
command:
|
||||
- M115
|
||||
@@ -53,6 +60,7 @@ Placeholders
|
||||
You can use the following generic placeholders in your event hooks:
|
||||
|
||||
* ``{__currentZ}``: the current Z position of the head if known, -1 if not available
|
||||
* ``{__eventname}`` : the name of the event hook being triggered
|
||||
* ``{__filename}`` : name of currently selected file, or ``NO FILE`` if no file is selected
|
||||
* ``{__filepath}`` : path in origin location of currently selected file, or ``NO FILE`` if no file is selected
|
||||
* ``{__fileorigin}`` : origin of currently selected file, or ``NO FILE`` if no file is selected
|
||||
@@ -580,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
|
||||
@@ -591,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
|
||||
@@ -603,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
|
||||
@@ -613,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
|
||||
@@ -628,7 +640,7 @@ SlicingProfileAdded
|
||||
* ``profile``: the profile that was added
|
||||
|
||||
SlicingProfileModified
|
||||
A new slicing profile was modified.
|
||||
A slicing profile was modified.
|
||||
|
||||
Payload:
|
||||
|
||||
@@ -653,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
|
||||
@@ -21,12 +21,12 @@ Commands, which are admin-only.
|
||||
|
||||
If Access Control is disabled, everything is directly accessible. **That also
|
||||
includes all administrative functionality as well as full control over the
|
||||
printer!**
|
||||
printer**, and without the need for an :ref:`API key <sec-api-general-authorization>`!
|
||||
|
||||
Upon first start a configuration wizard is provided which allows configuration
|
||||
of the first administrator account or alternatively disabling Access Control
|
||||
(which is **NOT** recommended for systems that are directly accessible via the
|
||||
Internet!).
|
||||
internet or other untrusted networks!).
|
||||
|
||||
.. hint::
|
||||
|
||||
|
||||
+17
-10
@@ -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 |
@@ -766,9 +766,10 @@ octoprint.comm.protocol.scripts
|
||||
make sure to only proceed with returning additional scripts if the ``script_type`` and ``script_name`` match
|
||||
handled scripts. If not, None should be returned directly.
|
||||
|
||||
If the hook handler has something to add to the specified script, it may return a 2-tuple or a 3-tuple with the first entry
|
||||
If the hook handler has something to add to the specified script, it may return a 2-tuple, a 3-tuple or a 4-tuple with the first entry
|
||||
defining the prefix (what to *prepend* to the script in question), the second entry defining the postfix (what to
|
||||
*append* to the script in question), and finally if desired a dictionary of variables to be made available to the script. Both prefix and postfix can be None to signify that nothing should be prepended
|
||||
*append* to the script in question), and finally if desired a dictionary of variables to be made available to the script on third and additional tags to set on the
|
||||
commands on fourth position. Both prefix and postfix can be None to signify that nothing should be prepended
|
||||
respectively appended.
|
||||
|
||||
The returned prefix and postfix entries may be either iterables of script lines or a string including newlines of the script lines (which
|
||||
|
||||
@@ -61,7 +61,8 @@ INSTALL_REQUIRES = [
|
||||
"monotonic>=1.5,<1.6",
|
||||
"frozendict>=1.2,<1.3",
|
||||
"sentry-sdk==0.7.7",
|
||||
"typing>=3.6.6,<4"
|
||||
"typing>=3.6.6,<4",
|
||||
"filetype>=1.0.5,<2"
|
||||
]
|
||||
|
||||
if sys.platform == "darwin":
|
||||
@@ -81,6 +82,7 @@ EXTRA_REQUIRES = dict(
|
||||
"sphinxcontrib-httpdomain",
|
||||
"sphinxcontrib-mermaid>=0.3",
|
||||
"sphinx_rtd_theme",
|
||||
"readthedocs-sphinx-ext==0.5.7"
|
||||
],
|
||||
|
||||
# Dependencies for developing OctoPrint plugins
|
||||
|
||||
@@ -104,7 +104,10 @@ def init_platform(basedir, configfile, use_logging_file=True, logging_file=None,
|
||||
after_logging(**kwargs)
|
||||
|
||||
settings_start_once_in_safemode = "settings" if settings.getBoolean(["server", "startOnceInSafeMode"]) else None
|
||||
settings_incomplete_startup_safemode = "incomplete_startup" if settings.getBoolean(["server", "incompleteStartup"]) else None
|
||||
settings_incomplete_startup_safemode = "incomplete_startup" \
|
||||
if settings.getBoolean(["server", "incompleteStartup"]) \
|
||||
and not settings.getBoolean(["server", "ignoreIncompleteStartup"]) \
|
||||
else None
|
||||
safe_mode = safe_mode or settings_start_once_in_safemode or settings_incomplete_startup_safemode
|
||||
kwargs["safe_mode"] = safe_mode
|
||||
if callable(after_safe_mode):
|
||||
|
||||
@@ -137,9 +137,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)
|
||||
|
||||
@@ -92,7 +92,8 @@ class OctoPrintPluginCommands(click.MultiCommand):
|
||||
continue
|
||||
result[name + self.sep + command.name] = command
|
||||
except:
|
||||
self._logger.exception("Error while retrieving cli commands for plugin {}".format(name))
|
||||
self._logger.exception("Error while retrieving cli commands for plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
# 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.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))
|
||||
|
||||
name = settings.get(["accessControl", "userManager"])
|
||||
try:
|
||||
clazz = get_class(name)
|
||||
manager = clazz(settings=settings)
|
||||
except Exception:
|
||||
click.echo("Could not instantiate user manager {}, falling back to FilebasedUserManager!".format(name), err=True)
|
||||
manager = FilebasedUserManager(settings=settings)
|
||||
finally:
|
||||
manager.enabled = settings.getBoolean(["accessControl", "enabled"])
|
||||
|
||||
ctx.obj.user_manager = 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.getAllUsers()
|
||||
_print_list(users)
|
||||
|
||||
|
||||
@user.command(name="add")
|
||||
@click.argument("username", type=click.STRING, required=True)
|
||||
@click.password_option("--password", "password", help="Password for user")
|
||||
@click.option("--admin", "is_admin", type=click.BOOL, is_flag=True, default=False,
|
||||
help="Sets admin role on user")
|
||||
@click.pass_context
|
||||
def add_user_command(ctx, username, password, is_admin):
|
||||
"""Add a new user."""
|
||||
try:
|
||||
ctx.obj.user_manager.addUser(username,
|
||||
password,
|
||||
roles=(("user", "admin") if is_admin else ("user",)),
|
||||
active=True)
|
||||
|
||||
user = ctx.obj.user_manager.findUser(username)
|
||||
if user:
|
||||
click.echo("User created:")
|
||||
click.echo("\t{}".format(_user_to_line(user.asDict())))
|
||||
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.removeUser(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.changeUserPassword(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.changeUserActivation(username, True)
|
||||
click.echo("User {} activated.".format(username))
|
||||
|
||||
user = ctx.obj.user_manager.findUser(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.changeUserActivation(username, False)
|
||||
click.echo("User {} activated.".format(username))
|
||||
|
||||
user = ctx.obj.user_manager.findUser(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(users, key=lambda x: x.get("name")):
|
||||
click.echo("\t{}".format(_user_to_line(user)))
|
||||
|
||||
|
||||
def _user_to_line(user):
|
||||
return "{} (active: {}, admin: {})".format(user.get("name"),
|
||||
"yes" if user.get("active", False) else "no",
|
||||
"yes" if user.get("admin", False) else "no")
|
||||
@@ -25,10 +25,15 @@ class EnvironmentDetector(object):
|
||||
self._cache = None
|
||||
self._cache_lock = threading.RLock()
|
||||
|
||||
self._environment_plugins = self._plugin_manager.get_implementations(EnvironmentDetectionPlugin)
|
||||
|
||||
self._logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
self._environment_plugins = self._plugin_manager.get_implementations(EnvironmentDetectionPlugin)
|
||||
except Exception:
|
||||
# just in case, see #3100...
|
||||
self._logger.exception("There was an error fetching EnvironmentDetectionPlugins from the plugin manager")
|
||||
self._environment_plugins = []
|
||||
|
||||
@property
|
||||
def environment(self):
|
||||
with self._cache_lock:
|
||||
@@ -120,7 +125,8 @@ class EnvironmentDetector(object):
|
||||
result[implementation._identifier] = additional
|
||||
except:
|
||||
self._logger.exception("Error while fetching additional "
|
||||
"environment data from plugin {}".format(implementation._identifier))
|
||||
"environment data from plugin {}".format(implementation._identifier),
|
||||
extra=dict(plugin=implementation._identifier))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
+19
-11
@@ -186,8 +186,7 @@ class EventManager(object):
|
||||
|
||||
octoprint.plugin.call_plugin(octoprint.plugin.types.EventHandlerPlugin,
|
||||
"on_event",
|
||||
args=(event, payload),
|
||||
initialized=True)
|
||||
args=(event, payload))
|
||||
self._logger.info("Event loop shut down")
|
||||
except:
|
||||
self._logger.exception("Ooops, the event bus worker loop crashed")
|
||||
@@ -344,17 +343,24 @@ class CommandTrigger(GenericEventListener):
|
||||
self._logger.info("Disabled command trigger: {!r}".format(subscription))
|
||||
continue
|
||||
|
||||
event = subscription["event"]
|
||||
events = subscription["event"]
|
||||
command = subscription["command"]
|
||||
commandType = subscription["type"]
|
||||
debug = subscription["debug"] if "debug" in subscription else False
|
||||
|
||||
if not event in self._subscriptions.keys():
|
||||
self._subscriptions[event] = []
|
||||
self._subscriptions[event].append((command, commandType, debug))
|
||||
# "event" in the configuration can be a string, or
|
||||
# a list of strings. If it's the former, convert it
|
||||
# into the latter.
|
||||
if not isinstance(events, (tuple, list, set)):
|
||||
events = [events]
|
||||
|
||||
if not event in eventsToSubscribe:
|
||||
eventsToSubscribe.append(event)
|
||||
for event in events:
|
||||
if not event in self._subscriptions.keys():
|
||||
self._subscriptions[event] = []
|
||||
self._subscriptions[event].append((command, commandType, debug))
|
||||
|
||||
if not event in eventsToSubscribe:
|
||||
eventsToSubscribe.append(event)
|
||||
|
||||
self.subscribe(eventsToSubscribe)
|
||||
|
||||
@@ -374,9 +380,9 @@ class CommandTrigger(GenericEventListener):
|
||||
if isinstance(command, (tuple, list, set)):
|
||||
processedCommand = []
|
||||
for c in command:
|
||||
processedCommand.append(self._processCommand(c, payload))
|
||||
processedCommand.append(self._processCommand(c, event, payload))
|
||||
else:
|
||||
processedCommand = self._processCommand(command, payload)
|
||||
processedCommand = self._processCommand(command, event, payload)
|
||||
self.executeCommand(processedCommand, commandType, debug=debug)
|
||||
except KeyError as e:
|
||||
self._logger.warn("There was an error processing one or more placeholders in the following command: %s" % command)
|
||||
@@ -425,13 +431,14 @@ class CommandTrigger(GenericEventListener):
|
||||
self._logger.info("Executing GCode commands: %r" % command)
|
||||
self._printer.commands(commands)
|
||||
|
||||
def _processCommand(self, command, payload):
|
||||
def _processCommand(self, command, event, payload):
|
||||
"""
|
||||
Performs string substitutions in the command string based on a few current parameters.
|
||||
|
||||
The following substitutions are currently supported:
|
||||
|
||||
- {__currentZ} : current Z position of the print head, or -1 if not available
|
||||
- {__eventname} : the name of the event hook being triggered
|
||||
- {__filename} : name of currently selected file, or "NO FILE" if no file is selected
|
||||
- {__filepath} : path in origin location of currently selected file, or "NO FILE" if no file is selected
|
||||
- {__fileorigin} : origin of currently selected file, or "NO FILE" if no file is selected
|
||||
@@ -453,6 +460,7 @@ class CommandTrigger(GenericEventListener):
|
||||
|
||||
params = {
|
||||
"__currentZ": "-1",
|
||||
"__eventname": event,
|
||||
"__filename": "NO FILE",
|
||||
"__filepath": "NO PATH",
|
||||
"__progress": "0",
|
||||
|
||||
@@ -17,6 +17,7 @@ from .destinations import FileDestinations
|
||||
from .analysis import QueueEntry, AnalysisQueue
|
||||
from .storage import LocalFileStorage
|
||||
from .util import AbstractFileWrapper, StreamWrapper, DiskFileWrapper
|
||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@@ -78,7 +79,9 @@ def full_extension_tree():
|
||||
continue
|
||||
result = octoprint.util.dict_merge(result, plugin_result, leaf_merger=leaf_merger)
|
||||
except:
|
||||
logging.getLogger(__name__).exception("Exception while retrieving additional extension tree entries from SlicerPlugin {name}".format(name=plugin.key))
|
||||
logging.getLogger(__name__).exception("Exception while retrieving additional extension "
|
||||
"tree entries from SlicerPlugin {name}".format(name=plugin._identifier),
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
|
||||
extension_tree_hooks = octoprint.plugin.plugin_manager().get_hooks("octoprint.filemanager.extension_tree")
|
||||
for name, hook in extension_tree_hooks.items():
|
||||
@@ -88,7 +91,9 @@ def full_extension_tree():
|
||||
continue
|
||||
result = octoprint.util.dict_merge(result, hook_result, leaf_merger=leaf_merger)
|
||||
except:
|
||||
logging.getLogger(__name__).exception("Exception while retrieving additional extension tree entries from hook {name}".format(name=name))
|
||||
logging.getLogger(__name__).exception("Exception while retrieving additional extension "
|
||||
"tree entries from hook {name}".format(name=name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
return result
|
||||
|
||||
@@ -325,25 +330,27 @@ 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["hash"]
|
||||
hash = source_meta.get("hash", "n/a")
|
||||
|
||||
import io
|
||||
links = [("model", dict(name=source_path))]
|
||||
_, stl_name = self.split_path(source_location, source_path)
|
||||
file_obj = StreamWrapper(os.path.basename(dest_path),
|
||||
io.BytesIO(u";Generated from {stl_name} {hash}\n".format(**locals()).encode("ascii", "replace")),
|
||||
io.BytesIO(u";Generated from {stl_name} (hash: {hash})\n".format(**locals()).encode("ascii", "replace")),
|
||||
io.FileIO(tmp_path, "rb"))
|
||||
|
||||
printer_profile = self._printer_profile_manager.get(printer_profile_id)
|
||||
@@ -352,11 +359,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:
|
||||
@@ -377,7 +385,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,
|
||||
@@ -421,7 +430,8 @@ class FileManager(object):
|
||||
self._last_slicing_progress = progress_int
|
||||
for callback in self._slicing_progress_callbacks:
|
||||
try: callback.sendSlicingProgress(slicer, source_location, source_path, dest_location, dest_path, progress_int)
|
||||
except: self._logger.exception("Exception while pushing slicing progress")
|
||||
except: 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):
|
||||
@@ -429,7 +439,8 @@ class FileManager(object):
|
||||
try:
|
||||
plugin.on_slicing_progress(slicer, source_location, source_path, dest_location, dest_path, progress)
|
||||
except:
|
||||
self._logger.exception("Exception while sending slicing progress to plugin %s" % plugin._identifier)
|
||||
self._logger.exception("Exception while sending slicing progress to plugin %s" % plugin._identifier,
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
|
||||
import threading
|
||||
thread = threading.Thread(target=call_plugins, args=(slicer, source_location, source_path, dest_location, dest_path, progress_int))
|
||||
@@ -464,11 +475,11 @@ class FileManager(object):
|
||||
if printer_profile is None:
|
||||
printer_profile = self._printer_profile_manager.get_current_or_default()
|
||||
|
||||
for hook in self._preprocessor_hooks.values():
|
||||
for name, hook in self._preprocessor_hooks.items():
|
||||
try:
|
||||
hook_file_object = hook(path, file_object, links=links, printer_profile=printer_profile, allow_overwrite=allow_overwrite)
|
||||
except:
|
||||
self._logger.exception("Error when calling preprocessor hook {}, ignoring".format(hook))
|
||||
self._logger.exception("Error when calling preprocessor hook for plugin {}, ignoring".format(name), extra=dict(plugin=name))
|
||||
continue
|
||||
|
||||
if hook_file_object is not None:
|
||||
@@ -649,6 +660,8 @@ class FileManager(object):
|
||||
try:
|
||||
with open(self._recovery_file) 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:
|
||||
self._logger.exception("Could not read recovery data from file {}".format(self._recovery_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,
|
||||
|
||||
@@ -1547,13 +1547,21 @@ class LocalFileStorage(StorageInterface):
|
||||
except:
|
||||
self._logger.exception("Error while reading .metadata.json from {path}".format(**locals()))
|
||||
|
||||
def valid_json(value):
|
||||
try:
|
||||
json.dumps(value, allow_nan=False)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
if isinstance(metadata, dict):
|
||||
old_size = len(metadata)
|
||||
metadata = { k: v for k, v in metadata.items() if valid_json(v) }
|
||||
metadata = { k: v for k, v in metadata.items() if os.path.exists(os.path.join(path, k)) }
|
||||
new_size = len(metadata)
|
||||
if new_size != old_size:
|
||||
self._logger.info("Deleted {} stale entries from metadata for path {}".format(old_size - new_size,
|
||||
path))
|
||||
self._logger.info("Deleted {} stale or invalid entries from metadata for path {}".format(old_size - new_size,
|
||||
path))
|
||||
self._save_metadata(path, metadata)
|
||||
else:
|
||||
with self._get_metadata_lock(path):
|
||||
|
||||
@@ -3,6 +3,8 @@ from __future__ import absolute_import
|
||||
|
||||
from octoprint.logging import handlers
|
||||
|
||||
from typing import Union
|
||||
|
||||
def log_to_handler(logger, handler, level, msg, exc_info=None, extra=None, *args):
|
||||
"""
|
||||
Logs to the provided handler only.
|
||||
@@ -137,14 +139,17 @@ def get_divider_line(c, message=None, length=78, indent=3):
|
||||
return c * indent + " " + message
|
||||
|
||||
|
||||
def prefix_multilines(text, prefix=": "):
|
||||
def prefix_multilines(text, prefix=u": "):
|
||||
# type: (Union[unicode, bytes], unicode) -> unicode
|
||||
from octoprint.util import to_unicode
|
||||
|
||||
lines = text.splitlines()
|
||||
if not lines:
|
||||
return ""
|
||||
return u""
|
||||
|
||||
if len(lines) == 1:
|
||||
return lines[0]
|
||||
return to_unicode(lines[0])
|
||||
|
||||
return lines[0] + "\n" + "\n".join(map(lambda line: prefix + line,
|
||||
lines[1:]))
|
||||
return to_unicode(lines[0]) + u"\n" + u"\n".join(map(lambda line: prefix + to_unicode(line),
|
||||
lines[1:]))
|
||||
|
||||
@@ -196,8 +196,7 @@ def call_plugin(types, method, args=None, kwargs=None, callback=None, error_call
|
||||
error_callback (function): A callback to invoke after the call of an implementation resulted in an exception.
|
||||
Will be called with the three arguments ``name``, ``plugin`` and ``exc``. ``name`` will be the plugin
|
||||
identifier, ``plugin`` the plugin implementation instance itself and ``exc`` the caught exception.
|
||||
initialized (boolean): Whether the plugin needs to be initialized (True) or not (False). Initialization status
|
||||
is determined be presence of injected ``_identifier`` property.
|
||||
initialized (boolean): Ignored.
|
||||
"""
|
||||
|
||||
if not isinstance(types, (list, tuple)):
|
||||
@@ -211,7 +210,7 @@ def call_plugin(types, method, args=None, kwargs=None, callback=None, error_call
|
||||
|
||||
plugins = plugin_manager().get_implementations(*types, sorting_context=sorting_context)
|
||||
for plugin in plugins:
|
||||
if initialized and not hasattr(plugin, "_identifier"):
|
||||
if not hasattr(plugin, "_identifier"):
|
||||
continue
|
||||
|
||||
if hasattr(plugin, method):
|
||||
@@ -221,7 +220,7 @@ def call_plugin(types, method, args=None, kwargs=None, callback=None, error_call
|
||||
if callback:
|
||||
callback(plugin._identifier, plugin, result)
|
||||
except Exception as exc:
|
||||
logger.exception("Error while calling plugin %s" % plugin._identifier)
|
||||
logger.exception("Error while calling plugin %s" % plugin._identifier, extra=dict(plugin=plugin._identifier))
|
||||
if error_callback:
|
||||
error_callback(plugin._identifier, plugin, exc)
|
||||
|
||||
|
||||
@@ -69,6 +69,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
|
||||
|
||||
@@ -213,7 +215,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__ = {
|
||||
|
||||
@@ -4,7 +4,17 @@ $(function() {
|
||||
|
||||
self.loginState = parameters[0];
|
||||
|
||||
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.isUser()) return;
|
||||
@@ -15,26 +25,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) {
|
||||
@@ -42,8 +61,9 @@ $(function() {
|
||||
};
|
||||
|
||||
self._closePrompt = function() {
|
||||
if (self._modal) {
|
||||
self._modal.modal("hide");
|
||||
var modal = self.modal();
|
||||
if (modal) {
|
||||
modal.modal("hide");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,10 +79,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;
|
||||
}
|
||||
@@ -73,6 +97,7 @@ $(function() {
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: ActionCommandPromptViewModel,
|
||||
dependencies: ["loginStateViewModel"]
|
||||
dependencies: ["loginStateViewModel"],
|
||||
elements: ["#navbar_plugin_action_command_prompt"]
|
||||
});
|
||||
});
|
||||
+3
@@ -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>
|
||||
@@ -43,6 +43,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):
|
||||
@@ -54,6 +60,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):
|
||||
@@ -74,6 +85,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,
|
||||
@@ -121,12 +137,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>
|
||||
|
||||
@@ -619,6 +619,11 @@ 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")
|
||||
|
||||
configfile = settings._configfile
|
||||
basedir = settings._basedir
|
||||
|
||||
@@ -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> | <a href="javascript:void(0)" title="{{ _('Download') }}" class="fa fa-download" data-bind="attr: {href: url}"></a><span data-bind="visible: $parent.restoreSupported()"> | <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> | <a href="javascript:void(0)" title="{{ _('Download')|edq }}" class="fa fa-download" data-bind="attr: {href: url}"></a><span data-bind="visible: $parent.restoreSupported()"> | <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://827d1f11ccda4b31b924f29aaacab493@sentry.io/1373987"
|
||||
SENTRY_URL_COREUI = "https://30bdc39d2248444c8bc01484f38c9444@sentry.io/1374096"
|
||||
SENTRY_URL_SERVER = "https://562288d61d724563b6d43e2a6670616e@sentry.io/1373987"
|
||||
SENTRY_URL_COREUI = "https://5c2e838ac5554162bfc30142788362db@sentry.io/1374096"
|
||||
|
||||
SETTINGS_DEFAULTS = dict(enabled=False,
|
||||
enabled_unreleased=False,
|
||||
@@ -21,6 +22,45 @@ SETTINGS_DEFAULTS = dict(enabled=False,
|
||||
url_server=SENTRY_URL_SERVER,
|
||||
url_coreui=SENTRY_URL_COREUI)
|
||||
|
||||
import serial
|
||||
import requests.exceptions
|
||||
import errno
|
||||
import octoprint.util.avr_isp.ispBase
|
||||
import tornado.websocket
|
||||
|
||||
IGNORED_EXCEPTIONS = [
|
||||
# serial exceptions in 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, cb: logger == "octoprint.util.comm"),
|
||||
|
||||
# IOErrors of any kind due to a full file system
|
||||
(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,
|
||||
|
||||
# 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:
|
||||
# noinspection PyUnresolvedReferences
|
||||
from octoprint.plugins.backup import InsufficientSpace
|
||||
|
||||
# if the backup plugin is enabled, ignore InsufficientSpace errors from it as well
|
||||
IGNORED_EXCEPTIONS.append(InsufficientSpace)
|
||||
|
||||
del InsufficientSpace
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class ErrorTrackingPlugin(octoprint.plugin.SettingsPlugin,
|
||||
octoprint.plugin.AssetPlugin,
|
||||
@@ -94,13 +134,68 @@ def _enable_errortracking():
|
||||
|
||||
if _is_enabled(enabled, enabled_unreleased):
|
||||
import sentry_sdk
|
||||
from octoprint.plugin import plugin_manager
|
||||
|
||||
def _before_send(event, hint):
|
||||
if not "exc_info" in hint:
|
||||
# we only want exceptions
|
||||
return None
|
||||
|
||||
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):
|
||||
ignored_exc, matcher = ignore
|
||||
else:
|
||||
ignored_exc = ignore
|
||||
matcher = lambda *args: True
|
||||
|
||||
exc = hint["exc_info"][1]
|
||||
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):
|
||||
if isinstance(hint["exc_info"][1], ignore):
|
||||
# exception ignored
|
||||
return None
|
||||
|
||||
if event.get("exception") and event["exception"].get("values"):
|
||||
handled = not any(map(lambda x: x.get("mechanism") and x["mechanism"].get("handled", True) == False,
|
||||
event["exception"]["values"]))
|
||||
|
||||
if handled:
|
||||
# error is handled, restrict further based on logger
|
||||
if logger != "" and not (logger.startswith("octoprint.") or logger.startswith("tornado.")):
|
||||
# we only want errors logged by loggers octoprint.* or tornado.*
|
||||
return None
|
||||
|
||||
if logger.startswith("octoprint.plugins."):
|
||||
plugin_id = logger.split(".")[2]
|
||||
plugin_info = plugin_manager().get_plugin_info(plugin_id)
|
||||
if plugin_info is None or not plugin_info.bundled:
|
||||
# we only want our active bundled plugins
|
||||
return None
|
||||
|
||||
if plugin is not None:
|
||||
plugin_info = plugin_manager().get_plugin_info(plugin)
|
||||
if plugin_info is None or not plugin_info.bundled:
|
||||
# we only want our active bundled plugins
|
||||
return None
|
||||
|
||||
return event
|
||||
|
||||
sentry_sdk.init(url_server,
|
||||
release=version)
|
||||
release=version,
|
||||
before_send=_before_send)
|
||||
|
||||
with sentry_sdk.configure_scope() as scope:
|
||||
scope.user = dict(id=unique_id)
|
||||
|
||||
logging.getLogger("octoprint.plugin.errortracking").info("Initialized error tracking")
|
||||
logging.getLogger("octoprint.plugins.errortracking").info("Initialized error tracking")
|
||||
_enabled = True
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
/*! @sentry/browser 4.5.1 (6a390acf) | https://github.com/getsentry/sentry-javascript */
|
||||
var Sentry=function(t){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,n)};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,o,i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function s(t,e,n,r){return new(n||(n=Promise))(function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(s,a)}u((r=r.apply(t,e||[])).next())})}function a(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function u(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function l(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(c(arguments[e]));return t}function p(t){switch(Object.prototype.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return t instanceof Error}}function f(t){return"[object ErrorEvent]"===Object.prototype.toString.call(t)}function h(t){return"[object DOMError]"===Object.prototype.toString.call(t)}function d(t){return void 0===t}function v(t){return"function"==typeof t}function g(t){return"[object String]"===Object.prototype.toString.call(t)}function y(t){return"[object Object]"===Object.prototype.toString.call(t)}function m(t){return t!=t}function b(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}}function E(){var t=b(),e=t.crypto||t.msCrypto;if(void 0!==e&&e.getRandomValues){var n=new Uint16Array(8);e.getRandomValues(n),n[3]=4095&n[3]|16384,n[4]=16383&n[4]|32768;var r=function(t){for(var e=t.toString(16);e.length<4;)e="0"+e;return e};return r(n[0])+r(n[1])+r(n[2])+r(n[3])+r(n[4])+r(n[5])+r(n[6])+r(n[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}function x(t){var e,n,r,o,i,s=[];if(!t||!t.tagName)return"";if(s.push(t.tagName.toLowerCase()),t.id&&s.push("#"+t.id),(e=t.className)&&g(e))for(n=e.split(/\s+/),i=0;i<n.length;i++)s.push("."+n[i]);var a=["type","name","title","alt"];for(i=0;i<a.length;i++)r=a[i],(o=t.getAttribute(r))&&s.push("["+r+'="'+o+'"]');return s.join("")}function _(t){if(!t)return{};var e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};var n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+r}}function S(t){if(t.message)return t.message;if(t.exception&&t.exception.values&&t.exception.values[0]){var e=t.exception.values[0];return e.type&&e.value?e.type+": "+e.value:e.type||e.value||t.event_id||"<unknown>"}return t.event_id||"<unknown>"}function w(t){var e=b();if(!("console"in e))return t();var n=e.console,r={};["debug","info","warn","error","log"].forEach(function(t){t in e.console&&n[t].__sentry__&&(r[t]=n[t].__sentry_wrapped__,n[t]=n[t].__sentry_original__)});var o=t();return Object.keys(r).forEach(function(t){n[t]=r[t]}),o}function k(t,e){return void 0===e&&(e=0),0!==e&&g(t)?t.length<=e?t:t.substr(0,e)+"...":t}function O(t,e){if(!Array.isArray(t))return"";for(var n=[],r=0;r<t.length;r++){var o=t[r];try{n.push(String(o))}catch(t){n.push("[value cannot be serialized]")}}return n.join(e)}function j(t,e){return!(Line truncated
|
||||
//# sourceMappingURL=bundle.min.js.map
|
||||
/*! @sentry/browser 5.0.5 (913eafc4) | https://github.com/getsentry/sentry-javascript */
|
||||
var Sentry=function(n){"use strict";var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])})(n,r)};function r(n,r){function i(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i,e,o,u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)};function c(n,t,r,i){return new(r||(r=Promise))(function(e,o){function u(n){try{s(i.next(n))}catch(n){o(n)}}function c(n){try{s(i.throw(n))}catch(n){o(n)}}function s(n){n.done?e(n.value):new r(function(t){t(n.value)}).then(u,c)}s((i=i.apply(n,t||[])).next())})}function s(n,t){var r,i,e,o,u={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,i&&(e=2&o[0]?i.return:o[0]?i.throw||((e=i.return)&&e.call(i),0):i.next)&&!(e=e.call(i,o[1])).done)return e;switch(i=0,e&&(o=[2&o[0],e.value]),o[0]){case 0:case 1:e=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,i=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(e=(e=u.trys).length>0&&e[e.length-1])&&(6===o[0]||2===o[0])){u=0;continue}if(3===o[0]&&(!e||o[1]>e[0]&&o[1]<e[3])){u.label=o[1];break}if(6===o[0]&&u.label<e[1]){u.label=e[1],e=o;break}if(e&&u.label<e[2]){u.label=e[2],u.ops.push(o);break}e[2]&&u.ops.pop(),u.trys.pop();continue}o=t.call(n,u)}catch(n){o=[6,n],i=0}finally{r=e=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function f(n,t){var r="function"==typeof Symbol&&n[Symbol.iterator];if(!r)return n;var i,e,o=r.call(n),u=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)u.push(i.value)}catch(n){e={error:n}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return u}function a(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(f(arguments[t]));return n}function h(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return n instanceof Error}}function v(n){return"[object ErrorEvent]"===Object.prototype.toString.call(n)}function l(n){return"[object DOMError]"===Object.prototype.toString.call(n)}function d(n){return"[object String]"===Object.prototype.toString.call(n)}function p(n){return null===n||"object"!=typeof n&&"function"!=typeof n}function m(n){return"[object Object]"===Object.prototype.toString.call(n)}function y(n){return Boolean(n&&n.then&&"function"==typeof n.then)}!function(n){n[n.None=0]="None",n[n.Error=1]="Error",n[n.Debug=2]="Debug",n[n.Verbose=3]="Verbose"}(i||(i={})),(e=n.Severity||(n.Severity={})).Fatal="fatal",e.Error="error",e.Warning="warning",e.Log="log",e.Info="info",e.Debug="debug",e.Critical="critical",function(n){n.fromString=function(t){switch(t){case"debug":return n.Debug;case"info":return n.Info;case"warn":case"warning":return n.Warning;case"error":return n.Error;case"fatal":return n.Fatal;case"critical":return n.Critical;case"log":default:return n.Log}}}(n.Severity||(n.Severity={})),(o=n.Status||(n.Status={})).Unknown="unknown",o.Skipped="skipped",o.Success="success",o.RateLimit="rate_limit",o.Invalid="invalid",o.Failed="failed",function(n){n.fromHttpCode=function(t){return t>=200&&t<300?n.Success:429===t?n.RateLimit:t>=400&&t<500?n.Invalid:t>=500?n.Failed:n.Unknown}}(n.Status||(n.Status={}));var b={};function w(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:b}function g(){var n=w(),t=n.crypto||n.msCrypto;if(void 0!==t&&t.getRandomValues){var r=new Uint16Array(8);t.getRandomValues(r),r[3]=4095&r[3]|16384,r[4]=16383&r[4]|32768;var i=function(n){for(var t=n.toString(16);t.length<4;)t="0"+t;return t};return i(r[0])+i(r[1])+i(r[2])+i(r[3])+i(r[4])+i(r[5])+i(r[6])+i(r[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=16*Math.random()|0;return("x"===n?t:3&t|8).toString(16)})}function E(n){var t,r,i,e,o,u=[];if(!n||!n.tagName)return"";if(u.push(n.tagName.toLowerCase()),n.id&&u.push("#"+n.id),(t=n.className)&&d(t))for(r=t.split(/\s+/),o=0;o<r.length;o++)u.push("."+r[o]);var c=["type","name","title","alt"];for(o=0;o<c.length;o++)i=c[o],(e=n.getAttribute(i))&&u.push("["+i+'="'+e+'"]');return u.join("")}function x(n){if(!n)return{};var t=n.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};var r=t[6]||"",i=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],relative:t[5]+r+i}}function j(n){if(n.message)return n.message;if(n.exception&&n.exception.values&&n.excepLine truncated
|
||||
@@ -7,7 +7,15 @@
|
||||
|
||||
Sentry.init({
|
||||
dsn: errortracking_url_coreui,
|
||||
release: VERSION
|
||||
release: VERSION,
|
||||
whitelistUrls: [
|
||||
// only include static assets
|
||||
"/static/"
|
||||
],
|
||||
blacklistUrls: [
|
||||
// exclude third party plugins
|
||||
"/static/webassets/packed_plugins.js"
|
||||
]
|
||||
});
|
||||
Sentry.configureScope(function (scope) {
|
||||
scope.setUser({"id": errortracking_unique_id});
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -87,7 +87,8 @@ class ForceLoginPlugin(octoprint.plugin.UiPlugin,
|
||||
if isinstance(assets, (tuple, list)):
|
||||
additional_assets += assets
|
||||
except:
|
||||
self._logger.exception("Error fetching theming CSS to include from plugin {}".format(name))
|
||||
self._logger.exception("Error fetching theming CSS to include from plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
render_kwargs.update(dict(forcelogin_theming=additional_assets))
|
||||
return make_response(render_template("forcelogin_index.jinja2", **render_kwargs))
|
||||
@@ -122,7 +123,7 @@ class ForceLoginPlugin(octoprint.plugin.UiPlugin,
|
||||
# not active, no handling
|
||||
return
|
||||
|
||||
if flask.request.endpoint in ("api.login",):
|
||||
if flask.request.endpoint in ("api.login",) or flask.request.endpoint.endswith(".static"):
|
||||
return
|
||||
|
||||
if plugin is not None and not plugin.is_blueprint_protected():
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
<div id="login-error" class="alert alert-error">{{ _('Incorrect username or password.') }}</div>
|
||||
<div id="login-offline" class="alert alert-error">{{ _('Server is currently offline.') }} <a id="login-reconnect" href="javascript:void(0)">{{ _('Reconnect...') }}</a></div>
|
||||
|
||||
<input type="text" id="login-user" class="input-block-level" placeholder="{{ _('Username') }}">
|
||||
<input type="password" id="login-password" class="input-block-level" placeholder="{{ _('Password') }}">
|
||||
<input type="text" id="login-user" class="input-block-level" placeholder="{{ _('Username')|edq }}" autofocus>
|
||||
<input type="password" id="login-password" class="input-block-level" placeholder="{{ _('Password')|edq }}">
|
||||
<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" id="login-remember"> {{ _('Remember me') }}
|
||||
</label>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -304,7 +304,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>
|
||||
@@ -37,6 +37,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:
|
||||
@@ -103,20 +106,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
|
||||
@@ -141,6 +150,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)
|
||||
|
||||
@@ -154,6 +167,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=[]
|
||||
)
|
||||
@@ -164,6 +179,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
|
||||
|
||||
@@ -260,11 +277,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():
|
||||
@@ -341,6 +358,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")
|
||||
@@ -688,7 +711,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
if additional_args:
|
||||
args.append(additional_args)
|
||||
|
||||
return self._pip_caller.execute(*args)
|
||||
kwargs = dict(env=dict(PYTHONWARNINGS="ignore:DEPRECATION::pip._internal.cli.base_command"))
|
||||
|
||||
return self._pip_caller.execute(*args, **kwargs)
|
||||
|
||||
def _log_message(self, *lines):
|
||||
self._log(lines, prefix=u"*", stream="message")
|
||||
@@ -765,16 +790,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 open(self._repository_cache_path) as f:
|
||||
repo_data = json.load(f)
|
||||
self._repository_mtime = mtime
|
||||
self._logger.info("Loaded plugin repository data from disk, was still valid")
|
||||
except:
|
||||
self._logger.exception("Error while loading repository data from {}".format(self._repository_cache_path))
|
||||
@@ -795,12 +827,22 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
self._logger.exception("Could not fetch plugins from repository at {repository_url}: {message}".format(repository_url=repository_url, message=str(e)))
|
||||
return None
|
||||
|
||||
repo_data = r.json()
|
||||
try:
|
||||
repo_data = r.json()
|
||||
except Exception as e:
|
||||
self._logger.exception("Error while reading repository data")
|
||||
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, "wb") as f:
|
||||
json.dump(repo_data, f)
|
||||
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)))
|
||||
|
||||
@@ -812,19 +854,27 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
if repo_data is None:
|
||||
return False
|
||||
|
||||
self._repository_plugins = map(map_repository_entry, repo_data)
|
||||
self._repository_plugins = 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 open(self._notices_cache_path) as f:
|
||||
notice_data = json.load(f)
|
||||
self._notices_mtime = mtime
|
||||
self._logger.info("Loaded notice data from disk, was still valid")
|
||||
except:
|
||||
self._logger.exception("Error while loading notices from {}".format(self._notices_cache_path))
|
||||
@@ -851,6 +901,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
import json
|
||||
with octoprint.util.atomic_write(self._notices_cache_path, "wb") as f:
|
||||
json.dump(notice_data, f)
|
||||
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
|
||||
@@ -900,7 +951,8 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
reconnect_hooks.extend(filter(lambda x: isinstance(x, basestring), result))
|
||||
except:
|
||||
self._logger.exception("Error while retrieving additional hooks for which a "
|
||||
"reconnect is required from plugin {name}".format(**locals()))
|
||||
"reconnect is required from plugin {name}".format(**locals()),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
return reconnect_hooks
|
||||
|
||||
|
||||
@@ -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_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_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_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_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}
|
||||
@@ -7,12 +7,17 @@ $(function() {
|
||||
self.printerState = parameters[2];
|
||||
self.systemViewModel = parameters[3];
|
||||
|
||||
// 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");
|
||||
|
||||
@@ -164,9 +169,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",
|
||||
@@ -191,6 +200,7 @@ $(function() {
|
||||
return self.enableManagement()
|
||||
&& self.pipAvailable()
|
||||
&& !self.safeMode()
|
||||
&& !self.throttled()
|
||||
&& self.online()
|
||||
&& url !== undefined
|
||||
&& url.trim() !== ""
|
||||
@@ -216,6 +226,7 @@ $(function() {
|
||||
return self.enableManagement()
|
||||
&& self.pipAvailable()
|
||||
&& !self.safeMode()
|
||||
&& !self.throttled()
|
||||
&& name !== undefined
|
||||
&& name.trim() !== ""
|
||||
&& !self.invalidArchive();
|
||||
@@ -394,12 +405,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;
|
||||
@@ -409,10 +421,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();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -446,6 +469,10 @@ $(function() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.throttled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (url === undefined) {
|
||||
url = self.installUrl();
|
||||
}
|
||||
@@ -511,23 +538,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() {
|
||||
@@ -596,7 +641,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(),
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -614,6 +661,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) {
|
||||
@@ -1083,7 +1132,8 @@ $(function() {
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: PluginManagerViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel", "printerStateViewModel", "systemViewModel"],
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel", "printerStateViewModel", "systemViewModel", "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"> </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> | <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> | <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()">
|
||||
@@ -184,7 +193,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>
|
||||
@@ -234,18 +243,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">
|
||||
@@ -259,13 +287,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">
|
||||
@@ -279,7 +307,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">
|
||||
|
||||
@@ -8,6 +8,7 @@ import octoprint.plugin
|
||||
|
||||
from octoprint.events import Events
|
||||
from octoprint.server import user_permission
|
||||
from octoprint.util import to_unicode
|
||||
|
||||
from .checks.firmware_unsafe import FirmwareUnsafeChecks
|
||||
|
||||
@@ -77,19 +78,24 @@ class PrinterSafetyCheckPlugin(octoprint.plugin.AssetPlugin,
|
||||
|
||||
def on_gcode_received(self, comm_instance, line, *args, **kwargs):
|
||||
if self._scan_received:
|
||||
self._run_checks("received", line)
|
||||
self._run_checks("received", to_unicode(line, errors="replace"))
|
||||
return line
|
||||
|
||||
##~~ Firmware info hook handler
|
||||
|
||||
def on_firmware_info_received(self, comm_instance, firmware_name, firmware_data):
|
||||
self._run_checks("m115", firmware_name, firmware_data)
|
||||
self._run_checks("m115",
|
||||
to_unicode(firmware_name, errors="replace"),
|
||||
dict((to_unicode(key, errors="replace"), to_unicode(value, errors="replace"))
|
||||
for key, value in firmware_data.items()))
|
||||
self._scan_received = False
|
||||
|
||||
##~~ Firmware capability hook handler
|
||||
|
||||
def on_firmware_cap_received(self, comm_instance, cap, enabled, all_caps):
|
||||
self._run_checks("cap", cap, enabled)
|
||||
self._run_checks("cap",
|
||||
to_unicode(cap, errors="replace"),
|
||||
enabled)
|
||||
|
||||
##~~ Helpers
|
||||
|
||||
@@ -171,7 +177,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
|
||||
|
||||
@@ -32,9 +32,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
|
||||
@@ -75,6 +76,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")
|
||||
|
||||
@@ -98,6 +101,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()
|
||||
@@ -119,7 +126,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
try:
|
||||
hook_checks = hook()
|
||||
except:
|
||||
self._logger.exception("Error while retrieving update information from plugin {name}".format(**locals()))
|
||||
self._logger.exception("Error while retrieving update information "
|
||||
"from plugin {name}".format(**locals()),
|
||||
extra=dict(plugin=name))
|
||||
else:
|
||||
for key, default_config in hook_checks.items():
|
||||
if key in effective_configs or key == "octoprint":
|
||||
@@ -565,6 +574,12 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
@restricted_access
|
||||
@admin_permission.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)
|
||||
@@ -912,7 +927,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin,
|
||||
elif restart_type == "environment":
|
||||
restart_command = self._settings.global_get(["server", "commands", "systemRestartCommand"])
|
||||
|
||||
if restart_command is not None:
|
||||
if restart_command:
|
||||
self._send_client_message("restarting", dict(restart_type=restart_type, results=target_results))
|
||||
try:
|
||||
self._perform_restart(restart_command)
|
||||
|
||||
@@ -5,6 +5,11 @@ $(function() {
|
||||
self.loginState = parameters[0];
|
||||
self.printerState = parameters[1];
|
||||
self.settings = parameters[2];
|
||||
|
||||
// optional
|
||||
|
||||
self.piSupport = parameters[3]; // might be null!
|
||||
|
||||
self.popup = undefined;
|
||||
|
||||
self.updateInProgress = false;
|
||||
@@ -51,7 +56,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() {
|
||||
@@ -91,6 +96,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.onUserLoggedIn = function() {
|
||||
self.performCheck();
|
||||
};
|
||||
@@ -484,36 +493,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) {
|
||||
@@ -795,7 +814,8 @@ $(function() {
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: SoftwareUpdateViewModel,
|
||||
dependencies: ["loginStateViewModel", "printerStateViewModel", "settingsViewModel"],
|
||||
dependencies: ["loginStateViewModel", "printerStateViewModel", "settingsViewModel", "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>
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ def perform_update(target, check, target_version, log_cb=None, online=True, forc
|
||||
|
||||
logger.debug(u"Target: %s, executing pip install %s" % (target, install_arg))
|
||||
pip_args = ["--disable-pip-version-check", "install", install_arg, "--no-cache-dir"]
|
||||
pip_kwargs = dict()
|
||||
pip_kwargs = dict(env=dict(PYTHONWARNINGS="ignore:DEPRECATION::pip._internal.cli.base_command"))
|
||||
if pip_working_directory is not None:
|
||||
pip_kwargs.update(cwd=pip_working_directory)
|
||||
|
||||
|
||||
@@ -29,4 +29,5 @@ def execute(command, cwd=None, evaluate_returncode=True, **kwargs):
|
||||
if evaluate_returncode and p.returncode != 0:
|
||||
raise ScriptError(p.returncode, p.stdout.text, p.stderr.text)
|
||||
|
||||
return p.returncode, p.stdout.text, p.stderr.text
|
||||
if not do_async:
|
||||
return p.returncode, p.stdout.text, p.stderr.text
|
||||
@@ -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(b"time", 0))
|
||||
if elapsed:
|
||||
args[b"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(b"time", 0))
|
||||
if elapsed:
|
||||
args[b"elapsed"] = elapsed
|
||||
except ValueError:
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
args[b"reason"] = payload.get(b"reason", "unknown")
|
||||
|
||||
@@ -326,7 +351,7 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
|
||||
elapsed = int(payload.get(b"time", 0))
|
||||
if elapsed:
|
||||
args[b"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(b"warning_type", "unknown"),
|
||||
printer_safety_check_name=payload.get(b"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([b"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:
|
||||
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>
|
||||
|
||||
@@ -18,7 +18,7 @@ from serial import SerialTimeoutException
|
||||
|
||||
from octoprint.settings import settings
|
||||
from octoprint.plugin import plugin_manager
|
||||
from octoprint.util import RepeatedTimer, monotonic_time
|
||||
from octoprint.util import RepeatedTimer, monotonic_time, to_bytes, to_unicode
|
||||
|
||||
class VirtualPrinter(object):
|
||||
command_regex = re.compile("^([GMTF])(\d+)")
|
||||
@@ -45,7 +45,7 @@ class VirtualPrinter(object):
|
||||
self._seriallog.addHandler(seriallog_handler)
|
||||
self._seriallog.setLevel(logging.INFO)
|
||||
|
||||
self._seriallog.info("-"*78)
|
||||
self._seriallog.info(u"-"*78)
|
||||
|
||||
self._read_timeout = read_timeout
|
||||
self._write_timeout = write_timeout
|
||||
@@ -137,7 +137,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()
|
||||
@@ -146,6 +146,7 @@ class VirtualPrinter(object):
|
||||
self._debug_sleep = None
|
||||
self._sleepAfterNext = dict()
|
||||
self._sleepAfter = dict()
|
||||
self._rerequest_last = False
|
||||
|
||||
self._dont_answer = False
|
||||
|
||||
@@ -204,7 +205,7 @@ class VirtualPrinter(object):
|
||||
|
||||
self._heatingUp = False
|
||||
|
||||
self.currentLine = 0
|
||||
self.current_line = 0
|
||||
self.lastN = 0
|
||||
|
||||
self._debug_awol = False
|
||||
@@ -283,6 +284,10 @@ class VirtualPrinter(object):
|
||||
self._send("wait")
|
||||
next_wait_timeout = monotonic_time() + self._waitInterval
|
||||
continue
|
||||
except Exception:
|
||||
if self.incoming is None:
|
||||
# just got closed
|
||||
break
|
||||
|
||||
buf += data
|
||||
if "\n" in buf:
|
||||
@@ -300,17 +305,17 @@ class VirtualPrinter(object):
|
||||
self._dont_answer = False
|
||||
continue
|
||||
|
||||
data = data.strip()
|
||||
data = to_unicode(data.strip(), errors="replace")
|
||||
|
||||
# strip checksum
|
||||
if "*" in data:
|
||||
checksum = int(data[data.rfind("*") + 1:])
|
||||
data = data[:data.rfind("*")]
|
||||
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
|
||||
@@ -319,7 +324,7 @@ class VirtualPrinter(object):
|
||||
if data.startswith("N") and "M110" in data:
|
||||
linenumber = int(re.search("N([0-9]+)", data).group(1))
|
||||
self.lastN = linenumber
|
||||
self.currentLine = linenumber
|
||||
self.current_line = linenumber
|
||||
|
||||
self._triggerResendAt100 = True
|
||||
self._triggerResendWithTimeoutAt105 = True
|
||||
@@ -360,6 +365,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()
|
||||
@@ -749,6 +757,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
|
||||
|
||||
@@ -810,6 +820,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()
|
||||
@@ -1367,6 +1380,9 @@ class VirtualPrinter(object):
|
||||
pass
|
||||
|
||||
def write(self, data):
|
||||
data = to_bytes(data, errors="replace")
|
||||
u_data = to_unicode(data, errors="replace")
|
||||
|
||||
if self._debug_awol:
|
||||
return len(data)
|
||||
|
||||
@@ -1379,13 +1395,13 @@ class VirtualPrinter(object):
|
||||
return 0
|
||||
|
||||
if "M112" in data and self._supportM112:
|
||||
self._seriallog.info("<<< {}".format(data.strip()))
|
||||
self._seriallog.info(u"<<< {}".format(u_data))
|
||||
self._kill()
|
||||
return len(data)
|
||||
|
||||
try:
|
||||
written = self.incoming.put(data, timeout=self._write_timeout, partial=True)
|
||||
self._seriallog.info("<<< {}".format(data.strip()))
|
||||
self._seriallog.info(u"<<< {}".format(u_data))
|
||||
return written
|
||||
except queue.Full:
|
||||
self._logger.info("Incoming queue is full, raising SerialTimeoutException")
|
||||
@@ -1420,10 +1436,10 @@ class VirtualPrinter(object):
|
||||
|
||||
try:
|
||||
# fetch a line from the queue, wait no longer than timeout
|
||||
line = self.outgoing.get(timeout=timeout)
|
||||
self._seriallog.info(">>> {}".format(line.strip()))
|
||||
line = to_unicode(self.outgoing.get(timeout=timeout), errors="replace")
|
||||
self._seriallog.info(u">>> {}".format(line.strip()))
|
||||
self.outgoing.task_done()
|
||||
return line
|
||||
return to_bytes(line, errors="replace")
|
||||
except queue.Empty:
|
||||
# queue empty? return empty line
|
||||
return ""
|
||||
|
||||
@@ -37,6 +37,8 @@ class PrintTimeEstimator(object):
|
||||
if interval <= 0:
|
||||
interval = 1.0
|
||||
rolling_window = 15 / interval
|
||||
if rolling_window < 1:
|
||||
rolling_window = 1
|
||||
|
||||
# we are happy when one rolling window has been stable
|
||||
countdown = rolling_window
|
||||
@@ -226,14 +228,14 @@ class TimeEstimationHelper(object):
|
||||
|
||||
@property
|
||||
def average_total_rolling(self):
|
||||
if not self._count or self._count < self._rolling_window:
|
||||
if not self._count or self._count < self._rolling_window or not len(self._totals):
|
||||
return None
|
||||
else:
|
||||
return sum(self._totals) / len(self._totals)
|
||||
|
||||
@property
|
||||
def average_distance(self):
|
||||
if not self._count or self._count < self._rolling_window + 1:
|
||||
if not self._count or self._count < self._rolling_window + 1 or not len(self._distances):
|
||||
return None
|
||||
else:
|
||||
return sum(self._distances) / len(self._distances)
|
||||
@@ -319,14 +319,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:
|
||||
@@ -341,7 +348,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)
|
||||
@@ -349,6 +359,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):
|
||||
|
||||
@@ -30,6 +30,7 @@ from octoprint.util import comm as comm
|
||||
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
|
||||
|
||||
|
||||
class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
@@ -54,8 +55,10 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
# TODO do we really need to hold the temperature here?
|
||||
self._temp = None
|
||||
self._bedTemp = None
|
||||
self._chamberTemp = None
|
||||
self._targetTemp = None
|
||||
self._targetBedTemp = None
|
||||
self._targetChamberTemp = None
|
||||
self._temps = TemperatureHistory(cutoff=settings().getInt(["temperature", "cutoff"])*60)
|
||||
self._tempBacklog = []
|
||||
|
||||
@@ -93,7 +96,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._logger.info("Using print time estimator provided by {}".format(name))
|
||||
self._estimator_factory = estimator
|
||||
except:
|
||||
self._logger.exception("Error while processing analysis queues from {}".format(name))
|
||||
self._logger.exception("Error while processing analysis queues from {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
#hook card upload
|
||||
self.sd_card_upload_hooks = plugin_manager().get_hooks("octoprint.printer.sdcardupload")
|
||||
@@ -171,28 +175,32 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
try:
|
||||
callback.on_printer_add_temperature(data)
|
||||
except:
|
||||
self._logger.exception(u"Exception while adding temperature data point to callback {}".format(callback))
|
||||
self._logger.exception(u"Exception while adding temperature data point to callback {}".format(callback),
|
||||
extra=dict(callback=fqcn(callback)))
|
||||
|
||||
def _sendAddLogCallbacks(self, data):
|
||||
for callback in self._callbacks:
|
||||
try:
|
||||
callback.on_printer_add_log(data)
|
||||
except:
|
||||
self._logger.exception(u"Exception while adding communication log entry to callback {}".format(callback))
|
||||
self._logger.exception(u"Exception while adding communication log entry to callback {}".format(callback),
|
||||
extra=dict(callback=fqcn(callback)))
|
||||
|
||||
def _sendAddMessageCallbacks(self, data):
|
||||
for callback in self._callbacks:
|
||||
try:
|
||||
callback.on_printer_add_message(data)
|
||||
except:
|
||||
self._logger.exception(u"Exception while adding printer message to callback {}".format(callback))
|
||||
self._logger.exception(u"Exception while adding printer message to callback {}".format(callback),
|
||||
extra=dict(callback=fqcn(callback)))
|
||||
|
||||
def _sendCurrentDataCallbacks(self, data):
|
||||
for callback in self._callbacks:
|
||||
try:
|
||||
callback.on_printer_send_current_data(copy.deepcopy(data))
|
||||
except:
|
||||
self._logger.exception(u"Exception while pushing current data to callback {}".format(callback))
|
||||
self._logger.exception(u"Exception while pushing current data to callback {}".format(callback),
|
||||
extra=dict(callback=fqcn(callback)))
|
||||
|
||||
#~~ callback from metadata analysis event
|
||||
|
||||
@@ -227,7 +235,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
try:
|
||||
plugin.on_print_progress(storage, filename, progress)
|
||||
except:
|
||||
self._logger.exception("Exception while sending print progress to plugin %s" % plugin._identifier)
|
||||
self._logger.exception("Exception while sending print progress to plugin %s" % plugin._identifier,
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
|
||||
thread = threading.Thread(target=call_plugins, args=(storage, filename, progress))
|
||||
thread.daemon = False
|
||||
@@ -479,14 +488,18 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
path_on_disk = self._fileManager.path_on_disk(origin, path)
|
||||
path_in_storage = self._fileManager.path_in_storage(origin, path_on_disk)
|
||||
|
||||
recovery_data = self._fileManager.get_recovery_data()
|
||||
if recovery_data:
|
||||
# clean up recovery data if we just selected a different file than is logged in that
|
||||
actual_origin = recovery_data.get("origin", None)
|
||||
actual_path = recovery_data.get("path", None)
|
||||
try:
|
||||
recovery_data = self._fileManager.get_recovery_data()
|
||||
if recovery_data:
|
||||
# clean up recovery data if we just selected a different file
|
||||
actual_origin = recovery_data.get("origin", None)
|
||||
actual_path = recovery_data.get("path", None)
|
||||
|
||||
if actual_origin is None or actual_path is None or actual_origin != origin or actual_path != path_in_storage:
|
||||
self._fileManager.delete_recovery_data()
|
||||
if actual_origin is None or actual_path is None or actual_origin != origin or actual_path != path_in_storage:
|
||||
self._fileManager.delete_recovery_data()
|
||||
except Exception:
|
||||
# anything goes wrong with the recovery data, we ignore it
|
||||
self._logger.exception("Something was wrong with processing the recovery data")
|
||||
|
||||
self._printAfterSelect = printAfterSelect
|
||||
self._posAfterSelect = pos
|
||||
@@ -719,7 +732,9 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
if result is not None:
|
||||
return result
|
||||
except:
|
||||
self._logger.exception("There was an error running the sd upload hook provided by plugin {}".format(name))
|
||||
self._logger.exception("There was an error running the sd upload "
|
||||
"hook provided by plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
else:
|
||||
# no plugin feels responsible, use the default implementation
|
||||
@@ -853,11 +868,14 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
statisticalTotalPrintTime = self._selectedFile["estimatedPrintTime"]
|
||||
statisticalTotalPrintTimeType = self._selectedFile.get("estimatedPrintTimeType", None)
|
||||
|
||||
printTimeLeft, printTimeLeftOrigin = estimator.estimate(progress,
|
||||
printTime,
|
||||
cleanedPrintTime,
|
||||
statisticalTotalPrintTime,
|
||||
statisticalTotalPrintTimeType)
|
||||
try:
|
||||
printTimeLeft, printTimeLeftOrigin = estimator.estimate(progress,
|
||||
printTime,
|
||||
cleanedPrintTime,
|
||||
statisticalTotalPrintTime,
|
||||
statisticalTotalPrintTimeType)
|
||||
except Exception:
|
||||
self._logger.exception("Error while estimating print time via {}".format(estimator))
|
||||
|
||||
return self._dict(completion=progress * 100 if progress is not None else None,
|
||||
filepos=filepos,
|
||||
@@ -993,7 +1011,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._stateMonitor.set_job_data(self._dict(file=job_data["file"],
|
||||
estimatedPrintTime=job_data["estimatedPrintTime"],
|
||||
averagePrintTime=job_data["averagePrintTime"],
|
||||
lastPrintTIme=job_data["lastPrintTime"],
|
||||
lastPrintTime=job_data["lastPrintTime"],
|
||||
filament=job_data["filament"],
|
||||
user=user))
|
||||
|
||||
@@ -1007,7 +1025,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
})
|
||||
callback.on_printer_send_initial_data(data)
|
||||
except:
|
||||
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 _getStateFlags(self):
|
||||
return self._dict(operational=self.is_operational(),
|
||||
@@ -1121,7 +1140,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
|
||||
|
||||
def on_comm_sd_files(self, files):
|
||||
eventManager().fire(Events.UPDATED_FILES, {"type": "gcode"})
|
||||
eventManager().fire(Events.UPDATED_FILES, {"type": "printables"})
|
||||
self._sdFilelistAvailable.set()
|
||||
|
||||
def on_comm_file_selected(self, full_path, size, sd, user=None):
|
||||
|
||||
@@ -148,7 +148,17 @@ def load_user(id):
|
||||
return None
|
||||
|
||||
def load_user_from_request(request):
|
||||
return util.get_user_for_authorization_header(request.headers.get('Authorization'))
|
||||
user = None
|
||||
|
||||
if settings().getBoolean(["accessControl", "trustBasicAuthentication"]):
|
||||
# Basic Authentication?
|
||||
user = util.get_user_for_authorization_header(request.headers.get('Authorization'))
|
||||
|
||||
if settings().getBoolean(["accessControl", "trustRemoteUser"]):
|
||||
# Remote user header?
|
||||
user = util.get_user_for_remote_user_header(request)
|
||||
|
||||
return user
|
||||
|
||||
def unauthorized_user():
|
||||
from flask import abort
|
||||
@@ -191,8 +201,9 @@ class Server(object):
|
||||
if self._settings is None:
|
||||
self._settings = settings()
|
||||
|
||||
self._settings.setBoolean(["server", "incompleteStartup"], True)
|
||||
self._settings.save()
|
||||
if not self._settings.getBoolean(["server", "ignoreIncompleteStartup"]):
|
||||
self._settings.setBoolean(["server", "incompleteStartup"], True)
|
||||
self._settings.save()
|
||||
|
||||
if self._plugin_manager is None:
|
||||
self._plugin_manager = octoprint.plugin.plugin_manager()
|
||||
@@ -250,7 +261,11 @@ class Server(object):
|
||||
# monkey patch a bunch of 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)
|
||||
@@ -288,7 +303,8 @@ class Server(object):
|
||||
additional_factories = hook()
|
||||
analysis_queue_factories.update(**additional_factories)
|
||||
except:
|
||||
self._logger.exception("Error while processing analysis queues from {}".format(name))
|
||||
self._logger.exception("Error while processing analysis queues from {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
analysisQueue = octoprint.filemanager.analysis.AnalysisQueue(analysis_queue_factories)
|
||||
|
||||
slicingManager = octoprint.slicing.SlicingManager(self._settings.getBaseFolder("slicingProfiles"), printerProfileManager)
|
||||
@@ -345,7 +361,8 @@ class Server(object):
|
||||
self._logger.debug("Created user manager instance from factory {}".format(name))
|
||||
break
|
||||
except:
|
||||
self._logger.exception("Error while creating user manager instance from factory {}".format(name))
|
||||
self._logger.exception("Error while creating user manager instance from factory {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
else:
|
||||
name = self._settings.get(["accessControl", "userManager"])
|
||||
try:
|
||||
@@ -368,7 +385,8 @@ class Server(object):
|
||||
self._logger.debug("Created printer instance from factory {}".format(name))
|
||||
break
|
||||
except:
|
||||
self._logger.exception("Error while creating printer instance from factory {}".format(name))
|
||||
self._logger.exception("Error while creating printer instance from factory {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
else:
|
||||
printer = Printer(fileManager, analysisQueue, printerProfileManager)
|
||||
components.update(dict(printer=printer))
|
||||
@@ -457,7 +475,8 @@ class Server(object):
|
||||
constant, value = octoprint.events.Events.register_event(event, prefix="plugin_{}_".format(name))
|
||||
self._logger.debug("Registered event {} of plugin {} as Events.{} = \"{}\"".format(event, name, constant, value))
|
||||
except:
|
||||
self._logger.exception("Error while retrieving custom event list from plugin {}".format(name))
|
||||
self._logger.exception("Error while retrieving custom event list from plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
pluginManager.implementation_inject_factories=[octoprint_plugin_inject_factory,
|
||||
settings_plugin_inject_factory]
|
||||
@@ -468,7 +487,9 @@ class Server(object):
|
||||
try:
|
||||
settings_plugin_config_migration_and_cleanup(implementation._identifier, implementation)
|
||||
except:
|
||||
self._logger.exception("Error while trying to migrate settings for plugin {}, ignoring it".format(implementation._identifier))
|
||||
self._logger.exception("Error while trying to migrate settings for "
|
||||
"plugin {}, ignoring it".format(implementation._identifier),
|
||||
extra=dict(plugin=implementation._identifier))
|
||||
|
||||
pluginManager.implementation_post_inits=[settings_plugin_config_migration_and_cleanup]
|
||||
|
||||
@@ -540,7 +561,8 @@ class Server(object):
|
||||
try:
|
||||
access_validators_from_plugins.append(util.tornado.access_validation_factory(app, hook))
|
||||
except:
|
||||
self._logger.exception("Error while adding tornado access validator from plugin {}".format(plugin))
|
||||
self._logger.exception("Error while adding tornado access validator from plugin {}".format(plugin),
|
||||
extra=dict(plugin=plugin))
|
||||
|
||||
admin_validators = [util.tornado.access_validation_factory(app, util.flask.admin_validator),] + access_validators_from_plugins
|
||||
user_validators = [util.tornado.access_validation_factory(app, util.flask.user_validator),] + access_validators_from_plugins
|
||||
@@ -606,7 +628,9 @@ class Server(object):
|
||||
try:
|
||||
result = hook(list(server_routes))
|
||||
except:
|
||||
self._logger.exception("There was an error while retrieving additional server routes from plugin hook {name}".format(**locals()))
|
||||
self._logger.exception("There was an error while retrieving additional "
|
||||
"server routes from plugin hook {name}".format(**locals()),
|
||||
extra=dict(plugin=name))
|
||||
else:
|
||||
if isinstance(result, (list, tuple)):
|
||||
for entry in result:
|
||||
@@ -649,7 +673,9 @@ class Server(object):
|
||||
try:
|
||||
result = hook(list(max_body_sizes))
|
||||
except:
|
||||
self._logger.exception("There was an error while retrieving additional upload sizes from plugin hook {name}".format(**locals()))
|
||||
self._logger.exception("There was an error while retrieving additional "
|
||||
"upload sizes from plugin hook {name}".format(**locals()),
|
||||
extra=dict(plugin=name))
|
||||
else:
|
||||
if isinstance(result, (list, tuple)):
|
||||
for entry in result:
|
||||
@@ -1002,10 +1028,20 @@ class Server(object):
|
||||
return u"<{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
|
||||
@@ -1179,7 +1215,9 @@ class Server(object):
|
||||
blueprint, prefix = self._prepare_blueprint_plugin(plugin)
|
||||
blueprints[prefix] = blueprint
|
||||
except:
|
||||
self._logger.exception("Error while registering blueprint of plugin {}, ignoring it".format(plugin._identifier))
|
||||
self._logger.exception("Error while registering blueprint of "
|
||||
"plugin {}, ignoring it".format(plugin._identifier),
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
continue
|
||||
|
||||
return blueprints
|
||||
@@ -1195,7 +1233,9 @@ class Server(object):
|
||||
blueprint, prefix = self._prepare_asset_plugin(plugin)
|
||||
blueprints[prefix] = blueprint
|
||||
except:
|
||||
self._logger.exception("Error while registering assets of plugin {}, ignoring it".format(plugin._identifier))
|
||||
self._logger.exception("Error while registering assets of plugin "
|
||||
"{}, ignoring it".format(plugin._identifier),
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
continue
|
||||
|
||||
return blueprints
|
||||
@@ -1243,7 +1283,8 @@ class Server(object):
|
||||
for h in result:
|
||||
blueprint.before_request(h)
|
||||
except:
|
||||
self._logger.exception("Error processing before_request hooks from plugin {}".format(name))
|
||||
self._logger.exception("Error processing before_request hooks from plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
for name, hook in after_hooks.items():
|
||||
try:
|
||||
@@ -1252,7 +1293,8 @@ class Server(object):
|
||||
for h in result:
|
||||
blueprint.after_request(h)
|
||||
except:
|
||||
self._logger.exception("Error processing after_request hooks from plugin {}".format(name))
|
||||
self._logger.exception("Error processing after_request hooks from plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
def _setup_assets(self):
|
||||
global app
|
||||
@@ -1579,10 +1621,7 @@ class Server(object):
|
||||
|
||||
loginManager.user_callback = load_user
|
||||
loginManager.unauthorized_callback = unauthorized_user
|
||||
|
||||
# login users authenticated by basic auth
|
||||
if self._settings.get(["accessControl", "trustBasicAuthentication"]):
|
||||
loginManager.request_callback = load_user_from_request
|
||||
loginManager.request_callback = load_user_from_request
|
||||
|
||||
if not userManager.enabled:
|
||||
loginManager.anonymous_user = users.DummyUser
|
||||
|
||||
@@ -60,15 +60,20 @@ def pluginData(name):
|
||||
if len(api_plugins) > 1:
|
||||
return make_response("More than one api provider registered for {name}, can't proceed".format(name=name), 500)
|
||||
|
||||
api_plugin = api_plugins[0]
|
||||
if api_plugin.is_api_adminonly() and not current_user.is_admin():
|
||||
return make_response("Forbidden", 403)
|
||||
try:
|
||||
api_plugin = api_plugins[0]
|
||||
if api_plugin.is_api_adminonly() and not current_user.is_admin():
|
||||
return make_response("Forbidden", 403)
|
||||
|
||||
response = api_plugin.on_api_get(request)
|
||||
response = api_plugin.on_api_get(request)
|
||||
|
||||
if response is not None:
|
||||
return response
|
||||
return NO_CONTENT
|
||||
if response is not None:
|
||||
return response
|
||||
return NO_CONTENT
|
||||
except Exception:
|
||||
logging.getLogger(__name__).exception("Error calling SimpleApiPlugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
return abort(500)
|
||||
|
||||
#~~ commands for plugins
|
||||
|
||||
@@ -84,21 +89,26 @@ def pluginCommand(name):
|
||||
return make_response("More than one api provider registered for {name}, can't proceed".format(name=name), 500)
|
||||
|
||||
api_plugin = api_plugins[0]
|
||||
valid_commands = api_plugin.get_api_commands()
|
||||
if valid_commands is None:
|
||||
return make_response("Method not allowed", 405)
|
||||
try:
|
||||
valid_commands = api_plugin.get_api_commands()
|
||||
if valid_commands is None:
|
||||
return make_response("Method not allowed", 405)
|
||||
|
||||
if api_plugin.is_api_adminonly() and not current_user.is_admin():
|
||||
return make_response("Forbidden", 403)
|
||||
if api_plugin.is_api_adminonly() and not current_user.is_admin():
|
||||
return make_response("Forbidden", 403)
|
||||
|
||||
command, data, response = get_json_command_from_request(request, valid_commands)
|
||||
if response is not None:
|
||||
return response
|
||||
command, data, response = get_json_command_from_request(request, valid_commands)
|
||||
if response is not None:
|
||||
return response
|
||||
|
||||
response = api_plugin.on_api_command(command, data)
|
||||
if response is not None:
|
||||
return response
|
||||
return NO_CONTENT
|
||||
response = api_plugin.on_api_command(command, data)
|
||||
if response is not None:
|
||||
return response
|
||||
return NO_CONTENT
|
||||
except Exception:
|
||||
logging.getLogger(__name__).exception("Error while excuting SimpleApiPlugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
return abort(500)
|
||||
|
||||
#~~ first run setup
|
||||
|
||||
@@ -119,7 +129,9 @@ def wizardState():
|
||||
version = implementation.get_wizard_version()
|
||||
ignored = octoprint.plugin.WizardPlugin.is_wizard_ignored(seen_wizards, implementation)
|
||||
except:
|
||||
logging.getLogger(__name__).exception("There was an error fetching wizard details for {}, ignoring".format(name))
|
||||
logging.getLogger(__name__).exception("There was an error fetching wizard "
|
||||
"details for {}, ignoring".format(name),
|
||||
extra=dict(plugin=name))
|
||||
else:
|
||||
result[name] = dict(required=required, details=details, version=version, ignored=ignored)
|
||||
|
||||
@@ -154,7 +166,9 @@ def wizardFinish():
|
||||
if name in handled:
|
||||
seen_wizards[name] = implementation.get_wizard_version()
|
||||
except:
|
||||
logging.getLogger(__name__).exception("There was an error finishing the wizard for {}, ignoring".format(name))
|
||||
logging.getLogger(__name__).exception("There was an error finishing the "
|
||||
"wizard for {}, ignoring".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
s().set(["server", "seenWizards"], seen_wizards)
|
||||
s().save()
|
||||
@@ -222,7 +236,10 @@ def login():
|
||||
response["_is_external_client"] = s().getBoolean(["server", "ipCheck", "enabled"]) \
|
||||
and not util_net.is_lan_address(remote_addr,
|
||||
additional_private=s().get(["server", "ipCheck", "trustedSubnets"]))
|
||||
return jsonify(response)
|
||||
|
||||
r = make_response(jsonify(response))
|
||||
r.delete_cookie("active_logout")
|
||||
return r
|
||||
|
||||
return make_response(("User unknown or password incorrect", 401, []))
|
||||
|
||||
@@ -240,7 +257,11 @@ def logout():
|
||||
# ... and from flask login (and principal)
|
||||
logout_user()
|
||||
|
||||
return NO_CONTENT
|
||||
# ... and send an active logout session cookie
|
||||
r = make_response(NO_CONTENT)
|
||||
r.set_cookie("active_logout", "true")
|
||||
|
||||
return r
|
||||
|
||||
|
||||
def _logout(user):
|
||||
@@ -443,7 +464,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(
|
||||
|
||||
@@ -18,6 +18,8 @@ from collections import defaultdict
|
||||
|
||||
from flask import request, jsonify, make_response
|
||||
|
||||
import logging
|
||||
|
||||
from octoprint.settings import settings
|
||||
|
||||
from octoprint.server import admin_permission
|
||||
@@ -78,9 +80,19 @@ def getInstalledLanguagePacks():
|
||||
plugin_packs[plugin_entry.name]["display"] = plugin_info.name
|
||||
|
||||
for language_entry in scandir(plugin_entry.path):
|
||||
plugin_packs[plugin_entry.name]["languages"].append(load_meta(language_entry.path, language_entry.name))
|
||||
try:
|
||||
plugin_packs[plugin_entry.name]["languages"].append(load_meta(language_entry.path, language_entry.name))
|
||||
except Exception:
|
||||
logging.getLogger(__name__).exception("Error while parsing metadata for language pack {} from {} for plugin {}".format(language_entry.name,
|
||||
language_entry.path,
|
||||
plugin_entry.name))
|
||||
continue
|
||||
else:
|
||||
core_packs.append(load_meta(entry.path, entry.name))
|
||||
try:
|
||||
core_packs.append(load_meta(entry.path, entry.name))
|
||||
except Exception:
|
||||
logging.getLogger(__name__).exception("Error while parsing metadata for core language pack {} from {}".format(entry.name,
|
||||
entry.path))
|
||||
|
||||
result = dict(_core=dict(identifier="_core", display="Core", languages=core_packs))
|
||||
result.update(plugin_packs)
|
||||
|
||||
@@ -33,12 +33,18 @@ def printerState():
|
||||
|
||||
result = {}
|
||||
|
||||
processor = lambda x: x
|
||||
if not printerProfileManager.get_current_or_default()["heatedBed"]:
|
||||
processor = _delete_bed
|
||||
|
||||
# add temperature information
|
||||
if not "temperature" in excludes:
|
||||
processor = lambda x: x
|
||||
heated_bed = printerProfileManager.get_current_or_default()["heatedBed"]
|
||||
heated_chamber = printerProfileManager.get_current_or_default()["heatedChamber"]
|
||||
if not heated_bed and not heated_chamber:
|
||||
processor = _keep_tools
|
||||
elif not heated_bed:
|
||||
processor = _delete_bed
|
||||
elif not heated_chamber:
|
||||
processor = _delete_chamber
|
||||
|
||||
result.update({"temperature": _get_temperature_data(processor)})
|
||||
|
||||
# add sd information
|
||||
@@ -80,7 +86,7 @@ def printerToolCommand():
|
||||
##~~ tool selection
|
||||
if command == "select":
|
||||
tool = data["tool"]
|
||||
if re.match(validation_regex, tool) is None:
|
||||
if not isinstance(tool, basestring) or re.match(validation_regex, tool) is None:
|
||||
return make_response("Invalid tool: %s" % tool, 400)
|
||||
if not tool.startswith("tool"):
|
||||
return make_response("Invalid tool for selection: %s" % tool, 400)
|
||||
@@ -151,7 +157,7 @@ def printerToolState():
|
||||
if not printer.is_operational():
|
||||
return make_response("Printer is not operational", 409)
|
||||
|
||||
return jsonify(_get_temperature_data(_delete_bed))
|
||||
return jsonify(_get_temperature_data(_keep_tools))
|
||||
|
||||
|
||||
##~~ Heated bed
|
||||
@@ -483,10 +489,15 @@ def _keep_tools(x):
|
||||
def _keep_bed(x):
|
||||
return _delete_from_data(x, lambda k: k != "bed")
|
||||
|
||||
def _delete_bed(x):
|
||||
return _delete_from_data(x, lambda k: k == "bed")
|
||||
|
||||
def _keep_chamber(x):
|
||||
return _delete_from_data(x, lambda k: k != "chamber")
|
||||
|
||||
def _delete_chamber(x):
|
||||
return _delete_from_data(x, lambda k: k == "chamber")
|
||||
|
||||
|
||||
def _delete_from_data(x, key_matcher):
|
||||
data = dict(x)
|
||||
|
||||
@@ -85,7 +85,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:
|
||||
@@ -114,7 +115,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"])
|
||||
@@ -146,7 +147,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:
|
||||
|
||||
@@ -92,7 +92,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"])
|
||||
@@ -123,6 +124,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"])
|
||||
@@ -130,6 +132,7 @@ def getSettings():
|
||||
"serial": {
|
||||
"port": connectionOptions["portPreference"],
|
||||
"baudrate": connectionOptions["baudratePreference"],
|
||||
"exclusive": s.getBoolean(["serial", "exclusive"]),
|
||||
"portOptions": connectionOptions["ports"],
|
||||
"baudrateOptions": connectionOptions["baudrates"],
|
||||
"autoconnect": s.getBoolean(["serial", "autoconnect"]),
|
||||
@@ -151,6 +154,7 @@ def getSettings():
|
||||
"checksumRequiringCommands": s.get(["serial", "checksumRequiringCommands"]),
|
||||
"blockedCommands": s.get(["serial", "blockedCommands"]),
|
||||
"pausingCommands": s.get(["serial", "pausingCommands"]),
|
||||
"emergencyCommands": s.get(["serial", "emergencyCommands"]),
|
||||
"helloCommand": s.get(["serial", "helloCommand"]),
|
||||
"ignoreErrorsFromFirmware": s.getBoolean(["serial", "ignoreErrorsFromFirmware"]),
|
||||
"disconnectOnErrors": s.getBoolean(["serial", "disconnectOnErrors"]),
|
||||
@@ -170,6 +174,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"]),
|
||||
@@ -276,7 +282,8 @@ def _get_plugin_settings():
|
||||
logger.warn("octoprint.plugin.SettingsPlugin.on_settings_load(self) instead.")
|
||||
except:
|
||||
logger.exception("Could not load settings for plugin {name} ({version})".format(version=plugin._plugin_version,
|
||||
name=plugin._plugin_name))
|
||||
name=plugin._plugin_name),
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
|
||||
return data
|
||||
|
||||
@@ -380,6 +387,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.keys():
|
||||
if "defaultExtrusionLength" in data["printer"]: s.setInt(["printerParameters", "defaultExtrusionLength"], data["printer"]["defaultExtrusionLength"])
|
||||
@@ -410,6 +418,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"])
|
||||
@@ -418,6 +427,7 @@ def _saveSettings(data):
|
||||
if "autoconnect" in data["serial"]: s.setBoolean(["serial", "autoconnect"], data["serial"]["autoconnect"])
|
||||
if "port" in data["serial"]: s.set(["serial", "port"], data["serial"]["port"])
|
||||
if "baudrate" in data["serial"]: s.setInt(["serial", "baudrate"], data["serial"]["baudrate"])
|
||||
if "exclusive" in data["serial"]: s.setBoolean(["serial", "exclusive"], data["serial"]["exclusive"])
|
||||
if "timeoutConnection" in data["serial"]: s.setFloat(["serial", "timeout", "connection"], data["serial"]["timeoutConnection"], min=1.0)
|
||||
if "timeoutDetection" in data["serial"]: s.setFloat(["serial", "timeout", "detection"], data["serial"]["timeoutDetection"], min=1.0)
|
||||
if "timeoutCommunication" in data["serial"]: s.setFloat(["serial", "timeout", "communication"], data["serial"]["timeoutCommunication"], min=1.0)
|
||||
@@ -435,6 +445,7 @@ def _saveSettings(data):
|
||||
if "checksumRequiringCommands" in data["serial"] and isinstance(data["serial"]["checksumRequiringCommands"], (list, tuple)): s.set(["serial", "checksumRequiringCommands"], data["serial"]["checksumRequiringCommands"])
|
||||
if "blockedCommands" in data["serial"] and isinstance(data["serial"]["blockedCommands"], (list, tuple)): s.set(["serial", "blockedCommands"], data["serial"]["blockedCommands"])
|
||||
if "pausingCommands" in data["serial"] and isinstance(data["serial"]["pausingCommands"], (list, tuple)): s.set(["serial", "pausingCommands"], data["serial"]["pausingCommands"])
|
||||
if "emergencyCommands" in data["serial"] and isinstance(data["serial"]["emergencyCommands"], (list, tuple)): s.set(["serial", "emergencyCommands"], data["serial"]["emergencyCommands"])
|
||||
if "helloCommand" in data["serial"]: s.set(["serial", "helloCommand"], data["serial"]["helloCommand"])
|
||||
if "ignoreErrorsFromFirmware" in data["serial"]: s.setBoolean(["serial", "ignoreErrorsFromFirmware"], data["serial"]["ignoreErrorsFromFirmware"])
|
||||
if "disconnectOnErrors" in data["serial"]: s.setBoolean(["serial", "disconnectOnErrors"], data["serial"]["disconnectOnErrors"])
|
||||
@@ -454,6 +465,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"])
|
||||
@@ -551,6 +567,8 @@ def _saveSettings(data):
|
||||
logger.warn("Please contact the plugin's author and ask to update the plugin to use a direct call like")
|
||||
logger.warn("octoprint.plugin.SettingsPlugin.on_settings_save(self, data) instead.")
|
||||
except:
|
||||
logger.exception("Could not save settings for plugin {name} ({version})".format(version=plugin._plugin_version, name=plugin._plugin_name))
|
||||
logger.exception("Could not save settings for plugin {name} ({version})".format(version=plugin._plugin_version,
|
||||
name=plugin._plugin_name),
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
|
||||
s.save(trigger_event=True)
|
||||
@@ -48,7 +48,7 @@ def performSystemAction():
|
||||
data = request.json
|
||||
|
||||
if not "action" in data:
|
||||
return make_response("action to perform is not defined", 400)
|
||||
return make_response(u"action to perform is not defined", 400)
|
||||
|
||||
return executeSystemCommand("custom", data["action"])
|
||||
|
||||
@@ -70,7 +70,7 @@ def retrieveSystemCommandsForSource(source):
|
||||
elif source == "custom":
|
||||
specs = _get_custom_command_specs()
|
||||
else:
|
||||
return make_response("Unknown system command source: {}".format(source), 404)
|
||||
return make_response(u"Unknown system command source: {}".format(source), 404)
|
||||
|
||||
return jsonify(_to_client_specs(specs))
|
||||
|
||||
@@ -86,26 +86,26 @@ def executeSystemCommand(source, command):
|
||||
|
||||
command_spec = _get_command_spec(source, command)
|
||||
if not command_spec:
|
||||
return make_response("Command {}:{} not found".format(source, command), 404)
|
||||
return make_response(u"Command {}:{} not found".format(source, command), 404)
|
||||
|
||||
if not "command" in command_spec:
|
||||
return make_response("Command {}:{} does not define a command to execute, can't proceed".format(source, command), 500)
|
||||
return make_response(u"Command {}:{} does not define a command to execute, can't proceed".format(source, command), 500)
|
||||
|
||||
do_async = command_spec.get("async", False)
|
||||
do_ignore = command_spec.get("ignore", False)
|
||||
debug = command_spec.get("debug", False)
|
||||
|
||||
if logger.isEnabledFor(logging.DEBUG) or debug:
|
||||
logger.info("Performing command for {}:{}: {}".format(source, command, command_spec["command"]))
|
||||
logger.info(u"Performing command for {}:{}: {}".format(source, command, command_spec["command"]))
|
||||
else:
|
||||
logger.info("Performing command for {}:{}".format(source, command))
|
||||
logger.info(u"Performing command for {}:{}".format(source, command))
|
||||
|
||||
try:
|
||||
if "before" in command_spec and callable(command_spec["before"]):
|
||||
command_spec["before"]()
|
||||
except Exception as e:
|
||||
if not do_ignore:
|
||||
error = "Command \"before\" for {}:{} failed: {}".format(source, command, str(e))
|
||||
error = u"Command \"before\" for {}:{} failed: {}".format(source, command, e)
|
||||
logger.warn(error)
|
||||
return make_response(error, 500)
|
||||
|
||||
@@ -124,11 +124,11 @@ def executeSystemCommand(source, command):
|
||||
stdout_text = p.stdout.text
|
||||
stderr_text = p.stderr.text
|
||||
|
||||
error = "Command for {}:{} failed with return code {}:\nSTDOUT: {}\nSTDERR: {}".format(source, command,
|
||||
returncode,
|
||||
stdout_text,
|
||||
stderr_text)
|
||||
logger.warn(prefix_multilines(error, prefix="! "))
|
||||
error = u"Command for {}:{} failed with return code {}:\nSTDOUT: {}\nSTDERR: {}".format(source, command,
|
||||
returncode,
|
||||
stdout_text,
|
||||
stderr_text)
|
||||
logger.warn(prefix_multilines(error, prefix=u"! "))
|
||||
if not do_async:
|
||||
raise CommandFailed(error)
|
||||
|
||||
@@ -145,7 +145,7 @@ def executeSystemCommand(source, command):
|
||||
|
||||
except Exception as e:
|
||||
if not do_ignore:
|
||||
error = "Command for {}:{} failed: {}".format(source, command, str(e))
|
||||
error = u"Command for {}:{} failed: {}".format(source, command, e)
|
||||
logger.warn(error)
|
||||
return make_response(error, 500)
|
||||
|
||||
@@ -183,19 +183,19 @@ def _get_core_command_specs():
|
||||
shutdown=dict(
|
||||
command=s().get(["server", "commands", "systemShutdownCommand"]),
|
||||
name=gettext("Shutdown system"),
|
||||
confirm=gettext("<strong>You are about to shutdown the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).")),
|
||||
confirm=gettext(u"<strong>You are about to shutdown the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).")),
|
||||
reboot=dict(
|
||||
command=s().get(["server", "commands", "systemRestartCommand"]),
|
||||
name=gettext("Reboot system"),
|
||||
confirm=gettext("<strong>You are about to reboot the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).")),
|
||||
confirm=gettext(u"<strong>You are about to reboot the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).")),
|
||||
restart=dict(
|
||||
command=s().get(["server", "commands", "serverRestartCommand"]),
|
||||
name=gettext("Restart OctoPrint"),
|
||||
confirm=gettext("<strong>You are about to restart the OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).")),
|
||||
confirm=gettext(u"<strong>You are about to restart the OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).")),
|
||||
restart_safe=dict(
|
||||
command=s().get(["server", "commands", "serverRestartCommand"]),
|
||||
name=gettext("Restart OctoPrint in safe mode"),
|
||||
confirm=gettext("<strong>You are about to restart the OctoPrint server in safe mode.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage)."),
|
||||
confirm=gettext(u"<strong>You are about to restart the OctoPrint server in safe mode.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage)."),
|
||||
before=enable_safe_mode)
|
||||
)
|
||||
|
||||
@@ -214,7 +214,7 @@ def _get_core_command_specs():
|
||||
def _get_core_command_spec(action):
|
||||
available_actions = _get_core_command_specs()
|
||||
if not action in available_actions:
|
||||
logging.getLogger(__name__).warn("Command for core action {} is not configured, you need to configure the command before it can be used".format(action))
|
||||
logging.getLogger(__name__).warn(u"Command for core action {} is not configured, you need to configure the command before it can be used".format(action))
|
||||
return None
|
||||
|
||||
return available_actions[action]
|
||||
|
||||
@@ -107,7 +107,9 @@ def _get_registered_apps():
|
||||
logger.warn("Plugin {} is still implementing the appkey hook that is deprecated since 1.3.11 and will be removed in 1.4.0. Switch it over to the Application Keys Plugin workflow.".format(name))
|
||||
except:
|
||||
import logging
|
||||
logging.getLogger(__name__).exception("Error while retrieving additional appkeys from plugin {name}".format(**locals()))
|
||||
logging.getLogger(__name__).exception("Error while retrieving additional appkeys "
|
||||
"from plugin {name}".format(**locals()),
|
||||
extra=dict(plugin=name))
|
||||
continue
|
||||
|
||||
any_version_enabled = dict()
|
||||
|
||||
@@ -193,10 +193,32 @@ def get_user_for_apikey(apikey):
|
||||
if user is not None:
|
||||
return user
|
||||
except:
|
||||
logging.getLogger(__name__).exception("Error running api key validator for plugin {} and key {}".format(name, apikey))
|
||||
logging.getLogger(__name__).exception("Error running api key validator "
|
||||
"for plugin {} and key {}".format(name, apikey),
|
||||
extra=dict(plugin=name))
|
||||
return None
|
||||
|
||||
|
||||
def get_user_for_remote_user_header(request):
|
||||
if not octoprint.server.userManager.enabled:
|
||||
return None
|
||||
|
||||
if not settings().getBoolean(["accessControl", "trustRemoteUser"]):
|
||||
return None
|
||||
|
||||
header = request.headers.get(settings().get(["accessControl", "remoteUserHeader"]))
|
||||
if header is None:
|
||||
return None
|
||||
|
||||
user = octoprint.server.userManager.findUser(userid=header)
|
||||
|
||||
if user is None and settings().getBoolean(["accessControl", "addRemoteUsers"]):
|
||||
octoprint.server.userManager.addUser(header, settings().generateApiKey(), active=True)
|
||||
user = octoprint.server.userManager.findUser(userid=header)
|
||||
|
||||
return user
|
||||
|
||||
|
||||
def get_user_for_authorization_header(header):
|
||||
if not settings().getBoolean(["accessControl", "trustBasicAuthentication"]):
|
||||
return None
|
||||
|
||||
@@ -271,7 +271,7 @@ def fix_flask_jsonify():
|
||||
data = args or kwargs
|
||||
|
||||
return current_app.response_class(
|
||||
dumps(data, indent=indent, separators=separators) + '\n',
|
||||
dumps(data, indent=indent, separators=separators, allow_nan=False) + '\n',
|
||||
mimetype='application/json'
|
||||
)
|
||||
|
||||
@@ -584,7 +584,8 @@ def passive_login():
|
||||
|
||||
elif settings().getBoolean(["accessControl", "autologinLocal"]) \
|
||||
and settings().get(["accessControl", "autologinAs"]) is not None \
|
||||
and settings().get(["accessControl", "localNetworks"]) is not None:
|
||||
and settings().get(["accessControl", "localNetworks"]) is not None \
|
||||
and not "active_logout" in flask.request.cookies:
|
||||
|
||||
autologin_as = settings().get(["accessControl", "autologinAs"])
|
||||
local_networks = _local_networks()
|
||||
@@ -1142,19 +1143,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
|
||||
|
||||
|
||||
@@ -1539,7 +1570,8 @@ def collect_plugin_assets(enable_gcodeviewer=True, preferred_stylesheet="css"):
|
||||
all_assets = implementation.get_assets()
|
||||
basefolder = implementation.get_asset_folder()
|
||||
except:
|
||||
logger.exception("Got an error while trying to collect assets from {}, ignoring assets from the plugin".format(name))
|
||||
logger.exception("Got an error while trying to collect assets from {}, ignoring assets from the plugin".format(name),
|
||||
extra=dict(plugin=name))
|
||||
continue
|
||||
|
||||
def asset_exists(category, asset):
|
||||
|
||||
@@ -268,7 +268,8 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection, o
|
||||
try:
|
||||
proceed = proceed and hook(self, self._user, type, payload)
|
||||
except:
|
||||
self._logger.exception("Error processing emit hook handler from plugin {}".format(name))
|
||||
self._logger.exception("Error processing emit hook handler from plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
if not proceed:
|
||||
return
|
||||
@@ -280,7 +281,7 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection, o
|
||||
self.send({type: payload})
|
||||
except Exception as e:
|
||||
if self._logger.isEnabledFor(logging.DEBUG):
|
||||
self._logger.exception("Could not send message to client {}".format(self._remoteAddress))
|
||||
self._logger.warn("Could not send message to client {}".format(self._remoteAddress), exc_info=True)
|
||||
else:
|
||||
self._logger.warn("Could not send message to client {}: {}".format(self._remoteAddress, e))
|
||||
|
||||
@@ -290,7 +291,8 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection, o
|
||||
try:
|
||||
proceed = proceed and hook(self, self._user)
|
||||
except:
|
||||
self._logger.exception("Error processing register hook handler for plugin {}".format(name))
|
||||
self._logger.exception("Error processing register hook handler for plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
if not proceed:
|
||||
return
|
||||
@@ -358,7 +360,8 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection, o
|
||||
try:
|
||||
hook(self, self._user)
|
||||
except:
|
||||
self._logger.exception("Error processing authed hook handler for plugin {}".format(name))
|
||||
self._logger.exception("Error processing authed hook handler for plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
def _on_logout(self):
|
||||
self._user = None
|
||||
@@ -367,5 +370,6 @@ class PrinterStateConnection(octoprint.vendor.sockjs.tornado.SockJSConnection, o
|
||||
try:
|
||||
hook(self, self._user)
|
||||
except:
|
||||
self._logger.exception("Error processing authed hook handler for plugin {}".format(name))
|
||||
self._logger.exception("Error processing authed hook handler for plugin {}".format(name),
|
||||
extra=dict(plugin=name))
|
||||
|
||||
@@ -36,7 +36,7 @@ def fix_json_encode():
|
||||
import json
|
||||
|
||||
def fixed_json_encode(value):
|
||||
return json.dumps(value, default=JsonEncoding.encode).replace("</", "<\\/")
|
||||
return json.dumps(value, default=JsonEncoding.encode, allow_nan=False).replace("</", "<\\/")
|
||||
|
||||
import tornado.escape
|
||||
tornado.escape.json_encode = fixed_json_encode
|
||||
|
||||
@@ -21,7 +21,7 @@ from octoprint.server import app, userManager, pluginManager, gettext, \
|
||||
NOT_MODIFIED
|
||||
from octoprint.settings import settings
|
||||
from octoprint.filemanager import full_extension_tree, get_all_extensions
|
||||
from octoprint.util import to_unicode
|
||||
from octoprint.util import to_unicode, to_bytes
|
||||
|
||||
import re
|
||||
import base64
|
||||
@@ -123,18 +123,22 @@ def in_cache():
|
||||
ui_plugins = pluginManager.get_implementations(octoprint.plugin.UiPlugin,
|
||||
sorting_context="UiPlugin.on_ui_render")
|
||||
for plugin in ui_plugins:
|
||||
if plugin.will_handle_ui(request):
|
||||
ui = plugin._identifier
|
||||
key = _cache_key(plugin._identifier,
|
||||
url=url,
|
||||
additional_key_data=plugin.get_ui_additional_key_data_for_cache)
|
||||
unless = _preemptive_unless(url, additional_unless=plugin.get_ui_preemptive_caching_additional_unless)
|
||||
data = _preemptive_data(plugin._identifier,
|
||||
path=path,
|
||||
base_url=base_url,
|
||||
data=plugin.get_ui_data_for_preemptive_caching,
|
||||
additional_request_data=plugin.get_ui_additional_request_data_for_preemptive_caching)
|
||||
break
|
||||
try:
|
||||
if plugin.will_handle_ui(request):
|
||||
ui = plugin._identifier
|
||||
key = _cache_key(plugin._identifier,
|
||||
url=url,
|
||||
additional_key_data=plugin.get_ui_additional_key_data_for_cache)
|
||||
unless = _preemptive_unless(url, additional_unless=plugin.get_ui_preemptive_caching_additional_unless)
|
||||
data = _preemptive_data(plugin._identifier,
|
||||
path=path,
|
||||
base_url=base_url,
|
||||
data=plugin.get_ui_data_for_preemptive_caching,
|
||||
additional_request_data=plugin.get_ui_additional_request_data_for_preemptive_caching)
|
||||
break
|
||||
except Exception:
|
||||
_logger.exception("Error while calling plugin {}, skipping it".format(plugin._identifier),
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
else:
|
||||
ui = "_default"
|
||||
key = _cache_key("_default", url=url)
|
||||
@@ -196,7 +200,10 @@ def index():
|
||||
|
||||
default_additional_etag = [enable_accesscontrol,
|
||||
enable_gcodeviewer,
|
||||
enable_timelapse] + sorted(["{}:{}".format(k, v) for k, v in _plugin_vars.items()])
|
||||
enable_timelapse,
|
||||
wizard_active(_templates.get(locale))] + sorted(["{}:{}".format(to_bytes(k, errors="replace"),
|
||||
to_bytes(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:
|
||||
@@ -401,13 +408,17 @@ def index():
|
||||
# select view from plugins and fall back on default view if no plugin will handle it
|
||||
ui_plugins = pluginManager.get_implementations(octoprint.plugin.UiPlugin, sorting_context="UiPlugin.on_ui_render")
|
||||
for plugin in ui_plugins:
|
||||
if plugin.will_handle_ui(request):
|
||||
# plugin claims responsibility, let it render the UI
|
||||
response = plugin_view(plugin)
|
||||
if response is not None:
|
||||
break
|
||||
else:
|
||||
_logger.warn("UiPlugin {} returned an empty response".format(plugin._identifier))
|
||||
try:
|
||||
if plugin.will_handle_ui(request):
|
||||
# plugin claims responsibility, let it render the UI
|
||||
response = plugin_view(plugin)
|
||||
if response is not None:
|
||||
break
|
||||
else:
|
||||
_logger.warn("UiPlugin {} returned an empty response".format(plugin._identifier))
|
||||
except Exception:
|
||||
_logger.exception("Error while calling plugin {}, skipping it".format(plugin._identifier),
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
else:
|
||||
response = default_view()
|
||||
|
||||
@@ -506,7 +517,9 @@ def fetch_template_data(refresh=False):
|
||||
try:
|
||||
result = hook(dict(template_sorting), dict(template_rules))
|
||||
except:
|
||||
_logger.exception("Error while retrieving custom template type definitions from plugin {name}".format(**locals()))
|
||||
_logger.exception("Error while retrieving custom template type "
|
||||
"definitions from plugin {name}".format(**locals()),
|
||||
extra=dict(plugin=name))
|
||||
else:
|
||||
if not isinstance(result, list):
|
||||
continue
|
||||
@@ -647,7 +660,8 @@ def fetch_template_data(refresh=False):
|
||||
wizard_required = implementation.is_wizard_required()
|
||||
wizard_ignored = octoprint.plugin.WizardPlugin.is_wizard_ignored(seen_wizards, implementation)
|
||||
except:
|
||||
_logger.exception("Error while retrieving template data for plugin {}, ignoring it".format(name))
|
||||
_logger.exception("Error while retrieving template data for plugin {}, ignoring it".format(name),
|
||||
extra=dict(plugin=name))
|
||||
continue
|
||||
|
||||
if not isinstance(vars, dict):
|
||||
|
||||
@@ -88,6 +88,7 @@ default_settings = {
|
||||
"serial": {
|
||||
"port": None,
|
||||
"baudrate": None,
|
||||
"exclusive": True,
|
||||
"autoconnect": False,
|
||||
"log": False,
|
||||
"timeout": {
|
||||
@@ -115,6 +116,7 @@ default_settings = {
|
||||
"longRunningCommands": ["G4", "G28", "G29", "G30", "G32", "M400", "M226", "M600"],
|
||||
"blockedCommands": ["M0", "M1"],
|
||||
"pausingCommands": ["M0", "M1", "M25"],
|
||||
"emergencyCommands": ["M112", "M108", "M410"],
|
||||
"checksumRequiringCommands": ["M110"],
|
||||
"helloCommand": "M110 N0",
|
||||
"disconnectOnErrors": True,
|
||||
@@ -142,6 +144,9 @@ default_settings = {
|
||||
"supportFAsCommand": False,
|
||||
"firmwareDetection": True,
|
||||
"blockWhileDwelling": False,
|
||||
"useParityWorkaround": "detect",
|
||||
"maxConsecutiveResends": 10,
|
||||
"sendM112OnError": True,
|
||||
|
||||
"capabilities": {
|
||||
"autoreport_temp": True,
|
||||
@@ -158,6 +163,7 @@ default_settings = {
|
||||
"port": 5000,
|
||||
"firstRun": True,
|
||||
"startOnceInSafeMode": False,
|
||||
"ignoreIncompleteStartup": False,
|
||||
"incompleteStartup": False,
|
||||
"seenWizards": {},
|
||||
"secretKey": None,
|
||||
@@ -251,6 +257,7 @@ default_settings = {
|
||||
"keyboardControl": True,
|
||||
"pollWatched": False,
|
||||
"modelSizeDetection": True,
|
||||
"printStartConfirmation": False,
|
||||
"printCancelConfirmation": True,
|
||||
"autoUppercaseBlacklist": ["M117", "M118"],
|
||||
"g90InfluencesExtruder": False
|
||||
@@ -294,6 +301,7 @@ default_settings = {
|
||||
"defaultLanguage": "_default",
|
||||
"showFahrenheitAlso": False,
|
||||
"fuzzyTimes": True,
|
||||
"closeModalsWithClick": True,
|
||||
"components": {
|
||||
"order": {
|
||||
"navbar": ["settings", "systemmenu", "plugin_announcements", "plugin_pi_support", "login"],
|
||||
@@ -334,7 +342,10 @@ default_settings = {
|
||||
"localNetworks": ["127.0.0.0/8", "::1/128"],
|
||||
"autologinAs": None,
|
||||
"trustBasicAuthentication": False,
|
||||
"checkBasicAuthenticationPassword": True
|
||||
"checkBasicAuthenticationPassword": True,
|
||||
"trustRemoteUser": False,
|
||||
"remoteUserHeader": "REMOTE_USER",
|
||||
"addRemoteUsers": False
|
||||
},
|
||||
"slicing": {
|
||||
"enabled": True,
|
||||
|
||||
@@ -139,7 +139,8 @@ class SlicingManager(object):
|
||||
try:
|
||||
slicers[plugin.get_slicer_properties()["type"]] = plugin
|
||||
except:
|
||||
self._logger.exception("Error while getting properties from slicer {}, ignoring it".format(plugin._identifier))
|
||||
self._logger.exception("Error while getting properties from slicer {}, ignoring it".format(plugin._identifier),
|
||||
extra=dict(plugin=plugin._identifier))
|
||||
continue
|
||||
self._slicers = slicers
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ GCODE.gCodeReader = (function(){
|
||||
lines = [];
|
||||
};
|
||||
|
||||
var sortLayers = function(){
|
||||
var sortLayers = function(m){
|
||||
var sortedZ = [];
|
||||
var tmpModel = [];
|
||||
|
||||
@@ -68,19 +68,18 @@ GCODE.gCodeReader = (function(){
|
||||
|
||||
for(var i=0;i<sortedZ.length;i++){
|
||||
if(typeof(z_heights[sortedZ[i]]) === 'undefined')continue;
|
||||
tmpModel[i] = model[z_heights[sortedZ[i]]];
|
||||
tmpModel[i] = m[z_heights[sortedZ[i]]];
|
||||
}
|
||||
model = tmpModel;
|
||||
delete tmpModel;
|
||||
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");
|
||||
@@ -97,34 +96,36 @@ GCODE.gCodeReader = (function(){
|
||||
}
|
||||
|
||||
var elements = percentageTree.findBest(key);
|
||||
if (elements.length == 0) {
|
||||
if (elements.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return elements[0];
|
||||
};
|
||||
|
||||
var purgeLayers = function(){
|
||||
if(!model) return;
|
||||
var purgeLayers = function(m){
|
||||
if(!m) return;
|
||||
var tmpModel = [];
|
||||
|
||||
var purge;
|
||||
for(var i = 0; i < model.length; i++){
|
||||
for(var i = 0; i < m.length; i++){
|
||||
purge = true;
|
||||
|
||||
if (typeof(model[i]) !== "undefined") {
|
||||
for (var j = 0; j < model[i].length; j++) {
|
||||
if(model[i][j].extrude) {
|
||||
if (typeof(m[i]) !== "undefined") {
|
||||
for (var j = 0; j < m[i].length; j++) {
|
||||
if(m[i][j].extrude) {
|
||||
purge = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (purge) {
|
||||
model.splice(i, 1);
|
||||
i--;
|
||||
if (!purge) {
|
||||
tmpModel.push(m[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return tmpModel;
|
||||
};
|
||||
|
||||
// ***** PUBLIC *******
|
||||
@@ -177,10 +178,12 @@ GCODE.gCodeReader = (function(){
|
||||
},
|
||||
|
||||
passDataToRenderer: function(){
|
||||
if (gCodeOptions["sortLayers"]) sortLayers();
|
||||
if (gCodeOptions["purgeEmptyLayers"]) purgeLayers();
|
||||
prepareLinesIndex();
|
||||
GCODE.renderer.doRender(model, 0);
|
||||
var m = model;
|
||||
if (gCodeOptions["sortLayers"]) m = sortLayers(m);
|
||||
if (gCodeOptions["purgeEmptyLayers"]) m = purgeLayers(m);
|
||||
prepareLinesIndex(m);
|
||||
GCODE.renderer.doRender(m, 0);
|
||||
return m;
|
||||
},
|
||||
|
||||
processLayerFromWorker: function(msg){
|
||||
|
||||
@@ -86,6 +86,10 @@ GCODE.renderer = (function(){
|
||||
}
|
||||
|
||||
var reRender = function(){
|
||||
if (!model) return;
|
||||
|
||||
log.debug("Rerendering layer " + layerNumStore + " of " + model.length + " with " + GCODE.renderer.getLayerNumSegments(layerNumStore) + " segments");
|
||||
|
||||
notifyIfViewportChanged();
|
||||
|
||||
var p1 = ctx.transformedPoint(0,0);
|
||||
@@ -356,6 +360,11 @@ GCODE.renderer = (function(){
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
|
||||
// draw origin
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, 2, 0, Math.PI * 2, true);
|
||||
ctx.stroke();
|
||||
|
||||
ctx.strokeStyle = renderOptions["colorGrid"];
|
||||
ctx.lineWidth = lineWidthFactor;
|
||||
|
||||
@@ -409,6 +418,11 @@ GCODE.renderer = (function(){
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
|
||||
// draw origin
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, 2, 0, Math.PI * 2, true);
|
||||
ctx.stroke();
|
||||
|
||||
ctx.strokeStyle = renderOptions["colorGrid"];
|
||||
ctx.lineWidth = lineWidthFactor;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -153,7 +153,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");
|
||||
@@ -174,7 +174,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
|
||||
});
|
||||
}
|
||||
@@ -266,6 +266,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);
|
||||
|
||||
@@ -21,6 +21,7 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor
|
||||
self.currentSorting = ko.observable(self.defaultSorting);
|
||||
self.currentFilters = ko.observableArray(self.defaultFilters);
|
||||
self.selectedItem = ko.observable(undefined);
|
||||
self.filterSearch = ko.observable(true);
|
||||
|
||||
self.storageIds = {
|
||||
"currentSorting": self.listType + "." + "currentSorting",
|
||||
@@ -223,6 +224,19 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor
|
||||
|
||||
//~~ filtering
|
||||
|
||||
self.setFilterSearch = function(enabled) {
|
||||
if (self.filterSearch() === enabled)
|
||||
return;
|
||||
|
||||
self.filterSearch(enabled);
|
||||
self.changePage(0);
|
||||
self._updateItems();
|
||||
};
|
||||
|
||||
self.toggleFilterSearch = function() {
|
||||
self.setFilterSearch(!self.filterSearch());
|
||||
};
|
||||
|
||||
self.toggleFilter = function(filter) {
|
||||
if (!_.contains(_.keys(self.supportedFilters), filter))
|
||||
return;
|
||||
@@ -283,15 +297,19 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor
|
||||
// work on all items
|
||||
var result = self.allItems;
|
||||
|
||||
// filter if necessary
|
||||
var filters = self.currentFilters();
|
||||
_.each(filters, function(filter) {
|
||||
if (typeof filter !== 'undefined' && typeof supportedFilters[filter] !== 'undefined')
|
||||
result = _.filter(result, supportedFilters[filter]);
|
||||
});
|
||||
var hasSearch = typeof self.searchFunction !== 'undefined' && self.searchFunction;
|
||||
|
||||
// filter if we're not searching or have search filtering enabled
|
||||
if (!hasSearch || self.filterSearch()) {
|
||||
var filters = self.currentFilters();
|
||||
_.each(filters, function (filter) {
|
||||
if (typeof filter !== 'undefined' && typeof supportedFilters[filter] !== 'undefined')
|
||||
result = _.filter(result, supportedFilters[filter]);
|
||||
});
|
||||
}
|
||||
|
||||
// search if necessary
|
||||
if (typeof self.searchFunction !== 'undefined' && self.searchFunction) {
|
||||
if (hasSearch) {
|
||||
result = _.filter(result, self.searchFunction);
|
||||
}
|
||||
|
||||
@@ -558,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) {
|
||||
|
||||
@@ -708,6 +708,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
|
||||
|
||||
@@ -177,6 +177,10 @@ $(function() {
|
||||
self.requestData();
|
||||
};
|
||||
|
||||
self.onEventDisconnected = function() {
|
||||
self.requestData();
|
||||
};
|
||||
|
||||
self.onStartup = function() {
|
||||
var connectionTab = $("#connection");
|
||||
connectionTab.on("show", function() {
|
||||
|
||||
@@ -203,9 +203,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)) {
|
||||
@@ -216,12 +215,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) {
|
||||
@@ -460,7 +460,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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1107,10 +1120,12 @@ $(function() {
|
||||
}).sort();
|
||||
extensions = extensions.join(", ");
|
||||
var error = "<p>"
|
||||
+ _.sprintf(gettext("Could not upload the file. Make sure that it is a valid file with one of these extensions: %(extensions)s"),
|
||||
+ _.sprintf(gettext("Could not upload the file. Make sure that it is a readable, valid file with one of these extensions: %(extensions)s"),
|
||||
{extensions: extensions})
|
||||
+ "</p>";
|
||||
error += pnotifyAdditionalInfo("<pre>" + data.jqXHR.responseText + "</pre>");
|
||||
if (data.jqXHR.responseText) {
|
||||
error += pnotifyAdditionalInfo("<pre>" + data.jqXHR.responseText + "</pre>");
|
||||
}
|
||||
new PNotify({
|
||||
title: "Upload failed",
|
||||
text: error,
|
||||
|
||||
@@ -139,34 +139,27 @@ $(function() {
|
||||
var currentProfileData = self.settings.printerProfiles.currentProfileData();
|
||||
if (!currentProfileData) return;
|
||||
|
||||
var options = {
|
||||
reader: {},
|
||||
renderer: {}
|
||||
};
|
||||
var dirty = false;
|
||||
|
||||
var toolOffsets = self._retrieveToolOffsets(currentProfileData);
|
||||
if (toolOffsets) {
|
||||
GCODE.ui.updateOptions({
|
||||
reader: {
|
||||
toolOffsets: toolOffsets
|
||||
}
|
||||
});
|
||||
options.reader.toolOffsets = toolOffsets;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
var bedDimensions = self._retrieveBedDimensions(currentProfileData);
|
||||
if (bedDimensions) {
|
||||
GCODE.ui.updateOptions({
|
||||
renderer: {
|
||||
bed: bedDimensions
|
||||
},
|
||||
reader: {
|
||||
bed: bedDimensions
|
||||
}
|
||||
});
|
||||
options.renderer.bed = bedDimensions;
|
||||
options.reader.bed = bedDimensions;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
var axesConfiguration = self._retrieveAxesConfiguration(currentProfileData);
|
||||
if (axesConfiguration) {
|
||||
GCODE.ui.updateOptions({
|
||||
renderer: {
|
||||
invertAxes: axesConfiguration
|
||||
}
|
||||
});
|
||||
if (dirty) {
|
||||
GCODE.ui.updateOptions(options);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -538,7 +531,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);
|
||||
|
||||
@@ -30,9 +30,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);
|
||||
@@ -62,7 +63,7 @@ $(function() {
|
||||
if (self.estimatedPrintTime())
|
||||
return fmt(self.estimatedPrintTime());
|
||||
return "-";
|
||||
}
|
||||
};
|
||||
self.estimatedPrintTimeString = ko.pureComputed(function() {
|
||||
return estimatedPrintTimeStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration);
|
||||
});
|
||||
@@ -95,7 +96,7 @@ $(function() {
|
||||
} else {
|
||||
return fmt(self.printTimeLeft());
|
||||
}
|
||||
}
|
||||
};
|
||||
self.printTimeLeftString = ko.pureComputed(function() {
|
||||
return printTimeLeftStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration);
|
||||
});
|
||||
@@ -194,6 +195,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);
|
||||
};
|
||||
@@ -228,7 +238,7 @@ $(function() {
|
||||
self.isReady(data.flags.ready);
|
||||
self.isSdReady(data.flags.sdReady);
|
||||
|
||||
if (self.isPaused() != prevPaused) {
|
||||
if (self.isPaused() !== prevPaused) {
|
||||
if (self.isPaused()) {
|
||||
self.titlePrintButton(self.TITLE_PRINT_BUTTON_PAUSED);
|
||||
self.titlePauseButton(self.TITLE_PAUSE_BUTTON_PAUSED);
|
||||
@@ -245,12 +255,14 @@ $(function() {
|
||||
self.filepath(data.file.path);
|
||||
self.filesize(data.file.size);
|
||||
self.filedisplay(data.file.display);
|
||||
self.sd(data.file.origin == "sdcard");
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -258,7 +270,7 @@ $(function() {
|
||||
self.lastPrintTime(data.lastPrintTime);
|
||||
|
||||
var result = [];
|
||||
if (data.filament && typeof(data.filament) == "object" && _.keys(data.filament).length > 0) {
|
||||
if (data.filament && typeof(data.filament) === "object" && _.keys(data.filament).length > 0) {
|
||||
var keys = _.keys(data.filament);
|
||||
keys.sort();
|
||||
_.each(keys, function(key) {
|
||||
@@ -310,7 +322,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
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -114,6 +114,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);
|
||||
|
||||
@@ -143,12 +144,14 @@ $(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);
|
||||
|
||||
self.serial_port = ko.observable();
|
||||
self.serial_baudrate = ko.observable();
|
||||
self.serial_exclusive = ko.observable();
|
||||
self.serial_portOptions = ko.observableArray([]);
|
||||
self.serial_baudrateOptions = ko.observableArray([]);
|
||||
self.serial_autoconnect = ko.observable(undefined);
|
||||
@@ -170,6 +173,7 @@ $(function() {
|
||||
self.serial_checksumRequiringCommands = ko.observable(undefined);
|
||||
self.serial_blockedCommands = ko.observable(undefined);
|
||||
self.serial_pausingCommands = ko.observable(undefined);
|
||||
self.serial_emergencyCommands = ko.observable(undefined);
|
||||
self.serial_helloCommand = ko.observable(undefined);
|
||||
self.serial_serialErrorBehaviour = ko.observable("cancel");
|
||||
self.serial_triggerOkForM29 = ko.observable(undefined);
|
||||
@@ -183,6 +187,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);
|
||||
@@ -194,6 +199,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.folder_uploads = ko.observable(undefined);
|
||||
self.folder_timelapse = ko.observable(undefined);
|
||||
@@ -356,7 +362,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) {
|
||||
@@ -380,7 +387,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) {
|
||||
@@ -390,7 +397,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);
|
||||
}
|
||||
@@ -780,6 +787,7 @@ $(function() {
|
||||
checksumRequiringCommands: function() { return splitTextToArray(self.serial_checksumRequiringCommands(), ",", true) },
|
||||
blockedCommands: function() { return splitTextToArray(self.serial_blockedCommands(), ",", true) },
|
||||
pausingCommands: function() { return splitTextToArray(self.serial_pausingCommands(), ",", true) },
|
||||
emergencyCommands: function() {return splitTextToArray(self.serial_emergencyCommands(), ",", true) },
|
||||
externalHeatupDetection: function() { return !self.serial_disableExternalHeatupDetection()},
|
||||
alwaysSendChecksum: function() { return self.serial_sendChecksum() === "always"},
|
||||
neverSendChecksum: function() { return self.serial_sendChecksum() === "never"},
|
||||
@@ -919,6 +927,7 @@ $(function() {
|
||||
checksumRequiringCommands: function(value) { self.serial_checksumRequiringCommands(value.join(", "))},
|
||||
blockedCommands: function(value) { self.serial_blockedCommands(value.join(", "))},
|
||||
pausingCommands: function(value) { self.serial_pausingCommands(value.join(", "))},
|
||||
emergencyCommands: function(value) { self.serial_emergencyCommands(value.join(", "))},
|
||||
externalHeatupDetection: function(value) { self.serial_disableExternalHeatupDetection(!value) },
|
||||
alwaysSendChecksum: function(value) { if (value) { self.serial_sendChecksum("always")}},
|
||||
neverSendChecksum: function(value) { if (value) { self.serial_sendChecksum("never")}},
|
||||
|
||||
@@ -338,6 +338,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
|
||||
|
||||
@@ -38,25 +38,28 @@ $(function() {
|
||||
self.changePasswordDialog = undefined;
|
||||
|
||||
self.currentUser.subscribe(function(newValue) {
|
||||
if (newValue === undefined) {
|
||||
self.editorUsername(undefined);
|
||||
self.editorAdmin(undefined);
|
||||
self.editorActive(undefined);
|
||||
self.editorApikey(undefined);
|
||||
} else {
|
||||
self.resetEditUser();
|
||||
if (newValue !== undefined) {
|
||||
self.editorUsername(newValue.name);
|
||||
self.editorAdmin(newValue.admin);
|
||||
self.editorActive(newValue.active);
|
||||
self.editorApikey(newValue.apikey);
|
||||
}
|
||||
self.editorPassword(undefined);
|
||||
self.editorRepeatedPassword(undefined);
|
||||
});
|
||||
|
||||
self.editorPasswordMismatch = ko.pureComputed(function() {
|
||||
return self.editorPassword() !== self.editorRepeatedPassword();
|
||||
});
|
||||
|
||||
self.resetEditUser = function() {
|
||||
self.editorUsername(undefined);
|
||||
self.editorAdmin(undefined);
|
||||
self.editorActive(undefined);
|
||||
self.editorApikey(undefined);
|
||||
self.editorPassword(undefined);
|
||||
self.editorRepeatedPassword(undefined);
|
||||
};
|
||||
|
||||
self.requestData = function() {
|
||||
if (!CONFIG_ACCESS_CONTROL) return;
|
||||
if (!self.loginState.isAdmin()) return;
|
||||
@@ -178,8 +181,19 @@ $(function() {
|
||||
|
||||
self.onStartup = function() {
|
||||
self.addUserDialog = $("#settings-usersDialogAddUser");
|
||||
self.addUserDialog.on("hidden", function() {
|
||||
self.resetEditUser();
|
||||
});
|
||||
|
||||
self.editUserDialog = $("#settings-usersDialogEditUser");
|
||||
self.editUserDialog.on("hidden", function() {
|
||||
self.resetEditUser();
|
||||
});
|
||||
|
||||
self.changePasswordDialog = $("#settings-usersDialogChangePassword");
|
||||
self.changePasswordDialog.on("hidden", function() {
|
||||
self.resetEditUser();
|
||||
});
|
||||
};
|
||||
|
||||
//~~ API calls
|
||||
|
||||
+44
-40
@@ -1,5 +1,5 @@
|
||||
/* ===========================================================
|
||||
* bootstrap-modal.js v2.1
|
||||
* bootstrap-modal.js v2.2.5
|
||||
* ===========================================================
|
||||
* Copyright 2012 Jordan Schroter
|
||||
*
|
||||
@@ -33,12 +33,17 @@
|
||||
constructor: Modal,
|
||||
|
||||
init: function (element, options) {
|
||||
var that = this;
|
||||
|
||||
this.options = options;
|
||||
|
||||
this.$element = $(element)
|
||||
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this));
|
||||
|
||||
this.options.remote && this.$element.find('.modal-body').load(this.options.remote);
|
||||
this.options.remote && this.$element.find('.modal-body').load(this.options.remote, function () {
|
||||
var e = $.Event('loaded');
|
||||
that.$element.trigger(e);
|
||||
});
|
||||
|
||||
var manager = typeof this.options.manager === 'function' ?
|
||||
this.options.manager.call(this) : this.options.manager;
|
||||
@@ -76,7 +81,7 @@
|
||||
|
||||
this.$element.trigger(e);
|
||||
|
||||
if (!this.isShown || e.isDefaultPrevented()) return (this.isShown = false);
|
||||
if (!this.isShown || e.isDefaultPrevented()) return;
|
||||
|
||||
this.isShown = false;
|
||||
|
||||
@@ -126,8 +131,6 @@
|
||||
.css(prop, '')
|
||||
.css('min-height', '');
|
||||
|
||||
var modalOverflow = $(window).height() - 10 < this.$element.height();
|
||||
|
||||
if (value){
|
||||
this.$element.find('.modal-body')
|
||||
.css('overflow', 'auto')
|
||||
@@ -139,6 +142,8 @@
|
||||
.css('min-height', minHeight);
|
||||
}
|
||||
|
||||
var modalOverflow = $(window).height() - 10 < this.$element.height();
|
||||
|
||||
if (modalOverflow || this.options.modalOverflow) {
|
||||
this.$element
|
||||
.css('margin-top', 0)
|
||||
@@ -156,23 +161,24 @@
|
||||
if (this.isShown && this.options.consumeTab) {
|
||||
this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) {
|
||||
if (e.keyCode && e.keyCode == 9){
|
||||
var $next = $(this),
|
||||
$rollover = $(this);
|
||||
var elements = [],
|
||||
tabindex = Number($(this).data('tabindex'));
|
||||
|
||||
that.$element.find('[data-tabindex]:enabled:not([readonly])').each(function (e) {
|
||||
if (!e.shiftKey){
|
||||
$next = $next.data('tabindex') < $(this).data('tabindex') ?
|
||||
$next = $(this) :
|
||||
$rollover = $(this);
|
||||
} else {
|
||||
$next = $next.data('tabindex') > $(this).data('tabindex') ?
|
||||
$next = $(this) :
|
||||
$rollover = $(this);
|
||||
}
|
||||
that.$element.find('[data-tabindex]:enabled:visible:not([readonly])').each(function (ev) {
|
||||
elements.push(Number($(this).data('tabindex')));
|
||||
});
|
||||
elements.sort(function(a,b){return a-b});
|
||||
|
||||
$next[0] !== $(this)[0] ?
|
||||
$next.focus() : $rollover.focus();
|
||||
var arrayPos = $.inArray(tabindex, elements);
|
||||
if (!e.shiftKey){
|
||||
arrayPos < elements.length-1 ?
|
||||
that.$element.find('[data-tabindex='+elements[arrayPos+1]+']').focus() :
|
||||
that.$element.find('[data-tabindex='+elements[0]+']').focus();
|
||||
} else {
|
||||
arrayPos == 0 ?
|
||||
that.$element.find('[data-tabindex='+elements[elements.length-1]+']').focus() :
|
||||
that.$element.find('[data-tabindex='+elements[arrayPos-1]+']').focus();
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
@@ -209,10 +215,6 @@
|
||||
},
|
||||
|
||||
hideModal: function () {
|
||||
this.$element
|
||||
.hide()
|
||||
.trigger('hidden');
|
||||
|
||||
var prop = this.options.height ? 'height' : 'max-height';
|
||||
var value = this.options.height || this.options.maxHeight;
|
||||
|
||||
@@ -222,6 +224,9 @@
|
||||
.css(prop, '');
|
||||
}
|
||||
|
||||
this.$element
|
||||
.hide()
|
||||
.trigger('hidden');
|
||||
},
|
||||
|
||||
removeLoading: function () {
|
||||
@@ -297,28 +302,26 @@
|
||||
|
||||
destroy: function () {
|
||||
var e = $.Event('destroy');
|
||||
|
||||
this.$element.trigger(e);
|
||||
|
||||
if (e.isDefaultPrevented()) return;
|
||||
|
||||
this.teardown();
|
||||
},
|
||||
|
||||
teardown: function () {
|
||||
if (!this.$parent.length){
|
||||
this.$element.remove();
|
||||
this.$element = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.$parent !== this.$element.parent()){
|
||||
this.$element.appendTo(this.$parent);
|
||||
}
|
||||
|
||||
this.$element.off('.modal');
|
||||
this.$element.removeData('modal');
|
||||
this.$element
|
||||
.off('.modal')
|
||||
.removeData('modal')
|
||||
.removeClass('in')
|
||||
.attr('aria-hidden', true);
|
||||
|
||||
if (this.$parent !== this.$element.parent()) {
|
||||
this.$element.appendTo(this.$parent);
|
||||
} else if (!this.$parent.length) {
|
||||
// modal is not part of the DOM so remove it.
|
||||
this.$element.remove();
|
||||
this.$element = null;
|
||||
}
|
||||
|
||||
this.$element.trigger('destroyed');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -354,7 +357,8 @@
|
||||
resize: false,
|
||||
attentionAnimation: 'shake',
|
||||
manager: 'body',
|
||||
spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>'
|
||||
spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',
|
||||
backdropTemplate: '<div class="modal-backdrop" />'
|
||||
};
|
||||
|
||||
$.fn.modal.Constructor = Modal;
|
||||
|
||||
+60
-49
@@ -1,5 +1,5 @@
|
||||
/* ===========================================================
|
||||
* bootstrap-modalmanager.js v2.1
|
||||
* bootstrap-modalmanager.js v2.2.5
|
||||
* ===========================================================
|
||||
* Copyright 2012 Jordan Schroter.
|
||||
*
|
||||
@@ -79,15 +79,14 @@
|
||||
modal.$element.appendTo(modal.$container);
|
||||
|
||||
that.backdrop(modal, function () {
|
||||
|
||||
modal.$element.show();
|
||||
|
||||
if (transition) {
|
||||
//modal.$element[0].style.display = 'run-in';
|
||||
if (transition) {
|
||||
//modal.$element[0].style.display = 'run-in';
|
||||
modal.$element[0].offsetWidth;
|
||||
//modal.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' });
|
||||
//modal.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' });
|
||||
}
|
||||
|
||||
|
||||
modal.layout();
|
||||
|
||||
modal.$element
|
||||
@@ -111,48 +110,40 @@
|
||||
}));
|
||||
|
||||
modal.$element.on('hidden.modalmanager', targetIsSelf(function (e) {
|
||||
|
||||
that.backdrop(modal);
|
||||
|
||||
if (modal.$backdrop){
|
||||
$.support.transition && modal.$element.hasClass('fade') ?
|
||||
modal.$backdrop.one($.support.transition.end, function () { that.destroyModal(modal) }) :
|
||||
that.destroyModal(modal);
|
||||
} else {
|
||||
// handle the case when a modal may have been removed from the dom before this callback executes
|
||||
if (!modal.$element.parent().length) {
|
||||
that.destroyModal(modal);
|
||||
} else if (modal.$backdrop){
|
||||
var transition = $.support.transition && modal.$element.hasClass('fade');
|
||||
|
||||
// trigger a relayout due to firebox's buggy transition end event
|
||||
if (transition) { modal.$element[0].offsetWidth; }
|
||||
$.support.transition && modal.$element.hasClass('fade') ?
|
||||
modal.$backdrop.one($.support.transition.end, function () { modal.destroy(); }) :
|
||||
modal.destroy();
|
||||
} else {
|
||||
modal.destroy();
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
modal.$element.on('destroy.modalmanager', targetIsSelf(function (e) {
|
||||
that.removeModal(modal);
|
||||
modal.$element.on('destroyed.modalmanager', targetIsSelf(function (e) {
|
||||
that.destroyModal(modal);
|
||||
}));
|
||||
|
||||
},
|
||||
|
||||
destroyModal: function (modal) {
|
||||
|
||||
modal.destroy();
|
||||
|
||||
var hasOpenModal = this.hasOpenModal();
|
||||
|
||||
this.$element.toggleClass('modal-open', hasOpenModal);
|
||||
|
||||
if (!hasOpenModal){
|
||||
this.$element.removeClass('page-overflow');
|
||||
getOpenModals: function () {
|
||||
var openModals = [];
|
||||
for (var i = 0; i < this.stack.length; i++){
|
||||
if (this.stack[i].isShown) openModals.push(this.stack[i]);
|
||||
}
|
||||
|
||||
this.removeContainer(modal);
|
||||
|
||||
this.setFocus();
|
||||
return openModals;
|
||||
},
|
||||
|
||||
hasOpenModal: function () {
|
||||
for (var i = 0; i < this.stack.length; i++){
|
||||
if (this.stack[i].isShown) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return this.getOpenModals().length > 0;
|
||||
},
|
||||
|
||||
setFocus: function () {
|
||||
@@ -165,13 +156,24 @@
|
||||
if (!topModal) return;
|
||||
|
||||
topModal.focus();
|
||||
|
||||
},
|
||||
|
||||
removeModal: function (modal) {
|
||||
destroyModal: function (modal) {
|
||||
modal.$element.off('.modalmanager');
|
||||
if (modal.$backdrop) this.removeBackdrop.call(modal);
|
||||
if (modal.$backdrop) this.removeBackdrop(modal);
|
||||
this.stack.splice(this.getIndexOfModal(modal), 1);
|
||||
|
||||
var hasOpenModal = this.hasOpenModal();
|
||||
|
||||
this.$element.toggleClass('modal-open', hasOpenModal);
|
||||
|
||||
if (!hasOpenModal){
|
||||
this.$element.removeClass('page-overflow');
|
||||
}
|
||||
|
||||
this.removeContainer(modal);
|
||||
|
||||
this.setFocus();
|
||||
},
|
||||
|
||||
getModalAt: function (index) {
|
||||
@@ -209,11 +211,12 @@
|
||||
modal.$backdrop = null;
|
||||
},
|
||||
|
||||
createBackdrop: function (animate) {
|
||||
createBackdrop: function (animate, tmpl) {
|
||||
var $backdrop;
|
||||
|
||||
if (!this.$backdropHandle) {
|
||||
$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||
$backdrop = $(tmpl)
|
||||
.addClass(animate)
|
||||
.appendTo(this.$element);
|
||||
} else {
|
||||
$backdrop = this.$backdropHandle;
|
||||
@@ -222,7 +225,7 @@
|
||||
this.isLoading && this.removeSpinner();
|
||||
}
|
||||
|
||||
return $backdrop
|
||||
return $backdrop;
|
||||
},
|
||||
|
||||
removeContainer: function (modal) {
|
||||
@@ -234,8 +237,7 @@
|
||||
var $container;
|
||||
|
||||
$container = $('<div class="modal-scrollable">')
|
||||
.css('z-index', getzIndex( 'modal',
|
||||
modal ? this.getIndexOfModal(modal) : this.stack.length ))
|
||||
.css('z-index', getzIndex('modal', this.getOpenModals().length))
|
||||
.appendTo(this.$element);
|
||||
|
||||
if (modal && modal.options.backdrop != 'static') {
|
||||
@@ -260,9 +262,9 @@
|
||||
if (modal.isShown && showBackdrop) {
|
||||
var doAnimate = $.support.transition && animate && !this.$backdropHandle;
|
||||
|
||||
modal.$backdrop = this.createBackdrop(animate);
|
||||
modal.$backdrop = this.createBackdrop(animate, modal.options.backdropTemplate);
|
||||
|
||||
modal.$backdrop.css('z-index', getzIndex( 'backdrop', this.getIndexOfModal(modal) ));
|
||||
modal.$backdrop.css('z-index', getzIndex( 'backdrop', this.getOpenModals().length ));
|
||||
|
||||
if (doAnimate) modal.$backdrop[0].offsetWidth; // force reflow
|
||||
|
||||
@@ -311,16 +313,18 @@
|
||||
|
||||
if (!this.isLoading) {
|
||||
|
||||
this.$backdropHandle = this.createBackdrop('fade');
|
||||
this.$backdropHandle = this.createBackdrop('fade', this.options.backdropTemplate);
|
||||
|
||||
this.$backdropHandle[0].offsetWidth; // force reflow
|
||||
|
||||
var openModals = this.getOpenModals();
|
||||
|
||||
this.$backdropHandle
|
||||
.css('z-index', getzIndex('backdrop', this.stack.length))
|
||||
.css('z-index', getzIndex('backdrop', openModals.length + 1))
|
||||
.addClass('in');
|
||||
|
||||
var $spinner = $(this.options.spinner)
|
||||
.css('z-index', getzIndex('modal', this.stack.length))
|
||||
.css('z-index', getzIndex('modal', openModals.length + 1))
|
||||
.appendTo(this.$element)
|
||||
.addClass('in');
|
||||
|
||||
@@ -381,7 +385,7 @@
|
||||
// if Boostsrap namespaced events, this would not be needed.
|
||||
function targetIsSelf(callback){
|
||||
return function (e) {
|
||||
if (this === e.target){
|
||||
if (e && this === e.target){
|
||||
return callback.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
@@ -404,9 +408,16 @@
|
||||
$.fn.modalmanager.defaults = {
|
||||
backdropLimit: 999,
|
||||
resize: true,
|
||||
spinner: '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>'
|
||||
spinner: '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',
|
||||
backdropTemplate: '<div class="modal-backdrop" />'
|
||||
};
|
||||
|
||||
$.fn.modalmanager.Constructor = ModalManager
|
||||
|
||||
// ModalManager handles the modal-open class so we need
|
||||
// to remove conflicting bootstrap 3 event handlers
|
||||
$(function () {
|
||||
$(document).off('show.bs.modal').off('hidden.bs.modal');
|
||||
});
|
||||
|
||||
}(jQuery);
|
||||
@@ -9,11 +9,11 @@
|
||||
</thead>
|
||||
<tbody data-bind="foreach: users.listHelper.paginatedItems">
|
||||
<tr>
|
||||
<td class="settings_users_name"><span data-bind="text: name"></span><span class="muted" data-bind="visible: apikey"><br /><small>{{ _('API Key') }}: <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></small></span></td>
|
||||
<td class="settings_users_name"><span data-bind="text: name"></span><span class="muted" data-bind="visible: apikey"><br /><small>{{ _('API Key') }}: <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></small></span></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_admin"><i class="fa" data-bind="css: { 'fa-check-square-o': admin, 'fa-square-o': !admin }"></i></td>
|
||||
<td class="settings_users_actions">
|
||||
<a href="#" class="fa fa-pencil" title="{{ _('Update User') }}" data-bind="click: function() { $root.users.showEditUserDialog($data); }"></a> | <a href="#" class="fa fa-key" title="{{ _('Change password') }}" data-bind="click: function() { $root.users.showChangePasswordDialog($data); }"></a> | <a href="#" class="fa fa-trash-o" title="{{ _('Delete user') }}" data-bind="click: function() { $root.users.removeUser($data); }"></a>
|
||||
<a href="#" class="fa fa-pencil" title="{{ _('Update User')|edq }}" data-bind="click: function() { $root.users.showEditUserDialog($data); }"></a> | <a href="#" class="fa fa-key" title="{{ _('Change password')|edq }}" data-bind="click: function() { $root.users.showChangePasswordDialog($data); }"></a> | <a href="#" class="fa fa-trash-o" title="{{ _('Delete user')|edq }}" data-bind="click: function() { $root.users.removeUser($data); }"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -137,7 +137,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.users.editorApikey, valueUpdate: 'input', attr: {placeholder: '{{ _('N/A') }}'}">
|
||||
<input type="text" readonly="readonly" data-bind="value: $root.users.editorApikey, valueUpdate: 'input', attr: {placeholder: '{{ _('N/A')|esq }}'}">
|
||||
<a class="btn add-on" title="Copy API Key to clipboard" data-bind="click: $root.users.copyApikey, css: {'disabled': !$root.users.editorApikey()}"><i class="fa fa-copy"></i></a>
|
||||
<a class="btn add-on" title="Generate new API Key" data-bind="click: function() { $root.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.users.confirmDeleteApikey(); }, css: {'disabled': !$root.users.editorApikey()}"><i class="fa fa-trash-o"></i></a>
|
||||
|
||||
@@ -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">
|
||||
|
||||
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user