diff --git a/.github/fixtures/with_acl/config.yaml b/.github/fixtures/with_acl/config.yaml new file mode 100644 index 000000000..76cd71aad --- /dev/null +++ b/.github/fixtures/with_acl/config.yaml @@ -0,0 +1,18 @@ +accessControl: + salt: zXmvzI3uWuTLkSPOEfA2ZLwn3f3sGUNS +plugins: + virtual_printer: + enabled: true + tracking: + enabled: false +server: + firstRun: false + onlineCheck: + enabled: false + pluginBlacklist: + enabled: false + secretKey: rrdHjvmeGMPSdYWg2NGdiM7mpz9pjekk + seenWizards: + backup: null + corewizard: 3 + tracking: null diff --git a/.github/fixtures/with_acl/users.yaml b/.github/fixtures/with_acl/users.yaml new file mode 100644 index 000000000..fac60a9d4 --- /dev/null +++ b/.github/fixtures/with_acl/users.yaml @@ -0,0 +1,22 @@ +admin: + active: true + apikey: null + groups: + - admins + - users + password: 3033587f3b040680c77ce4fb7e8d61422878ef49a2a784227689f3b44ce66ada7f6161f8b2b037267f0d37b783a5600276eb88e1d224d24915f64e187a49a89f + permissions: [] + roles: + - user + - admin + settings: {} +user: + active: true + apikey: null + groups: + - users + password: 3033587f3b040680c77ce4fb7e8d61422878ef49a2a784227689f3b44ce66ada7f6161f8b2b037267f0d37b783a5600276eb88e1d224d24915f64e187a49a89f + permissions: [] + roles: + - user + settings: {} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..830ddfbd7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,175 @@ +name: Build +on: + push: + release: + types: [published, prereleased] + +jobs: + build: + name: ๐Ÿ”จ Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿ— Install build dependencies + run: | + python -m pip install wheel --user + - name: ๐Ÿ”จ Build a binary wheel and a source tarball + run: | + python setup.py sdist bdist_wheel + - name: โฌ† Upload build result + uses: actions/upload-artifact@v1 + with: + name: dist + path: dist + + test-unit: + name: ๐Ÿงช Unit tests + strategy: + matrix: + python: ["2.7", "3.7", "3.8"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + - name: ๐Ÿ— Set up test dependencies + run: | + pip install -e .[develop] + - name: ๐Ÿš€ Run test suite + run: | + pytest + + test-flake8: + name: ๐Ÿงช Flake8 + 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 test dependencies + run: | + pip install -e .[develop] + - name: ๐Ÿš€ Run test suite + run: | + flake8 src/ tests setup.py + + test-install: + name: ๐Ÿงช Installation tests + needs: build + strategy: + matrix: + python: ["2.7", "3.7", "3.8"] + installable: ["wheel", "sdist"] + runs-on: ubuntu-latest + steps: + - name: โฌ‡ Download build result + uses: actions/download-artifact@v1 + with: + name: dist + path: dist + - name: ๐Ÿ— Set up Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + - name: ๐Ÿš€ Install wheel + if: matrix.installable == 'wheel' + run: | + pip install dist/OctoPrint-*-py2.py3-none-any.whl + - name: ๐Ÿš€ Install source tarball + if: matrix.installable == 'sdist' + run: | + pip install dist/OctoPrint-*.tar.gz + + test-e2e: + name: ๐Ÿงช E2E tests + needs: build + runs-on: ubuntu-16.04 + steps: + - name: โฌ‡ Checkout code + uses: actions/checkout@v2 + + - name: โฌ‡ Download build result + uses: actions/download-artifact@v1 + with: + name: dist + path: dist + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿš€ Install wheel + run: | + pip install dist/OctoPrint-*-py2.py3-none-any.whl + + - name: ๐Ÿ— Create base config for test server + run: | + mkdir e2econfig + cp -r .github/fixtures/with_acl/* e2econfig + + - name: ๐Ÿš€ Run Cypress + uses: cypress-io/github-action@v2 + with: + working-directory: tests/cypress + browser: chrome + start: 'octoprint -b ${{ github.workspace }}/e2econfig serve --host 127.0.0.1 --port 5000' + wait-on: 'http://127.0.0.1:5000/online.txt' + + - name: โฌ† Upload screenshots + uses: actions/upload-artifact@v1 + if: failure() + with: + name: cypress-screenshots + path: tests/cypress/screenshots + - name: โฌ† Upload videos + uses: actions/upload-artifact@v1 + if: always() + with: + name: cypress-videos + path: tests/cypress/videos + + publish-on-testpypi: + name: ๐Ÿ“ฆ Publish on TestPyPI + if: github.event_name == 'release' + needs: + - test-unit + - test-install + - test-e2e + runs-on: ubuntu-latest + steps: + - name: โฌ‡ Download build result + uses: actions/download-artifact@v1 + with: + name: dist + path: dist + - name: ๐Ÿ“ฆ Publish to index + uses: pypa/gh-action-pypi-publish@master + continue-on-error: true + with: + password: ${{ secrets.testpypi_password }} + repository_url: https://test.pypi.org/legacy/ + + #publish-on-pypi: + # name: ๐Ÿ“ฆ Publish tagged releases to PyPI + # if: github.event_name == 'release' + # needs: publish-on-testpypi + # runs-on: ubuntu-latest + # steps: + # - name: โฌ‡ Download build result + # uses: actions/download-artifact@v1 + # with: + # name: dist + # path: dist + # - name: ๐Ÿ“ฆ Publish to index + # uses: pypa/gh-action-pypi-publish@master + # with: + # password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml new file mode 100644 index 000000000..98c3d4d01 --- /dev/null +++ b/.github/workflows/test_install.yml @@ -0,0 +1,75 @@ +name: Test install of branches and latest release twice per day + +on: + schedule: + - cron: '0 */12 * * *' + +jobs: + install-branch: + name: Install branch + strategy: + matrix: + os: ["ubuntu-latest"] + python: ["2.7", "3.7", "3.8"] + branch: ["master"] + runs-on: ${{ matrix.os }} + steps: + - name: ๐Ÿ Set up Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: โฌ‡ Checkout code + uses: actions/checkout@v2 + with: + ref: ${{ matrix.branch }} + fetch-depth: 0 + - name: ๐Ÿ‘ท Build and install checkout + run: | + pip install . + - name: ๐Ÿ“ง Discord success notification + 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:${{ matrix.branch }}` was successful' + - name: ๐Ÿ“ง Discord failure notification + 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:${{ matrix.branch }}` failed' + + install-latest: + name: Install latest release + strategy: + matrix: + os: ["ubuntu-latest"] + python: ["2.7", "3.7", "3.8"] + runs-on: ${{ matrix.os }} + steps: + - name: ๐Ÿ‘€ Determine latest release + id: latest + uses: foosel/github-action-get-latest-release@master + with: + repository: "OctoPrint/OctoPrint" + - name: ๐Ÿ Set up Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: ๐Ÿ‘ท Build and install latest release + run: | + pip install https://github.com/OctoPrint/OctoPrint/archive/${{ steps.latest.outputs.release }}.zip + - name: ๐Ÿ“ง Discord success notification + 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:${{ steps.latest.outputs.release }}` was successful' + - name: ๐Ÿ“ง Discord failure notification + 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:${{ steps.latest.outputs.release }}` failed' diff --git a/.github/workflows/test_install_py2.yml b/.github/workflows/test_install_py2.yml deleted file mode 100644 index d6b2290db..000000000 --- a/.github/workflows/test_install_py2.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Test install on Python 2 - -on: - push: - branches: - - master - repository_dispatch: - types: [test_install_py2] - schedule: - - cron: '0 */12 * * *' - -jobs: - install-master: - runs-on: ubuntu-latest - steps: - - name: ๐Ÿ Set up Python 2.7 - uses: actions/setup-python@v2 - with: - python-version: 2.7 - - name: โฌ‡ Checkout code - uses: actions/checkout@v2 - - name: ๐Ÿ‘ท Build and install checkout - run: | - pip install . - - name: ๐Ÿ“ง Discord success notification - env: - DISCORD_WEBHOOK: ${{ secrets.discord_webhook }} - uses: Ilshidur/action-discord@master - with: - args: 'โ˜‘๏ธ Test install on Python 2 for `OctoPrint/OctoPrint:master` was successful' - - name: ๐Ÿ“ง Discord failure notification - if: failure() - env: - DISCORD_WEBHOOK: ${{ secrets.discord_webhook_foosel }} - uses: Ilshidur/action-discord@master - with: - args: '๐Ÿšซ Test install on Python 2 for `OctoPrint/OctoPrint:master` failed' - - install-latest: - runs-on: ubuntu-latest - steps: - - name: ๐Ÿ Set up Python 2.7 - uses: actions/setup-python@v2 - with: - python-version: 2.7 - - name: ๐Ÿ‘ท Build and install latest from PyPI - run: | - pip install OctoPrint - - name: ๐Ÿ“ง Discord success notification - env: - DISCORD_WEBHOOK: ${{ secrets.discord_webhook }} - uses: Ilshidur/action-discord@master - with: - args: 'โ˜‘๏ธ Test install on Python 2 for latest OctoPrint release was successful' - - name: ๐Ÿ“ง Discord failure notification - if: failure() - env: - DISCORD_WEBHOOK: ${{ secrets.discord_webhook_foosel }} - uses: Ilshidur/action-discord@master - with: - args: '๐Ÿšซ Test install on Python 2 for latest OctoPrint release failed' diff --git a/.gitignore b/.gitignore index 55634017d..4aa025b88 100644 --- a/.gitignore +++ b/.gitignore @@ -20,25 +20,26 @@ linux-Cura-* Printrun ======= .idea +.vscode .DS_Store Cura/current_profile.ini Cura/preferences.ini build dist pypy -OctoPrint.egg-info -*.orig +*.orig *.codekit -venv -venv2 -venv3 -venv26 -venv27 -venv33 -venv34 -venv35 -venv36 -venv37 -venv38 +*.egg-info +.eggs +.mypy_cache +.pytest_cache +.tox + +venv* +testconf* + +node_modules +tests/cypress/screenshots +tests/cypress/videos diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c69eccd39..000000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- - -language: python -dist: xenial - -matrix: - include: - - python: '3.8' - env: RUN_FLAKE8=true - -python: -- "3.8" -- "3.7" -- "3.6" -install: -- pip install -e .[develop] -script: -- test -n "$RUN_FLAKE8" || pytest -- test -z "$RUN_FLAKE8" || flake8 src/ tests setup.py -sudo: false -git: - depth: 250 diff --git a/.versioneer-lookup b/.versioneer-lookup index ad36dffb1..ded4d8ec4 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -18,19 +18,19 @@ prerelease HEAD \(detached.* -# maintenance is currently the branch for preparation of maintenance release 1.4.1 +# maintenance is currently the branch for preparation of maintenance release 1.4.2 # so are any fix/... and improve/... branches -maintenance 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev -fix/.* 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev -improve/.* 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev +maintenance 1.4.2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev +fix/.* 1.4.2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev +improve/.* 1.4.2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev # staging/maintenance is currently the branch for preparation of 1.4.0rc7 # so is regressionfix/... -staging/maintenance 1.4.0rc7 d99af420acb9d5b18a4f60f9cae8abb458e131d4 pep440-dev -regressionfix/.* 1.4.0rc7 d99af420acb9d5b18a4f60f9cae8abb458e131d4 pep440-dev +staging/maintenance 1.4.1rc2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev +regressionfix/.* 1.4.1rc2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev -# staging/devel is currently inactive (but has the 1.4.0rc7 namespace) -staging/devel 1.4.0rc7 d99af420acb9d5b18a4f60f9cae8abb458e131d4 pep440-dev +# staging/devel is currently inactive (but has the 1.4.1rc2 namespace) +staging/devel 1.4.1rc2 42769dad7dda3bc0c6c94e0e8ce832af9b14a565 pep440-dev # every other branch is a development branch and thus gets resolved to 2.0.0-dev for now .* 2.0.0 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev diff --git a/AUTHORS.md b/AUTHORS.md index 32763a221..db2e16367 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -121,6 +121,7 @@ date of first contribution): * [Josh Friend](https://github.com/joshfriend) * [Lachlan Cresswell](https://github.com/lachyc) * [Khoi Pham](https://github.com/osubuu) + * [Federico Nembrini](https://github.com/FedericoNembrini) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and diff --git a/CHANGELOG.md b/CHANGELOG.md index c7a906db4..ece6d517e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ # Changelog -See [the releases on Github](https://github.com/foosel/OctoPrint/releases) for detailed changelogs for all releases +See [the releases on Github](https://github.com/OctoPrint/OctoPrint/releases) for detailed changelogs for all releases and release candidates. diff --git a/README.md b/README.md index 3c282478d..b614cb2e7 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # OctoPrint -![GitHub release](https://img.shields.io/github/release/OctoPrint/OctoPrint.svg?colorB=brightgreen) -[![Travis build status](https://img.shields.io/travis/OctoPrint/OctoPrint.svg)](https://travis-ci.org/OctoPrint/OctoPrint) -[![Forum](https://img.shields.io/discourse/https/community.octoprint.org/users.svg)](https://community.octoprint.org) -[![Discord](https://img.shields.io/discord/704958479194128507?label=discord)](https://discord.octoprint.org) +![GitHub release](https://img.shields.io/github/v/release/OctoPrint/OctoPrint?logo=github&logoColor=white) +![PyPI](https://img.shields.io/pypi/v/OctoPrint?logo=python&logoColor=white) +![Build status](https://img.shields.io/github/workflow/status/OctoPrint/OctoPrint/Build) +[![Community Forum](https://img.shields.io/discourse/users?logo=discourse&logoColor=white&server=https%3A%2F%2Fcommunity.octoprint.org)](https://community.octoprint.org) +[![Discord](https://img.shields.io/discord/704958479194128507?label=discord&logo=discord&logoColor=white)](https://discord.octoprint.org) [![Twitter Follow](https://img.shields.io/twitter/follow/OctoPrint3d.svg?style=social&label=Follow)](https://twitter.com/OctoPrint3d) @@ -13,7 +14,7 @@ and released under the [GNU Affero General Public License V3](http://www.gnu.org Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme). -The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme). +The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme). It also serves as central knowledge base. An invite to the Discord server can be found at [discord.octoprint.org](https://discord.octoprint.org). @@ -30,17 +31,17 @@ If you enjoy OctoPrint, please consider becoming a regular supporter!** You are currently looking at the source code repository of OctoPrint. If you already installed it (e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only -want to find out how to use it, [the documentation](http://docs.octoprint.org/) and [the public wiki](https://github.com/OctoPrint/OctoPrint/wiki) -might be of more interest for you. You might also want to subscribe to join +want to find out how to use it, [the documentation](http://docs.octoprint.org/) might be of more interest for you. You might also want to subscribe to join [the community forum at community.octoprint.org](https://community.octoprint.org) where there are other active users who might be able to help you with any questions you might have. ## Contributing Contributions of all kinds are welcome, not only in the form of code but also with regards to the -[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/OctoPrint/OctoPrint/wiki), debugging help +[official documentation](http://docs.octoprint.org/), debugging help in the [bug tracker](https://github.com/OctoPrint/OctoPrint/issues), support of other users on -[the community forum at community.octoprint.org](https://community.octoprint.org) +[the community forum at community.octoprint.org](https://community.octoprint.org) or +[the official discord at discord.octoprint.org](https://discord.octoprint.org) and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme). If you think something is bad about OctoPrint or its documentation the way it is, please help @@ -53,7 +54,7 @@ For information about how to go about submitting bug reports or pull requests, p ## Installation Installation instructions for installing from source for different operating -systems can be found [on the wiki](https://github.com/OctoPrint/OctoPrint/wiki#assorted-guides). +systems can be found [on the forum](https://community.octoprint.org/tags/c/support/guides/15/setup). If you want to run OctoPrint on a Raspberry Pi, you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi) which is a custom SD card image that includes OctoPrint plus dependencies. @@ -61,9 +62,11 @@ which is a custom SD card image that includes OctoPrint plus dependencies. The generic steps that should basically be done regardless of operating system and runtime environment are the following (as *regular user*, please keep your hands *off* of the `sudo` command here!) - this assumes -you already have Python 3.6, 3.7 or 3.8, pip and virtualenv set up on your system: +you already have Python 3.6, 3.7 or 3.8, pip and virtualenv and their dependencies set up on your system: -1. Create a user-owned virtual environment therein: `virtualenv venv`. +1. Create a user-owned virtual environment therein: `virtualenv venv`. If you want to specify a specific python + to use instead of whatever version your system defaults to, you can also explicitly require that via the `--python` + parameter, e.g. `virtualenv --python=python3 venv`. 2. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install OctoPrint` Or alternatively, for an install from source: diff --git a/SUPPORTERS.md b/SUPPORTERS.md index a06ccfb07..8876adb44 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -1,14 +1,14 @@ -# Supporters +# Supporters Development of this version of OctoPrint wouldn't have been possible without -[the financial support by the community](https://octoprint.org/support-octoprint/) - +[the financial support by the community](https://support.octoprint.org) - thanks to everyone who contributed! -## Patreon Patrons +## Patrons & Sponsors - * Alex Krilov * Andrew Moorby * Arnljot Arntsen + * Ash King * BigTreeTech * Boris Hussein * Brad Jackson @@ -27,13 +27,15 @@ thanks to everyone who contributed! * Hog Duske * Hugh Blemings * jean-claude migneault - * Jeff Renfer - * Jeremiah Avery + * Jeremy Cole + * Joe Pasqua + * John Robinson * Joshua Wills * Justin Kaufman * Kaile Riser * Kale Stedman * Kazuhiro Ogura + * Kelly C McNiece * Kenneth Jiang * Kurt Wubbels * Kyle Menigoz @@ -41,7 +43,7 @@ thanks to everyone who contributed! * Lee Dohm * Makespace Madrid * Mark Walker - * Martin Majewski + * Marvin Nahmias * Michael Aumock * Miles Flavel * Mosaic Manufacturing @@ -49,6 +51,7 @@ thanks to everyone who contributed! * Patrick Glyrรฉ * Patrick McGinnis * Prof Yuh Wen Chen + * Raise3D * Randy C. Will * Ranjib Dey * Richard Michaud @@ -56,11 +59,11 @@ thanks to everyone who contributed! * Robert Gusek * Ronald Griehsler * Sacha Telgenhof - * Simon Hallam + * Sebastien Andrivet * Stefan Krister * Steve Thompson + * Stewart Danos * Sven Mueller - * Trent Shumay * Ulrich Kempken -and 1741 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)! +and 1886 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)! \ No newline at end of file diff --git a/THIRDPARTYLICENSES.md b/THIRDPARTYLICENSES.md index 568a14bc5..594251edb 100644 --- a/THIRDPARTYLICENSES.md +++ b/THIRDPARTYLICENSES.md @@ -24,10 +24,12 @@ * [LESS](http://lesscss.org): Apache License 2.0 * [lodash](https://lodash.com): MIT * [Loglevel](https://github.com/pimterry/loglevel): MIT + * [md5.js](https://blueimp.github.io/JavaScript-MD5/): MIT * [Modernizr](http://modernizr.com): MIT * [Moment.js](http://momentjs.com/): MIT * [PNotify](http://sciactive.com/pnotify/): GPL, LGPL, MPL (triple licensed) * [pusher.color.js](http://cache.preserve.io/5g18q0pw/index.html) (original link dead): MIT + * [ResizeSensor.js](https://github.com/procurios/ResizeSensor): MIT * [SockJS](https://github.com/sockjs/sockjs-client): MIT * [sprintf-js](http://alexei.ro/): BSD @@ -39,12 +41,14 @@ * [Click](http://click.pocoo.org/): BSD * [emoji](https://github.com/carpedm20/emoji/): BSD * [feedparser](https://github.com/kurtmckee/feedparser): BSD + * [filetype](https://h2non.github.io/filetype.py/): MIT * [Flask](http://flask.pocoo.org/): BSD * [Flask-Assets](http://github.com/miracle2k/flask-assets): BSD * [Flask-Babel](http://github.com/mitsuhiko/flask-babel): BSD * [Flask-Login](https://github.com/maxcountryman/flask-login): MIT * [Flask-Markdown](http://github.com/dcolish/flask-markdown): BSD * [Flask-Principal](http://packages.python.org/Flask-Principal/): MIT + * [frozendict](https://github.com/slezica/python-frozendict): MIT * [future](https://python-future.org/): MIT * [futures](https://github.com/agronholm/pythonfutures): Python * [monotonic](https://github.com/atdt/monotonic): Apache License 2.0 @@ -58,19 +62,25 @@ * [requests](http://python-requests.org/): Apache License 2.0 * [rsa](http://stuvel.eu/rsa): Apache License 2.0 * [sarge](http://sarge.readthedocs.org/): BSD + * [sentry-sdk](https://github.com/getsentry/sentry-python): BSD * [scandir](https://github.com/benhoyt/scandir): BSD * [semantic_version](https://github.com/rbarrois/python-semanticversion): BSD * [SockJS-Tornado](http://github.com/mrjoes/sockjs-tornado/): MIT * [Tornado](http://www.tornadoweb.org/): Apache License 2.0 + * [typing](https://pypi.org/project/typing/): Python * [watchdog](http://github.com/gorakhargosh/watchdog): Apache License 2.0 * [websocket-client](https://github.com/liris/websocket-client): LGPLv3 * [wrapt](http://wrapt.readthedocs.org/): BSD ## Development (testing, documentation generation, etc) + * [cookiecutter](https://github.com/cookiecutter/cookiecutter): BSD * [ddt](https://github.com/txels/ddt): MIT + * [flake8](https://gitlab.com/pycqa/flake8): MIT * [mock](https://github.com/testing-cabal/mock): BSD - * [nose](http://pythonhosted.org/nose/): LGPL + * [pyinstrument](https://github.com/joerick/pyinstrument): BSD + * [pytest](https://docs.pytest.org/en/latest/): MIT + * [pytest-doctest-custom](http://github.com/danilobellini/pytest-doctest-custom): MIT * [Sphinx](http://sphinx-doc.org/): BSD * [sphinxcontrib-httpdomain](https://bitbucket.org/birkenfeld/sphinx-contrib/src/default/httpdomain/): BSD * [sphinxcontrib-mermad](https://github.com/mgaitan/sphinxcontrib-mermaid): BSD diff --git a/docs/bundledplugins/action_command_notification.rst b/docs/bundledplugins/action_command_notification.rst new file mode 100644 index 000000000..aff4d75be --- /dev/null +++ b/docs/bundledplugins/action_command_notification.rst @@ -0,0 +1,61 @@ +.. _sec-bundledplugins-action_command_notification: + +Action Command Notification support +=================================== + +The OctoPrint Action Command Notification Support Plugin comes bundled with OctoPrint (starting with 1.4.1). + +It allows firmware to trigger notifications users with the ``PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW`` permission +using :ref:`action commands ` about relevant events. These notifications will be shown +in the sidebar and if configured also as popup messages. The notifications in the sidebar panel can also be cleared +by users with the ``PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR` permission. + +.. _fig-bundledplugins-action_command_notification-example: +.. figure:: ../images/bundledplugins-action_command_notification-example.png + :align: center + :alt: Simple notification example + + A simple notification example triggered by the firmware + +.. _sec-bundledplugins-action_command_notification-configuration: + +Configuring the plugin +---------------------- + +The plugin supports the following configuration keys: + + * ``enable``: Whether to enable the support of notifications (enabled by default). + * ``enable_popup``: Whether to enable the additional display of notifications as popups in the UI (disabled by default). + +You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``. + +.. _sec-bundledplugins-action_command_notification-action_commands: + +Supported action commands +------------------------- + +notification + Displays the notification ```` + +.. _sec-bundledplugins-action_command_prompt-example: + +Example communication with the firmware +--------------------------------------- + +.. _sec-bundledplugins-action_command_prompt-sourcecode: + +To display the :ref:`above notification ` the firmware sent this action command: + +.. code-block:: none + + //action:notification Hello World! + + +.. _sec-bundledplugins-action_command_notification-sourcecode: + + +Source code +----------- + +The source of the Action Command Prompt Notification plugin is bundled with OctoPrint and can be found in +its source repository under ``src/octoprint/plugins/action_command_notification``. diff --git a/docs/bundledplugins/action_command_prompt.rst b/docs/bundledplugins/action_command_prompt.rst index 2d972cac4..247f741ff 100644 --- a/docs/bundledplugins/action_command_prompt.rst +++ b/docs/bundledplugins/action_command_prompt.rst @@ -19,17 +19,6 @@ placeholder for the selected option's index. A simple dialog example triggered by the firmware -.. _sec-bundledplugins-action_command_prompt-firststeps: - -First Steps ------------ - -In order for this plugin to work, you'll need to configure it with the command your firmware uses to accept -dialog selections. You can do that in the settings dialog. - -Currently there is no agreed upon command for this since no firmware has yet made use of this feature, so OctoPrint -ships with an empty value here. - .. _sec-bundledplugins-action_command_prompt-configuration: Configuring the plugin @@ -37,7 +26,13 @@ Configuring the plugin The plugin supports the following configuration keys: - * ``selection_command``: The command to send to the firmware on choice, including the ``{choice}`` placeholder, e.g. ``M876 S{choice}``. + * ``enable``: Whether to always enable (``always``), disable (``never``) or ``detect`` support. + * ``enable_emergency_sending``: Will make the selection command be sent as an emergency command to jump the internal + send queue and even be sent to the printer if it's not signaling to be able to received. Only done if this is true + and the printer signals support for emergency command processing. Defaults to ``true``. + * ``enable_signaling``: If enabled, will send the configured command with the ``P1`` parameter to the printer to + signal prompt support of the host. Defaults to ``true``. + * ``command``: The command to send to the firmware on choice, defaults to ``M876``. You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``. @@ -69,8 +64,6 @@ prompt_end Example communication with the firmware --------------------------------------- -.. _sec-bundledplugins-action_command_prompt-sourcecode: - To display the :ref:`above dialog ` the firmware sent these action commands: .. code-block:: none @@ -103,6 +96,8 @@ This would produce the following output: If the user selects "Abort print", OctoPrint will send ``2`` as selected choice. +.. _sec-bundledplugins-action_command_prompt-sourcecode: + Source code ----------- diff --git a/docs/bundledplugins/file_check.rst b/docs/bundledplugins/file_check.rst new file mode 100644 index 000000000..814066697 --- /dev/null +++ b/docs/bundledplugins/file_check.rst @@ -0,0 +1,7 @@ +.. _sec-bundledplugins-file_check: + +File Check +========== + +The file check plugin - while considered bundled with OctoPrint - is a separate project on its own release +cycle and documented on `its Github repository `_. diff --git a/docs/bundledplugins/firmware_check.rst b/docs/bundledplugins/firmware_check.rst index ceb071039..c7e95facc 100644 --- a/docs/bundledplugins/firmware_check.rst +++ b/docs/bundledplugins/firmware_check.rst @@ -4,4 +4,4 @@ Firmware Check ============== The firmware check plugin - while considered bundled with OctoPrint - is a separate project on its own release -cycle and documented on :ref:`its Github repository `_. +cycle and documented on `its Github repository `_. diff --git a/docs/bundledplugins/gcodeviewer.rst b/docs/bundledplugins/gcodeviewer.rst new file mode 100644 index 000000000..2531f7533 --- /dev/null +++ b/docs/bundledplugins/gcodeviewer.rst @@ -0,0 +1,35 @@ +.. _sec-bundledplugins-gcodeviewer: + +GCode Viewer Plugin +=================== + +The GCode Viewer plugin provides a GCode viewer based on `Alex Ustyantsev's work `_. + +.. _fig-bundledplugins-gcodeviewer-example: +.. figure:: ../images/bundledplugins-gcodeviewer-example.png + :align: center + :alt: OctoPrint GCode Viewer Plugin + + An example of the GCode Viewer in action. + +The viewer has been included in OctoPrint ever since the first releases back in 2013, however as of +OctoPrint 1.4.1 it has been extracted into its own bundled plugin. + +.. _sec-bundledplugins-gcodeviewer-configuration: + +Configuring the plugin +---------------------- + +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 + +.. _sec-bundledplugins-gcodeviewer-sourcecode: + +Source Code +----------- + +The source of the GCode Viewer plugin is bundled with OctoPrint and can be +found in its source repository under ``src/octoprint/plugins/gcodeviewer``. diff --git a/docs/bundledplugins/index.rst b/docs/bundledplugins/index.rst index 206aaab57..d26c4fa87 100644 --- a/docs/bundledplugins/index.rst +++ b/docs/bundledplugins/index.rst @@ -7,15 +7,19 @@ Bundled Plugins .. toctree:: :maxdepth: 2 + action_command_notification.rst action_command_prompt.rst announcements.rst - tracking.rst appkeys.rst backup.rst discovery.rst errortracking.rst + file_check.rst + firmware_check.rst + gcodeviewer.rst logging.rst loginui.rst pluginmanager.rst printer_safety_check.rst softwareupdate.rst + tracking.rst diff --git a/docs/bundledplugins/softwareupdate.rst b/docs/bundledplugins/softwareupdate.rst index f99e5627f..5ee80148f 100644 --- a/docs/bundledplugins/softwareupdate.rst +++ b/docs/bundledplugins/softwareupdate.rst @@ -215,12 +215,6 @@ types are currently recognized: * ``header_prefix``: Prefix to use for the obtained value in the version display. If not provided ``header_name`` will be used. If set to an empty string, no prefix will be added. - * ``lastmodified``: Checks the ``Last-Modified`` header on a defined URL for changes. Additional - config parameters: - - * ``lastmodified_url`` or ``url``: (mandatory) URL to check. ``url`` can be used to avoid duplication in case of updater - methods such as ``single_file_plugin``. - * ``jsondata``: Checks the provided JSON endpoint for changes. The JSON endpoint must return an object with the property ``version``, which should contain the latest version, e.g. ``{"version":"1.2.3"}``. Additional config parameters: diff --git a/docs/events/index.rst b/docs/events/index.rst index 224656b3f..fe24e847f 100644 --- a/docs/events/index.rst +++ b/docs/events/index.rst @@ -197,12 +197,15 @@ File handling ------------- Upload - A file has been uploaded through the web interface. + A file has been uploaded through the :ref:`REST API `. Payload: * ``name``: the file's name * ``path``: the file's path within its storage location * ``target``: the target storage location to which the file was uploaded, either ``local`` or ``sdcard`` + * ``select``: whether the file will immediately be selected, as requested on the API by the corresponding parameter + * ``print``: whether the file will immediately start printing, as requested on the API by the corresponding parameter + * ``userdata``: optional ``userdata`` if provided on the API, will only be present if supplied in the upload request .. deprecated:: 1.3.0 diff --git a/docs/features/gcode_scripts.rst b/docs/features/gcode_scripts.rst index d07a609f8..6351fef37 100644 --- a/docs/features/gcode_scripts.rst +++ b/docs/features/gcode_scripts.rst @@ -18,13 +18,7 @@ simple "send-as-is" scripts but making use of a full blown templating language i this end, OctoPrint injects some variables into the :ref:`template rendering context ` as described below. -You can find the docs on the Jinja templating engine as used in OctoPrint at `jinja.octoprint.org `_. - -.. note:: - - Due to backwards compatibility issues with Jinja versions 2.9+, OctoPrint currently only supports Jinja 2.8. For this - reason use the template documentation at `jinja.octoprint.org `_ instead of the - documentation of current stable Jinja versions. +You can find the docs on the Jinja templating engine as used in OctoPrint `here `_. .. _sec-features-gcode_scripts-predefined: @@ -250,7 +244,6 @@ to the persisted pause position on resume, making sure to also reset the extrude .. seealso:: - `Jinja Template Designer Documentation `_ + `Jinja Template Designer Documentation `_ Jinja's Template Designer Documentation describes the syntax and semantics of the template language used - also by OctoPrint's GCODE scripts. Linked here are the docs for Jinja 2.8.1, which OctoPrint still - relies on for backwards compatibility reasons. + also by OctoPrint's GCODE scripts. diff --git a/docs/images/bundledplugins-action_command_notification-example.png b/docs/images/bundledplugins-action_command_notification-example.png new file mode 100644 index 000000000..fc571db92 Binary files /dev/null and b/docs/images/bundledplugins-action_command_notification-example.png differ diff --git a/docs/images/bundledplugins-gcodeviewer-example.png b/docs/images/bundledplugins-gcodeviewer-example.png new file mode 100644 index 000000000..28f54fc73 Binary files /dev/null and b/docs/images/bundledplugins-gcodeviewer-example.png differ diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index 791ba4cc3..ebc8859e1 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -472,12 +472,12 @@ octoprint.comm.protocol.firmware.info This includes I/O of any kind. :param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook. - :param str firmware_name: The name of the parsed capability + :param str firmware_name: The parsed name of the firmware :param dict firmware_data: All data contained in the ``M115`` report .. _sec-plugins-hook-comm-protocol-firmware-capabilities: -octoprint.comm.firmware.protocol.capabilities +octoprint.comm.protocol.firmware.capabilities ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. py:function:: firmware_capability_hook(comm_instance, capability, enabled, already_defined, *args, **kwargs) diff --git a/setup.py b/setup.py index c76085ba1..a9239ec7d 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,8 @@ SETUP_REQUIRES = [ # Requirements for our application INSTALL_REQUIRES = [ # additional OctoPrint plugins that are maintained on a different release cycle - "OctoPrint-FirmwareCheck>=2020.03.27", + "OctoPrint-FirmwareCheck>=2020.06.22", + "OctoPrint-FileCheck>=2020.06.22", # the following dependencies are non trivial to update since later versions introduce backwards incompatible # changes that might affect plugins, or due to other observed problems @@ -60,7 +61,7 @@ INSTALL_REQUIRES = [ "wrapt>=1.12.1,<2", "emoji>=0.5.4,<1", "frozendict>=1.2,<2", - "sentry-sdk>=0.14.4,<1", + "sentry-sdk>=0.15.1,<1", "filetype>=1.0.7,<2", # vendor bundle dependencies diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index 4ed99cfca..18322aa29 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -47,6 +47,13 @@ if version_info.major == 2 and version_info.minor <= 7 and version_info.micro < except ImportError: pass +elif version_info.major == 3 and version_info.minor >= 8 and sys.platform == "win32": + # Python 3.8 makes proactor event loop the default on Windows, Tornado doesn't like that + # + # see https://github.com/tornadoweb/tornado/issues/2608 + import asyncio + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + del version_info #~~ custom exceptions diff --git a/src/octoprint/access/permissions.py b/src/octoprint/access/permissions.py index c638aa93f..d342efeda 100644 --- a/src/octoprint/access/permissions.py +++ b/src/octoprint/access/permissions.py @@ -298,12 +298,14 @@ class Permissions(with_metaclass(PermissionsMetaClass)): dangerous=True) FILES_LIST = OctoPrintPermission("File List", - gettext("Allows to retrieve a list of all uploaded files, including" + gettext("Allows to retrieve a list of all uploaded files and folders, including" "their metadata (e.g. date, file size, analysis results, ...)"), RoleNeed("files_list"), default_groups=[USER_GROUP, READONLY_GROUP]) FILES_UPLOAD = OctoPrintPermission("File Upload", - gettext("Allows users to upload new files"), + gettext("Allows users to upload new files, create new folders and copy existing ones. If " + "the File Delete permission is also set, File Upload also allows " + "moving files and folders."), RoleNeed("files_upload"), default_groups=[USER_GROUP]) FILES_DOWNLOAD = OctoPrintPermission("File Download", @@ -312,7 +314,8 @@ class Permissions(with_metaclass(PermissionsMetaClass)): RoleNeed("files_download"), default_groups=[USER_GROUP, READONLY_GROUP]) FILES_DELETE = OctoPrintPermission("File Delete", - gettext("Allows users to delete files"), + gettext("Allows users to delete files and folders. If the File Upload permission is " + "also set, File Delete also allows moving files and folders."), RoleNeed("files_delete"), default_groups=[USER_GROUP]) FILES_SELECT = OctoPrintPermission("File Select", diff --git a/src/octoprint/access/users.py b/src/octoprint/access/users.py index 50656b05f..a0d0f7ba9 100644 --- a/src/octoprint/access/users.py +++ b/src/octoprint/access/users.py @@ -493,7 +493,7 @@ class FilebasedUserManager(UserManager): if "groups" in attributes: groups = set(attributes["groups"]) else: - groups = set(self._group_manager.user_group) + groups = {self._group_manager.user_group} # migrate from roles to permissions if "roles" in attributes and not "permissions" in attributes: diff --git a/src/octoprint/cli/plugins.py b/src/octoprint/cli/plugins.py index e628ae4c6..40c444c17 100644 --- a/src/octoprint/cli/plugins.py +++ b/src/octoprint/cli/plugins.py @@ -8,8 +8,34 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms import click click.disable_unicode_literals_warning = True import logging +import logging.config from octoprint.cli import pass_octoprint_ctx, OctoPrintContext, get_ctx_obj_option +from octoprint.util import dict_merge + +LOGGING_CONFIG = { + "version": 1, + "formatters": { + "brief": { + "format": "%(message)s" + } + }, + "handlers": { + "console": { + "class": "logging.StreamHandler", + "formatter": "brief", + "stream": "ext://sys.stdout" + } + }, + "loggers": { + "octoprint.plugin.core": { + "level": logging.ERROR + } + }, + "root": { + "level": logging.WARNING + } +} #~~ "octoprint plugin:command" commands @@ -48,6 +74,9 @@ class OctoPrintPluginCommands(click.MultiCommand): if ctx.obj is None: ctx.obj = OctoPrintContext() + logging_config = dict_merge(LOGGING_CONFIG, dict(root=dict(level=logging.DEBUG if ctx.obj.verbosity > 0 else logging.WARNING))) + logging.config.dictConfig(logging_config) + # initialize settings and plugin manager based on provided # context (basedir and configfile) from octoprint import init_settings, init_pluginsystem, FatalStartupError @@ -63,8 +92,6 @@ class OctoPrintPluginCommands(click.MultiCommand): # fetch registered hooks self.hooks = self.plugin_manager.get_hooks("octoprint.cli.commands") - logging.basicConfig(level=logging.DEBUG if ctx.obj.verbosity > 0 else logging.WARN) - self._initialized = True def list_commands(self, ctx): diff --git a/src/octoprint/cli/server.py b/src/octoprint/cli/server.py index ab9ea5fe4..5a28741a9 100644 --- a/src/octoprint/cli/server.py +++ b/src/octoprint/cli/server.py @@ -50,12 +50,12 @@ def run_server(basedir, configfile, host, port, v6_only, debug, allow_root, logg from octoprint import urllib3_ssl if not urllib3_ssl: logging.getLogger("octoprint.server")\ - .warn("requests/urllib3 will run in an insecure SSL environment. " - "You might see corresponding warnings logged later " - "(\"InsecurePlatformWarning\"). It is recommended to either " - "update to a Python version >= 2.7.9 or alternatively " - "install PyOpenSSL plus its dependencies. For details see " - "https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl") + .warning("requests/urllib3 will run in an insecure SSL environment. " + "You might see corresponding warnings logged later " + "(\"InsecurePlatformWarning\"). It is recommended to either " + "update to a Python version >= 2.7.9 or alternatively " + "install PyOpenSSL plus its dependencies. For details see " + "https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl") logger.info(get_divider_line("*")) def log_register_rollover(safe_mode=None, plugin_manager=None, environment_detector=None, **kwargs): diff --git a/src/octoprint/filemanager/__init__.py b/src/octoprint/filemanager/__init__.py index 809ee4a44..71d8aa4eb 100644 --- a/src/octoprint/filemanager/__init__.py +++ b/src/octoprint/filemanager/__init__.py @@ -675,6 +675,9 @@ class FileManager(object): self._logger.exception("Could not read recovery data from file {}".format(self._recovery_file)) self.delete_recovery_data() + def get_additional_metadata(self, destination, path, key): + self._storage(destination).get_additional_metadata(path, key) + def set_additional_metadata(self, destination, path, key, data, overwrite=False, merge=False): self._storage(destination).set_additional_metadata(path, key, data, overwrite=overwrite, merge=merge) diff --git a/src/octoprint/filemanager/storage.py b/src/octoprint/filemanager/storage.py index 3dddb9bd8..04a97765b 100644 --- a/src/octoprint/filemanager/storage.py +++ b/src/octoprint/filemanager/storage.py @@ -307,6 +307,15 @@ class StorageInterface(object): """ raise NotImplementedError() + def get_additional_metadata(self, path, key): + """ + Fetches additional metadata at ``key`` from the metadata of ``path``. + + :param path: the virtual path to the file for which to fetch additional metadata + :param key: key of metadata to fetch + """ + raise NotImplementedError() + def set_additional_metadata(self, path, key, data, overwrite=False, merge=False): """ Adds additional metadata to the metadata of ``path``. Metadata in ``data`` will be saved under ``key``. @@ -877,6 +886,15 @@ class LocalFileStorage(StorageInterface): path, name = self.sanitize(path) self._delete_history(name, path, index) + def get_additional_metadata(self, path, key): + path, name = self.sanitize(path) + metadata = self._get_metadata(path) + + if not name in metadata: + return + + return metadata[name].get(key) + def set_additional_metadata(self, path, key, data, overwrite=False, merge=False): path, name = self.sanitize(path) metadata = self._get_metadata(path) diff --git a/src/octoprint/logging/__init__.py b/src/octoprint/logging/__init__.py index 10dae37d7..d884c948f 100644 --- a/src/octoprint/logging/__init__.py +++ b/src/octoprint/logging/__init__.py @@ -20,8 +20,11 @@ def log_to_handler(logger, handler, level, msg, exc_info=None, extra=None, *args extra: optional extra data *args: log args """ - from logging import _srcfile import sys + try: + from logging import _srcfile + except ImportError: + _srcfile = None # this is just the same as logging.Logger._log diff --git a/src/octoprint/plugin/__init__.py b/src/octoprint/plugin/__init__.py index 1f3439374..69ff0c79d 100644 --- a/src/octoprint/plugin/__init__.py +++ b/src/octoprint/plugin/__init__.py @@ -98,7 +98,7 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en plugin_obsolete_hooks = ["octoprint.comm.protocol.gcode"] if plugin_considered_bundled is None: - plugin_considered_bundled = ["firmware_check"] + plugin_considered_bundled = ["firmware_check", "file_check"] if plugin_validators is None: plugin_validators = [_validate_plugin] diff --git a/src/octoprint/plugins/action_command_notification/__init__.py b/src/octoprint/plugins/action_command_notification/__init__.py index c2b3c606c..eb06109a7 100644 --- a/src/octoprint/plugins/action_command_notification/__init__.py +++ b/src/octoprint/plugins/action_command_notification/__init__.py @@ -85,9 +85,10 @@ class ActionCommandNotificationPlugin(octoprint.plugin.AssetPlugin, custom_bindings=False), dict(type="sidebar", name=gettext("Printer Notifications"), - icon="bell-o", styles=["display: none"], - data_bind="visible: loginState.hasPermission(access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW) " - "&& settings.settings.plugins.action_command_notification.enable") + icon="bell-o", + styles_wrapper=["display: none"], + data_bind="visible: loginState.hasPermissionKo(access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW)" + " && settings.settings.plugins.action_command_notification.enable()") ] #~ action command handler @@ -110,9 +111,12 @@ class ActionCommandNotificationPlugin(octoprint.plugin.AssetPlugin, self._notifications.append((time.time(), message)) self._plugin_manager.send_plugin_message(self._identifier, dict(message=message)) + self._logger.info("Got a notification: {}".format(message)) + def _clear_notifications(self): self._notifications = [] self._plugin_manager.send_plugin_message(self._identifier, dict()) + self._logger.info("Notifications cleared") __plugin_name__ = "Action Command Notification Support" __plugin_description__ = "Allows your printer to trigger notifications via action commands on the connection" diff --git a/src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js b/src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js index c319d378c..991557caa 100644 --- a/src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js +++ b/src/octoprint/plugins/action_command_notification/static/js/action_command_notification.js @@ -60,6 +60,6 @@ $(function() { OCTOPRINT_VIEWMODELS.push({ construct: ActionCommandNotificationViewModel, dependencies: ["loginStateViewModel", "accessViewModel", "settingsViewModel"], - elements: ["#sidebar_plugin_action_command_notification"] + elements: ["#sidebar_plugin_action_command_notification_wrapper"] }); }); diff --git a/src/octoprint/plugins/action_command_prompt/__init__.py b/src/octoprint/plugins/action_command_prompt/__init__.py index 817e30df1..680ea9dd1 100644 --- a/src/octoprint/plugins/action_command_prompt/__init__.py +++ b/src/octoprint/plugins/action_command_prompt/__init__.py @@ -50,8 +50,8 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin, self._prompt = None self._enable = "detected" self._command = None - self._enable_emergency_sending = False - self._enable_signal_support = False + self._enable_emergency_sending = True + self._enable_signal_support = True self._cap_prompt_support = False def initialize(self): @@ -223,7 +223,7 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin, if "{choice}" in self._command: self._printer.commands([self._command.format(choice=choice)]) else: - self._printer.commands(["{command} S{choice}".format(command=self._command, + self._printer.commands(["{command} S{choice}".format(command=self._command, choice=choice)]) diff --git a/src/octoprint/plugins/backup/__init__.py b/src/octoprint/plugins/backup/__init__.py index cb30f048c..c0bd77866 100644 --- a/src/octoprint/plugins/backup/__init__.py +++ b/src/octoprint/plugins/backup/__init__.py @@ -252,14 +252,14 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin, compatible = octoprint_compatible and os_compatible if not compatible: if not octoprint_compatible and not os_compatible: - self._logger.warn("Cannot install plugin {}, it is incompatible to this version " - "of OctoPrint and the underlying operating system".format(plugin["id"])) + self._logger.warning("Cannot install plugin {}, it is incompatible to this version " + "of OctoPrint and the underlying operating system".format(plugin["id"])) elif not octoprint_compatible: - self._logger.warn("Cannot install plugin {}, it is incompatible to this version " - "of OctoPrint".format(plugin["id"])) + self._logger.warning("Cannot install plugin {}, it is incompatible to this version " + "of OctoPrint".format(plugin["id"])) elif not os_compatible: - self._logger.warn("Cannot install plugin {}, it is incompatible to the underlying " - "operating system".format(plugin["id"])) + self._logger.warning("Cannot install plugin {}, it is incompatible to the underlying " + "operating system".format(plugin["id"])) self._send_client_message("plugin_incompatible", dict(plugin=plugin["id"], octoprint_compatible=octoprint_compatible, os_compatible=os_compatible)) @@ -366,15 +366,21 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin, @click.option("--exclude", multiple=True, help="Identifiers of data folders to exclude, e.g. 'uploads' to exclude uploads or " "'timelapse' to exclude timelapses.") - def backup_command(exclude): + @click.option("--path", type=click.Path(), default=None, + help="Specify full path to backup file to be created") + def backup_command(exclude, path): """ Creates a new backup. """ - backup_file = build_backup_filename() settings = octoprint.plugin.plugin_settings_for_settings_plugin("backup", self, settings=cli_group.settings) - datafolder = os.path.join(settings.getBaseFolder("data"), "backup") + if path is not None: + datafolder, backup_file = os.path.split(os.path.abspath(path)) + else: + backup_file = build_backup_filename() + datafolder = os.path.join(settings.getBaseFolder("data"), "backup") + if not os.path.isdir(datafolder): os.makedirs(datafolder) @@ -385,6 +391,7 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin, plugin_manager=cli_group.plugin_manager, datafolder=datafolder) click.echo("Done.") + click.echo("Backup located at {}".format(os.path.join(datafolder, backup_file))) @click.command("restore") @click.argument("path") diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index 7eb80825f..d205c3a78 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -13,8 +13,8 @@ from octoprint.util.version import get_octoprint_version_string, is_released_oct from flask import jsonify from flask_babel import gettext -SENTRY_URL_SERVER = "https://2e668ba966024cfc962ba97eef89dc15@sentry.io/1373987" -SENTRY_URL_COREUI = "https://dccc2e2f3c6b4adda72f376bbb7fe561@sentry.io/1374096" +SENTRY_URL_SERVER = "https://a928e3eb40864ed086f765d6976bf792@o118517.ingest.sentry.io/1373987" +SENTRY_URL_COREUI = "https://26fe846c0ff34995a39bbb67a04b3f42@o118517.ingest.sentry.io/1374096" SETTINGS_DEFAULTS = dict(enabled=False, enabled_unreleased=False, @@ -31,6 +31,9 @@ IGNORED_EXCEPTIONS = [ # serial exceptions in octoprint.util.comm (serial.SerialException, lambda exc, logger, plugin, cb: logger == "octoprint.util.comm"), + # KeyboardInterrupts + KeyboardInterrupt, + # IOErrors of any kind due to a full file system (IOError, lambda exc, logger, plugin, cb: getattr(exc, "errno") and exc.errno in (getattr(errno, "ENOSPC"),)), diff --git a/src/octoprint/plugins/errortracking/static/js/sentry.min.js b/src/octoprint/plugins/errortracking/static/js/sentry.min.js index 83bb176de..bc3fd88aa 100644 --- a/src/octoprint/plugins/errortracking/static/js/sentry.min.js +++ b/src/octoprint/plugins/errortracking/static/js/sentry.min.js @@ -1,2 +1,2 @@ -/*! @sentry/browser 5.0.5 (913eafc4) | https://github.com/getsentry/sentry-javascript */ -var Sentry=function(n){"use strict";var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])})(n,r)};function r(n,r){function i(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i,e,o,u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r0&&e[e.length-1])&&(6===o[0]||2===o[0])){u=0;continue}if(3===o[0]&&(!e||o[1]>e[0]&&o[1]0)&&!(i=o.next()).done;)u.push(i.value)}catch(n){e={error:n}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return u}function a(){for(var n=[],t=0;t=200&&t<300?n.Success:429===t?n.RateLimit:t>=400&&t<500?n.Invalid:t>=500?n.Failed:n.Unknown}}(n.Status||(n.Status={}));var b={};function w(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:b}function g(){var n=w(),t=n.crypto||n.msCrypto;if(void 0!==t&&t.getRandomValues){var r=new Uint16Array(8);t.getRandomValues(r),r[3]=4095&r[3]|16384,r[4]=16383&r[4]|32768;var i=function(n){for(var t=n.toString(16);t.length<4;)t="0"+t;return t};return i(r[0])+i(r[1])+i(r[2])+i(r[3])+i(r[4])+i(r[5])+i(r[6])+i(r[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=16*Math.random()|0;return("x"===n?t:3&t|8).toString(16)})}function E(n){var t,r,i,e,o,u=[];if(!n||!n.tagName)return"";if(u.push(n.tagName.toLowerCase()),n.id&&u.push("#"+n.id),(t=n.className)&&d(t))for(r=t.split(/\s+/),o=0;o"}return n.event_id||""}function S(n){var t=w();if(!("console"in t))return n();var r=t.console,i={};["debug","info","warn","error","log"].forEach(function(n){n in t.console&&r[n].__sentry__&&(i[n]=r[n].__sentry_wrapped__,r[n]=r[n].__sentry_original__)});var e=n();return Object.keys(i).forEach(function(n){r[n]=i[n]}),e}function _(n,t,r,i){void 0===i&&(i={handled:!0,type:"generic"}),n.exception=n.exception||{},n.exception.values=n.exception.values||[],n.exception.values[0]=n.exception.values[0]||{},n.exception.values[0].value=n.exception.values[0].value||t||"",n.exception.values[0].type=n.exception.values[0].type||r||"Error",n.exception.values[0].mechanism=n.exception.values[0].mechanism||i}var O,k=function(){function n(){this.t="function"==typeof WeakSet,this.i=this.t?new WeakSet:[]}return n.prototype.memoize=function(n){if(this.t)return!!this.i.has(n)||(this.i.add(n),!1);for(var t=0;tr?D(n,t-1,r):i}function I(n,t){return"domain"===t&&"object"==typeof n&&n.o?"[Domain]":"domainEmitter"===t?"[DomainEmitter]":"undefined"!=typeof global&&n===global?"[Global]":"undefined"!=typeof window&&n===window?"[Window]":"undefined"!=typeof document&&n===document?"[Document]":"undefined"!=typeof Event&&n instanceof Event?Object.getPrototypeOf(n)?n.constructor.name:"Event":m(r=n)&&"nativeEvent"in r&&"preventDefault"in r&&"stopPropagation"in r?"[SyntheticEvent]":Number.isNaN(n)?"[NaN]":void 0===n?"[undefined]":"function"==typeof n?"[Function: "+(n.name||"")+"]":n;var r}function A(n,t,r,i){if(void 0===r&&(r=1/0),void 0===i&&(i=new k),0===r)return function(n){var t=Object.prototype.toString.call(n);if("string"==typeof n)return n;if("[object Object]"===t)return"[Object]";if("[object Array]"===t)return"[Array]";var r=I(n);return p(r)?r:t}(t);if(null!=t&&"function"==typeof t.toJSON)return t.toJSON();var e=I(t,n);if(p(e))return e;var o=h(t)?function(n){var t={message:n.message,name:n.name,stack:n.stack};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}(t):t,u=Array.isArray(t)?[]:{};if(i.memoize(t))return"[Circular ~]";for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(u[c]=A(c,o[c],r-1,i));return i.unmemoize(t),u}function C(n,t){try{return JSON.parse(JSON.stringify(n,function(n,r){return A(n,r,t)}))}catch(n){return"**non-serializable**"}}!function(n){n.PENDING="PENDING",n.RESOLVED="RESOLVED",n.REJECTED="REJECTED"}(O||(O={}));var M=function(){function n(n){var t=this;this.u=O.PENDING,this.s=[],this.h=function(n){t.v(n,O.RESOLVED)},this.l=function(n){t.v(n,O.REJECTED)},this.v=function(n,r){t.u===O.PENDING&&(y(n)?n.then(t.h,t.l):(t.p=n,t.u=r,t.m()))},this.m=function(){t.u!==O.PENDING&&(t.u===O.REJECTED?t.s.forEach(function(n){return n.onFail&&n.onFail(t.p)}):t.s.forEach(function(n){return n.onSuccess&&n.onSuccess(t.p)}),t.s=[])},this.g=function(n){t.s=t.s.concat(n),t.m()};try{n(this.h,this.l)}catch(n){this.l(n)}}return n.prototype.then=function(t,r){var i=this;return new n(function(n,e){i.g({onFail:function(t){if(r)try{return void n(r(t))}catch(n){return void e(n)}else e(t)},onSuccess:function(r){if(t)try{return void n(t(r))}catch(n){return void e(n)}else n(r)}})})},n.prototype.catch=function(n){return this.then(function(n){return n},n)},n.prototype.toString=function(){return"[object SyncPromise]"},n.resolve=function(t){return new n(function(n){n(t)})},n.reject=function(t){return new n(function(n,r){r(t)})},n}(),N=function(){function n(){this.j=!1,this.S=[],this._=[],this.O=[],this.k={},this.T={},this.R={}}return n.prototype.addScopeListener=function(n){this.S.push(n)},n.prototype.addEventProcessor=function(n){return this._.push(n),this},n.prototype.D=function(){var n=this;this.j||(this.j=!0,setTimeout(function(){n.S.forEach(function(t){t(n)}),n.j=!1}))},n.prototype.I=function(n,t,r,i){var e=this;return void 0===i&&(i=0),new M(function(o,c){var s=n[i];if(null===t||"function"!=typeof s)o(t);else{var f=s(u({},t),r);y(f)?f.then(function(t){return e.I(n,t,r,i+1).then(o)}).catch(c):e.I(n,f,r,i+1).then(o).catch(c)}})},n.prototype.setUser=function(n){return this.k=C(n),this.D(),this},n.prototype.setTags=function(n){return this.T=u({},this.T,C(n)),this.D(),this},n.prototype.setTag=function(n,t){var r;return this.T=u({},this.T,((r={})[n]=C(t),r)),this.D(),this},n.prototype.setExtras=function(n){return this.R=u({},this.R,C(n)),this.D(),this},n.prototype.setExtra=function(n,t){var r;return this.R=u({},this.R,((r={})[n]=C(t),r)),this.D(),this},n.prototype.setFingerprint=function(n){return this.A=C(n),this.D(),this},n.prototype.setLevel=function(n){return this.C=C(n),this.D(),this},n.clone=function(t){var r=new n;return Object.assign(r,t,{S:[]}),t&&(r.O=a(t.O),r.T=u({},t.T),r.R=u({},t.R),r.k=t.k,r.C=t.C,r.A=t.A,r._=a(t._)),r},n.prototype.clear=function(){return this.O=[],this.T={},this.R={},this.k={},this.C=void 0,this.A=void 0,this.D(),this},n.prototype.addBreadcrumb=function(n,t){return this.O=void 0!==t&&t>=0?a(this.O,[C(n)]).slice(-t):a(this.O,[C(n)]),this.D(),this},n.prototype.clearBreadcrumbs=function(){return this.O=[],this.D(),this},n.prototype.M=function(n){n.fingerprint=n.fingerprint?Array.isArray(n.fingerprint)?n.fingerprint:[n.fingerprint]:[],this.A&&(n.fingerprint=n.fingerprint.concat(this.A)),n.fingerprint&&!n.fingerprint.length&&delete n.fingerprint},n.prototype.applyToEvent=function(n,t){return this.R&&Object.keys(this.R).length&&(n.extra=u({},this.R,n.extra)),this.T&&Object.keys(this.T).length&&(n.tags=u({},this.T,n.tags)),this.k&&Object.keys(this.k).length&&(n.user=u({},this.k,n.user)),this.C&&(n.level=this.C),this.M(n),(!n.breadcrumbs||0===n.breadcrumbs.length)&&this.O.length>0&&(n.breadcrumbs=this.O),this.I(a(F(),this._),n,t)},n}();function F(){var n=w();return n.__SENTRY__=n.__SENTRY__||{},n.__SENTRY__.globalEventProcessors=n.__SENTRY__.globalEventProcessors||[],n.__SENTRY__.globalEventProcessors}function U(n){F().push(n)}var L=w(),P="Sentry Logger ",$=function(){function n(){this.N=!1}return n.prototype.disable=function(){this.N=!1},n.prototype.enable=function(){this.N=!0},n.prototype.log=function(){for(var n=[],t=0;t0?n[n.length-1].scope:void 0,r=N.clone(t);return this.getStack().push({client:this.getClient(),scope:r}),r},n.prototype.popScope=function(){return void 0!==this.getStack().pop()},n.prototype.withScope=function(n){var t=this.pushScope();try{n(t)}finally{this.popScope()}},n.prototype.getClient=function(){return this.getStackTop().client},n.prototype.getScope=function(){return this.getStackTop().scope},n.prototype.getStack=function(){return this.U},n.prototype.getStackTop=function(){return this.U[this.U.length-1]},n.prototype.captureException=function(n,t){var r=this.P=g();return this.L("captureException",n,u({},t,{event_id:r})),r},n.prototype.captureMessage=function(n,t,r){var i=this.P=g();return this.L("captureMessage",n,t,u({},r,{event_id:i})),i},n.prototype.captureEvent=function(n,t){var r=this.P=g();return this.L("captureEvent",n,u({},t,{event_id:r})),r},n.prototype.lastEventId=function(){return this.P},n.prototype.addBreadcrumb=function(n,t){var r=this.getStackTop();if(r.scope&&r.client){var i=r.client.getOptions(),e=i.beforeBreadcrumb,o=i.maxBreadcrumbs,c=void 0===o?30:o;if(!(c<=0)){var s=(new Date).getTime()/1e3,f=u({timestamp:s},n),a=e?S(function(){return e(f,t)}):f;null!==a&&r.scope.addBreadcrumb(a,Math.min(c,100))}}},n.prototype.configureScope=function(n){var t=this.getStackTop();t.scope&&t.client&&n(t.scope)},n.prototype.run=function(n){var t=G(this);try{n(this)}finally{G(t)}},n.prototype.getIntegration=function(n){var t=this.getClient();if(!t)return null;try{return t.getIntegration(n)}catch(t){return q.warn("Cannot retrieve integration "+n.id+" from the current Hub"),null}},n}();function B(){var n=w();return n.__SENTRY__=n.__SENTRY__||{hub:void 0},n}function G(n){var t=B(),r=z(t);return V(t,n),r}function J(){var n,t,r=B();X(r)&&!z(r).isOlderThan(H)||V(r,new W);try{var i=(n=module,t="domain",n.require(t)).active;if(!i)return z(r);if(!X(i)||z(i).isOlderThan(H)){var e=z(r).getStackTop();V(i,new W(e.client,N.clone(e.scope)))}return z(i)}catch(n){return z(r)}}function X(n){return!!(n&&n.__SENTRY__&&n.__SENTRY__.hub)}function z(n){return n&&n.__SENTRY__&&n.__SENTRY__.hub?n.__SENTRY__.hub:(n.__SENTRY__=n.__SENTRY__||{},n.__SENTRY__.hub=new W,n.__SENTRY__.hub)}function V(n,t){return!!n&&(n.__SENTRY__=n.__SENTRY__||{},n.__SENTRY__.hub=t,!0)}function K(n){for(var t=[],r=1;r1&&(h=l.slice(0,-1).join("/"),v=l.pop()),Object.assign(this,{host:c,pass:u,path:h,projectId:v,port:a,protocol:i,user:e})},n.prototype.q=function(n){this.protocol=n.protocol,this.user=n.user,this.pass=n.pass||"",this.host=n.host,this.port=n.port||"",this.path=n.path||"",this.projectId=n.projectId},n.prototype.H=function(){var n=this;if(["protocol","user","host","projectId"].forEach(function(t){if(!n[t])throw new Q("Invalid Dsn")}),"http"!==this.protocol&&"https"!==this.protocol)throw new Q("Invalid Dsn");if(this.port&&Number.isNaN(parseInt(this.port,10)))throw new Q("Invalid Dsn")},n}(),tn=function(){function n(n){this.dsn=n,this.W=new nn(n)}return n.prototype.getDsn=function(){return this.W},n.prototype.getStoreEndpoint=function(){return""+this.B()+this.getStoreEndpointPath()},n.prototype.getStoreEndpointWithUrlEncodedAuth=function(){var n,t={sentry_key:this.W.user,sentry_version:"7"};return this.getStoreEndpoint()+"?"+(n=t,Object.keys(n).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(n[t])}).join("&"))},n.prototype.B=function(){var n=this.W,t=n.protocol?n.protocol+":":"",r=n.port?":"+n.port:"";return t+"//"+n.host+r},n.prototype.getStoreEndpointPath=function(){var n=this.W;return(n.path?"/"+n.path:"")+"/api/"+n.projectId+"/store/"},n.prototype.getRequestHeaders=function(n,t){var r=this.W,i=["Sentry sentry_version=7"];return i.push("sentry_timestamp="+(new Date).getTime()),i.push("sentry_client="+n+"/"+t),i.push("sentry_key="+r.user),r.pass&&i.push("sentry_secret="+r.pass),{"Content-Type":"application/json","X-Sentry-Auth":i.join(", ")}},n.prototype.getReportDialogEndpoint=function(n){void 0===n&&(n={});var t=this.W,r=this.B()+(t.path?"/"+t.path:"")+"/api/embed/error-page/",i=[];for(var e in i.push("dsn="+t.toString()),n)if("user"===e){if(!n.user)continue;n.user.name&&i.push("name="+encodeURIComponent(n.user.name)),n.user.email&&i.push("email="+encodeURIComponent(n.user.email))}else i.push(encodeURIComponent(e)+"="+encodeURIComponent(n[e]));return i.length?r+"?"+i.join("&"):r},n}();function rn(n,t){return void 0===t&&(t=0),0===t?n:n.length<=t?n:n.substr(0,t)+"..."}function en(n,t){if(!Array.isArray(n))return"";for(var r=[],i=0;i=t)return rn(n[0],t);for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length?i:rn(i,t)}return""}var un=[];function cn(n){var t={};return function(n){var t=n.defaultIntegrations&&a(n.defaultIntegrations)||[],r=n.integrations,i=[];if(Array.isArray(r)){var e=r.map(function(n){return n.name}),o=[];t.forEach(function(n){-1===e.indexOf(n.name)&&-1===o.indexOf(n.name)&&(i.push(n),o.push(n.name))}),r.forEach(function(n){-1===o.indexOf(n.name)&&(i.push(n),o.push(n.name))})}else{if("function"!=typeof r)return a(t);i=r(t),i=Array.isArray(i)?i:[i]}return i}(n).forEach(function(n){t[n.name]=n,function(n){-1===un.indexOf(n.name)&&(n.setupOnce(U,J),un.push(n.name),q.log("Integration installed: "+n.name))}(n)}),t}var sn,fn=function(){function n(n,t){this.G=!1,this.J=new n(t),this.X=t,t.dsn&&(this.V=new nn(t.dsn)),this.K=cn(this.X)}return n.prototype.captureException=function(n,t,r){var i=this,e=t&&t.event_id;return this.G=!0,this.Z().eventFromException(n,t).then(function(n){return i.Y(n,t,r)}).then(function(n){e=n&&n.event_id,i.G=!1}).catch(function(n){q.log(n),i.G=!1}),e},n.prototype.captureMessage=function(n,t,r,i){var e=this,o=r&&r.event_id;return this.G=!0,(p(n)?this.Z().eventFromMessage(""+n,t,r):this.Z().eventFromException(n,r)).then(function(n){return e.Y(n,r,i)}).then(function(n){o=n&&n.event_id,e.G=!1}).catch(function(n){q.log(n),e.G=!1}),o},n.prototype.captureEvent=function(n,t,r){var i=this,e=t&&t.event_id;return this.G=!0,this.Y(n,t,r).then(function(n){e=n&&n.event_id,i.G=!1}).catch(function(n){q.log(n),i.G=!1}),e},n.prototype.getDsn=function(){return this.V},n.prototype.getOptions=function(){return this.X},n.prototype.flush=function(n){return c(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.Z().getTransport().close(n),this.nn()])];case 1:return[2,t.sent().reduce(function(n,t){return n&&t})]}})})},n.prototype.close=function(n){return c(this,void 0,void 0,function(){var t=this;return s(this,function(r){return[2,this.flush(n).finally(function(){t.getOptions().enabled=!1})]})})},n.prototype.getIntegrations=function(){return this.K||{}},n.prototype.getIntegration=function(n){try{return this.K[n.id]||null}catch(t){return q.warn("Cannot retrieve integration "+n.id+" from the current Client"),null}},n.prototype.nn=function(n){return void 0===n&&(n=0),c(this,void 0,void 0,function(){var t=this;return s(this,function(r){return[2,new Promise(function(r){t.G?n>=10?r(!1):setTimeout(function(){return c(t,void 0,void 0,function(){var t;return s(this,function(i){switch(i.label){case 0:return t=r,[4,this.nn(n+1)];case 1:return t.apply(void 0,[i.sent()]),[2]}})})},10):r(!0)})]})})},n.prototype.Z=function(){return this.J},n.prototype.tn=function(){return!1!==this.getOptions().enabled&&void 0!==this.V},n.prototype.rn=function(n,t,r){var i=this.getOptions(),e=i.environment,o=i.release,c=i.dist,s=i.maxValueLength,f=void 0===s?250:s,a=u({},n);void 0===a.environment&&void 0!==e&&(a.environment=e),void 0===a.release&&void 0!==o&&(a.release=o),void 0===a.dist&&void 0!==c&&(a.dist=c),a.message&&(a.message=rn(a.message,f));var h=a.exception&&a.exception.values&&a.exception.values[0];h&&h.value&&(h.value=rn(h.value,f));var v=a.request;v&&v.url&&(v.url=rn(v.url,f)),void 0===a.event_id&&(a.event_id=g()),this.in(a.sdk);var l=M.resolve(a);return t&&(l=t.applyToEvent(a,r)),l},n.prototype.in=function(n){var t=Object.keys(this.K);n&&t.length>0&&(n.integrations=t)},n.prototype.Y=function(n,t,r){var i=this,e=this.getOptions(),o=e.beforeSend,u=e.sampleRate;return this.tn()?"number"==typeof u&&Math.random()>u?M.reject("This event has been sampled, will not send event."):new M(function(e,u){i.rn(n,r,t).then(function(n){if(null!==n){var r=n;try{if(t&&t.data&&!0===t.data.__sentry__||!o)return i.Z().sendEvent(r),void e(r);var c=o(n,t);if(void 0===c)q.error("`beforeSend` method has to return `null` or a valid event.");else if(y(c))i.en(c,e,u);else{if(null===(r=c))return q.log("`beforeSend` returned `null`, will not send event."),void e(null);i.Z().sendEvent(r),e(r)}}catch(n){i.captureException(n,{data:{__sentry__:!0},originalException:n}),u("`beforeSend` throw an error, will not send event.")}}else u("An event processor returned null, will not send event.")})}):M.reject("SDK not enabled, will not send event.")},n.prototype.en=function(n,t,r){var i=this;n.then(function(n){null!==n?(i.Z().sendEvent(n),t(n)):r("`beforeSend` returned `null`, will not send event.")}).catch(function(n){r("beforeSend rejected with "+n)})},n}(),an=function(){function t(){}return t.prototype.sendEvent=function(t){return c(this,void 0,void 0,function(){return s(this,function(t){return[2,Promise.resolve({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:n.Status.Skipped})]})})},t.prototype.close=function(n){return c(this,void 0,void 0,function(){return s(this,function(n){return[2,Promise.resolve(!0)]})})},t}(),hn=function(){function n(n){this.X=n,this.X.dsn||q.warn("No DSN provided, backend will not do anything."),this.on=this.un()}return n.prototype.un=function(){return new an},n.prototype.eventFromException=function(n,t){throw new Q("Backend has to implement `eventFromException` method")},n.prototype.eventFromMessage=function(n,t,r){throw new Q("Backend has to implement `eventFromMessage` method")},n.prototype.sendEvent=function(n){this.on.sendEvent(n).catch(function(n){q.error("Error while sending event: "+n)})},n.prototype.getTransport=function(){return this.on},n}();var vn=function(){function n(){this.name=n.id}return n.prototype.setupOnce=function(){sn=Function.prototype.toString,Function.prototype.toString=function(){for(var n=[],t=0;t|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,o=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,c=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,s=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=n.stack.split("\n"),a=[],h=/^(.*) is undefined$/.exec(n.message),v=0,l=f.length;v eval")>-1&&(t=c.exec(r[3]))?r[3]=t[1]:0!==v||r[5]||void 0===n.columnNumber||(a[0].column=n.columnNumber+1),i={url:r[3],func:r[1]||gn,args:r[2]?r[2].split(","):[],line:r[4]?+r[4]:null,column:r[5]?+r[5]:null}}!i.func&&i.line&&(i.func=gn),i.context=null,a.push(i)}return a.length?(a[0]&&a[0].line&&!a[0].column&&h&&(a[0].column=null),{mode:"stack",name:n.name,message:n.message,stack:a}):null}function t(n,t,r,i){var e={url:t,line:r};if(e.url&&e.line){if(n.incomplete=!1,e.func||(e.func=gn),e.context||(e.context=null),/ '([^']+)' /.exec(i)&&(e.column=null),n.stack.length>0&&n.stack[0].url===e.url){if(n.stack[0].line===e.line)return!1;if(!n.stack[0].line&&n.stack[0].func===e.func)return n.stack[0].line=e.line,n.stack[0].context=e.context,!1}return n.stack.unshift(e),n.partial=!0,!0}return n.incomplete=!0,!1}function r(n,e){for(var o,u,c=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,s=[],f={},a=!1,h=r.caller;h&&!a;h=h.caller)if(h!==i&&h!==wn.report){if(u={url:null,func:gn,args:[],line:null,column:null},h.name?u.func=h.name:(o=c.exec(h.toString()))&&(u.func=o[1]),void 0===u.func)try{u.func=o.input.substring(0,o.input.indexOf("{"))}catch(n){}f[""+h]?a=!0:f[""+h]=!0,s.push(u)}e&&s.splice(0,e);var v={mode:"callers",name:n.name,message:n.message,stack:s};return t(v,n.sourceURL||n.fileName,n.line||n.lineNumber,n.message||n.description),v}function i(t,i){var e=null;i=null==i?0:+i;try{if(e=function(n){var t=n.stacktrace;if(t){for(var r,i=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,e=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,o=t.split("\n"),u=[],c=0;c0&&r(!1)},n);Promise.all(t.yn).then(function(){clearTimeout(i),r(!0)}).catch(function(){r(!0)})})]})})},n}(),Nn=function(){function n(n){this.options=n,this.yn=new Mn(30),this.url=new tn(this.options.dsn).getStoreEndpointWithUrlEncodedAuth()}return n.prototype.sendEvent=function(n){return c(this,void 0,void 0,function(){return s(this,function(n){throw new Q("Transport Class has to implement `sendEvent` method")})})},n.prototype.close=function(n){return c(this,void 0,void 0,function(){return s(this,function(t){return[2,this.yn.drain(n)]})})},n}(),Fn=w(),Un=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),i.prototype.sendEvent=function(t){return c(this,void 0,void 0,function(){var r;return s(this,function(i){return r={body:JSON.stringify(t),method:"POST",referrerPolicy:yn()?"origin":""},[2,this.yn.add(Fn.fetch(this.url,r).then(function(t){return{status:n.Status.fromHttpCode(t.status)}}))]})})},i}(Nn),Ln=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),i.prototype.sendEvent=function(t){return c(this,void 0,void 0,function(){var r=this;return s(this,function(i){return[2,this.yn.add(new Promise(function(i,e){var o=new XMLHttpRequest;o.onreadystatechange=function(){4===o.readyState&&(200===o.status&&i({status:n.Status.fromHttpCode(o.status)}),e(o))},o.open("POST",r.url),o.send(JSON.stringify(t))}))]})})},i}(Nn),Pn=Object.freeze({BaseTransport:Nn,FetchTransport:Un,XHRTransport:Ln}),$n=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),i.prototype.un=function(){if(!this.X.dsn)return t.prototype.un.call(this);var n=this.X.transportOptions?this.X.transportOptions:{dsn:this.X.dsn};return this.X.transport?new this.X.transport(n):mn()?new Un(n):new Ln(n)},i.prototype.eventFromException=function(t,r){var i,e,o=this;if(v(t)&&t.error)return t=t.error,i=Dn(kn(t)),M.resolve(this.bn(i,r));if(l(t)||(e=t,"[object DOMException]"===Object.prototype.toString.call(e))){var u=t,c=u.name||(l(u)?"DOMError":"DOMException"),s=u.message?c+": "+u.message:c;return this.eventFromMessage(s,n.Severity.Error,r).then(function(n){return _(n,s),M.resolve(o.bn(n,r))})}if(h(t))return i=Dn(kn(t)),M.resolve(this.bn(i,r));if(m(t)&&r&&r.syntheticException)return _(i=function(n,t){var r=Object.keys(n).sort(),i={extra:{__serialized__:D(n)},message:"Non-Error exception captured with keys: "+on(r)};if(t){var e=In(kn(t).stack);i.stacktrace={frames:e}}return i}(t,r.syntheticException),"Custom Object",void 0,{handled:!0,synthetic:!0,type:"generic"}),i.level=n.Severity.Error,M.resolve(this.bn(i,r));var f=t;return this.eventFromMessage(f,void 0,r).then(function(t){return _(t,""+f,void 0,{handled:!0,synthetic:!0,type:"generic"}),t.level=n.Severity.Error,M.resolve(o.bn(t,r))})},i.prototype.bn=function(n,t){return u({},n,{event_id:t&&t.event_id})},i.prototype.eventFromMessage=function(t,r,i){void 0===r&&(r=n.Severity.Info);var e={event_id:i&&i.event_id,level:r,message:t};if(this.X.attachStacktrace&&i&&i.syntheticException){var o=In(kn(i.syntheticException).stack);e.stacktrace={frames:o}}return M.resolve(e)},i}(hn),qn="sentry.javascript.browser",Hn=function(n){function t(t){return void 0===t&&(t={}),n.call(this,$n,t)||this}return r(t,n),t.prototype.rn=function(t,r,i){return t.platform=t.platform||"javascript",t.sdk=u({},t.sdk,{name:qn,packages:a(t.sdk&&t.sdk.packages||[],[{name:"npm:@sentry/browser",version:"5.0.5"}]),version:"5.0.5"}),n.prototype.rn.call(this,t,r,i)},t.prototype.showReportDialog=function(n){void 0===n&&(n={});var t=w().document;if(t)if(this.tn()){var r=n.dsn||this.getDsn();if(n.eventId)if(r){var i=t.createElement("script");i.async=!0,i.src=new tn(r).getReportDialogEndpoint(n),(t.head||t.body).appendChild(i)}else q.error("Missing `Dsn` option in showReportDialog call");else q.error("Missing `eventId` option in showReportDialog call")}else q.error("Trying to call showReportDialog with Sentry Client is disabled")},t}(fn),Wn=1e3,Bn=0;function Gn(n,t,r){if(void 0===t&&(t={}),"function"!=typeof n)return n;try{if(n.__sentry__)return n;if(n.__sentry_wrapped__)return n.__sentry_wrapped__}catch(t){return n}var sentryWrapped=function(){r&&"function"==typeof r&&r.apply(this,arguments);var i=Array.prototype.slice.call(arguments);try{var e=i.map(function(n){return Gn(n,t)});return n.handleEvent?n.handleEvent.apply(this,e):n.apply(this,e)}catch(n){throw Bn+=1,setTimeout(function(){Bn-=1}),Z(function(r){r.addEventProcessor(function(n){var r=u({},n);return t.mechanism&&_(r,void 0,void 0,t.mechanism),r.extra=u({},r.extra,{arguments:C(i,3)}),r}),captureException(n)}),n}};try{for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(sentryWrapped[i]=n[i])}catch(n){}n.prototype=n.prototype||{},sentryWrapped.prototype=n.prototype,Object.defineProperty(n,"__sentry_wrapped__",{enumerable:!1,value:sentryWrapped}),Object.defineProperties(sentryWrapped,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:n}});try{Object.defineProperty(sentryWrapped,"name",{get:function(){return n.name}})}catch(n){}return sentryWrapped}function Jn(n){return function(t){if(An=void 0,Cn!==t){var r;Cn=t;try{r=function(n){for(var t,r=n,i=[],e=0,o=0,u=" > ".length;r&&e++<5&&!("html"===(t=E(r))||e>1&&o+i.length*u+t.length>=80);)i.push(t),o+=t.length,r=r.parentNode;return i.reverse().join(" > ")}(t.target)}catch(n){r=""}J().addBreadcrumb({category:"ui."+n,message:r},{event:t,name:n})}}}function Xn(){return function(n){var t;try{t=n.target}catch(n){return}var r=t&&t.tagName;r&&("INPUT"===r||"TEXTAREA"===r||t.isContentEditable)&&(An||Jn("input")(n),clearTimeout(An),An=setTimeout(function(){An=void 0},Wn))}}var zn=function(){function n(t){this.name=n.id,this.X=u({onerror:!0,onunhandledrejection:!0},t)}return n.prototype.setupOnce=function(){Error.stackTraceLimit=50,Sn(function(t,r,i){if(!(Bn>0)){var e=J().getIntegration(n);e&&J().captureEvent(e.wn(t),{data:{stack:t},originalException:i})}}),this.X.onerror&&(q.log("Global Handler attached: onerror"),_n()),this.X.onunhandledrejection&&(q.log("Global Handler attached: onunhandledrejection"),On())},n.prototype.wn=function(n){var t=Dn(n),r={mode:n.mode};n.message&&(r.message=n.message),n.name&&(r.name=n.name);var i=J().getClient(),e=i&&i.getOptions().maxValueLength||250;return _(t,n.original?rn(JSON.stringify(C(n.original)),e):"","onunhandledrejection"===n.mechanism?"UnhandledRejection":"Error",{data:r,handled:!1,type:n.mechanism}),t},n.id="GlobalHandlers",n}(),Vn=function(){function n(){this.gn=0,this.name=n.id}return n.prototype.En=function(n){return function(){for(var t=[],r=0;r"}catch(n){return""}}var Zn,Qn=w(),Yn=function(){function t(n){this.name=t.id,this.X=u({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},n)}return t.prototype.Sn=function(){"console"in Qn&&["debug","info","warn","error","log"].forEach(function(r){r in Qn.console&&T(Qn.console,r,function(i){return function(){for(var e=[],o=0;o2?t[2]:void 0;return i&&u(Zn,String(i)),n.apply(this,t)}}},t.prototype.Tn=function(){if("XMLHttpRequest"in Qn){var n=XMLHttpRequest.prototype;T(n,"open",function(n){return function(){for(var t=[],r=0;r"},handled:!0,type:"instrument"}})})}(n,e)}),"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?T(e,"onreadystatechange",function(n){return Gn(n,{mechanism:{data:{function:"onreadystatechange",handler:n&&n.name||""},handled:!0,type:"instrument"}},o)}):e.onreadystatechange=o,n.apply(this,r)}})}},t.addBreadcrumb=function(n,r){J().getIntegration(t)&&J().addBreadcrumb(n,r)},t.prototype.setupOnce=function(){this.X.console&&this.Sn(),this.X.dom&&this._n(),this.X.xhr&&this.Tn(),this.X.fetch&&this.On(),this.X.history&&this.kn()},t.id="Breadcrumbs",t}();function nt(t){try{var r=JSON.parse(t);Yn.addBreadcrumb({category:"sentry",event_id:r.event_id,level:r.level||n.Severity.fromString("error"),message:j(r)},{event:r})}catch(n){q.error("Error while adding sentry type breadcrumb")}}var tt="cause",rt=5,it=function(){function n(t){void 0===t&&(t={}),this.name=n.id,this.Rn=t.key||tt,this.mn=t.limit||rt}return n.prototype.setupOnce=function(){U(function(t,r){var i=J().getIntegration(n);return i?i.handler(t,r):t})},n.prototype.handler=function(n,t){if(!(n.exception&&n.exception.values&&t&&t.originalException instanceof Error))return n;var r=this.walkErrorTree(t.originalException,this.Rn);return n.exception.values=a(r,n.exception.values),n},n.prototype.walkErrorTree=function(n,t,r){if(void 0===r&&(r=[]),!(n[t]instanceof Error)||r.length+1>=this.mn)return r;var i=Rn(kn(n[t]));return this.walkErrorTree(n[t],t,a([i],r))},n.id="LinkedErrors",n}(),et=w(),ot=function(){function n(){this.name=n.id}return n.prototype.setupOnce=function(){U(function(t){if(J().getIntegration(n)){if(!et.navigator||!et.location)return t;var r=t.request||{};return r.url=r.url||et.location.href,r.headers=r.headers||{},r.headers["User-Agent"]=et.navigator.userAgent,u({},t,{request:r})}return t})},n.id="UserAgent",n}(),ut=Object.freeze({GlobalHandlers:zn,TryCatch:Vn,Breadcrumbs:Yn,LinkedErrors:it,UserAgent:ot}),ct=[new dn,new vn,new Vn,new Yn,new zn,new it,new ot];var st={},ft=w();ft.Sentry&&ft.Sentry.Integrations&&(st=ft.Sentry.Integrations);var at=u({},st,pn,ut);return n.Integrations=at,n.Transports=Pn,n.addGlobalEventProcessor=U,n.addBreadcrumb=function(n){K("addBreadcrumb",n)},n.captureException=captureException,n.captureEvent=function(n){return K("captureEvent",n)},n.captureMessage=function(n,t){var r;try{throw new Error(n)}catch(n){r=n}return K("captureMessage",n,t,{originalException:n,syntheticException:r})},n.configureScope=function(n){K("configureScope",n)},n.withScope=Z,n.getHubFromCarrier=z,n.getCurrentHub=J,n.Hub=W,n.Scope=N,n.BrowserClient=Hn,n.defaultIntegrations=ct,n.forceLoad=function(){},n.init=function(n){void 0===n&&(n={}),void 0===n.defaultIntegrations&&(n.defaultIntegrations=ct),function(n,t){!0===t.debug&&q.enable(),J().bindClient(new n(t))}(Hn,n)},n.lastEventId=function(){return J().lastEventId()},n.onLoad=function(n){n()},n.showReportDialog=function(n){void 0===n&&(n={}),n.eventId||(n.eventId=J().lastEventId());var t=J().getClient();t&&t.showReportDialog(n)},n.flush=function(n){return c(this,void 0,void 0,function(){var t;return s(this,function(r){return(t=J().getClient())?[2,t.flush(n)]:[2,Promise.reject(!1)]})})},n.close=function(n){return c(this,void 0,void 0,function(){var t;return s(this,function(r){return(t=J().getClient())?[2,t.close(n)]:[2,Promise.reject(!1)]})})},n.SDK_NAME=qn,n.SDK_VERSION="5.0.5",n}({}); +/*! @sentry/browser 5.18.1 (b1261aab) | https://github.com/getsentry/sentry-javascript */ +var Sentry=function(t){var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(t,r)};function r(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var e=function(){return(e=Object.assign||function(t){for(var n,r=1,e=arguments.length;r=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}function o(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var e,i,o=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(e=o.next()).done;)u.push(e.value)}catch(t){i={error:t}}finally{try{e&&!e.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return u}function u(){for(var t=[],n=0;n=200&&n<300?t.Success:429===n?t.RateLimit:n>=400&&n<500?t.Invalid:n>=500?t.Failed:t.Unknown}}(t.Status||(t.Status={}));var f=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,n){return t.__proto__=n,t}:function(t,n){for(var r in n)t.hasOwnProperty(r)||(t[r]=n[r]);return t});var h=function(t){function n(n){var r=this.constructor,e=t.call(this,n)||this;return e.message=n,e.name=r.prototype.constructor.name,f(e,r.prototype),e}return r(n,t),n}(Error);function v(t){switch(Object.prototype.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return E(t,Error)}}function l(t){return"[object ErrorEvent]"===Object.prototype.toString.call(t)}function d(t){return"[object DOMError]"===Object.prototype.toString.call(t)}function p(t){return"[object String]"===Object.prototype.toString.call(t)}function y(t){return null===t||"object"!=typeof t&&"function"!=typeof t}function m(t){return"[object Object]"===Object.prototype.toString.call(t)}function b(t){return"undefined"!=typeof Event&&E(t,Event)}function w(t){return"undefined"!=typeof Element&&E(t,Element)}function g(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function E(t,n){try{return t instanceof n}catch(t){return!1}}function x(t,n){return void 0===n&&(n=0),"string"!=typeof t||0===n?t:t.length<=n?t:t.substr(0,n)+"..."}function j(t,n){if(!Array.isArray(t))return"";for(var r=[],e=0;e"}return t.event_id||""}function I(t){var n=O();if(!("console"in n))return t();var r=n.console,e={};["debug","info","warn","error","log","assert"].forEach(function(t){t in n.console&&r[t].__sentry_original__&&(e[t]=r[t],r[t]=r[t].__sentry_original__)});var i=t();return Object.keys(e).forEach(function(t){r[t]=e[t]}),i}function N(t,n,r){t.exception=t.exception||{},t.exception.values=t.exception.values||[],t.exception.values[0]=t.exception.values[0]||{},t.exception.values[0].value=t.exception.values[0].value||n||"",t.exception.values[0].type=t.exception.values[0].type||r||"Error"}function C(t,n){void 0===n&&(n={});try{t.exception.values[0].mechanism=t.exception.values[0].mechanism||{},Object.keys(n).forEach(function(r){t.exception.values[0].mechanism[r]=n[r]})}catch(t){}}function M(t){try{for(var n=t,r=[],e=0,i=0,o=" > ".length,u=void 0;n&&e++<5&&!("html"===(u=A(n))||e>1&&i+r.length*o+u.length>=80);)r.push(u),i+=u.length,n=n.parentNode;return r.reverse().join(" > ")}catch(t){return""}}function A(t){var n,r,e,i,o,u=t,c=[];if(!u||!u.tagName)return"";if(c.push(u.tagName.toLowerCase()),u.id&&c.push("#"+u.id),(n=u.className)&&p(n))for(r=n.split(/\s+/),o=0;o"}try{o.currentTarget=w(i.currentTarget)?M(i.currentTarget):Object.prototype.toString.call(i.currentTarget)}catch(t){o.currentTarget=""}for(var e in"undefined"!=typeof CustomEvent&&E(t,CustomEvent)&&(o.detail=i.detail),i)Object.prototype.hasOwnProperty.call(i,e)&&(o[e]=i);return o}return t}function Z(t){return function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(t))}function tt(t,n,r){void 0===n&&(n=3),void 0===r&&(r=102400);var e=et(t,n);return Z(e)>r?tt(t,n-1,r):e}function nt(t,n){return"domain"===n&&t&&"object"==typeof t&&t.u?"[Domain]":"domainEmitter"===n?"[DomainEmitter]":"undefined"!=typeof global&&t===global?"[Global]":"undefined"!=typeof window&&t===window?"[Window]":"undefined"!=typeof document&&t===document?"[Document]":m(r=t)&&"nativeEvent"in r&&"preventDefault"in r&&"stopPropagation"in r?"[SyntheticEvent]":"number"==typeof t&&t!=t?"[NaN]":void 0===t?"[undefined]":"function"==typeof t?"[Function: "+$(t)+"]":t;var r}function rt(t,n,r,e){if(void 0===r&&(r=1/0),void 0===e&&(e=new K),0===r)return function(t){var n=Object.prototype.toString.call(t);if("string"==typeof t)return t;if("[object Object]"===n)return"[Object]";if("[object Array]"===n)return"[Array]";var r=nt(t);return y(r)?r:n}(n);if(null!=n&&"function"==typeof n.toJSON)return n.toJSON();var i=nt(n,t);if(y(i))return i;var o=Y(n),u=Array.isArray(n)?[]:{};if(e.memoize(n))return"[Circular ~]";for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&(u[c]=rt(c,o[c],r-1,e));return e.unmemoize(n),u}function et(t,n){try{return JSON.parse(JSON.stringify(t,function(t,r){return rt(t,r,n)}))}catch(t){return"**non-serializable**"}}function it(t,n){void 0===n&&(n=40);var r=Object.keys(Y(t));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=n)return x(r[0],n);for(var e=r.length;e>0;e--){var i=r.slice(0,e).join(", ");if(!(i.length>n))return e===r.length?i:x(i,n)}return""}!function(t){t.PENDING="PENDING",t.RESOLVED="RESOLVED",t.REJECTED="REJECTED"}(z||(z={}));var ot=function(){function t(t){var n=this;this.s=z.PENDING,this.h=[],this.v=function(t){n.l(z.RESOLVED,t)},this.p=function(t){n.l(z.REJECTED,t)},this.l=function(t,r){n.s===z.PENDING&&(g(r)?r.then(n.v,n.p):(n.s=t,n.m=r,n.g()))},this.j=function(t){n.h=n.h.concat(t),n.g()},this.g=function(){if(n.s!==z.PENDING){var t=n.h.slice();n.h=[],t.forEach(function(t){t.done||(n.s===z.RESOLVED&&t.onfulfilled&&t.onfulfilled(n.m),n.s===z.REJECTED&&t.onrejected&&t.onrejected(n.m),t.done=!0)})}};try{t(this.v,this.p)}catch(t){this.p(t)}}return t.prototype.toString=function(){return"[object SyncPromise]"},t.resolve=function(n){return new t(function(t){t(n)})},t.reject=function(n){return new t(function(t,r){r(n)})},t.all=function(n){return new t(function(r,e){if(Array.isArray(n))if(0!==n.length){var i=n.length,o=[];n.forEach(function(n,u){t.resolve(n).then(function(t){o[u]=t,0===(i-=1)&&r(o)}).then(null,e)})}else r([]);else e(new TypeError("Promise.all requires an array as input."))})},t.prototype.then=function(n,r){var e=this;return new t(function(t,i){e.j({done:!1,onfulfilled:function(r){if(n)try{return void t(n(r))}catch(t){return void i(t)}else t(r)},onrejected:function(n){if(r)try{return void t(r(n))}catch(t){return void i(t)}else i(n)}})})},t.prototype.catch=function(t){return this.then(function(t){return t},t)},t.prototype.finally=function(n){var r=this;return new t(function(t,e){var i,o;return r.then(function(t){o=!1,i=t,n&&n()},function(t){o=!0,i=t,n&&n()}).then(function(){o?e(i):t(i)})})},t}(),ut=function(){function t(t){this.k=t,this.S=[]}return t.prototype.isReady=function(){return void 0===this.k||this.length()0&&r(!1)},t);ot.all(n.S).then(function(){clearTimeout(e),r(!0)}).then(null,function(){r(!0)})})},t}();function ct(){if(!("fetch"in O()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(t){return!1}}function at(t){return t&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function st(){if(!ct())return!1;try{return new Request("_",{referrerPolicy:"origin"}),!0}catch(t){return!1}}var ft,ht=O(),vt={},lt={};function dt(t){if(!lt[t])switch(lt[t]=!0,t){case"console":!function(){if(!("console"in ht))return;["debug","info","warn","error","log","assert"].forEach(function(t){t in ht.console&&Q(ht.console,t,function(n){return function(){for(var r=[],e=0;e2?n[2]:void 0;if(e){var i=ft,o=String(e);ft=o,yt("history",{from:i,to:o})}return t.apply(this,n)}}ht.onpopstate=function(){for(var t=[],n=0;n1&&(v=d.slice(0,-1).join("/"),l=d.pop()),l){var p=l.match(/^\d+/);p&&(l=p[0])}this.O({host:a,pass:c,path:v,projectId:l,port:f,protocol:e,user:i})},t.prototype.O=function(t){this.protocol=t.protocol,this.user=t.user,this.pass=t.pass||"",this.host=t.host,this.port=t.port||"",this.path=t.path||"",this.projectId=t.projectId},t.prototype._=function(){var t=this;if(["protocol","user","host","projectId"].forEach(function(n){if(!t[n])throw new h("Invalid Dsn: "+n+" missing")}),!this.projectId.match(/^\d+$/))throw new h("Invalid Dsn: Invalid projectId "+this.projectId);if("http"!==this.protocol&&"https"!==this.protocol)throw new h("Invalid Dsn: Invalid protocol "+this.protocol);if(this.port&&isNaN(parseInt(this.port,10)))throw new h("Invalid Dsn: Invalid port "+this.port)},t}(),Dt=function(){function t(){this.D=!1,this.R=[],this.I=[],this.N=[],this.C={},this.M={},this.A={},this.q={}}return t.prototype.addScopeListener=function(t){this.R.push(t)},t.prototype.addEventProcessor=function(t){return this.I.push(t),this},t.prototype.U=function(){var t=this;this.D||(this.D=!0,setTimeout(function(){t.R.forEach(function(n){n(t)}),t.D=!1}))},t.prototype.L=function(t,n,r,i){var o=this;return void 0===i&&(i=0),new ot(function(u,c){var a=t[i];if(null===n||"function"!=typeof a)u(n);else{var s=a(e({},n),r);g(s)?s.then(function(n){return o.L(t,n,r,i+1).then(u)}).then(null,c):o.L(t,s,r,i+1).then(u).then(null,c)}})},t.prototype.setUser=function(t){return this.C=t||{},this.U(),this},t.prototype.setTags=function(t){return this.M=e({},this.M,t),this.U(),this},t.prototype.setTag=function(t,n){var r;return this.M=e({},this.M,((r={})[t]=n,r)),this.U(),this},t.prototype.setExtras=function(t){return this.A=e({},this.A,t),this.U(),this},t.prototype.setExtra=function(t,n){var r;return this.A=e({},this.A,((r={})[t]=n,r)),this.U(),this},t.prototype.setFingerprint=function(t){return this.H=t,this.U(),this},t.prototype.setLevel=function(t){return this.F=t,this.U(),this},t.prototype.setTransactionName=function(t){return this.P=t,this.U(),this},t.prototype.setTransaction=function(t){return this.setTransactionName(t)},t.prototype.setContext=function(t,n){var r;return this.q=e({},this.q,((r={})[t]=n,r)),this.U(),this},t.prototype.setSpan=function(t){return this.X=t,this.U(),this},t.prototype.getSpan=function(){return this.X},t.prototype.getTransaction=function(){var t=this.getSpan();if(t&&t.spanRecorder&&t.spanRecorder.spans[0])return t.spanRecorder.spans[0]},t.clone=function(n){var r=new t;return n&&(r.N=u(n.N),r.M=e({},n.M),r.A=e({},n.A),r.q=e({},n.q),r.C=n.C,r.F=n.F,r.X=n.X,r.P=n.P,r.H=n.H,r.I=u(n.I)),r},t.prototype.update=function(n){if(!n)return this;if("function"==typeof n){var r=n(this);return r instanceof t?r:this}return n instanceof t?(this.M=e({},this.M,n.M),this.A=e({},this.A,n.A),this.q=e({},this.q,n.q),n.C&&(this.C=n.C),n.F&&(this.F=n.F),n.H&&(this.H=n.H)):m(n)&&(n=n,this.M=e({},this.M,n.tags),this.A=e({},this.A,n.extra),this.q=e({},this.q,n.contexts),n.user&&(this.C=n.user),n.level&&(this.F=n.level),n.fingerprint&&(this.H=n.fingerprint)),this},t.prototype.clear=function(){return this.N=[],this.M={},this.A={},this.C={},this.q={},this.F=void 0,this.P=void 0,this.H=void 0,this.X=void 0,this.U(),this},t.prototype.addBreadcrumb=function(t,n){var r=e({timestamp:F()},t);return this.N=void 0!==n&&n>=0?u(this.N,[r]).slice(-n):u(this.N,[r]),this.U(),this},t.prototype.clearBreadcrumbs=function(){return this.N=[],this.U(),this},t.prototype.W=function(t){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],this.H&&(t.fingerprint=t.fingerprint.concat(this.H)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint},t.prototype.applyToEvent=function(t,n){return this.A&&Object.keys(this.A).length&&(t.extra=e({},this.A,t.extra)),this.M&&Object.keys(this.M).length&&(t.tags=e({},this.M,t.tags)),this.C&&Object.keys(this.C).length&&(t.user=e({},this.C,t.user)),this.q&&Object.keys(this.q).length&&(t.contexts=e({},this.q,t.contexts)),this.F&&(t.level=this.F),this.P&&(t.transaction=this.P),this.X&&(t.contexts=e({trace:this.X.getTraceContext()},t.contexts)),this.W(t),t.breadcrumbs=u(t.breadcrumbs||[],this.N),t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,this.L(u(Rt(),this.I),t,n)},t}();function Rt(){var t=O();return t.__SENTRY__=t.__SENTRY__||{},t.__SENTRY__.globalEventProcessors=t.__SENTRY__.globalEventProcessors||[],t.__SENTRY__.globalEventProcessors}function It(t){Rt().push(t)}var Nt=3,Ct=function(){function t(t,n,r){void 0===n&&(n=new Dt),void 0===r&&(r=Nt),this.$=r,this.B=[],this.B.push({client:t,scope:n}),this.bindClient(t)}return t.prototype.G=function(t){for(var n,r=[],e=1;e0?t[t.length-1].scope:void 0,r=Dt.clone(n);return this.getStack().push({client:this.getClient(),scope:r}),r},t.prototype.popScope=function(){return void 0!==this.getStack().pop()},t.prototype.withScope=function(t){var n=this.pushScope();try{t(n)}finally{this.popScope()}},t.prototype.getClient=function(){return this.getStackTop().client},t.prototype.getScope=function(){return this.getStackTop().scope},t.prototype.getStack=function(){return this.B},t.prototype.getStackTop=function(){return this.B[this.B.length-1]},t.prototype.captureException=function(t,n){var r=this.J=_(),i=n;if(!n){var o=void 0;try{throw new Error("Sentry syntheticException")}catch(t){o=t}i={originalException:t,syntheticException:o}}return this.G("captureException",t,e({},i,{event_id:r})),r},t.prototype.captureMessage=function(t,n,r){var i=this.J=_(),o=r;if(!r){var u=void 0;try{throw new Error(t)}catch(t){u=t}o={originalException:t,syntheticException:u}}return this.G("captureMessage",t,n,e({},o,{event_id:i})),i},t.prototype.captureEvent=function(t,n){var r=this.J=_();return this.G("captureEvent",t,e({},n,{event_id:r})),r},t.prototype.lastEventId=function(){return this.J},t.prototype.addBreadcrumb=function(t,n){var r=this.getStackTop();if(r.scope&&r.client){var i=r.client.getOptions&&r.client.getOptions()||{},o=i.beforeBreadcrumb,u=void 0===o?null:o,c=i.maxBreadcrumbs,a=void 0===c?100:c;if(!(a<=0)){var s=F(),f=e({timestamp:s},t),h=u?I(function(){return u(f,n)}):f;null!==h&&r.scope.addBreadcrumb(h,Math.min(a,100))}}},t.prototype.setUser=function(t){var n=this.getStackTop();n.scope&&n.scope.setUser(t)},t.prototype.setTags=function(t){var n=this.getStackTop();n.scope&&n.scope.setTags(t)},t.prototype.setExtras=function(t){var n=this.getStackTop();n.scope&&n.scope.setExtras(t)},t.prototype.setTag=function(t,n){var r=this.getStackTop();r.scope&&r.scope.setTag(t,n)},t.prototype.setExtra=function(t,n){var r=this.getStackTop();r.scope&&r.scope.setExtra(t,n)},t.prototype.setContext=function(t,n){var r=this.getStackTop();r.scope&&r.scope.setContext(t,n)},t.prototype.configureScope=function(t){var n=this.getStackTop();n.scope&&n.client&&t(n.scope)},t.prototype.run=function(t){var n=At(this);try{t(this)}finally{At(n)}},t.prototype.getIntegration=function(t){var n=this.getClient();if(!n)return null;try{return n.getIntegration(t)}catch(n){return V.warn("Cannot retrieve integration "+t.id+" from the current Hub"),null}},t.prototype.startSpan=function(t){return this.V("startSpan",t)},t.prototype.startTransaction=function(t){return this.V("startTransaction",t)},t.prototype.traceHeaders=function(){return this.V("traceHeaders")},t.prototype.V=function(t){for(var n=[],r=1;r=t&&r({interval:i,ready:!1})):r({interval:i,ready:!0})},1)})},t.prototype.ut=function(){return this.et},t.prototype.st=function(){return!1!==this.getOptions().enabled&&void 0!==this.ot},t.prototype.ft=function(t,n,r){var i=this,o=this.getOptions().normalizeDepth,u=void 0===o?3:o,c=e({},t,{event_id:t.event_id||(r&&r.event_id?r.event_id:_()),timestamp:t.timestamp||F()});this.ht(c),this.vt(c);var a=n;r&&r.captureContext&&(a=Dt.clone(a).update(r.captureContext));var s=ot.resolve(c);return a&&(s=a.applyToEvent(c,r)),s.then(function(t){return"number"==typeof u&&u>0?i.lt(t,u):t})},t.prototype.lt=function(t,n){if(!t)return null;var r=e({},t,t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(function(t){return e({},t,t.data&&{data:et(t.data,n)})})},t.user&&{user:et(t.user,n)},t.contexts&&{contexts:et(t.contexts,n)},t.extra&&{extra:et(t.extra,n)});return t.contexts&&t.contexts.trace&&(r.contexts.trace=t.contexts.trace),r},t.prototype.ht=function(t){var n=this.getOptions(),r=n.environment,e=n.release,i=n.dist,o=n.maxValueLength,u=void 0===o?250:o;void 0===t.environment&&void 0!==r&&(t.environment=r),void 0===t.release&&void 0!==e&&(t.release=e),void 0===t.dist&&void 0!==i&&(t.dist=i),t.message&&(t.message=x(t.message,u));var c=t.exception&&t.exception.values&&t.exception.values[0];c&&c.value&&(c.value=x(c.value,u));var a=t.request;a&&a.url&&(a.url=x(a.url,u))},t.prototype.vt=function(t){var n=t.sdk,r=Object.keys(this.nt);n&&r.length>0&&(n.integrations=r)},t.prototype.dt=function(t){this.ut().sendEvent(t)},t.prototype.ct=function(t,n,r){var e=this,i=this.getOptions(),o=i.beforeSend,u=i.sampleRate;if(!this.st())return ot.reject("SDK not enabled, will not send event.");var c="transaction"===t.type;return!c&&"number"==typeof u&&Math.random()>u?ot.reject("This event has been sampled, will not send event."):new ot(function(i,u){e.ft(t,r,n).then(function(t){if(null!==t){var r=t;if(n&&n.data&&!0===n.data.__sentry__||!o||c)return e.dt(r),void i(r);var a=o(t,n);if(void 0===a)V.error("`beforeSend` method has to return `null` or a valid event.");else if(g(a))e.pt(a,i,u);else{if(null===(r=a))return V.log("`beforeSend` returned `null`, will not send event."),void i(null);e.dt(r),i(r)}}else u("An event processor returned null, will not send event.")}).then(null,function(t){e.captureException(t,{data:{__sentry__:!0},originalException:t}),u("Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: "+t)})})},t.prototype.pt=function(t,n,r){var e=this;t.then(function(t){null!==t?(e.dt(t),n(t)):r("`beforeSend` returned `null`, will not send event.")}).then(null,function(t){r("beforeSend rejected with "+t)})},t}(),Jt=function(){function n(){}return n.prototype.sendEvent=function(n){return ot.resolve({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:t.Status.Skipped})},n.prototype.close=function(t){return ot.resolve(!0)},n}(),zt=function(){function t(t){this.it=t,this.it.dsn||V.warn("No DSN provided, backend will not do anything."),this.yt=this.bt()}return t.prototype.bt=function(){return new Jt},t.prototype.eventFromException=function(t,n){throw new h("Backend has to implement `eventFromException` method")},t.prototype.eventFromMessage=function(t,n,r){throw new h("Backend has to implement `eventFromMessage` method")},t.prototype.sendEvent=function(t){this.yt.sendEvent(t).then(null,function(t){V.error("Error while sending event: "+t)})},t.prototype.getTransport=function(){return this.yt},t}();function Vt(t,n){var r="transaction"===t.type,e={body:JSON.stringify(t),url:r?n.getEnvelopeEndpointWithUrlEncodedAuth():n.getStoreEndpointWithUrlEncodedAuth()};if(r){var i=JSON.stringify({event_id:t.event_id,sent_at:new Date(1e3*F()).toISOString()})+"\n"+JSON.stringify({type:t.type})+"\n"+e.body;e.body=i}return e}var Kt=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(){Bt=Function.prototype.toString,Function.prototype.toString=function(){for(var t=[],n=0;n|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,rn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,en=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,on=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,un=/\((\S*)(?::(\d+))(?::(\d+))\)/;function cn(t){var n=null,r=t&&t.framesToPop;try{if(n=function(t){if(!t||!t.stacktrace)return null;for(var n,r=t.stacktrace,e=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,o=r.split("\n"),u=[],c=0;c eval")>-1&&(n=on.exec(r[3]))?(r[1]=r[1]||"eval",r[3]=n[1],r[4]=n[2],r[5]=""):0!==u||r[5]||void 0===t.columnNumber||(i[0].column=t.columnNumber+1),e={url:r[3],func:r[1]||tn,args:r[2]?r[2].split(","):[],line:r[4]?+r[4]:null,column:r[5]?+r[5]:null}}!e.func&&e.line&&(e.func=tn),i.push(e)}if(!i.length)return null;return{message:sn(t),name:t.name,stack:i}}(t))return an(n,r)}catch(t){}return{message:sn(t),name:t&&t.name,stack:[],failed:!0}}function an(t,n){try{return e({},t,{stack:t.stack.slice(n)})}catch(n){return t}}function sn(t){var n=t&&t.message;return n?n.error&&"string"==typeof n.error.message?n.error.message:n:"No error message"}var fn=50;function hn(t){var n=ln(t.stack),r={type:t.name,value:t.message};return n&&n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function vn(t){return{exception:{values:[hn(t)]}}}function ln(t){if(!t||!t.length)return[];var n=t,r=n[0].func||"",e=n[n.length-1].func||"";return-1===r.indexOf("captureMessage")&&-1===r.indexOf("captureException")||(n=n.slice(1)),-1!==e.indexOf("sentryWrapped")&&(n=n.slice(0,-1)),n.slice(0,fn).map(function(t){return{colno:null===t.column?void 0:t.column,filename:t.url||n[0].url,function:t.func||"?",in_app:!0,lineno:null===t.line?void 0:t.line}}).reverse()}function dn(t,n,r){var e,i;if(void 0===r&&(r={}),l(t)&&t.error)return e=vn(cn(t=t.error));if(d(t)||(i=t,"[object DOMException]"===Object.prototype.toString.call(i))){var o=t,u=o.name||(d(o)?"DOMError":"DOMException"),c=o.message?u+": "+o.message:u;return N(e=pn(c,n,r),c),e}return v(t)?e=vn(cn(t)):m(t)||b(t)?(C(e=function(t,n,r){var e={exception:{values:[{type:b(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:"Non-Error "+(r?"promise rejection":"exception")+" captured with keys: "+it(t)}]},extra:{__serialized__:tt(t)}};if(n){var i=ln(cn(n).stack);e.stacktrace={frames:i}}return e}(t,n,r.rejection),{synthetic:!0}),e):(N(e=pn(t,n,r),""+t,void 0),C(e,{synthetic:!0}),e)}function pn(t,n,r){void 0===r&&(r={});var e={message:t};if(r.attachStacktrace&&n){var i=ln(cn(n).stack);e.stacktrace={frames:i}}return e}var yn=function(){function t(t){this.options=t,this.S=new ut(30),this.Ot=new Xt(this.options.dsn),this.url=this.Ot.getStoreEndpointWithUrlEncodedAuth()}return t.prototype.sendEvent=function(t){throw new h("Transport Class has to implement `sendEvent` method")},t.prototype.close=function(t){return this.S.drain(t)},t}(),mn=O(),bn=function(n){function e(){var t=null!==n&&n.apply(this,arguments)||this;return t._t=new Date(Date.now()),t}return r(e,n),e.prototype.sendEvent=function(n){var r=this;if(new Date(Date.now())0}function kn(t,n,r){if(void 0===n&&(n={}),"function"!=typeof t)return t;try{if(t.__sentry__)return t;if(t.__sentry_wrapped__)return t.__sentry_wrapped__}catch(n){return t}var sentryWrapped=function(){var i=Array.prototype.slice.call(arguments);try{r&&"function"==typeof r&&r.apply(this,arguments);var o=i.map(function(t){return kn(t,n)});return t.handleEvent?t.handleEvent.apply(this,o):t.apply(this,o)}catch(t){throw xn+=1,setTimeout(function(){xn-=1}),Pt(function(r){r.addEventProcessor(function(t){var r=e({},t);return n.mechanism&&(N(r,void 0,void 0),C(r,n.mechanism)),r.extra=e({},r.extra,{arguments:i}),r}),captureException(t)}),t}};try{for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(sentryWrapped[i]=t[i])}catch(t){}t.prototype=t.prototype||{},sentryWrapped.prototype=t.prototype,Object.defineProperty(t,"__sentry_wrapped__",{enumerable:!1,value:sentryWrapped}),Object.defineProperties(sentryWrapped,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:t}});try{Object.getOwnPropertyDescriptor(sentryWrapped,"name").configurable&&Object.defineProperty(sentryWrapped,"name",{get:function(){return t.name}})}catch(t){}return sentryWrapped}var Sn=function(){function n(t){this.name=n.id,this.Dt=!1,this.Rt=!1,this.it=e({onerror:!0,onunhandledrejection:!0},t)}return n.prototype.setupOnce=function(){Error.stackTraceLimit=50,this.it.onerror&&(V.log("Global Handler attached: onerror"),this.It()),this.it.onunhandledrejection&&(V.log("Global Handler attached: onunhandledrejection"),this.Nt())},n.prototype.It=function(){var t=this;this.Dt||(pt({callback:function(r){var e=r.error,i=qt(),o=i.getIntegration(n),u=e&&!0===e.__sentry_own_request__;if(o&&!jn()&&!u){var c=i.getClient(),a=y(e)?t.Ct(r.msg,r.url,r.line,r.column):t.Mt(dn(e,void 0,{attachStacktrace:c&&c.getOptions().attachStacktrace,rejection:!1}),r.url,r.line,r.column);C(a,{handled:!1,type:"onerror"}),i.captureEvent(a,{originalException:e})}},type:"error"}),this.Dt=!0)},n.prototype.Nt=function(){var r=this;this.Rt||(pt({callback:function(e){var i=e;try{"reason"in e?i=e.reason:"detail"in e&&"reason"in e.detail&&(i=e.detail.reason)}catch(t){}var o=qt(),u=o.getIntegration(n),c=i&&!0===i.__sentry_own_request__;if(!u||jn()||c)return!0;var a=o.getClient(),s=y(i)?r.At(i):dn(i,void 0,{attachStacktrace:a&&a.getOptions().attachStacktrace,rejection:!0});s.level=t.Severity.Error,C(s,{handled:!1,type:"onunhandledrejection"}),o.captureEvent(s,{originalException:i})},type:"unhandledrejection"}),this.Rt=!0)},n.prototype.Ct=function(t,n,r,e){var i,o=l(t)?t.message:t;if(p(o)){var u=o.match(/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i);u&&(i=u[1],o=u[2])}var c={exception:{values:[{type:i||"Error",value:o}]}};return this.Mt(c,n,r,e)},n.prototype.At=function(t){return{exception:{values:[{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+t}]}}},n.prototype.Mt=function(t,n,r,e){t.exception=t.exception||{},t.exception.values=t.exception.values||[],t.exception.values[0]=t.exception.values[0]||{},t.exception.values[0].stacktrace=t.exception.values[0].stacktrace||{},t.exception.values[0].stacktrace.frames=t.exception.values[0].stacktrace.frames||[];var i=isNaN(parseInt(e,10))?void 0:e,o=isNaN(parseInt(r,10))?void 0:r,u=p(n)&&n.length>0?n:function(){try{return document.location.href}catch(t){return""}}();return 0===t.exception.values[0].stacktrace.frames.length&&t.exception.values[0].stacktrace.frames.push({colno:i,filename:u,function:"?",in_app:!0,lineno:o}),t},n.id="GlobalHandlers",n}(),Tn=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],On=function(){function t(n){this.name=t.id,this.it=e({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},n)}return t.prototype.qt=function(t){return function(){for(var n=[],r=0;r"}0!==n.length&&qt().addBreadcrumb({category:"ui."+t.name,message:n},{event:t.event,name:t.name})},n.prototype.Xt=function(t){if(t.endTimestamp){if(t.xhr.__sentry_own_request__)return;qt().addBreadcrumb({category:"xhr",data:t.xhr.__sentry_xhr__,type:"http"},{xhr:t.xhr})}else;},n.prototype.Wt=function(n){n.endTimestamp&&(n.fetchData.url.match(/sentry_key/)&&"POST"===n.fetchData.method||(n.error?qt().addBreadcrumb({category:"fetch",data:n.fetchData,level:t.Severity.Error,type:"http"},{data:n.error,input:n.args}):qt().addBreadcrumb({category:"fetch",data:e({},n.fetchData,{status_code:n.response.status}),type:"http"},{input:n.args,response:n.response})))},n.prototype.$t=function(t){var n=O(),r=t.from,e=t.to,i=D(n.location.href),o=D(r),u=D(e);o.path||(o=i),i.protocol===u.protocol&&i.host===u.host&&(e=u.relative),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),qt().addBreadcrumb({category:"navigation",data:{from:r,to:e}})},n.prototype.setupOnce=function(){var t=this;this.it.console&&pt({callback:function(){for(var n=[],r=0;r=this.k)return r;var e=hn(cn(t[n]));return this.Jt(t[n],n,u([e],r))},t.id="LinkedErrors",t}(),Nn=O(),Cn=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(){It(function(n){if(qt().getIntegration(t)){if(!Nn.navigator||!Nn.location)return n;var r=n.request||{};return r.url=r.url||Nn.location.href,r.headers=r.headers||{},r.headers["User-Agent"]=Nn.navigator.userAgent,e({},n,{request:r})}return n})},t.id="UserAgent",t}(),Mn=Object.freeze({GlobalHandlers:Sn,TryCatch:On,Breadcrumbs:_n,LinkedErrors:In,UserAgent:Cn}),An="sentry.javascript.browser",qn=function(t){function n(n){return void 0===n&&(n={}),t.call(this,En,n)||this}return r(n,t),n.prototype.ft=function(n,r,i){return n.platform=n.platform||"javascript",n.sdk=e({},n.sdk,{name:An,packages:u(n.sdk&&n.sdk.packages||[],[{name:"npm:@sentry/browser",version:"5.18.1"}]),version:"5.18.1"}),t.prototype.ft.call(this,n,r,i)},n.prototype.dt=function(n){var r=this.getIntegration(_n);r&&r.addSentryBreadcrumb(n),t.prototype.dt.call(this,n)},n.prototype.showReportDialog=function(t){void 0===t&&(t={});var n=O().document;if(n)if(this.st()){var r=t.dsn||this.getDsn();if(t.eventId)if(r){var e=n.createElement("script");e.async=!0,e.src=new Xt(r).getReportDialogEndpoint(t),t.onLoad&&(e.onload=t.onLoad),(n.head||n.body).appendChild(e)}else V.error("Missing `Dsn` option in showReportDialog call");else V.error("Missing `eventId` option in showReportDialog call")}else V.error("Trying to call showReportDialog with Sentry Client is disabled")},n}(Gt),Un=[new Yt,new Kt,new On,new _n,new Sn,new In,new Cn];var Ln={},Hn=O();Hn.Sentry&&Hn.Sentry.Integrations&&(Ln=Hn.Sentry.Integrations);var Fn=e({},Ln,Zt,Mn);return t.BrowserClient=qn,t.Hub=Ct,t.Integrations=Fn,t.SDK_NAME=An,t.SDK_VERSION="5.18.1",t.Scope=Dt,t.Transports=gn,t.addBreadcrumb=function(t){Ft("addBreadcrumb",t)},t.addGlobalEventProcessor=It,t.captureEvent=function(t){return Ft("captureEvent",t)},t.captureException=captureException,t.captureMessage=function(t,n){var r;try{throw new Error(t)}catch(t){r=t}return Ft("captureMessage",t,"string"==typeof n?n:void 0,e({originalException:t,syntheticException:r},"string"!=typeof n?{captureContext:n}:void 0))},t.close=function(t){var n=qt().getClient();return n?n.close(t):ot.reject(!1)},t.configureScope=function(t){Ft("configureScope",t)},t.defaultIntegrations=Un,t.flush=function(t){var n=qt().getClient();return n?n.flush(t):ot.reject(!1)},t.forceLoad=function(){},t.getCurrentHub=qt,t.getHubFromCarrier=Lt,t.init=function(t){if(void 0===t&&(t={}),void 0===t.defaultIntegrations&&(t.defaultIntegrations=Un),void 0===t.release){var n=O();n.SENTRY_RELEASE&&n.SENTRY_RELEASE.id&&(t.release=n.SENTRY_RELEASE.id)}!function(t,n){!0===n.debug&&V.enable();var r=qt(),e=new t(n);r.bindClient(e)}(qn,t)},t.lastEventId=function(){return qt().lastEventId()},t.makeMain=At,t.onLoad=function(t){t()},t.setContext=function(t,n){Ft("setContext",t,n)},t.setExtra=function(t,n){Ft("setExtra",t,n)},t.setExtras=function(t){Ft("setExtras",t)},t.setTag=function(t,n){Ft("setTag",t,n)},t.setTags=function(t){Ft("setTags",t)},t.setUser=function(t){Ft("setUser",t)},t.showReportDialog=function(t){void 0===t&&(t={}),t.eventId||(t.eventId=qt().lastEventId());var n=qt().getClient();n&&n.showReportDialog(t)},t.startTransaction=function(t){return Ft("startTransaction",e({},t))},t.withScope=Pt,t.wrap=function(t){return kn(t)()},t}({}); diff --git a/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2 b/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2 index d449fb7fd..776eaf8a5 100644 --- a/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2 +++ b/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2 @@ -8,18 +8,14 @@ Sentry.init({ dsn: errortracking_url_coreui, release: VERSION, - whitelistUrls: [ - // only include static assets - "/static/" - ], - blacklistUrls: [ - // exclude third party plugins - "/static/webassets/packed_plugins.js" + allowUrls: [ + // only include errors raise in HTML, packed core & client + {% assets "js_client" %}"{{ ASSET_URL }}",{% endassets %} + {% assets "js_core" %}"{{ ASSET_URL }}",{% endassets %} + {% if g.locale %}"{{ url_for('localeJs', locale=g.locale, domain='messages') }}"{% endif %} ] }); - Sentry.configureScope(function (scope) { - scope.setUser({"id": errortracking_unique_id}); - }); + Sentry.setUser({"id": errortracking_unique_id}); ERRORTRACKING_ENABLED = true; log.info("Initialized error tracking"); }; diff --git a/src/octoprint/plugins/gcodeviewer/__init__.py b/src/octoprint/plugins/gcodeviewer/__init__.py new file mode 100644 index 000000000..d4d9961d0 --- /dev/null +++ b/src/octoprint/plugins/gcodeviewer/__init__.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function, unicode_literals + +__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' +__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License" + +import octoprint.plugin + +from flask_babel import gettext + +class GcodeviewerPlugin(octoprint.plugin.AssetPlugin, + octoprint.plugin.TemplatePlugin, + octoprint.plugin.SettingsPlugin): + + def get_assets(self): + js = ["js/gcodeviewer.js", + "js/viewer/ui.js", + "js/viewer/reader.js", + "js/viewer/renderer.js" + ] + + return dict(js=js, + less=["less/gcodeviewer.less"], + css=["css/gcodeviewer.css"]) + + def get_template_configs(self): + return [ + dict(type="tab", + template="gcodeviewer_tab.jinja2", + div="gcode", + styles=["display: none;"], + data_bind="visible: loginState.hasAllPermissionsKo(access.permissions.GCODE_VIEWER, access.permissions.FILES_DOWNLOAD)"), + dict(type="settings", + template="gcodeviewer_settings.jinja2", + custom_bindings=True), + dict(type="generic", + template="gcodeviewer_initscript.jinja2") + ] + + def get_settings_defaults(self): + return dict(mobileSizeThreshold=2 * 1024 * 1024, # 2MB + sizeThreshold=20 * 1024 * 1024) # 20MB + + def get_settings_version(self): + return 1 + + def on_settings_migrate(self, target, current): + if current is None: + config = self._settings.global_get(["gcodeViewer"]) + if config: + self._logger.info("Migrating settings from gcodeViewer to plugins.gcodeviewer...") + if "mobileSizeThreshold" in config: + self._settings.set_int(["mobileSizeThreshold"], config["mobileSizeThreshold"]) + if "sizeThreshold" in config: + self._settings.set_int(["sizeThreshold"], config["sizeThreshold"]) + self._settings.global_remove(["gcodeViewer"]) + + +__plugin_name__ = gettext("GCode Viewer") +__plugin_author__ = "Gina HรคuรŸge" +__plugin_description__ = "Provides a GCODE viewer in OctoPrint's UI." +__plugin_disabling_discouraged__ = gettext("Without this plugin the GCode Viewer in OctoPrint will no longer be " + "available.") +__plugin_license__ = "AGPLv3" +__plugin_pythoncompat__ = ">=2.7,<4" +__plugin_implementation__ = GcodeviewerPlugin() +#__plugin_hooks__ = { +# "octoprint.access.permissions": __plugin_implementation__.get_additional_permissions +#} diff --git a/src/octoprint/plugins/gcodeviewer/static/css/gcodeviewer.css b/src/octoprint/plugins/gcodeviewer/static/css/gcodeviewer.css new file mode 100644 index 000000000..a4ed68acb --- /dev/null +++ b/src/octoprint/plugins/gcodeviewer/static/css/gcodeviewer.css @@ -0,0 +1 @@ +#gcode .progress{width:588px}#gcode .progress .bar{-webkit-transition:width 0s linear;-moz-transition:width 0s linear;-o-transition:width 0s linear;transition:width 0s linear}#gcode .canvas_container{position:relative}#gcode .canvas_container:hover,#gcode .canvas_container:active{outline:0}#gcode .layer-buttons{padding-top:5px;padding-bottom:7px}#gcode #gcode_layer_slider{position:absolute;right:0;top:0;height:568px;float:right}#gcode #gcode_layer_slider .slider-handle{width:14px;height:14px;margin-left:-3px;margin-top:-7px}#gcode #gcode_command_slider .slider-handle{width:14px;height:14px;margin-left:-7px;margin-top:-3px} \ No newline at end of file diff --git a/src/octoprint/static/js/app/viewmodels/gcode.js b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js similarity index 97% rename from src/octoprint/static/js/app/viewmodels/gcode.js rename to src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js index 6b5ab9bd4..364d1bcb9 100644 --- a/src/octoprint/static/js/app/viewmodels/gcode.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js @@ -6,6 +6,9 @@ $(function() { self.settings = parameters[1]; self.access = parameters[2]; + self.sizeThresholdStr = undefined; + self.mobileSizeThresholdStr = undefined; + self.ui_progress_percentage = ko.observable(); self.ui_progress_type = ko.observable(); self.ui_progress_text = ko.pureComputed(function() { @@ -285,6 +288,9 @@ $(function() { self.maxLayer = undefined; self.initialize = function() { + self.sizeThresholdStr = sizeObservable(self.settings.settings.plugins.gcodeviewer.sizeThreshold); + self.mobileSizeThresholdStr = sizeObservable(self.settings.settings.plugins.gcodeviewer.mobileSizeThreshold); + var layerSliderElement = $("#gcode_slider_layers"); var commandSliderElement = $("#gcode_slider_commands"); var containerElement = $("#gcode_canvas"); @@ -478,7 +484,8 @@ $(function() { self.selectedFile.date(data.job.file.date); self.selectedFile.size(data.job.file.size); - if (data.job.file.size > CONFIG_GCODE_SIZE_THRESHOLD || (OctoPrint.coreui.browser.mobile && data.job.file.size > CONFIG_GCODE_MOBILE_SIZE_THRESHOLD)) { + if (data.job.file.size > self.settings.settings.plugins.gcodeviewer.sizeThreshold() + || (OctoPrint.coreui.browser.mobile && data.job.file.size > self.settings.settings.plugins.gcodeviewer.mobileSizeThreshold())) { self.waitForApproval(true); self.loadedFilepath = undefined; self.loadedFileDate = undefined; @@ -754,6 +761,6 @@ $(function() { OCTOPRINT_VIEWMODELS.push({ construct: GcodeViewModel, dependencies: ["loginStateViewModel", "settingsViewModel", "accessViewModel"], - elements: ["#gcode", "#gcode_link"] + elements: ["#gcode", "#gcode_link", "#settings_plugin_gcodeviewer"] }); }); diff --git a/src/octoprint/static/gcodeviewer/js/gCodeReader.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js similarity index 100% rename from src/octoprint/static/gcodeviewer/js/gCodeReader.js rename to src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js diff --git a/src/octoprint/static/gcodeviewer/js/renderer.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/renderer.js similarity index 100% rename from src/octoprint/static/gcodeviewer/js/renderer.js rename to src/octoprint/plugins/gcodeviewer/static/js/viewer/renderer.js diff --git a/src/octoprint/static/gcodeviewer/js/ui.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/ui.js similarity index 100% rename from src/octoprint/static/gcodeviewer/js/ui.js rename to src/octoprint/plugins/gcodeviewer/static/js/viewer/ui.js diff --git a/src/octoprint/static/gcodeviewer/js/Worker.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/worker.js similarity index 100% rename from src/octoprint/static/gcodeviewer/js/Worker.js rename to src/octoprint/plugins/gcodeviewer/static/js/viewer/worker.js diff --git a/src/octoprint/plugins/gcodeviewer/static/less/gcodeviewer.less b/src/octoprint/plugins/gcodeviewer/static/less/gcodeviewer.less new file mode 100644 index 000000000..044cb5cce --- /dev/null +++ b/src/octoprint/plugins/gcodeviewer/static/less/gcodeviewer.less @@ -0,0 +1,50 @@ +/** GCODE viewer */ + +#gcode { + .progress { + width: 588px; + + .bar { + -webkit-transition: width 0s linear; + -moz-transition: width 0s linear; + -o-transition: width 0s linear; + transition: width 0s linear; + } + } + + .canvas_container { + position: relative; + &:hover, &:active { + outline: 0; + } + } + + .layer-buttons { + padding-top: 5px; + padding-bottom: 7px; + } + + #gcode_layer_slider { + position: absolute; + right: 0; + top: 0; + height: 568px; + float: right; + + .slider-handle { + width: 14px; + height: 14px; + margin-left: -3px; + margin-top: -7px; + } + } + + #gcode_command_slider { + .slider-handle { + width: 14px; + height: 14px; + margin-left: -7px; + margin-top: -3px; + } + } +} diff --git a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_initscript.jinja2 b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_initscript.jinja2 new file mode 100644 index 000000000..b5b7e1bde --- /dev/null +++ b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_initscript.jinja2 @@ -0,0 +1,3 @@ + diff --git a/src/octoprint/templates/dialogs/settings/gcodevisualizer.jinja2 b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 similarity index 58% rename from src/octoprint/templates/dialogs/settings/gcodevisualizer.jinja2 rename to src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 index 4ae0dcebe..aea74d13a 100644 --- a/src/octoprint/templates/dialogs/settings/gcodevisualizer.jinja2 +++ b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 @@ -1,22 +1,15 @@
-
-
- -
-
-
- +
+
- +
{{ _('on desktop')}}
- +
{{ _('on mobile')}}
diff --git a/src/octoprint/templates/tabs/gcodeviewer.jinja2 b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2 similarity index 100% rename from src/octoprint/templates/tabs/gcodeviewer.jinja2 rename to src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_tab.jinja2 diff --git a/src/octoprint/plugins/logging/__init__.py b/src/octoprint/plugins/logging/__init__.py index a6e7e95e5..d0cc01e69 100644 --- a/src/octoprint/plugins/logging/__init__.py +++ b/src/octoprint/plugins/logging/__init__.py @@ -51,8 +51,10 @@ class LoggingPlugin(octoprint.plugin.AssetPlugin, free, total = self._get_usage() loggers = self._get_available_loggers() levels = self._get_logging_levels() + serial_log_enabled = self._settings.global_get_boolean(["serial", "log"]) return jsonify(logs=dict(files=files, free=free, total=total), - setup=dict(loggers=loggers, levels=levels)) + setup=dict(loggers=loggers, levels=levels), + serial_log=dict(enabled=serial_log_enabled)) @octoprint.plugin.BlueprintPlugin.route("/logs", methods=["GET"]) @no_firstrun_access @@ -228,12 +230,7 @@ __plugin_disabling_discouraged__ = gettext("Without this plugin you will no long "the web interface.") __plugin_license__ = "AGPLv3" __plugin_pythoncompat__ = ">=2.7,<4" - -def __plugin_load__(): - global __plugin_implementation__ - __plugin_implementation__ = LoggingPlugin() - - global __plugin_hooks__ - __plugin_hooks__ = { - "octoprint.access.permissions": __plugin_implementation__.get_additional_permissions - } +__plugin_implementation__ = LoggingPlugin() +__plugin_hooks__ = { + "octoprint.access.permissions": __plugin_implementation__.get_additional_permissions +} diff --git a/src/octoprint/plugins/logging/static/js/logging.js b/src/octoprint/plugins/logging/static/js/logging.js index 7a7978ac7..ff37477f7 100644 --- a/src/octoprint/plugins/logging/static/js/logging.js +++ b/src/octoprint/plugins/logging/static/js/logging.js @@ -3,11 +3,16 @@ $(function() { var self = this; self.loginState = parameters[0]; + self.access = parameters[1]; + self.availableLoggers = ko.observableArray(); self.availableLoggersName = ko.observable(); self.availableLoggersLevel = ko.observable(); self.configuredLoggers = ko.observableArray(); self.configuredLoggersChanged = false; + self.serialLogEnabled = ko.observable(); + self.freeSpace = ko.observable(undefined); + self.totalSpace = ko.observable(undefined); self.markedForDeletion = ko.observableArray([]); @@ -54,6 +59,9 @@ $(function() { ); self.requestData = function() { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } OctoPrint.plugins.logging.get() .done(self.fromResponse); }; @@ -61,6 +69,7 @@ $(function() { self.fromResponse = function(response) { self.fromLogsResponse(response.logs); self.fromSetupResponse(response.setup); + self.fromSerialLogResponse(response.serial_log); }; self.fromLogsResponse = function(response) { @@ -71,6 +80,9 @@ $(function() { return; self.listHelper.updateItems(files); + + self.freeSpace(response.free); + self.totalSpace(response.total); }; self.fromSetupResponse = function(response) { @@ -94,11 +106,44 @@ $(function() { self.availableLoggers(availableLoggers); }; + self.fromSerialLogResponse = function(response) { + if (!response) return; + + self.serialLogEnabled(response.enabled); + }; + + self.popoverContent = function() { + var free = self.freeSpace(); + var total = self.totalSpace(); + + var content = "

" + + gettext("You currently have serial.log enabled. Please remember to turn it off " + + "again once your are done debugging whatever issue prompted you to turn it on.") + + "

" + + gettext("It can negatively impact print performance and also take up a lot of storage space " + + "depending on how long you stay connected to your printer and thus should only be used for " + + "debugging.") + + "

"; + + if (free !== undefined && total !== undefined) { + content += "

" + gettext("Log storage:") + " " + + formatSize(free) + " / " + + formatSize(total) + + "

"; + } + + return content; + }; + self.configuredLoggersHasChanged = function () { self.configuredLoggersChanged = true; }; self.addLogger = function() { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } + var component = self.availableLoggersName(); var level = self.availableLoggersLevel(); @@ -109,6 +154,10 @@ $(function() { }; self.removeLogger = function(logger) { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } + self.configuredLoggers.remove(logger); self.availableLoggers.push(logger.component); @@ -116,6 +165,9 @@ $(function() { }; self.removeFile = function(filename) { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } var perform = function() { OctoPrint.plugins.logging.deleteLog(filename) .done(self.requestData); @@ -134,10 +186,16 @@ $(function() { }; self.clearMarkedFiles = function() { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } self.markedForDeletion.removeAll(); }; self.removeMarkedFiles = function() { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } var perform = function() { self._bulkRemove(self.markedForDeletion(), "files") .done(function() { @@ -149,11 +207,17 @@ $(function() { perform); }; - self.onSettingsShown = function() { + self.onServerReconnect = self.onUserLoggedIn = self.onEventSettingsUpdated = function() { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } self.requestData(); }; self.onSettingsBeforeSave = function () { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } if ( self.configuredLoggersChanged ) { console.log("ConfiguredLoggers has changed. Saving!"); var levels = {}; @@ -167,6 +231,9 @@ $(function() { }; self._bulkRemove = function(files) { + if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_LOGGING_MANAGE)) { + return; + } var title = gettext("Deleting log files"); var message = _.sprintf(gettext("Deleting %(count)d log files..."), {count: files.length}); var handler = function(filename) { @@ -211,7 +278,7 @@ $(function() { OCTOPRINT_VIEWMODELS.push({ construct: LoggingViewModel, additionalNames: ["logsViewModel"], - dependencies: ["loginStateViewModel"], - elements: ["#settings_plugin_logging"] + dependencies: ["loginStateViewModel", "accessViewModel"], + elements: ["#settings_plugin_logging", "#navbar_plugin_logging"] }); }); diff --git a/src/octoprint/plugins/logging/templates/logging_navbar.jinja2 b/src/octoprint/plugins/logging/templates/logging_navbar.jinja2 new file mode 100644 index 000000000..f03a75d09 --- /dev/null +++ b/src/octoprint/plugins/logging/templates/logging_navbar.jinja2 @@ -0,0 +1,3 @@ + + + diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index 66bb9fde0..b19dfd218 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -193,7 +193,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, if helpers and "get_throttled" in helpers: self._get_throttled = helpers["get_throttled"] if self._settings.get_boolean(["ignore_throttled"]): - self._logger.warn("!!! THROTTLE STATE IGNORED !!! You have configured the Plugin Manager plugin to ignore an active throttle state of the underlying system. You might run into stability issues or outright corrupt your install. Consider fixing the throttling issue instead of suppressing it.") + self._logger.warning("!!! THROTTLE STATE IGNORED !!! You have configured the Plugin Manager plugin to ignore an active throttle state of the underlying system. You might run into stability issues or outright corrupt your install. Consider fixing the throttling issue instead of suppressing it.") # decouple repository fetching from server startup self._fetch_all_data(do_async=True) @@ -1121,7 +1121,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, # validation if not isinstance(repo_data, (list, tuple)): - self._logger.warn("Invalid repository data: expected a list, got {!r}".format(repo_data)) + self._logger.warning("Invalid repository data: expected a list, got {!r}".format(repo_data)) return None try: diff --git a/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css b/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css index 7450d4f01..9e48d34f6 100644 --- a/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css +++ b/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css @@ -1 +1 @@ -#settings_plugin_pluginmanager_pluginlist{display:block;width:auto;max-height:400px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_name,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a.disabled,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_orphanlist{display:block;width:auto;max-height:400px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_orphanlist table td.settings_plugin_plugin_manager_orphans_id,#settings_plugin_pluginmanager_orphanlist table th.settings_plugin_plugin_manager_orphans_id{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_orphanlist table td.settings_plugin_plugin_manager_orphans_actions,#settings_plugin_pluginmanager_orphanlist table th.settings_plugin_plugin_manager_orphans_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_orphanlist table td.settings_plugin_plugin_manager_orphans_actions a,#settings_plugin_pluginmanager_orphanlist table th.settings_plugin_plugin_manager_orphans_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_orphanlist table td.settings_plugin_plugin_manager_orphans_actions a.disabled,#settings_plugin_pluginmanager_orphanlist table th.settings_plugin_plugin_manager_orphans_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px 10px 5px 5px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_empty,#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable{overflow:hidden;width:100%;height:300px;background-image:url(../img/repo_unavailable.png);text-align:center;display:table}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_empty div,#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable div{display:table-cell;vertical-align:middle}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list{width:auto;height:300px;overflow-x:hidden;overflow-y:scroll;padding-right:2px}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry{border-bottom:1px solid #ddd;padding:5px}#settings_plugin_pluginmanager_workingdialog_output .message{font-weight:700}#settings_plugin_pluginmanager_workingdialog_output .error{font-weight:700;color:#900}#settings_plugin_pluginmanager_workingdialog_output .stdout{color:#333}#settings_plugin_pluginmanager_workingdialog_output .stderr{color:#900}#settings_plugin_pluginmanager_workingdialog_output .call{color:#009} \ No newline at end of file +#settings_plugin_pluginmanager_pluginlist{display:block;width:auto;max-height:400px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_name,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_name .prop,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_name .prop{white-space:nowrap}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a.disabled,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_orphanlist{display:block;width:auto;max-height:400px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_orphanlist table td.settings_plugin_plugin_manager_orphans_id,#settings_plugin_pluginmanager_orphanlist table th.settings_plugin_plugin_manager_orphans_id{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_orphanlist table td.settings_plugin_plugin_manager_orphans_actions,#settings_plugin_pluginmanager_orphanlist table th.settings_plugin_plugin_manager_orphans_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_orphanlist table td.settings_plugin_plugin_manager_orphans_actions a,#settings_plugin_pluginmanager_orphanlist table th.settings_plugin_plugin_manager_orphans_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_orphanlist table td.settings_plugin_plugin_manager_orphans_actions a.disabled,#settings_plugin_pluginmanager_orphanlist table th.settings_plugin_plugin_manager_orphans_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px 10px 5px 5px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_empty,#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable{overflow:hidden;width:100%;height:400px;background-image:url(../img/repo_unavailable.png);text-align:center;display:table}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_empty div,#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable div{display:table-cell;vertical-align:middle}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list{width:auto;height:400px;overflow-x:hidden;overflow-y:scroll;padding-right:2px}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry{border-bottom:1px solid #ddd;padding:5px}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry .meta{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry .stats .prop{white-space:nowrap}#settings_plugin_pluginmanager_workingdialog_output .message{font-weight:700}#settings_plugin_pluginmanager_workingdialog_output .error{font-weight:700;color:#900}#settings_plugin_pluginmanager_workingdialog_output .stdout{color:#333}#settings_plugin_pluginmanager_workingdialog_output .stderr{color:#900}#settings_plugin_pluginmanager_workingdialog_output .call{color:#009} \ No newline at end of file diff --git a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js index e39223307..833480db6 100644 --- a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js +++ b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js @@ -57,14 +57,14 @@ $(function() { { "title": function (a, b) { // sorts ascending - if (a["title"].toLocaleLowerCase() < b["title"].toLocaleLowerCase()) return -1; - if (a["title"].toLocaleLowerCase() > b["title"].toLocaleLowerCase()) return 1; + if (a.title.toLocaleLowerCase() < b.title.toLocaleLowerCase()) return -1; + if (a.title.toLocaleLowerCase() > b.title.toLocaleLowerCase()) return 1; return 0; }, "published": function (a, b) { // sorts descending - if (a["published"].toLocaleLowerCase() > b["published"].toLocaleLowerCase()) return -1; - if (a["published"].toLocaleLowerCase() < b["published"].toLocaleLowerCase()) return 1; + if (a.published.toLocaleLowerCase() > b.published.toLocaleLowerCase()) return -1; + if (a.published.toLocaleLowerCase() < b.published.toLocaleLowerCase()) return 1; return 0; }, "popularity": function (a, b) { @@ -76,21 +76,43 @@ $(function() { if (countA < countB) return 1; return 0; }, - "hotness": function (a, b) { + "release_date": function (a, b) { // sorts descending - var countA = (a.stats && a.stats.install_events_week) ? a.stats.install_events_week : 0; - var countB = (b.stats && b.stats.install_events_week) ? b.stats.install_events_week : 0; + var valA = (a.github && a.github.latest_release) ? a.github.latest_release.date.toLocaleLowerCase() : ""; + var valB = (b.github && b.github.latest_release) ? b.github.latest_release.date.toLocaleLowerCase() : ""; - if (countA > countB) return -1; - if (countA < countB) return 1; - return 0; } + if (valA > valB) return -1; + if (valA < valB) return 1; + return 0; }, + "push_date": function (a, b) { + // sorts descending + var valA = (a.github) ? a.github.last_push.toLocaleLowerCase() : ""; + var valB = (b.github) ? b.github.last_push.toLocaleLowerCase() : ""; + + if (valA > valB) return -1; + if (valA < valB) return 1; + return 0; + }, + "stars": function (a, b) { + // sorts descending + var valA = (a.github) ? a.github.stars : 0; + var valB = (b.github) ? b.github.stars : 0; + + if (valA > valB) return -1; + if (valA < valB) return 1; + return 0; + } + }, { "filter_installed": function(plugin) { return !self.installed(plugin); }, "filter_incompatible": function(plugin) { return plugin.is_compatible.octoprint && plugin.is_compatible.os && plugin.is_compatible.python; + }, + "filter_abandoned": function(plugin) { + return !plugin.abandoned; } }, "title", @@ -528,7 +550,10 @@ $(function() { }; self.showRepository = function() { - self.repositoryDialog.modal("show"); + self.repositoryDialog.modal({ + minHeight: function() { return Math.max($.fn.modal.defaults.maxHeight() - 80, 250); }, + show: true + }); }; self.pluginDetails = function(data) { diff --git a/src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less b/src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less index 89f5ee3d0..2c5beb3bc 100644 --- a/src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less +++ b/src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less @@ -16,6 +16,10 @@ &.settings_plugin_plugin_manager_plugins_name { text-overflow: ellipsis; text-align: left; + + .prop { + white-space: nowrap; + } } &.settings_plugin_plugin_manager_plugins_actions { @@ -106,7 +110,7 @@ #settings_plugin_pluginmanager_repositorydialog_empty { overflow: hidden; width: 100%; - height: 300px; + height: 400px; background-image: url("../img/repo_unavailable.png"); text-align: center; display: table; @@ -119,7 +123,7 @@ #settings_plugin_pluginmanager_repositorydialog_list { width: auto; - height: 300px; + height: 400px; overflow-x: hidden; overflow-y: scroll; padding-right: 2px; @@ -127,6 +131,16 @@ .entry { border-bottom: 1px solid #ddd; padding: 5px; + + .meta { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + } + + .stats .prop { + white-space: nowrap; + } } } } diff --git a/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 b/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 index 232618952..a774980da 100644 --- a/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 +++ b/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 @@ -93,14 +93,16 @@
()
+
 
- {{ _('Homepage') }} - - - Python -   + + Python +  
@@ -202,119 +204,138 @@

{{ _('Install new Plugins...') }}

+
+ +
+
+ + MB + {{ _('The minimum amount of free disk space that has to be available on various locations for OctoPrint to allow updates. Should not be set to 0.') }} +
+
+