Merge branch 'maintenance' into devel
This commit is contained in:
commit
49bc29fca3
15 files changed
+255
-16
No files matched your search
@@ -65,6 +65,19 @@ jobs:
|
||||
run: |
|
||||
pytest
|
||||
|
||||
test-js-unit:
|
||||
name: 🧪 JavaScript unit tests
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: 🏗 Set up test dependencies
|
||||
run: |
|
||||
npm -g install node-qunit-puppeteer@2.1.0
|
||||
- name: 🚀 Run helpers.js test suite
|
||||
run: |
|
||||
node-qunit-puppeteer tests/static/js/test-helpers.html
|
||||
|
||||
test-install:
|
||||
name: 🧪 Installation tests
|
||||
needs: build
|
||||
@@ -146,6 +159,7 @@ jobs:
|
||||
needs:
|
||||
- pre-commit
|
||||
- test-unit
|
||||
- test-js-unit
|
||||
- test-install
|
||||
- test-e2e
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -76,7 +76,7 @@ Change current timelapse config
|
||||
.. http:post:: /api/timelapse
|
||||
|
||||
Save a new :ref:`timelapse configuration <sec-api-timelapse-datamodel-config>` to use for the next print. Set the optional ``save`` flag in the
|
||||
configuration to ``true`` in order to make the new configuration persist accross restarts.
|
||||
configuration to ``true`` in order to make the new configuration persist across restarts.
|
||||
|
||||
The configuration is expected as the request body.
|
||||
|
||||
@@ -220,7 +220,7 @@ Timelapse configuration
|
||||
* - ``save``
|
||||
- 1
|
||||
- bool
|
||||
- Optional flag to be included when when saving a configuration to make the configuration persist accross restarts
|
||||
- Optional flag to be included when when saving a configuration to make the configuration persist across restarts
|
||||
|
||||
Further fields are timelapse type specific, see below for details.
|
||||
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ Various tests
|
||||
* ``content_type_whitelist``: Optional array of supported content types. If set and the URL returns a content
|
||||
type not included in this list, the test will fail. E.g. ``["image/*", "text/plain"]``.
|
||||
* ``content_type_blacklist``: Optional array of unsupported content types. If set and the URL returns a content
|
||||
type included in this list, the test wil fail. E.g. ``["video/*"]``. Can be used together with ``content_type_whitelist``
|
||||
type included in this list, the test will fail. E.g. ``["video/*"]``. Can be used together with ``content_type_whitelist``
|
||||
to further limit broader content type definition, e.g. by putting ``image/*`` into the whitelist, but disallowing
|
||||
PNG by including ``image/png`` on the blacklist.
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ The subnet to use is usually the IP address range of your LAN, which sounds scar
|
||||
actually isn't. Just `figure out your PC's IP address and subnet mask <https://lifehacker.com/how-to-find-your-local-and-external-ip-address-5833108>`_
|
||||
and then combine both with a / in between.
|
||||
|
||||
On OctoPi (or another Linux distribution) you can use the follwing command:
|
||||
On OctoPi (or another Linux distribution) you can use the following command:
|
||||
|
||||
.. code-block::
|
||||
|
||||
@@ -189,7 +189,7 @@ further down there's also a dedicated list of steps for OctoPi specifically.
|
||||
|
||||
4. Restart OctoPrint, check that everything works.
|
||||
|
||||
This will automatically log you in as the user you specified whenver you connect to
|
||||
This will automatically log you in as the user you specified whenever you connect to
|
||||
OctoPrint from an address in the address range (e.g. a device on your local network).
|
||||
|
||||
OctoPi specific steps
|
||||
|
||||
@@ -1433,7 +1433,7 @@ octoprint.server.http.access_validator
|
||||
|
||||
Allows adding additional access validators to the default tornado routers.
|
||||
|
||||
Your plugin might need to this to restrict acccess to downloads and webcam snapshots further.
|
||||
Your plugin might need to this to restrict access to downloads and webcam snapshots further.
|
||||
|
||||
.. important::
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ will now fail with an error. You'll need to explicitly make the import a relativ
|
||||
|
||||
from . import my_sub_package
|
||||
|
||||
To make your code behave the same in that regard unter both Python 2 and Python 3, you should add the corresponding
|
||||
To make your code behave the same in that regard in both Python 2 and Python 3, you should add the corresponding
|
||||
future import:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -97,7 +97,7 @@ def map_repository_entry(entry):
|
||||
entry["compatibility"]["python"]
|
||||
)
|
||||
else:
|
||||
# we default to only assume py2 compatiblity for now
|
||||
# we default to only assume py2 compatibility for now
|
||||
result["is_compatible"]["python"] = is_python_compatible(">=2.7,<3")
|
||||
|
||||
return result
|
||||
|
||||
@@ -1555,7 +1555,7 @@ var copyToClipboard = function (text) {
|
||||
};
|
||||
|
||||
var getExternalHostUrl = function () {
|
||||
var loc = window.location;
|
||||
var loc = fetchWindowLocation();
|
||||
var port = "";
|
||||
if (
|
||||
(loc.protocol === "http:" && loc.port !== "80") ||
|
||||
@@ -1576,7 +1576,7 @@ var validateWebcamUrl = function (streamUrl) {
|
||||
|
||||
if (lower.startsWith("//")) {
|
||||
// protocol relative
|
||||
toParse = window.location.protocol + streamUrl;
|
||||
toParse = fetchWindowLocation().protocol + streamUrl;
|
||||
} else if (lower.startsWith("/")) {
|
||||
// host relative
|
||||
toParse = getExternalHostUrl() + streamUrl;
|
||||
@@ -1751,3 +1751,7 @@ var startWebRTC = function (videoElement, streamUrl, iceServers) {
|
||||
negotiateWebRTC(streamUrl);
|
||||
return pc;
|
||||
};
|
||||
|
||||
var fetchWindowLocation = function () {
|
||||
return window.location;
|
||||
};
|
||||
@@ -868,7 +868,7 @@ $(function () {
|
||||
// If we found the rotation container, the view is rotated 90 degrees. This
|
||||
// means we need to manually calculate the player dimensions and apply them
|
||||
// to the rotation target where height = width and width = height (to
|
||||
// accomodate the rotation). The target is centered in the container and
|
||||
// accommodate the rotation). The target is centered in the container and
|
||||
// rotated around its center, so after we manually resized the container
|
||||
// everything will layout nicely.
|
||||
if (rotationContainer && player.videoWidth && player.videoHeight) {
|
||||
|
||||
@@ -41,7 +41,7 @@ $(function () {
|
||||
// system commands
|
||||
self.systemCommands = ko.observableArray([]);
|
||||
|
||||
// systen info
|
||||
// system info
|
||||
self.systemInfo = ko.observableArray([]);
|
||||
|
||||
// printer
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ sub {
|
||||
|
||||
img {
|
||||
/* Responsive images (ensure images don't scale beyond their parents) */
|
||||
max-width: 100%; /* Part 1: Set a maxium relative to the parent */
|
||||
max-width: 100%; /* Part 1: Set a maximum relative to the parent */
|
||||
width: auto\9; /* IE7-8 need help adjusting responsive images */
|
||||
height: auto; /* Part 2: Scale the height according to the width, otherwise you get stretching */
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class SerializableJsonEncoding(JsonEncoding):
|
||||
def encode(cls, val):
|
||||
"""
|
||||
Recursively replace all instances of encodable types with their encoded
|
||||
value. This is useful over the ``default=`` functionallity of the JSON
|
||||
value. This is useful over the ``default=`` functionality of the JSON
|
||||
encoder because JSON will not call default for tuples, lists, ints, etc:
|
||||
https://docs.python.org/3/library/json.html#json.JSONEncoder
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ def is_python_mismatch(lines):
|
||||
|
||||
def is_egg_problem(lines):
|
||||
"""
|
||||
Returns whether the given output lines indicates an occurence of the "egg-problem".
|
||||
Returns whether the given output lines indicates an occurrence of the "egg-problem".
|
||||
|
||||
If something (target or dependency of target) was installed as an egg at an earlier
|
||||
date (e.g. thanks to just running python setup.py install), pip install will throw an
|
||||
|
||||
@@ -896,7 +896,7 @@ class LocalStorageTest(unittest.TestCase):
|
||||
"""
|
||||
Adds a folder to the storage.
|
||||
|
||||
Verifies existance of folder.
|
||||
Verifies existence of folder.
|
||||
|
||||
Returns sanitized path.
|
||||
"""
|
||||
|
||||
@@ -189,3 +189,224 @@ QUnit.cases(
|
||||
"As expected: " + String(params.expected)
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.module("determineWebcamStreamType");
|
||||
QUnit.cases(
|
||||
(function () {
|
||||
var cases = [];
|
||||
|
||||
var params = [
|
||||
{
|
||||
streamUrl: undefined,
|
||||
exceptionExpected: "Empty streamUrl. Cannot determine stream type.",
|
||||
expectedResult: undefined
|
||||
},
|
||||
{
|
||||
streamUrl: "invalidUrl",
|
||||
exceptionExpected: "Invalid streamUrl. Cannot determine stream type.",
|
||||
expectedResult: undefined
|
||||
},
|
||||
{
|
||||
streamUrl: "webrtc://localhost/stream",
|
||||
exceptionExpected: undefined,
|
||||
expectedResult: "webrtc"
|
||||
},
|
||||
{
|
||||
streamUrl: "webrtcs://localhost/stream",
|
||||
exceptionExpected: undefined,
|
||||
expectedResult: "webrtc"
|
||||
},
|
||||
{
|
||||
streamUrl: "https://localhost/stream.m3u8",
|
||||
exceptionExpected: undefined,
|
||||
expectedResult: "hls"
|
||||
},
|
||||
{
|
||||
streamUrl: "https://localhost/stream",
|
||||
exceptionExpected: undefined,
|
||||
expectedResult: "mjpg"
|
||||
}
|
||||
];
|
||||
|
||||
var param, i;
|
||||
for (i = 0; i < params.length; i++) {
|
||||
param = params[i];
|
||||
param["title"] =
|
||||
String(param.streamUrl) +
|
||||
String(param.exceptionExpected) +
|
||||
String(param.expectedResult);
|
||||
cases.push(param);
|
||||
}
|
||||
|
||||
return cases;
|
||||
})()
|
||||
).test("determineWebcamStreamType", function (params, assert) {
|
||||
var exceptionMessage = undefined;
|
||||
var result = undefined;
|
||||
|
||||
try {
|
||||
result = determineWebcamStreamType(params.streamUrl);
|
||||
} catch (ex) {
|
||||
exceptionMessage = ex;
|
||||
}
|
||||
|
||||
assert.equal(
|
||||
params.exceptionExpected,
|
||||
exceptionMessage,
|
||||
"Exception expected: " + String(params.exceptionExpected)
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
params.expectedResult,
|
||||
result,
|
||||
"As expected: " + String(params.expectedResult)
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.module("validateWebcamUrl");
|
||||
QUnit.cases(
|
||||
(function () {
|
||||
var cases = [];
|
||||
|
||||
var params = [
|
||||
{
|
||||
streamUrl: undefined,
|
||||
expected: false,
|
||||
windowLocationOverride: undefined
|
||||
},
|
||||
{
|
||||
streamUrl: "//localhost/stream",
|
||||
expected: new URL("https://localhost/stream"),
|
||||
windowLocationOverride: {protocol: "https:"}
|
||||
},
|
||||
{
|
||||
streamUrl: "/stream",
|
||||
expected: new URL("https://localhost/stream"),
|
||||
windowLocationOverride: {
|
||||
protocol: "https:",
|
||||
port: "443",
|
||||
hostname: "localhost"
|
||||
}
|
||||
},
|
||||
{
|
||||
streamUrl: "http://localhost/stream",
|
||||
expected: new URL("http://localhost/stream"),
|
||||
windowLocationOverride: undefined
|
||||
},
|
||||
{
|
||||
streamUrl: "https://localhost/stream",
|
||||
expected: new URL("https://localhost/stream"),
|
||||
windowLocationOverride: undefined
|
||||
},
|
||||
{
|
||||
streamUrl: "webrtc://localhost/stream",
|
||||
expected: new URL("webrtc://localhost/stream"),
|
||||
windowLocationOverride: undefined
|
||||
},
|
||||
{
|
||||
streamUrl: "webrtcs://localhost/stream",
|
||||
expected: new URL("webrtcs://localhost/stream"),
|
||||
windowLocationOverride: undefined
|
||||
},
|
||||
{
|
||||
streamUrl: "invalid",
|
||||
expected: false,
|
||||
windowLocationOverride: undefined
|
||||
},
|
||||
{
|
||||
streamUrl: "//exception",
|
||||
expected: false,
|
||||
windowLocationOverride: {protocol: ":"}
|
||||
}
|
||||
];
|
||||
|
||||
var param, i;
|
||||
for (i = 0; i < params.length; i++) {
|
||||
param = params[i];
|
||||
param["title"] = String(param.streamUrl) + String(param.expected);
|
||||
cases.push(param);
|
||||
}
|
||||
|
||||
return cases;
|
||||
})()
|
||||
).test("validateWebcamUrl", function (params, assert) {
|
||||
if (params.windowLocationOverride) {
|
||||
fetchWindowLocation = function () {
|
||||
return params.windowLocationOverride;
|
||||
};
|
||||
}
|
||||
|
||||
var result = validateWebcamUrl(params.streamUrl);
|
||||
|
||||
assert.equal(
|
||||
params.expected.toString(),
|
||||
result.toString(),
|
||||
"As expected: " + String(params.expected)
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.module("getExternalHostUrl");
|
||||
QUnit.cases(
|
||||
(function () {
|
||||
var cases = [];
|
||||
|
||||
var params = [
|
||||
{
|
||||
windowLocation: {
|
||||
protocol: "https:",
|
||||
port: "443",
|
||||
hostname: "localhost"
|
||||
},
|
||||
expected: "https://localhost"
|
||||
},
|
||||
{
|
||||
windowLocation: {
|
||||
protocol: "https:",
|
||||
port: "8000",
|
||||
hostname: "localhost"
|
||||
},
|
||||
expected: "https://localhost:8000"
|
||||
},
|
||||
|
||||
{
|
||||
windowLocation: {
|
||||
protocol: "http:",
|
||||
port: "80",
|
||||
hostname: "localhost"
|
||||
},
|
||||
expected: "http://localhost"
|
||||
},
|
||||
{
|
||||
windowLocation: {
|
||||
protocol: "http:",
|
||||
port: "8000",
|
||||
hostname: "localhost"
|
||||
},
|
||||
expected: "http://localhost:8000"
|
||||
}
|
||||
];
|
||||
|
||||
var param, i;
|
||||
for (i = 0; i < params.length; i++) {
|
||||
param = params[i];
|
||||
param["title"] =
|
||||
String(param.windowLocation.protocol) +
|
||||
"//" +
|
||||
String(param.windowLocation.hostname) +
|
||||
String(param.windowLocation.port);
|
||||
cases.push(param);
|
||||
}
|
||||
|
||||
return cases;
|
||||
})()
|
||||
).test("getExternalHostUrl", function (params, assert) {
|
||||
if (params.windowLocation) {
|
||||
fetchWindowLocation = function () {
|
||||
return params.windowLocation;
|
||||
};
|
||||
}
|
||||
|
||||
var result = getExternalHostUrl();
|
||||
|
||||
assert.equal(params.expected, result, "As expected: " + String(params.expected));
|
||||
});
|
||||
Reference in new issue
Block a user