Merge branch 'devel' into dev/commRefactoringNG

# Conflicts:
#	src/octoprint/static/css/octoprint.css
This commit is contained in:
Gina Häußge committed 2021-02-25 14:48:18 +01:00
commit 11e30150b7
55 files changed
+11951 -172

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
overrides:
- files:
- "src/octoprint/static/js/app/**"
env:
browser: true
jquery: true
parserOptions:
ecmaVersion: 5
rules:
es5/no-arrow-functions: error
es5/no-binary-and-octal-literals: error
es5/no-block-scoping: error
es5/no-classes: error
es5/no-computed-properties: error
es5/no-default-parameters: error
es5/no-destructuring: error
es5/no-exponentiation-operator: error
es5/no-for-of: error
es5/no-generators: error
es5/no-modules: error
es5/no-object-super: error
es5/no-rest-parameters: error
es5/no-shorthand-properties: error
es5/no-spread: error
es5/no-template-literals: error
es5/no-typeof-symbol: error
es5/no-unicode-code-point-escape: error
es5/no-unicode-regex: error
- files:
- "tests/cypress/**"
env:
node: true
es6: true
cypress/globals: true
extends:
- "plugin:cypress/recommended"
plugins:
- eslint-plugin-es5
- cypress
+28 -13
View File
@@ -1,9 +1,9 @@
name: Bug report
about: Create a report to help improve OctoPrint
name: 🐛 Report a bug
about: Create a bug report to help improve OctoPrint
title: ""
issue_body: true
inputs:
- type: description
body:
- type: markdown
attributes:
value: >
**Thank you for wanting to report a bug in OctoPrint!**
@@ -35,7 +35,6 @@ inputs:
- type: textarea
attributes:
label: The problem
required: true
description: >-
Describe the issue you are experiencing here. Tell us what you were trying to do
step by step, and what happened that you did not expect.
@@ -46,6 +45,8 @@ inputs:
1. ...
2. ...
3. ...
validations:
required: true
- type: dropdown
attributes:
label: Did the issue persist even in safe mode?
@@ -53,12 +54,24 @@ inputs:
Testing in safe mode is required to make sure the issue you are reporting is not
caused by a third party plugin. Please see [here](https://docs.octoprint.org/en/master/features/safemode.html)
on how to run OctoPrint in safe mode.
choices:
options:
- Yes, it did persist
- No, it did not persist (it's an issue with one of your installed plugins, don't report here)
- I cannot test this issue in safe mode (state why below)
validations:
required: true
- type: description
- type: input
attributes:
label: If you could not test in safe mode, please state why
description: >-
Issues caused by a third party plugin are a major cause of bugs reported here, so we really need to
rule out that a plugin is at fault here. [Safe mode](https://docs.octoprint.org/en/master/features/safemode.html) is an easy way to do that. Only skip safe mode
if your particular problem *absolutely requires* third party plugins to be enabled. "It would take
too long" is **not** a reason to skip testing in safe mode, neither is "I do not know how to
enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html).
If you really *cannot* test in safe mode, leave a short explanation as to why.
- type: markdown
attributes:
value: |
## Environment
@@ -66,6 +79,7 @@ inputs:
attributes:
label: Version of OctoPrint
description: Can be found in the lower left corner of the web interface.
validations:
required: true
- type: input
attributes:
@@ -74,6 +88,7 @@ inputs:
OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's
version can be found in `/etc/octopi_version` or in the lower left corner of the
web interface.
validations:
required: true
- type: input
attributes:
@@ -83,19 +98,19 @@ inputs:
attributes:
label: Browser and version of browser, operating system running browser
description: If applicable, always include if unsure
- type: description
- type: markdown
attributes:
value: |
## Logs and other files needed for analysis
- type: description
- type: markdown
attributes:
value: >-
Please also be sure to upload the following files below:
* `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that.
* `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. Just attach down below as-is.
* `serial.log` or the contents of your terminal tab, if applicable. Always
include if unsure. **Please note that you need to enable `serial.log` first**,
see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it.
see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. Just attach down below as-is.
* Your browser's JavaScript console, if you are reporting a problem with the
user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that.
* If possible, screenshots or videos showing the problem, especially if you
@@ -108,14 +123,14 @@ inputs:
- type: checkboxes
attributes:
label: Checklist of files to include below
choices:
options:
- label: octoprint.log
required: true
- label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication)
- label: Contents of the JavaScript browser console (always include in cases of issues with the user interface)
- label: Screenshots and/or videos showing the problem (always include in case of issues with the user interface)
- label: GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour)
- type: description
- type: markdown
attributes:
value: |
## Additional information & file uploads
+5 -2
View File
@@ -1,4 +1,7 @@
contact_links:
- name: Have questions or need support?
- name: 🤔 Have questions or need support?
url: https://community.octoprint.org
about: Please get in touch on the OctoPrint Community Forum!
about: Please get in touch on the OctoPrint Community Forums!
- name: 💸 Want to donate?
url: https://support.octoprint.org
about: Please take a look at the various options to support OctoPrint's development financially!
-22
View File
@@ -1,22 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[Request]'
---
<!--
Please make sure to add [Request] to your issue's title. Thank you!
-->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
@@ -0,0 +1,37 @@
name: ✨ Request a feature
about: Request a new feature to implement in OctoPrint
title: "[Request]"
issue_body: true
body:
- type: markdown
attributes:
value: >
**Thank you for wanting to request a feature in OctoPrint!**
Before you go ahead with your request, please first consider if it wouldn't be
better suited for a plugin. As a general rule of thumb, any feature that is only
of interest to a small sub group should be moved into a plugin. Only such features
that are of interest to a majority of OctoPrint's users will be implemented as
part of the core itself.
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Eg, "I'm always frustrated when [...]".
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen. Explain why it needs to be included in OctoPrint's core and can't become a plugin.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
- type: markdown
attributes:
value: >
**Additional context**
Add any other context or screenshots about the feature request here.
+34 -17
View File
@@ -46,22 +46,6 @@ jobs:
run: |
pre-commit run --hook-stage manual black --all-files --show-diff-on-failure
lint-prettier:
name: 🧹 prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🏗 Set up dev dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run prettier
run: |
pre-commit run --hook-stage manual prettier --all-files --show-diff-on-failure
lint-isort:
name: 🧹 isort
runs-on: ubuntu-latest
@@ -94,6 +78,38 @@ jobs:
run: |
pre-commit run --hook-stage manual flake8 --all-files
lint-prettier:
name: 🧹 prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🏗 Set up dev dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run prettier
run: |
pre-commit run --hook-stage manual prettier --all-files --show-diff-on-failure
lint-eslint:
name: 🧹 eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🏗 Set up dev dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run eslint
run: |
pre-commit run --hook-stage manual eslint --all-files
test-unit:
name: 🧪 Unit tests
strategy:
@@ -192,9 +208,10 @@ jobs:
if: github.event_name == 'release'
needs:
- lint-black
- lint-prettier
- lint-isort
- lint-flake8
- lint-prettier
- lint-eslint
- test-unit
- test-install
- test-e2e
+33
View File
@@ -0,0 +1,33 @@
name: "Nightly merge"
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
nightly-merge:
runs-on: ubuntu-latest
steps:
- name: ⬇ Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 🔀 Merge master into maintenance
uses: robotology/gh-action-nightly-merge@v1.3.2
with:
stable_branch: "master"
development_branch: "maintenance"
allow_ff: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: 🔀 Merge maintenance into devel
# uses: robotology/gh-action-nightly-merge@v1.3.2
# with:
# stable_branch: "maintenance"
# development_branch: "devel"
# allow_ff: false
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+32 -14
View File
@@ -1,4 +1,4 @@
exclude: ^(src/octoprint/vendor/|src/octoprint/static/js/lib|src/octoprint/static/vendor|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/|.*\.css|.*\.svg)
exclude: ^(src/octoprint/vendor/|src/octoprint/static/js/lib|src/octoprint/static/vendor|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/|versioneer.py|.*\.css|.*\.svg)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
@@ -13,26 +13,34 @@ repos:
- id: fix-encoding-pragma
args: ["--remove"]
- repo: https://github.com/OctoPrint/codemods
rev: devel
rev: 0.4.0
hooks:
- id: codemod_remove_future_imports
args: ["--ignore", "src/octoprint/vendor"]
stages: ["manual"]
- id: codemod_remove_builtins_imports
args: ["--ignore", "src/octoprint/vendor"]
stages: ["manual"]
- id: codemod_detect_past_builtins_imports
args: ["--ignore", "src/octoprint/vendor"]
stages: ["manual"]
- id: codemod_dict_comprehension_to_literal
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_dict_to_literal
args: ["--ignore", "src/octoprint/vendor"]
stages: ["manual"]
- id: codemod_set_to_literal
args: ["--ignore", "src/octoprint/vendor"]
stages: ["manual"]
- id: codemod_not_in
args: ["--ignore", "src/octoprint/vendor"]
stages: ["manual"]
- id: codemod_oserror_merge
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_py3_class_inheritance
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_py3_super
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_remove_builtins_imports
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_remove_float_conversion
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_remove_future_imports
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_set_to_literal
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_string_encoding
args: ["--ignore", "src/octoprint/vendor"]
- id: codemod_yield_from_generator
args: ["--ignore", "src/octoprint/vendor"]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.5.4
hooks:
@@ -52,3 +60,13 @@ repos:
rev: v2.1.2
hooks:
- id: prettier
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.19.0
hooks:
- id: eslint
additional_dependencies:
- eslint@7.19.0
- eslint-plugin-es5@v1.3.0
- eslint-plugin-cypress@2.11.2
files: \.js$
exclude: ^(src/octoprint/vendor/|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/)
+1
View File
@@ -4,6 +4,7 @@
* [AVLTree](https://gist.github.com/viking/2424106) (modified): GPL, LGPL (dual licensed)
* [Babel JavaScript Support](https://github.com/mitsuhiko/babel/blob/master/contrib/babel.js): BSD
* [@babel/polyfill](https://babeljs.io/docs/en/babel-polyfill/): MIT
* [Bootstrap](http://getbootstrap.com/): Apache License 2.0
* [Bootstrap Modal](http://jschr.github.io/bootstrap-modal/): Apache License 2.0
* [Bootstrap Slider Knockout Binding](https://github.com/cosminstefanxp/bootstrap-slider-knockout-binding): MIT
+17
View File
@@ -68,6 +68,23 @@ OctoPrint's SockJS socket also accepts two commands from the client to the serve
"auth": "someuser:LGZ0trf8By"
}
An example for an auth roundtrip with only an API key using the :ref:`JS Client Library <sec-jsclientlib-base>`
can be found :ref:`here <sec-jsclient-socket-authsample>`.
.. mermaid::
sequenceDiagram
participant Client
participant API
participant Websocket
Client->>API: GET /api/login?passive=true&apikey=...
API->>Client: { name: ..., session: ..., ... }
note over Client: auth = name ":" session
Client->>Websocket: { "auth": auth }
* ``throttle``: Usually, OctoPrint will push the general state update
in the ``current`` message twice per second. For some clients that might still
be too fast, so they can signal a different factor to OctoPrint utilizing the
+1
View File
@@ -27,6 +27,7 @@ The plugin supports the following configuration keys:
* ``mobileSizeThreshold``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases
or release candidates). Defaults to ``false``.
* ``sizeThreshold``: Unique instance identifier, auto generated on first activation
* ``skipUntilThis``: If this string is provided the GCode Viewer will search for this string, and if found, skip all gcode up until this string. This can be used to skip prime nozzle gcode in the preview
.. _sec-bundledplugins-gcodeviewer-sourcecode:
+42 -10
View File
@@ -1,14 +1,15 @@
.. _sec-development-environment:
************************************
Setting up a Development environment
====================================
************************************
.. _sec-development-environment-source:
Obtaining, building and running the source
------------------------------------------
==========================================
This describes the general steps in obtaining, building and running. OS specific instructions can be found
This describes the **general, platform agnostic** steps in obtaining, building and running. OS specific instructions can be found
below.
* Prerequisites:
@@ -77,10 +78,11 @@ Go to the directory `docs` and you can then build the documentation:
* ``sphinx-build -b html . _build``
The documentation will be available in the newly created ``_build`` directory. You can simply browse it locally by opening ``index.html``
.. _sec-development-environment-source-linux:
Linux
.....
-----
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
@@ -119,7 +121,7 @@ You can then start OctoPrint via ``octoprint`` after activating one of the two v
.. _sec-development-environment-windows:
Windows
.......
-------
This assumes you'll host your OctoPrint development checkout at ``C:\Devel\OctoPrint``. If you want to use a different
location, please substitute accordingly.
@@ -131,8 +133,13 @@ First download & install:
* make sure to have the installer add Python to the ``PATH`` and have it install ``pip`` too
* it's recommended to install Python 2.7 into ``C:\Python27`` and Python 3 into ``C:\Python38`` - if you select
different install locations please substitute accordingly
* it's also recommended to have both versions get installed for all users
* `Build Tools for Visual Studio 2019 <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019>`_
* install "C++ build tools" and ensure the latest versions of "MSVCv142 - VS 2019 C++ x64/x86 build tools" and
"Windows 10 SDK" are checked.
* `Git for Windows <https://git-scm.com/downloads>`_
Open the Git Bash you just installed and in that:
@@ -145,15 +152,40 @@ Open the Git Bash you just installed and in that:
cd OctoPrint
virtualenv --python=C:\Python38\python.exe venv
source ./venv/Scripts/activate
pip install --upgrade pip
pip install -e .[develop,plugins,docs]
python -m pip install --upgrade pip
python -m pip install -e .[develop,plugins,docs]
pre-commit install
git config blame.ignoreRevsFile .git-blame-ignore-revs
.. _sec-development-environment-windows-optional:
Optional but recommended tools
..............................
These are some tools that are recommended but not required to have on hand:
* `Visual Studio Code <https://code.visualstudio.com/download>`_
* `Windows Terminal <https://github.com/microsoft/terminal>`_
Add the following profile to ``profiles.list`` in the settings, that will allow you to
easily start Git Bash from the terminal:
.. code-block:: js
{
"guid": "{3df4550c-eebd-496c-a189-e55f2f8b01ce}",
"hidden": false,
"name": "Git Bash",
"commandline": "C:\\Program Files\\Git\\bin\\bash.exe --login -i",
"startingDirectory": "C:\\Devel",
"tabTitle": "Git Bash",
"suppressApplicationTitle": true
},
.. _sec-development-environment-mac:
Mac OS X
........
--------
.. note::
@@ -204,7 +236,7 @@ You'll need a user account with administrator privileges.
.. _sec-development-environment-ides:
IDE Setup
---------
=========
.. todo::
@@ -215,7 +247,7 @@ IDE Setup
.. _sec-development-environment-ides-pycharm:
PyCharm
.......
-------
- "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
- Register virtual environments:
+1
View File
@@ -177,6 +177,7 @@ further down there's also a dedicated list of steps for OctoPi specifically.
salt line):
.. code-block:: yaml
accessControl:
salt: aabbccddee1234523452345
autologinLocal: true
+4 -4
View File
@@ -14,13 +14,13 @@
The client library instance's options. The following keys are currently supported:
``apikey``
The API Key to use for requests against the OctoPrint API. Should usually be
the anonymous UI API Key provided on the socket.
``baseurl``
The base URL of the OctoPrint API
``apikey``
The API Key to use for requests against the OctoPrint API. If left unset, you'll
need to authenticate your session through a login.
``locale``
The locale to set in ``X-Locale`` headers on API requests. Useful for API
endpoints that might return localized content.
+19
View File
@@ -29,6 +29,25 @@
Tries to perform a passive login into OctoPrint, using existing session data
stored in the browser's cookies.
.. code-block:: javascript
OctoPrint.browser.passiveLogin()
.done(function(response) {
// do something with the response
})
.. code-block:: javascript
var client = new OctoPrintClient({
baseurl: "https://example.com/",
apikey: "..."
});
client.browser.passiveLogin()
.done(function(response) {
// do something with the response, e.g. authenticate with the socket
// via response.name and response.session
})
:param object opts: Additional request options
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
+6
View File
@@ -40,6 +40,12 @@ because the library depends on those to be available (as ``$`` and ``_``). You c
<script src="{{ url_for("static", filename="js/lib/jquery/jquery.min.js") }}"></script>
<script src="{{ url_for("static", filename="js/lib/lodash.min.js") }}"></script>
Moreover, if you need to use the socket module, you'll need to include sockJS. You can embed it like this:
.. code-block:: html+jinja
<script src="{{ url_for("static", filename="js/lib/sockjs.min.js") }}"></script>
Note that all components depend on the ``base`` component to be present, so if you are only including a select
number of components, make sure to at the very least include that one to be able to utilize the client.
+42 -1
View File
@@ -64,12 +64,24 @@
Sends a message of type ``type`` with the provided ``payload`` to the server.
Note that at the time of writing, OctoPrint only supports the ``throttle`` message. See
Note that at the time of writing, OctoPrint only supports the ``throttle`` and ``auth`` messages. See
also the :ref:`Push API documentation <sec-api-push>`.
:param string type: Type of message to send
:param object payload: Payload to send
.. js:function:: OctoPrintClient.socket.sendAuth(userId, session)
Sends an ``auth`` message with the provided ``userId`` and ``session`` to the server.
``session`` is expected to be the ``session`` value retrieved
from any valid :ref:`OctoPrint.browser.login(userId,...) <sec-jsclientlib-browser>` response.
See also the :ref:`Push API documentation <sec-api-push>`.
:param string userId: An existing OctoPrint username
:param string session: A valid session id for the provided username
.. js:function:: OctoPrintClient.socket.onRateTooLow(measured, minimum)
Called by the socket client when the measured message round trip times have been lower than
@@ -102,6 +114,35 @@
Instructs the server to decrease the message rate by 500ms.
.. _sec-jsclient-socket-authsample:
Sample to setup an authed socket
================================
If you have a username and a password:
.. code-block:: javascript
OctoPrint.socket.connect();
OctoPrint.browser.login("myusername", "mypassword", true)
.done(function(response) {
OctoPrint.socket.sendAuth("myusername", response.session);
});
If you have an API key:
.. code-block:: javascript
var client = new OctoPrintClient({
baseurl: "http://example.com/",
apikey: "abcdef"
});
client.socket.connect();
client.browser.passiveLogin()
.done(function(response) {
client.socket.sendAuth(response.name, response.session);
});
.. _sec-jsclient-socket-throttling:
Communication Throttling
+1 -1
View File
@@ -347,7 +347,7 @@ class FilebasedGroupManager(GroupManager):
import yaml
yaml.safe_dump(
data, f, default_flow_style=False, indent=4, allow_unicode=True
data, f, default_flow_style=False, indent=2, allow_unicode=True
)
self._dirty = False
self._load()
+1 -1
View File
@@ -605,7 +605,7 @@ class FilebasedUserManager(UserManager):
self._userfile, mode="wt", permissions=0o600, max_permissions=0o666
) as f:
yaml.safe_dump(
data, f, default_flow_style=False, indent=4, allow_unicode=True
data, f, default_flow_style=False, indent=2, allow_unicode=True
)
self._dirty = False
self._load()
+1 -1
View File
@@ -140,7 +140,7 @@ def gcode_command(
yaml.safe_dump(
interpreter.get_result(),
default_flow_style=False,
indent=4,
indent=2,
allow_unicode=True,
)
)
+2 -2
View File
@@ -215,7 +215,7 @@ def get_command(ctx, path, as_json=False, as_yaml=False, as_raw=False):
output = json.dumps(value)
elif as_yaml:
output = yaml.safe_dump(
value, default_flow_style=False, indent=4, allow_unicode=True
value, default_flow_style=False, indent=2, allow_unicode=True
)
elif as_raw:
output = value
@@ -241,7 +241,7 @@ def effective_command(ctx, as_json=False, as_yaml=False, as_raw=False):
output = json.dumps(value)
elif as_yaml:
output = yaml.safe_dump(
value, default_flow_style=False, indent=4, allow_unicode=True
value, default_flow_style=False, indent=2, allow_unicode=True
)
elif as_raw:
output = value
+1 -1
View File
@@ -166,7 +166,7 @@ class EnvironmentDetector:
environment = copy.deepcopy(self._cache)
dumped_environment = yaml.safe_dump(
environment, default_flow_style=False, indent=4, allow_unicode=True
environment, default_flow_style=False, indent=2, allow_unicode=True
).strip()
environment_lines = "\n".join(
map(lambda l: "| {}".format(l), dumped_environment.split("\n"))
+2 -2
View File
@@ -1451,7 +1451,7 @@ class LocalFileStorage(Storage):
try:
with atomic_write(metadata_path, mode="wb") as f:
f.write(
to_bytes(json.dumps(metadata, indent=4, separators=(",", ": ")))
to_bytes(json.dumps(metadata, indent=2, separators=(",", ": ")))
)
except Exception:
self._logger.exception(
@@ -1525,7 +1525,7 @@ class LocalFileStorage(Storage):
return
with atomic_write(metadata_path_json, mode="wb") as f:
f.write(to_bytes(json.dumps(metadata, indent=4, separators=(",", ": "))))
f.write(to_bytes(json.dumps(metadata, indent=2, separators=(",", ": "))))
try:
os.remove(metadata_path_yaml)
+14 -4
View File
@@ -45,12 +45,15 @@ from flask_babel import gettext
from octoprint.plugins.pluginmanager import DEFAULT_PLUGIN_REPOSITORY
from octoprint.settings import valid_boolean_trues
from octoprint.util import get_formatted_size
from octoprint.util.text import sanitize
UNKNOWN_PLUGINS_FILE = "unknown_plugins_from_restore.json"
BACKUP_DATE_TIME_FMT = "%Y%m%d-%H%M%S"
MAX_UPLOAD_SIZE = 1024 * 1024 * 1024 # 1GB
class BackupPlugin(
octoprint.plugin.SettingsPlugin,
@@ -118,6 +121,12 @@ class BackupPlugin(
{"type": "wizard", "name": gettext("Restore Backup?")},
]
def get_template_vars(self):
return {
"max_upload_size": MAX_UPLOAD_SIZE,
"max_upload_size_str": get_formatted_size(MAX_UPLOAD_SIZE),
}
##~~ BlueprintPlugin
@octoprint.plugin.BlueprintPlugin.route("/", methods=["GET"])
@@ -131,6 +140,7 @@ class BackupPlugin(
backup_in_progress=len(self._in_progress) > 0,
unknown_plugins=unknown_plugins,
restore_supported=self._restore_supported(self._settings),
max_upload_size=MAX_UPLOAD_SIZE,
)
@octoprint.plugin.BlueprintPlugin.route("/unknown_plugins", methods=["GET"])
@@ -385,8 +395,8 @@ class BackupPlugin(
]
def bodysize_hook(self, current_max_body_sizes, *args, **kwargs):
# max upload size of 1GB for the restore endpoint
return [("POST", r"/restore", 1024 * 1024 * 1024)]
# max upload size for the restore endpoint
return [("POST", r"/restore", MAX_UPLOAD_SIZE)]
# Exported plugin helpers
def create_backup_helper(self, exclude=None, filename=None):
@@ -1136,8 +1146,8 @@ class BackupPlugin(
metadata_bytes = zip.read(metadata_zipinfo)
metadata = json.loads(metadata_bytes)
backup_version = get_comparable_version(metadata["version"], base=True)
if backup_version > get_octoprint_version(base=True):
backup_version = get_comparable_version(metadata["version"], cut=1)
if backup_version > get_octoprint_version(cut=1):
if callable(on_invalid_backup):
on_invalid_backup(
"Backup is from a newer version of OctoPrint and cannot be applied"
@@ -27,10 +27,15 @@ $(function () {
self.excludeFromBackup = ko.observableArray([]);
self.backupInProgress = ko.observable(false);
self.restoreSupported = ko.observable(true);
self.maxUploadSize = ko.observable(0);
self.backupUploadData = undefined;
self.backupUploadName = ko.observable();
self.isAboveUploadSize = function (data) {
return data.size > self.maxUploadSize();
};
var backupFileuploadOptions = {
dataType: "json",
maxNumberOfFiles: 1,
@@ -70,6 +75,7 @@ $(function () {
self.backups.updateItems(response.backups);
self.unknownPlugins(response.unknown_plugins);
self.restoreSupported(response.restore_supported);
self.maxUploadSize(response.max_upload_size);
};
self.createBackup = function () {
@@ -45,7 +45,7 @@
<td class="settings_plugin_backup_checkbox"><input type="checkbox" data-bind="value: name, checked: $root.markedForBackupDeletion"></td>
<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_size"><i class="fa fa-warning text-error" data-bind="visible: $root.isAboveUploadSize($data)" title="{{ _("This backup exceeds the maximum allowed upload size")|edq }}"></i> <span data-bind="text: formatSize(size)"></span></td>
<td class="settings_plugin_backup_actions"><a href="javascript:void(0)" title="{{ _('Delete')|edq }}" class="far fa-trash-alt" data-bind="click: function() { $parent.removeBackup($data.name) }, css: {disabled: $root.backupInProgress() || $root.restoreInProgress()}"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Download')|edq }}" class="fas fa-download" data-bind="attr: {href: url}"></a><span data-bind="visible: $parent.restoreSupported()">&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Restore')|edq }}" data-bind="click: function() { $parent.restoreBackup($data.name) }, css: {disabled: $root.backupInProgress() || $root.restoreInProgress()}"><i class="fas fa-sync"></i></a></span></td>
</tr>
</tbody>
@@ -61,6 +61,17 @@
<li data-bind="css: {disabled: backups.currentPage() === backups.lastPage()}"><a href="javascript:void(0)" data-bind="click: backups.nextPage">»</a></li>
</ul>
</div>
<p>
<strong>{{ _("Note:") }}</strong>
{% trans marker="<i class='fa fa-warning text-error'></i>" %}
OctoPrint currently only allows uploading backups of a maximum size of
{{ plugin_backup_max_upload_size_str }} via the UI. Backups larger than this can only be restored by command line,
or by adjusting the size by removing large contents (like timelapses) from the
zip prior to uploading. Backups exceeding this size limit are marked with a
{{ marker }} up there.
{% endtrans %}
</p>
</div>
<h3>{{ _('Create backup') }}</h3>
@@ -45,8 +45,9 @@ class GcodeviewerPlugin(
def get_settings_defaults(self):
return {
"mobileSizeThreshold": 2 * 1024 * 1024, # 2MB
"sizeThreshold": 20 * 1024 * 1024,
} # 20MB
"sizeThreshold": 20 * 1024 * 1024, # 20MB
"skipUntilThis": None,
}
def get_settings_version(self):
return 1
@@ -475,6 +475,20 @@ $(function () {
};
self.showGCodeViewer = function (response, rstatus) {
// Slice of the gcode
var findThis = self.settings.settings.plugins.gcodeviewer.skipUntilThis();
if (findThis && findThis !== "") {
var indexPos = response.indexOf("\n" + findThis);
// Try windows newlines if not found
if (indexPos === -1) {
indexPos = response.indexOf("\r" + findThis);
}
if (indexPos !== -1) {
// Slice and make sure we comment out any string left back after slicing - so if a user configures something like "G1" we dont end up with a snippet of gcode commands
// Yes it would be prettier to parse it line by line and remove the entire line, that is very slow and uses mem - this way we find the string, and remove it
response = ";" + response.slice(indexPos + findThis.length + 1);
}
}
var par = {
target: {
result: response
@@ -879,8 +893,8 @@ $(function () {
self.resetOptions();
var current = loadFromLocalStorage(optionsLocalStorageKey);
if (current["centerViewport"] !== undefined)
self.renderer_centerViewport(current["centerViewport"]);
if (current["centerViewPort"] !== undefined)
self.renderer_centerViewport(current["centerViewPort"]);
if (current["zoomOnModel"] !== undefined)
self.renderer_zoomOnModel(current["zoomOnModel"]);
if (current["showMoves"] !== undefined)
@@ -19,4 +19,15 @@
</span>
</div>
</div>
<div class="control-group" title="{{ _('Skip/Hide gcode until this string')}}">
<label class="control-label" for="settings-skipUntilThis">{{ _('Skip to this') }}</label>
<div class="controls">
<input type="text" class="input-block-level" data-bind="value: settings.settings.plugins.gcodeviewer.skipUntilThis" id="settings-skipUntilThis" placeholder="; layer 1">
</div>
<div class="controls">
<span class="help-inline">
{% trans %}If provided, the GCode Viewer will search for a line beginning with this string. If found, all GCode up to that point will be skipped. This can be used to skip "purge/nozzle wipe" GCode in the viewer. Note the search is case sensitive. Example: <code>; layer 1</code>{% endtrans %}
</span>
</div>
</div>
</form>
@@ -97,10 +97,10 @@ $(function () {
levels.push(item);
configuredLoggers.push(logger);
});
let sortedLevels = _.sortBy(levels, function (o) {
var sortedLevels = _.sortBy(levels, function (o) {
return o.component;
});
self.configuredLoggers(levels);
self.configuredLoggers(sortedLevels);
// loggers
var availableLoggers = _.difference(response.loggers, configuredLoggers);
@@ -29,7 +29,11 @@ from octoprint.server.util.flask import (
)
from octoprint.util import dict_merge, get_formatted_size, to_unicode
from octoprint.util.pip import create_pip_caller
from octoprint.util.version import get_comparable_version, get_python_version_string
from octoprint.util.version import (
get_comparable_version,
get_python_version_string,
is_python_compatible,
)
from . import cli, exceptions, updaters, util, version_checks
@@ -367,23 +371,33 @@ class SoftwareUpdatePlugin(
or self._overlay_cache_timestamp + self._overlay_cache_ttl < time.time()
)
def _get_check_overlay(self, url):
self._logger.info("Fetching check overlays from {}".format(url))
try:
r = requests.get(url, timeout=3.1)
r.raise_for_status()
data = r.json()
except Exception as exc:
self._logger.error(
"Could not fetch check overlay from {}: {}".format(url, exc)
)
return {}
else:
return data
def _get_check_overlays(self, force=False):
if self._check_overlays_stale or force:
if self._connectivity_checker.online:
# reload from URL
url = self._settings.get(["check_overlay_url"])
self._logger.info("Fetching check overlays from {}".format(url))
try:
r = requests.get(url, timeout=3.1)
r.raise_for_status()
data = r.json()
except Exception as exc:
self._logger.error(
"Could not fetch check overlay from {}: {}".format(url, exc)
self._overlay_cache = self._get_check_overlay(
self._settings.get(["check_overlay_url"])
)
if is_python_compatible("<3"):
data = self._get_check_overlay(
self._settings.get(["check_overlay_py2_url"])
)
self._overlay_cache = octoprint.util.dict_merge(
self._overlay_cache, data
)
self._overlay_cache = {}
else:
self._overlay_cache = data
else:
self._logger.info("Not fetching check overlays, we are offline")
@@ -530,6 +544,7 @@ class SoftwareUpdatePlugin(
"ignore_throttled": False,
"minimum_free_storage": 150,
"check_overlay_url": "https://plugins.octoprint.org/update_check_overlay.json",
"check_overlay_py2_url": "https://plugins.octoprint.org/update_check_overlay_py2.json",
"check_overlay_ttl": 6 * 60,
"credentials": {
"github": None,
@@ -1331,6 +1346,7 @@ class SoftwareUpdatePlugin(
)
target_disabled = populated_check.get("disabled", False)
target_compatible = populated_check.get("compatible", True)
update_available = update_available or (
target_update_available and not target_disabled
)
@@ -1380,6 +1396,7 @@ class SoftwareUpdatePlugin(
"online": target_online,
"error": target_error,
"disabled": target_disabled,
"compatible": target_compatible,
"releaseChannels": {},
}
@@ -1485,6 +1502,9 @@ class SoftwareUpdatePlugin(
update_available = False
error = None
disabled = check.get("disabled", False)
compatible = check.get("compatible", True)
try:
version_checker = self._get_version_checker(target, check)
information, is_current = version_checker.get_latest(
@@ -1501,7 +1521,7 @@ class SoftwareUpdatePlugin(
)
del self._version_cache[target]
self._version_cache_dirty = True
elif not is_current:
elif not is_current and compatible:
update_available = True
except exceptions.CannotCheckOffline:
update_possible = False
@@ -1539,15 +1559,15 @@ class SoftwareUpdatePlugin(
else:
try:
updater = self._get_updater(target, check)
update_possible = updater.can_perform_update(target, check, online=online)
update_possible = compatible and updater.can_perform_update(
target, check, online=online
)
except Exception:
self._logger.exception(
"Error while checking if {} can be updated".format(target)
)
update_possible = False
disabled = check.get("disabled", False)
self._version_cache[target] = {
"timestamp": time.time(),
"hash": current_hash,
@@ -1557,6 +1577,7 @@ class SoftwareUpdatePlugin(
"online": online,
"error": error,
"disabled": disabled,
"compatible": compatible,
}
self._version_cache_dirty = True
return information, update_available, update_possible, online, error
@@ -1638,7 +1659,7 @@ class SoftwareUpdatePlugin(
continue
check = checks[target]
if "enabled" in check and not check["enabled"]:
if not check.get("enabled", True) or not check.get("compatible", True):
continue
if target not in check_targets:
@@ -1731,8 +1752,17 @@ class SoftwareUpdatePlugin(
if not update_possible:
self._logger.warning(
"Cannot perform update for %s, update type is not fully configured"
% target
"Cannot perform update for {}, update type is not fully configured".format(
target
)
)
return False, None
if not information.get("compatible", True):
self._logger.warning(
"Cannot perform update for {}, update is reported as incompatible".format(
target
)
)
return False, None
@@ -386,7 +386,11 @@ $(function () {
text += "<ul class='fa-ul'>";
_.each(self.versions.items(), function (update_info) {
if (update_info.updateAvailable && !update_info.disabled) {
if (
update_info.updateAvailable &&
!update_info.disabled &&
update_info.compatible
) {
text +=
"<li>" +
"<i class='fa fa-li " +
@@ -92,18 +92,22 @@
<tbody data-bind="foreach: versions.paginatedItems">
<tr data-bind="attr: {title: displayName}">
<td class="settings_plugin_softwareupdate_column_update">
<a href="javascript:void(0)" data-bind="click: toggleDisabled"><i class="far" data-bind="css: { muted: !updateAvailable, 'fa-bell': !disabled, 'fa-bell-slash': disabled }" title="{{ _('Update available')|edq }}"></i></a><br />
<a href="javascript:void(0)" data-bind="visible: compatible, click: toggleDisabled"><i class="far" data-bind="css: { muted: !updateAvailable, 'fa-bell': !disabled, 'fa-bell-slash': disabled }" title="{{ _('Update available')|edq }}"></i></a>
<span data-bind="visible: !compatible" class="muted"><i class="fas fa-power-off" title="{{ _('Not compatible') }}|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: $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="fas 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">
<small data-bind="visible: compatible" class="muted">
<span data-bind="visible: releaseChannels && releaseChannels.available" class="line">{{ _('Release Channel:') }} <select class="settings_plugin_softwareupdate_release_channel" data-bind="visible: releaseChannels && releaseChannels.available, value: releaseChannels.current, options: releaseChannels.available, optionsText: 'name', optionsValue: 'channel'"></select> <a href="https://faq.octoprint.org/using-release-channels" target="_blank"><i class="fas fa-question-circle"></i></a></span>
<span class="line">{{ _('Installed:') }} <span data-bind="text: information.local.name"></span></span>
<span class="line">{{ _('Available:') }} <span data-bind="text: information.remote.name"></span></span>
<span class="line" data-bind="visible: releaseNotes">{{ _('Release Notes:') }} <a data-bind="attr: {href: releaseNotes}, text: releaseNotes" target="_blank" rel="noreferrer noopener"></a></span>
<span class="line text-error" data-bind="visible: error, text: $root.errorTextForEntry($data)"></span>
</small>
<small data-bind="visible: !compatible">
<span class="line text-error">{{ _('Newer versions of this plugin are not compatible to this setup.') }}</span>
</small>
</td>
</tr>
</tbody>
+8 -4
View File
@@ -2011,6 +2011,7 @@ class Server:
)
js_libs = [
"js/lib/babel-polyfill.min.js",
"js/lib/jquery/jquery.min.js",
"js/lib/modernizr.custom.js",
"js/lib/lodash.min.js",
@@ -2056,6 +2057,7 @@ class Server:
"js/lib/sockjs.min.js",
"js/lib/ResizeSensor.js",
"js/lib/hls.js",
"js/lib/less.js",
]
js_client = [
"js/app/client/base.js",
@@ -2100,6 +2102,7 @@ class Server:
JsDelimiterBundler,
JsPluginBundle,
LessImportRewrite,
RJSMinExtended,
SourceMapRemove,
SourceMapRewrite,
)
@@ -2109,6 +2112,7 @@ class Server:
register_filter(SourceMapRemove)
register_filter(JsDelimiterBundler)
register_filter(GzipFile)
register_filter(RJSMinExtended)
def all_assets_for_plugins(collection):
"""Gets all plugin assets for a dict of plugin->assets"""
@@ -2119,16 +2123,16 @@ class Server:
# -- JS --------------------------------------------------------------------------------------------------------
filters = ["sourcemap_remove", "js_delimiter_bundler"]
filters = ["sourcemap_remove"]
if self._settings.getBoolean(["devel", "webassets", "minify"]):
filters.append("rjsmin")
filters.append("gzip")
filters += ["rjsmin_extended"]
filters += ["js_delimiter_bundler", "gzip"]
js_filters = filters
if self._settings.getBoolean(["devel", "webassets", "minify_plugins"]):
js_plugin_filters = js_filters
else:
js_plugin_filters = [x for x in js_filters if x not in ("rjsmin",)]
js_plugin_filters = [x for x in js_filters if x not in ("rjsmin_extended",)]
def js_bundles_for_plugins(collection, filters=None):
"""Produces JsPluginBundle instances that output IIFE wrapped assets"""
+1 -1
View File
@@ -1053,7 +1053,7 @@ class PreemptiveCache:
data,
handle,
default_flow_style=False,
indent=4,
indent=2,
allow_unicode=True,
)
except Exception:
+1 -2
View File
@@ -43,8 +43,7 @@ class GcodeWatchdogHandler(watchdog.events.PatternMatchingEventHandler):
"""Recursively yield DirEntry objects for given directory."""
for entry in scandir(path):
if entry.is_dir(follow_symlinks=False):
for entry in _recursive_scandir(entry.path):
yield entry
yield from _recursive_scandir(entry.path)
else:
yield entry
+17
View File
@@ -12,6 +12,7 @@ import webassets.filter.cssrewrite.urlpath as urlpath
from webassets.bundle import Bundle
from webassets.filter import Filter
from webassets.filter.cssrewrite.base import PatternRewriter
from webassets.filter.rjsmin import rjsmin
from webassets.merge import BaseHunk, MemoryHunk
@@ -98,6 +99,22 @@ class JsDelimiterBundler(Filter):
out.write("\n;\n")
class RJSMinExtended(Filter):
name = "rjsmin_extended"
options = {
"keep_bang_comments": "RJSMIN_KEEP_BANG_COMMENTS",
}
def input(self, _in, out, **kw):
source = kw["source"]
if source.endswith(".min.js"):
# out.write("// source is already minified, not minifying again\n")
out.write(_in.read())
else:
keep = self.keep_bang_comments or False
out.write(rjsmin.jsmin(_in.read(), keep_bang_comments=keep))
class GzipFile(Filter):
name = "gzip"
options = {}
+13
View File
@@ -224,6 +224,19 @@ def recovery():
except Exception:
_logger.exception("Error processing theming CSS, ignoring")
try:
from octoprint.plugins.backup import MAX_UPLOAD_SIZE
from octoprint.util import get_formatted_size
render_kwargs.update(
{
"plugin_backup_max_upload_size": MAX_UPLOAD_SIZE,
"plugin_backup_max_upload_size_str": get_formatted_size(MAX_UPLOAD_SIZE),
}
)
except Exception:
_logger.exception("Error adding backup upload size info, ignoring")
return render_template("recovery.jinja2", **render_kwargs)
+1 -1
View File
@@ -2045,7 +2045,7 @@ class Settings:
self._config,
configFile,
default_flow_style=False,
indent=4,
indent=2,
allow_unicode=True,
)
self._dirty = False
+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,.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;*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.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.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:focus,.btn:hover{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:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;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{color:#fff;text-shadow:0 -1px 0 rgba(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;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.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,.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;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine 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,.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;*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.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.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:focus,.btn:hover{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:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;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{color:#fff;text-shadow:0 -1px 0 rgba(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;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.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,.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;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
+6
View File
@@ -0,0 +1,6 @@
/*
* @babel/polyfill
* license: MIT
* source: https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.12.1/polyfill.min.js
*/
!function r(c,a,f){function o(n,t){if(!a[n]){if(!c[n]){var e="function"==typeof require&&require;if(!t&&e)return e(n,!0);if(s)return s(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var u=a[n]={exports:{}};c[n][0].call(u.exports,function(t){return o(c[n][1][t]||t)},u,u.exports,r,c,a,f)}return a[n].exports}for(var s="function"==typeof require&&require,t=0;t<f.length;t++)o(f[t]);return o}({1:[function(t,n,r){t(276),t(212),t(214),t(213),t(216),t(218),t(223),t(217),t(215),t(225),t(224),t(220),t(221),t(219),t(211),t(222),t(226),t(227),t(178),t(180),t(179),t(229),t(228),t(199),t(209),t(210),t(200),t(201),t(202),t(203),t(204),t(205),t(206),t(207),t(208),t(182),t(183),t(184),t(185),t(186),t(187),t(188),t(189),t(190),t(191),t(192),t(193),t(194),t(195),t(196),t(197),t(198),t(263),t(268),t(275),t(266),t(258),t(259),t(264),t(269),t(271),t(254),t(255),t(256),t(257),t(260),t(261),t(262),t(265),t(267),t(270),t(272),t(273),t(274),t(173),t(175),t(174),t(177),t(176),t(161),t(159),t(166),t(163),t(169),t(171),t(158),t(165),t(155),t(170),t(153),t(168),t(167),t(160),t(164),t(152),t(154),t(157),t(156),t(172),t(162),t(245),t(246),t(252),t(247),t(248),t(249),t(250),t(251),t(230),t(181),t(253),t(288),t(289),t(277),t(278),t(283),t(286),t(287),t(281),t(284),t(282),t(285),t(279),t(280),t(231),t(232),t(233),t(234),t(235),t(238),t(236),t(237),t(239),t(240),t(241),t(242),t(244),t(243),n.exports=t(50)},{152:152,153:153,154:154,155:155,156:156,157:157,158:158,159:159,160:160,161:161,162:162,163:163,164:164,165:165,166:166,167:167,168:168,169:169,170:170,171:171,172:172,173:173,174:174,175:175,176:176,177:177,178:178,179:179,180:180,181:181,182:182,183:183,184:184,185:185,186:186,187:187,188:188,189:189,190:190,191:191,192:192,193:193,194:194,195:195,196:196,197:197,198:198,199:199,200:200,201:201,202:202,203:203,204:204,205:205,206:206,207:207,208:208,209:209,210:210,211:211,212:212,213:213,214:214,215:215,216:216,217:217,218:218,219:219,220:220,221:221,222:222,223:223,224:224,225:225,226:226,227:227,228:228,229:229,230:230,231:231,232:232,233:233,234:234,235:235,236:236,237:237,238:238,239:239,240:240,241:241,242:242,243:243,244:244,245:245,246:246,247:247,248:248,249:249,250:250,251:251,252:252,253:253,254:254,255:255,256:256,257:257,258:258,259:259,260:260,261:261,262:262,263:263,264:264,265:265,266:266,267:267,268:268,269:269,270:270,271:271,272:272,273:273,274:274,275:275,276:276,277:277,278:278,279:279,280:280,281:281,282:282,283:283,284:284,285:285,286:286,287:287,288:288,289:289,50:50}],2:[function(t,n,r){t(290),n.exports=t(50).Array.flatMap},{290:290,50:50}],3:[function(t,n,r){t(291),n.exports=t(50).Array.includes},{291:291,50:50}],4:[function(t,n,r){t(292),n.exports=t(50).Object.entries},{292:292,50:50}],5:[function(t,n,r){t(293),n.exports=t(50).Object.getOwnPropertyDescriptors},{293:293,50:50}],6:[function(t,n,r){t(294),n.exports=t(50).Object.values},{294:294,50:50}],7:[function(t,n,r){"use strict";t(230),t(295),n.exports=t(50).Promise.finally},{230:230,295:295,50:50}],8:[function(t,n,r){t(296),n.exports=t(50).String.padEnd},{296:296,50:50}],9:[function(t,n,r){t(297),n.exports=t(50).String.padStart},{297:297,50:50}],10:[function(t,n,r){t(299),n.exports=t(50).String.trimRight},{299:299,50:50}],11:[function(t,n,r){t(298),n.exports=t(50).String.trimLeft},{298:298,50:50}],12:[function(t,n,r){t(300),n.exports=t(149).f("asyncIterator")},{149:149,300:300}],13:[function(t,n,r){t(30),n.exports=t(16).global},{16:16,30:30}],14:[function(t,n,r){n.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},{}],15:[function(t,n,r){var e=t(26);n.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},{26:26}],16:[function(t,n,r){var e=n.exports={version:"2.6.11"};"number"==typeof __e&&(__e=e)},{}],17:[function(t,n,r){var o=t(14);n.exports=function(e,i,t){if(o(e),void 0===i)return e;switch(t){case 1:return function(t){return e.call(i,t)};case 2:return function(t,n){return e.call(i,t,n)};case 3:return function(t,n,r){return e.call(i,t,n,r)}}return function(){return e.apply(i,arguments)}}},{14:14}],18:[function(t,n,r){n.exports=!t(21)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{21:21}],19:[function(t,n,r){var e=t(26),i=t(22).document,o=e(i)&&e(i.createElement);n.exports=function(t){return o?i.createElement(t):{}}},{22:22,26:26}],20:[function(t,n,r){var g=t(22),y=t(16),d=t(17),x=t(24),m=t(23),S="prototype",b=function(t,n,r){var e,i,o,u=t&b.F,c=t&b.G,a=t&b.S,f=t&b.P,s=t&b.B,l=t&b.W,h=c?y:y[n]||(y[n]={}),p=h[S],v=c?g:a?g[n]:(g[n]||{})[S];for(e in c&&(r=n),r)(i=!u&&v&&void 0!==v[e])&&m(h,e)||(o=i?v[e]:r[e],h[e]=c&&"function"!=typeof v[e]?r[e]:s&&i?d(o,g):l&&v[e]==o?function(e){function ib(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)}return ib[S]=e[S],ib}(o):f&&"function"==typeof o?d(FunctLine truncated
+11277
View File
File diff suppressed because it is too large. Load diff
-11
View File
@@ -1,11 +0,0 @@
/**
* Less - Leaner CSS v3.12.2
* http://lesscss.org
*
* Copyright (c) 2009-2020, Alexis Sellier <self@cloudhead.net>
* Licensed under the Apache-2.0 License.
*
* @license Apache-2.0
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).less=t()}(this,(function(){"use strict";function e(e){return e.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/[\?\&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function t(e,t){for(var n in t.dataset)if(t.dataset.hasOwnProperty(n))if("env"===n||"dumpLineNumbers"===n||"rootpath"===n||"errorReporting"===n)e[n]=t.dataset[n];else try{e[n]=JSON.parse(t.dataset[n])}catch(e){}}var n=function(t,n,i){var r=i.href||"",o="less:"+(i.title||e(r)),s=t.getElementById(o),a=!1,l=t.createElement("style");l.setAttribute("type","text/css"),i.media&&l.setAttribute("media",i.media),l.id=o,l.styleSheet||(l.appendChild(t.createTextNode(n)),a=null!==s&&s.childNodes.length>0&&l.childNodes.length>0&&s.firstChild.nodeValue===l.firstChild.nodeValue);var u=t.getElementsByTagName("head")[0];if(null===s||!1===a){var c=i&&i.nextSibling||null;c?c.parentNode.insertBefore(l,c):u.appendChild(l)}if(s&&!1===a&&s.parentNode.removeChild(s),l.styleSheet)try{l.styleSheet.cssText=n}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}},i=function(e){var t,n=e.document;return n.currentScript||(t=n.getElementsByTagName("script"))[t.length-1]},r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function a(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}var l={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},u={lenLine truncated
//# sourceMappingURL=less.min.js.map
+4
View File
@@ -16,6 +16,8 @@ $(function () {
var buttonElement = $("#login-button");
var reconnectElement = $("#login-reconnect");
var ignoreDisconnect = false;
buttonElement.click(function () {
var usernameElement = $("#login-user");
var passwordElement = $("#login-password");
@@ -31,6 +33,7 @@ $(function () {
OctoPrint.browser
.login(username, password, remember)
.done(function () {
ignoreDisconnect = true;
window.location.href = REDIRECT_URL;
})
.fail(function () {
@@ -52,6 +55,7 @@ $(function () {
};
OctoPrint.socket.onDisconnected = function () {
if (ignoreDisconnect) return;
buttonElement.prop("disabled", true);
offlineElement.addClass("in");
};
@@ -53,6 +53,10 @@ $(function () {
self.restoreSupported = ko.observable(false);
self.backups = ko.observableArray([]);
self.excludeFromBackup = ko.observableArray([]);
self.backupMaxUploadSize = ko.observable();
self.backupIsAboveUploadSize = function (data) {
return data.size > self.backupMaxUploadSize();
};
// working dialog
self.workDialog = $("#workdialog");
@@ -96,6 +100,7 @@ $(function () {
OctoPrint.plugins.backup.get().done(function (resp) {
self.backupSupported(true);
self.restoreSupported(resp.restore_supported);
self.backupMaxUploadSize(resp.max_upload_size);
var backups = resp.backups;
backups.sort(function (a, b) {
+1 -1
View File
@@ -253,7 +253,7 @@ body {
.accordion-heading-button {
float: right;
a {
> a {
display: inline-block;
padding: 8px 15px;
font-size: 14px;
+13 -1
View File
@@ -132,7 +132,9 @@
<tbody data-bind="foreach: backups">
<tr>
<td><a href="javascript:void(0)" data-bind="text: name, attr: {href: url}"></a></td>
<td style="text-align: right" data-bind="text: formatSize(size)"></td>
<td style="text-align: right">
<strong data-bind="visible: $root.backupIsAboveUploadSize($data)" class="text-error">!</strong> <span data-bind="text: formatSize(size)"></span>
</td>
<td style="text-align: center" data-bind="text: formatDate(date)"></td>
<td style="text-align: center">
<button class="btn btn-small" data-bind="visible: $root.restoreSupported, click: $root.restoreBackup">{{ _('Restore') }}</button>
@@ -141,6 +143,16 @@
</tr>
</tbody>
</table>
<p data-bind="visible: backups().length > 0">
<strong>{{ _("Note:") }}</strong>
{% trans marker="<strong class='text-error'>!</strong>" %}
OctoPrint currently only allows uploading backups of a maximum size of
{{ plugin_backup_max_upload_size_str }} via the UI. Backups larger than this can only be restored by command line,
or by adjusting the size by removing large contents (like timelapses) from the
zip prior to uploading. Backups exceeding this size limit are marked with a
{{ marker }} up there.
{% endtrans %}
</p>
<p data-bind="visible: backups().length <= 0">
{{ _('There are no backups yet.') }}
</p>
@@ -1,4 +1,4 @@
<!-- must be kept in sync with stylesheets-preload.jinja2! -->
<!-- must be kept in sync with stylesheets.jinja2! -->
{% assets "css_libs" %}<link rel="preload" as="style" href="{{ ASSET_URL }}">{% endassets %}
{% assets "css_core" %}<link rel="preload" as="style" href="{{ ASSET_URL }}">{% endassets %}
{% assets "css_plugins" %}<link rel="preload" as="style" href="{{ ASSET_URL }}">{% endassets %}
@@ -4,4 +4,3 @@
{% assets "css_plugins" %}<link href="{{ ASSET_URL }}" rel="stylesheet" media="screen">{% endassets %}
{% assets "less_core" %}<link href="{{ ASSET_URL }}" rel="stylesheet/less" type="text/css" media="screen">{% endassets %}
{% assets "less_plugins" %}<link href="{{ ASSET_URL }}" rel="stylesheet/less" type="text/css" media="screen">{% endassets %}
<script src="{{ url_for('static', filename='js/lib/less.min.js') }}" type="text/javascript"></script>
+1 -1
View File
@@ -1,7 +1,7 @@
{% if enableWebcam %}
<!-- ko if: loginState.hasPermissionKo(access.permissions.WEBCAM) -->
<div id="webcam_hls_container" tabindex="0" data-bind="visible: webcamHlsEnabled()">
<video id="webcam_hls" muted autoplay style="width: 100%"/>
<video id="webcam_hls" muted autoplay style="width: 100%"></video>
</div>
<div id="webcam_container" tabindex="0" data-bind="event: { keydown: onKeyDown, mouseover: onMouseOver, mouseout: onMouseOut, focus: onFocus }, visible: webcamMjpgEnabled()">
<div class="nowebcam" data-bind="visible: !webcamLoaded()">
+6 -2
View File
@@ -169,7 +169,7 @@ Groups will be as follows:
* ``value``: reported position value
"""
regex_firmware_splitter = re.compile(r"\s*([A-Z0-9_]+):\s*")
regex_firmware_splitter = re.compile(r"(^|\s+)([A-Z][A-Z0-9_]*):")
"""Regex to use for splitting M115 responses."""
regex_resend_linenumber = re.compile(r"(N|N:)?(?P<n>%s)" % regex_int_pattern)
@@ -6074,6 +6074,10 @@ def parse_firmware_line(line):
The result will be a dictionary mapping from the contained keys to the contained
values.
Valid keys must only contain A-Z, 0-9 and _ and must start with a letter. See the
unit tests for valid and invalid examples. There sadly is no existing specification
of the key format, but this is the format extracted from real life logs.
Arguments:
line (str): the line to parse
@@ -6091,7 +6095,7 @@ def parse_firmware_line(line):
split_line = regex_firmware_splitter.split(line.strip())[
1:
] # first entry is empty start of trimmed string
for key, value in chunks(split_line, 2):
for _, key, value in chunks(split_line, 3):
result[key] = value.strip()
return result
+45 -19
View File
@@ -15,9 +15,9 @@ def get_octoprint_version_string():
return __version__
def get_octoprint_version(base=False):
octoprint_version_string = get_octoprint_version_string()
return get_comparable_version(octoprint_version_string, base=base)
def get_octoprint_version(cut=None, **kwargs):
octoprint_version_string = normalize_version(get_octoprint_version_string())
return get_comparable_version(octoprint_version_string, cut=cut, **kwargs)
def is_released_octoprint_version(version=None):
@@ -126,11 +126,7 @@ def is_octoprint_compatible(*compatibility_entries, **kwargs):
def get_python_version_string():
from platform import python_version
version_string = python_version()
# Debian has the python version set to 2.7.15+ which is not PEP440 compliant (bug 914072)
if version_string.endswith("+"):
version_string = version_string[:-1]
version_string = normalize_version(python_version())
return version_string
@@ -151,21 +147,27 @@ def is_python_compatible(compat, **kwargs):
return python_version in s
def get_comparable_version(version_string, base=False):
if "-" in version_string:
version_string = version_string[: version_string.find("-")]
def get_comparable_version(version_string, cut=None, **kwargs):
"""
Args:
version_string: The version string for which to create a comparable version instance
cut: optional, how many version digits to remove (e.g., cut=1 will turn 1.2.3 into 1.2).
Defaults to ``None``, meaning no further action. Settings this to 0 will remove
anything up to the last digit, e.g. dev or rc information.
# Debian has the python version set to 2.7.15+ which is not PEP440 compliant (bug 914072)
if version_string.endswith("+"):
version_string = version_string[:-1]
Returns:
A comparable version
"""
if "base" in kwargs and kwargs.get("base", False) and cut is None:
cut = 0
if cut is not None and (cut < 0 or not isinstance(cut, int)):
raise ValueError("level must be a positive integer")
version_string = normalize_version(version_string)
version = pkg_resources.parse_version(version_string)
# A leading v is common in github release tags and old setuptools doesn't remove it.
if version and isinstance(version, tuple) and version[0].lower() == "*v":
version = version[1:]
if base:
if cut is not None:
if isinstance(version, tuple):
# old setuptools
base_version = []
@@ -173,11 +175,21 @@ def get_comparable_version(version_string, base=False):
if part.startswith("*"):
break
base_version.append(part)
if 0 < cut < len(base_version):
base_version = base_version[:-cut]
base_version.append("*final")
version = tuple(base_version)
else:
# new setuptools
version = pkg_resources.parse_version(version.base_version)
if cut is not None:
parts = version.base_version.split(".")
if 0 < cut < len(parts):
reduced = parts[:-cut]
version = pkg_resources.parse_version(
".".join(str(x) for x in reduced)
)
return version
@@ -190,3 +202,17 @@ def is_prerelease(version_string):
else:
# new setuptools
return version.is_prerelease
def normalize_version(version):
if "-" in version:
version = version[: version.find("-")]
# Debian has the python version set to 2.7.15+ which is not PEP440 compliant (bug 914072)
if version.endswith("+"):
version = version[:-1]
if version[0].lower() == "v":
version = version[1:]
return version.strip()
+3
View File
@@ -607,6 +607,9 @@ class TestSettings(unittest.TestCase):
basedir, configfile = paths
settings = octoprint.settings.Settings()
# Make sure the config files last modified time changes
time.sleep(1.0)
self.assertEqual("0.0.0.0", settings.get(["server", "host"]))
# modify yaml file externally
+17
View File
@@ -373,6 +373,23 @@ class TestCommHelpers(unittest.TestCase):
"UUID": "00000000-0000-0000-0000-000000000000",
},
),
# Test firmware name with time created
(
"FIRMWARE_NAME:Marlin 2.0.7.2 (Nov 27 2020 14:30:11) SOURCE_CODE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Ender 5 Pro EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff",
{
"FIRMWARE_NAME": "Marlin 2.0.7.2 (Nov 27 2020 14:30:11)",
"SOURCE_CODE_URL": "https://github.com/MarlinFirmware/Marlin",
"PROTOCOL_VERSION": "1.0",
"MACHINE_TYPE": "Ender 5 Pro",
"EXTRUDER_COUNT": "1",
"UUID": "cede2a2f-41a2-4748-9b12-c55c62f367ff",
},
),
# Test that keys beginning with _ or number are ignored
(
"KEY1:VALUE1 _KEY2:INVALID 123:INVALID 1KEY:INVALID KEY2:VALUE2",
{"KEY1": "VALUE1 _KEY2:INVALID 123:INVALID 1KEY:INVALID", "KEY2": "VALUE2"},
),
)
@unpack
def test_parse_firmware_line(self, line, expected):
+54
View File
@@ -0,0 +1,54 @@
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
__copyright__ = "Copyright (C) 2021 The OctoPrint Project - Released under terms of the AGPLv3 License"
import unittest
import ddt
import pkg_resources
@ddt.ddt
class VersionUtilTest(unittest.TestCase):
@ddt.data(
("1.6.0.dev303+g328853170.dirty", None, "1.6.0.dev303+g328853170.dirty"),
("1.6.0.dev303+g328853170.dirty", 0, "1.6.0"),
("1.6.0.dev303+g328853170.dirty", 1, "1.6"),
("1.6.0", 0, "1.6.0"),
("1.6.0", 23, "1.6.0"),
("1.6.0", -1, ValueError),
)
@ddt.unpack
def test_get_comparable_version(self, version, cut, expected):
from octoprint.util.version import get_comparable_version
try:
actual = get_comparable_version(version, cut=cut)
except Exception as exc:
if isinstance(expected, type) and isinstance(exc, expected):
pass
else:
raise
else:
self.assertEqual(actual, pkg_resources.parse_version(expected))
def test_get_comparable_version_base(self):
from octoprint.util.version import get_comparable_version
actual = get_comparable_version("1.6.0.dev303+g328853170.dirty", base=True)
self.assertEqual(actual, pkg_resources.parse_version("1.6.0"))
@ddt.data(
("1.6.0", "1.6.0"),
("v1.6.0", "1.6.0"),
("V1.6.0", "1.6.0"),
("1.6.0+", "1.6.0"),
("\t1.6.0 \r\n", "1.6.0"),
("1.6.0-dev123", "1.6.0"),
)
@ddt.unpack
def test_normalize_version(self, version, expected):
from octoprint.util.version import normalize_version
actual = normalize_version(version)
self.assertEqual(actual, expected)