diff --git a/.versioneer-lookup b/.versioneer-lookup index 1e8c5e63d..f36ca988a 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -18,16 +18,16 @@ prerelease HEAD \(detached.* -# maintenance is currently the branch for preparation of maintenance release 1.3.11 +# maintenance is currently the branch for preparation of maintenance release 1.3.12 # so are any fix/... and improve/... branches -maintenance 1.3.11 e14c00f135bf2a955e54ac3f0a2928d8440055d2 pep440-dev -fix/.* 1.3.11 e14c00f135bf2a955e54ac3f0a2928d8440055d2 pep440-dev -improve/.* 1.3.11 e14c00f135bf2a955e54ac3f0a2928d8440055d2 pep440-dev +maintenance 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev +fix/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev +improve/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev -# staging/maintenance is currently the branch for preparation of 1.3.10rc5 +# staging/maintenance is currently the branch for preparation of 1.3.11rc4 # so is regressionfix/... -staging/maintenance 1.3.10rc5 e628aedbc11e2ef03ba4172b93e5be2a892b955b pep440-dev -regressionfix/.* 1.3.10rc5 e628aedbc11e2ef03ba4172b93e5be2a892b955b pep440-dev +staging/maintenance 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev +regressionfix/.* 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev # every other branch is a development branch and thus gets resolved to 1.4.0-dev for now .* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev diff --git a/AUTHORS.md b/AUTHORS.md index 4765b3944..34af33e5f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -101,6 +101,10 @@ date of first contribution): * [Matthias Urlichs](https://github.com/smurfix) * [Daniel Joyce](https://github.com/DanielJoyce) * [Andy Qua](https://github.com/AndyQ) + * [Fabio Santos](https://github.com/Fabi0San) + * [Jack Wilsdon](https://github.com/jackwilsdon) + * [Ryan Finnie](https://github.com/rfinnie) + * [Timur Duehr](https://github.com/tduehr) 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 6801292f7..8c7163640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,153 @@ # OctoPrint Changelog +## 1.3.11 (2019-05-14) + +### Heads-up: 1.3.11 unbundles the Cura plugin + +If you rely on the Cura Plugin for your workflow that so far was bundled with OctoPrint, be sure to install the [Cura Legacy plugin](https://github.com/OctoPrint/OctoPrint-CuraLegacy) that's now also [available on the plugin repository](https://plugins.octoprint.org/plugins/curalegacy/). + +Once installed the Cura Legacy plugin will import the settings and profiles from the former bundled Cura plugin automatically on first start. + +### Improvements + + * [#1938](https://github.com/foosel/OctoPrint/issues/1938) - Allow slicing parallel to printing on machines with more than one core. + * [#2462](https://github.com/foosel/OctoPrint/issues/2462) - Also scan and process watched folder on startup, not just during runtime. + * [#2900](https://github.com/foosel/OctoPrint/pull/2900) - Add new hook `octoprint.printer.sdcardupload` to allow plugins to override default way to upload files to the printer's SD card. + * [#2904](https://github.com/foosel/OctoPrint/issues/2904) - Added new command line switches `-4` and `-6` to restrict binding of the server to IPv4 or v6 respectively. + * [#2905](https://github.com/foosel/OctoPrint/issues/2905) - Use maximum of communication & temperature timeout as serial timeout to avoid issues if the user has set a longer temperature reporting interval than (busy) communication timeout. + * [#2945](https://github.com/foosel/OctoPrint/issues/2945) - Adjust default regex for filtering temperature requests and responses to not filter some `M115` responses as well. New regex is `(Send: (N\d+\s+)?M105)|(Recv:\s+(ok\s+((P|B|N)\d+\s+)*)?(B|T\d*):\d+)`. If you modified your terminal filters you'll have to update that manually. + * [#2947](https://github.com/foosel/OctoPrint/issues/2947) - Printer safety check plugin: Disable warning for Monoprice Select Mini V2 with firmware v4.1+. + * [#2953](https://github.com/foosel/OctoPrint/issues/2953) - GCODE Viewer: Bring back the total number of printed layers. + * [#2962](https://github.com/foosel/OctoPrint/issues/2962) - Logging: deletion confirmation and bulk delete for log file management. + * [#2965](https://github.com/foosel/OctoPrint/issues/2965) - Add new hook `octoprint.events.register_custom_events` to allow plugins to cleanly add custom events by plugins. + * [#2970](https://github.com/foosel/OctoPrint/issues/2970) - Add configurable list of commands that should never be sent to the printer, and a configurable list of commands on which OctoPrint should pause the current print job. Allows more granular configuration of behaviour of `M0`, `M1` and `M25`. + * [#2974](https://github.com/foosel/OctoPrint/issues/2974) - Dedicated checkboxes to enable/disable webcam & timelapse functionality instead of relying on empty URLs. + * [#2976](https://github.com/foosel/OctoPrint/issues/2976) - Correctly identify v6 representations of v4 networks for auto login. Also correctly identify `::1` as local network. + * [#2978](https://github.com/foosel/OctoPrint/pull/2978) - Use module name instead of plugin identifier when loading plugins from entry points. Also load bundled plugins under `octoprint.plugins.*` instead of their identifier. + * [#2982](https://github.com/foosel/OctoPrint/issues/2982) - Log user activity of who started/paused/resumed/cancelled the current print. Include `owner` of a print job in event data and log. + * [#2983](https://github.com/foosel/OctoPrint/issues/2983) - Add clear button to filter box in file list. + * [#2986](https://github.com/foosel/OctoPrint/pull/2986) - Forcelogin plugin: Make login page responsive. + * [#2988](https://github.com/foosel/OctoPrint/issues/2988) - Add `--disable-pip-version-check` to pip calls to stop pip's tendency to confuse people with it's update nag messages. + * [#2997](https://github.com/foosel/OctoPrint/issues/2997) - Forcelogin plugin: Accept authentication through API key and/or authorization headers. + * [#3010](https://github.com/foosel/OctoPrint/pull/3010) - Add usage information for all folders to the API. + * [#3014](https://github.com/foosel/OctoPrint/issues/3014) - Hardening against corrupt language packs. + * [#3023](https://github.com/foosel/OctoPrint/issues/3023) - Hardening against corrupt preemptive caching configurations. + * [#3030](https://github.com/foosel/OctoPrint/issues/3030) - Backup plugin: Change name of generated backup file to have an `octoprint-` prefix. See also [#3039](https://github.com/foosel/OctoPrint/pull/3039). + * [#3033](https://github.com/foosel/OctoPrint/issues/3033) - Open serial port in exclusive mode. See also [#3036](https://github.com/foosel/OctoPrint/pull/3036). + * [#3038](https://github.com/foosel/OctoPrint/issues/3038) - Detect Klipper firmware and adjust serial communication settings accordingly. + * [#3040](https://github.com/foosel/OctoPrint/issues/3040) - Add setting to disable fuzzy estimation display in the UI. + * [#3049](https://github.com/foosel/OctoPrint/issues/3049) - Workaround for broken PEP440 non-compliant Python version numbers under Debian. See also [#3054](https://github.com/foosel/OctoPrint/pull/3054). + * [#3051](https://github.com/foosel/OctoPrint/pull/3051) - Always show unfuzzy total print time and print left in a tooltip. + * [#3055](https://github.com/foosel/OctoPrint/pull/3055) - GCODE Viewer: Add ability to preview the current layer to be drawn. + * [#3057](https://github.com/foosel/OctoPrint/issues/3057) - Performance improvements in file management operations & more aggressive cleanup of stale metadata. + * [#3066](https://github.com/foosel/OctoPrint/pull/3066) - Docs: Add missing documentation about state in `jobs` endpoint on API. + * [#3072](https://github.com/foosel/OctoPrint/pull/3072) - Hide temperature tab for machines with neither heated bed nor extruders. + * [#3073](https://github.com/foosel/OctoPrint/pull/3073) - Hide tool section in "Control" tab for machines with no extruders. + * [#3074](https://github.com/foosel/OctoPrint/issues/3074) - Updated several dependencies to newer versions. + * Add elapsed time and reason for failure to `PrintFailed` event. + * Add `trigger_event` parameter to `Settings.save` and `PluginSettings.save` to trigger `SettingsUpdated` event on save of settings. + * Simplify configuration change handling of wizards. + * Minimum Python version is now 2.7.9. + * Create a backup of working `config.yaml` after successful startup. + * Detect incomplete startups and set safe mode flag for next startup. + * Always show actual temperature as received from printer instead of "off" for very low temperatures. That way people will hopefully no longer blame OctoPrint for MINTEMP errors triggered by their firmware because it "can't handle temperatures under 10°C". + * Add full version string `OctoPrint ` to API. + * Add systemd unit file. + * Deprecate appkey API in favor of new bundled Application Keys Plugin. AFAIK was never used by anyone anyhow. + * Take bundle status into account for plugin sorting, bundled plugins should always win before not bundled plugins if no sorting key is provided. + * Load generic templates after JavaScript assets, making it possible to reference already loaded libraries in any injected generic templates. + * Hardening against callback errors in decorators on default view. + * Unbundled the Cura plugin. It lives on as "Cura Legacy" at [OctoPrint/OctoPrint-CuraLegacy](https://github.com/OctoPrint/OctoPrint-CuraLegacy) and will also be available on the plugin repository. + * Hardening against invalid SD status reports. + * Cleanup now obsolete `metadata.yaml` files. + * Use `monotonic_time` for relative times everywhere. + * Support for heated chamber firmware capabilities. + * Remove `UI_API_KEY` and API disabling. With the inclusion of the ForceLogin plugin that doesn't serve a real purpose anymore in most cases, and it was only ever more of a rate limiting feature than an actual security measure anyhow. Plus it lead to a ton of false security alarms. + * More resilience against broken configurations. + * More resilience against platform startup issues during environment detection. + * Don't confuse users with current `pip`'s "Python 2.7 is EOL" messages + * Define empty `UI_API_KEY` for backwards compatibility with third party plugins + * Add config flag `server.ignoredIncompleteStartup` to override incomplete startup detection + * Hardening against errors triggered during print time estimation + * Introduce setting to disable exclusive claim on serial port. There might be issues with this out there in the field, so having the option to disable it is a good thing. + * Docs: Improve docs of connection API to avoid issues as encountered in [#3043](https://github.com/foosel/OctoPrint/issues/3043). + * Action Command Prompt plugin: Set `M876` as default command as discussed in [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982). + * Action Command Prompt plugin: Add `M876` to `EMERGENCY_PARSER` compliant commands, if configured accordingly. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982). + * Action Command Prompt plugin: Signal support for action command prompts to firmware via `M876 P1`, if configured accordingly. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982). + * Action Command Prompt plugin: Properly handle `PROMPT_SUPPORT` capability report from firmware and configure action command prompt support accordingly. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982). + * Error Tracking plugin: New plugin utilizing [sentry.io](https://sentry.io) to track any kind of errors thrown in either backend or the default UI. Will ship disabled by default, has to be enabled by the user. Release Candidates will prompt users to enable it in order to improve on error detection during RC phase. + * Error Tracking: Severely restrict what gets tracked: + * we are only interested in handled core exceptions or unhandled exceptions + * we are not interested at all in `SerialException` + * Error Tracking: Further restriction of what gets tracked + * Forcelogin plugin: Set sorting key to 0 to increase likelihood of coming before alternative UIs. + * Forcelogin plugin: Add favicon meta tags. + * Plugin Manager plugin, Softwareupdate plugin: Use scrollables instead of pagination. + * Printer Safety Check plugin: Add version restriction to Anycubic check. + * Tracking plugin: Add elapsed time and reason for failure to `print_failed` event. + * Tracking plugin: Add elapsed time to `print_cancelled` event. + * Tracking plugin: Track firmware/communication errors. + * Tracking plugin: Track printer safety warnings. + * Tracking plugin: Track uptime of OctoPrint in `ping` event. + +### Bug fixes + + * [#1881](https://github.com/foosel/OctoPrint/issues/1881) - Another attempt at fixing the hard to intentionally reproduce issue where all API endpoints start returning `403` responses. Caching headers have been adjusted and API key handling has been changed, which might fix things. + * [#2859](https://github.com/foosel/OctoPrint/issues/2859) - Fix for used port and baudrate to not be properly reflected on the UI. + * [#2916](https://github.com/foosel/OctoPrint/issues/2916) - Possible workaround for a rare issue with the bundled Tornado dependency when running OctoPrint under Windows. + * [#2954](https://github.com/foosel/OctoPrint/issues/2954) - Backup plugin: Fix an issue with calculation of available free space. + * [#2955](https://github.com/foosel/OctoPrint/issues/2955) - Fix handling of `action:resume` or `action:resumed` received during `PAUSING` and handling of `action:pause` or `action:paused` received during `RESUMING`. Fix `PAUSING` state not allowing a resume to proceed. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982). + * [#2959](https://github.com/foosel/OctoPrint/issues/2959) - Enforce max height smaller than available viewport for notifications so that they cannot scroll out of the screen. + * [#2967](https://github.com/foosel/OctoPrint/issues/2967) - Tracking plugin: Fix exception caused on printer events when tracking is disabled and no UUID is thus set. + * [#2971](https://github.com/foosel/OctoPrint/issues/2971) - Forcelogin plugin: Fix "remember me" not working as advertised. See also [#2973](https://github.com/foosel/OctoPrint/pull/2973). + * [#2992](https://github.com/foosel/OctoPrint/issues/2992) - Backup plugin: Use `shutil.move` instead of `os.rename` and thus avoid issues with certain filesystem configurations. See also [#2993](https://github.com/foosel/OctoPrint/pull/2993). + * [#2996](https://github.com/foosel/OctoPrint/issues/2996) - Use non-blocking writes on serial communication to avoid `select` blocking issues under certain conditions. See also [#3004](https://github.com/foosel/OctoPrint/pull/3004). + * [#3001](https://github.com/foosel/OctoPrint/issues/3001) - Fix a race condition in SD printing detection. + * [#3012](https://github.com/foosel/OctoPrint/issues/3012) - Fix a unicode vs ASCII bug in translating plugins. + * [#3024](https://github.com/foosel/OctoPrint/issues/3024) - Fix inconsistent behaviour of CORS support on the API regarding static routes and the socket. + * [#3029](https://github.com/foosel/OctoPrint/issues/3029) & [#3045](https://github.com/foosel/OctoPrint/pull/3045) & [#3061](https://github.com/foosel/OctoPrint/issues/3061) - Fix issues in the German translation + * [#3053](https://github.com/foosel/OctoPrint/pull/3053) - GCODE Viewer: Fix an issue with multi extruder files where only a higher extruder index is actually used and all prior ones are undefined. + * [#3080](https://github.com/foosel/OctoPrint/issues/3080) - Virtual Printer plugin: Fix tracking of negative movements and homing. + * [#3071](https://github.com/foosel/OctoPrint/issues/3071) - Application Keys plugin: Fix appkeys not working when access control is disabled. + * [#3088](https://github.com/foosel/OctoPrint/issues/3088) (regression) - Fix 500 error on index rendering in case of plugins that use unicode in plugin vars. + * [#3089](https://github.com/foosel/OctoPrint/issues/3089) (regression) - Fix missing `_chamberTemp` definition + * [#3090](https://github.com/foosel/OctoPrint/issues/3090) (regression) - Fix missing method causing an exception on `/api/printer/tool` endpoint + * [#3091](https://github.com/foosel/OctoPrint/issues/3091) (regression) - Printer Safety Check: Fix unicode errors in certain communication scenarios. + * [#3092](https://github.com/foosel/OctoPrint/issues/3092) - Fix invalid tool parameter detection on `/api/printer/tool` endpoint. + * [#3098](https://github.com/foosel/OctoPrint/issues/3098) - Backup: Exclude temporary timelapse files as well if timelapses are excluded from backup. + * [#3105](https://github.com/foosel/OctoPrint/issues/3105) (regression) - Virtual printer: Fix an encoding issue + * [#3108](https://github.com/foosel/OctoPrint/issues/3108) (regression) - Fix bug in port detection + * [#3111](https://github.com/foosel/OctoPrint/issues/3111) (regression) - Refresh port list after disconnect to detect vanishing ports + * [#3115](https://github.com/foosel/OctoPrint/issues/3115) (regression) - Fix extra newlines in `serial.log` and empty lines on terminal + * [#3116](https://github.com/foosel/OctoPrint/issues/3116) - Fix potential division by zero + * Fix a typo in an error message during startup. + * `paused` action command must not trigger *any* local processing. See also [MarlinFirmware/Marlin#12982](https://github.com/MarlinFirmware/Marlin/pull/12982). + * Only use page size from local storage in `ItemListHelper` if configured. + * Fix caching headers on main view. + * Fix missing default value for `self._errorValue` in comm layer. + * Don't read return code on async system commands, it won't work. + * Fix wrong textual representation of `STARTING` state + * Fix some potential encoding errors in the comm layer + * Fix for the file list in the UI not getting refreshed after an SD list refresh from the printer. + * Docs: Fix documentation for firmware info & capability plugin hooks. + * Docs: Fix a formatting issue in the event docs, making it seem like events were deprecated when it was only payload entries that are deprecated. + * Forcelogin plugin: Never handle the UI if ACL is disabled. + * Tracking plugin: Fix tracking not starting fully if enabled during runtime. + * Tracking plugin: Fix handling of missing print time. See also [#3063](https://github.com/foosel/OctoPrint/issues/3063). + +### Special thanks to all the contributors! + +Special thanks to everyone who contributed to this release, especially [@agrif](https://github.com/agrif), [@akraus53](https://github.com/akraus53), [@AndyQ](https://github.com/AndyQ), [@CapnBry](https://github.com/CapnBry), [@DanielJoyce](https://github.com/DanielJoyce), [@devildant](https://github.com/devildant), [@Fabi0San](https://github.com/Fabi0San), [@fake-name](https://github.com/fake-name), [@fieldOfView](https://github.com/fieldOfView), [@gloomyandy](https://github.com/gloomyandy), [@HarlemSquirrel](https://github.com/HarlemSquirrel), [@hgross](https://github.com/hgross), [@jubaleth](https://github.com/foosel/OctoPrint/commits?author=jubaleth), [@melgish](https://github.com/melgish), [@rgriebl](https://github.com/rgriebl) and [@tedder](https://github.com/tedder) for their PRs. + +### More information + + * [Commits](https://github.com/foosel/OctoPrint/compare/1.3.10...1.3.11) + * Release Candidates: + * [1.3.11rc1](https://github.com/foosel/OctoPrint/releases/tag/1.3.11rc1) + * [1.3.11rc2](https://github.com/foosel/OctoPrint/releases/tag/1.3.11rc2) + * [1.3.11rc3](https://github.com/foosel/OctoPrint/releases/tag/1.3.11rc3) + * A big **Thank you!** to everyone who reported back on these release candidates this time: [@arhi](https://github.com/arhi), [@b-morgan](https://github.com/b-morgan), [@CRCinAU](https://github.com/CRCinAU), [@devildant](https://github.com/devildant), [@evanquinnalaska](https://github.com/evanquinnalaska), [@FormerLurker](https://github.com/FormerLurker), [@gege2b](https://github.com/gege2b), [@isbric](https://github.com/isbric), [@JohnOCFII](https://github.com/JohnOCFII), [@kazibole](https://github.com/kazibole), [@nionio6915](https://github.com/nionio6915), [@reloxx13](https://github.com/reloxx13), [@schnello](https://github.com/schnello), [@trunzoc](https://github.com/trunzoc), [@vfrdirk](https://github.com/vfrdirk) & [@zeroflow](https://github.com/zeroflow) + ## 1.3.10 (2018-12-10) ### Heads-up for plugin authors regarding the `sarge` dependency diff --git a/README.md b/README.md index 1758d00ff..37d04ee65 100644 --- a/README.md +++ b/README.md @@ -142,5 +142,8 @@ be edited from OctoPrint's settings dialog. ## Special Thanks -Cross-browser testing services are kindly provided by [BrowserStack](http://www.browserstack.com/). -Profiling is done with the help of [PyVmMonitor](http://www.pyvmmonitor.com). +Cross-browser testing services are kindly provided by [BrowserStack](https://www.browserstack.com/). + +Profiling is done with the help of [PyVmMonitor](https://www.pyvmmonitor.com). + +Error tracking is powered and sponsored by [Sentry](https://sentry.io). diff --git a/SUPPORTERS.md b/SUPPORTERS.md index aae0022bb..8ca7d23b7 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -9,6 +9,7 @@ thanks to everyone who contributed! * Andre Bubel * Andrew Moorby * Arnljot Arntsen + * Bjorn Breckenridge * Boris Hussein * Brad Jackson * Christian Petropolis @@ -16,42 +17,41 @@ thanks to everyone who contributed! * COLLE+McVOY * D Brian Kimmel * DeltaMaker 3D Printers + * Dorian Gray * E3D BigBox * Eric Betts - * Eric Slape * Ernesto Martinez - * Frank Sander + * Franziska Kunsmann * George Robles - * Jared Go + * jean-claude migneault * Jeff Renfer * Jefferson Hunt * Jeremiah Avery * Joseph Payne - * Josh Daniels * Joshua Wills * Justin Kaufman * Kaile Riser * Kale Stedman * Kazuhiro Ogura * LA 3D Printer Repair - * Lewis Newby * LulzBot® * Makespace Madrid * Mark Walker * Michael Aumock * Miles Flavel * Mosaic Manufacturing + * OMER MEHMET SUTAS * Patrick McGinnis * Prof Yuh Wen Chen * Randy C. Will * Robert Gusek - * Roger Strolz * Samer Najia + * Shawn Lewis * Simon Hallam * Stefan Krister * Sven Mueller - * Thomas Hatley - * Timothy D Hoogland + * TEVO 3D Printers * Trent Shumay + * Ulrich Kempken -and 1446 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file +and 1544 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! diff --git a/THIRDPARTYLICENSES.md b/THIRDPARTYLICENSES.md index 6e626afe2..568a14bc5 100644 --- a/THIRDPARTYLICENSES.md +++ b/THIRDPARTYLICENSES.md @@ -37,7 +37,6 @@ * [Awesome-Slugify](https://pypi.python.org/pypi/awesome-slugify): GPLv3 * [chainmap](https://bitbucket.org/jeunice/chainmap): Python * [Click](http://click.pocoo.org/): BSD - * [dateutil](https://dateutil.readthedocs.io/): BSD * [emoji](https://github.com/carpedm20/emoji/): BSD * [feedparser](https://github.com/kurtmckee/feedparser): BSD * [Flask](http://flask.pocoo.org/): BSD diff --git a/docs/api/general.rst b/docs/api/general.rst index edc54ed78..3c404724c 100644 --- a/docs/api/general.rst +++ b/docs/api/general.rst @@ -11,9 +11,9 @@ General information Authorization ============= -OctoPrint's API expects an API key to be supplied with each request. This API key can be either the globally -configured one, a user specific one if "Access Control" is enabled or an app and user specific one as generated -by the authorization workflow implemented by the bundled :ref:`Application Keys Plugin ` (since 1.3.10). +If :ref:`Access Control ` is enabled OctoPrint's API expects an API key to be supplied with each request. This API +key can be either the globally configured one, a user specific one or an app and user specific one as generated by the +authorization workflow implemented by the bundled :ref:`Application Keys Plugin ` (since 1.3.10). Clients are advised to implement the :ref:`Application Keys Plugin workflow ` first and fallback on directing the user to manually supply the the user specific API key. The global key should rarely be used. @@ -26,8 +26,6 @@ The API key must be supplied in the custom HTTP header ``X-Api-Key``, e.g. Host: example.com X-Api-Key: abcdef... -If it is missing or included but invalid, OctoPrint will directly return a response with status :http:statuscode:`403`. - For testing purposes it is also possible to supply the API key via a query parameter ``apikey``, e.g. .. sourcecode:: http @@ -37,6 +35,24 @@ For testing purposes it is also possible to supply the API key via a query param Please be advised that clients should use the header field variant if at all possible. +If the key is missing or invalid, OctoPrint will treat the request as it would any unauthenticated anonymous request to the endpoint. +Consequently, if the bundled :ref:`ForceLogin plugin ` is active (which is the default), that means +that any requests without or with an invalid API key targeting other API endpoints than :ref:`Login ` +will be denied with a :http:statuscode:`403`. + +.. warning:: + + If :ref:`Access Control ` is disabled, OctoPrint will treat any unauthenticated anonymous requests and thus also requests + with an invalid or outright missing API key as requests with full admin rights! + +.. note:: + + The API key requirements changed in 1.3.11. Up to that version, even if Access Control was disabled, all requests needed to + be supplied with an API Key. To make the webinterface work under these circumstances, an unauthenticated anonymous API key was injected into the + HTML page and also available on the :ref:`Push API `. The presence and ready availability of this unauthenticated + anonymous "UI API key" caused confusion and false alarm among users and didn't contribute to the security of the platform in a + meaningful way, so it was finally abandoned in 1.3.11. + .. _fig-api-general-globalapikey: .. figure:: ../images/settings-global-api-key.png :align: center @@ -58,11 +74,6 @@ Please be advised that clients should use the header field variant if at all pos The API key options in the "Change password" dialog. Users can generate and revoke their custom API key here. -.. note:: - OctoPrint's web interface uses a custom API key that is freshly generated on every server start. This key is not - intended to be used by any other client and would not be very useful in any case, since it basically represents - a completely anonymous client. - .. _sec-api-general-contenttype: Content Type diff --git a/docs/api/printer.rst b/docs/api/printer.rst index 1c8483a55..82f86cc91 100644 --- a/docs/api/printer.rst +++ b/docs/api/printer.rst @@ -22,6 +22,11 @@ Bed corresponding resource returns temperature information including an optional history. Note that Bed commands are only available if the currently selected printer profile has a heated bed. See :ref:`sec-api-printer-bedcommand`. +Chamber + Chamber commands allow setting the temperature and temperature offset for the printer's heated chamber. Querying + the corresponding resource returns temperature information including an option history. Note that Chamber commands + are only available if the currently selected printer profile has a heated chamber. + See :ref:`sec-api-printer-chambercommand`. SD card SD commands allow initialization, refresh and release of the printer's SD card (if available). Querying the corresponding resource returns the current SD card state. @@ -623,12 +628,12 @@ Issue a bed command are: target - Sets the given target temperature on the printer's tools. Additional parameters: + Sets the given target temperature on the printer's bed. Additional parameters: * ``target``: Target temperature to set. offset - Sets the given temperature offset on the printer's tools. Additional parameters: + Sets the given temperature offset on the printer's bed. Additional parameters: * ``offset``: Offset to set. @@ -710,7 +715,7 @@ Retrieve the current bed state an :http:statuscode:`409`. .. note:: - If you want both tool and bed temperature information at the same time, take a look at + If you want tool, bed and chamber temperature information at the same time, take a look at :ref:`Retrieve the current printer state `. **Example** @@ -760,6 +765,154 @@ Retrieve the current bed state :statuscode 409: If the printer is not operational or the selected printer profile does not have a heated bed. +.. _sec-api-printer-chambercommand: + +Issue a chamber command +======================= + +.. http:post:: /api/printer/bed + + Chamber commands allow setting the temperature and temperature offsets for the printer's heated chamber. Available commands + are: + + target + Sets the given target temperature on the printer's chamber. Additional parameters: + + * ``target``: Target temperature to set. + + offset + Sets the given temperature offset on the printer's chamber. Additional parameters: + + * ``offset``: Offset to set. + + All of these commands may only be sent if the printer is currently operational. Otherwise a :http:statuscode:`409` + is returned. + + Upon success, a status code of :http:statuscode:`204` and an empty body is returned. + + If no heated chambed is configured for the currently selected printer profile, the resource will return + an :http:statuscode:`409`. + + Requires user rights. + + **Example Target Temperature Request** + + Set the target temperature for the printer's heated chamber to 50°C. + + .. sourcecode:: http + + POST /api/printer/chamber HTTP/1.1 + Host: example.com + Content-Type: application/json + X-Api-Key: abcdef... + + { + "command": "target", + "target": 50 + } + + .. sourcecode:: http + + HTTP/1.1 204 No Content + + **Example Offset Temperature Request** + + Set the temperature offset for the heated chamber to -5°C. + + .. sourcecode:: http + + POST /api/printer/chamber HTTP/1.1 + Host: example.com + Content-Type: application/json + X-Api-Key: abcdef... + + { + "command": "offset", + "offset": -5 + } + + .. sourcecode:: http + + HTTP/1.1 204 No Content + + :json string command: The command to issue, either ``target`` or ``offset``. + :json object target: ``target`` command: The target temperature to set. + :json object offset: ``offset`` command: The offset temperature to set. + :statuscode 204: No error + :statuscode 400: If ``target`` or ``offset`` is not a valid number or outside of the supported range, or if the + request is otherwise invalid. + :statuscode 409: If the printer is not operational or the selected printer profile + does not have a heated chamber. + +.. _sec-api-printer-chamberstate: + +Retrieve the current chamber state +================================== + +.. http:get:: /api/printer/chamber + + Retrieves the current temperature data (actual, target and offset) plus optionally a (limited) history (actual, target, + timestamp) for the printer's heated chamber. + + It's also possible to retrieve the temperature history by supplying the ``history`` query parameter set to ``true``. The + amount of returned history data points can be limited using the ``limit`` query parameter. + + Returns a :http:statuscode:`200` with a Temperature Response in the body upon success. + + If no heated chamber is configured for the currently selected printer profile, the resource will return + an :http:statuscode:`409`. + + .. note:: + If you want tool, bed and chamber temperature information at the same time, take a look at + :ref:`Retrieve the current printer state `. + + **Example** + + Query the chamber temperature data and also include the temperature history but limit it to two entries. + + .. sourcecode:: http + + GET /api/printer/chamber?history=true&limit=2 HTTP/1.1 + Host: example.com + X-Api-Key: abcdef... + + .. sourcecode:: http + + HTTP/1.1 200 OK + Content-Type: application/json + + { + "chamber": { + "actual": 50.221, + "target": 70.0, + "offset": 5 + }, + "history": [ + { + "time": 1395651928, + "chamber": { + "actual": 50.221, + "target": 70.0 + } + }, + { + "time": 1395651926, + "chamber": { + "actual": 49.1123, + "target": 70.0 + } + } + ] + } + + :query history: If set to ``true`` (or: ``yes``, ``y``, ``1``), history information will be included in the response + too. If no ``limit`` parameter is given, all available temperature history data will be returned. + :query limit: If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history + will be returned. Will be ignored if ``history`` is not enabled. + :statuscode 200: No error + :statuscode 409: If the printer is not operational or the selected printer profile + does not have a heated chamber. + .. _sec-api-printer-sdcommand: Issue an SD command diff --git a/docs/api/printerprofiles.rst b/docs/api/printerprofiles.rst index 8db1b51ae..9f2f163e2 100644 --- a/docs/api/printerprofiles.rst +++ b/docs/api/printerprofiles.rst @@ -52,6 +52,7 @@ Retrieve all printer profiles "height": 200 }, "heatedBed": true, + "heatedChamber": false, "axes": { "x": { "speed": 6000, @@ -93,6 +94,7 @@ Retrieve all printer profiles "height": 200 }, "heatedBed": true, + "heatedChamber": true, "axes": { "x": { "speed": 6000, @@ -184,6 +186,7 @@ Add a new printer profile "height": 200 }, "heatedBed": true, + "heatedChamber": false, "axes": { "x": { "speed": 6000, @@ -267,6 +270,7 @@ Add a new printer profile "height": 300 }, "heatedBed": false, + "heatedChamber": false, "axes": { "x": { "speed": 6000, @@ -352,6 +356,7 @@ Update an existing printer profile "height": 200 }, "heatedBed": true, + "heatedChamber": false, "axes": { "x": { "speed": 6000, @@ -578,6 +583,10 @@ Profile - 0..1 - ``boolean`` - Whether the printer has a heated bed (``true``) or not (``false``) + * - ``heatedChamber`` + - 0..1 + - ``boolean`` + - Whether the printer has a heated chamber (``true``) or not (``false``) * - ``axes`` - 0..1 - Object diff --git a/docs/configuration/config_yaml.rst b/docs/configuration/config_yaml.rst index 59cdbbd35..0f43e32c7 100644 --- a/docs/configuration/config_yaml.rst +++ b/docs/configuration/config_yaml.rst @@ -62,6 +62,18 @@ Use the following settings to enable access control: # header and login the user without further checks. Use with caution. checkBasicAuthenticationPassword: true + # Whether to trust remote user headers. If you have setup authentication in front of + # OctoPrint and the user names you use there match OctoPrint accounts, by setting this to true users will + # be logged into OctoPrint as the user provided in the header. Your should ONLY ENABLE THIS if your + # OctoPrint instance is only accessible through a connection locked down through an authenticating reverse proxy! + trustRemoteUser: false + + # Header used by the reverse proxy to convey the authenticated user. + remoteUserHeader: REMOTE_USER + + # If a remote user is not found, add them. Use this only if all users from the remote system can use OctoPrint. + addRemoteUsers: false + .. _sec-configuration-config_yaml-api: API @@ -323,6 +335,9 @@ The following settings are only relevant to you if you want to do OctoPrint deve # Whether the simulated printer should also simulate a heated bed or not hasBed: true + # Whether the simulated printer should also simulate a heated chamber or not + hasChamber: false + # If enabled, reports the set target temperatures as separate messages from the firmware # # True: > M109 S220.0 @@ -815,6 +830,19 @@ Use the following settings to configure the serial connection to the printer: additionalBaudrates: - 123456 + # Commands which should not be sent to the printer, e.g. because they are known to block serial + # communication until physical interaction with the printer as is the case on most firmwares with + # the default M0 and M1. + blockedCommands: + - M0 + - M1 + + # Commands which should cause OctoPrint to pause any ongoing prints. + pausingCommands: + - M0 + - M1 + - M25 + # Commands which are known to take a long time to be acknowledged by the firmware. E.g. # homing, dwelling, auto leveling etc. Defaults to the below commands. longRunningCommands: @@ -941,6 +969,13 @@ Use the following settings to configure the server: # reset the setting to false startOnceInSafeMode: false + # Signals to OctoPrint that the last startup was incomplete. OctoPrint will then startup + # in safe mode + incompleteStartup: false + + # Set this to true to make OctoPrint ignore incomplete startups. Helpful for development. + ignoreIncompleteStartup: false + # Secret key for encrypting cookies and such, randomly generated on first run secretKey: someSecretKey diff --git a/docs/events/index.rst b/docs/events/index.rst index 26deef5bd..eeaac5869 100644 --- a/docs/events/index.rst +++ b/docs/events/index.rst @@ -38,6 +38,13 @@ Example - event: PrintDone command: python ~/growl.py -t mygrowlserver -d "Completed {file}" -a OctoPrint -i http://raspi/Octoprint_logo.png type: system + - event: + - PrintStarted + - PrintFailed + - PrintDone + - PrintCancelled + command: python ~/growl.py -t mygrowlserver -d "Event {__eventname} ({name})" -a OctoPrint -i http://raspi/Octoprint_logo.png + type: system - event: Connected command: - M115 @@ -53,6 +60,7 @@ Placeholders You can use the following generic placeholders in your event hooks: * ``{__currentZ}``: the current Z position of the head if known, -1 if not available + * ``{__eventname}`` : the name of the event hook being triggered * ``{__filename}`` : name of currently selected file, or ``NO FILE`` if no file is selected * ``{__filepath}`` : path in origin location of currently selected file, or ``NO FILE`` if no file is selected * ``{__fileorigin}`` : origin of currently selected file, or ``NO FILE`` if no file is selected @@ -80,6 +88,8 @@ Available Events Plugins may add additional events via the :ref:`octoprint.events.register_custom_events hook `. +.. _sec-events-available_events-server: + Server ------ @@ -113,6 +123,8 @@ ConnectivityChanged * ``old``: Old connectivity value (true for online, false for offline) * ``new``: New connectivity value (true for online, false for offline) +.. _sec-events-available_events-printer_commmunication: + Printer communication --------------------- @@ -152,6 +164,8 @@ PrinterStateChanged :func:`~octoprint.printer.PrinterInterface.get_state_id` for possible values. * ``state_string``: Text representation of the new state. +.. _sec-events-available_events-file_handling: + File handling ------------- @@ -299,6 +313,8 @@ TransferDone * ``local``: the file's name as stored locally * ``remote``: the file's name as stored on SD +.. _sec-events-available_events-printing: + Printing -------- @@ -443,6 +459,8 @@ PrintResumed * ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0. * ``filename``: the file's name. To be removed in 1.4.0. +.. _sec-events-available_events-gcode_processing: + GCODE processing ---------------- @@ -504,6 +522,8 @@ ToolChange * ``old``: old tool index * ``new``: new tool index +.. _sec-events-available_events-timelapses: + Timelapses ---------- @@ -558,6 +578,8 @@ MovieFailed returned a non-0 return code, ``no_frames`` if no frames were captured that could be rendered to a timelapse, or ``unknown`` for any other reason of failure to render. +.. _sec-events-available_events-slicing: + Slicing ------- @@ -629,8 +651,13 @@ SlicingProfileDeleted * ``slicer``: the slicer for which the profile was deleted * ``profile``: the profile that was deleted +.. _sec-events-available_events-settings: + Settings -------- SettingsUpdated - The internal settings were updated. + The settings were updated via the REST API. + + This event may also be triggered if calling code of :py:class:`octoprint.settings.Settings.save` or + :py:class:`octoprint.plugin.PluginSettings.save` sets the ``trigger_event`` parameter to ``True``. diff --git a/docs/features/accesscontrol.rst b/docs/features/accesscontrol.rst index cb6a1e248..06bcc253e 100644 --- a/docs/features/accesscontrol.rst +++ b/docs/features/accesscontrol.rst @@ -21,12 +21,12 @@ Commands, which are admin-only. If Access Control is disabled, everything is directly accessible. **That also includes all administrative functionality as well as full control over the -printer!** +printer**, and without the need for an :ref:`API key `! Upon first start a configuration wizard is provided which allows configuration of the first administrator account or alternatively disabling Access Control (which is **NOT** recommended for systems that are directly accessible via the -Internet!). +internet or other untrusted networks!). .. hint:: diff --git a/docs/index.rst b/docs/index.rst index ac0ed3ec5..cdfa4b217 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,7 +11,7 @@ and released under the `GNU Affero General Public License V3 `_. -The community forum is available at `discourse.octoprint.org `_. +The community forum is available at `community.octoprint.org `_. The FAQ can be accessed by following `faq.octoprint.org `_. @@ -23,7 +23,7 @@ If you enjoy OctoPrint, please consider becoming a regular supporter! .. note:: This documentation currently focuses primarily on developers and less on end users. If you are interested in - helping to change this, please get in touch `on the forum `_! + helping to change this, please get in touch `on the forum `_! Contents ======== diff --git a/docs/jsclientlib/printer.rst b/docs/jsclientlib/printer.rst index 14df29834..d79d3d6de 100644 --- a/docs/jsclientlib/printer.rst +++ b/docs/jsclientlib/printer.rst @@ -210,6 +210,64 @@ :param object opts: Additional options for the request :returns Promise: A `jQuery Promise `_ for the request's response +.. js:function:: OctoPrintClient.printer.getChamberState(data, opts) + + Retrieves the current printer chamber state/temperature information, and optionally also the temperature + history. + + The ``flags`` object can be used to specify the data to retrieve further via the following + properties: + + * ``history``: a boolean value to specify whether the temperature history should be included (``true``) + or not (``false``), defaults to it not being included + * ``limit``: an integer value to specify how many history entries to include + + See :ref:`Retrieve the current bed state ` for more details. + + :param object flags: Flags that further specify which data to retrieve, see above for details + :param object opts: Additional options for the request + :returns Promise: A `jQuery Promise `_ for the request's response + +.. js:function:: OctoPrintClient.printer.setChamberTargetTemperature(target, opts) + + Sets the given temperature on the printer's heated chamber (if available). + + ``target`` is expected to be the target temperature as a float value. + + **Example:** + + Set the chamber to 50°C. + + .. code-block:: javascript + + OctoPrint.printer.setChamberTargetTemperature(50.0); + + See the ``target`` command in :ref:`Issue a chamber command ` for more details. + + :param float target: The target to set + :param object opts: Additional options for the request + :returns Promise: A `jQuery Promise `_ for the request's response + +.. js:function:: OctoPrintClient.printer.setChamberTemperatureOffset(offset, opts) + + Sets the given temperature offset for the printer's heated chamber (if available). + + ``offset`` is expected to be the temperature offset to set. + + **Example:** + + Set the offset for the chamber to -5°C. + + .. code-block:: javascript + + OctoPrint.printer.setChamberTemperatureOffset(-5); + + See the ``offset`` command in :ref:`Issue a chamber command ` for more details. + + :param object offsets: The offsets to set + :param object opts: Additional options for the request + :returns Promise: A `jQuery Promise `_ for the request's response + .. js:function:: OctoPrintClient.printer.jog(amounts, opts) Jogs the specified axes by the specified ``amounts``. diff --git a/docs/plugins/hooks.rst b/docs/plugins/hooks.rst index a5a9f0aa3..8d35ea5a6 100644 --- a/docs/plugins/hooks.rst +++ b/docs/plugins/hooks.rst @@ -736,9 +736,10 @@ octoprint.comm.protocol.scripts make sure to only proceed with returning additional scripts if the ``script_type`` and ``script_name`` match handled scripts. If not, None should be returned directly. - If the hook handler has something to add to the specified script, it may return a 2-tuple or a 3-tuple with the first entry + If the hook handler has something to add to the specified script, it may return a 2-tuple, a 3-tuple or a 4-tuple with the first entry defining the prefix (what to *prepend* to the script in question), the second entry defining the postfix (what to - *append* to the script in question), and finally if desired a dictionary of variables to be made available to the script. Both prefix and postfix can be None to signify that nothing should be prepended + *append* to the script in question), and finally if desired a dictionary of variables to be made available to the script on third and additional tags to set on the + commands on fourth position. Both prefix and postfix can be None to signify that nothing should be prepended respectively appended. The returned prefix and postfix entries may be either iterables of script lines or a string including newlines of the script lines (which diff --git a/setup.py b/setup.py index c81498e48..1d093e778 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ INSTALL_REQUIRES = [ # guarantee backwards compatibility for plugins and such with that # version, hence we need to pin to a lower version for now. See #1697 "tornado==4.5.3", # a memory leak was observed in tornado >= 5, see #2585 - "regex!=2018.11.6", # avoid broken 2018.11.6. See #2874 + "regex!=2018.11.6", # avoid broken 2018.11.6. See #2874 # anything below this should be checked on releases for new versions @@ -35,39 +35,39 @@ INSTALL_REQUIRES = [ "Flask-Principal>=0.4,<0.5", "Flask-Babel>=0.12,<0.13", "Flask-Assets>=0.12,<0.13", - "werkzeug>=0.14.1,<0.15", - "PyYAML>=3.13,<4", + "werkzeug>=0.15.1,<0.16", + "cachelib>=0.1,<0.2", + "PyYAML>=5.1,<6", "markdown>=3.0,<3.1", "pyserial>=3.4,<3.5", "netaddr>=0.7.19,<0.8", "watchdog>=0.9.0,<0.10", "sarge==0.1.5post0", - "netifaces>=0.10.7,<0.11", - "pylru>=1.1,<1.2", + "netifaces>=0.10.9,<0.11", + "pylru>=1.2,<1.3", "rsa>=4.0,<5", - "pkginfo>=1.4.2,<1.5", - "requests>=2.20.0,<3", + "pkginfo>=1.5.0.1,<1.6", + "requests>=2.21.0,<3", "semantic_version>=2.6,<2.7", - "psutil>=5.4.8,<5.5", + "psutil>=5.6.1,<5.7", "Click>=7,<8", "awesome-slugify>=1.6.5,<1.7", "feedparser>=5.2.1,<5.3", "future>=0.17,<0.18", - "websocket-client>=0.53,<0.54", - "python-dateutil>=2.7.5,<2.8", - "wrapt>=1.10.11,<1.11", + "websocket-client>=0.56,<0.57", + "wrapt>=1.11.1,<1.12", "emoji>=0.5.1,<0.6", "frozendict>=1.2,<1.3", - "sentry-sdk==0.6.6" + "sentry-sdk==0.7.7" ] # Python 2 specific requirements INSTALL_REQUIRES_PYTHON2 = [ "futures>=3.2,<3.3", "monotonic>=1.5,<1.6", - "scandir>=1.9,<1.10", - "chainmap>=1.0.2,<1.1", - "typing>=3.6.4,<4" + "scandir>=1.10,<1.11", + "chainmap>=1.0.3,<1.1", + "typing>=3.6.6,<4" ] # OSX specific requirements @@ -227,7 +227,7 @@ def params(): keywords = "3dprinting 3dprinter 3d-printing 3d-printer octoprint" project_urls={ - "Community Forum": "https://discourse.octoprint.org", + "Community Forum": "https://community.octoprint.org", "Bug Reports": "https://github.com/foosel/OctoPrint/issues", "Source": "https://github.com/foosel/OctoPrint", "Funding": "https://donate.octoprint.org" diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index 6308cbdfd..a8f4c2d81 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -105,7 +105,10 @@ def init_platform(basedir, configfile, use_logging_file=True, logging_file=None, after_logging(**kwargs) settings_start_once_in_safemode = "settings" if settings.getBoolean(["server", "startOnceInSafeMode"]) else None - settings_incomplete_startup_safemode = "incomplete_startup" if settings.getBoolean(["server", "incompleteStartup"]) else None + settings_incomplete_startup_safemode = "incomplete_startup" \ + if settings.getBoolean(["server", "incompleteStartup"]) \ + and not settings.getBoolean(["server", "ignoreIncompleteStartup"]) \ + else None safe_mode = safe_mode or settings_start_once_in_safemode or settings_incomplete_startup_safemode kwargs["safe_mode"] = safe_mode if callable(after_safe_mode): diff --git a/src/octoprint/access/users.py b/src/octoprint/access/users.py index 5ba09e617..ea09d8ef1 100644 --- a/src/octoprint/access/users.py +++ b/src/octoprint/access/users.py @@ -20,7 +20,7 @@ import logging from builtins import range, bytes from octoprint.settings import settings -from octoprint.util import atomic_write, to_bytes, deprecated +from octoprint.util import atomic_write, to_bytes, deprecated, monotonic_time from octoprint.access.permissions import Permissions, OctoPrintPermission from octoprint.access.groups import GroupChangeListener, Group @@ -129,11 +129,10 @@ class UserManager(GroupChangeListener, object): self._logger.debug("Logged out user: %r" % user) def _cleanup_sessions(self): - import time for session, user in self._session_users_by_session.items(): if not isinstance(user, SessionUser): continue - if user.created + (24 * 60 * 60) < time.time(): + if user.created + (24 * 60 * 60) < monotonic_time(): self.logout_user(user) @staticmethod @@ -1191,8 +1190,8 @@ class SessionUser(wrapt.ObjectProxy): wrapt.ObjectProxy.__init__(self, user) self._self_session = "".join('%02X' % z for z in bytes(uuid.uuid4().bytes)) - self._self_created = time.time() - self._self_touched = time.time() + self._self_created = monotonic_time() + self._self_touched = monotonic_time() @property def session(self): @@ -1207,7 +1206,7 @@ class SessionUser(wrapt.ObjectProxy): return self._self_touched def touch(self): - self._self_touched = time.time() + self._self_touched = monotonic_time() @deprecated("SessionUser.get_session() has been deprecated, use SessionUser.session instead", since="1.3.5") def get_session(self): diff --git a/src/octoprint/cli/analysis.py b/src/octoprint/cli/analysis.py index 6bc902472..d549e5424 100644 --- a/src/octoprint/cli/analysis.py +++ b/src/octoprint/cli/analysis.py @@ -35,6 +35,7 @@ def gcode_command(path, speedx, speedy, speedz, offset, maxt, throttle, throttle import time import yaml + from octoprint.util import monotonic_time from octoprint.util.gcodeInterpreter import gcode throttle_callback = None @@ -53,7 +54,7 @@ def gcode_command(path, speedx, speedy, speedz, offset, maxt, throttle, throttle if len(offsets) < maxt: offsets += [(0, 0)] * (maxt - len(offsets)) - start_time = time.time() + start_time = monotonic_time() progress_callback = None if progress: @@ -69,7 +70,7 @@ def gcode_command(path, speedx, speedy, speedz, offset, maxt, throttle, throttle max_extruders=maxt, g90_extruder=g90_extruder) - click.echo("DONE:{}s".format(time.time() - start_time)) + click.echo("DONE:{}s".format(monotonic_time() - start_time)) click.echo("RESULTS:") click.echo(yaml.safe_dump(interpreter.get_result(), default_flow_style=False, indent=4, allow_unicode=True)) diff --git a/src/octoprint/cli/plugins.py b/src/octoprint/cli/plugins.py index f3b791637..e628ae4c6 100644 --- a/src/octoprint/cli/plugins.py +++ b/src/octoprint/cli/plugins.py @@ -93,7 +93,8 @@ class OctoPrintPluginCommands(click.MultiCommand): continue result[name + self.sep + command.name] = command except Exception: - self._logger.exception("Error while retrieving cli commands for plugin {}".format(name)) + self._logger.exception("Error while retrieving cli commands for plugin {}".format(name), + extra=dict(plugin=name)) return result diff --git a/src/octoprint/cli/server.py b/src/octoprint/cli/server.py index e86b524d8..ab9ea5fe4 100644 --- a/src/octoprint/cli/server.py +++ b/src/octoprint/cli/server.py @@ -12,7 +12,7 @@ import sys from octoprint.cli import bulk_options, standard_options, set_ctx_obj_option, get_ctx_obj_option -def run_server(basedir, configfile, host, port, debug, allow_root, logging_config, verbosity, safe_mode, +def run_server(basedir, configfile, host, port, v6_only, debug, allow_root, logging_config, verbosity, safe_mode, ignore_blacklist, octoprint_daemon=None): """Initializes the environment and starts up the server.""" @@ -111,6 +111,7 @@ def run_server(basedir, configfile, host, port, debug, allow_root, logging_confi environment_detector=environment_detector, host=host, port=port, + v6_only=v6_only, debug=debug, safe_mode=safe_mode, allow_root=allow_root, @@ -121,9 +122,13 @@ def run_server(basedir, configfile, host, port, debug, allow_root, logging_confi server_options = bulk_options([ click.option("--host", type=click.STRING, callback=set_ctx_obj_option, - help="Specify the host on which to bind the server."), + help="Specify the host address on which to bind the server."), click.option("--port", type=click.INT, callback=set_ctx_obj_option, help="Specify the port on which to bind the server."), + click.option("-4", "--ipv4", "v4", is_flag=True, callback=set_ctx_obj_option, + help="Bind to IPv4 addresses only. Implies '--host 0.0.0.0'. Silently ignored if -6 is present."), + click.option("-6", "--ipv6", "v6", is_flag=True, callback=set_ctx_obj_option, + help="Bind to IPv6 addresses only. Disables dual stack when binding to any v6 addresses. Silently ignored if -4 is present."), click.option("--logging", type=click.Path(), callback=set_ctx_obj_option, help="Specify the config file to use for configuring logging."), click.option("--iknowwhatimdoing", "allow_root", is_flag=True, callback=set_ctx_obj_option, @@ -133,7 +138,7 @@ server_options = bulk_options([ click.option("--ignore-blacklist", "ignore_blacklist", is_flag=True, callback=set_ctx_obj_option, help="Disable processing of the plugin blacklist.") ]) -"""Decorator to add the options shared among the server commands: ``--host``, ``--port``, +"""Decorator to add the options shared among the server commands: ``--host``, ``--port``, ``-4``, ``-6`` ``--logging``, ``--iknowwhatimdoing`` and ``--debug``.""" daemon_options = bulk_options([ @@ -163,11 +168,11 @@ def enable_safemode(ctx, **kwargs): click.echo(e.message, err=True) click.echo("There was a fatal error initializing the settings manager.", err=True) ctx.exit(-1) + else: + settings.setBoolean(["server", "startOnceInSafeMode"], True) + settings.save() - settings.setBoolean(["server", "startOnceInSafeMode"], True) - settings.save() - - click.echo("Safe mode flag set, OctoPrint will start in safe mode on next restart.") + click.echo("Safe mode flag set, OctoPrint will start in safe mode on next restart.") @server_commands.command(name="serve") @@ -182,6 +187,8 @@ def serve_command(ctx, **kwargs): host = get_value("host") port = get_value("port") + v4 = get_value("v4") + v6 = get_value("v6") logging = get_value("logging") allow_root = get_value("allow_root") debug = get_value("debug") @@ -192,7 +199,10 @@ def serve_command(ctx, **kwargs): safe_mode = "flag" if get_value("safe_mode") else None ignore_blacklist = get_value("ignore_blacklist") - run_server(basedir, configfile, host, port, debug, + if v4 and not host: + host = "0.0.0.0" + + run_server(basedir, configfile, host, port, v6, debug, allow_root, logging, verbosity, safe_mode, ignore_blacklist) @@ -219,6 +229,8 @@ if sys.platform != "win32" and sys.platform != "darwin": host = get_value("host") port = get_value("port") + v4 = get_value("v4") + v6 = get_value("v6") logging = get_value("logging") allow_root = get_value("allow_root") debug = get_value("debug") @@ -230,6 +242,9 @@ if sys.platform != "win32" and sys.platform != "darwin": safe_mode = "flag" if get_value("safe_mode") else None ignore_blacklist = get_value("ignore_blacklist") + if v4 and not host: + host = "0.0.0.0" + if pid is None: click.echo("No path to a pidfile set", file=sys.stderr) @@ -237,14 +252,15 @@ if sys.platform != "win32" and sys.platform != "darwin": from octoprint.daemon import Daemon class OctoPrintDaemon(Daemon): - def __init__(self, pidfile, basedir, configfile, host, port, debug, allow_root, logging_config, verbosity, - safe_mode, ignore_blacklist): + def __init__(self, pidfile, basedir, configfile, host, port, v6_only, debug, allow_root, logging_config, + verbosity, safe_mode, ignore_blacklist): Daemon.__init__(self, pidfile) self._basedir = basedir self._configfile = configfile self._host = host self._port = port + self._v6_only = v6_only self._debug = debug self._allow_root = allow_root self._logging_config = logging_config @@ -253,12 +269,12 @@ if sys.platform != "win32" and sys.platform != "darwin": self._ignore_blacklist = ignore_blacklist def run(self): - run_server(self._basedir, self._configfile, self._host, self._port, self._debug, + run_server(self._basedir, self._configfile, self._host, self._port, self._v6_only, self._debug, self._allow_root, self._logging_config, self._verbosity, self._safe_mode, self._ignore_blacklist, octoprint_daemon=self) - octoprint_daemon = OctoPrintDaemon(pid, basedir, configfile, host, port, debug, allow_root, logging, verbosity, - safe_mode, ignore_blacklist) + octoprint_daemon = OctoPrintDaemon(pid, basedir, configfile, host, port, v6, debug, allow_root, logging, + verbosity, safe_mode, ignore_blacklist) if command == "start": octoprint_daemon.start() diff --git a/src/octoprint/comm/protocol/__init__.py b/src/octoprint/comm/protocol/__init__.py index d6ef95de4..7430750d6 100644 --- a/src/octoprint/comm/protocol/__init__.py +++ b/src/octoprint/comm/protocol/__init__.py @@ -370,6 +370,9 @@ class ThreeDPrinterProtocolMixin(ThreeAxisProtocolMixin, MultiToolProtocolMixin) def set_bed_temperature(self, temperature, wait=False, *args, **kwargs): pass + def set_chamber_temperature(self, temperature, wait=False, *args, **kwargs): + pass + class FanControlProtocolMixin(object): def set_fan_speed(self, speed, *args, **kwargs): diff --git a/src/octoprint/comm/protocol/reprap/__init__.py b/src/octoprint/comm/protocol/reprap/__init__.py index 165277427..76a90e503 100644 --- a/src/octoprint/comm/protocol/reprap/__init__.py +++ b/src/octoprint/comm/protocol/reprap/__init__.py @@ -82,6 +82,7 @@ CAPABILITY_AUTOREPORT_TEMP = "AUTOREPORT_TEMP" CAPABILITY_AUTOREPORT_SD_STATUS = "AUTOREPORT_SD_STATUS" CAPABILITY_BUSY_PROTOCOL = "BUSY_PROTOCOL" CAPABILITY_EMERGENCY_PARSER = "EMERGENCY_PARSER" +CAPABILITY_CHAMBER_TEMP = "CHAMBER_TEMPERATURE" class FallbackValue(object): @@ -192,6 +193,7 @@ class ReprapGcodeProtocol(Protocol, ThreeDPrinterProtocolMixin, MotorControlProt self._capability_support = dict() self._capability_support[CAPABILITY_AUTOREPORT_TEMP] = True self._capability_support[CAPABILITY_BUSY_PROTOCOL] = True + self._capability_support[CAPABILITY_CHAMBER_TEMP] = True self._transport = None @@ -562,6 +564,11 @@ class ReprapGcodeProtocol(Protocol, ThreeDPrinterProtocolMixin, MotorControlProt self._send_commands(self.flavor.command_set_bed_temp(temperature, wait=wait), tags=tags) + def set_chamber_temperature(self, temperature, wait=False, *args, **kwargs): + tags = kwargs.get("tags", set()) | {"trigger:protocol.set_chamber_temperature"} + self._send_commands(self.flavor.command_set_bed_temp(temperature, wait=wait), + tags=tags) + ##~~ MotorControlProtocolMixin def set_motor_state(self, enabled, *args, **kwargs): @@ -1285,6 +1292,10 @@ class ReprapGcodeProtocol(Protocol, ThreeDPrinterProtocolMixin, MotorControlProt actual, target = temperatures["B"] self._internal_flags["temperatures"].set_bed(actual=actual, target=target) + if "C" in temperatures and (self._capability_support.get(CAPABILITY_CHAMBER_TEMP, False) or self._printer_profile["heatedChamber"]): + actual, target = temperatures["C"] + self._internal_flags["temperatures"].set_chamber(actual=actual, target=target) + self.notify_listeners("on_protocol_temperature", self, self._internal_flags["temperatures"].as_dict()) def _on_message_position(self, position): @@ -2049,6 +2060,17 @@ class ReprapGcodeProtocol(Protocol, ThreeDPrinterProtocolMixin, MotorControlProt self._internal_flags["temperatures"].set_bed(target=target) self.notify_listeners("on_protocol_temperature", self, self._internal_flags["temperatures"].as_dict()) + def _gcode_M141_sent(self, command, wait=False, support_r=False): + target = None + if command.s is not None: + target = float(command.s) + elif command.r is not None and support_r: + target = float(command.r) + + if target: + self._internal_flags["temperatures"].set_chamber(target=target) + self.notify_listeners("on_protocol_temperature", self, self._internal_flags["temperatures"].as_dict()) + def _gcode_M109_sent(self, command): self._internal_flags["heatup_start"] = monotonic_time() self._internal_flags["long_running_command"] = True @@ -2061,6 +2083,12 @@ class ReprapGcodeProtocol(Protocol, ThreeDPrinterProtocolMixin, MotorControlProt self._internal_flags["heating"] = True self._gcode_M140_sent(command, wait=True, support_r=True) + def _gcode_M191_sent(self, command): + self._internal_flags["heatup_start"] = monotonic_time() + self._internal_flags["long_running_command"] = True + self._internal_flags["heating"] = True + self._gcode_M141_sent(command, wait=True, support_r=True) + def _gcode_M116_sent(self, command): self._internal_flags["heatup_start"] = monotonic_time() self._internal_flags["long_running_command"] = True diff --git a/src/octoprint/comm/protocol/reprap/flavors/generic.py b/src/octoprint/comm/protocol/reprap/flavors/generic.py index d4cb7b0f0..b4068268e 100644 --- a/src/octoprint/comm/protocol/reprap/flavors/generic.py +++ b/src/octoprint/comm/protocol/reprap/flavors/generic.py @@ -432,6 +432,10 @@ class GenericFlavor(with_metaclass(FlavorMeta, object)): def command_set_bed_temp(cls, temperature, wait=False): return GcodeCommand("M190" if wait else "M140", s=temperature) + @classmethod + def command_set_chamber_temp(cls, temperature, wait=False): + return GcodeCommand("M191" if wait else "M141", s=temperature) + @classmethod def command_set_relative_positioning(cls): return GcodeCommand("G91") diff --git a/src/octoprint/comm/protocol/reprap/util/__init__.py b/src/octoprint/comm/protocol/reprap/util/__init__.py index 1cab538c3..122fb22da 100644 --- a/src/octoprint/comm/protocol/reprap/util/__init__.py +++ b/src/octoprint/comm/protocol/reprap/util/__init__.py @@ -312,10 +312,12 @@ class TemperatureRecord(object): def __init__(self): self._tools = dict() self._bed = (None, None) + self._chamber = (None, None) def copy_from(self, other): self._tools = other.tools self._bed = other.bed + self._chamber = other.chamber def set_tool(self, tool, actual=None, target=None): current = self._tools.get(tool, (None, None)) @@ -325,6 +327,10 @@ class TemperatureRecord(object): current = self._bed self._bed = self._to_new_tuple(current, actual, target) + def set_chamber(self, actual=None, target=None): + current = self._chamber() + self._chamber = self._to_new_tuple(current, actual, target) + @property def tools(self): return dict(self._tools) @@ -333,6 +339,10 @@ class TemperatureRecord(object): def bed(self): return self._bed + @property + def chamber(self): + return self._chamber + def as_dict(self): result = dict() @@ -345,6 +355,10 @@ class TemperatureRecord(object): result["bed"] = dict(actual=bed[0], target=bed[1]) + chamber = self.chamber + result["chamber"] = dict(actual=chamber[0], + target=chamber[1]) + return result def as_script_dict(self): @@ -360,6 +374,10 @@ class TemperatureRecord(object): result["b"] = dict(actual=bed[0], target=bed[1]) + chamber = self.chamber + result["c"] = dict(actual=chamber[0], + target=chamber[1]) + return result @classmethod diff --git a/src/octoprint/environment.py b/src/octoprint/environment.py index e51328dfe..d1fb6dc56 100644 --- a/src/octoprint/environment.py +++ b/src/octoprint/environment.py @@ -25,10 +25,15 @@ class EnvironmentDetector(object): self._cache = None self._cache_lock = threading.RLock() - self._environment_plugins = self._plugin_manager.get_implementations(EnvironmentDetectionPlugin) - self._logger = logging.getLogger(__name__) + try: + self._environment_plugins = self._plugin_manager.get_implementations(EnvironmentDetectionPlugin) + except Exception: + # just in case, see #3100... + self._logger.exception("There was an error fetching EnvironmentDetectionPlugins from the plugin manager") + self._environment_plugins = [] + @property def environment(self): with self._cache_lock: @@ -120,7 +125,8 @@ class EnvironmentDetector(object): result[implementation._identifier] = additional except Exception: self._logger.exception("Error while fetching additional " - "environment data from plugin {}".format(implementation._identifier)) + "environment data from plugin {}".format(implementation._identifier), + extra=dict(plugin=implementation._identifier)) return result diff --git a/src/octoprint/events.py b/src/octoprint/events.py index efcbbe08b..b552e6a9c 100644 --- a/src/octoprint/events.py +++ b/src/octoprint/events.py @@ -186,8 +186,7 @@ class EventManager(object): octoprint.plugin.call_plugin(octoprint.plugin.types.EventHandlerPlugin, "on_event", - args=(event, payload), - initialized=True) + args=(event, payload)) self._logger.info("Event loop shut down") except Exception: self._logger.exception("Ooops, the event bus worker loop crashed") @@ -343,17 +342,24 @@ class CommandTrigger(GenericEventListener): self._logger.info("Disabled command trigger: {!r}".format(subscription)) continue - event = subscription["event"] + events = subscription["event"] command = subscription["command"] commandType = subscription["type"] debug = subscription["debug"] if "debug" in subscription else False - if event not in self._subscriptions: - self._subscriptions[event] = [] - self._subscriptions[event].append((command, commandType, debug)) + # "event" in the configuration can be a string, or + # a list of strings. If it's the former, convert it + # into the latter. + if not isinstance(events, (tuple, list, set)): + events = [events] - if event not in eventsToSubscribe: - eventsToSubscribe.append(event) + for event in events: + if event not in self._subscriptions: + self._subscriptions[event] = [] + self._subscriptions[event].append((command, commandType, debug)) + + if event not in eventsToSubscribe: + eventsToSubscribe.append(event) self.subscribe(eventsToSubscribe) @@ -373,9 +379,9 @@ class CommandTrigger(GenericEventListener): if isinstance(command, (tuple, list, set)): processedCommand = [] for c in command: - processedCommand.append(self._processCommand(c, payload)) + processedCommand.append(self._processCommand(c, event, payload)) else: - processedCommand = self._processCommand(command, payload) + processedCommand = self._processCommand(command, event, payload) self.executeCommand(processedCommand, commandType, debug=debug) except KeyError: self._logger.warning("There was an error processing one or more placeholders in the following command: %s" % command) @@ -424,13 +430,14 @@ class CommandTrigger(GenericEventListener): self._logger.info("Executing GCode commands: %r" % command) self._printer.commands(commands) - def _processCommand(self, command, payload): + def _processCommand(self, command, event, payload): """ Performs string substitutions in the command string based on a few current parameters. The following substitutions are currently supported: - {__currentZ} : current Z position of the print head, or -1 if not available + - {__eventname} : the name of the event hook being triggered - {__filename} : name of currently selected file, or "NO FILE" if no file is selected - {__filepath} : path in origin location of currently selected file, or "NO FILE" if no file is selected - {__fileorigin} : origin of currently selected file, or "NO FILE" if no file is selected @@ -453,6 +460,7 @@ class CommandTrigger(GenericEventListener): params = { "__currentZ": "-1", + "__eventname": event, "__filename": "NO FILE", "__filepath": "NO PATH", "__progress": "0", diff --git a/src/octoprint/filemanager/__init__.py b/src/octoprint/filemanager/__init__.py index 8111b065b..eade379cb 100644 --- a/src/octoprint/filemanager/__init__.py +++ b/src/octoprint/filemanager/__init__.py @@ -79,7 +79,9 @@ def full_extension_tree(): continue result = octoprint.util.dict_merge(result, plugin_result, leaf_merger=leaf_merger) except Exception: - logging.getLogger(__name__).exception("Exception while retrieving additional extension tree entries from SlicerPlugin {name}".format(name=plugin.key)) + logging.getLogger(__name__).exception("Exception while retrieving additional extension " + "tree entries from SlicerPlugin {name}".format(name=plugin._identifier), + extra=dict(plugin=plugin._identifier)) extension_tree_hooks = octoprint.plugin.plugin_manager().get_hooks("octoprint.filemanager.extension_tree") for name, hook in extension_tree_hooks.items(): @@ -89,7 +91,9 @@ def full_extension_tree(): continue result = octoprint.util.dict_merge(result, hook_result, leaf_merger=leaf_merger) except Exception: - logging.getLogger(__name__).exception("Exception while retrieving additional extension tree entries from hook {name}".format(name=name)) + logging.getLogger(__name__).exception("Exception while retrieving additional extension " + "tree entries from hook {name}".format(name=name), + extra=dict(plugin=name)) return result @@ -338,13 +342,13 @@ class FileManager(object): gcode_location=dest_location)) else: source_meta = self.get_metadata(source_location, source_path) - hash = source_meta["hash"] + hash = source_meta.get("hash", "n/a") import io links = [("model", dict(name=source_path))] _, stl_name = self.split_path(source_location, source_path) file_obj = StreamWrapper(os.path.basename(dest_path), - io.BytesIO(";Generated from {stl_name} {hash}\n".format(**locals()).encode("ascii", "replace")), + io.BytesIO(";Generated from {stl_name} (hash: {hash})\n".format(**locals()).encode("ascii", "replace")), io.FileIO(tmp_path, 'rb')) printer_profile = self._printer_profile_manager.get(printer_profile_id) @@ -352,7 +356,7 @@ class FileManager(object): display=display, links=links, allow_overwrite=True, printer_profile=printer_profile, analysis=_analysis) - end_time = time.time() + end_time = octoprint.util.monotonic_time() eventManager().fire(Events.SLICING_DONE, dict(stl=source_path, stl_location=source_location, gcode=dest_path, @@ -377,8 +381,7 @@ class FileManager(object): slicer = self._slicing_manager.get_slicer(slicer_name) - import time - start_time = time.time() + start_time = octoprint.util.monotonic_time() eventManager().fire(Events.SLICING_STARTED, {"stl": source_path, "stl_location": source_location, "gcode": dest_path, @@ -433,7 +436,8 @@ class FileManager(object): try: plugin.on_slicing_progress(slicer, source_location, source_path, dest_location, dest_path, progress) except Exception: - self._logger.exception("Exception while sending slicing progress to plugin %s" % plugin._identifier) + self._logger.exception("Exception while sending slicing progress to plugin %s" % plugin._identifier, + extra=dict(plugin=plugin._identifier)) import threading thread = threading.Thread(target=call_plugins, args=(slicer, source_location, source_path, dest_location, dest_path, progress_int)) @@ -468,11 +472,11 @@ class FileManager(object): if printer_profile is None: printer_profile = self._printer_profile_manager.get_current_or_default() - for hook in self._preprocessor_hooks.values(): + for name, hook in self._preprocessor_hooks.items(): try: hook_file_object = hook(path, file_object, links=links, printer_profile=printer_profile, allow_overwrite=allow_overwrite) except Exception: - self._logger.exception("Error when calling preprocessor hook {}, ignoring".format(hook)) + self._logger.exception("Error when calling preprocessor hook for plugin {}, ignoring".format(name), extra=dict(plugin=name)) continue if hook_file_object is not None: diff --git a/src/octoprint/filemanager/analysis.py b/src/octoprint/filemanager/analysis.py index 9aafaca9a..a23e1f0a0 100644 --- a/src/octoprint/filemanager/analysis.py +++ b/src/octoprint/filemanager/analysis.py @@ -18,6 +18,7 @@ import time from octoprint.events import Events, eventManager from octoprint.settings import settings +from octoprint.util import monotonic_time class QueueEntry(collections.namedtuple("QueueEntry", "name, path, type, location, absolute_path, printer_profile, analysis")): @@ -249,7 +250,7 @@ class AbstractAnalysisQueue(object): self._current_progress = 0 try: - start_time = time.time() + start_time = monotonic_time() self._logger.info("Starting analysis of {}".format(entry)) eventManager().fire(Events.METADATA_ANALYSIS_STARTED, {"name": entry.name, "path": entry.path, @@ -262,7 +263,7 @@ class AbstractAnalysisQueue(object): result = self._do_analysis(high_priority=high_priority) except TypeError: result = self._do_analysis() - self._logger.info("Analysis of entry {} finished, needed {:.2f}s".format(entry, time.time() - start_time)) + self._logger.info("Analysis of entry {} finished, needed {:.2f}s".format(entry, monotonic_time() - start_time)) self._finished_callback(self._current, result) finally: self._current = None diff --git a/src/octoprint/filemanager/storage/local.py b/src/octoprint/filemanager/storage/local.py index affc02234..ce5533064 100644 --- a/src/octoprint/filemanager/storage/local.py +++ b/src/octoprint/filemanager/storage/local.py @@ -1151,13 +1151,21 @@ class LocalFileStorage(Storage): except Exception: self._logger.exception("Error while reading .metadata.json from {path}".format(**locals())) + def valid_json(value): + try: + json.dumps(value, allow_nan=False) + return True + except: + return False + if isinstance(metadata, dict): old_size = len(metadata) + metadata = { k: v for k, v in metadata.items() if valid_json(v) } metadata = { k: v for k, v in metadata.items() if os.path.exists(os.path.join(path, k)) } new_size = len(metadata) if new_size != old_size: - self._logger.info("Deleted {} stale entries from metadata for path {}".format(old_size - new_size, - path)) + self._logger.info("Deleted {} stale or invalid entries from metadata for path {}".format(old_size - new_size, + path)) self._save_metadata(path, metadata) else: with self._get_metadata_lock(path): diff --git a/src/octoprint/logging/__init__.py b/src/octoprint/logging/__init__.py index 1e324038b..10dae37d7 100644 --- a/src/octoprint/logging/__init__.py +++ b/src/octoprint/logging/__init__.py @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from past.builtins import basestring +from past.builtins import basestring, unicode from octoprint.logging import handlers +from typing import Union + def log_to_handler(logger, handler, level, msg, exc_info=None, extra=None, *args): """ Logs to the provided handler only. @@ -139,13 +141,16 @@ def get_divider_line(c, message=None, length=78, indent=3): return c * indent + " " + message -def prefix_multilines(text, prefix=": "): +def prefix_multilines(text, prefix=u": "): + # type: (Union[unicode, bytes], unicode) -> unicode + from octoprint.util import to_unicode + lines = text.splitlines() if not lines: - return "" + return u"" if len(lines) == 1: - return lines[0] + return to_unicode(lines[0]) - return lines[0] + "\n" + "\n".join(map(lambda line: prefix + line, - lines[1:])) + return to_unicode(lines[0]) + u"\n" + u"\n".join(map(lambda line: prefix + to_unicode(line), + lines[1:])) diff --git a/src/octoprint/plugin/__init__.py b/src/octoprint/plugin/__init__.py index 1893c950f..c899e053a 100644 --- a/src/octoprint/plugin/__init__.py +++ b/src/octoprint/plugin/__init__.py @@ -201,8 +201,7 @@ def call_plugin(types, method, args=None, kwargs=None, callback=None, error_call error_callback (function): A callback to invoke after the call of an implementation resulted in an exception. Will be called with the three arguments ``name``, ``plugin`` and ``exc``. ``name`` will be the plugin identifier, ``plugin`` the plugin implementation instance itself and ``exc`` the caught exception. - initialized (boolean): Whether the plugin needs to be initialized (True) or not (False). Initialization status - is determined be presence of injected ``_identifier`` property. + initialized (boolean): Ignored. """ if not isinstance(types, (list, tuple)): @@ -216,7 +215,7 @@ def call_plugin(types, method, args=None, kwargs=None, callback=None, error_call plugins = plugin_manager().get_implementations(*types, sorting_context=sorting_context) for plugin in plugins: - if initialized and not hasattr(plugin, "_identifier"): + if not hasattr(plugin, "_identifier"): continue if hasattr(plugin, method): @@ -226,7 +225,7 @@ def call_plugin(types, method, args=None, kwargs=None, callback=None, error_call if callback: callback(plugin._identifier, plugin, result) except Exception as exc: - logger.exception("Error while calling plugin %s" % plugin._identifier) + logger.exception("Error while calling plugin %s" % plugin._identifier, extra=dict(plugin=plugin._identifier)) if error_callback: error_callback(plugin._identifier, plugin, exc) @@ -302,6 +301,17 @@ class PluginSettings(SubSettings): .. method:: set_boolean(path, value, force=False) Like :func:`set` but ensures the value is an ``boolean`` through attempted conversion before setting it. + + .. method:: save(force=False, trigger_event=False) + + Saves the settings to ``config.yaml`` if there are active changes. If ``force`` is set to ``True`` the settings + will be saved even if there are no changes. Settings ``trigger_event`` to ``True`` will cause a ``SettingsUpdated`` + :ref:`event ` to get triggered. + + :param force: Force saving to ``config.yaml`` even if there are no changes. + :type force: boolean + :param trigger_event: Trigger the ``SettingsUpdated`` :ref:`event ` on save. + :type trigger_event: boolean """ def __init__(self, settings, plugin_key, defaults=None, get_preprocessors=None, set_preprocessors=None): diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index cb6332d40..d625844ec 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -794,7 +794,7 @@ class UiPlugin(OctoPrintPlugin, SortablePlugin): def get_ui_custom_etag(self): """ Allows to use a custom way to calculate the ETag, instead of the default method (hashing - OctoPrint's version, current ``UI_API_KEY``, tracked file paths and ``LastModified`` value). + OctoPrint's version, tracked file paths and ``LastModified`` value). Returns: str: An alternatively calculated ETag value. Ignored if ``None`` is returned (default). @@ -1391,8 +1391,9 @@ class BlueprintPlugin(OctoPrintPlugin, RestartNeedingPlugin): # noinspection PyMethodMayBeStatic def is_blueprint_protected(self): """ - Whether a valid API key is needed to access the blueprint (the default) or not. Note that this only restricts - access to the blueprint's dynamic methods, static files are always accessible without API key. + Whether a login session is needed to access the blueprint if the forcelogin plugin is enabled or not. Requiring + a session is the default. Note that this only restricts access to the blueprint's dynamic methods, static files + are always accessible. """ return True diff --git a/src/octoprint/plugins/announcements/__init__.py b/src/octoprint/plugins/announcements/__init__.py index 2441b00e4..ad13b95be 100644 --- a/src/octoprint/plugins/announcements/__init__.py +++ b/src/octoprint/plugins/announcements/__init__.py @@ -25,7 +25,7 @@ from collections import OrderedDict from octoprint.access import ADMIN_GROUP from octoprint.access.permissions import Permissions from octoprint.server.util.flask import no_firstrun_access, with_revalidation_checking, check_etag -from octoprint.util import utmify, count +from octoprint.util import utmify, count, monotonic_time from flask_babel import gettext from octoprint import __version__ as OCTOPRINT_VERSION @@ -377,10 +377,10 @@ class AnnouncementPlugin(octoprint.plugin.AssetPlugin, url = config["url"] try: - start = time.time() + start = monotonic_time() r = requests.get(url, timeout=30) r.raise_for_status() - self._logger.info("Loaded channel {} from {} in {:.2}s".format(key, config["url"], time.time() - start)) + self._logger.info("Loaded channel {} from {} in {:.2}s".format(key, config["url"], monotonic_time() - start)) except Exception: self._logger.exception( "Could not fetch channel {} from {}".format(key, config["url"])) diff --git a/src/octoprint/plugins/appkeys/__init__.py b/src/octoprint/plugins/appkeys/__init__.py index 5912f02e7..63381ece5 100644 --- a/src/octoprint/plugins/appkeys/__init__.py +++ b/src/octoprint/plugins/appkeys/__init__.py @@ -361,7 +361,11 @@ class AppKeysPlugin(octoprint.plugin.AssetPlugin, with self._keys_lock: for user_id, data in self._keys.items(): if any(filter(lambda x: x.api_key == api_key, data)): - return self._user_manager.findUser(userid=user_id) + if self._user_manager.enabled: + return self._user_manager.findUser(userid=user_id) + elif user_id == "_admin" or user_id == "dummy": + # dummy = backwards compatible + return self._user_manager.anonymous_user_factory() return None def _api_keys_for_user(self, user_id): diff --git a/src/octoprint/plugins/backup/__init__.py b/src/octoprint/plugins/backup/__init__.py index 9b4d759b5..c424b8356 100644 --- a/src/octoprint/plugins/backup/__init__.py +++ b/src/octoprint/plugins/backup/__init__.py @@ -634,6 +634,9 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin, if exclude is None: exclude = [] + if "timelapse" in exclude: + exclude.append("timelapse_tmp") + configfile = settings._configfile basedir = settings._basedir diff --git a/src/octoprint/plugins/corewizard/static/js/corewizard.js b/src/octoprint/plugins/corewizard/static/js/corewizard.js index 1c8f41b7d..5f3dfa7d0 100644 --- a/src/octoprint/plugins/corewizard/static/js/corewizard.js +++ b/src/octoprint/plugins/corewizard/static/js/corewizard.js @@ -170,10 +170,6 @@ $(function() { return false; }; - self.onWizardPreventSettingsRefreshDialog = function() { - return self.active; - }; - self.onWizardDetails = function(response) { self.required = response && response.corewizard && response.corewizard.details && response.corewizard.details.onlinecheck && response.corewizard.details.onlinecheck.required; }; @@ -252,10 +248,6 @@ $(function() { return false; }; - self.onWizardPreventSettingsRefreshDialog = function() { - return self.active; - }; - self.onWizardDetails = function(response) { self.required = response && response.corewizard && response.corewizard.details && response.corewizard.details.pluginblacklist && response.corewizard.details.pluginblacklist.required; }; diff --git a/src/octoprint/plugins/discovery/__init__.py b/src/octoprint/plugins/discovery/__init__.py index 2b20cf577..e8d153f8e 100644 --- a/src/octoprint/plugins/discovery/__init__.py +++ b/src/octoprint/plugins/discovery/__init__.py @@ -569,9 +569,8 @@ class DiscoveryPlugin(octoprint.plugin.StartupPlugin, """ import socket - import time - if alive and self._ssdp_last_notify + self._ssdp_notify_timeout > time.time(): + if alive and self._ssdp_last_notify + self._ssdp_notify_timeout > octoprint.util.monotonic_time(): # we just sent an alive, no need to send another one now return @@ -610,7 +609,7 @@ class DiscoveryPlugin(octoprint.plugin.StartupPlugin, except Exception: pass - self._ssdp_last_notify = time.time() + self._ssdp_last_notify = octoprint.util.monotonic_time() def _ssdp_monitor(self, timeout=5): """ diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index 9203ad6d2..341adf66b 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -12,8 +12,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://827d1f11ccda4b31b924f29aaacab493@sentry.io/1373987" -SENTRY_URL_COREUI = "https://30bdc39d2248444c8bc01484f38c9444@sentry.io/1374096" +SENTRY_URL_SERVER = "https://4069187705ab4e76921eb19db2e9ccbb@sentry.io/1373987" +SENTRY_URL_COREUI = "https://a4ab48f27daf4c129392b78be15412b8@sentry.io/1374096" SETTINGS_DEFAULTS = dict(enabled=False, enabled_unreleased=False, @@ -21,6 +21,40 @@ SETTINGS_DEFAULTS = dict(enabled=False, url_server=SENTRY_URL_SERVER, url_coreui=SENTRY_URL_COREUI) +import serial +import requests.exceptions +import errno +import octoprint.util.avr_isp.ispBase +import tornado.websocket + +IGNORED_EXCEPTIONS = [ + # serial exceptions in octoprint.util.comm + (serial.SerialException, lambda exc, logger, plugin: logger == "octoprint.util.comm"), + + # isp errors during port auto detection in octoprint.util.comm + (octoprint.util.avr_isp.ispBase.IspError, lambda exc, logger, plugin: logger == "octoprint.util.comm"), + + # IOErrors of any kind due to a full file system + (IOError, lambda exc, logger, plugin: getattr(exc, "errno") and exc.errno in (getattr(errno, "ENOSPC"),)), + + # RequestExceptions of any kind + requests.exceptions.RequestException, + + # Tornado WebSocketErrors of any kind + tornado.websocket.WebSocketError +] + +try: + # noinspection PyUnresolvedReferences + from octoprint.plugins.backup import InsufficientSpace + + # if the backup plugin is enabled, ignore InsufficientSpace errors from it as well + IGNORED_EXCEPTIONS.append(InsufficientSpace) + + del InsufficientSpace +except ImportError: + pass + class ErrorTrackingPlugin(octoprint.plugin.SettingsPlugin, octoprint.plugin.AssetPlugin, @@ -94,13 +128,67 @@ def _enable_errortracking(): if _is_enabled(enabled, enabled_unreleased): import sentry_sdk + from octoprint.plugin import plugin_manager + + def _before_send(event, hint): + if not "exc_info" in hint: + # we only want exceptions + return None + + handled = True + logger = event.get("logger", "") + plugin = event.get("extra", dict()).get("plugin", None) + + for ignore in IGNORED_EXCEPTIONS: + if isinstance(ignore, tuple): + ignored_exc, matcher = ignore + else: + ignored_exc = ignore + matcher = lambda *args: True + + exc = hint["exc_info"][1] + if isinstance(exc, ignored_exc) and matcher(exc, logger, plugin): + # exception ignored for logger + return None + + elif isinstance(ignore, type): + if isinstance(hint["exc_info"][1], ignore): + # exception ignored + return None + + if event.get("exception") and event["exception"].get("values"): + handled = not any(map(lambda x: x.get("mechanism") and x["mechanism"].get("handled", True) == False, + event["exception"]["values"])) + + if handled: + # error is handled, restrict further based on logger + if logger != "" and not (logger.startswith("octoprint.") or logger.startswith("tornado.")): + # we only want errors logged by loggers octoprint.* or tornado.* + return None + + if logger.startswith("octoprint.plugins."): + plugin_id = logger.split(".")[2] + plugin_info = plugin_manager().get_plugin_info(plugin_id) + if plugin_info is None or not plugin_info.bundled: + # we only want our active bundled plugins + return None + + if plugin is not None: + plugin_info = plugin_manager().get_plugin_info(plugin) + if plugin_info is None or not plugin_info.bundled: + # we only want our active bundled plugins + return None + + return event + sentry_sdk.init(url_server, - release=version) + release=version, + before_send=_before_send) with sentry_sdk.configure_scope() as scope: scope.user = dict(id=unique_id) - logging.getLogger("octoprint.plugin.errortracking").info("Initialized error tracking") + logging.getLogger("octoprint.plugins.errortracking").info("Initialized error tracking") _enabled = True diff --git a/src/octoprint/plugins/errortracking/static/js/sentry.min.js b/src/octoprint/plugins/errortracking/static/js/sentry.min.js index e4979d05a..83bb176de 100644 --- a/src/octoprint/plugins/errortracking/static/js/sentry.min.js +++ b/src/octoprint/plugins/errortracking/static/js/sentry.min.js @@ -1,3 +1,2 @@ -/*! @sentry/browser 4.5.1 (6a390acf) | https://github.com/getsentry/sentry-javascript */ -var Sentry=function(t){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,n)};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,o,i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function l(){for(var t=[],e=0;e"}return t.event_id||""}function w(t){var e=b();if(!("console"in e))return t();var n=e.console,r={};["debug","info","warn","error","log"].forEach(function(t){t in e.console&&n[t].__sentry__&&(r[t]=n[t].__sentry_wrapped__,n[t]=n[t].__sentry_original__)});var o=t();return Object.keys(r).forEach(function(t){n[t]=r[t]}),o}function k(t,e){return void 0===e&&(e=0),0!==e&&g(t)?t.length<=e?t:t.substr(0,e)+"...":t}function O(t,e){if(!Array.isArray(t))return"";for(var n=[],r=0;rt.length)&&-1!==t.indexOf(e)}function T(t){return JSON.stringify(t,L({normalize:!1}))}function I(t,e,n){if(e in t&&!t[e].__sentry__){var r=t[e],o=n(r);o.__sentry__=!0,o.__sentry_original__=r,o.__sentry_wrapped__=o,t[e]=o}}(r=t.Severity||(t.Severity={})).Fatal="fatal",r.Error="error",r.Warning="warning",r.Log="log",r.Info="info",r.Debug="debug",r.Critical="critical",function(t){t.fromString=function(e){switch(e){case"debug":return t.Debug;case"info":return t.Info;case"warn":case"warning":return t.Warning;case"error":return t.Error;case"fatal":return t.Fatal;case"critical":return t.Critical;case"log":default:return t.Log}}}(t.Severity||(t.Severity={})),(o=t.Status||(t.Status={})).Unknown="unknown",o.Skipped="skipped",o.Success="success",o.RateLimit="rate_limit",o.Invalid="invalid",o.Failed="failed",function(t){t.fromHttpCode=function(e){return e>=200&&e<300?t.Success:429===e?t.RateLimit:e>=400&&e<500?t.Invalid:e>=500?t.Failed:t.Unknown}}(t.Status||(t.Status={}));var R=3,F=102400,C=40;function D(t){return function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(t))}function N(t){var e=Object.prototype.toString.call(t);return"string"==typeof t?k(t,40):"[object Object]"===e?"[Object]":"[object Array]"===e?"[Array]":P(t)}function M(t,e){if(0===e)return N(t);if(y(t)){var n={},r=t;return Object.keys(r).forEach(function(t){n[t]=M(r[t],e-1)}),n}return Array.isArray(t)?t.map(function(t){return M(t,e-1)}):N(t)}function U(t){for(var e=[],n=1;n")+"]":t}function L(t){void 0===t&&(t={normalize:!0});var e=[],n=[];return function(r,o){if(e.length>0){var i=e.indexOf(this);-1===i?(e.push(this),n.push(r)):(e.splice(i+1),n.splice(i,1/0,r)),-1!==e.indexOf(o)&&(o=function(t,r){return e[0]===r?"[Circular ~]":"[Circular ~."+n.slice(0,e.indexOf(r)).join(".")+"]"}.call(this,r,o))}else e.push(o);return t.normalize?P(o,r):o}}function A(t){try{return JSON.parse(JSON.stringify(t,L({normalize:!0})))}catch(t){return"**non-serializable**"}}var B=function(){function t(){this.notifyingListeners=!1,this.scopeListeners=[],this.eventProcessors=[],this.breadcrumbs=[],this.user={},this.tags={},this.extra={}}return t.prototype.addScopeListener=function(t){this.scopeListeners.push(t)},t.prototype.addEventProcessor=function(t){return this.eventProcessors.push(t),this},t.prototype.notifyScopeListeners=function(){var t=this;this.notifyingListeners||(this.notifyingListeners=!0,setTimeout(function(){t.scopeListeners.forEach(function(e){e(t)}),t.notifyingListeners=!1},0))},t.prototype.notifyEventProcessors=function(t,e){return s(this,void 0,void 0,function(){var n,r,o,s,c,p,f;return a(this,function(a){switch(a.label){case 0:o=t,a.label=1;case 1:a.trys.push([1,8,9,10]),s=u(l(H(),this.eventProcessors)),c=s.next(),a.label=2;case 2:if(c.done)return[3,7];p=c.value,a.label=3;case 3:return a.trys.push([3,5,,6]),[4,p(i({},o),e)];case 4:return null===(o=a.sent())?[2,null]:[3,6];case 5:return a.sent(),[3,6];case 6:return c=s.next(),[3,2];case 7:return[3,10];case 8:return f=a.sent(),n={error:f},[3,10];case 9:try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}return[7];case 10:return[2,o]}})})},t.prototype.setUser=function(t){return this.user=A(t),this.notifyScopeListeners(),this},t.prototype.setTag=function(t,e){var n;return this.tags=i({},this.tags,((n={})[t]=A(e),n)),this.notifyScopeListeners(),this},t.prototype.setExtra=function(t,e){var n;return this.extra=i({},this.extra,((n={})[t]=A(e),n)),this.notifyScopeListeners(),this},t.prototype.setFingerprint=function(t){return this.fingerprint=A(t),this.notifyScopeListeners(),this},t.prototype.setLevel=function(t){return this.level=A(t),this.notifyScopeListeners(),this},t.clone=function(e){var n=new t;return U(n,e,{scopeListeners:[]}),e&&(n.extra=U(e.extra),n.tags=U(e.tags),n.breadcrumbs=l(e.breadcrumbs),n.eventProcessors=l(e.eventProcessors)),n},t.prototype.clear=function(){this.breadcrumbs=[],this.tags={},this.extra={},this.user={},this.level=void 0,this.fingerprint=void 0,this.notifyScopeListeners()},t.prototype.addBreadcrumb=function(t,e){this.breadcrumbs=void 0!==e&&e>=0?l(this.breadcrumbs,[A(t)]).slice(-e):l(this.breadcrumbs,[A(t)]),this.notifyScopeListeners()},t.prototype.applyFingerprint=function(t){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],this.fingerprint?t.fingerprint=t.fingerprint.concat(this.fingerprint):t.message&&(t.fingerprint=t.fingerprint.concat(t.message)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint},t.prototype.applyToEvent=function(t,e,n){return s(this,void 0,void 0,function(){return a(this,function(r){return this.extra&&Object.keys(this.extra).length&&(t.extra=i({},this.extra,t.extra)),this.tags&&Object.keys(this.tags).length&&(t.tags=i({},this.tags,t.tags)),this.user&&Object.keys(this.user).length&&(t.user=i({},this.user,t.user)),this.level&&(t.level=this.level),this.applyFingerprint(t),(!t.breadcrumbs||0===t.breadcrumbs.length)&&this.breadcrumbs.length>0&&(t.breadcrumbs=void 0!==n&&n>=0?this.breadcrumbs.slice(-n):this.breadcrumbs),[2,this.notifyEventProcessors(t,e)]})})},t}();function H(){var t=b();return t.__SENTRY__=t.__SENTRY__||{},t.__SENTRY__.globalEventProcessors=t.__SENTRY__.globalEventProcessors||[],t.__SENTRY__.globalEventProcessors}function $(t){H().push(t)}var q=b(),W=new(function(){function t(){this.enabled=!1}return t.prototype.disable=function(){this.enabled=!1},t.prototype.enable=function(){this.enabled=!0},t.prototype.log=function(){for(var t=[],e=0;e0?t[t.length-1].scope:void 0,n=B.clone(e);return this.getStack().push({client:this.getClient(),scope:n}),n},t.prototype.popScope=function(){return void 0!==this.getStack().pop()},t.prototype.withScope=function(t){var e=this.pushScope();try{t(e)}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.stack},t.prototype.getStackTop=function(){return this.stack[this.stack.length-1]},t.prototype.captureException=function(t,e){var n=this._lastEventId=E();return this.invokeClientAsync("captureException",t,i({},e,{event_id:n})),n},t.prototype.captureMessage=function(t,e,n){var r=this._lastEventId=E();return this.invokeClientAsync("captureMessage",t,e,i({},n,{event_id:r})),r},t.prototype.captureEvent=function(t,e){var n=this._lastEventId=E();return this.invokeClientAsync("captureEvent",t,i({},e,{event_id:n})),n},t.prototype.lastEventId=function(){return this._lastEventId},t.prototype.addBreadcrumb=function(t,e){this.invokeClient("addBreadcrumb",t,i({},e))},t.prototype.configureScope=function(t){var e=this.getStackTop();e.scope&&e.client&&t(e.scope)},t.prototype.run=function(t){var e=z(this);try{t(this)}finally{z(e)}},t.prototype.getIntegration=function(t){try{return this.getClient().getIntegration(t)}catch(e){return W.warn("Cannot retrieve integration "+t.id+" from the current Hub"),null}},t}();function Y(){var t=b();return t.__SENTRY__=t.__SENTRY__||{hub:void 0},t}function z(t){var e=Y(),n=K(e);return Z(e,t),n}function X(){var t,e,n=Y();J(n)&&!K(n).isOlderThan(V)||Z(n,new G);try{var r=(t=module,e="domain",t.require(e)).active;if(!r)return K(n);if(!J(r)||K(r).isOlderThan(V)){var o=K(n).getStackTop();Z(r,new G(o.client,B.clone(o.scope)))}return K(r)}catch(t){return K(n)}}function J(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function K(t){return t&&t.__SENTRY__&&t.__SENTRY__.hub?t.__SENTRY__.hub:(t.__SENTRY__={},t.__SENTRY__.hub=new G,t.__SENTRY__.hub)}function Z(t,e){return!!t&&(t.__SENTRY__=t.__SENTRY__||{},t.__SENTRY__.hub=e,!0)}function Q(t){for(var e=[],n=1;n1&&(p=h.slice(0,-1).join("/"),f=h.pop()),U(this,{host:a,pass:s,path:p,projectId:f,port:l,protocol:r,user:o})},t.prototype.fromComponents=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.validate=function(){var t,e;try{for(var n=u(["protocol","user","host","projectId"]),r=n.next();!r.done;r=n.next()){var o=r.value;if(!this[o])throw new et("Invalid Dsn: Missing "+o)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}if("http"!==this.protocol&&"https"!==this.protocol)throw new et('Invalid Dsn: Unsupported protocol "'+this.protocol+'"');if(this.port&&m(parseInt(this.port,10)))throw new et('Invalid Dsn: Invalid port number "'+this.port+'"')},t}(),ot=function(){function t(t){this.dsn=t,this.dsnObject=new rt(t)}return t.prototype.getDsn=function(){return this.dsnObject},t.prototype.getStoreEndpoint=function(){return""+this.getBaseUrl()+this.getStoreEndpointPath()},t.prototype.getStoreEndpointWithUrlEncodedAuth=function(){var t,e={sentry_key:this.dsnObject.user,sentry_version:"7"};return this.getStoreEndpoint()+"?"+(t=e,Object.keys(t).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])}).join("&"))},t.prototype.getBaseUrl=function(){var t=this.dsnObject,e=t.protocol?t.protocol+":":"",n=t.port?":"+t.port:"";return e+"//"+t.host+n},t.prototype.getStoreEndpointPath=function(){var t=this.dsnObject;return(t.path?"/"+t.path:"")+"/api/"+t.projectId+"/store/"},t.prototype.getRequestHeaders=function(t,e){var n=this.dsnObject,r=["Sentry sentry_version=7"];return r.push("sentry_timestamp="+(new Date).getTime()),r.push("sentry_client="+t+"/"+e),r.push("sentry_key="+n.user),n.pass&&r.push("sentry_secret="+n.pass),{"Content-Type":"application/json","X-Sentry-Auth":r.join(", ")}},t.prototype.getReportDialogEndpoint=function(t){void 0===t&&(t={});var e=this.dsnObject,n=this.getBaseUrl()+(e.path?"/"+e.path:"")+"/api/embed/error-page/",r=[];for(var o in r.push("dsn="+e.toString()),t)if("user"===o){if(!t.user)continue;t.user.name&&r.push("name="+encodeURIComponent(t.user.name)),t.user.email&&r.push("email="+encodeURIComponent(t.user.email))}else r.push(encodeURIComponent(o)+"="+encodeURIComponent(t[o]));return r.length?n+"?"+r.join("&"):n},t}();var it=[];function st(t){var e={};return function(t){var e,n,r,o,i=t.defaultIntegrations&&l(t.defaultIntegrations)||[],s=t.integrations,a=[];if(Array.isArray(s)){var c=s.map(function(t){return t.name}),p=[];try{for(var f=u(i),h=f.next();!h.done;h=f.next()){var d=h.value;-1===c.indexOf(at(d))&&-1===p.indexOf(at(d))&&(a.push(d),p.push(at(d)))}}catch(t){e={error:t}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(e)throw e.error}}try{for(var v=u(s),g=v.next();!g.done;g=v.next()){var y=g.value;-1===p.indexOf(at(y))&&(a.push(y),p.push(at(y)))}}catch(t){r={error:t}}finally{try{g&&!g.done&&(o=v.return)&&o.call(v)}finally{if(r)throw r.error}}}else{if("function"!=typeof s)return l(i);a=s(i),a=Array.isArray(a)?a:[a]}return a}(t).forEach(function(n){e[at(n)]=n,function(t,e){if(-1===it.indexOf(at(t))){try{t.setupOnce()}catch(n){t.install&&(W.warn("Integration "+at(t)+': The install method is deprecated. Use "setupOnce".'),t.install(e))}it.push(at(t)),W.log("Integration installed: "+at(t))}}(n,t)}),e}function at(t){return t.constructor.id||t.name}var ut,ct=function(){function t(t){this.limit=t,this.buffer=[]}return t.prototype.isReady=function(){return void 0===this.limit||this.length()0&&n(!1)},t);Promise.all(e.buffer).then(function(){clearTimeout(r),n(!0)}).catch(function(){n(!0)})})]})})},t}(),lt=function(){function e(t,e){this.buffer=new ct,this.backend=new t(e),this.options=e,e.dsn&&(this.dsn=new rt(e.dsn)),this.integrations=st(this.options)}return e.prototype.install=function(){if(!this.isEnabled())return this.installed=!1;var t=this.getBackend();return!this.installed&&t.install&&t.install(),this.installed=!0},e.prototype.captureException=function(t,e,n){return s(this,void 0,void 0,function(){var r=this;return a(this,function(o){return[2,this.buffer.add(s(r,void 0,void 0,function(){var r;return a(this,function(o){switch(o.label){case 0:return[4,this.getBackend().eventFromException(t,e)];case 1:return r=o.sent(),[2,this.captureEvent(r,e,n)]}})}))]})})},e.prototype.captureMessage=function(t,e,n,r){return s(this,void 0,void 0,function(){var o=this;return a(this,function(i){return[2,this.buffer.add(s(o,void 0,void 0,function(){var o,i;return a(this,function(s){switch(s.label){case 0:return null===(a=t)||"object"!=typeof a&&"function"!=typeof a?[4,this.getBackend().eventFromMessage(""+t,e,n)]:[3,2];case 1:return i=s.sent(),[3,4];case 2:return[4,this.getBackend().eventFromException(t,n)];case 3:i=s.sent(),s.label=4;case 4:return o=i,[2,this.captureEvent(o,n,r)]}var a})}))]})})},e.prototype.captureEvent=function(t,e,n){return s(this,void 0,void 0,function(){var r=this;return a(this,function(o){return[2,this.buffer.add(s(r,void 0,void 0,function(){var r=this;return a(this,function(o){return[2,this.processEvent(t,function(t){return s(r,void 0,void 0,function(){return a(this,function(e){return[2,this.getBackend().sendEvent(t)]})})},e,n)]})}))]})})},e.prototype.addBreadcrumb=function(t,e,n){var r=this.getOptions(),o=r.beforeBreadcrumb,s=r.maxBreadcrumbs,a=void 0===s?30:s;if(!(a<=0)){var u=(new Date).getTime()/1e3,c=i({timestamp:u},t),l=o?w(function(){return o(c,e)}):c;null!==l&&this.getBackend().storeBreadcrumb(l)&&n&&n.addBreadcrumb(l,Math.min(a,100))}},e.prototype.getDsn=function(){return this.dsn},e.prototype.getOptions=function(){return this.options},e.prototype.getBackend=function(){return this.backend},e.prototype.isEnabled=function(){return!1!==this.getOptions().enabled&&void 0!==this.dsn},e.prototype.prepareEvent=function(t,e,n){return s(this,void 0,void 0,function(){var r,o,s,u,c,l,p,f,h;return a(this,function(a){return r=this.getOptions(),o=r.environment,s=r.maxBreadcrumbs,u=void 0===s?30:s,c=r.release,l=r.dist,void 0===(p=i({},t)).environment&&void 0!==o&&(p.environment=o),void 0===p.release&&void 0!==c&&(p.release=c),void 0===p.dist&&void 0!==l&&(p.dist=l),p.message&&(p.message=k(p.message,250)),(f=p.exception&&p.exception.values&&p.exception.values[0])&&f.value&&(f.value=k(f.value,250)),(h=p.request)&&h.url&&(h.url=k(h.url,250)),void 0===p.event_id&&(p.event_id=E()),e?[2,e.applyToEvent(p,n,Math.min(u,100))]:[2,p]})})},e.prototype.processEvent=function(e,n,r,o){return s(this,void 0,void 0,function(){var i,s,u,c,l,p,f,h;return a(this,function(a){switch(a.label){case 0:return this.isEnabled()?(i=this.getOptions(),s=i.beforeSend,"number"==typeof(u=i.sampleRate)&&Math.random()>u?[2,{status:t.Status.Skipped}]:[4,this.prepareEvent(e,o,r)]):[2,{status:t.Status.Skipped}];case 1:if(null===(c=a.sent()))return[2,{status:t.Status.Skipped}];l=c,a.label=2;case 2:return a.trys.push([2,5,,6]),r&&r.data&&!0===r.data.__sentry__||!s?[3,4]:[4,s(c,r)];case 3:void 0===(l=a.sent())&&W.error("`beforeSend` method has to return `null` or a valid event"),a.label=4;case 4:return[3,6];case 5:return p=a.sent(),this.captureException(p,{data:{__sentry__:!0},originalException:p}).catch(function(t){console.error(t)}),[2,{reason:"Event processing in beforeSend method threw an exception",status:t.Status.Invalid}];case 6:if(null===l)return[2,{reason:"Event dropped due to being discarded by beforeSend method",status:t.Status.Skipped}];a.label=7;case 7:return a.trys.push([7,9,,10]),[4,n(l)];case 8:return(f=a.sent()).event=l,f.status,t.Status.RateLimit,[2,f];case 9:return h=a.sent(),W.error(""+h),[2,{reason:""+h,status:t.Status.Failed}];case 10:return[2]}})})},e.prototype.close=function(t){return s(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,Promise.all([this.getBackend().getTransport().close(t),this.buffer.drain(t)])];case 1:return[2,e.sent().reduce(function(t,e){return t&&e})]}})})},e.prototype.getIntegrations=function(){return this.integrations||{}},e.prototype.getIntegration=function(t){try{return this.integrations[t.id]||null}catch(e){return W.warn("Cannot retrieve integration "+t.id+" from the current Client"),null}},e}(),pt=function(){function e(){}return e.prototype.sendEvent=function(e){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,Promise.resolve({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:t.Status.Skipped})]})})},e.prototype.close=function(t){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,Promise.resolve(!0)]})})},e}(),ft=function(){function t(t){this.options=t,this.options.dsn||W.warn("No DSN provided, backend will not do anything."),this.transport=this.setupTransport()}return t.prototype.setupTransport=function(){return new pt},t.prototype.eventFromException=function(t,e){return s(this,void 0,void 0,function(){return a(this,function(t){throw new et("Backend has to implement `eventFromException` method")})})},t.prototype.eventFromMessage=function(t,e,n){return s(this,void 0,void 0,function(){return a(this,function(t){throw new et("Backend has to implement `eventFromMessage` method")})})},t.prototype.sendEvent=function(t){return s(this,void 0,void 0,function(){return a(this,function(e){return this.transport.captureEvent?[2,this.transport.captureEvent(t)]:[2,this.transport.sendEvent(T(t))]})})},t.prototype.storeBreadcrumb=function(t){return!0},t.prototype.storeScope=function(t){},t.prototype.getTransport=function(){return this.transport},t}();!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Debug=2]="Debug",t[t.Verbose=3]="Verbose"}(ut||(ut={}));var ht,dt=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(){var e=this;$(function(n){return s(e,void 0,void 0,function(){var e;return a(this,function(r){if(e=X().getIntegration(t)){try{if(e.shouldDropEvent(n,e.previousEvent))return[2,null]}catch(t){return[2,e.previousEvent=n]}return[2,e.previousEvent=n]}return[2,n]})})})},t.prototype.shouldDropEvent=function(t,e){return!!e&&(this.isSameMessageEvent(t,e)?(W.warn("Event dropped due to being a duplicate of previous event (same message).\nEvent: "+S(t)),!0):!!this.isSameExceptionEvent(t,e)&&(W.warn("Event dropped due to being a duplicate of previous event (same exception).\nEvent: "+S(t)),!0))},t.prototype.isSameMessageEvent=function(t,e){var n=t.message,r=e.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!this.isSameFingerprint(t,e)&&!!this.isSameStacktrace(t,e))))},t.prototype.getFramesFromEvent=function(t){var e=t.exception;if(!e)return t.stacktrace?t.stacktrace.frames:void 0;try{return e.values[0].stacktrace.frames}catch(t){return}},t.prototype.isSameStacktrace=function(t,e){var n=this.getFramesFromEvent(t),r=this.getFramesFromEvent(e);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(n=n,(r=r).length!==n.length)return!1;for(var o=0;o ".length;n&&i++<5&&!("html"===(e=o(n))||i>1&&s+r.length*a+e.length>=80);)r.push(e),s+=e.length,n=n.parentNode;return r.reverse().join(" > ")},e.htmlElementAsString=o,e.parseUrl=function(t){if(!t)return{};var e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};var n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+r}},e.getEventDescription=function(t){if(t.message)return t.message;if(t.exception&&t.exception.values&&t.exception.values[0]){var e=t.exception.values[0];return e.type&&e.value?e.type+": "+e.value:e.type||e.value||t.event_id||""}return t.event_id||""},e.consoleSandbox=function(t){var e=r();if(!("console"in e))return t();var n=e.console,o={};["debug","info","warn","error","log"].forEach(function(t){t in e.console&&n[t].__sentry__&&(o[t]=n[t].__sentry_wrapped__,n[t]=n[t].__sentry_original__)});var i=t();return Object.keys(o).forEach(function(t){n[t]=o[t]}),i}});Et(St);St.dynamicRequire,St.isNodeEnv,St.getGlobalObject,St.uuid4,St.htmlTreeAsString,St.htmlElementAsString,St.parseUrl,St.getEventDescription,St.consoleSandbox;var wt=xt(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=St.getGlobalObject(),r=new(function(){function t(){this.enabled=!1}return t.prototype.disable=function(){this.enabled=!1},t.prototype.enable=function(){this.enabled=!0},t.prototype.log=function(){for(var t=[],e=0;e=-1&&!r;o--){var i=o>=0?t[o]:"/";i&&(n=i+"/"+n,r="/"===i.charAt(0))}return n=function(t,e){for(var n=0,r=t.length-1;r>=0;r--){var o=t[r];"."===o?t.splice(r,1):".."===o?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}(n.split("/").filter(function(t){return!!t}),!r).join("/"),(r?"/":"")+n||"."}function Rt(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}function Ft(t,e){var n,r,o=(n=t,r=Tt.exec(n),r?r.slice(1):[])[2];return e&&o.substr(-1*e.length)===e&&(o=o.substr(0,o.length-e.length)),o}var Ct=function(){function t(e){void 0===e&&(e={});var n=this;this.name=t.id,this.iteratee=function(t){return s(n,void 0,void 0,function(){var e;return a(this,function(n){return t.filename&&t.filename.startsWith("/")&&(e=this.root?function(t,e){t=It(t).substr(1),e=It(e).substr(1);for(var n=Rt(t.split("/")),r=Rt(e.split("/")),o=Math.min(n.length,r.length),i=o,s=0;s>16)+(e>>16)+(n>>16)<<16|65535&n}function Pt(t,e,n,r,o,i){return Ut((s=Ut(Ut(e,t),Ut(r,i)))<<(a=o)|s>>>32-a,n);var s,a}function Lt(t,e,n,r,o,i,s){return Pt(e&n|~e&r,t,e,o,i,s)}function At(t,e,n,r,o,i,s){return Pt(e&r|n&~r,t,e,o,i,s)}function Bt(t,e,n,r,o,i,s){return Pt(e^n^r,t,e,o,i,s)}function Ht(t,e,n,r,o,i,s){return Pt(n^(e|~r),t,e,o,i,s)}function $t(t,e){var n,r,o,i,s;t[e>>5]|=128<>>9<<4)]=e;var a=1732584193,u=-271733879,c=-1732584194,l=271733878;for(n=0;n>5]>>>e%32&255);return n}function Wt(t){var e,n=[];for(n[(t.length>>2)-1]=void 0,e=0;e>5]|=(255&t.charCodeAt(e/8))<>>4&15)+"0123456789abcdef".charAt(15&e);return r}function Gt(t){return unescape(encodeURIComponent(t))}function Yt(t){return function(t){return qt($t(Wt(t),8*t.length))}(Gt(t))}function zt(t,e){return function(t,e){var n,r,o=Wt(t),i=[],s=[];for(i[15]=s[15]=void 0,o.length>16&&(o=$t(o,8*t.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],s[n]=1549556828^o[n];return r=$t(i.concat(Wt(e)),512+8*e.length),qt($t(s.concat(r),640))}(Gt(t),Gt(e))}function Xt(t,e,n){return e?n?zt(e,t):Vt(zt(e,t)):n?Yt(t):Vt(Yt(t))}var Jt=b(),Kt={wrap:function(){return function(){}},report:!1,collectWindowErrors:!1,computeStackTrace:!1,remoteFetching:!1,linesOfContext:!1,extendToAsynchronousCallbacks:!1},Zt=[].slice,Qt="?",te=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function ee(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ne(){return"undefined"==typeof document||null==document.location?"":document.location.href}Kt.wrap=function(t){return function(){try{return t.apply(this,arguments)}catch(t){throw Kt.report(t),t}}},Kt.report=function(){var t,e,n,r,o=[],s=null,a=null;function u(t,e,n){var r=null;if(!e||Kt.collectWindowErrors){for(var i in o)if(ee(o,i))try{o[i](t,e,n)}catch(t){r=t}if(r)throw r}}function c(e,n,r,o,s){var c=null;if(s=f(s)?s.error:s,e=f(e)?e.message:e,a)Kt.computeStackTrace.augmentStackTraceWithInitialElement(a,n,r,e),h();else if(s&&p(s))(c=Kt.computeStackTrace(s)).mechanism="onerror",u(c,!0,s);else{var l,d={url:n,line:r,column:o},v=e;if("[object String]"==={}.toString.call(e)){var g=e.match(te);g&&(l=g[1],v=g[2])}d.func=Kt.computeStackTrace.guessFunctionName(d.url,d.line),d.context=Kt.computeStackTrace.gatherContext(d.url,d.line),u(c={name:l,message:v,mode:"onerror",mechanism:"onerror",stack:[i({},d,{url:d.url||ne()})]},!0,null)}return!!t&&t.apply(this,arguments)}function l(t){var e=t&&(t.detail?t.detail.reason:t.reason)||t,n=Kt.computeStackTrace(e);n.mechanism="onunhandledrejection",u(n,!0,e)}function h(){var t=a,e=s;a=null,s=null,u(t,!1,e)}function d(t){if(a){if(s===t)return;h()}var e=Kt.computeStackTrace(t);throw a=e,s=t,setTimeout(function(){s===t&&h()},e.incomplete?2e3:0),t}return d.subscribe=function(t){o.push(t)},d.unsubscribe=function(i){for(var s=o.length-1;s>=0;--s)o[s]===i&&o.splice(s,1);0===o.length&&(e&&(Jt.onerror=t,e=!1),r&&(Jt.onunhandledrejection=n,r=!1))},d.installGlobalHandler=function(){!0!==e&&(t=Jt.onerror,Jt.onerror=c,e=!0)},d.installGlobalUnhandledRejectionHandler=function(){!0!==r&&(n=Jt.onunhandledrejection,Jt.onunhandledrejection=l,r=!0)},d}(),Kt.computeStackTrace=function(){var t=!1,e={};function n(t){if("string"!=typeof t)return[];if(!ee(e,t)){var n="",r="";try{r=Jt.document.domain}catch(t){}var o=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(t);o&&o[2]===r&&(n=function(t){if(!Kt.remoteFetching)return"";try{var e=function(){try{return new Jt.XMLHttpRequest}catch(t){return new Jt.ActiveXObject("Microsoft.XMLHTTP")}}();return e.open("GET",t,!1),e.send(""),e.responseText}catch(t){return""}}(t)),e[t]=n?n.split("\n"):[]}return e[t]}function r(t,e){var r,o=/function ([^(]*)\(([^)]*)\)/,i=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,s="",a=n(t);if(!a.length)return Qt;for(var u=0;u<10;++u)if(!d(s=a[e-u]+s)){if(r=i.exec(s))return r[1];if(r=o.exec(s))return r[1]}return Qt}function o(t,e){var r=n(t);if(!r.length)return null;var o=[],i=Math.floor(Kt.linesOfContext/2),s=i+Kt.linesOfContext%2,a=Math.max(0,e-i-1),u=Math.min(r.length,e+s-1);e-=1;for(var c=a;c0?o:null}function i(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function s(t){return i(t).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function a(t,e){for(var r,o,i=0,s=e.length;ir&&(o=a.exec(s[r]))?o.index:null}function c(t){if(!d(Jt&&Jt.document)){for(var e,n,r,o,u=[ne()],c=Jt.document.getElementsByTagName("script"),l=""+t,p=0;p|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,c=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,l=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,p=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=t.stack.split("\n"),h=[],v=/^(.*) is undefined$/.exec(t.message),g=0,y=f.length;g eval")>-1&&(e=l.exec(n[3]))?n[3]=e[1]:0!==g||n[5]||d(t.columnNumber)||(h[0].column=t.columnNumber+1),i={url:n[3],func:n[1]||Qt,args:n[2]?n[2].split(","):[],line:n[4]?+n[4]:null,column:n[5]?+n[5]:null}}if(!i.func&&i.line&&(i.func=r(i.url,i.line)),Kt.remoteFetching&&i.url&&"blob:"===i.url.substr(0,5)){var b=new XMLHttpRequest;if(b.open("GET",i.url,!1),b.send(""),200===b.status){var E=b.responseText||"",x=(E=E.slice(-300)).match(/\/\/# sourceMappingURL=(.*)$/);if(x){var _=x[1];"~"===_.charAt(0)&&(_=("undefined"==typeof document||null==document.location?"":document.location.origin?document.location.origin:document.location.protocol+"//"+document.location.hostname+(document.location.port?":"+document.location.port:""))+_.slice(1)),i.url=_.slice(0,-4)}}}i.context=i.line?o(i.url,i.line):null,h.push(i)}return h.length?(h[0]&&h[0].line&&!h[0].column&&v&&(h[0].column=u(v[1],h[0].url,h[0].line)),{mode:"stack",name:t.name,message:t.message,stack:h}):null}function p(t,e,n,i){var s={url:e,line:n};if(s.url&&s.line){t.incomplete=!1,s.func||(s.func=r(s.url,s.line)),s.context||(s.context=o(s.url,s.line));var a=/ '([^']+)' /.exec(i);if(a&&(s.column=u(a[1],s.url,s.line)),t.stack.length>0&&t.stack[0].url===s.url){if(t.stack[0].line===s.line)return!1;if(!t.stack[0].line&&t.stack[0].func===s.func)return t.stack[0].line=s.line,t.stack[0].context=s.context,!1}return t.stack.unshift(s),t.partial=!0,!0}return t.incomplete=!0,!1}function f(t,e){for(var n,o,i,s=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,a=[],l={},d=!1,v=f.caller;v&&!d;v=v.caller)if(v!==h&&v!==Kt.report){if(o={url:null,func:Qt,args:[],line:null,column:null},v.name?o.func=v.name:(n=s.exec(v.toString()))&&(o.func=n[1]),void 0===o.func)try{o.func=n.input.substring(0,n.input.indexOf("{"))}catch(t){}if(i=c(v)){o.url=i.url,o.line=i.line,o.func===Qt&&(o.func=r(o.url,o.line));var g=/ '([^']+)' /.exec(t.message||t.description);g&&(o.column=u(g[1],i.url,i.line))}l[""+v]?d=!0:l[""+v]=!0,a.push(o)}e&&a.splice(0,e);var y={mode:"callers",name:t.name,message:t.message,stack:a};return p(y,t.sourceURL||t.fileName,t.line||t.lineNumber,t.message||t.description),y}function h(e,i){var u=null;i=null==i?0:+i;try{if(u=function(t){var e=t.stacktrace;if(e){for(var n,i=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,s=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,a=e.split("\n"),u=[],c=0;c=0&&(g.line=y+b.substring(0,E).split("\n").length)}}}else if(i=l.exec(e[v])){var x=ne().replace(/#.*$/,""),_=a(new RegExp(s(e[v+1])),[x]);g={url:x,func:"",args:[],line:_?_.line:i[1],column:null}}if(g){g.func||(g.func=r(g.url,g.line));var S=o(g.url,g.line),w=S?S[Math.floor(S.length/2)]:null;S&&w.replace(/^\s*/,"")===e[v+1].replace(/^\s*/,"")?g.context=S:g.context=[e[v+1]],p.push(g)}}return p.length?{mode:"multiline",name:t.name,message:e[0],stack:p}:null}(e))return u}catch(e){if(t)throw e}try{if(u=f(e,i+1))return u}catch(e){if(t)throw e}return{name:e.name,message:e.message,mode:"failed"}}return h.augmentStackTraceWithInitialElement=p,h.computeStackTraceFromStackProp=l,h.guessFunctionName=r,h.gatherContext=o,h.ofCaller=function(t){t=1+(null==t?0:+t);try{throw new Error}catch(e){return h(e,t+1)}},h.getSource=n,h}(),Kt.extendToAsynchronousCallbacks=function(){var t=function(t){var e=Jt[t];Jt[t]=function(){var t=Zt.call(arguments),n=t[0];return"function"==typeof n&&(t[0]=Kt.wrap(n)),e.apply?e.apply(this,t):e(t[0],t[1])}};t("setTimeout"),t("setInterval")},Kt.remoteFetching=!1,Kt.collectWindowErrors=!0,Kt.linesOfContext=11;var re=Kt.report.subscribe,oe=Kt.report.installGlobalHandler,ie=Kt.report.installGlobalUnhandledRejectionHandler,se=Kt.computeStackTrace,ae=50;function ue(t){var e={stacktrace:{frames:pe(t.stack)},type:t.name,value:t.message};return void 0===e.type&&""===e.value&&(e.value="Unrecoverable error caught"),e}function ce(t,e){var n=Object.keys(t).sort(),r={extra:{__serialized__:function t(e,n,r){void 0===n&&(n=R),void 0===r&&(r=F);var o=M(e,n);return D(T(o))>r?t(e,n-1):o}(t)},fingerprint:[Xt(n.join(""))],message:"Non-Error exception captured with keys: "+function(t,e){if(void 0===e&&(e=C),!t.length)return"[object has no keys]";if(t[0].length>=e)return k(t[0],e);for(var n=t.length;n>0;n--){var r=t.slice(0,n).join(", ");if(!(r.length>e))return n===t.length?r:k(r,e)}return""}(n)};if(e){var o=pe(se(e).stack);r.stacktrace={frames:o}}return r}function le(t){return{exception:{values:[ue(t)]}}}function pe(t){if(!t||!t.length)return[];var e=t,n=e[0].func||"",r=e[e.length-1].func||"";return(j(n,"captureMessage")||j(n,"captureException"))&&(e=e.slice(1)),j(r,"sentryWrapped")&&(e=e.slice(0,-1)),e.map(function(t){return{colno:t.column,filename:t.url||e[0].url,function:t.func||"?",in_app:!0,lineno:t.line}}).slice(0,ae).reverse()}function fe(t,e){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||e,t.exception.values[0].type=t.exception.values[0].type||"Error"}var he,de,ve=function(){function t(t){this.options=t,this.buffer=new ct(30),this.url=new ot(this.options.dsn).getStoreEndpointWithUrlEncodedAuth()}return t.prototype.sendEvent=function(t){return s(this,void 0,void 0,function(){return a(this,function(t){throw new et("Transport Class has to implement `sendEvent` method")})})},t.prototype.close=function(t){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,this.buffer.drain(t)]})})},t}(),ge=b(),ye=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.sendEvent=function(e){return s(this,void 0,void 0,function(){var n;return a(this,function(r){return n={body:e,method:"POST",referrerPolicy:function(){if(!Nt())return!1;try{return new Request("pickleRick",{referrerPolicy:"origin"}),!0}catch(t){return!1}}()?"origin":""},[2,this.buffer.add(ge.fetch(this.url,n).then(function(e){return{status:t.Status.fromHttpCode(e.status)}}))]})})},r}(ve),me=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.sendEvent=function(e){return s(this,void 0,void 0,function(){var n=this;return a(this,function(r){return[2,this.buffer.add(new Promise(function(r,o){var i=new XMLHttpRequest;i.onreadystatechange=function(){4===i.readyState&&(200===i.status&&r({status:t.Status.fromHttpCode(i.status)}),o(i))},i.open("POST",n.url),i.send(e)}))]})})},r}(ve),be=b(),Ee=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.sendEvent=function(e){return s(this,void 0,void 0,function(){var n;return a(this,function(r){return n=be.navigator.sendBeacon(this.url,e),[2,this.buffer.add(Promise.resolve({status:n?t.Status.Success:t.Status.Failed}))]})})},r}(ve),xe=Object.freeze({BaseTransport:ve,FetchTransport:ye,XHRTransport:me,BeaconTransport:Ee}),_e=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.install=function(){if(!this.options.dsn)throw new et("Invariant exception: install() must not be called when disabled");return Error.stackTraceLimit=50,!0},r.prototype.setupTransport=function(){if(!this.options.dsn)return e.prototype.setupTransport.call(this);var t=this.options.transportOptions?this.options.transportOptions:{dsn:this.options.dsn};return this.options.transport?new this.options.transport(t):Mt()?new Ee(t):Nt()?new ye(t):new me(t)},r.prototype.eventFromException=function(t,e){return s(this,void 0,void 0,function(){var n,r,o,s;return a(this,function(a){switch(a.label){case 0:return f(t)&&t.error?(t=(s=t).error,n=le(se(t)),[3,7]):[3,1];case 1:return h(t)||(u=t,"[object DOMException]"===Object.prototype.toString.call(u))?(r=(s=t).name||(h(s)?"DOMError":"DOMException"),o=s.message?r+": "+s.message:r,[4,this.eventFromMessage(o,void 0,e)]):[3,3];case 2:return fe(n=a.sent(),o),[3,7];case 3:return p(t)?(n=le(se(t)),[3,7]):[3,4];case 4:return y(t)&&e&&e.syntheticException?(fe(n=ce(s=t,e.syntheticException),"Custom Object"),[3,7]):[3,5];case 5:return s=t,[4,this.eventFromMessage(s,void 0,e)];case 6:fe(n=a.sent(),""+s),a.label=7;case 7:return[2,n=i({},n,{event_id:e&&e.event_id,exception:i({},n.exception,{mechanism:{handled:!0,type:"generic"}})})]}var u})})},r.prototype.eventFromMessage=function(e,n,r){return void 0===n&&(n=t.Severity.Info),s(this,void 0,void 0,function(){var t,o,i;return a(this,function(s){return t={event_id:r&&r.event_id,level:n,message:e},this.options.attachStacktrace&&r&&r.syntheticException&&(o=se(r.syntheticException),i=pe(o.stack),t.stacktrace={frames:i}),[2,t]})})},r}(ft),Se="sentry.javascript.browser",we=function(t){function e(e){return t.call(this,_e,e)||this}return n(e,t),e.prototype.prepareEvent=function(e,n,r){return s(this,void 0,void 0,function(){return a(this,function(o){return e.platform=e.platform||"javascript",e.sdk=i({},e.sdk,{name:Se,packages:l(e.sdk&&e.sdk.packages||[],[{name:"npm:@sentry/browser",version:"4.5.1"}]),version:"4.5.1"}),[2,t.prototype.prepareEvent.call(this,e,n,r)]})})},e.prototype.showReportDialog=function(t){void 0===t&&(t={});var e=b().document;if(e){var n=t.dsn||this.getDsn();if(!t.eventId)throw new et("Missing `eventId` option in showReportDialog call");if(!n)throw new et("Missing `Dsn` option in showReportDialog call");var r=e.createElement("script");r.async=!0,r.src=new ot(n).getReportDialogEndpoint(t),(e.head||e.body).appendChild(r)}},e}(lt),ke=1e3,Oe=0;function je(t,e,n){if(void 0===e&&(e={}),!v(t))return t;try{if(t.__sentry__)return t;if(t.__sentry_wrapped__)return t.__sentry_wrapped__}catch(e){return t}var sentryWrapped=function(){var r=this;n&&v(n)&&n.apply(this,arguments);var o=Array.prototype.slice.call(arguments);try{var u=o.map(function(t){return je(t,e)});return t.handleEvent?t.handleEvent.apply(this,u):t.apply(this,u)}catch(t){throw Oe+=1,setTimeout(function(){Oe-=1}),tt(function(n){return s(r,void 0,void 0,function(){var r=this;return a(this,function(u){return n.addEventProcessor(function(t){return s(r,void 0,void 0,function(){var n;return a(this,function(r){return n=i({},t),e.mechanism&&(n.exception=n.exception||{},n.exception.mechanism=e.mechanism),n.extra=i({},n.extra,{arguments:M(o,2)}),[2,n]})})}),captureException(t),[2]})})}),t}};try{for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(sentryWrapped[r]=t[r])}catch(t){}return sentryWrapped.prototype=t.prototype,t.__sentry_wrapped__=sentryWrapped,sentryWrapped.__sentry__=!0,sentryWrapped.__sentry_original__=t,sentryWrapped}function Te(t){return function(e){if(he=void 0,de!==e){var n;de=e;try{n=function(t){for(var e,n=t,r=[],o=0,i=0,s=" > ".length;n&&o++<5&&!("html"===(e=x(n))||o>1&&i+r.length*s+e.length>=80);)r.push(e),i+=e.length,n=n.parentNode;return r.reverse().join(" > ")}(e.target)}catch(t){n=""}X().addBreadcrumb({category:"ui."+t,message:n},{event:e,name:t})}}}function Ie(){return function(t){var e;try{e=t.target}catch(t){return}var n=e&&e.tagName;n&&("INPUT"===n||"TEXTAREA"===n||e.isContentEditable)&&(he||Te("input")(t),clearTimeout(he),he=setTimeout(function(){he=void 0},ke))}}var Re=function(){function t(e){this.name=t.id,this.options=i({onerror:!0,onunhandledrejection:!0},e)}return t.prototype.setupOnce=function(){re(function(e,n,r){if(!(Oe>0)){var o=X().getIntegration(t);o&&X().captureEvent(o.eventFromGlobalHandler(e),{originalException:r,data:{stack:e}})}}),this.options.onerror&&(W.log("Global Handler attached: onerror"),oe()),this.options.onunhandledrejection&&(W.log("Global Handler attached: onunhandledrejection"),ie())},t.prototype.eventFromGlobalHandler=function(t){var e=le(t);return i({},e,{exception:i({},e.exception,{mechanism:{data:{mode:t.mode},handled:!1,type:t.mechanism}})})},t.id="GlobalHandlers",t}(),Fe=function(){function t(){this.ignoreOnError=0,this.name=t.id}return t.prototype.wrapTimeFunction=function(t){return function(){for(var e=[],n=0;n"}catch(t){return""}}var De,Ne=b(),Me=function(){function e(t){this.name=e.id,this.options=i({beacon:!0,console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t)}return e.prototype.instrumentBeacon=function(){Mt()&&I(Ne.navigator,"sendBeacon",function(n){return function(){for(var r=[],o=0;o2?e[2]:void 0;return r&&s(De,String(r)),t.apply(this,e)}}},e.prototype.instrumentXHR=function(){if("XMLHttpRequest"in Ne){var t=XMLHttpRequest.prototype;I(t,"open",function(t){return function(){for(var e=[],n=0;n"},handled:!0,type:"instrument"}})})}(t,o)}),"onreadystatechange"in o&&v(o.onreadystatechange)?I(o,"onreadystatechange",function(t){return je(t,{mechanism:{data:{function:"onreadystatechange",handler:t&&t.name||""},handled:!0,type:"instrument"}},i)}):o.onreadystatechange=i,t.apply(this,n)}})}},e.addBreadcrumb=function(t,n){X().getIntegration(e)&&X().addBreadcrumb(t,n)},e.prototype.setupOnce=function(){this.options.console&&this.instrumentConsole(),this.options.dom&&this.instrumentDOM(),this.options.xhr&&this.instrumentXHR(),this.options.fetch&&this.instrumentFetch(),this.options.beacon&&this.instrumentBeacon(),this.options.history&&this.instrumentHistory()},e.id="Breadcrumbs",e}();function Ue(e){try{var n=(r=e,JSON.parse(r));Me.addBreadcrumb({category:"sentry",event_id:n.event_id,level:n.level||t.Severity.fromString("error"),message:S(n)},{event:n})}catch(t){W.error("Error while adding sentry type breadcrumb")}var r}var Pe,Le="cause",Ae=5,Be=function(){function t(e){void 0===e&&(e={}),this.name=t.id,this.key=e.key||Le,this.limit=e.limit||Ae}return t.prototype.setupOnce=function(){var e=this;$(function(n,r){return s(e,void 0,void 0,function(){var e;return a(this,function(o){return(e=X().getIntegration(t))?[2,e.handler(n,r)]:[2,n]})})})},t.prototype.handler=function(t,e){if(!(t.exception&&t.exception.values&&e&&e.originalException instanceof Error))return t;var n=this.walkErrorTree(e.originalException,this.key);return t.exception.values=l(n,t.exception.values),t},t.prototype.walkErrorTree=function(t,e,n){if(void 0===n&&(n=[]),!(t[e]instanceof Error)||n.length+1>=this.limit)return n;var r=ue(se(t[e]));return this.walkErrorTree(t[e],e,l([r],n))},t.id="LinkedErrors",t}(),He=b(),$e=function(){function t(){this.name=t.id}return t.prototype.setupOnce=function(){var e=this;$(function(n){return s(e,void 0,void 0,function(){var e;return a(this,function(r){return X().getIntegration(t)&&He.navigator&&He.location?((e=n.request||{}).url=e.url||He.location.href,e.headers=e.headers||{},e.headers["User-Agent"]=He.navigator.userAgent,[2,i({},n,{request:e})]):[2,n]})})})},t.id="UserAgent",t}(),qe=function(){function t(e){void 0===e&&(e={}),this.name=t.id,this.Ember=e.Ember||b().Ember}return t.prototype.setupOnce=function(){var e=this;if(this.Ember){var n=this.Ember.onerror;this.Ember.onerror=function(r){if(X().getIntegration(t)&&tt(function(t){e.addIntegrationToSdkInfo(t),captureException(r)}),"function"==typeof n)n.call(e.Ember,r);else if(e.Ember.testing)throw r},this.Ember.RSVP.on("error",function(n){X().getIntegration(t)&&tt(function(t){n instanceof Error?(t.setExtra("context","Unhandled Promise error detected"),e.addIntegrationToSdkInfo(t),captureException(n)):(t.setExtra("reason",n),e.addIntegrationToSdkInfo(t),captureMessage("Unhandled Promise error detected"))})})}},t.prototype.addIntegrationToSdkInfo=function(t){var e=this;t.addEventProcessor(function(t){return s(e,void 0,void 0,function(){var e;return a(this,function(n){return t.sdk&&(e=t.sdk.integrations||[],t.sdk=i({},t.sdk,{integrations:l(e,["ember"])})),[2,t]})})})},t.id="Ember",t}(),We=function(){function t(e){void 0===e&&(e={}),this.name=t.id,this.Vue=e.Vue||b().Vue}return t.prototype.formatComponentName=function(t){if(t.$root===t)return"root instance";var e=t._isVue?t.$options.name||t.$options._componentTag:t.name;return(e?"component <"+e+">":"anonymous component")+(t._isVue&&t.$options.__file?" at "+t.$options.__file:"")},t.prototype.setupOnce=function(){var e=this;if(this.Vue&&this.Vue.config){var n=this.Vue.config.errorHandler;this.Vue.config.errorHandler=function(r,o,u){var c={};y(o)&&(c.componentName=e.formatComponentName(o),c.propsData=o.$options.propsData),d(u)||(c.lifecycleHook=u),X().getIntegration(t)&&tt(function(t){Object.keys(c).forEach(function(e){t.setExtra(e,c[e])}),t.addEventProcessor(function(t){return s(e,void 0,void 0,function(){var e;return a(this,function(n){return t.sdk&&(e=t.sdk.integrations||[],t.sdk=i({},t.sdk,{integrations:l(e,["vue"])})),[2,t]})})}),captureException(r)}),"function"==typeof n&&n.call(e.Vue,r,o,u)}}},t.id="Vue",t}();!function(t){t.Crash="crash",t.Deprecation="deprecation",t.Intervention="intervention"}(Pe||(Pe={}));var Ve=function(){function t(e){void 0===e&&(e={types:[Pe.Crash,Pe.Deprecation,Pe.Intervention]}),this.options=e,this.name=t.id}return t.prototype.setupOnce=function(){"ReportingObserver"in b()&&new(b().ReportingObserver)(this.handler.bind(this),{buffered:!0,types:this.options.types}).observe()},t.prototype.handler=function(e){var n,r;if(X().getIntegration(t)){var o=function(t){tt(function(e){e.setExtra("url",t.url);var n="ReportingObserver ["+t.type+"]",r="No details available";if(t.body){var o,i={};for(var s in t.body)i[s]=t.body[s];if(e.setExtra("body",i),t.type===Pe.Crash)r=[(o=t.body).crashId||"",o.reason||""].join(" ").trim()||r;else r=(o=t.body).message||r}captureMessage(n+": "+r)})};try{for(var i=u(e),s=i.next();!s.done;s=i.next()){o(s.value)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}},t.id="ReportingObserver",t}(),Ge=Object.freeze({GlobalHandlers:Re,TryCatch:Fe,Breadcrumbs:Me,LinkedErrors:Be,UserAgent:$e,Ember:qe,Vue:We,ReportingObserver:Ve}),Ye=[new dt,new mt,new vt,new Ot,new Fe,new Me,new Re,new Be,new $e];var ze=i({},Dt,Ge);return t.Integrations=ze,t.Transports=xe,t.addGlobalEventProcessor=$,t.addBreadcrumb=function(t){Q("addBreadcrumb",t)},t.captureException=captureException,t.captureEvent=function(t){return Q("captureEvent",t)},t.captureMessage=captureMessage,t.configureScope=function(t){Q("configureScope",t)},t.withScope=tt,t.getHubFromCarrier=K,t.getCurrentHub=X,t.Hub=G,t.Scope=B,t.BrowserBackend=_e,t.BrowserClient=we,t.defaultIntegrations=Ye,t.forceLoad=function(){},t.init=function(t){void 0===t&&(t={}),void 0===t.defaultIntegrations&&(t.defaultIntegrations=Ye),function(t,e){if(!0===e.debug&&W.enable(),!X().getClient()){var n=new t(e);X().bindClient(n),n.install()}}(we,t)},t.lastEventId=function(){return X().lastEventId()},t.onLoad=function(t){t()},t.showReportDialog=function(t){void 0===t&&(t={}),t.eventId||(t.eventId=X().lastEventId()),X().getClient().showReportDialog(t)},t.SDK_NAME=Se,t.SDK_VERSION="4.5.1",t}({}); -//# sourceMappingURL=bundle.min.js.map +/*! @sentry/browser 5.0.5 (913eafc4) | https://github.com/getsentry/sentry-javascript */ +var Sentry=function(n){"use strict";var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])})(n,r)};function r(n,r){function i(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i,e,o,u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;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}({}); diff --git a/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2 b/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2 index e953144dc..d449fb7fd 100644 --- a/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2 +++ b/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2 @@ -7,7 +7,15 @@ Sentry.init({ dsn: errortracking_url_coreui, - release: VERSION + release: VERSION, + whitelistUrls: [ + // only include static assets + "/static/" + ], + blacklistUrls: [ + // exclude third party plugins + "/static/webassets/packed_plugins.js" + ] }); Sentry.configureScope(function (scope) { scope.setUser({"id": errortracking_unique_id}); diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index fc720f94b..2af973b7e 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -31,10 +31,11 @@ import requests import re import os import copy -import dateutil.parser import time import threading +from datetime import datetime + _DATA_FORMAT_VERSION = "v2" @@ -721,7 +722,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, if additional_args: args.append(additional_args) - return self._pip_caller.execute(*args) + kwargs = dict(env=dict(PYTHONWARNINGS="ignore:DEPRECATION::pip._internal.cli.base_command")) + + return self._pip_caller.execute(*args, **kwargs) def _log_message(self, *lines): self._log(lines, prefix="*", stream="message") @@ -902,7 +905,12 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, key = notice["plugin"] try: - parsed_date = dateutil.parser.parse(notice["date"]) + # Jekyll turns "%Y-%m-%d %H:%M:%SZ" into "%Y-%m-%d %H:%M:%S +0000", so be sure to ignore "+0000" + # + # Being able to use dateutil here would make things way easier but sadly that can no longer get + # installed (from source) under OctoPi 0.14 due to its setuptools-scm dependency, so we have to do + # without it for now until we can drop support for OctoPi 0.14. + parsed_date = datetime.strptime(notice["date"], "%Y-%m-%d %H:%M:%S +0000") notice["timestamp"] = parsed_date.timetuple() except Exception as e: self._logger.warning("Error while parsing date {!r} for plugin notice " @@ -928,7 +936,8 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, reconnect_hooks.extend(filter(lambda x: isinstance(x, basestring), result)) except Exception: self._logger.exception("Error while retrieving additional hooks for which a " - "reconnect is required from plugin {name}".format(**locals())) + "reconnect is required from plugin {name}".format(**locals()), + extra=dict(plugin=name)) return reconnect_hooks diff --git a/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css b/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css index 7248bf5eb..8e6a40957 100644 --- a/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css +++ b/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css @@ -1 +1 @@ -table td.settings_plugin_plugin_manager_plugins_name,table th.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}table td.settings_plugin_plugin_manager_plugins_actions,table th.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}table td.settings_plugin_plugin_manager_plugins_actions a,table th.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}table td.settings_plugin_plugin_manager_plugins_actions a.disabled,table th.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px 10px 5px 5px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_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;height:500px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_name,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a.disabled,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px 10px 5px 5px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_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} diff --git a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js index c04e42d65..ed263c8d1 100644 --- a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js +++ b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js @@ -32,7 +32,7 @@ $(function() { "name", [], [], - 5 + 0 ); self.repositoryplugins = new ItemListHelper( diff --git a/src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less b/src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less index 5ef59cdef..b0b071203 100644 --- a/src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less +++ b/src/octoprint/plugins/pluginmanager/static/less/pluginmanager.less @@ -1,21 +1,32 @@ -table { - th, td { - &.settings_plugin_plugin_manager_plugins_name { - text-overflow: ellipsis; - text-align: left; - } +#settings_plugin_pluginmanager_pluginlist { + display: block; + width: auto; + height: 500px; + overflow-x: hidden; + overflow-y: scroll; + padding-right: 2px; + margin-bottom: 1em; - &.settings_plugin_plugin_manager_plugins_actions { - text-align: center; - width: 80px; + table { - a { - text-decoration: none; - color: #000; + th, td { + &.settings_plugin_plugin_manager_plugins_name { + text-overflow: ellipsis; + text-align: left; + } - &.disabled { - color: #ccc; - cursor: default; + &.settings_plugin_plugin_manager_plugins_actions { + text-align: center; + width: 80px; + + a { + text-decoration: none; + color: #000; + + &.disabled { + color: #ccc; + cursor: default; + } } } } diff --git a/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 b/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 index e5270be8f..2d9a303e5 100644 --- a/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 +++ b/src/octoprint/plugins/pluginmanager/templates/pluginmanager_settings.jinja2 @@ -37,42 +37,33 @@

{{ _('Installed Plugins') }}

- - - - - - - - - - - - - -
{{ _('Name') }}{{ _('Actions') }}
-
()
-
-
 
-
- {{ _('Homepage') }} - - -   -
-
-  |  -
-