Compare commits

...
Author SHA1 Message Date
Gina Häußge c9bb0eca29 🐛 Fix connections being closed too early
Turned UploadStorageFallbackHandler async for this as well.
2023-11-24 17:34:31 +01:00
Gina Häußge 10c4e6fe89 ⬆️ Upgrade Playwright 2023-11-24 17:33:31 +01:00
Gina Häußge 12833a3b83 ⚡️ Make WSGIContainer use threads for async handling
Copied from current tornado.wsgi.WSGIContainer. Seems to solve
#4764. UploadStorageFallbackHandler needed some adjustments
to not delete the tmp files too early.
2023-11-23 17:11:46 +01:00
GitHub Nightly Merge Action 8b4e40ac32 Merge branch 'master' into maintenance 2023-11-23 00:12:06 +00:00
Credomane Evonguard 3fae2952b1 🚸 Add APIKey details to user settings so QRCode can be viewed. (#4895)
Closes #4894
2023-11-22 17:22:29 +01:00
evan.wurden 8bcebb7ed9 🚸 Add axis labels to model size dimensions (#4898)
Closes #4866
2023-11-22 17:19:18 +01:00
dependabot[bot] a93b4d3972 👷 Bump dessant/lock-threads from 4 to 5 (#4910)
Bumps [dessant/lock-threads](https://github.com/dessant/lock-threads) from 4 to 5.
- [Release notes](https://github.com/dessant/lock-threads/releases)
- [Changelog](https://github.com/dessant/lock-threads/blob/main/CHANGELOG.md)
- [Commits](https://github.com/dessant/lock-threads/compare/v4...v5)

---
updated-dependencies:
- dependency-name: dessant/lock-threads
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-22 17:16:58 +01:00
dependabot[bot] b141f79669 👷 Bump actions/github-script from 6 to 7 (#4909)
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-22 17:15:57 +01:00
Gina Häußge 2480fcd390 📝 Update plugin tutorial
Make sure cookiecutter templates are correctly shown.

Closes #4852
2023-11-22 15:24:06 +01:00
Gina Häußge fcc99bd2ce 👷 Publish release artifacts as release assets
Closes #4908
2023-11-21 17:50:23 +01:00
Gina Häußge 3953f6309b 📝 logViewModel -> logsViewModel
Closes #4906
2023-11-21 17:03:38 +01:00
Gina Häußge bfd7199afc 🔥 Get rid of unmaintained scripts folder
Closes #4880
2023-11-20 16:05:59 +01:00
Gina Häußge 395a82b14a 🥅 Logging in case of temp parsing errors
See #4903
2023-11-20 11:50:27 +01:00
Gina Häußge a1f43ced66 🥅 Protect offset code against empty temps
Potential fix for #4903
2023-11-20 11:12:54 +01:00
Gina Häußge 5ab0786873 📝 Add note about settings vs data folder
Closes #4787
2023-11-20 10:53:30 +01:00
cociweb 35b12fdf05 🌐 Correct Model vs Modell typos (#4897) 2023-10-27 10:59:42 +02:00
Hynek SchlawackandGina Häußge 4b7cd98e5a 📌 Remove upper pin from argon2-cffi (#4899)
argon2-cffi uses calendar versioning, therefore the pin achieves no compatibility promises and only limits releases to from before 2022.

Co-authored-by: Gina Häußge <gina@octoprint.org>
2023-10-27 10:48:41 +02:00
Gina Häußge 628e8d6589 ✨ Add funding link to footer 2023-10-24 15:57:23 +02:00
Gina Häußge 406c8d857d ✨ Add funding banner to About dialog 2023-10-24 15:57:14 +02:00
Gina Häußge 5b4b029d1d 🚸 More visible funding request in wizard 2023-10-24 15:57:06 +02:00
Gina Häußge 4830ac53c7 ✨ Add operation to FileRemoved event
Also document operation field for FileAdded.
2023-10-24 15:56:55 +02:00
Gina Häußge 523d4aa5ac ✨ Add progress to Print(Failed|Cancelled|Paused) events 2023-10-24 15:56:45 +02:00
Gina Häußge 8a4db71e07 Merge branch 'maintenance' of github.com:OctoPrint/OctoPrint into maintenance 2023-10-19 13:26:30 +02:00
GitHub Nightly Merge Action 1a40b7ac05 Merge branch 'master' into maintenance 2023-10-19 00:11:21 +00:00
Gina Häußge dfe2893049 💸 Update FUNDING.yml
Add ko-fi and liberapay links
2023-10-18 15:05:39 +02:00
Gina Häußge d825eeffe7 🥅 plugin_version could be None
E.g. if we try to load notifications for a bundled plugin (could
happen in case of identifier clash - normally *shouldn't* but just
did during development, so better safe than sorry)
2023-10-17 16:54:08 +02:00
Gina Häußge fb7fa0bde8 Merge branch 'improve/replace_versioneer' into maintenance 2023-10-16 14:41:47 +02:00
GitHub Nightly Merge Action 8f7dff1bc0 Merge branch 'master' into maintenance 2023-10-13 00:11:45 +00:00
Gina Häußge f325791ec6 ⏪ Revert the addition of 3.11.2 to test install matrix 2023-10-12 14:14:35 +02:00
Gina Häußge df257eca83 👷 Fix a typo 2023-10-12 10:47:31 +02:00
Gina Häußge 74990e8ee6 👷 Add bookworm python 3 version to test matrix 2023-10-12 10:46:01 +02:00
Gina Häußge 2813baa232 Merge branch 'staging/bugfix' into maintenance 2023-10-09 17:20:01 +02:00
Gina Häußge 8365b47bd5 🔖 staging/bugfix is now 1.9.4.dev 2023-10-09 17:19:40 +02:00
Gina Häußge 506648c152 🔖 Preparing release of 1.9.3 2023-10-09 14:32:34 +02:00
Gina Häußge d0072cff89 Merge branch 'bug/gcode_script_vuln' into staging/bugfix 2023-10-09 14:31:21 +02:00
Gina Häußge 2b7c01563f 📌 Pin pydantic to 1.10.12
Solves #4893 by working around pydantic/pydantic#7689
2023-10-09 10:49:37 +02:00
Gina Häußge 7bfd77d9eb Merge branch 'master' into staging/bugfix 2023-10-09 10:19:41 +02:00
Gina Häußge 5ca7f07cb7 👷 Include server run in test install workflow 2023-10-09 10:13:40 +02:00
Gina Häußge 3bde48a9fb 🔒️ Use sandboxed jinja env for gcode scripts
Without this patch, an attacker with admin rights could configure
a specially crafted GCODE Script to allow for code execution during
rendering of that script. An attacker might use this to extract data
managed by OctoPrint, or manipulate data managed by OctoPrint,
as well as execute arbitrary commands with the rights of the
OctoPrint process on the server system.

Fixes a reported security issue, CVE pending.
2023-08-31 16:35:08 +02:00
38 changed files with 481 additions and 445 deletions

No files matched your search

+2
View File
@@ -1,5 +1,7 @@
# These are supported funding model platforms # These are supported funding model platforms
github: [foosel] github: [foosel]
ko_fi: OctoPrint
patreon: foosel patreon: foosel
liberapay: foosel
custom: https://octoprint.org/support-octoprint/ custom: https://octoprint.org/support-octoprint/
+32 -5
View File
@@ -195,8 +195,8 @@ jobs:
name: octoprint-logs name: octoprint-logs
path: ${{ github.workspace }}/e2econfig/logs path: ${{ github.workspace }}/e2econfig/logs
publish-on-testpypi: publish-on-release:
name: 📦 Publish on TestPyPI name: 📦 Publish on GitHub release
if: github.event_name == 'release' && github.repository == 'OctoPrint/OctoPrint' if: github.event_name == 'release' && github.repository == 'OctoPrint/OctoPrint'
needs: needs:
- pre-commit - pre-commit
@@ -211,12 +211,39 @@ jobs:
with: with:
name: dist name: dist
path: dist path: dist
- name: 📦 Publish to index
- name: ⬆ Upload to release
run: |
UPLOAD_URL="https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets"
for file in dist/*; do
[ -e "$file" ] || exit 1
echo "Uploading $file..."
response=$(curl -s -XPOST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: $(file -b --mime-type $file)" \
--data-binary @$file \
"$UPLOAD_URL?name=$(basename $file)")
echo "$response" | jq -e '.errors' >/dev/null && echo "Error uploading $file to release: $response" && exit 1 || true
done
publish-on-testpypi:
name: 📦 Publish on TestPyPI
if: github.event_name == 'release' && github.repository == 'OctoPrint/OctoPrint'
needs:
- publish-on-release
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: ⬆ Upload to index
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
continue-on-error: true continue-on-error: true
with: with:
password: ${{ secrets.testpypi_password }} password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/ repository-url: https://test.pypi.org/legacy/
publish-on-pypi: publish-on-pypi:
name: 📦 Publish tagged releases to PyPI name: 📦 Publish tagged releases to PyPI
@@ -229,7 +256,7 @@ jobs:
with: with:
name: dist name: dist
path: dist path: dist
- name: 📦 Publish to index - name: ⬆ Publish to index
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
password: ${{ secrets.pypi_password }} password: ${{ secrets.pypi_password }}
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
name: 🔒 Lock issues & PRs closed over a year name: 🔒 Lock issues & PRs closed over a year
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: dessant/lock-threads@v4 - uses: dessant/lock-threads@v5
with: with:
github-token: ${{ github.token }} github-token: ${{ github.token }}
issue-comment: "" issue-comment: ""
+2 -2
View File
@@ -7,7 +7,7 @@ jobs:
issue-automation: issue-automation:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v6 - uses: actions/github-script@v7
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
script: | script: |
@@ -72,7 +72,7 @@ jobs:
# with: # with:
# repo-token: ${{ secrets.GITHUB_TOKEN }} # repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/github-script@v6 - uses: actions/github-script@v7
env: env:
REMINDER: > REMINDER: >
Hi @${{ github.event.issue.user.login }}! Hi @${{ github.event.issue.user.login }}!
+1 -1
View File
@@ -7,7 +7,7 @@ jobs:
linkifyBundles: linkifyBundles:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v6 - uses: actions/github-script@v7
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
script: | script: |
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
with: with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" repo-token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/github-script@v6 - uses: actions/github-script@v7
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
script: | script: |
+44 -37
View File
@@ -15,21 +15,63 @@ jobs:
matrix: matrix:
os: ["ubuntu-latest"] os: ["ubuntu-latest"]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"] python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
branch: ["master"] branch: ["master", "release"]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: ⬇ Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
path: src
- name: 🐍 Set up Python ${{ matrix.python }} - name: 🐍 Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- name: ⬇ Checkout code
# Checkout code and install
- name: ⬇ Checkout code to test
if: ${{ matrix.branch != 'release' }}
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
ref: ${{ matrix.branch }} ref: ${{ matrix.branch }}
fetch-depth: 0 fetch-depth: 0
path: checkout
- name: 👷 Build and install checkout - name: 👷 Build and install checkout
if: ${{ matrix.branch != 'release' }}
working-directory: checkout
run: | run: |
pip install . pip install .
# Install latest release
- name: 👀 Determine latest release
if: ${{ matrix.branch == 'release' }}
run: |
OCTOPRINT_VERSION=$(curl -i https://github.com/OctoPrint/OctoPrint/releases/latest | grep -i location: | head -n1 | awk -F/ '{print $NF}' | tr -d '\r')
echo "OCTOPRINT_VERSION=$OCTOPRINT_VERSION" >> $GITHUB_ENV
- name: 👷 Build and install latest release
if: ${{ matrix.branch == 'release' }}
run: |
pip install https://github.com/OctoPrint/OctoPrint/archive/${{ env.OCTOPRINT_VERSION }}.zip
# Test if server starts without error
- name: 🏗 Create base config for test server
run: |
mkdir e2econfig
cp -r src/.github/fixtures/with_acl/* e2econfig
- name: 🧪 Start OctoPrint server
run: |
timeout -k 10s 30s octoprint serve --basedir e2econfig &
wait
- name: 🔎 Check octoprint.log for errors
run: |
log=${{ github.workspace }}/e2econfig/logs/octoprint.log
if grep "\- ERROR \-" $log; then
echo "::error::Errors were logged to octoprint.log"
grep -Pazo '(?m)^\N+\- ERROR \-\N*\n(^\N*?\n)*?(?=\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \- )' $log
exit 1
fi
- name: 📧 Discord success notification - name: 📧 Discord success notification
continue-on-error: true continue-on-error: true
env: env:
@@ -45,38 +87,3 @@ jobs:
uses: Ilshidur/action-discord@master uses: Ilshidur/action-discord@master
with: with:
args: "🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` failed" args: "🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` failed"
install-latest:
name: Install latest release
strategy:
matrix:
os: ["ubuntu-latest"]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
- name: 👀 Determine latest release
run: |
OCTOPRINT_VERSION=$(curl -i https://github.com/OctoPrint/OctoPrint/releases/latest | grep -i location: | head -n1 | awk -F/ '{print $NF}' | tr -d '\r')
echo "OCTOPRINT_VERSION=$OCTOPRINT_VERSION" >> $GITHUB_ENV
- name: 🐍 Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: 👷 Build and install latest release
run: |
pip install https://github.com/OctoPrint/OctoPrint/archive/${{ env.OCTOPRINT_VERSION }}.zip
- name: 📧 Discord success notification
continue-on-error: true
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
args: "☑️ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ env.OCTOPRINT_VERSION }}` was successful"
- name: 📧 Discord failure notification
continue-on-error: true
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
uses: Ilshidur/action-discord@master
with:
args: "🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ env.OCTOPRINT_VERSION }}` failed"
+4 -6
View File
@@ -10,7 +10,6 @@ thanks to everyone who contributed!
* 3DPrinterOS * 3DPrinterOS
* Al Mucci * Al Mucci
* Ash King * Ash King
* Ben Fritsch
* BigTreeTech * BigTreeTech
* Boris Hussein * Boris Hussein
* Brad Jackson * Brad Jackson
@@ -18,13 +17,12 @@ thanks to everyone who contributed!
* Christian Wolf * Christian Wolf
* Christian Würthner * Christian Würthner
* Christoph Sigrist * Christoph Sigrist
* Creality3D
* DeltaMaker 3D Printers * DeltaMaker 3D Printers
* Dennis Breining * Dennis Breining
* Dima Gorbenko * Dima Gorbenko
* Douglas Floyd
* Ed Crump * Ed Crump
* Ernesto Martinez * Ernesto Martinez
* Fiberpunk
* Franziska Kunsmann * Franziska Kunsmann
* Hog Duske * Hog Duske
* Jacob Renstrom * Jacob Renstrom
@@ -41,10 +39,10 @@ thanks to everyone who contributed!
* Lachlan Bell * Lachlan Bell
* Lefteris Lertas * Lefteris Lertas
* LulzBot * LulzBot
* Makerbase
* Makespace Madrid * Makespace Madrid
* Mark Greenwald * Mark Greenwald
* Mark Walker * Mark Walker
* Martin Majewski
* Michael Aumock * Michael Aumock
* Michael Badagliacco * Michael Badagliacco
* Mike Labanov * Mike Labanov
@@ -52,7 +50,6 @@ thanks to everyone who contributed!
* Norman Jaffe * Norman Jaffe
* Obico * Obico
* Ory Weaver * Ory Weaver
* Peopoly
* Pete Barnwell * Pete Barnwell
* Raise3D * Raise3D
* Randy C. Will * Randy C. Will
@@ -64,6 +61,7 @@ thanks to everyone who contributed!
* Stefan Krister * Stefan Krister
* Steve Dougherty * Steve Dougherty
* Steve Thompson * Steve Thompson
* Tideline 3D
* Ulrich Kempken * Ulrich Kempken
and 1970 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)! and 1918 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
+4
View File
@@ -246,6 +246,7 @@ FileAdded
* ``name``: the file's name * ``name``: the file's name
* ``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or * ``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]`` ``["model", "stl"]``
* ``operation``: the operation that triggered the event, either ``add``, ``copy`` or ``move``.
.. note:: .. note::
@@ -263,6 +264,7 @@ FileRemoved
* ``name``: the file's name * ``name``: the file's name
* ``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or * ``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]`` ``["model", "stl"]``
* ``operation``: the operation that triggered the event, either ``remove`` or ``move``
.. note:: .. note::
@@ -525,6 +527,7 @@ PrintCancelled
feedrate outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will feedrate outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will
NOT be accurate) NOT be accurate)
* ``fileposition``: position in the file in bytes at the time of cancellation * ``fileposition``: position in the file in bytes at the time of cancellation
* ``progress``: print progress as a percentage at the time of cancellation
.. deprecated:: 1.3.0 .. deprecated:: 1.3.0
@@ -557,6 +560,7 @@ PrintPaused
feedrate outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will feedrate outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will
NOT be accurate) NOT be accurate)
* ``fileposition``: position in the file in bytes at the time of pausing * ``fileposition``: position in the file in bytes at the time of pausing
* ``progress``: print progress as a percentage at the time of pausing
.. deprecated:: 1.3.0 .. deprecated:: 1.3.0
+107 -24
View File
@@ -64,13 +64,15 @@ We'll start at the most basic form a plugin can take - just a few simple lines o
Saving this as ``helloworld.py`` in ``~/.octoprint/plugins`` yields you something resembling these log entries upon server startup:: Saving this as ``helloworld.py`` in ``~/.octoprint/plugins`` yields you something resembling these log entries upon server startup::
(venv) $ octoprint serve (venv) $ octoprint serve
2015-01-27 11:14:35,124 - octoprint.server - INFO - Starting OctoPrint 1.2.0-dev-448-gd96e56e (devel branch) 2023-11-20 11:14:35,122 - octoprint.startup - INFO - ******************************************************************************
2023-11-20 11:14:35,124 - octoprint.startup - INFO - Starting OctoPrint 1.9.3
2023-11-20 11:14:35,124 - octoprint.startup - INFO - ******************************************************************************
[...] [...]
2015-01-27 11:14:35,124 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/.octoprint/plugins, /home/pi/OctoPrint/src/octoprint/plugins and installed plugin packages... 2023-11-20 11:14:35,124 - octoprint.plugin.core - INFO - Loading plugins from /home/gina/.octoprint/plugins, /home/gina/devel/OctoPrint/src/octoprint/plugins and installed plugin packages...
[...] [...]
2015-01-27 11:14:36,135 - octoprint.plugin.core - INFO - 3 plugin(s) registered with the system: 2023-11-20 11:14:36,135 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system:
[...] [...]
| Hello World (1.0.0) = /home/pi/.octoprint/plugins/helloworld.py | Hello World (1.0.0) = /home/gina/.octoprint/plugins/helloworld.py
[...] [...]
OctoPrint found that plugin in the folder and took a look into it. The name and the version it displays in that log OctoPrint found that plugin in the folder and took a look into it. The name and the version it displays in that log
@@ -106,7 +108,7 @@ Apart from being discovered by OctoPrint, our plugin does nothing yet. We want t
and restart OctoPrint. You now get this output in the log:: and restart OctoPrint. You now get this output in the log::
2015-01-27 11:17:10,792 - octoprint.plugins.helloworld - INFO - Hello World! 2023-11-20 11:17:10,792 - octoprint.plugins.helloworld - INFO - Hello World!
Neat, isn't it? We added a custom class that subclasses one of OctoPrint's :ref:`plugin mixins <sec-plugins-mixins>` Neat, isn't it? We added a custom class that subclasses one of OctoPrint's :ref:`plugin mixins <sec-plugins-mixins>`
with :class:`~octoprint.plugin.StartupPlugin` and another control property, ``__plugin_implementation__``, that instantiates with :class:`~octoprint.plugin.StartupPlugin` and another control property, ``__plugin_implementation__``, that instantiates
@@ -143,7 +145,7 @@ So let's begin. We'll use the `cookiecutter <https://github.com/audreyr/cookiecu
here. This should already be installed if you used the ``plugins`` extra while installing OctoPrint. However, here. This should already be installed if you used the ``plugins`` extra while installing OctoPrint. However,
you may install it with:: you may install it with::
(venv) $ pip install "cookiecutter>=1.4,<1.7" (venv) $ pip install "cookiecutter>=2.1.1,<3"
Then we can use the ``octoprint dev plugin:new`` command [#f1]_ to generate a new OctoPrint plugin skeleton for us:: Then we can use the ``octoprint dev plugin:new`` command [#f1]_ to generate a new OctoPrint plugin skeleton for us::
@@ -229,16 +231,75 @@ configuration parameters for you:
.. code-block:: python .. code-block:: python
# coding=utf-8
########################################################################################################################
### Do not forget to adjust the following variables to your own plugin.
# The plugin's identifier, has to be unique
plugin_identifier = "helloworld" plugin_identifier = "helloworld"
# The plugin's python package, should be "octoprint_<plugin identifier>", has to be unique
plugin_package = "octoprint_helloworld" plugin_package = "octoprint_helloworld"
# The plugin's human readable name. Can be overwritten within OctoPrint's internal data via __plugin_name__ in the
# plugin module
plugin_name = "OctoPrint-Helloworld" plugin_name = "OctoPrint-Helloworld"
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "1.0.0" plugin_version = "1.0.0"
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
plugin_description = """A quick "Hello World" example plugin for OctoPrint""" plugin_description = """A quick "Hello World" example plugin for OctoPrint"""
plugin_author = "Your Name"
# The plugin's author. Can be overwritten within OctoPrint's internal data via __plugin_author__ in the plugin module
plugin_author = "Your name"
# The plugin's author's mail address.
plugin_author_email = "you@somewhere.net" plugin_author_email = "you@somewhere.net"
# The plugin's homepage URL. Can be overwritten within OctoPrint's internal data via __plugin_url__ in the plugin module
plugin_url = "https://github.com/yourGithubName/OctoPrint-Helloworld" plugin_url = "https://github.com/yourGithubName/OctoPrint-Helloworld"
# The plugin's license. Can be overwritten within OctoPrint's internal data via __plugin_license__ in the plugin module
plugin_license = "AGPLv3" plugin_license = "AGPLv3"
# Any additional requirements besides OctoPrint should be listed here
plugin_requires = []
### --------------------------------------------------------------------------------------------------------------------
### More advanced options that you usually shouldn't have to touch follow after this point
### --------------------------------------------------------------------------------------------------------------------
# Additional package data to install for this plugin. The subfolders "templates", "static" and "translations" will
# already be installed automatically if they exist. Note that if you add something here you'll also need to update
# MANIFEST.in to match to ensure that python setup.py sdist produces a source distribution that contains all your
# files. This is sadly due to how python's setup.py works, see also http://stackoverflow.com/a/14159430/2028598
plugin_additional_data = []
# Any additional python packages you need to install with your plugin that are not contained in <plugin_package>.*
plugin_additional_packages = []
# Any python packages within <plugin_package>.* you do NOT want to install with your plugin
plugin_ignored_packages = []
# Additional parameters for the call to setuptools.setup. If your plugin wants to register additional entry points,
# define dependency links or other things like that, this is the place to go. Will be merged recursively with the
# default setup parameters as provided by octoprint_setuptools.create_plugin_setup_parameters using
# octoprint.util.dict_merge.
#
# Example:
# plugin_requires = ["someDependency==dev"]
# additional_setup_parameters = {"dependency_links": ["https://github.com/someUser/someRepo/archive/master.zip#egg=someDependency-dev"]}
# "python_requires": ">=3,<4" blocks installation on Python 2 systems, to prevent confused users and provide a helpful error.
# Remove it if you would like to support Python 2 as well as 3 (not recommended).
additional_setup_parameters = {"python_requires": ">=3,<4"}
########################################################################################################################
# ... remaining setup.py content ...
Now all that's left to do is to move our ``helloworld.py`` into the ``octoprint_helloworld`` folder and renaming it to Now all that's left to do is to move our ``helloworld.py`` into the ``octoprint_helloworld`` folder and renaming it to
``__init__.py``. Make sure to delete the copy under ``~/.octoprint/plugins`` in the process, including the ``.pyc`` file! ``__init__.py``. Make sure to delete the copy under ``~/.octoprint/plugins`` in the process, including the ``.pyc`` file!
@@ -249,23 +310,34 @@ discoverable by OctoPrint, however we don't have to reinstall it after any chang
to your OctoPrint installation:: to your OctoPrint installation::
(venv) $ octoprint dev plugin:install (venv) $ octoprint dev plugin:install
running develop >> /home/gina/.pyenv/versions/3.11.2/envs/octoprint-py311/bin/python -m pip install -e .
running egg_info Obtaining file:///home/gina/devel/OctoPrint-Helloworld
creating OctoPrint_HelloWorld.egg-info
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
[...] [...]
Finished processing dependencies for OctoPrint-HelloWorld==1.0.0
Installing collected packages: OctoPrint-Helloworld
Running setup.py develop for OctoPrint-Helloworld
Successfully installed OctoPrint-Helloworld-0.1.0
Restart OctoPrint. Your plugin should still be properly discovered and the log line should be printed:: Restart OctoPrint. Your plugin should still be properly discovered and the log line should be printed::
2015-01-27 13:43:34,134 - octoprint.server - INFO - Starting OctoPrint 1.2.0-dev-448-gd96e56e (devel branch) 2023-11-20 13:43:34,132 - octoprint.startup - INFO - ******************************************************************************
2023-11-20 13:43:34,134 - octoprint.startup - INFO - Starting OctoPrint 1.9.3
2023-11-20 13:43:34,134 - octoprint.startup - INFO - ******************************************************************************
[...] [...]
2015-01-27 13:43:34,134 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/.octoprint/plugins, /home/pi/OctoPrint/src/octoprint/plugins and installed plugin packages... 2023-11-20 13:43:34,134 - octoprint.plugin.core - INFO - Loading plugins from /home/gina/.octoprint/plugins, /home/gina/devel/OctoPrint/src/octoprint/plugins and installed plugin packages...
[...] [...]
2015-01-27 13:43:34,818 - octoprint.plugin.core - INFO - 3 plugin(s) registered with the system: 2023-11-20 13:43:34,818 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system:
[...] [...]
| Hello World (1.0.0) = /home/pi/devel/OctoPrint-HelloWorld/octoprint_helloworld | Hello World (1.0.0) = /home/gina/devel/OctoPrint-HelloWorld/octoprint_helloworld
[...] [...]
2015-01-27 13:43:38,997 - octoprint.plugins.helloworld - INFO - Hello World! 2023-11-20 13:43:38,997 - octoprint.plugins.helloworld - INFO - Hello World!
Looks like it still works! Looks like it still works!
@@ -282,9 +354,20 @@ of information now defined twice:
.. code-block:: python .. code-block:: python
:caption: setup.py :caption: setup.py
plugin_name = "OctoPrint-HelloWorld" # ...
# The plugin's human readable name. Can be overwritten within OctoPrint's internal data via __plugin_name__ in the
# plugin module
plugin_name = "OctoPrint-Helloworld"
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "1.0.0" plugin_version = "1.0.0"
plugin_description = "A quick \"Hello World\" example plugin for OctoPrint"
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
plugin_description = """A quick "Hello World" example plugin for OctoPrint"""
# ...
The nice thing about our plugin now being a proper Python package is that OctoPrint can and will access the metadata defined The nice thing about our plugin now being a proper Python package is that OctoPrint can and will access the metadata defined
within ``setup.py``! So, we don't really need to define all this data twice. Remove ``__plugin_name__``, ``__plugin_version__`` within ``setup.py``! So, we don't really need to define all this data twice. Remove ``__plugin_name__``, ``__plugin_version__``
@@ -303,9 +386,9 @@ and ``__plugin_description__`` from ``__init__.py``, but leave ``__plugin_implem
and restart OctoPrint:: and restart OctoPrint::
2015-01-27 13:46:33,786 - octoprint.plugin.core - INFO - 3 plugin(s) registered with the system: 2023-11-20 13:46:33,786 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system:
[...] [...]
| OctoPrint-HelloWorld (1.0.0) = /home/pi/devel/OctoPrint-HelloWorld/octoprint_helloworld | OctoPrint-HelloWorld (1.0.0) = /home/gina/devel/OctoPrint-HelloWorld/octoprint_helloworld
[...] [...]
Our "Hello World" Plugin still gets detected fine, but it's now listed under the same name it's installed under, Our "Hello World" Plugin still gets detected fine, but it's now listed under the same name it's installed under,
@@ -327,9 +410,9 @@ Our "Hello World" Plugin still gets detected fine, but it's now listed under the
Restart OctoPrint again:: Restart OctoPrint again::
2015-01-27 13:48:54,122 - octoprint.plugin.core - INFO - 3 plugin(s) registered with the system: 2023-11-20 13:48:54,122 - octoprint.plugin.core - INFO - 19 plugin(s) registered with the system:
[...] [...]
| Hello World (1.0.0) = /home/pi/OctoPrint-HelloWorld/octoprint_helloworld | Hello World (1.0.0) = /home/gina/devel/OctoPrint-HelloWorld/octoprint_helloworld
[...] [...]
Much better! You can override pretty much all of the metadata defined within ``setup.py`` from within your Plugin itself -- Much better! You can override pretty much all of the metadata defined within ``setup.py`` from within your Plugin itself --
@@ -339,7 +422,7 @@ overrides.
Following the README of the `Plugin Skeleton <https://github.com/OctoPrint/OctoPrint-PluginSkeleton>`_ you could now Following the README of the `Plugin Skeleton <https://github.com/OctoPrint/OctoPrint-PluginSkeleton>`_ you could now
already publish your plugin on Github and it would be directly installable by others using pip:: already publish your plugin on Github and it would be directly installable by others using pip::
(venv) $ pip install https://github.com/yourGithubName/OctoPrint-HelloWorld/archive/master.zip (venv) $ pip install https://github.com/yourGithubName/OctoPrint-HelloWorld/archive/main.zip
But let's add some more features instead. But let's add some more features instead.
@@ -532,7 +615,7 @@ settings view model into the ``href`` attribute of the link tag:
.. code-block:: html .. code-block:: html
<a href="#" data-bind="attr: {href: settings.settings.plugins.helloworld.url}">Hello World!</a> <a href="javascript:void()" data-bind="attr: {href: settings.settings.plugins.helloworld.url}">Hello World!</a>
You might have noticed the quite ugly way to access our plugin's ``url`` property here: ``settings.settings.plugins.helloworld.url``. You might have noticed the quite ugly way to access our plugin's ``url`` property here: ``settings.settings.plugins.helloworld.url``.
The reason for this is that we'll make our plugin use the existing ``NavigationViewModel`` which holds the The reason for this is that we'll make our plugin use the existing ``NavigationViewModel`` which holds the
+1 -1
View File
@@ -122,7 +122,7 @@ gcodeViewModel
View model for the gcode viewer tab. View model for the gcode viewer tab.
gcodeFilesViewModel gcodeFilesViewModel
Deprecated in favor of ``filesViewModel``. Deprecated in favor of ``filesViewModel``.
logViewModel logsViewModel
View model for the logfile settings dialog. View model for the logfile settings dialog.
loginStateViewModel loginStateViewModel
View model for the current login state of the user, very interesting for plugins that need to View model for the current login state of the user, very interesting for plugins that need to
-44
View File
@@ -1,44 +0,0 @@
# init/systemd files for OctoPrint.
Assumes OctoPrint is installed under user pi at /home/pi/OctoPrint/venv/bin/octoprint. If you have a different
setup you'll need to adjust octoprint.default (init) or octoprint.service (systemd) accordingly.
## init
Download the init.d files to the locations shown:
```
octoprint.default => /etc/default/octoprint
octoprint.init => /etc/init.d/octoprint
```
Next, enable and start the `octoprint` service:
```sh
# Enable octoprint service
sudo update-rc.d octoprint defaults
# and start it
sudo service octoprint start
```
## systemd
Download the systemd files to the locations shown:
```
octoprint.service => /etc/systemd/system/octoprint.service
```
Next, make necessary modifications (if any) then notify systemd:
```sh
sudo systemctl daemon-reload
```
Finally, enable and start the `octoprint` service:
```sh
# Enable octoprint service
sudo systemctl enable octoprint
# and start it
sudo systemctl start octoprint
```
-29
View File
@@ -1,29 +0,0 @@
# Configuration for /etc/init.d/octoprint
# The init.d script will only run if this variable non-empty.
OCTOPRINT_USER=pi
# base directory to use
#BASEDIR=/home/pi/.octoprint
# configuration file to use
#CONFIGFILE=/home/pi/.octoprint/config.yaml
# On what port to run daemon, default is 5000
PORT=5000
# Path to the OctoPrint executable, you need to set this to match your installation!
#DAEMON=/home/pi/OctoPrint/venv/bin/octoprint
# What arguments to pass to octoprint, usually no need to touch this
DAEMON_ARGS="--port=$PORT"
# Umask of files octoprint generates, Change this to 000 if running octoprint as its own, separate user
UMASK=022
# Process priority, 0 here will result in a priority 20 process.
# -2 ensures Octoprint has a slight priority over user processes.
NICELEVEL=-2
# Should we run at startup?
START=yes
-162
View File
@@ -1,162 +0,0 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: octoprint
# Required-Start: $local_fs networking
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OctoPrint daemon
# Description: Starts the OctoPrint daemon with the user specified in
# /etc/default/octoprint.
### END INIT INFO
# Author: Sami Olmari & Gina Häußge
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="OctoPrint Daemon"
NAME="OctoPrint"
PKGNAME=octoprint
PIDFILE=/var/run/$PKGNAME.pid
SCRIPTNAME=/etc/init.d/$PKGNAME
DEFAULTS=/etc/default/$PKGNAME
# Read configuration variable file if it is present
[ -r $DEFAULTS ] && . $DEFAULTS
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# Exit if the DAEMON is not set
if [ -z "$DAEMON" ]
then
log_warning_msg "Not starting $PKGNAME, DAEMON not set in /etc/default/$PKGNAME."
exit 0
fi
# Exit if the DAEMON is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
if [ -z "$START" -o "$START" != "yes" ]
then
log_warning_msg "Not starting $PKGNAME, edit /etc/default/$PKGNAME to start it."
exit 0
fi
if [ -z "$OCTOPRINT_USER" ]
then
log_warning_msg "Not starting $PKGNAME, OCTOPRINT_USER not set in /etc/default/$PKGNAME."
exit 0
fi
COMMAND_ARGS=
if [ -n "$BASEDIR" ]
then
COMMAND_ARGS="--basedir $BASEDIR $COMMAND_ARGS"
fi
if [ -n "$CONFIGFILE" ]
then
COMMAND_ARGS="--config $CONFIGFILE $COMMAND_ARGS"
fi
#
# Function to verify if a pid is alive
#
is_alive()
{
pid=`cat $1` > /dev/null 2>&1
kill -0 $pid > /dev/null 2>&1
return $?
}
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
is_alive $PIDFILE
RETVAL="$?"
if [ $RETVAL != 0 ]; then
start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \
--exec $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK --nicelevel=$NICELEVEL \
-- serve $COMMAND_ARGS $DAEMON_ARGS
RETVAL="$?"
fi
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $OCTOPRINT_USER --pidfile $PIDFILE
RETVAL="$?"
[ "$RETVAL" = "2" ] && return 2
rm -f $PIDFILE
[ "$RETVAL" = "0" ] && return 0 || return 1
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
exit 3
;;
esac
-14
View File
@@ -1,14 +0,0 @@
[Unit]
Description=The snappy web interface for your 3D printer
After=network-online.target
Wants=network-online.target
[Service]
Environment="LC_ALL=C.UTF-8"
Environment="LANG=C.UTF-8"
Type=exec
User=pi
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint serve
[Install]
WantedBy=multi-user.target
+3 -3
View File
@@ -35,7 +35,7 @@ bundled_plugins = [
"OctoPrint-PiSupport>=2023.5.24", "OctoPrint-PiSupport>=2023.5.24",
] ]
core_deps = [ core_deps = [
"argon2_cffi>=21.3.0,<22", "argon2-cffi>=21.3.0",
"Babel>=2.12.1,<2.13", # breaking changes can happen on minor version increases "Babel>=2.12.1,<2.13", # breaking changes can happen on minor version increases
"cachelib>=0.10.2,<0.11", "cachelib>=0.10.2,<0.11",
"Click>=8.1.3,<9", "Click>=8.1.3,<9",
@@ -57,7 +57,7 @@ core_deps = [
"pathvalidate>=2.5.2,<3", "pathvalidate>=2.5.2,<3",
"pkginfo>=1.9.6,<2", "pkginfo>=1.9.6,<2",
"psutil>=5.9.4,<6", "psutil>=5.9.4,<6",
"pydantic>=1.10.7,<2", "pydantic==1.10.12", # to be kept pinned until https://github.com/pydantic/pydantic/issues/7689 is resolved
"pylru>=1.2.1,<2", "pylru>=1.2.1,<2",
"pyserial>=3.5,<4", "pyserial>=3.5,<4",
"PyYAML>=6.0.1,<7", # changelog at https://github.com/yaml/pyyaml/blob/master/CHANGES "PyYAML>=6.0.1,<7", # changelog at https://github.com/yaml/pyyaml/blob/master/CHANGES
@@ -106,7 +106,7 @@ EXTRA_REQUIRES = {
"pyinstrument", "pyinstrument",
], ],
# Dependencies for developing OctoPrint plugins # Dependencies for developing OctoPrint plugins
"plugins": ["cookiecutter>=2.1.1,<3"], "plugins": ["cookiecutter>=2.1.1,<3"], # update plugin tutorial when updating this
# Dependencies for building the documentation # Dependencies for building the documentation
"docs": [ "docs": [
"sphinx", "sphinx",
+2 -2
View File
@@ -52,8 +52,8 @@ improve/.* 1.10.0 cd955e9a46782119b36cc22b8dea5652ebbf9774
# staging/bugfix is the branch for preparation of the 1.9.x bugfix releases # staging/bugfix is the branch for preparation of the 1.9.x bugfix releases
# so are any bug/... branches # so are any bug/... branches
staging/bugfix 1.9.3 f027aaa7300f70b046525a49245b33c43dd198c1 staging/bugfix 1.9.4 506648c152681bf4b1416cf2b5aaf97d526ee752 pep440-dev
bug/.* 1.9.3 f027aaa7300f70b046525a49245b33c43dd198c1 bug/.* 1.9.4 506648c152681bf4b1416cf2b5aaf97d526ee752 pep440-dev
# staging/maintenance is currently the branch for preparation of 1.9.0rc7 # staging/maintenance is currently the branch for preparation of 1.9.0rc7
# so is regressionfix/... # so is regressionfix/...
+2
View File
@@ -769,6 +769,7 @@ class FileManager:
"path": path, "path": path,
"name": name, "name": name,
"type": get_file_type(name), "type": get_file_type(name),
"operation": "remove",
}, },
) )
eventManager().fire(Events.UPDATED_FILES, {"type": "printables"}) eventManager().fire(Events.UPDATED_FILES, {"type": "printables"})
@@ -814,6 +815,7 @@ class FileManager:
"path": source_path_in_storage, "path": source_path_in_storage,
"name": source_name, "name": source_name,
"type": get_file_type(source_name), "type": get_file_type(source_name),
"operation": "move",
}, },
) )
eventManager().fire( eventManager().fire(
+18 -1
View File
@@ -1606,12 +1606,29 @@ class SettingsPlugin(OctoPrintPlugin):
Including the ``SettingsPlugin`` mixin allows plugins to store and retrieve their own settings within OctoPrint's Including the ``SettingsPlugin`` mixin allows plugins to store and retrieve their own settings within OctoPrint's
configuration. configuration.
Plugins including the mixing will get injected an additional property ``self._settings`` which is an instance of Plugins including the mixin will get injected an additional property ``self._settings`` which is an instance of
:class:`PluginSettingsManager` already properly initialized for use by the plugin. In order for the manager to :class:`PluginSettingsManager` already properly initialized for use by the plugin. In order for the manager to
know about the available settings structure and default values upon initialization, implementing plugins will need know about the available settings structure and default values upon initialization, implementing plugins will need
to provide a dictionary with the plugin's default settings through overriding the method :func:`get_settings_defaults`. to provide a dictionary with the plugin's default settings through overriding the method :func:`get_settings_defaults`.
The defined structure will then be available to access through the settings manager available as ``self._settings``. The defined structure will then be available to access through the settings manager available as ``self._settings``.
.. note::
Use the settings only to store configuration data or information that is relevant to the UI. Anything in the settings
is part of the hash that is used to determine whether a client's copy of the UI is still up to date or not. If you
store unrelated and possibly often changing information in the settings, you will force the client to reload the
UI without visible changes, which will lead to a bad user experience.
You may store additional data in your plugin's data folder instead, which is not part of the hash and whose path
can be retrieved through :func:`~
octoprint.plugin.types.OctoPrintPlugin.get_plugin_data_folder`, e.g.:
.. code-block:: python
data_folder = self.get_plugin_data_folder()
with open(os.path.join(data_folder, "some_file.txt"), "w") as f:
f.write("some data")
If your plugin needs to react to the change of specific configuration values on the fly, e.g. to adjust the log level If your plugin needs to react to the change of specific configuration values on the fly, e.g. to adjust the log level
of a logger when the user changes a corresponding flag via the settings dialog, you can override the of a logger when the user changes a corresponding flag via the settings dialog, you can override the
:func:`on_settings_save` method and wrap the call to the implementation from the parent class with retrieval of the :func:`on_settings_save` method and wrap the call to the implementation from the parent class with retrieval of the
@@ -14,7 +14,7 @@
<tbody data-bind="foreach: keys.paginatedItems"> <tbody data-bind="foreach: keys.paginatedItems">
<tr> <tr>
<td class="settings_plugin_appkeys_app"><span data-bind="text: app_id"></span><br /><small class="muted">{{ _('API Key') }}: <span data-bind="text: api_key"></span> <a href="javascript:void(0)" title="{{ _('Copy API Key to clipboard')|edq }}" data-bind="click: function() { copyToClipboard(api_key) }"><i class="fas fa-copy"></i></a></small></td> <td class="settings_plugin_appkeys_app"><span data-bind="text: app_id"></span><br /><small class="muted">{{ _('API Key') }}: <span data-bind="text: api_key"></span> <a href="javascript:void(0)" title="{{ _('Copy API Key to clipboard')|edq }}" data-bind="click: function() { copyToClipboard(api_key) }"><i class="fas fa-copy"></i></a></small></td>
<td class="settings_plugin_appkeys_actions"><a href="javascript:void(0)" title="{{ _('Revoke')|edq }}" class="far fa-trash-alt" data-bind="click: function() { $parent.revokeKey($data.api_key) }"></a></td> <td class="settings_plugin_appkeys_actions"><a href="javascript:void(0)" title="{{ _('Revoke')|edq }}" class="far fa-trash-alt" data-bind="click: function() { $parent.revokeKey($data.api_key) }"></a>&nbsp;|&nbsp;<a href="javascript:void(0)" title="{{ _('Details')|edq }}" class="fas fa-search" data-bind="click: function() { $parent.dialog.showDialog(gettext('Details'), $data) }"></a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -18,10 +18,10 @@ from octoprint.util.version import (
) )
SENTRY_URL_SERVER = ( SENTRY_URL_SERVER = (
"https://ba4e3d61c37a4d219e1cd81bdc1417a7@o118517.ingest.sentry.io/1373987" "https://f723fd2a91da40dbae1148193ea49001@o118517.ingest.sentry.io/1373987"
) )
SENTRY_URL_COREUI = ( SENTRY_URL_COREUI = (
"https://2382252761de4d318e5f83be0816efaa@o118517.ingest.sentry.io/1374096" "https://a115318be6faed605c6bfde4e183b7a0@o118517.ingest.sentry.io/1374096"
) )
SETTINGS_DEFAULTS = { SETTINGS_DEFAULTS = {
@@ -2348,10 +2348,11 @@ def _filter_relevant_notification(notification, plugin_version, octoprint_versio
and ( and (
(version_ranges is None and versions is None) (version_ranges is None and versions is None)
or ( or (
version_ranges plugin_version
and version_ranges
and (any(map(lambda v: plugin_version in v, version_ranges))) and (any(map(lambda v: plugin_version in v, version_ranges)))
) )
or (versions and plugin_version in versions) or (plugin_version and versions and plugin_version in versions)
) )
and ( and (
"octoversions" not in notification "octoversions" not in notification
+9
View File
@@ -1453,6 +1453,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
payload["time"] = self._comm.getPrintTime() payload["time"] = self._comm.getPrintTime()
payload["reason"] = "error" payload["reason"] = "error"
payload["error"] = self._comm.getErrorString() payload["error"] = self._comm.getErrorString()
payload["progress"] = self._comm.getPrintProgress()
def finalize(): def finalize():
self._fileManager.log_print( self._fileManager.log_print(
@@ -1688,11 +1689,13 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
self._updateProgressData() self._updateProgressData()
fileposition = self._comm.getFilePosition() if self._comm else None fileposition = self._comm.getFilePosition() if self._comm else None
progress = self._comm.getPrintProgress() if self._comm else None
payload = self._payload_for_print_job_event( payload = self._payload_for_print_job_event(
position=self._comm.cancel_position.as_dict() position=self._comm.cancel_position.as_dict()
if self._comm and self._comm.cancel_position if self._comm and self._comm.cancel_position
else None, else None,
fileposition=fileposition["pos"] if fileposition else None, fileposition=fileposition["pos"] if fileposition else None,
progress=progress,
action_user=user, action_user=user,
) )
if payload: if payload:
@@ -1741,11 +1744,13 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
def on_comm_print_job_paused(self, suppress_script=False, user=None): def on_comm_print_job_paused(self, suppress_script=False, user=None):
fileposition = self._comm.getFilePosition() if self._comm else None fileposition = self._comm.getFilePosition() if self._comm else None
progress = self._comm.getPrintProgress() if self._comm else None
payload = self._payload_for_print_job_event( payload = self._payload_for_print_job_event(
position=self._comm.pause_position.as_dict() position=self._comm.pause_position.as_dict()
if self._comm and self._comm.pause_position and not suppress_script if self._comm and self._comm.pause_position and not suppress_script
else None, else None,
fileposition=fileposition["pos"] if fileposition else None, fileposition=fileposition["pos"] if fileposition else None,
progress=progress,
action_user=user, action_user=user,
) )
if payload: if payload:
@@ -1874,6 +1879,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
print_job_user=None, print_job_user=None,
position=None, position=None,
fileposition=None, fileposition=None,
progress=None,
action_user=None, action_user=None,
): ):
if print_job_file is None: if print_job_file is None:
@@ -1919,6 +1925,9 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
if fileposition is not None: if fileposition is not None:
result["fileposition"] = fileposition result["fileposition"] = fileposition
if progress is not None:
result["progress"] = int(progress * 100)
if print_job_user is not None: if print_job_user is not None:
result["owner"] = print_job_user result["owner"] = print_job_user
+9 -5
View File
@@ -677,10 +677,7 @@ class Server:
## Tornado initialization starts here ## Tornado initialization starts here
ioloop = ( ioloop = IOLoop.current()
IOLoop()
) # TODO: This way to create the ioloop is deprecated and logs a warning
ioloop.install()
enable_cors = settings().getBoolean(["api", "allowCrossOrigin"]) enable_cors = settings().getBoolean(["api", "allowCrossOrigin"])
@@ -1020,13 +1017,20 @@ class Server:
removed_headers = ["Server"] removed_headers = ["Server"]
from concurrent.futures import ThreadPoolExecutor
server_routes.append( server_routes.append(
( (
r".*", r".*",
util.tornado.UploadStorageFallbackHandler, util.tornado.UploadStorageFallbackHandler,
{ {
"fallback": util.tornado.WsgiInputContainer( "fallback": util.tornado.WsgiInputContainer(
app.wsgi_app, headers=headers, removed_headers=removed_headers app.wsgi_app,
executor=ThreadPoolExecutor(
thread_name_prefix="WsgiRequestHandler"
),
headers=headers,
removed_headers=removed_headers,
), ),
"file_prefix": "octoprint-file-upload-", "file_prefix": "octoprint-file-upload-",
"file_suffix": ".tmp", "file_suffix": ".tmp",
+93 -43
View File
@@ -20,6 +20,8 @@ import tornado.iostream
import tornado.tcpserver import tornado.tcpserver
import tornado.util import tornado.util
import tornado.web import tornado.web
from tornado.concurrent import dummy_executor
from tornado.ioloop import IOLoop
from zipstream.ng import ZIP_DEFLATED, ZipStream from zipstream.ng import ZIP_DEFLATED, ZipStream
import octoprint.util import octoprint.util
@@ -562,7 +564,7 @@ class UploadStorageFallbackHandler(RequestlessExceptionLoggingMixin, CorsSupport
self._new_body += value + b"\r\n" self._new_body += value + b"\r\n"
self._new_body += b"--%s--\r\n" % self._multipart_boundary self._new_body += b"--%s--\r\n" % self._multipart_boundary
def _handle_method(self, *args, **kwargs): async def _handle_method(self, *args, **kwargs):
""" """
Takes care of defining the new request body if necessary and forwarding Takes care of defining the new request body if necessary and forwarding
the current request and changed body to the ``fallback``. the current request and changed body to the ``fallback``.
@@ -582,17 +584,24 @@ class UploadStorageFallbackHandler(RequestlessExceptionLoggingMixin, CorsSupport
# directly use data from buffer # directly use data from buffer
body = self._buffer body = self._buffer
# rewrite content length
self.request.headers["Content-Length"] = len(body) self.request.headers["Content-Length"] = len(body)
try: try:
# call the configured fallback with request and body to use # call the configured fallback with request and body to use
self._fallback(self.request, body) result = self._fallback(self.request, body)
self._headers_written = True if result is not None:
await result
# self._headers_written = True
finally: finally:
# make sure the temporary files are removed again # make sure the temporary files are removed again
for f in self._files: self._cleanup_files()
octoprint.util.silent_remove(f)
def _cleanup_files(self):
"""
Removes all temporary files created by this handler.
"""
for f in self._files:
octoprint.util.silent_remove(f)
# make all http methods trigger _handle_method # make all http methods trigger _handle_method
get = _handle_method get = _handle_method
@@ -663,12 +672,21 @@ class WsgiInputContainer:
The implementation logic is basically the same as ``tornado.wsgi.WSGIContainer`` but the ``__call__`` and ``environ`` The implementation logic is basically the same as ``tornado.wsgi.WSGIContainer`` but the ``__call__`` and ``environ``
methods have been adjusted to allow for an optionally supplied ``body`` argument which is then used for ``wsgi.input``. methods have been adjusted to allow for an optionally supplied ``body`` argument which is then used for ``wsgi.input``.
Additionally, some headers can be added or removed from the response by supplying ``forced_headers`` and
``removed_headers`` arguments. ``forced_headers`` will be added to the response, ``removed_headers`` will be removed.
""" """
def __init__( def __init__(
self, wsgi_application, headers=None, forced_headers=None, removed_headers=None self,
wsgi_application,
executor=None,
headers=None,
forced_headers=None,
removed_headers=None,
): ):
self.wsgi_application = wsgi_application self.wsgi_application = wsgi_application
self.executor = dummy_executor if executor is None else executor
if headers is None: if headers is None:
headers = {} headers = {}
@@ -682,11 +700,19 @@ class WsgiInputContainer:
self.removed_headers = removed_headers self.removed_headers = removed_headers
def __call__(self, request, body=None): def __call__(self, request, body=None):
future = tornado.concurrent.Future()
IOLoop.current().spawn_callback(
self.handle_request, request, body=body, future=future
)
return future
async def handle_request(self, request, body=None, future=None):
""" """
Wraps the call against the WSGI app, deriving the WSGI environment from the supplied Tornado ``HTTPServerRequest``. Wraps the call against the WSGI app, deriving the WSGI environment from the supplied Tornado ``HTTPServerRequest``.
:param request: the ``tornado.httpserver.HTTPServerRequest`` to derive the WSGI environment from :param request: the ``tornado.httpserver.HTTPServerRequest`` to derive the WSGI environment from
:param body: an optional body to use as ``wsgi.input`` instead of ``request.body``, can be a string or a stream :param body: an optional body to use as ``wsgi.input`` instead of ``request.body``, can be a string or a stream
:param future: a future to complete after the request has been handled
""" """
data = {} data = {}
@@ -697,48 +723,72 @@ class WsgiInputContainer:
data["headers"] = response_headers data["headers"] = response_headers
return response.append return response.append
app_response = self.wsgi_application(
WsgiInputContainer.environ(request, body), start_response
)
try: try:
response.extend(app_response) loop = IOLoop.current()
app_response = await loop.run_in_executor(
self.executor,
self.wsgi_application,
self.environ(request, body),
start_response,
)
try:
app_response_iter = iter(app_response)
def next_chunk():
try:
return next(app_response_iter)
except StopIteration:
return None
while True:
chunk = await loop.run_in_executor(self.executor, next_chunk)
if chunk is None:
break
response.append(chunk)
finally:
if hasattr(app_response, "close"):
app_response.close()
body = b"".join(response) body = b"".join(response)
finally: if not data:
if hasattr(app_response, "close"): raise Exception("WSGI app did not call start_response")
app_response.close()
if not data:
raise Exception("WSGI app did not call start_response")
status_code, reason = data["status"].split(" ", 1) status_code_str, reason = data["status"].split(" ", 1)
status_code = int(status_code) status_code = int(status_code_str)
headers = data["headers"] headers = data["headers"]
header_set = {k.lower() for (k, v) in headers} header_set = {k.lower() for (k, v) in headers}
body = tornado.escape.utf8(body) body = tornado.escape.utf8(body)
if status_code != 304: if status_code != 304:
if "content-length" not in header_set: if "content-length" not in header_set:
headers.append(("Content-Length", str(len(body)))) headers.append(("Content-Length", str(len(body))))
if "content-type" not in header_set: if "content-type" not in header_set:
headers.append(("Content-Type", "text/html; charset=UTF-8")) headers.append(("Content-Type", "text/html; charset=UTF-8"))
header_set = {k.lower() for (k, v) in headers} header_set = {k.lower() for (k, v) in headers}
for header, value in self.headers.items(): for header, value in self.headers.items():
if header.lower() not in header_set: if header.lower() not in header_set:
headers.append((header, value))
for header, value in self.forced_headers.items():
headers.append((header, value)) headers.append((header, value))
for header, value in self.forced_headers.items(): headers = [
headers.append((header, value)) (header, value)
headers = [ for header, value in headers
(header, value) if header.lower() not in self.removed_headers
for header, value in headers ]
if header.lower() not in self.removed_headers
]
start_line = tornado.httputil.ResponseStartLine("HTTP/1.1", status_code, reason) start_line = tornado.httputil.ResponseStartLine(
header_obj = tornado.httputil.HTTPHeaders() "HTTP/1.1", status_code, reason
for key, value in headers: )
header_obj.add(key, value) header_obj = tornado.httputil.HTTPHeaders()
request.connection.write_headers(start_line, header_obj, chunk=body) for key, value in headers:
request.connection.finish() header_obj.add(key, value)
self._log(status_code, request) assert request.connection is not None
request.connection.write_headers(start_line, header_obj, chunk=body)
request.connection.finish()
self._log(status_code, request)
finally:
if future is not None:
future.set_result(None)
@staticmethod @staticmethod
def environ(request, body=None): def environ(request, body=None):
+4 -3
View File
@@ -646,9 +646,10 @@ class Settings:
return folder return folder
def _init_script_templating(self): def _init_script_templating(self):
from jinja2 import BaseLoader, ChoiceLoader, Environment, TemplateNotFound from jinja2 import BaseLoader, ChoiceLoader, TemplateNotFound
from jinja2.ext import Extension from jinja2.ext import Extension
from jinja2.nodes import Include from jinja2.nodes import Include
from jinja2.sandbox import SandboxedEnvironment
from octoprint.util.jinja import FilteredFileSystemLoader from octoprint.util.jinja import FilteredFileSystemLoader
@@ -717,9 +718,9 @@ class Settings:
def list_templates(self): def list_templates(self):
return self._default.list_templates() return self._default.list_templates()
class RelEnvironment(Environment): class RelEnvironment(SandboxedEnvironment):
def __init__(self, prefix_sep=":", *args, **kwargs): def __init__(self, prefix_sep=":", *args, **kwargs):
Environment.__init__(self, *args, **kwargs) super().__init__(*args, **kwargs)
self._prefix_sep = prefix_sep self._prefix_sep = prefix_sep
def join_path(self, template, parent): def join_path(self, template, parent):
+1 -1
View File
@@ -1 +1 @@
.actioncol,.btn{text-align:center}.btn,.btn-link,ul.dropdown-menu li a{cursor:pointer}.btn,.slider .slider-handle{background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));margin-bottom:0}.btn,.btn-danger,.btn-info,.btn-inverse,.btn-primary,.btn-success,.btn-warning{filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x}.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;font-size:14px;line-height:20px;vertical-align:middle;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-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);*background-color:#e6e6e6;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: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-color:#ccc\9;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-primary,.slider .slider-selection{text-shadow:0 -1px 0 rgba(0,0,0,.25);background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c)}.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-danger.active,.btn-info.active,.btn-inverse.active,.btn-primary.active,.btn-success.active,.btn-warning.active{color:rgba(255,255,255,.75)}.btn-primary{color:#fff;background-color:#006dcc;background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);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}.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);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}.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);bLine truncated .btn,.btn-link,ul.dropdown-menu li a{cursor:pointer}#files .gcode_files .entry:hover,.btn{background-color:#f5f5f5}.btn,.btn-danger,.btn-info,.btn-inverse,.btn-primary,.btn-success,.btn-warning{filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x}.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;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);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-color:#e6e6e6;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: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-color:#ccc\9;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-primary,.slider .slider-selection{text-shadow:0 -1px 0 rgba(0,0,0,.25);background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c)}.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 [class*=" icon-"],.btn-small [class^=icon-],table td.timelapse_files_checkbox input[type=checkbox],table td.timelapse_unrendered_checkbox input[type=checkbox],table th.timelapse_files_checkbox input[type=checkbox],table th.timelapse_unrendered_checkbox input[type=checkbox]{margin-top:0}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.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}.border_box,.input-block-level{-webkit-box-sizing:border-box;-moz-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-danger.active,.btn-info.active,.btn-inverse.active,.btn-primary.active,.btn-success.active,.btn-warning.active{color:rgba(255,255,255,.75)}.btn-primary{color:#fff;background-color:#006dcc;background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);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}.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);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}.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{bLine truncated
@@ -41,11 +41,14 @@ $(function () {
$("a:first", self.aboutTabs).tab("show"); $("a:first", self.aboutTabs).tab("show");
} }
self.aboutContent.scrollTop(0); self.aboutContent.scrollTop(0);
const maxHeight = $.fn.modal.defaults.maxHeight() - 80 - 60;
self.aboutDialog self.aboutDialog
.modal({ .modal({
minHeight: function () { minHeight: function () {
return Math.max($.fn.modal.defaults.maxHeight() - 80, 250); return Math.max(maxHeight, 250);
} },
maxHeight: maxHeight
}) })
.css({ .css({
"margin-left": function () { "margin-left": function () {
@@ -1063,7 +1063,7 @@ $(function () {
gettext("Model size") + gettext("Model size") +
": " + ": " +
_.sprintf( _.sprintf(
"%(width).2fmm &times; %(depth).2fmm &times; %(height).2fmm", "%(width).2fmm (X) &times; %(depth).2fmm (Y) &times; %(height).2fmm (Z)",
dimensions dimensions
); );
output += "<br>"; output += "<br>";
@@ -4,12 +4,14 @@ $(function () {
self.dontPrintUnattendedAcknowledged = ko.observable(false); self.dontPrintUnattendedAcknowledged = ko.observable(false);
self.dontPortForwardAcknowledged = ko.observable(false); self.dontPortForwardAcknowledged = ko.observable(false);
self.fundingRequestAcknowledged = ko.observable(false);
self.error = ko.observable(false); self.error = ko.observable(false);
self.allAcknowledged = ko.pureComputed(function () { self.allAcknowledged = ko.pureComputed(function () {
return ( return (
self.dontPrintUnattendedAcknowledged() && self.dontPrintUnattendedAcknowledged() &&
self.dontPortForwardAcknowledged() self.dontPortForwardAcknowledged() &&
self.fundingRequestAcknowledged()
); );
}); });
@@ -34,9 +36,11 @@ $(function () {
self._showAcknowledgementNeededDialog = function () { self._showAcknowledgementNeededDialog = function () {
self.error(true); self.error(true);
showMessageDialog({ showMessageDialog({
title: gettext("Please acknowledge the safety warnings"), title: gettext(
"Please acknowledge the safety warnings and call for funding"
),
message: gettext( message: gettext(
"You haven't yet acknowledged all safety warnings. Please do so first." "You haven't yet acknowledged all safety warnings and the call for funding. Please do so first."
) )
}); });
}; };
+24
View File
@@ -1092,6 +1092,30 @@ ul.dropdown-menu li a {
} }
} }
.funding-banner {
display: flex;
flex-grow: 1;
flex-direction: row;
align-items: center;
padding: 1em;
height: 60px;
border-top: 1px solid #85ba80;
border-bottom: 1px solid #85ba80;
background-color: #85ba8066;
.banner-icon {
display: inline-block;
font-size: 4em;
line-height: 1em;
}
.banner-text {
font-size: 1em;
margin: 0 0 0 1.5em;
}
}
/** Footer */ /** Footer */
.footer { .footer {
ul { ul {
@@ -3,6 +3,13 @@
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
<h3 id="about_dialog_label">{{ _('About OctoPrint') }}</h3> <h3 id="about_dialog_label">{{ _('About OctoPrint') }}</h3>
</div> </div>
<div class="funding-banner">
<span class="banner-icon">💸</span>
<p class="banner-text">
Work on OctoPrint is only possible through continued financial support by people like you!<br />
<strong><a href="https://octoprint.org/support-octoprint/?utm_source=octoprint&utm_medium=about_banner&utm_campaign=funding" target="_blank" rel="noopener noreferer">Click here if you enjoy OctoPrint and want to help with its funding!</a></strong>
</p>
</div>
<div class="modal-body"> <div class="modal-body">
<div class="full-sized-box"> <div class="full-sized-box">
<div class="tabbable row-fluid"> <div class="tabbable row-fluid">
@@ -42,16 +42,21 @@
</div> </div>
</div> </div>
<h4>{{ _('If you enjoy OctoPrint...') }}</h4> <h4>{{ _('Support OctoPrint\'s ongoing development!') }}</h4>
<div class="row-fluid"> <div class="row-fluid">
<div class="span1 text-center"><img src="{{ url_for('static', filename='img/tentacle-56x56.png') }}"></div> <div class="span1 text-center"><img src="{{ url_for('static', filename='img/tentacle-56x56.png') }}"></div>
<div class="span11"> <div class="span11">
<p>{% trans url='https://octoprint.org/support-octoprint/?utm_source=octoprint&utm_medium=first_run_wizard' %} <p>{% trans url='https://octoprint.org/support-octoprint/?utm_source=octoprint&utm_medium=first_run_wizard&campaign=funding' %}
Please consider <strong><a href="{{ url }}" target="_blank">supporting OctoPrint's ongoing development</a></strong>, Work on OctoPrint is only possible through continued financial support by people like you!
which can only continue with funding by users like you! You can also find this link in the "About" dialog.<br> If you enjoy OctoPrint, please <strong><a href="{{ url }}" target="_blank">click here to learn how to help with its funding</a></strong> -
every bit helps!<br>
<strong>Thank you!</strong> <strong>Thank you!</strong>
{% endtrans %}</p> {% endtrans %}</p>
<p><label class="checkbox" data-bind="style: { border: !fundingRequestAcknowledged() && error() ? '1px dashed red' : 'inherit' }">
<input type="checkbox" data-bind="checked: fundingRequestAcknowledged">
<strong>{{ _('I have read and understood this') }}</strong>
</label></p>
</div> </div>
</div> </div>
+1 -4
View File
@@ -5,10 +5,7 @@
</ul> </ul>
<ul id="footer_links" class="pull-right"> <ul id="footer_links" class="pull-right">
<li><a href="https://octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fas fa-home"></i> {{ _('Web') }}</a></li> <li><a href="https://octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fas fa-home"></i> {{ _('Web') }}</a></li>
<li><a href="https://community.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fab fa-discourse"></i> {{ _('Forum') }}</a></li> <li><a href="https://octoprint.org/support-octoprint/?utm_source=octoprint&utm_medium=footer&utm_campaign=funding" target="_blank" rel="noreferrer noopener"><i class="fas fa-donate"></i> {{ _('Donate') }}</a></li>
<li><a href="https://discord.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fab fa-discord"></i> {{ _('Discord') }}</a></li>
<li><a href="https://faq.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fas fa-question-circle"></i> {{ _('FAQ') }}</a></li>
<li><a href="https://docs.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fas fa-book"></i> {{ _('Docs') }}</a></li>
<li id="footer_about"><a href="javascript:void(0)" data-bind="click: function() { show('about_about') }"><i class="fas fa-info-circle"></i> {{ _('About') }}</a></li> <li id="footer_about"><a href="javascript:void(0)" data-bind="click: function() { show('about_about') }"><i class="fas fa-info-circle"></i> {{ _('About') }}</a></li>
<li id="footer_systeminfo" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.SYSTEM)"><a href="javascript:void(0)" data-bind="click: function() { show('about_systeminfo') }"><i class="fas fa-flag-checkered"></i> {{ _('System') }}</a></li> <li id="footer_systeminfo" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.SYSTEM)"><a href="javascript:void(0)" data-bind="click: function() { show('about_systeminfo') }"><i class="fas fa-flag-checkered"></i> {{ _('System') }}</a></li>
</ul> </ul>
+11 -6
View File
@@ -6138,13 +6138,11 @@ def apply_temperature_offsets(line, offsets, current_tool=None):
return line return line
groups = match.groupdict() groups = match.groupdict()
if "temperature" not in groups or groups["temperature"] is None: if not groups.get("temperature"):
return line return line
offset = 0 offset = 0
if current_tool is not None and ( if current_tool is not None and groups["command"] in ("104", "109"):
groups["command"] == "104" or groups["command"] == "109"
):
# extruder temperature, determine which one and retrieve corresponding offset # extruder temperature, determine which one and retrieve corresponding offset
tool_num = current_tool tool_num = current_tool
if "tool" in groups and groups["tool"] is not None: if "tool" in groups and groups["tool"] is not None:
@@ -6153,14 +6151,21 @@ def apply_temperature_offsets(line, offsets, current_tool=None):
tool_key = "tool%d" % tool_num tool_key = "tool%d" % tool_num
offset = offsets[tool_key] if tool_key in offsets and offsets[tool_key] else 0 offset = offsets[tool_key] if tool_key in offsets and offsets[tool_key] else 0
elif groups["command"] == "140" or groups["command"] == "190": elif groups["command"] in ("140", "190"):
# bed temperature # bed temperature
offset = offsets["bed"] if "bed" in offsets else 0 offset = offsets["bed"] if "bed" in offsets else 0
if offset == 0: if offset == 0:
return line return line
temperature = float(groups["temperature"]) try:
temperature = float(groups["temperature"])
except ValueError:
_logger.warning(
f"Could not parse target temperature, ignoring line for offset application: {line}"
)
return line
if temperature == 0: if temperature == 0:
return line return line
+66 -31
View File
@@ -9,65 +9,100 @@
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.30.0" "@playwright/test": "^1.40.0"
} }
}, },
"node_modules/@playwright/test": { "node_modules/@playwright/test": {
"version": "1.30.0", "version": "1.40.0",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.30.0.tgz", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.0.tgz",
"integrity": "sha512-SVxkQw1xvn/Wk/EvBnqWIq6NLo1AppwbYOjNLmyU0R1RoQ3rLEBtmjTnElcnz8VEtn11fptj1ECxK0tgURhajw==", "integrity": "sha512-PdW+kn4eV99iP5gxWNSDQCbhMaDVej+RXL5xr6t04nbKLCBwYtA046t7ofoczHOm8u6c+45hpDKQVZqtqwkeQg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/node": "*", "playwright": "1.40.0"
"playwright-core": "1.30.0"
}, },
"bin": { "bin": {
"playwright": "cli.js" "playwright": "cli.js"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=16"
} }
}, },
"node_modules/@types/node": { "node_modules/fsevents": {
"version": "18.11.18", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true
},
"node_modules/playwright-core": {
"version": "1.30.0",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.30.0.tgz",
"integrity": "sha512-7AnRmTCf+GVYhHbLJsGUtskWTE33SwMZkybJ0v6rqR1boxq2x36U7p1vDRV7HO2IwTZgmycracLxPEJI49wu4g==",
"dev": true, "dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/playwright": {
"version": "1.40.0",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.0.tgz",
"integrity": "sha512-gyHAgQjiDf1m34Xpwzaqb76KgfzYrhK7iih+2IzcOCoZWr/8ZqmdBw+t0RU85ZmfJMgtgAiNtBQ/KS2325INXw==",
"dev": true,
"dependencies": {
"playwright-core": "1.40.0"
},
"bin": { "bin": {
"playwright": "cli.js" "playwright": "cli.js"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=16"
},
"optionalDependencies": {
"fsevents": "2.3.2"
}
},
"node_modules/playwright-core": {
"version": "1.40.0",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.0.tgz",
"integrity": "sha512-fvKewVJpGeca8t0ipM56jkVSU6Eo0RmFvQ/MaCQNDYm+sdvKkMBBWTE1FdeMqIdumRaXXjZChWHvIzCGM/tA/Q==",
"dev": true,
"bin": {
"playwright-core": "cli.js"
},
"engines": {
"node": ">=16"
} }
} }
}, },
"dependencies": { "dependencies": {
"@playwright/test": { "@playwright/test": {
"version": "1.30.0", "version": "1.40.0",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.30.0.tgz", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.0.tgz",
"integrity": "sha512-SVxkQw1xvn/Wk/EvBnqWIq6NLo1AppwbYOjNLmyU0R1RoQ3rLEBtmjTnElcnz8VEtn11fptj1ECxK0tgURhajw==", "integrity": "sha512-PdW+kn4eV99iP5gxWNSDQCbhMaDVej+RXL5xr6t04nbKLCBwYtA046t7ofoczHOm8u6c+45hpDKQVZqtqwkeQg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "*", "playwright": "1.40.0"
"playwright-core": "1.30.0"
} }
}, },
"@types/node": { "fsevents": {
"version": "18.11.18", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true "dev": true,
"optional": true
},
"playwright": {
"version": "1.40.0",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.0.tgz",
"integrity": "sha512-gyHAgQjiDf1m34Xpwzaqb76KgfzYrhK7iih+2IzcOCoZWr/8ZqmdBw+t0RU85ZmfJMgtgAiNtBQ/KS2325INXw==",
"dev": true,
"requires": {
"fsevents": "2.3.2",
"playwright-core": "1.40.0"
}
}, },
"playwright-core": { "playwright-core": {
"version": "1.30.0", "version": "1.40.0",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.30.0.tgz", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.0.tgz",
"integrity": "sha512-7AnRmTCf+GVYhHbLJsGUtskWTE33SwMZkybJ0v6rqR1boxq2x36U7p1vDRV7HO2IwTZgmycracLxPEJI49wu4g==", "integrity": "sha512-fvKewVJpGeca8t0ipM56jkVSU6Eo0RmFvQ/MaCQNDYm+sdvKkMBBWTE1FdeMqIdumRaXXjZChWHvIzCGM/tA/Q==",
"dev": true "dev": true
} }
} }
+1 -1
View File
@@ -8,6 +8,6 @@
"author": "Gina Häußge", "author": "Gina Häußge",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.30.0" "@playwright/test": "^1.40.0"
} }
} }
+3 -3
View File
@@ -1967,7 +1967,7 @@ msgstr "Fertig!"
#: src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js:700 #: src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js:700
#: src/octoprint/static/js/app/viewmodels/files.js:1066 #: src/octoprint/static/js/app/viewmodels/files.js:1066
msgid "Model size" msgid "Model size"
msgstr "Modelgröße" msgstr "Modellgröße"
#: src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js:710 #: src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js:710
msgid "Estimated layer height" msgid "Estimated layer height"
@@ -2128,7 +2128,7 @@ msgstr "Nächste Schicht"
#: src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2:26 #: src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2:26
msgid "Model info" msgid "Model info"
msgstr "Modelinformationen" msgstr "Modellinformationen"
#: src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2:29 #: src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2:29
msgid "Layer info" msgid "Layer info"
@@ -2148,7 +2148,7 @@ msgstr "Ausschnitt auf Modell zentrieren"
#: src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2:45 #: src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2:45
msgid "Zoom in on model" msgid "Zoom in on model"
msgstr "Auf Model zoomen" msgstr "Auf Modell zoomen"
#: src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2:51 #: src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2:51
msgid "Show moves" msgid "Show moves"