Compare commits

...
28 Commits
Author SHA1 Message Date
Gina Häußge 3c478036ae Merge branch 'master' into staging/maintenance 2022-03-29 11:19:35 +02:00
Gina Häußge 76e87ba813 💚 Pin click in pre-commit black
See psf/black#2964

To be replaced by an update of black et al in dev branches.
2022-03-29 11:19:16 +02:00
Gina Häußge ad32bbfdb8 🐛 Add back accidentally removed flask-login req 2022-03-29 10:55:15 +02:00
Gina Häußge ccd5fa56a2 📌 Pin werkzeug to 2.0.x for now
Apparently werkzeug removes stuff on minor releases and that just
broke flask-login 0.5. A newer version isn't out yet, so we pin to
a lower version of werkzeug for 1.8.0 and will then see what to do
with this situation for 1.9 and later (potentially even vendor
flask-login as it appears pretty dead currently).
2022-03-29 10:38:04 +02:00
Gina Häußge 24b5b3a857 🐛 Fix potential race condition in webassets
Could trigger when reloading page while preliminary cache
was being done, causing an internal server error
on page load, immediately fixed by a second reload.

Seems to be caused by the change in webasset handling
in 1.8.0, hence considering this a regression.

Fix consists of switching to a thread-safe in-memory
manifest storage.
2022-03-28 16:42:46 +02:00
Gina Häußge 3be85646cd 🔖 Preparing release of 1.8.0rc3 2022-03-28 14:27:38 +02:00
Gina Häußge 54207abbe1 ⬆️ Require latest version of the PiSupport plugin 2022-03-28 11:23:35 +02:00
Gina Häußge 4c4721518c Merge branch 'master' into staging/maintenance 2022-03-23 10:24:02 +01:00
Gina Häußge 772f9f95da 📌 pre-commit: Pin flake8 bugbear
The new version will cause pre-commit to fail, we need to fix
the newly detected issues but not on frozen code (like master
or to a degree the RCs).
2022-03-23 10:23:18 +01:00
Gina Häußge 6728a17448 🚸 Re-enable connect dialog w/ no serial ports
Apparently disabling it if no serial ports are currently
known to the client breaks certain workflows for people.

So this is a short-term solution to fix things for them, while
technically non-sensical (why offer to connect if we don't see
anything to connect to?) So in 1.9.0 this should rather be
solved by adding some form of platform agnostic (!) auto-refresh,
either regular polling while no port is detected, or even
watchdog enabled event based refresh. See #4473.
2022-03-22 12:07:59 +01:00
Zack Lewis 7bc2a79642 ✏️ Spelling correction in software update docs (#4466)
* Spelling Correction

supplyting -> supplying

* Update AUTHORS.md
2022-03-17 22:32:24 +00:00
Gina Häußge 8c9536f323 🐛 GCV: Send the final layer to the UI as well
Closes #4463
2022-03-17 14:28:16 +01:00
Charlie Powell 594b660bb6 :pencil2 2022-03-16 21:44:03 +00:00
Gina Häußge 23f90060c6 🔖 staging/maintenance is now 1.8.0rc3.dev 2022-03-16 11:53:23 +01:00
Gina Häußge 76c5924532 ⬆️ Force upgrade PiSupport to 2022.3.1+
Not 2021.3.1... 🤦‍♀️
2022-03-16 10:45:52 +01:00
Gina Häußge 6fc2edcc1f 🚸 Expose serial.ignoreEmptyPorts on UI
Closes #4460
2022-03-15 19:30:41 +01:00
Gina Häußge 056eb122f3 🐛 Fix some more less 4 incompatibilities 2022-03-15 18:27:06 +01:00
Gina Häußge 33cef57551 🐛 GCV: Fix layer transmission logic
Only ever send *completed* layers to the frontend. Otherwise in case of
zHops and such we risk sending incomplete layers and missing whole
command segments in the process.

Closes #4459
2022-03-15 17:42:01 +01:00
Gina Häußge 9563e898ba 🐛 GCV: Don't try to iterate empty models 2022-03-15 17:39:51 +01:00
Gina Häußge 3816c95678 🐛 Fix get_by_path for empty default dicts & local keys
Closes #4458
2022-03-15 14:36:55 +01:00
Gina Häußge df3b3420ab 🐛 Fix custom temperature handling
* Fix too broad regex
  * Fix lack of error handling in case of reserved identifier

All of these got already introduced in 1.4.1, but now with #4388
they are WAY more likely to pop up (e.g. in garbage lines too) and
completely nuke the connection.

Closes #4456
2022-03-15 12:38:11 +01:00
Gina Häußge 6cd87d1c84 🔖 Preparing of 1.8.0rc2 2022-03-14 18:08:40 +01:00
Gina Häußge fd125e3569 ⬆️ Upgrade outdated sentry-sdk 2022-03-14 18:08:03 +01:00
Gina Häußge 6033ca9a8f 📝 appkeys: Add docs for new auth dialog workflow 2022-03-14 16:26:25 +01:00
Gina Häußge 091edac818 🔖 make staging/maintenance actually be 1.8.0rc2.dev 2022-03-14 15:59:07 +01:00
Gina Häußge e59fab10f8 🥅 More resilience against template plugin bugs
* Don't crash if template is set to None
  * In general catch any error while processing plugin template
    configs and ignore plugin completely.

Closes #4453
2022-03-14 15:17:34 +01:00
Gina Häußge 7f348146cb 🐛 Fix handling of integer keys in the settings
Closes #4454
2022-03-14 14:46:55 +01:00
Gina Häußge 4a3b50cd3e 🔖 staging/maintenance is now 1.8.0rc2.dev 2022-03-14 12:29:32 +01:00
35 changed files with 1047 additions and 697 deletions

No files matched your search

+3 -1
View File
@@ -47,12 +47,14 @@ repos:
hooks:
- id: black
args: ["--config", "black.toml"]
additional_dependencies:
- click==8.0.4
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-bugbear==22.1.11
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
hooks:
+3 -3
View File
@@ -29,10 +29,10 @@ improve/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev
staging/bugfix 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev
bug/.* 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev
# staging/maintenance is currently the branch for preparation of 1.7.0rc4
# staging/maintenance is currently the branch for preparation of 1.8.0rc3
# so is regressionfix/...
staging/maintenance 1.7.0rc4 f31194f75365787f3eb5da61a24f2f8620111f4f pep440-dev
regressionfix/.* 1.7.0rc4 f31194f75365787f3eb5da61a24f2f8620111f4f pep440-dev
staging/maintenance 1.8.0rc3 76c59245329b8f485061ba20d21a56df4d474c34 pep440-dev
regressionfix/.* 1.8.0rc3 76c59245329b8f485061ba20d21a56df4d474c34 pep440-dev
# staging/devel is currently inactive (but has the 1.4.1rc4 namespace)
staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev
+1
View File
@@ -164,6 +164,7 @@ date of first contribution):
* [Shell M. Shrader](https://github.com/synman)
* [Johan Verrept](https://github.com/JoveToo)
* [Nicu Surdu](https://github.com/surdu)
* [Zack Lewis](https://github.com/lima3w)
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
+2 -4
View File
@@ -45,7 +45,6 @@ thanks to everyone who contributed!
* Kurt Wubbels
* Kyle Menigoz
* Lachlan Bell
* Lee Dohm
* Lefteris Lertas
* LulzBot
* Makespace Madrid
@@ -54,7 +53,6 @@ thanks to everyone who contributed!
* Mike Kershaw
* Miles Flavel
* Mosaic Manufacturing
* Nat Friedman
* Norman Jaffe
* Peopoly
* Pete Barnwell
@@ -74,7 +72,7 @@ thanks to everyone who contributed!
* The Spaghetti Detective
* TJ Horner
* Trent Shumay
* Ulderico Cirello
* Ulrich Kempken
* Yehuda Katz
and 2298 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
and 2307 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
+126 -7
View File
@@ -45,10 +45,11 @@ of the following steps:
2. The App :ref:`probes for workflow support <sec-bundledplugins-appkeys-api-probe>` on the Server. If this request
doesn't get an HTTP :http:statuscode:`204` the App needs to direct the user to an alternative manual workflow
(copy-paste API key) and abort this one. Otherwise it proceeds to the next step.
3. The App sends a :ref:`key request <sec-bundledplugins-appkey-datamodel-keyrequest>` to the Server to start the
3. The App sends an :ref:`Authorization request <sec-bundledplugins-appkey-datamodel-authrequest>` to the Server to start the
authorization process.
4. The Server triggers a confirmation dialog for the User on the Webinterface and returns an endpoint to the
App to poll for a decision in the ``Location`` header of an HTTP :http:statuscode:`201`.
4. The Server triggers a confirmation dialog for the User on the Webinterface (unused here) and returns an endpoint to the
App to poll for a decision in the ``Location`` header of an HTTP :http:statuscode:`201`
and an :ref:`Authorization response <sec-bundledplugins-appkey-datamodel-authresponse>` (unused here).
5. The App uses the obtained request specific endpoint to poll for a decision every second. An HTTP :http:statuscode:`202`
signals that no decision has been made yet.
6. The User either accepts or denies the access request which makes the Webinterface send a
@@ -116,6 +117,98 @@ of the following steps:
end
.. _sec-bundledplugins-appkeys-workflow-authdialog:
Workflow with redirect to auth dialog
-------------------------------------
.. versionadded:: 1.8.0
Instead of asking the user to open the full blown OctoPrint interface to confirm the request,
since OctoPrint 1.8.0 there also exists the alternative of redirecting the user to a
basic auth dialog that allows logging in and confirming the request in a light-weight
dialog. To implementat that, follow these steps:
1. The User opens the App and gets prompted to enter or select an instance URL. Optionally (recommended!) the User also
enters their username which is also their user ID into the App.
2. The App :ref:`probes for workflow support <sec-bundledplugins-appkeys-api-probe>` on the Server. If this request
doesn't get an HTTP :http:statuscode:`204` the App needs to direct the user to an alternative manual workflow
(copy-paste API key) and abort this one. Otherwise it proceeds to the next step.
3. The App sends an :ref:`Authorization request <sec-bundledplugins-appkey-datamodel-authrequest>` to the Server to start the
authorization process.
4. The Server triggers a confirmation dialog for the User on the Webinterface (unused here) and returns an endpoint to the
App to poll for a decision in the ``Location`` header of an HTTP :http:statuscode:`201`
and an :ref:`Authorization response <sec-bundledplugins-appkey-datamodel-authresponse>`.
5. The App opens a browser window with the provided `auth_dialog` URL for the user to log in and confirm the request. At the
same time the App also uses the obtained request specific endpoint to poll for a decision every second. An HTTP :http:statuscode:`202`
signals that no decision has been made yet.
6. The User logs in and either accepts or denies the access request which makes the auth dialog send a
:ref:`decision request <sec-bundledplugins-appkey-datamodel-decisionrequest>` to the Server.
7. If the User accepted the request, the App receives an HTTP :http:statuscode:`200` with an attached
:ref:`API key response <sec-bundledplugins-appkey-datamodel-keyresponse>`. If they deny it, the App will receive
an HTTP :http:statuscode:`404`.
.. mermaid::
sequenceDiagram
participant User
participant App
participant Auth Dialog
participant Server
note over User, Server: Step 1, 2 & 3
User->>App: enters URL of instance to connect to and optional user_id
App->>Server: GET /plugin/appkeys/probe
alt Workflow unsupported
Server->>App: 404
App->>User: alternative workflow, copy-paste key manually
else Workflow supported
App->>Server: POST /plugin/appkeys/request, (app_name, user_id)
note over User, Server: Step 4
Server->>App: 201, Location: /plugin/appkeys/request/<app_token>, auth_dialog: <auth_dialog>
note over User, Server: Step 5
App-->>Auth Dialog: open new browser window with auth_dialog URL
loop Poll for decision
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 202
end
note over User, Server: Step 6 & 7
User->>Auth Dialog: Logs in
alt User accepts
User-->>Auth Dialog: Allow access
Auth Dialog->>Server: POST /plugin/appkeys/decision/<user_token>, (True)
Server->>Auth Dialog: 204
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 200, api_key
else User denies
User-->>Auth Dialog: Deny access
Auth Dialog->>Server: POST /plugin/appkeys/decision/<user_token>, (False)
Server->>Auth Dialog: 204
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 404
end
end
.. _sec-bundledplugins-appkeys-api:
API
@@ -144,7 +237,7 @@ Start authorization process
Starts the authorization process.
Expects a :ref:`Key request <sec-bundledplugins-appkey-datamodel-keyrequest>` as request body.
Expects a :ref:`Authorization request <sec-bundledplugins-appkey-datamodel-authrequest>` as request body.
The ``app`` parameter should be a human readable identifier to use
for the application requesting access. It will be displayed to the user. Internally it will be used case insensitively,
@@ -156,6 +249,9 @@ Start authorization process
it in the ``user`` parameter. OctoPrint will then only display the authorization request on browsers the user ``me``
is logged in on.
Returns a :ref:`Authorization response <sec-bundledplugins-appkey-datamodel-authresponse>`
and HTTP :http:statuscode:`201` with the ``Location`` header set to the endpoint to poll for a decision.
:json app: application identifier to use for the request, case insensitive
:json user: optional user id to restrict the decision to the specified user
:status 201: authorization process started, polling URL to query can be found in ``Location`` header
@@ -287,10 +383,10 @@ Issue an application key command
Data model
----------
.. _sec-bundledplugins-appkey-datamodel-keyrequest:
.. _sec-bundledplugins-appkey-datamodel-authrequest:
Key request
...........
Authorization request
.....................
.. list-table::
:widths: 15 5 10 30
@@ -309,6 +405,29 @@ Key request
- str
- User identifier/name to restrict the request to
.. _sec-bundledplugins-appkey-datamodel-authresponse:
Authorization response
......................
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``app_token``
- 1
- str
- Application token to use to poll for the decision.
* - ``auth_dialog``
- 1
- str
- An URL with which a dedicated auth dialog can be used for the user to log into
and authorize the request.
.. _sec-bundledplugins-appkey-datamodel-keyresponse:
Key response
+1 -1
View File
@@ -560,7 +560,7 @@ Global credentials
.. versionadded:: 1.5.0
Starting with OctoPrint 1.5.0, the Software Update Plugin supports supplyting a GitHub
Starting with OctoPrint 1.5.0, the Software Update Plugin supports supplying a GitHub
API token to use for the ``github_release`` and ``github_commit`` version check types,
to work around possible rate limit problems if a lot of checks are to be made from a single
external IP. You may create a `personal access token <https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token>`_
+5
View File
@@ -451,6 +451,11 @@ Use the following settings to enable or disable OctoPrint features:
# whether G90/G91 also influence absolute/relative mode of extruders
g90InfluencesExtruder: false
# Replace all special characters and spaces with text equivalent to make them univerally compatible.
# Most OS filesystems work fine with unicode characters, but just in case you can revert to the
# older behaviour by setting this to true.
enforceReallyUniversalFilenames: false
.. _sec-configuration-config_yaml-folder:
+3 -2
View File
@@ -31,7 +31,7 @@ SETUP_REQUIRES = []
bundled_plugins = [
"OctoPrint-FileCheck>=2021.2.23",
"OctoPrint-FirmwareCheck>=2021.10.11",
"OctoPrint-PiSupport>=2021.3.1",
"OctoPrint-PiSupport>=2022.3.28",
]
core_deps = [
"cachelib>=0.2,<0.3",
@@ -58,10 +58,11 @@ core_deps = [
"requests>=2.26.0,<3",
"sarge==0.1.6",
"semantic_version>=2.8.5,<3",
"sentry-sdk>=1.3.1,<2",
"sentry-sdk>=1.5.7,<2",
"tornado>=6.0.4,<7",
"watchdog>=1,<2",
"websocket-client>=1.2.1,<2",
"werkzeug>=2.0,<2.1", # breaking changes can happen on minor version increases, flask-login 0.5 is incompatible with 2.1
"wrapt>=1.13.3,<1.14",
"zeroconf>=0.33,<0.34", # breaking changes can happen on minor version increases
"zipstream-ng>=1.3.4,<2.0.0",
@@ -18,10 +18,10 @@ from octoprint.util.version import (
)
SENTRY_URL_SERVER = (
"https://87d311e64fdc40f096a1049d99307bf5@o118517.ingest.sentry.io/1373987"
"https://4f9abc3158334309ad3c22f6693ee6e7@o118517.ingest.sentry.io/1373987"
)
SENTRY_URL_COREUI = (
"https://91516ad9a76c47409b02734cbe8492c5@o118517.ingest.sentry.io/1374096"
"https://ef731a61e7a146228b720c54e21c554c@o118517.ingest.sentry.io/1374096"
)
SETTINGS_DEFAULTS = {
@@ -1,2 +1,3 @@
/*! @sentry/browser 5.18.1 (b1261aab) | https://github.com/getsentry/sentry-javascript */
var Sentry=function(t){var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(t,r)};function r(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var e=function(){return(e=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var i in n=arguments[r])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)};function i(t){var n="function"==typeof Symbol&&t[Symbol.iterator],r=0;return n?n.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function o(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var e,i,o=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(e=o.next()).done;)u.push(e.value)}catch(t){i={error:t}}finally{try{e&&!e.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return u}function u(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(o(arguments[n]));return t}var c,a,s;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Debug=2]="Debug",t[t.Verbose=3]="Verbose"}(c||(c={})),(a=t.Severity||(t.Severity={})).Fatal="fatal",a.Error="error",a.Warning="warning",a.Log="log",a.Info="info",a.Debug="debug",a.Critical="critical",function(t){t.fromString=function(n){switch(n){case"debug":return t.Debug;case"info":return t.Info;case"warn":case"warning":return t.Warning;case"error":return t.Error;case"fatal":return t.Fatal;case"critical":return t.Critical;case"log":default:return t.Log}}}(t.Severity||(t.Severity={})),(s=t.Status||(t.Status={})).Unknown="unknown",s.Skipped="skipped",s.Success="success",s.RateLimit="rate_limit",s.Invalid="invalid",s.Failed="failed",function(t){t.fromHttpCode=function(n){return n>=200&&n<300?t.Success:429===n?t.RateLimit:n>=400&&n<500?t.Invalid:n>=500?t.Failed:t.Unknown}}(t.Status||(t.Status={}));var f=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){return t.__proto__=n,t}:function(t,n){for(var r in n)t.hasOwnProperty(r)||(t[r]=n[r]);return t});var h=function(t){function n(n){var r=this.constructor,e=t.call(this,n)||this;return e.message=n,e.name=r.prototype.constructor.name,f(e,r.prototype),e}return r(n,t),n}(Error);function v(t){switch(Object.prototype.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return E(t,Error)}}function l(t){return"[object ErrorEvent]"===Object.prototype.toString.call(t)}function d(t){return"[object DOMError]"===Object.prototype.toString.call(t)}function p(t){return"[object String]"===Object.prototype.toString.call(t)}function y(t){return null===t||"object"!=typeof t&&"function"!=typeof t}function m(t){return"[object Object]"===Object.prototype.toString.call(t)}function b(t){return"undefined"!=typeof Event&&E(t,Event)}function w(t){return"undefined"!=typeof Element&&E(t,Element)}function g(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function E(t,n){try{return t instanceof n}catch(t){return!1}}function x(t,n){return void 0===n&&(n=0),"string"!=typeof t||0===n?t:t.length<=n?t:t.substr(0,n)+"..."}function j(t,n){if(!Array.isArray(t))return"";for(var r=[],e=0;e<t.length;e++){var i=t[e];try{r.push(String(i))}catch(t){r.push("[value cannot be serialized]")}}return r.join(n)}function k(t,n){return!!p(t)&&(r=n,"[object RegExp]"===Object.prototype.toString.call(r)?n.test(t):"string"==typeof n&&-1!==t.indexOf(n));var r}function S(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)}var T={};function O(){return S()?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:T}function _(){var t=O(),n=t.crypto||t.msCrypto;if(void 0!==n&&n.getRandomValues){var r=new Uint16Array(8);n.getRandomValues(r),r[3]=4095&r[3]|16384,r[4]=16383&r[4]|32768;var e=function(t){for(var n=t.toString(16);n.length<4;)n="0"+n;return n};return e(r[0])+e(r[1])+e(r[2])+e(r[3])+e(r[4])+e(r[5])+e(r[6])+e(r[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)})}function D(t){if(!t)return{};var n=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!n)return{};var r=n[6]||"",e=n[8]||"";return{host:n[4],path:n[5],protocol:n[2],relative:n[5]+r+e}}function R(t){if(t.message)return t.message;if(t.exception&&t.exception.values&&t.exception.values[0]){var n=t.exception.values[0];return n.type&&n.value?n.type+": "+n.value:n.type||n.value||t.event_id||"<unknown>"}return t.event_id||"<unknown>"}function I(t){var n=O();if(!("console"in n))return t();var r=n.console,e={};["debug","info","warn","error","log","assert"].forEach(function(t){t in n.console&&r[t].__sentry_original__&&(e[t]=r[t],r[t]=r[t].__sentry_original__)});var i=t();return Object.keys(e).forEach(function(t){r[t]=e[t]}),i}function N(t,n,r){t.exception=t.exception||{},t.exception.values=t.exLine truncated
/*! @sentry/browser 6.18.2 (22f518e) | https://github.com/getsentry/sentry-javascript */
var Sentry=function(t){var n=function(t,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},n(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i,e=function(){return e=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++)for(var e in n=arguments[r])Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t},e.apply(this,arguments)};function o(t){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&t[n],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,e,o=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(i=o.next()).done;)u.push(i.value)}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return u}function a(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(u(arguments[n]));return t}t.Severity=void 0,(i=t.Severity||(t.Severity={})).Fatal="fatal",i.Error="error",i.Warning="warning",i.Log="log",i.Info="info",i.Debug="debug",i.Critical="critical";var c={};function s(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:c}var f=Object.prototype.toString;function h(t){switch(f.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return x(t,Error)}}function v(t,n){return f.call(t)==="[object "+n+"]"}function d(t){return v(t,"ErrorEvent")}function l(t){return v(t,"DOMError")}function p(t){return v(t,"String")}function y(t){return null===t||"object"!=typeof t&&"function"!=typeof t}function m(t){return v(t,"Object")}function b(t){return"undefined"!=typeof Event&&x(t,Event)}function w(t){return"undefined"!=typeof Element&&x(t,Element)}function g(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function x(t,n){try{return t instanceof n}catch(t){return!1}}function E(t,n){try{for(var r=t,i=[],e=0,o=0,u=" > ".length,a=void 0;r&&e++<5&&!("html"===(a=_(r,n))||e>1&&o+i.length*u+a.length>=80);)i.push(a),o+=a.length,r=r.parentNode;return i.reverse().join(" > ")}catch(t){return"<unknown>"}}function _(t,n){var r,i,e,o,u,a=t,c=[];if(!a||!a.tagName)return"";c.push(a.tagName.toLowerCase());var s=n&&n.length?n.filter((function(t){return a.getAttribute(t)})).map((function(t){return[t,a.getAttribute(t)]})):null;if(s&&s.length)s.forEach((function(t){c.push("["+t[0]+'="'+t[1]+'"]')}));else if(a.id&&c.push("#"+a.id),(r=a.className)&&p(r))for(i=r.split(/\s+/),u=0;u<i.length;u++)c.push("."+i[u]);var f=["type","name","title","alt"];for(u=0;u<f.length;u++)e=f[u],(o=a.getAttribute(e))&&c.push("["+e+'="'+o+'"]');return c.join("")}var j=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){return t.__proto__=n,t}:function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(t,r)||(t[r]=n[r]);return t});var k=function(t){function n(n){var r=this.constructor,i=t.call(this,n)||this;return i.message=n,i.name=r.prototype.constructor.name,j(i,r.prototype),i}return r(n,t),n}(Error),S=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;function O(t,n){void 0===n&&(n=!1);var r=t.host,i=t.path,e=t.pass,o=t.port,u=t.projectId;return t.protocol+"://"+t.publicKey+(n&&e?":"+e:"")+"@"+r+(o?":"+o:"")+"/"+(i?i+"/":i)+u}function T(t){return"user"in t&&!("publicKey"in t)&&(t.publicKey=t.user),{user:t.publicKey||"",protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function D(t){var n="string"==typeof t?function(t){var n=S.exec(t);if(!n)throw new k("Invalid Sentry Dsn: "+t);var r=u(n.slice(1),6),i=r[0],e=r[1],o=r[2],a=void 0===o?"":o,c=r[3],s=r[4],f=void 0===s?"":s,h="",v=r[5],d=v.split("/");if(d.length>1&&(h=d.slice(0,-1).join("/"),v=d.pop()),v){var l=v.match(/^\d+/);l&&(v=l[0])}return T({host:c,pass:a,path:h,projectId:v,port:f,protocol:i,publicKey:e})}(t):T(t);return n}var R=["fatal","error","warning","log","info","debug","critical"],N=s(),I="Sentry Logger ";function M(t){var n=s();if(!("console"in n))return t();var r=n.console,i={};["debug","info","warn","error","log","assert"].forEach((function(t){t in n.console&&r[t].__sentry_original__&&(i[t]=r[t],r[t]=r[t].__sentry_original__)}));var e=t();return Object.keys(i).forEach((function(t){r[t]=i[t]})),e}var q=function(){function t(){this.t=!1}return t.prototype.disable=function(){this.t=!1},t.prototype.enable=function(){this.t=!0},t.prototype.log=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.t&&M((function(){var n;(n=N.console).log.apply(n,a([I+"[Log]:Line truncated
//# sourceMappingURL=bundle.min.js.map
@@ -138,28 +138,31 @@ GCODE.gCodeReader = (function () {
var rebuildLayerPercentageLookup = function (m) {
var result = [];
for (var i = 0; i < m.length - 1; i++) {
// start is first command of current layer
var start = m[i].length ? m[i][0].percentage : -1;
var end = -1;
for (var j = i + 1; j < m.length; j++) {
// end is percentage of first command that follows our start, might
// be later layers if the next layer is empty!
if (m[j].length) {
end = m[j][0].percentage;
break;
if (m && m.length > 0) {
for (var i = 0; i < m.length - 1; i++) {
// start is first command of current layer
var start = m[i].length ? m[i][0].percentage : -1;
var end = -1;
for (var j = i + 1; j < m.length; j++) {
// end is percentage of first command that follows our start, might
// be later layers if the next layer is empty!
if (m[j].length) {
end = m[j][0].percentage;
break;
}
}
result[i] = [start, end];
}
result[i] = [start, end];
// final start-end-pair is start percentage of last layer and 100%
result[m.length - 1] = m[m.length - 1].length
? [m[m.length - 1][0].percentage, 100]
: [-1, -1];
}
// final start-end-pair is start percentage of last layer and 100%
result[m.length - 1] = m[m.length - 1].length
? [m[m.length - 1][0].percentage, 100]
: [-1, -1];
layerPercentageLookup = result;
};
@@ -303,6 +303,7 @@ var analyzeModel = function () {
var doParse = function () {
var argChar, numSlice;
var activeLayer = undefined;
var sendLayer = undefined;
var sendMultiLayer = [];
var lastSend = 0;
@@ -599,7 +600,6 @@ var doParse = function () {
}
layer = model.length;
sendLayer = layer;
prevZ = z;
}
@@ -634,49 +634,62 @@ var doParse = function () {
};
if (zLift) {
// Insert zLift moves for later processing
// Insert zLift moves for later processing - they might be part of
// the active layer still
zLiftMoves.push({
command: command,
layer: layer
});
} else if (zLiftMoves.length > 0) {
// there's something to be checked in the Z-lift cache
if (prevZ < maxLiftZ) {
zLiftMoves.forEach(function (zLiftMove) {
// move command from move layer...
model[zLiftMove.layer].splice(
model[layer].indexOf(zLiftMove.command),
1
);
// ... to z-lift layer
model[zLiftLayer].push(zLiftMove.command);
});
} else {
if (zLiftMoves.length > 0) {
// there's something to be checked in the Z-lift cache
if (prevZ < maxLiftZ) {
zLiftMoves.forEach(function (zLiftMove) {
// move command from move layer...
model[zLiftMove.layer].splice(
model[layer].indexOf(zLiftMove.command),
1
);
// ... to z-lift layer
model[zLiftLayer].push(zLiftMove.command);
});
// clean up empty layers at the end of the model
var spliceFrom = undefined;
for (var l = model.length - 1; l > 0; l--) {
if (model[l].length > 0) break;
spliceFrom = l;
}
if (spliceFrom !== undefined) {
model.splice(spliceFrom, model.length - spliceFrom);
// clean up empty layers at the end of the model
var spliceFrom = undefined;
for (var l = model.length - 1; l > 0; l--) {
if (model[l].length > 0) break;
spliceFrom = l;
}
if (spliceFrom !== undefined) {
model.splice(spliceFrom, model.length - spliceFrom);
}
// finally determine the new active layer
if (prevZ === zLiftZ) {
// initial lifted on layer if we are back at a prior height
layer = zLiftLayer;
} else {
// new layer if this a new z, just lower than max z-lift
model[model.length] = [];
layer = model.length - 1;
}
}
// finally determine the new active layer
if (prevZ === zLiftZ) {
// initial lifted on layer if we are back at a prior height
layer = zLiftLayer;
} else {
// new layer if this a new z, just lower than max z-lift
model[model.length] = [];
layer = model.length - 1;
}
// clear up cached Z-lift moves
zLiftMoves = [];
zLiftZ = undefined;
maxLiftZ = undefined;
zLiftLayer = undefined;
}
// have we progressed a layer?
if (activeLayer === undefined || layer > activeLayer) {
// the formerly active layer is now done and can be sent
sendLayer = activeLayer;
// the current layer is the new active layer
activeLayer = layer;
}
// clear up cached Z-lift moves
zLiftMoves = [];
zLiftZ = undefined;
maxLiftZ = undefined;
zLiftLayer = undefined;
}
model[layer].push(command);
@@ -694,10 +707,19 @@ var doParse = function () {
sendMultiLayer = [];
sendMultiLayerZ = [];
}
sendMultiLayer[sendMultiLayer.length] = sendLayer;
if (sendMultiLayer.indexOf(sendLayer) === -1) {
sendMultiLayer.push(sendLayer);
}
sendLayer = undefined;
}
}
// we are done, send the final layer
if (sendMultiLayer.indexOf(activeLayer) === -1) {
sendMultiLayer.push(activeLayer);
}
sendLayersToParent(sendMultiLayer, 100);
};
+5 -2
View File
@@ -1944,6 +1944,8 @@ class Server:
global assets
global pluginManager
from octoprint.server.util.webassets import MemoryManifest # noqa: F401
util.flask.fix_webassets_filtertool()
base_folder = self._settings.getBaseFolder("generated")
@@ -1955,7 +1957,8 @@ class Server:
for entry, recreate in (
("webassets", True),
(".webassets-cache", False), # no longer used, but clean up just in case
# no longer used, but clean up just in case
(".webassets-cache", False),
(".webassets-manifest.json", False),
):
path = os.path.join(base_folder, entry)
@@ -2042,7 +2045,7 @@ class Server:
# few seconds for regeneration in development, if it means we can get rid of
# a whole monkey patch and in internal use of pickle with non-tamperproof files
assets.cache = False
assets.manifest = "json:.webassets-manifest.json"
assets.manifest = "memory"
UpdaterType = type(util.flask.SettingsCheckUpdater)(
util.flask.SettingsCheckUpdater.__name__,
+18
View File
@@ -6,6 +6,7 @@ import gzip
import logging
import os
import re
import threading
from urllib import parse as urlparse
import webassets.filter.cssrewrite.urlpath as urlpath
@@ -14,6 +15,7 @@ from webassets.filter import Filter
from webassets.filter.cssrewrite.base import PatternRewriter
from webassets.filter.rjsmin import rjsmin
from webassets.merge import BaseHunk, MemoryHunk
from webassets.version import Manifest
def replace_url(source_url, output_url, url):
@@ -207,3 +209,19 @@ class JsPluginBundle(Bundle):
(hunk, lambda x: x.replace("\n", "\n ")),
MemoryHunk(_PLUGIN_BUNDLE_WRAPPER_SUFFIX.format(plugin=self.plugin)),
)
class MemoryManifest(Manifest):
id = "memory"
def __init__(self, *args, **kwargs):
self.manifest = {}
self._lock = threading.RLock()
def remember(self, bundle, ctx, version):
with self._lock:
self.manifest[bundle.output] = version
def query(self, bundle, ctx):
with self._lock:
return self.manifest.get(bundle.output, None)
+18 -7
View File
@@ -1223,9 +1223,17 @@ def fetch_template_data(refresh=False):
for var_name, var_value in vars.items():
plugin_vars["plugin_" + name + "_" + var_name] = var_value
includes = _process_template_configs(
name, implementation, configs, template_rules
)
try:
includes = _process_template_configs(
name, implementation, configs, template_rules
)
except Exception:
_logger.exception(
"Error while processing template configs for plugin {}, ignoring it".format(
name
),
extra={"plugin": name},
)
if not wizard_required or wizard_ignored:
includes["wizard"] = list()
@@ -1483,11 +1491,14 @@ def _process_template_config(name, implementation, rule, config=None, counter=1)
)
return None
if "template" not in data:
data["template"] = rule["template"](name)
data["template"] = implementation.template_folder_key + "/" + data["template"]
if data.get("template"):
data["template"] = implementation.template_folder_key + "/" + data["template"]
else:
data["template"] = (
implementation.template_folder_key + "/" + rule["template"](name)
)
if "template_header" in data:
if data.get("template_header"):
data["template_header"] = (
implementation.template_folder_key + "/" + data["template_header"]
)
+5 -6
View File
@@ -563,7 +563,7 @@ class HierarchicalChainMap:
items = []
for k, v in d.items():
new_key = parent_key + _CHAINMAP_SEP + k if parent_key else k
new_key = parent_key + _CHAINMAP_SEP + str(k) if parent_key else str(k)
if v and isinstance(v, dict):
items.extend(HierarchicalChainMap._flatten(v, new_key).items())
else:
@@ -631,27 +631,26 @@ class HierarchicalChainMap:
current = self._chainmap
key = self._path_to_key(path)
prefix = key + _CHAINMAP_SEP
if key in current:
if key in current and not any(k.startswith(prefix) for k in current.keys()):
# found it, return
return current[key]
# if we arrived here we might be trying to grab a dict, look for children
key = key + _CHAINMAP_SEP
# TODO 2.0.0 remove this & make 'merged' the default
if not merged and hasattr(current, "maps"):
# we do something a bit odd here: if merged is not true, we don't include the
# full contents of the key. Instead, we only include the contents of the key
# on the first level where we find the value.
for layer in current.maps:
if any(k.startswith(key) for k in layer):
if any(k.startswith(prefix) for k in layer):
current = layer
break
result = self._unflatten(
{k: v for k, v in current.items() if k.startswith(key)}, prefix=key
{k: v for k, v in current.items() if k.startswith(prefix)}, prefix=prefix
)
if not result:
raise KeyError("Could not find entry for " + str(path))
+1 -1
View File
@@ -1 +1 @@
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,0.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top, #fff, #e6e6e6);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#e6e6e6));background-image:-webkit-linear-gradient(top, #fff, #e6e6e6);background-image:-o-linear-gradient(top, #fff, #e6e6e6);background-image:linear-gradient(to bottom, #fff, #e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover,.btn:focus{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:65 / 100;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0}.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top, #08c, #04c);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#04c));background-image:-webkit-linear-gradient(top, #08c, #04c);background-image:-o-linear-gradient(top, #08c, #04c);background-image:linear-gradient(to bottom, #08c, #04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false)}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(to bottom, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false)Line truncated
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,0.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top, #fff, #e6e6e6);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#e6e6e6));background-image:-webkit-linear-gradient(top, #fff, #e6e6e6);background-image:-o-linear-gradient(top, #fff, #e6e6e6);background-image:linear-gradient(to bottom, #fff, #e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover,.btn:focus{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0}.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top, #08c, #04c);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#04c));background-image:-webkit-linear-gradient(top, #08c, #04c);background-image:-o-linear-gradient(top, #08c, #04c);background-image:linear-gradient(to bottom, #08c, #04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false)}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(to bottom, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false)}.btnLine truncated
@@ -40,7 +40,8 @@ $(function () {
self.isLoading = ko.observable(undefined);
self.enableConnect = ko.pureComputed(function () {
return self.enablePort() || !self.isErrorOrClosed();
//return self.enablePort() || !self.isErrorOrClosed();
return true; // enable always for now, until we have an auto refresh in 1.9.0
});
self.buttonText = ko.pureComputed(function () {
@@ -250,6 +250,7 @@ $(function () {
self.serial_ackMax = ko.observable(undefined);
self.serial_resendRatioThreshold = ko.observable(100);
self.serial_resendRatioStart = ko.observable(100);
self.serial_ignoreEmptyPorts = ko.observable(undefined);
self.serial_enableShutdownActionCommand = ko.observable(undefined);
self.folder_uploads = ko.observable(undefined);
+2 -2
View File
@@ -21,8 +21,8 @@
// Optional: Group multiple button groups together for a toolbar
.btn-toolbar {
font-size: 0; // Hack to remove whitespace that results from using inline-block
margin-top: @baseLineHeight / 2;
margin-bottom: @baseLineHeight / 2;
margin-top: (@baseLineHeight / 2);
margin-bottom: (@baseLineHeight / 2);
> .btn + .btn,
> .btn-group + .btn,
> .btn + .btn-group {
+2 -2
View File
@@ -24,8 +24,8 @@ code {
// Blocks of code
pre {
display: block;
padding: (@baseLineHeight - 1) / 2;
margin: 0 0 @baseLineHeight / 2;
padding: ((@baseLineHeight - 1) / 2);
margin: 0 0 (@baseLineHeight / 2);
font-size: @baseFontSize - 1; // 14px to 13px
line-height: @baseLineHeight;
word-break: break-all;
+5 -5
View File
@@ -81,7 +81,7 @@ input[type="color"],
display: inline-block;
height: @baseLineHeight;
padding: 4px 6px;
margin-bottom: @baseLineHeight / 2;
margin-bottom: (@baseLineHeight / 2);
font-size: @baseFontSize;
line-height: @baseLineHeight;
color: @gray;
@@ -399,7 +399,7 @@ select:focus:invalid {
.help-block {
display: block; // account for any element using help-block
margin-bottom: @baseLineHeight / 2;
margin-bottom: (@baseLineHeight / 2);
}
.help-inline {
@@ -416,7 +416,7 @@ select:focus:invalid {
.input-append,
.input-prepend {
display: inline-block;
margin-bottom: @baseLineHeight / 2;
margin-bottom: (@baseLineHeight / 2);
vertical-align: middle;
font-size: 0; // white space collapse hack
white-space: nowrap; // Prevent span and input from separating
@@ -617,7 +617,7 @@ input.search-query {
// Margin to space out fieldsets
.control-group {
margin-bottom: @baseLineHeight / 2;
margin-bottom: (@baseLineHeight / 2);
}
// Legend collapses margin, so next element is responsible for spacing
@@ -666,7 +666,7 @@ legend + .control-group {
.input-prepend,
.input-append {
+ .help-block {
margin-top: @baseLineHeight / 2;
margin-top: (@baseLineHeight / 2);
}
}
// Move over buttons in .form-actions to align with .controls
+2 -2
View File
@@ -376,7 +376,7 @@
// Opacity
.opacity(@opacity) {
opacity: @opacity / 100;
opacity: (@opacity / 100);
filter: ~"alpha(opacity=@{opacity})";
}
@@ -679,7 +679,7 @@
// Vertically center elements in the navbar.
// Example: an element has a height of 30px, so write out `.navbarVerticalAlign(30px);` to calculate the appropriate top margin.
.navbarVerticalAlign(@elementHeight) {
margin-top: (@navbarHeight - @elementHeight) / 2;
margin-top: ((@navbarHeight - @elementHeight) / 2);
}
// Grid System
+3 -3
View File
@@ -6,7 +6,7 @@
// -------------------------
p {
margin: 0 0 @baseLineHeight / 2;
margin: 0 0 (@baseLineHeight / 2);
}
.lead {
margin-bottom: @baseLineHeight;
@@ -160,7 +160,7 @@ h4 small {
ul,
ol {
padding: 0;
margin: 0 0 @baseLineHeight / 2 25px;
margin: 0 0 (@baseLineHeight / 2) 25px;
}
ul ul,
ul ol,
@@ -204,7 +204,7 @@ dt {
font-weight: bold;
}
dd {
margin-left: @baseLineHeight / 2;
margin-left: (@baseLineHeight / 2);
}
// Horizontal layout (like forms)
.dl-horizontal {
@@ -92,6 +92,19 @@
</label>
</div>
</div>
<div>
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', container: '#settings_serial_general_connection .hide' }"><i class="fas fa-caret-right"></i> {{ _('Advanced options') }}</a></small></div>
<div class="hide">
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: serial_ignoreEmptyPorts" id="settings-serialIgnoreEmptyPorts"> {{ _('Ignore empty ports') }}
<span class="help-block">{{ _('By checking this you\'ll disable OctoPrint warning you if no serial ports to connect to were found.') }}</span>
</label>
</div>
</div>
</div>
</div>
</fieldset>
<fieldset id="settings_serial_general_logging">
<legend>{{ _('Serial logging') }}</legend>
File diff suppressed because it is too large. Load diff
+13 -8
View File
@@ -113,7 +113,7 @@ Groups will be as follows:
"""
regex_temp = re.compile(
r"(?P<sensor>B|C|T(?P<toolnum>\d*)|([\w]+)):\s*(?P<actual>%s)(\s*\/?\s*(?P<target>%s))?"
r"(^|\s)(?P<sensor>B|C|T(?P<toolnum>\d*)|([\w]+)):\s*(?P<actual>%s)(\s*\/?\s*(?P<target>%s))?"
% (regex_float_pattern, regex_float_pattern)
)
"""Regex matching temperature entries in line.
@@ -341,7 +341,7 @@ class PositionRecord:
class TemperatureRecord:
RESERVED_IDENTIFIER_REGEX = re.compile("[0-9]+|[bc]")
RESERVED_IDENTIFIER_REGEX = re.compile(r"B|C|T\d*")
def __init__(self):
self._tools = {}
@@ -366,7 +366,7 @@ class TemperatureRecord:
self._chamber = self._to_new_tuple(current, actual, target)
def set_custom(self, identifier, actual=None, target=None):
if self.RESERVED_IDENTIFIER_REGEX.match(identifier):
if self.RESERVED_IDENTIFIER_REGEX.fullmatch(identifier):
raise ValueError(f"{identifier} is a reserved identifier")
current = self._custom.get(identifier, (None, None))
self._custom[identifier] = self._to_new_tuple(current, actual, target)
@@ -2103,7 +2103,7 @@ class MachineCom:
def _processTemperatures(self, line):
current_tool = self._currentTool if self._currentTool is not None else 0
current_tool_key = "T%d" % current_tool
current_tool_key = f"T{current_tool}"
maxToolNum, parsedTemps = parse_temperature_line(line, current_tool)
maxToolNum = max(
@@ -2159,10 +2159,15 @@ class MachineCom:
del parsedTemps["C"]
self.last_temperature.set_chamber(actual=actual, target=target)
# all other injected temperatures
for key in parsedTemps.keys():
actual, target = parsedTemps[key]
self.last_temperature.set_custom(key, actual=actual, target=target)
# all other injected temperatures or temperature-like entries
for key, data in parsedTemps.items():
try:
actual, target = data
self.last_temperature.set_custom(key, actual=actual, target=target)
except Exception as ex:
self._logger.warning(
f"Could not add custom temperature record {key}: {ex}"
)
##~~ Serial monitor processing received messages
+11
View File
@@ -7,6 +7,17 @@ serial:
additionalPorts:
- /dev/portA
- /dev/portB
plugins:
foo:
bar:
a: 1
b: 2
c: 3
fnord:
bar:
a: 1
b: 2
c: 3
server:
port: 8080
devel:
+6
View File
@@ -5,6 +5,12 @@ devel:
waitInterval: 1.0
repetierStyleResends: false
capabilities: {}
plugins:
foo:
bar: {}
fnord:
bar:
d: 4
test:
b:
b1: 1
+28 -7
View File
@@ -507,11 +507,14 @@ class SettingsTest(unittest.TestCase):
def test_get_preprocessor(self):
with self.settings() as settings:
config = {}
defaults = {"test": "some string"}
preprocessors = {"test": lambda x: x.upper()}
defaults = {"test_preprocessor": "some string"}
preprocessors = {"test_preprocessor": lambda x: x.upper()}
value = settings.get(
["test"], config=config, defaults=defaults, preprocessors=preprocessors
["test_preprocessor"],
config=config,
defaults=defaults,
preprocessors=preprocessors,
)
self.assertEqual("SOME STRING", value)
@@ -519,18 +522,18 @@ class SettingsTest(unittest.TestCase):
def test_set_preprocessor(self):
with self.settings() as settings:
config = {}
defaults = {"foo": {"bar": "fnord"}}
preprocessors = {"foo": {"bar": lambda x: x.upper()}}
defaults = {"foo_preprocessor": {"bar": "fnord"}}
preprocessors = {"foo_preprocessor": {"bar": lambda x: x.upper()}}
settings.set(
["foo", "bar"],
["foo_preprocessor", "bar"],
"value",
config=config,
defaults=defaults,
preprocessors=preprocessors,
)
self.assertEqual("VALUE", config["foo"]["bar"])
self.assertEqual("VALUE", config["foo_preprocessor"]["bar"])
def test_set_external_modification(self):
with self.settings() as settings:
@@ -675,6 +678,7 @@ class ChainmapTest(unittest.TestCase):
self.assertTrue(self.chainmap.has_path(["devel"]))
self.assertTrue(self.chainmap.has_path(["devel", "virtualPrinter"]))
self.assertTrue(self.chainmap.has_path(["devel", "virtualPrinter", "enabled"]))
self.assertTrue(self.chainmap.has_path(["plugins", "foo", "bar"]))
self.assertFalse(self.chainmap.has_path(["api", "lock"]))
@@ -697,6 +701,23 @@ class ChainmapTest(unittest.TestCase):
self.chainmap.get_by_path(["test"], merged=True),
)
self.assertEqual(
self.config["plugins"]["foo"]["bar"],
self.chainmap.get_by_path(["plugins", "foo", "bar"]),
)
self.assertEqual(
self.config["plugins"]["fnord"]["bar"],
self.chainmap.get_by_path(["plugins", "fnord", "bar"]),
)
self.assertEqual(
dict_merge(
self.overlay["plugins"]["fnord"]["bar"],
self.config["plugins"]["fnord"]["bar"],
),
self.chainmap.get_by_path(["plugins", "fnord", "bar"], merged=True),
)
def test_set_by_path(self):
self.chainmap.set_by_path(["devel", "virtualPrinter", "sendWait"], False)
+72
View File
@@ -284,6 +284,52 @@ class TestCommHelpers(unittest.TestCase):
{"T0": (-55.7, 0), "T1": (150.0, 210.0)},
1,
),
(
"T:210.04 /210.00 B:52.00 /52.00 @:85 B@:31pS_XYZ:5",
0,
{
"T0": (210.04, 210.0),
"B": (52.00, 52.0),
},
0,
),
(
"T:210.04 /210.00 B:52.00 /52.00 @:85 31pS_XYZ:5",
0,
{
"T0": (210.04, 210.0),
"B": (52.00, 52.0),
"31pS_XYZ": (5, None),
},
0,
),
(
"T:210.04 /210.00 B:52.00 /52.00 @:85 F0:255.0 /255.0",
0,
{
"T0": (210.04, 210.0),
"B": (52.00, 52.0),
"F0": (255.0, 255.0),
},
0,
),
(
"T:210.04 /210.00 @B:52.00 /52.00",
0,
{
"T0": (210.04, 210.0),
},
0,
),
(
"T:210.04 /210.00 @B:52.00 /52.00 TXYZ:2",
0,
{
"T0": (210.04, 210.0),
"TXYZ": (2, None),
},
0,
),
)
@unpack
def test_process_temperature_line(self, line, current, expected_result, expected_max):
@@ -533,3 +579,29 @@ class TestPositionRecord(unittest.TestCase):
from octoprint.util.comm import PositionRecord
return PositionRecord(**kwargs)
@ddt
class TestTemperatureRecord(unittest.TestCase):
@data("TX", "B2", "BX", "SOMETHING_CUSTOM", "1234B456", "blub", "fnord", "C1", "CX")
def test_set_custom(self, identifier):
temperature = self._create_temperature()
temperature.set_custom(identifier, 1, 2)
self.assertTrue(identifier in temperature.custom)
@data("T", "T1", "T42", "B", "C")
def test_set_custom_reserved(self, identifier):
temperature = self._create_temperature()
try:
temperature.set_custom(identifier, 1, 2)
self.fail(f"Expected ValueError for reserved identifier {identifier}")
except ValueError as ex:
self.assertTrue("is a reserved identifier" in str(ex))
def _create_temperature(self, **kwargs):
from octoprint.util.comm import TemperatureRecord
return TemperatureRecord(**kwargs)
Binary file not shown.
File diff suppressed because it is too large. Load diff
+203 -192
View File
File diff suppressed because it is too large. Load diff