diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.yml index a8842872f..5b6e026e7 100644 --- a/.github/workflows/issue_labeler.yml +++ b/.github/workflows/issue_labeler.yml @@ -1,10 +1,10 @@ name: "Issue Labeler" on: issues: - types: [opened, edited] + types: [opened, edited, closed, reopened] jobs: - apply-label: + label-opened-and-edited: runs-on: ubuntu-latest steps: - uses: actions/github-script@v2 @@ -12,19 +12,50 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | let labels = []; + let setLabels = false; + context.payload.issue.labels.forEach(label => { labels.push(label.name) }); - if (context.payload.issue.title.match(/\[request\]|feature request/i)) { - labels.push('type:request'); - } - if (context.payload.issue.title.match(/\[brainstorming\]/i)) { - labels.push('type:brainstorming'); - } - if (context.payload.issue.title.match(/\[rc feedback\]/i)) { - labels.push('type:rc feedback'); + switch (context.payload.action) { + + case 'opened': + case 'edited': { + if (context.payload.issue.title.match(/\[request\]|feature request/i)) { + labels.push('request'); + labels = labels.filter(label => label !== 'triage'); + setLabels = true; + } + if (context.payload.issue.title.match(/\[rc feedback\]/i)) { + labels.push('rc feedback'); + labels = labels.filter(label => label !== 'triage'); + setLabels = true; + } + + if (labels.length === 0) { + labels.push('triage'); + setLabels = true; + } + break; + } + + case 'closed': { + if (labels.includes('bug') || labels.includes('request') || labels.includes('improvement')) { + labels.push('done'); + setLabels = true; + } + break; + } + + case 'reopened': { + if (labels.includes('done')) { + labels = labels.filter(label => label !== 'done'); + setLabels = true; + } + break; + } } - if (labels.length > 0) { - github.issues.addLabels({ + if (setLabels) { + github.issues.setLabels({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9cc54048..da3d2724b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,6 +40,8 @@ repos: rev: 3.8.4 hooks: - id: flake8 + additional_dependencies: + - flake8-bugbear - repo: https://github.com/prettier/prettier rev: 2.1.2 hooks: diff --git a/AUTHORS.md b/AUTHORS.md index 57335f17c..2e4c54f02 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -128,6 +128,7 @@ date of first contribution): * [Charlie Powell](https://github.com/cp2004) * [Ollis Git](https://github.com/OllisGit) * [Sophist](https://github.com/Sophist-UK) + * [Manuel McLure](https://github.com/ManuelMcLure) 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/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..ba199875d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1 @@ +OctoPrint's Code of Conduct can be found at [octoprint.org/conduct/](https://octoprint.org/conduct/). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 068ea1c0a..68c62a498 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -360,8 +360,7 @@ and branching strategy. An [automatic build workflow](https://github.com/OctoPrint/OctoPrint/actions?query=workflow%3ABuild) is in place that will run these checks - if they fail your PR will be marked accordingly. 10. **Test your changes thoroughly**. That also means testing with usage - scenarios you don't normally use, e.g. if you only use access control, test - without and vice versa. If you only test with your printer, test with the + scenarios you don't normally use. If you only test with your printer, test with the virtual printer and vice versa. State in your pull request how you tested your changes. Ideally **add unit tests** - OctoPrint severely lacks in that department, but we are trying to change that, so any new code already covered diff --git a/README.md b/README.md index 8088f1c3c..3ea5d9353 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,20 @@ -# OctoPrint +

- Note: In case that your OctoPrint installation is only accessible from within a trustworthy local network and you don't - need Access Control for other reasons, you may alternatively disable Access Control. You should only - do this if you are absolutely certain that only people you know and trust will be able to connect to it. -
-- Do NOT underestimate the risk of access from the internet to your printer and OctoPrint instance! -
{% endtrans %} - - - - diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index ffcf9f0dc..d7b8de3f2 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -43,8 +43,8 @@ IGNORED_EXCEPTIONS = [ # IOErrors of any kind due to a full file system ( IOError, - lambda exc, logger, plugin, cb: getattr(exc, "errno") - and exc.errno in (getattr(errno, "ENOSPC"),), + lambda exc, logger, plugin, cb: exc.errorgetattr(exc, "errno") # noqa: B009 + and exc.errno in (getattr(errno, "ENOSPC"),), # noqa: B009 ), # RequestExceptions of any kind requests.exceptions.RequestException, diff --git a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js index eaf5896d1..6fb9ba4e3 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js @@ -860,41 +860,25 @@ $(function () { var optionsLocalStorageKey = "core.gcodeviewer.options"; self._toLocalStorage = function () { - if (!Modernizr.localstorage) return; - - var current = {}; - current["centerViewport"] = self.renderer_centerViewport(); - current["zoomOnModel"] = self.renderer_zoomOnModel(); - current["showMoves"] = self.renderer_showMoves(); - current["showRetracts"] = self.renderer_showRetracts(); - current["showPrinthead"] = self.renderer_showPrinthead(); - current["showPrevious"] = self.renderer_showPrevious(); - current["showCurrent"] = self.renderer_showCurrent(); - current["showNext"] = self.renderer_showNext(); - current["showFullsize"] = self.renderer_showFullSize(); - current["showBoundingBox"] = self.renderer_showBoundingBox(); - current["hideEmptyLayers"] = self.reader_hideEmptyLayers(); - current["sortLayers"] = self.reader_sortLayers(); - - localStorage[optionsLocalStorageKey] = JSON.stringify(current); + saveToLocalStorage(optionsLocalStorageKey, { + centerViewPort: self.renderer_centerViewport(), + zoomOnModel: self.renderer_zoomOnModel(), + showMoves: self.renderer_showMoves(), + showRetracts: self.renderer_showRetracts(), + showPrinthead: self.renderer_showPrinthead(), + showPrevious: self.renderer_showPrevious(), + showCurrent: self.renderer_showCurrent(), + showNext: self.renderer_showNext(), + showFullsize: self.renderer_showFullSize(), + showBoundingBox: self.renderer_showBoundingBox(), + hideEmptyLayers: self.reader_hideEmptyLayers(), + sortLayers: self.reader_sortLayers() + }); }; self._fromLocalStorage = function () { self.resetOptions(); - if (!Modernizr.localstorage) return; - - var currentString = localStorage[optionsLocalStorageKey]; - var current; - if (currentString === undefined) { - current = {}; - } else { - try { - current = JSON.parse(currentString); - } catch (ex) { - current = {}; - } - } - + var current = loadFromLocalStorage(optionsLocalStorageKey); if (current["centerViewport"] !== undefined) self.renderer_centerViewport(current["centerViewport"]); if (current["zoomOnModel"] !== undefined) diff --git a/src/octoprint/plugins/pi_support/__init__.py b/src/octoprint/plugins/pi_support/__init__.py index 163320a47..6c40674db 100644 --- a/src/octoprint/plugins/pi_support/__init__.py +++ b/src/octoprint/plugins/pi_support/__init__.py @@ -249,8 +249,14 @@ class PiSupportPlugin( def on_api_get(self, request): if not Permissions.PLUGIN_PI_SUPPORT_STATUS.can(): return flask.abort(403) - result = {"throttle_state": self._throttle_state.as_dict()} - result.update(self.get_additional_environment()) + + environment = self.get_additional_environment() + + result = { + "throttle_state": self._throttle_state.as_dict(), + "model_unrecommended": "zero" in environment.get("model").lower(), + } + result.update(environment) return flask.jsonify(**result) # ~~ AssetPlugin @@ -306,6 +312,7 @@ class PiSupportPlugin( return { "vcgencmd_throttle_check_enabled": True, "vcgencmd_throttle_check_command": _VCGENCMD_THROTTLE, + "ignore_unrecommended_model": False, } def get_settings_restricted_paths(self): diff --git a/src/octoprint/plugins/pi_support/static/js/pi_support.js b/src/octoprint/plugins/pi_support/static/js/pi_support.js index 75388df75..95112fece 100644 --- a/src/octoprint/plugins/pi_support/static/js/pi_support.js +++ b/src/octoprint/plugins/pi_support/static/js/pi_support.js @@ -4,6 +4,7 @@ $(function () { self.loginState = parameters[0]; self.access = parameters[1]; + self.settings = parameters[2]; self.model = ko.observable(); @@ -27,6 +28,42 @@ $(function () { // Raspberry Pi model self.model(response.model); + // Unrecommended model + if ( + response.model_unrecommended && + !self.settings.settings.plugins.pi_support.ignore_unrecommended_model() + ) { + var warning = gettext( + "OctoPrint does not and never has supported the " + + "RPi Zero or Zero W. Use at least a Raspberry Pi 3, or " + + "risk bad performance and failed prints." + ); + var faq = gettext( + "" + + 'You can read more in the FAQ.' + ); + var remove = gettext( + "You can disable this message via Settings > " + + "Pi Support > Ignore warning on unsupported hardware" + ); + new PNotify({ + title: gettext("Unsupported hardware detected"), + text: + "" + + warning + + "
" + + _.sprintf(faq, { + url: "https://faq.octoprint.org/recommended-hardware" + }) + + "
" + + "" + + remove + + "
", + type: "error", + hide: false + }); + } + // Throttle state self.fromThrottleState(response.throttle_state); @@ -130,6 +167,6 @@ $(function () { OCTOPRINT_VIEWMODELS.push({ construct: PiSupportViewModel, elements: ["#navbar_plugin_pi_support"], - dependencies: ["loginStateViewModel", "accessViewModel"] + dependencies: ["loginStateViewModel", "accessViewModel", "settingsViewModel"] }); }); diff --git a/src/octoprint/plugins/pi_support/templates/pi_support_settings.jinja2 b/src/octoprint/plugins/pi_support/templates/pi_support_settings.jinja2 index a8abffcc0..b16b8f17f 100644 --- a/src/octoprint/plugins/pi_support/templates/pi_support_settings.jinja2 +++ b/src/octoprint/plugins/pi_support/templates/pi_support_settings.jinja2 @@ -3,6 +3,15 @@{{ _('Please restart OctoPrint after changing any of this plugin\'s settings.') }}