Merge branch 'maintenance' into devel

# Conflicts:
#	src/octoprint/logging/__init__.py
This commit is contained in:
Gina Häußge committed 2021-02-05 13:04:26 +01:00
commit 2a6f7478c3
34 files changed
+487 -432

No files matched your search

-135
View File
@@ -1,135 +0,0 @@
---
name: Bug report
about: Create a report to help improve OctoPrint
---
<!--
READ THE FOLLOWING FIRST:
If not already done, please read the the Contribution Guidelines that
are linked to the right under "Helpful resources" > "Contributing".
Also read the FAQ: https://faq.octoprint.org
This is a bug and feature tracker, please only use it to report bugs
or request features within OctoPrint (not OctoPi, not any OctoPrint
plugins and not unofficial OctoPrint versions).
Do not seek support here ("I need help with ...", "I have a
question ..."), that belongs on the community forum at
community.octoprint.org, NOT here.
Mark requests with a "[Request]" prefix in the title please. For bug
reports fully fill out the bug reporting template (if you don't know
where to find some information - it's all described in the Contribution
Guidelines linked up there in the big yellow box).
When reporting a bug do NOT delete ANY lines from the template.
Make sure any bug you want to report is still present with the CURRENT
OctoPrint version and that it does not vanish when you start OctoPrint
in safe mode - how to do that is also explained in the Contribution
Guidelines linked up there in the big yellow box.
Thank you!
-->
#### What were you doing?
<!--
Please be as specific as possible here. The maintainers will need to
reproduce your issue in order to fix it and that is not possible if they
don't know what you did to get it to happen in the first place.
Ideally provide exact steps to follow in order to reproduce your problem:
-->
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
<!--
If you encountered a problem with specific files of any sorts, make sure
to also include a link to a file with which to reproduce the problem.
-->
#### What did you expect to happen?
#### What happened instead?
#### Did the same happen when running OctoPrint in safe mode?
<!--
Test if you can reproduce your problem in safe mode. You can find information
on how to enable safe mode in the Contribution Guidelines.
If you can't reproduce in safe mode, this is a bug with one of your
installed third party plugins. Don't open a ticket here!
If you can't test this in safe mode, state why.
-->
#### Version of OctoPrint
<!--
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
-->
#### Operating System running OctoPrint
<!--
OctoPi, Linux, Windows, MacOS, something else? With version please.
OctoPi's version can be found in /etc/octopi_version or in the lower left
corner of the web interface.
-->
#### Printer model & used firmware incl. version
<!--
If applicable, always include if unsure.
-->
#### Browser and version of browser, operating system running browser
<!--
If applicable, always include if unsure.
-->
#### Link to octoprint.log
<!--
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
The Contribution Guidelines tell you where to find that.
-->
#### Link to contents of terminal tab or serial.log
<!--
On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting communication issues. Never truncate.
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log (which the Contribution Guidelines tell you where to find).
-->
#### Link to contents of Javascript console in the browser
<!--
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.
The Contribution Guidelines tell you where to find that.
-->
#### Screenshot(s)/video(s) showing the problem:
<!--
If applicable. Always include if unsure or reporting UI issues.
-->
I have read the FAQ.
+121
View File
@@ -0,0 +1,121 @@
name: Bug report
about: Create a report to help improve OctoPrint
title: ""
issue_body: true
inputs:
- type: description
attributes:
value: >
**Thank you for wanting to report a bug in OctoPrint!**
If this is the first time you are doing this, please take a few moments to read
through the [Contribution Guidelines](https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md).
Also check out [the FAQ](https://faq.octoprint.org) if your
problem is maybe already covered there.
You are about to report a bug in **OctoPrint**. Do not proceed if your issues
occurs with OctoPi, any third party OctoPrint plugins, unofficial or outdated
OctoPrint versions. If you are unsure of the difference between OctoPrint and
OctoPi, [read this FAQ entry](https://faq.octoprint.org/octoprint-vs-octopi).
Do also not seek support here ("I need help with ...", "I have a
question ...", "Can someone walk me through ..."), that belongs into the
[community forum at community.octoprint.org](https://community.octoprint.org) or on the [Discord server](https://discord.octoprint.org).
And finally, make sure any bug you want to report is still present with the **current**
OctoPrint version and that it does not vanish when you start OctoPrint
in [safe mode](https://docs.octoprint.org/en/master/features/safemode.html) either.
Thank you for your collaboration!
- type: textarea
attributes:
label: The problem
required: true
description: >-
Describe the issue you are experiencing here. Tell us what you were trying to do
step by step, and what happened that you did not expect.
Provide a clear and concise description of what the problem is and include as many
details as possible.
placeholder: |
1. ...
2. ...
3. ...
- type: dropdown
attributes:
label: Did the issue persist even in safe mode?
description: >-
Testing in safe mode is required to make sure the issue you are reporting is not
caused by a third party plugin. Please see [here](https://docs.octoprint.org/en/master/features/safemode.html)
on how to run OctoPrint in safe mode.
choices:
- Yes, it did persist
- No, it did not persist (it's an issue with one of your installed plugins, don't report here)
- I cannot test this issue in safe mode (state why below)
required: true
- type: description
attributes:
value: |
## Environment
- type: input
attributes:
label: Version of OctoPrint
description: Can be found in the lower left corner of the web interface.
required: true
- type: input
attributes:
label: Operating system running OctoPrint
description: >-
OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's
version can be found in `/etc/octopi_version` or in the lower left corner of the
web interface.
required: true
- type: input
attributes:
label: Printer model & used firmware incl. version
description: If applicable, always include if unsure
- type: input
attributes:
label: Browser and version of browser, operating system running browser
description: If applicable, always include if unsure
- type: description
attributes:
value: |
## Logs and other files needed for analysis
- type: description
attributes:
value: >-
Please also be sure to upload the following files below:
* `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that.
* `serial.log` or the contents of your terminal tab, if applicable. Always
include if unsure. **Please note that you need to enable `serial.log` first**,
see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it.
* Your browser's JavaScript console, if you are reporting a problem with the
user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that.
* If possible, screenshots or videos showing the problem, especially if you
are reporting a problem with the user interface!
* GCODE files with which to reproduce, if you are reporting an issue with
GCODE file analysis or printing behaviour.
Please be aware that unless at least `octoprint.log` is included, your bug report
will not be processed.
- type: checkboxes
attributes:
label: Checklist of files to include below
choices:
- label: octoprint.log
required: true
- label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication)
- label: Contents of the JavaScript browser console (always include in cases of issues with the user interface)
- label: Screenshots and/or videos showing the problem (always include in case of issues with the user interface)
- label: GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour)
- type: description
attributes:
value: |
## Additional information & file uploads
+1 -1
View File
@@ -3,7 +3,7 @@ on:
push:
pull_request:
release:
types: [published, prereleased]
types: [released, prereleased]
workflow_dispatch:
jobs:
+4 -4
View File
@@ -63,7 +63,7 @@ jobs:
})
}
- uses: OctoPrint/actions/issue-validation@main
if: github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'edited')
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
#- uses: OctoPrint/actions/issue-validation@main
# if: github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'edited')
# with:
# repo-token: ${{ secrets.GITHUB_TOKEN }}
+8 -1
View File
@@ -31,7 +31,7 @@ jobs:
}
};
if (bundles) {
if (bundles.length > 0) {
let text = comment + botMarker + "\n\n---\n\n\nBundles:\n\n";
bundles.forEach((bundle) => {
text += " * [" + bundle.filename + "](https://bundleviewer.octoprint.org/?url=" + encodeURIComponent(bundle.link) + ")\n"
@@ -44,4 +44,11 @@ jobs:
comment_id: context.payload.comment.id,
body: text
});
} else if (botWasHere !== -1) {
github.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
body: comment
});
}
+1
View File
@@ -137,6 +137,7 @@ date of first contribution):
* [David Rifkind](https://github.com/drifkind)
* [Nils Hofmann](https://github.com/Master92)
* [Miroslav Šedivý](https://github.com/eumiro)
* [Costas Basdekis](https://github.com/costas-basdekis)
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
+8 -148
View File
@@ -31,7 +31,7 @@ nothing but ticket management.
- **[Read the FAQ](https://faq.octoprint.org)**
- If you want to report a **bug**, [read "How to file a bug report" below](#how-to-file-a-bug-report)
and *[use the provided template](#what-should-i-include-in-a-ticket)*.
and *[use the provided form](https://github.com/OctoPrint/OctoPrint/issues/new?template=bug_report.yml)*.
You do not need to do anything else with your ticket.
- If you want to post a **feature request** or a **documentation request**, add `[Request]`
to your issue's title (e.g. `[Request] Awesome new feature`). A question on how to run/change/setup
@@ -48,15 +48,6 @@ nothing but ticket management.
No matter what kind of ticket you create, never mix two or more "ticket reasons"
into one ticket: One ticket per bug, request, brainstorming thread please.
> 👉 **Note**
>
> A bot is in place that monitors new tickets, automatically
> categorizes them and checks new bug reports for usage of the provided template.
> That bot will only bother you if you open a ticket that appears to be a bug (no
> `[Request]` in the title) without the complete template, and it
> will do that only to ensure that all information needed to solve the issue is
> available for the maintainers to directly start tackling that problem.
## How to file a bug report
If you encounter an issue with OctoPrint, you are welcome to
@@ -118,7 +109,7 @@ following section *completely* and also follow the instructions in the
it is the same as your's, it actually behaves the same as your's. E.g. if someone gives steps
to reproduce his bug that looks like your's, reproduce the bug like that if possible,
and only add a "me too" if you actually can reproduce the same
issue. Also **provide all information** as [described below](#what-should-i-include-in-a-bug-report)
issue. Also **provide all information like logs, versions, different reproduction steps**
and whatever was additionally requested over the course of the ticket
even if you "only" add to an existing ticket. The more information available regarding a bug, the higher
the chances of reproducing and solving it. But "me too" on an actually unrelated ticket
@@ -126,7 +117,7 @@ following section *completely* and also follow the instructions in the
there's now also a [red herring](https://en.wikipedia.org/wiki/Red_herring) interfering - so please be
very diligent here!
If in doubt about any of the above - get in touch on the [community forum](https://community.octoprint.org)
If in doubt about any of the above - get in touch on the [community forums](https://community.octoprint.org)
instead of opening a ticket here. If you are actually running into a bug, we'll figure it out together
there.
@@ -135,143 +126,11 @@ there.
First of all make sure your use **a descriptive title**. "It doesn't work"
and similar unspecific complaints are NOT descriptive titles.
**Always use the following template, even if only adding a "me too" to an
existing ticket**:
Always fill out the [reporting form](https://github.com/OctoPrint/OctoPrint/issues/new?template=bug_report.yml) **completely** and include as much
information as possible.
```
<!--
READ THE FOLLOWING FIRST:
If not already done, please read the the Contribution Guidelines that
are linked to the right under "Helpful resources" > "Contributing".
Also read the FAQ: https://faq.octoprint.org
This is a bug and feature tracker, please only use it to report bugs
or request features within OctoPrint (not OctoPi, not any OctoPrint
plugins and not unofficial OctoPrint versions).
Do not seek support here ("I need help with ...", "I have a
question ..."), that belongs on the community forum at
community.octoprint.org, NOT here.
Mark requests with a "[Request]" prefix in the title please. For bug
reports fully fill out the bug reporting template (if you don't know
where to find some information - it's all described in the Contribution
Guidelines linked up there in the big yellow box).
When reporting a bug do NOT delete ANY lines from the template.
Make sure any bug you want to report is still present with the CURRENT
OctoPrint version and that it does not vanish when you start OctoPrint
in safe mode - how to do that is also explained in the Contribution
Guidelines linked up there in the big yellow box.
Thank you!
-->
#### What were you doing?
<!--
Please be as specific as possible here. The maintainers will need to
reproduce your issue in order to fix it and that is not possible if they
don't know what you did to get it to happen in the first place.
Ideally provide exact steps to follow in order to reproduce your problem:
-->
1. ...
2. ...
3. ...
<!--
If you encountered a problem with specific files of any sorts, make sure
to also include a link to a file with which to reproduce the problem.
-->
#### What did you expect to happen?
#### What happened instead?
#### Did the same happen when running OctoPrint in safe mode?
<!--
Test if you can reproduce your problem in safe mode. You can find information
on how to enable safe mode in the Contribution Guidelines.
If you can't reproduce in safe mode, this is a bug with one of your
installed third party plugins. Don't open a ticket here!
If you can't test this in safe mode, state why.
-->
#### Version of OctoPrint
<!--
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
-->
#### Operating System running OctoPrint
<!--
OctoPi, Linux, Windows, MacOS, something else? With version please.
OctoPi's version can be found in /etc/octopi_version or in the lower left
corner of the web interface.
-->
#### Printer model & used firmware incl. version
<!--
If applicable, always include if unsure.
-->
#### Browser and version of browser, operating system running browser
<!--
If applicable, always include if unsure.
-->
#### Link to octoprint.log
<!--
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
The Contribution Guidelines tell you where to find that.
-->
#### Link to contents of terminal tab or serial.log
<!--
On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting communication issues. Never truncate.
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log (which the Contribution Guidelines tell you where to find).
-->
#### Link to contents of Javascript console in the browser
<!--
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.
The Contribution Guidelines tell you where to find that.
-->
#### Screenshot(s)/video(s) showing the problem:
<!--
If applicable. Always include if unsure or reporting UI issues.
-->
I have read the FAQ.
```
Copy-paste this template **completely** (or use the version that gets pre-filled
into the "new issue" form). Do not skip any lines or the bot *will* complain! Provide
all requested information or your ticket will be closed.
Provide the same kind and amount of information also when you are just adding on to an
existing ticket!
### Where can I find which version and branch I'm on?
@@ -427,6 +286,7 @@ See [the corresponding chapter in the documentation](https://docs.octoprint.org/
* 2020-08-10: Update versioning scheme and PR instructions
* 2020-09-23: Move branch & versioning into development docs
* 2020-10-07: Introduce `pre-commit`
* 2021-02-04: Issue forms! \o/
## Footnotes
* [1] - If you are wondering why, the problem is that anything that you add
+11 -9
View File
@@ -199,7 +199,7 @@ types are currently recognized:
* ``prerelease_branches``: Prerelease channel definitions, optional. List of:
* ``branch``: Branch associated with the channel, acts as ID
* ``name``: Human readable name of the release channel
* ``committish``: List of values to check against ``target_comittish``
* ``commitish``: List of values to check against ``target_commitish``
field in Github release data - release will only be included if the
values match. Defaults to being unset, in which case the ``branch``
will be matched.
@@ -207,13 +207,13 @@ types are currently recognized:
* ``stable_branch``: Stable channel definition, optional. Structure:
* ``branch``: Branch associated with the channel, acts as ID
* ``name``: Human readable name of the release channel
* ``commitish``: List of values to check against ``target_comittish``
* ``commitish``: List of values to check against ``target_commitish``
field in Github release data - release will only be included if the
values match. Defaults to being unset, in which case the ``branch``
will be matched.
.. versionadded:: 1.2.16
* ``prerelease_channel``: Release channel to limit updates to. If set only
those releases will be included if their ``target_comittish`` matches
those releases will be included if their ``target_commitish`` matches
the ones associated with the release channel identified by this, either
included in ``prerelease_channels`` or the ``stable_channel``. Only
taken into account if ``prerelease`` is ``true``.
@@ -445,17 +445,17 @@ but with "Stable" active:
stable_branch:
name: Stable
branch: master
comittish:
commitish:
- master
prerelease_branches:
- name: Maintenance RCs
branch: rc/maintenance
comittish:
commitish:
- rc/maintenance
- master
- name: Devel RCs
branch: rc/devel
comittish:
commitish:
- rc/devel
- rc/maintenance
- master
@@ -463,6 +463,8 @@ but with "Stable" active:
And now with "Maintenance RCs" active (note the ``prerelease`` and ``prerelease_channel`` settings):
.. code-block:: yaml
plugins:
softwareupdate:
checks:
@@ -473,17 +475,17 @@ And now with "Maintenance RCs" active (note the ``prerelease`` and ``prerelease_
stable_branch:
name: Stable
branch: master
comittish:
commitish:
- master
prerelease_branches:
- name: Maintenance RCs
branch: rc/maintenance
comittish:
commitish:
- rc/maintenance
- master
- name: Devel RCs
branch: rc/devel
comittish:
commitish:
- rc/devel
- rc/maintenance
- master
+2 -1
View File
@@ -72,10 +72,11 @@ the *Python 3* environment and install the docs dependencies as well:
* ``source venv3/bin/activate`` (Linux, macOS) or ``source venv3/Scripts/activate`` (Git Bash under Windows, see below)
* ``pip install -e .[develop,plugins,docs]``
You can then build the documentation:
Go to the directory `docs` and you can then build the documentation:
* ``sphinx-build -b html . _build``
The documentation will be available in the newly created ``_build`` directory. You can simply browse it locally by opening ``index.html``
.. _sec-development-environment-source-linux:
Linux
+1 -1
View File
@@ -22,7 +22,7 @@ SETUP_REQUIRES = [
# Requirements for our application
INSTALL_REQUIRES = [
# additional OctoPrint plugins that are maintained on a different release cycle
"OctoPrint-FirmwareCheck>=2020.09.23",
"OctoPrint-FirmwareCheck>=2021.2.4",
"OctoPrint-FileCheck>=2020.08.07",
# the following dependencies are non trivial to update since later versions
# introduce backwards incompatible changes that might affect plugins, or due to
+5
View File
@@ -529,6 +529,8 @@ def set_logging_config(config, debug, verbosity, uncaught_logger, uncaught_handl
# configure logging globally
import logging.config as logconfig
from octoprint.logging.filters import TornadoAccessFilter
logconfig.dictConfig(config)
# make sure we log any warnings
@@ -557,6 +559,9 @@ def set_logging_config(config, debug, verbosity, uncaught_logger, uncaught_handl
uncaught_handler = exception_logger
sys.excepthook = uncaught_handler
tornado_logger = log.getLogger("tornado.access")
tornado_logger.addFilter(TornadoAccessFilter())
return logger
+2
View File
@@ -43,6 +43,8 @@ def validate_result(result):
if "total_time" not in result or invalid_float(result["total_time"]):
return False
return True
@click.group()
def analysis_commands():
+11 -2
View File
@@ -140,7 +140,7 @@ def run_server(
method("There was a fatal error starting up OctoPrint.")
else:
from octoprint.server import Server
from octoprint.server import CannotStartServerException, Server
octoprint_server = Server(
settings=settings,
@@ -156,7 +156,16 @@ def run_server(
allow_root=allow_root,
octoprint_daemon=octoprint_daemon,
)
octoprint_server.run()
try:
octoprint_server.run()
except CannotStartServerException as e:
logger = logging.getLogger("octoprint.startup").fatal
echo = lambda x: click.echo(x, err=True)
for method in logger, echo:
method(str(e))
method("There was a fatal error starting up OctoPrint.")
# ~~ server options
+101 -5
View File
@@ -3,18 +3,23 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms
import logging
import os
import click
import zipstream
from octoprint.cli import init_platform_for_cli, standard_options
click.disable_unicode_literals_warning = True
def get_systeminfo(environment_detector, connectivity_checker):
def get_systeminfo(environment_detector, connectivity_checker, additional_fields=None):
from octoprint import __version__
from octoprint.util import dict_flatten
if additional_fields is None:
additional_fields = {}
environment_detector.run_detection(notify_plugins=False)
systeminfo = {
@@ -27,9 +32,70 @@ def get_systeminfo(environment_detector, connectivity_checker):
flattened = dict_flatten(systeminfo)
flattened["env.python.virtualenv"] = "env.python.virtualenv" in flattened
for k, v in additional_fields.items():
if k not in flattened:
flattened[k] = v
return flattened
def get_systeminfo_bundle(systeminfo, logbase, printer=None):
from octoprint.util import to_bytes
systeminfotxt = []
for k in sorted(systeminfo.keys()):
systeminfotxt.append("{}: {}".format(k, systeminfo[k]))
terminaltxt = None
if printer and printer.is_operational():
firmware_info = printer.firmware_info
if firmware_info:
systeminfo["printer.firmware"] = firmware_info["name"]
if hasattr(printer, "_log"):
terminaltxt = list(printer._log)
try:
import zlib # noqa: F401
compress_type = zipstream.ZIP_DEFLATED
except ImportError:
# no zlib, no compression
compress_type = zipstream.ZIP_STORED
z = zipstream.ZipFile()
# add systeminfo
z.writestr(
"systeminfo.txt", to_bytes("\n".join(systeminfotxt)), compress_type=compress_type
)
# add terminal.txt, if available
if terminaltxt:
z.writestr(
"terminal.txt", to_bytes("\n".join(terminaltxt)), compress_type=compress_type
)
# add logs
for log in (
"octoprint.log",
"serial.log",
"plugin_softwareupdate_console.log",
"plugin_pluginmanager_console.log",
):
logpath = os.path.join(logbase, log)
if os.path.exists(logpath):
z.write(logpath, arcname=log, compress_type=compress_type)
return z
def get_systeminfo_bundle_name():
import time
return "octoprint-systeminfo-{}.zip".format(time.strftime("%Y%m%d%H%M%S"))
@click.group()
def systeminfo_commands():
pass
@@ -37,8 +103,14 @@ def systeminfo_commands():
@systeminfo_commands.command(name="systeminfo")
@standard_options()
@click.argument(
"path",
nargs=1,
required=False,
type=click.Path(writable=True, dir_okay=True, resolve_path=True),
)
@click.pass_context
def systeminfo_command(ctx, **kwargs):
def systeminfo_command(ctx, path, **kwargs):
"""Retrieves and prints the system info."""
logging.disable(logging.ERROR)
try:
@@ -56,8 +128,32 @@ def systeminfo_command(ctx, **kwargs):
click.echo("There was a fatal error initializing the platform.", err=True)
ctx.exit(-1)
else:
systeminfo = get_systeminfo(environment_detector, connectivity_checker)
systeminfo = get_systeminfo(
environment_detector, connectivity_checker, {"systeminfo.generator": "cli"}
)
for k in sorted(systeminfo.keys()):
click.echo("{}: {}".format(k, systeminfo[k]))
if path:
# create zip at path
zipfilename = os.path.join(path, get_systeminfo_bundle_name())
click.echo("Writing systeminfo bundle to {}...".format(zipfilename))
z = get_systeminfo_bundle(systeminfo, settings.getBaseFolder("logs"))
try:
with open(zipfilename, "wb") as f:
for data in z:
f.write(data)
except Exception as e:
click.echo(str(e), err=True)
click.echo(
"There was an error writing to {}.".format(zipfilename), err=True
)
ctx.exit(-1)
click.echo("Done!")
click.echo(zipfilename)
else:
# output systeminfo to console
for k in sorted(systeminfo.keys()):
click.echo("{}: {}".format(k, systeminfo[k]))
ctx.exit(0)
+1
View File
@@ -1,5 +1,6 @@
from typing import Union
from octoprint.logging import filters # noqa: F401
from octoprint.logging import handlers # noqa: F401
+29
View File
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
try:
from urllib import parse as urlparse
except ImportError:
import urlparse
class TornadoAccessFilter(logging.Filter):
def filter(self, record):
try:
status, request_line, rtt = record.args
if status == 409:
method, url, client = request_line.split()
u = urlparse.urlparse(url)
if u.path in ("/api/printer",):
record.levelno = logging.INFO
record.levelname = logging.getLevelName(record.levelno)
except Exception:
logging.getLogger(__name__).exception(
"Error while filtering log record {!r}".format(record)
)
return logging.Filter.filter(self, record)
+5 -3
View File
@@ -43,6 +43,7 @@ import requests
import sarge
from flask_babel import gettext
from octoprint.plugins.pluginmanager import DEFAULT_PLUGIN_REPOSITORY
from octoprint.settings import valid_boolean_trues
from octoprint.util.text import sanitize
@@ -1110,10 +1111,11 @@ class BackupPlugin(
basedir = settings._basedir
cls._clean_dir_backup(basedir, on_log_progress=on_log_progress)
plugin_repo = {}
repo_url = settings.global_get(["plugins", "pluginmanager", "repository"])
if repo_url:
plugin_repo = cls._get_plugin_repository_data(repo_url)
if not repo_url:
repo_url = DEFAULT_PLUGIN_REPOSITORY
plugin_repo = cls._get_plugin_repository_data(repo_url)
if callable(on_restore_start):
on_restore_start(path)
@@ -48,6 +48,9 @@ from . import exceptions
_DATA_FORMAT_VERSION = "v3"
DEFAULT_PLUGIN_REPOSITORY = "https://plugins.octoprint.org/plugins.json"
DEFAULT_PLUGIN_NOTICES = "https://plugins.octoprint.org/notices.json"
def map_repository_entry(entry):
if not isinstance(entry, dict):
@@ -267,9 +270,9 @@ class PluginManagerPlugin(
def get_settings_defaults(self):
return {
"repository": "https://plugins.octoprint.org/plugins.json",
"repository": DEFAULT_PLUGIN_REPOSITORY,
"repository_ttl": 24 * 60,
"notices": "https://plugins.octoprint.org/notices.json",
"notices": DEFAULT_PLUGIN_NOTICES,
"notices_ttl": 6 * 60,
"pip_args": None,
"pip_force_user": False,
@@ -1967,12 +1967,6 @@ class SoftwareUpdatePlugin(
elif check.get("pip", None):
# we force python unequality check for pip installs, to be able to downgrade
result["release_compare"] = "python_unequal"
result["pip_command"] = check.get(
"pip_command",
self._settings.global_get(
["server", "commands", "localPipCommand"]
),
)
elif target == "pip":
import pkg_resources
@@ -2016,12 +2010,13 @@ class SoftwareUpdatePlugin(
"current", check.get("displayVersion", None)
)
if "pip" in result:
if (
"pip_command" not in check
and self._settings.get(["pip_command"]) is not None
):
result["pip_command"] = self._settings.get(["pip_command"])
if result.get("pip", None):
if "pip_command" not in result:
local_pip_command = self._settings.global_get(
["server", "commands", "localPipCommand"]
)
if local_pip_command:
result["pip_command"] = local_pip_command
return result
+22 -3
View File
@@ -2027,7 +2027,6 @@ class Server:
"js/lib/loglevel.min.js",
"js/lib/sockjs.min.js",
"js/lib/ResizeSensor.js",
"js/lib/less.min.js",
"js/lib/hls.js",
]
js_client = [
@@ -2441,9 +2440,25 @@ class Server:
try:
self._intermediary_server.server_bind()
self._intermediary_server.server_activate()
except Exception:
except Exception as exc:
self._intermediary_server.server_close()
raise
if isinstance(exc, UnicodeDecodeError) and sys.platform == "win32":
# we end up here if the hostname contains non-ASCII characters due to
# https://bugs.python.org/issue26227 - tell the user they need
# to either change their hostname or read up other options in
# https://github.com/OctoPrint/OctoPrint/issues/3963
raise CannotStartServerException(
"OctoPrint cannot start due to a Python bug "
"(https://bugs.python.org/issue26227). Your "
"computer's host name contains non-ASCII characters. "
"Please either change your computer's host name to "
"contain only ASCII characters, or take a look at "
"https://github.com/OctoPrint/OctoPrint/issues/3963 for "
"other options."
)
else:
raise
def serve():
try:
@@ -2656,3 +2671,7 @@ class LifecycleManager:
for event in events:
if callback in self._plugin_lifecycle_callbacks[event]:
self._plugin_lifecycle_callbacks[event].remove(callback)
class CannotStartServerException(Exception):
pass
+9 -3
View File
@@ -39,9 +39,15 @@ def getSystemInfo():
)
from octoprint.util import dict_flatten
systeminfo = get_systeminfo(environmentDetector, connectivityChecker)
systeminfo["browser.user_agent"] = request.headers.get("User-Agent")
systeminfo["octoprint.safe_mode"] = safe_mode is not None
systeminfo = get_systeminfo(
environmentDetector,
connectivityChecker,
{
"browser.user_agent": request.headers.get("User-Agent"),
"octoprint.safe_mode": safe_mode is not None,
"systeminfo.generator": "systemapi",
},
)
if printer and printer.is_operational():
firmware_info = printer.firmware_info
+52 -52
View File
@@ -1385,7 +1385,12 @@ class DeprecatedEndpointHandler(CorsSupportMixin, tornado.web.RequestHandler):
class StaticZipBundleHandler(CorsSupportMixin, tornado.web.RequestHandler):
def initialize(
self, files=None, as_attachment=True, attachment_name=None, access_validation=None
self,
files=None,
as_attachment=True,
attachment_name=None,
access_validation=None,
compress=False,
):
if files is None:
files = []
@@ -1396,6 +1401,7 @@ class StaticZipBundleHandler(CorsSupportMixin, tornado.web.RequestHandler):
self._as_attachment = as_attachment
self._attachment_name = attachment_name
self._access_validator = access_validation
self._compress = compress
def get(self, *args, **kwargs):
if self._access_validator is not None:
@@ -1426,6 +1432,16 @@ class StaticZipBundleHandler(CorsSupportMixin, tornado.web.RequestHandler):
import zipstream
compress_type = zipstream.ZIP_STORED
if self._compress:
try:
import zlib # noqa: F401
compress_type = zipstream.ZIP_DEFLATED
except ImportError:
# no zlib, no compression
pass
z = zipstream.ZipFile()
for f in self.normalize_files(files):
# noinspection PyCompatibility
@@ -1435,11 +1451,11 @@ class StaticZipBundleHandler(CorsSupportMixin, tornado.web.RequestHandler):
content = f.get("content")
if path:
z.write(path, arcname=name, compress_type=zipstream.ZIP_STORED)
z.write(path, arcname=name, compress_type=compress_type)
elif iter and name:
z.write_iter(name, iter, compress_type=zipstream.ZIP_STORED)
z.write_iter(name, iter, compress_type=compress_type)
elif content and name:
z.writestr(name, content, compress_type=zipstream.ZIP_STORED)
z.writestr(name, content, compress_type=compress_type)
for chunk in z:
try:
@@ -1458,6 +1474,7 @@ class DynamicZipBundleHandler(StaticZipBundleHandler):
as_attachment=True,
attachment_name=None,
access_validation=None,
compress=False,
):
if as_attachment and not attachment_name:
raise ValueError("attachment name must be set if as_attachment is True")
@@ -1467,6 +1484,7 @@ class DynamicZipBundleHandler(StaticZipBundleHandler):
self._as_attachment = as_attachment
self._attachment_name = attachment_name
self._access_validator = access_validation
self._compress = compress
def get(self, *args, **kwargs):
if self._access_validator is not None:
@@ -1514,18 +1532,21 @@ class DynamicZipBundleHandler(StaticZipBundleHandler):
return self.stream_zip(files)
class SystemInfoBundleHandler(StaticZipBundleHandler):
class SystemInfoBundleHandler(CorsSupportMixin, tornado.web.RequestHandler):
# noinspection PyMethodOverriding
def initialize(self, access_validation=None):
self._as_attachment = True
self._attachment_name = "octoprint-systeminfo-{datetime}.zip"
self._access_validator = access_validation
@tornado.gen.coroutine
def get(self, *args, **kwargs):
if self._access_validator is not None:
self._access_validator(self.request)
from octoprint.cli.systeminfo import get_systeminfo
from octoprint.cli.systeminfo import (
get_systeminfo,
get_systeminfo_bundle,
get_systeminfo_bundle_name,
)
from octoprint.server import (
connectivityChecker,
environmentDetector,
@@ -1533,54 +1554,33 @@ class SystemInfoBundleHandler(StaticZipBundleHandler):
safe_mode,
)
from octoprint.settings import settings
from octoprint.util import dict_flatten
systeminfo = get_systeminfo(environmentDetector, connectivityChecker)
systeminfo["browser.user_agent"] = self.request.headers.get("User-Agent")
systeminfo["octoprint.safe_mode"] = safe_mode is not None
terminaltxt = None
if printer and printer.is_operational():
firmware_info = printer.firmware_info
if firmware_info:
systeminfo.update(
dict_flatten({"firmware": firmware_info["name"]}, prefix="printer")
)
if hasattr(printer, "_log"):
terminaltxt = list(printer._log)
logbase = settings().getBaseFolder("logs")
systeminfotxt = []
for k in sorted(systeminfo.keys()):
systeminfotxt.append("{}: {}".format(k, systeminfo[k]))
files = [
systeminfo = get_systeminfo(
environmentDetector,
connectivityChecker,
{
"name": "systeminfo.txt",
"content": octoprint.util.to_bytes("\n".join(systeminfotxt)),
"browser.user_agent": self.request.headers.get("User-Agent"),
"octoprint.safe_mode": safe_mode is not None,
"systeminfo.generator": "zipapi",
},
{"path": os.path.join(logbase, "octoprint.log"), "name": "octoprint.log"},
{"path": os.path.join(logbase, "serial.log"), "name": "serial.log"},
{
"path": os.path.join(logbase, "plugin_softwareupdate_console.log"),
"name": "plugin_softwareupdate_console.log",
},
{
"path": os.path.join(logbase, "plugin_pluginmanager_console.log"),
"name": "plugin_pluginmanager_console.log",
},
]
if terminaltxt is not None:
files.append(
{
"name": "terminal.txt",
"content": octoprint.util.to_bytes("\n".join(terminaltxt)),
}
)
)
return self.stream_zip(files)
z = get_systeminfo_bundle(
systeminfo, settings().getBaseFolder("logs"), printer=printer
)
self.set_header("Content-Type", "application/zip")
self.set_header(
"Content-Disposition",
'attachment; filename="{}"'.format(get_systeminfo_bundle_name()),
)
for chunk in z:
try:
self.write(chunk)
yield self.flush()
except tornado.iostream.StreamClosedError:
return
def get_attachment_name(self):
import time
+7 -1
View File
@@ -304,7 +304,13 @@ default_settings = {
"plugin_pi_support",
"login",
],
"sidebar": ["plugin_firmware_check", "connection", "state", "files"],
"sidebar": [
"plugin_firmware_check_warning",
"plugin_firmware_check_info",
"connection",
"state",
"files",
],
"tab": [
"temperature",
"control",
+1 -1
View File
@@ -1 +1 @@
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeaLine truncated
+4
View File
@@ -118,6 +118,10 @@ $(function () {
exports.browser.mobile = $.browser.mobile;
exports.browser.desktop = !exports.browser.mobile;
if (exports.browser.safari) {
$("html").addClass("safari");
}
// exports
exports.isVisible = function () {
@@ -152,19 +152,22 @@ $(function () {
self._reenableFancyTimer = undefined;
self._reenableUnfancyTimer = undefined;
self._disableFancy = function (difference) {
log.warn(
"Terminal: Detected slow client (needed " +
difference +
"ms for processing new log data), disabling fancy terminal functionality"
);
if (self.enableFancyFunctionality()) {
log.warn(
"Terminal: Detected slow client (needed " +
difference +
"ms for processing new log data), disabling fancy terminal functionality"
);
self.enableFancyFunctionality(false);
}
if (self._reenableFancyTimer) {
window.clearTimeout(self._reenableFancyTimer);
self._reenableFancyTimer = undefined;
}
self.enableFancyFunctionality(false);
};
self._reenableFancy = function (difference) {
if (self._reenableFancyTimer) return;
if (self.enableFancyFunctionality()) return;
self._reenableFancyTimer = window.setTimeout(function () {
log.info(
"Terminal: Client speed recovered, enabling fancy terminal functionality"
@@ -173,19 +176,22 @@ $(function () {
}, self.reenableTimeout);
};
self._disableUnfancy = function (difference) {
log.warn(
"Terminal: Detected very slow client (needed " +
difference +
"ms for processing new log data), completely disabling terminal output during printing"
);
if (!self.disableTerminalLogDuringPrinting()) {
log.warn(
"Terminal: Detected very slow client (needed " +
difference +
"ms for processing new log data), completely disabling terminal output during printing"
);
self.disableTerminalLogDuringPrinting(true);
}
if (self._reenableUnfancyTimer) {
window.clearTimeout(self._reenableUnfancyTimer);
self._reenableUnfancyTimer = undefined;
}
self.disableTerminalLogDuringPrinting(true);
};
self._reenableUnfancy = function () {
if (self._reenableUnfancyTimer) return;
if (!self.disableTerminalLogDuringPrinting()) return;
self._reenableUnfancyTimer = window.setTimeout(function () {
log.info(
"Terminal: Client speed recovered, enabling terminal output during printing"
@@ -202,23 +208,14 @@ $(function () {
var end = new Date().getTime();
var difference = end - start;
if (self.enableFancyFunctionality()) {
// fancy enabled -> check if we need to disable fancy
if (difference >= self.acceptableFancyTime) {
self._disableFancy(difference);
}
} else if (!self.disableTerminalLogDuringPrinting()) {
// fancy disabled, unfancy not -> check if we need to disable unfancy or re-enable fancy
if (difference >= self.acceptableUnfancyTime) {
self._disableUnfancy(difference);
} else if (difference < self.acceptableFancyTime / 2.0) {
self._reenableFancy(difference);
}
} else {
// fancy & unfancy disabled -> check if we need to re-enable unfancy
if (difference < self.acceptableUnfancyTime / 2.0) {
self._reenableUnfancy(difference);
}
if (difference >= self.acceptableFancyTime) {
self._disableFancy(difference);
} else if (difference >= self.acceptableUnfancyTime) {
self._disableUnfancy(difference);
} else if (difference < self.acceptableFancyTime / 2.0) {
self._reenableFancy(difference);
} else if (difference < self.acceptableUnfancyTime / 2.0) {
self._reenableUnfancy(difference);
}
};
+18
View File
@@ -1340,6 +1340,24 @@ _:future,
position: static;
}
// Speaking of Safari... it also wants to be special and doesn't consider scrollbars
// being visible that important and I'm frankly at a loss of words about that
.safari {
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
border-radius: 8px;
-webkit-border-radius: 8px;
}
::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: rgba(100, 100, 100, 0.8);
}
}
.scrollable {
height: 100%;
overflow: auto;
@@ -49,7 +49,7 @@
</div>
<div class="modal-footer">
<button class="btn aboutlink" data-bind="click: function() { about.show('about_about') }"><i class="fas fa-info-circle"></i> {{ _('About OctoPrint') }}</button>
<button class="btn systeminfolink" data-bind="click: function() { about.show('about_systeminfo') }"><i class="fas fa-flag-checkered"></i> {{ _('System info') }}</button>
<button class="btn systeminfolink" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.SYSTEM), click: function() { about.show('about_systeminfo') }"><i class="fas fa-flag-checkered"></i> {{ _('System info') }}</button>
<button class="btn" data-test-id="settings-close-button" data-bind="click: function() { cancelData() }" aria-hidden="true">{{ _('Close') }}</button>
<button class="btn btn-primary" data-test-id="settings-save" data-bind="click: function() { saveData(undefined, $root.hide) }, enable: !exchanging(), css: {disabled: exchanging()}"><i class="fas fa-spinner fa-spin" data-bind="visible: sending"></i> {{ _('Save') }}</button>
</div>
@@ -1,3 +1,7 @@
<div class="alert alert-block">
<strong>{{ _('Note: ') }}</strong>{{ _('Please note that OctoPrint merely embeds a webcam stream & access a snapshot URL. It does not actually run its own webcam server or interact directly with your camera. It thus can\'t impose access restrictions on it or enable/disable the stream for you. Please see <a href="%(url)s" target="_blank">this FAQ entry</a> for more explanation.', url="http://faq.octoprint.org/external-webcam-server") }}
</div>
<h3>{{ _('Webcam') }}</h3>
<form class="form-horizontal" onsubmit="return false;">
+1 -1
View File
@@ -10,6 +10,6 @@
<li><a href="https://faq.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fas fa-question-circle"></i> {{ _('FAQ') }}</a></li>
<li><a href="https://docs.octoprint.org" target="_blank" rel="noreferrer noopener"><i class="fas fa-book"></i> {{ _('Docs') }}</a></li>
<li id="footer_about"><a href="javascript:void(0)" data-bind="click: function() { show('about_about') }"><i class="fas fa-info-circle"></i> {{ _('About') }}</a></li>
<li id="footer_systeminfo"><a href="javascript:void(0)" data-bind="click: function() { show('about_systeminfo') }"><i class="fas fa-flag-checkered"></i> {{ _('System') }}</a></li>
<li id="footer_systeminfo" data-bind="visible: $root.loginState.hasPermissionKo($root.access.permissions.SYSTEM)"><a href="javascript:void(0)" data-bind="click: function() { show('about_systeminfo') }"><i class="fas fa-flag-checkered"></i> {{ _('System') }}</a></li>
</ul>
</div>
+10 -9
View File
@@ -61,9 +61,9 @@
<ul class="nav nav-list">
<li class="nav-header">{{ _('Navigation') }}</li>
<li><a href="#system-commands">{{ _('System commands') }}</a></li>
<li><a href="#system-info">{{ _('System info') }}</a></li>
<li data-bind="visible: printerConnected"><a href="#printer-control">{{ _('Printer control') }}</a></li>
<li data-bind="visible: backupSupported"><a href="#backups">{{ _('Backups') }}</a></li>
<li><a href="#system-info">{{ _('System info') }}</a></li>
</ul>
</div>
<div class="span9">
@@ -77,6 +77,15 @@
<!-- /ko -->
</div>
<div style="margin-bottom: 2em">
<h1 id="system-info">{{ _('System info') }}</h1>
<p data-bind="foreach: systemInfo">
<strong data-bind="text: key"></strong>: <span data-bind="text: value"></span><br />
</p>
<a href="{{ url_for('index', _external=True) }}downloads/systeminfo.zip" class="btn btn-primary"><i class="fas fa-download"></i> {{ _('Download Systeminfo Bundle') }}</a>
<a href="javascript:void(0)" class="btn" data-bind="click: copySystemInfo"><i class="far fa-copy"></i> {{ _('Copy') }}</a>
</div>
<div data-bind="visible: printerConnected" style="margin-bottom: 2em">
<h1 id="printer-control">{{ _('Printer control') }}</h1>
<button class="btn btn-block" data-bind="visible: jobInProgress, click: cancelPrint">{{ _('Cancel print') }}</button>
@@ -136,14 +145,6 @@
{{ _('There are no backups yet.') }}
</p>
</div>
<div style="margin-bottom: 2em">
<h1 id="system-info">{{ _('System info') }}</h1>
<p data-bind="foreach: systemInfo">
<strong data-bind="text: key"></strong>: <span data-bind="text: value"></span><br />
</p>
<a href="javascript:void(0)" data-bind="click: copySystemInfo"><i class="far fa-copy"></i> {{ _('Copy') }}</a>
</div>
</div>
</div>
</div>
@@ -4,3 +4,4 @@
{% assets "css_plugins" %}<link href="{{ ASSET_URL }}" rel="stylesheet" media="screen">{% endassets %}
{% assets "less_core" %}<link href="{{ ASSET_URL }}" rel="stylesheet/less" type="text/css" media="screen">{% endassets %}
{% assets "less_plugins" %}<link href="{{ ASSET_URL }}" rel="stylesheet/less" type="text/css" media="screen">{% endassets %}
<script src="{{ url_for('static', filename='js/lib/less.min.js') }}" type="text/javascript"></script>
+6 -6
View File
@@ -7,16 +7,16 @@
<a class="btn add-on" id="terminal-send" data-bind="click: sendCommand, enable: isOperational() && loginState.isUser()">{{ _('Send') }}</a>
</div>
</div>
<small class="pull-left" data-bind="visible: fancyFunctionality()">
<button class="btn btn-mini" data-bind="click: toggleAutoscroll, css: {active: autoscrollEnabled}">{{ _('Autoscroll') }}</button>
<small id="terminal-autoscroll-panel" class="pull-left" data-bind="visible: fancyFunctionality()">
<button class="btn btn-mini terminal-autoscroll" data-bind="click: toggleAutoscroll, css: {active: autoscrollEnabled}">{{ _('Autoscroll') }}</button>
<span data-bind="text: lineCount, visible: enableFancyFunctionality"></span>
<span data-bind="visible: !autoscrollEnabled() && enableFancyFunctionality()" style="display: none">(<a href="javascript:void(0)" data-bind="click: scrollToEnd">{{ _("Scroll to end") }}</a>)</span>
</small>
<small class="pull-right">
<a href="javascript:void(0)" data-bind="click: copyAll"><i class="fas fa-copy" title="{{ _('Copy all')|edq }}"></i> {{ _('Copy all') }}</a><br>
<a href="javascript:void(0)" data-bind="click: clearAllLogs"><i class="far fa-trash-alt" title="{{ _('Clear log window')|edq }}"></i> {{ _('Clear all') }}</a>
<small id="terminal-actions-panel" class="pull-right">
<a href="javascript:void(0)" data-bind="click: copyAll"><i class="fas fa-copy terminal-copy-all" title="{{ _('Copy all')|edq }}"></i> {{ _('Copy all') }}</a><br>
<a href="javascript:void(0)" data-bind="click: clearAllLogs"><i class="far fa-trash-alt terminal-clear-logs" title="{{ _('Clear log window')|edq }}"></i> {{ _('Clear all') }}</a>
</small>
<small class="pull-left text-warning" data-bind="visible: !fancyFunctionality()" style="display: none">
<small id="terminal-limited-functionality-panel" class="pull-left text-warning" data-bind="visible: !fancyFunctionality()" style="display: none">
{{ _('For performance reasons only a limited amount of terminal functionality is enabled right now.') }}
</small>
</div>
+2 -2
View File
@@ -2353,7 +2353,7 @@ class MachineCom:
if not filename.startswith("/"):
# file from the root of the sd -- we'll prepend a /
filename = "/" + filename
self._sdFiles.append((filename.lower(), size))
self._sdFiles.append((filename, size))
if longname is not None:
self._sdFilesMap[filename] = longname
continue
@@ -5072,7 +5072,7 @@ class MachineCom:
):
parts = cmd.split(None, 1)
if len(parts) > 1:
filename = parts[1].strip().lower()
filename = parts[1].strip()
if not filename.startswith("/"):
filename = "/" + filename
self._sdFileLongName = filename