Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45d3e7c864 | ||
|
|
89412a761a | ||
|
|
b8b3cdde53 | ||
|
|
8c829048af | ||
|
|
14a5f89b59 | ||
|
|
65d5d8963b | ||
|
|
ea58e48dad | ||
|
|
0a605ccb12 | ||
|
|
0364130dd3 | ||
|
|
3ab84ed7e4 | ||
|
|
3f7bc1ebb5 | ||
|
|
57b8d0b88e | ||
|
|
458ab91f91 | ||
|
|
ab8ad72bc3 | ||
|
|
e9b6d22932 | ||
|
|
57b085ff5c | ||
|
|
0cfc08748b | ||
|
|
0188745d05 | ||
|
|
5246e2ccb4 | ||
|
|
f1d4cb670a | ||
|
|
9dd1e95eae | ||
|
|
6083943e03 | ||
|
|
a8ba43308e | ||
|
|
4511d8667b | ||
|
|
af3a63fd9b | ||
|
|
93e54f57e0 | ||
|
|
a884888caa | ||
|
|
c40ae9f181 | ||
|
|
e33b3b5883 | ||
|
|
1da4c2b7ab | ||
|
|
c5baa05b5e | ||
|
|
719c3e3b0b | ||
|
|
123266d0ff | ||
|
|
aa0ba6881c | ||
|
|
b8246d41e3 | ||
|
|
7d037ab1a4 | ||
|
|
01940bbb10 | ||
|
|
6ef5b5001e | ||
|
|
2a4853bbd4 | ||
|
|
6bac39c193 | ||
|
|
7915e6c04e | ||
|
|
d2a23c3dc7 | ||
|
|
27191f5202 | ||
|
|
87cd6de96c | ||
|
|
650d54d188 | ||
|
|
a2510cf32a | ||
|
|
42abcd7009 | ||
|
|
b150989286 | ||
|
|
736dca4d07 | ||
|
|
f2ca247731 | ||
|
|
fa148a8b7e | ||
|
|
20a3700a2c | ||
|
|
f1cc40a87c | ||
|
|
a19c9366ed | ||
|
|
46203fd43c | ||
|
|
38f1c74379 | ||
|
|
113dcd3fc9 | ||
|
|
0b471aae9e | ||
|
|
42769dad7d | ||
|
|
d2110c3013 | ||
|
|
32b655451c | ||
|
|
0bc2bd6e40 | ||
|
|
0ff72a3510 | ||
|
|
b61b75e015 | ||
|
|
7339cb5d7b | ||
|
|
78b503239e | ||
|
|
2da5799677 | ||
|
|
ee74453839 | ||
|
|
7fe5af0466 | ||
|
|
9f68900dc5 | ||
|
|
7c4e0b2344 | ||
|
|
75c1b02760 | ||
|
|
fd1ddab50f | ||
|
|
940909c0f8 | ||
|
|
622aad07dc | ||
|
|
9921887047 | ||
|
|
e3a83ccb00 | ||
|
|
13c575b3bc | ||
|
|
0c9c25fb41 | ||
|
|
ff67171d46 | ||
|
|
f6fef5e61f | ||
|
|
ff552daf31 | ||
|
|
cf9de3d11c | ||
|
|
637f34162f | ||
|
|
3846a55c5e | ||
|
|
6cc0a5ae34 | ||
|
|
e88bd1f441 | ||
|
|
4fc5aa7c3a | ||
|
|
ca493459b3 | ||
|
|
a01128b273 | ||
|
|
727c69bb3f | ||
|
|
43fc028e2e | ||
|
|
2e4c3fed24 | ||
|
|
805159b07f | ||
|
|
27d2e22433 | ||
|
|
bbab42cacd | ||
|
|
9b6a14cf19 | ||
|
|
9a48342ce2 | ||
|
|
eb8eeae418 | ||
|
|
331cc3614a | ||
|
|
5287dca4e5 | ||
|
|
ced1bbf53d | ||
|
|
d114551bd1 | ||
|
|
8d32f65c5b | ||
|
|
ada121d2ec | ||
|
|
eac45562f8 | ||
|
|
0461992496 | ||
|
|
7224970e2c | ||
|
|
a0c0b2d8af | ||
|
|
e9f9ad3a0d | ||
|
|
9deabb895a | ||
|
|
c2705a96f1 | ||
|
|
a370f1e42f | ||
|
|
5b022a7321 | ||
|
|
063ad6cb3b | ||
|
|
8bf0ef5ddb | ||
|
|
4ac8476f74 | ||
|
|
86925a43c4 | ||
|
|
70ba9d56ab | ||
|
|
f3327eb3aa | ||
|
|
22177092be | ||
|
|
f9387a46c3 | ||
|
|
8e13e4fcc0 | ||
|
|
a81e2cd983 | ||
|
|
987b2e858f | ||
|
|
6396d5ede0 | ||
|
|
6d8a131c6d | ||
|
|
a4eb739a95 | ||
|
|
533039619e | ||
|
|
6e6af0203d | ||
|
|
2e4b5ebef6 | ||
|
|
82b07ae8f2 | ||
|
|
a9440eea88 | ||
|
|
eeaac73a5d | ||
|
|
0ac205cdf2 | ||
|
|
b399ce6fbc | ||
|
|
9d1633ae65 | ||
|
|
def106f409 | ||
|
|
462f2e602b | ||
|
|
a6fc4b6c7f | ||
|
|
6625f81b6e | ||
|
|
7290a6d350 | ||
|
|
4555200027 | ||
|
|
4415481604 | ||
|
|
0aed3c05cb | ||
|
|
1903a7a319 | ||
|
|
4689e87a1f | ||
|
|
165b3421f1 | ||
|
|
80aa7933ab | ||
|
|
5dd1b19373 | ||
|
|
2f630f69de | ||
|
|
0a9e9ef3a3 | ||
|
|
143cffd060 | ||
|
|
1d48d49453 | ||
|
|
0a5f9dfc00 | ||
|
|
607e4b376c | ||
|
|
9042442bea | ||
|
|
55dafd511b | ||
|
|
ddb88ea737 | ||
|
|
31e98b8949 | ||
|
|
37526800c1 | ||
|
|
eef51b1cb9 | ||
|
|
8e662fea9e | ||
|
|
4c73774104 | ||
|
|
b675ec6137 | ||
|
|
0c5a458759 | ||
|
|
ff47314d76 | ||
|
|
86d442a1e3 | ||
|
|
a819b5d2ca | ||
|
|
379c969a9f | ||
|
|
c3d2b31232 | ||
|
|
a909be7f49 | ||
|
|
207da9cda1 | ||
|
|
23f2b6c7d0 | ||
|
|
6fc415bb67 | ||
|
|
e4f8448d26 | ||
|
|
72ebf6f4c4 | ||
|
|
5cbba2b2b7 | ||
|
|
eb3d73bcf3 | ||
|
|
12cca448c7 | ||
|
|
a4d6e24dad | ||
|
|
2206b84f3e | ||
|
|
488a75737c | ||
|
|
2570b296ca | ||
|
|
a2c38dbc12 | ||
|
|
fb43bc0e25 | ||
|
|
839dc3e07f | ||
|
|
2bbe566f72 | ||
|
|
23a4a581a5 | ||
|
|
80f94946e3 | ||
|
|
42943050fe | ||
|
|
dac60a6783 | ||
|
|
1a37f0209c | ||
|
|
db46b4fb6f | ||
|
|
2b527f333f | ||
|
|
73fbd15bca | ||
|
|
f88b5e8142 | ||
|
|
a934075407 | ||
|
|
2e5d97e99c | ||
|
|
499b9130dd | ||
|
|
fd640c6962 | ||
|
|
1eb022e42b | ||
|
|
6751d683f3 | ||
|
|
1f5391fc2c | ||
|
|
5533263e91 | ||
|
|
65a66b11eb | ||
|
|
052f81275b | ||
|
|
e0a5751d9f | ||
|
|
8a18963a72 | ||
|
|
12d674882a | ||
|
|
b0d3c4a512 | ||
|
|
97483bc0cb | ||
|
|
92cfa98d88 | ||
|
|
6d501c84c5 | ||
|
|
58a6649157 | ||
|
|
3387b22040 | ||
|
|
52d3b9cf13 | ||
|
|
b763c0516d | ||
|
|
f4ba30b4ce | ||
|
|
6367ab8bf9 | ||
|
|
d99d2581aa | ||
|
|
1d2e82644c | ||
|
|
4d8a6faac3 | ||
|
|
3fd88b4f13 | ||
|
|
2baea4e5de | ||
|
|
d71b8e9e82 | ||
|
|
2bd29a7cb2 | ||
|
|
5c1271a56e | ||
|
|
bbbebe35fd | ||
|
|
3e777dd43c | ||
|
|
f862473969 | ||
|
|
f016bb1e0c | ||
|
|
85de9d5f45 | ||
|
|
ed1b02dcb2 | ||
|
|
4ba94c3ce9 | ||
|
|
679713f169 | ||
|
|
1b66edcb2e | ||
|
|
9e3cf58bc9 | ||
|
|
84e6ea99f3 | ||
|
|
2281b6e8e9 | ||
|
|
90b94c265d | ||
|
|
e62d50eb21 | ||
|
|
4ddaf350b4 | ||
|
|
8330a1d05f | ||
|
|
3bc4ae14cc | ||
|
|
51f5ff4193 | ||
|
|
8bae5ace0f | ||
|
|
553f8ce28f | ||
|
|
fb8ef4e7fa | ||
|
|
15f5873cc2 | ||
|
|
ef3c8bb6c2 | ||
|
|
87b20ddfe9 | ||
|
|
7bd781e7d2 | ||
|
|
fa2153f3e3 | ||
|
|
c766e99743 | ||
|
|
d97fdb5ce8 | ||
|
|
a96167729c | ||
|
|
52f990b9cb | ||
|
|
403b638eb6 | ||
|
|
0a889dc7e6 | ||
|
|
81e1ad2ee7 | ||
|
|
6aa2fc51f9 | ||
|
|
127bd37e29 | ||
|
|
e3d360a51a | ||
|
|
45aff52c81 | ||
|
|
65b960f0f0 | ||
|
|
1c371a24fb | ||
|
|
2d8904e2cf | ||
|
|
5b92be5889 | ||
|
|
bec4d04c15 | ||
|
|
a871766175 | ||
|
|
97a82c0cc1 | ||
|
|
5cb7fa4dc9 | ||
|
|
e6336c62ab | ||
|
|
582c3739e7 | ||
|
|
258250131f | ||
|
|
2cb8b03f7b | ||
|
|
fedbbdf3fb | ||
|
|
aab012d530 | ||
|
|
b930fb0edb | ||
|
|
8fd3ec6d6a | ||
|
|
d215715b52 | ||
|
|
2519c764c3 | ||
|
|
dcd0a8499e | ||
|
|
09823115af | ||
|
|
6b379fbef3 | ||
|
|
00a5243ec9 | ||
|
|
2bed65d819 | ||
|
|
ae16dcc16a | ||
|
|
d513459c63 | ||
|
|
63e915c8cc | ||
|
|
bd2a72d178 | ||
|
|
a55eeaf794 | ||
|
|
e366bbb588 | ||
|
|
31161e7a08 | ||
|
|
e6b747aef5 | ||
|
|
c5759e3349 | ||
|
|
2fc094a563 | ||
|
|
99efba4fc3 | ||
|
|
43fe5cd8be | ||
|
|
2b603b6f60 | ||
|
|
26feb27b83 | ||
|
|
45b9fcefd2 | ||
|
|
5ad06bc602 | ||
|
|
40a0913fa4 | ||
|
|
f66421c1a8 | ||
|
|
ff09cd0e54 | ||
|
|
810ee2f6d0 | ||
|
|
09b07274ab | ||
|
|
8604b5c105 | ||
|
|
fde070665d | ||
|
|
ebe2c53de7 | ||
|
|
3fccee1bc2 | ||
|
|
0a658e1b2e | ||
|
|
02ec6c5a47 | ||
|
|
01574aadfe | ||
|
|
93f78efed4 | ||
|
|
7c66f51395 | ||
|
|
46d4a73955 | ||
|
|
c4c4d055ea | ||
|
|
8ee6b9fdf1 | ||
|
|
0da0e6cf8b | ||
|
|
79cd98d467 | ||
|
|
7767c16916 | ||
|
|
014d32b83b | ||
|
|
ee70e9d546 | ||
|
|
2cc0e91c38 | ||
|
|
596a01ab30 | ||
|
|
0861e6f176 | ||
|
|
3dfbad68c9 | ||
|
|
f99ba720a8 | ||
|
|
7e4c29befb | ||
|
|
ef7a247df3 | ||
|
|
b63eec3e91 | ||
|
|
5596daf346 | ||
|
|
99072cd63d | ||
|
|
eec9a5c6e9 | ||
|
|
669668a134 | ||
|
|
698c13b2f1 | ||
|
|
00057e997d | ||
|
|
851539cc6f | ||
|
|
761a0fdb61 | ||
|
|
85ce90ca52 | ||
|
|
8a01d89049 | ||
|
|
610a7ed8a8 | ||
|
|
27bbab9582 | ||
|
|
05cbe89d87 | ||
|
|
9781d5c1ff | ||
|
|
86751249be | ||
|
|
5b795014e2 | ||
|
|
504137d249 | ||
|
|
c37f83c6c3 | ||
|
|
fe7894fb5f | ||
|
|
38e8878ded | ||
|
|
0c3b0b8a40 | ||
|
|
cf560a47d5 | ||
|
|
e0b09857c4 | ||
|
|
0d035496f5 |
No files matched your search
@@ -13,6 +13,10 @@ trim_trailing_whitespace = true
|
|||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
|
[src/octoprint/vendor/sockjs/**.py]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
[src/octoprint/static/js/app/**.js]
|
[src/octoprint/static/js/app/**.js]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
contact_links:
|
||||||
|
- name: Have questions or need support?
|
||||||
|
url: https://community.octoprint.org
|
||||||
|
about: Please get in touch on the OctoPrint Community Forum!
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: Feature request
|
name: Feature request
|
||||||
about: Suggest an idea for this project
|
about: Suggest an idea for this project
|
||||||
|
title: '[Request]'
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
accessControl:
|
||||||
|
salt: zXmvzI3uWuTLkSPOEfA2ZLwn3f3sGUNS
|
||||||
|
plugins:
|
||||||
|
virtual_printer:
|
||||||
|
enabled: true
|
||||||
|
tracking:
|
||||||
|
enabled: false
|
||||||
|
server:
|
||||||
|
firstRun: false
|
||||||
|
onlineCheck:
|
||||||
|
enabled: false
|
||||||
|
pluginBlacklist:
|
||||||
|
enabled: false
|
||||||
|
secretKey: rrdHjvmeGMPSdYWg2NGdiM7mpz9pjekk
|
||||||
|
seenWizards:
|
||||||
|
backup: null
|
||||||
|
corewizard: 3
|
||||||
|
tracking: null
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
admin:
|
||||||
|
active: true
|
||||||
|
apikey: null
|
||||||
|
groups:
|
||||||
|
- admins
|
||||||
|
- users
|
||||||
|
password: 3033587f3b040680c77ce4fb7e8d61422878ef49a2a784227689f3b44ce66ada7f6161f8b2b037267f0d37b783a5600276eb88e1d224d24915f64e187a49a89f
|
||||||
|
permissions: []
|
||||||
|
roles:
|
||||||
|
- user
|
||||||
|
- admin
|
||||||
|
settings: {}
|
||||||
|
user:
|
||||||
|
active: true
|
||||||
|
apikey: null
|
||||||
|
groups:
|
||||||
|
- users
|
||||||
|
password: 3033587f3b040680c77ce4fb7e8d61422878ef49a2a784227689f3b44ce66ada7f6161f8b2b037267f0d37b783a5600276eb88e1d224d24915f64e187a49a89f
|
||||||
|
permissions: []
|
||||||
|
roles:
|
||||||
|
- user
|
||||||
|
settings: {}
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
name: Build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
release:
|
||||||
|
types: [published, prereleased]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: 🔨 Build distribution
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: 🏗 Set up Python 3.7
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.7
|
||||||
|
- name: 🏗 Install build dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install wheel --user
|
||||||
|
- name: 🔨 Build a binary wheel and a source tarball
|
||||||
|
run: |
|
||||||
|
python setup.py sdist bdist_wheel
|
||||||
|
- name: ⬆ Upload build result
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
|
||||||
|
test-unit:
|
||||||
|
name: 🧪 Unit tests
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python: ["2.7", "3.7", "3.8"]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: 🏗 Set up Python ${{ matrix.python }}
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: 🏗 Set up test dependencies
|
||||||
|
run: |
|
||||||
|
pip install -e .[develop]
|
||||||
|
- name: 🚀 Run test suite
|
||||||
|
run: |
|
||||||
|
pytest
|
||||||
|
|
||||||
|
test-flake8:
|
||||||
|
name: 🧪 Flake8
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: 🏗 Set up Python 3.7
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.7
|
||||||
|
- name: 🏗 Set up test dependencies
|
||||||
|
run: |
|
||||||
|
pip install -e .[develop]
|
||||||
|
- name: 🚀 Run test suite
|
||||||
|
run: |
|
||||||
|
flake8 src/ tests setup.py
|
||||||
|
|
||||||
|
test-install:
|
||||||
|
name: 🧪 Installation tests
|
||||||
|
needs: build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python: ["2.7", "3.7", "3.8"]
|
||||||
|
installable: ["wheel", "sdist"]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: ⬇ Download build result
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
- name: 🏗 Set up Python ${{ matrix.python }}
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: 🚀 Install wheel
|
||||||
|
if: matrix.installable == 'wheel'
|
||||||
|
run: |
|
||||||
|
pip install dist/OctoPrint-*-py2.py3-none-any.whl
|
||||||
|
- name: 🚀 Install source tarball
|
||||||
|
if: matrix.installable == 'sdist'
|
||||||
|
run: |
|
||||||
|
pip install dist/OctoPrint-*.tar.gz
|
||||||
|
|
||||||
|
test-e2e:
|
||||||
|
name: 🧪 E2E tests
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-16.04
|
||||||
|
steps:
|
||||||
|
- name: ⬇ Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: ⬇ Download build result
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
- name: 🏗 Set up Python 3.7
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.7
|
||||||
|
- name: 🚀 Install wheel
|
||||||
|
run: |
|
||||||
|
pip install dist/OctoPrint-*-py2.py3-none-any.whl
|
||||||
|
|
||||||
|
- name: 🏗 Create base config for test server
|
||||||
|
run: |
|
||||||
|
mkdir e2econfig
|
||||||
|
cp -r .github/fixtures/with_acl/* e2econfig
|
||||||
|
|
||||||
|
- name: 🚀 Run Cypress
|
||||||
|
uses: cypress-io/github-action@v2
|
||||||
|
with:
|
||||||
|
working-directory: tests/cypress
|
||||||
|
browser: chrome
|
||||||
|
start: 'octoprint -b ${{ github.workspace }}/e2econfig serve --host 127.0.0.1 --port 5000'
|
||||||
|
wait-on: 'http://127.0.0.1:5000/online.txt'
|
||||||
|
|
||||||
|
- name: ⬆ Upload screenshots
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: cypress-screenshots
|
||||||
|
path: tests/cypress/screenshots
|
||||||
|
- name: ⬆ Upload videos
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: cypress-videos
|
||||||
|
path: tests/cypress/videos
|
||||||
|
|
||||||
|
publish-on-testpypi:
|
||||||
|
name: 📦 Publish on TestPyPI
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
needs:
|
||||||
|
- test-unit
|
||||||
|
- test-install
|
||||||
|
- test-e2e
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: ⬇ Download build result
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
- name: 📦 Publish to index
|
||||||
|
uses: pypa/gh-action-pypi-publish@master
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
password: ${{ secrets.testpypi_password }}
|
||||||
|
repository_url: https://test.pypi.org/legacy/
|
||||||
|
|
||||||
|
publish-on-pypi:
|
||||||
|
name: 📦 Publish tagged releases to PyPI
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
needs: publish-on-testpypi
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: ⬇ Download build result
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist
|
||||||
|
- name: 📦 Publish to index
|
||||||
|
uses: pypa/gh-action-pypi-publish@master
|
||||||
|
with:
|
||||||
|
password: ${{ secrets.pypi_password }}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
name: "Issue Labeler"
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened, edited]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
apply-label:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/github-script@v2
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
let labels = [];
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (labels.length > 0) {
|
||||||
|
github.issues.addLabels({
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
labels: labels
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
name: 'Lock outdated issues & PRs'
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lock:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 🔒 Lock issues & PRs closed over a year
|
||||||
|
uses: dessant/lock-threads@v2
|
||||||
|
with:
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
issue-lock-comment: ''
|
||||||
|
pr-lock-comment: ''
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
name: Test install of branches and latest release twice per day
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 */12 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
install-branch:
|
||||||
|
name: Install branch
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ["ubuntu-latest"]
|
||||||
|
python: ["2.7", "3.7", "3.8"]
|
||||||
|
branch: ["master"]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: 🐍 Set up Python ${{ matrix.python }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: ⬇ Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ matrix.branch }}
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: 👷 Build and install checkout
|
||||||
|
run: |
|
||||||
|
pip install .
|
||||||
|
- name: 📧 Discord success notification
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
|
||||||
|
uses: Ilshidur/action-discord@master
|
||||||
|
with:
|
||||||
|
args: '☑️ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` was successful'
|
||||||
|
- name: 📧 Discord failure notification
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
|
||||||
|
uses: Ilshidur/action-discord@master
|
||||||
|
with:
|
||||||
|
args: '🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ matrix.branch }}` failed'
|
||||||
|
|
||||||
|
install-latest:
|
||||||
|
name: Install latest release
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ["ubuntu-latest"]
|
||||||
|
python: ["2.7", "3.7", "3.8"]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: 👀 Determine latest release
|
||||||
|
id: latest
|
||||||
|
uses: foosel/github-action-get-latest-release@master
|
||||||
|
with:
|
||||||
|
repository: "OctoPrint/OctoPrint"
|
||||||
|
- name: 🐍 Set up Python ${{ matrix.python }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: 👷 Build and install latest release
|
||||||
|
run: |
|
||||||
|
pip install https://github.com/OctoPrint/OctoPrint/archive/${{ steps.latest.outputs.release }}.zip
|
||||||
|
- name: 📧 Discord success notification
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
|
||||||
|
uses: Ilshidur/action-discord@master
|
||||||
|
with:
|
||||||
|
args: '☑️ Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ steps.latest.outputs.release }}` was successful'
|
||||||
|
- name: 📧 Discord failure notification
|
||||||
|
if: failure()
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.discord_webhook }}
|
||||||
|
uses: Ilshidur/action-discord@master
|
||||||
|
with:
|
||||||
|
args: '🚫 Test install on Python ${{ matrix.python }} under `${{ matrix.os }}` for `OctoPrint/OctoPrint:${{ steps.latest.outputs.release }}` failed'
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
name: Trigger docker build
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- released
|
||||||
|
- prereleased
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trigger:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 🚀 Repository Dispatch
|
||||||
|
uses: peter-evans/repository-dispatch@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.DOCKER_ACCESS_TOKEN }}
|
||||||
|
repository: OctoPrint/docker
|
||||||
|
event-type: octoprint-release
|
||||||
|
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "event-name": "${{ github.event_name }}", "event-type": "${{ github.event.action }}"}'
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
name: Trigger doc build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- released
|
||||||
|
- prereleased
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trigger:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 🚀 Repository Dispatch
|
||||||
|
uses: peter-evans/repository-dispatch@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.DOCS_ACCESS_TOKEN }}
|
||||||
|
repository: OctoPrint/docs.octoprint.org
|
||||||
|
event-type: docs
|
||||||
|
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
|
||||||
+15
-12
@@ -2,6 +2,7 @@ src/octoprint/templates/_data/AUTHORS.md
|
|||||||
src/octoprint/templates/_data/CHANGELOG.md
|
src/octoprint/templates/_data/CHANGELOG.md
|
||||||
src/octoprint/templates/_data/SUPPORTERS.md
|
src/octoprint/templates/_data/SUPPORTERS.md
|
||||||
src/octoprint/templates/_data/THIRDPARTYLICENSES.md
|
src/octoprint/templates/_data/THIRDPARTYLICENSES.md
|
||||||
|
docs/_build
|
||||||
|
|
||||||
devtools
|
devtools
|
||||||
|
|
||||||
@@ -19,24 +20,26 @@ linux-Cura-*
|
|||||||
Printrun
|
Printrun
|
||||||
=======
|
=======
|
||||||
.idea
|
.idea
|
||||||
|
.vscode
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Cura/current_profile.ini
|
Cura/current_profile.ini
|
||||||
Cura/preferences.ini
|
Cura/preferences.ini
|
||||||
build
|
build
|
||||||
dist
|
dist
|
||||||
pypy
|
pypy
|
||||||
OctoPrint.egg-info
|
|
||||||
*.orig
|
|
||||||
|
|
||||||
|
*.orig
|
||||||
*.codekit
|
*.codekit
|
||||||
|
|
||||||
venv
|
*.egg-info
|
||||||
venv2
|
.eggs
|
||||||
venv3
|
.mypy_cache
|
||||||
venv26
|
.pytest_cache
|
||||||
venv27
|
.tox
|
||||||
venv33
|
|
||||||
venv34
|
venv*
|
||||||
venv35
|
testconf*
|
||||||
venv36
|
|
||||||
venv37
|
node_modules
|
||||||
|
tests/cypress/screenshots
|
||||||
|
tests/cypress/videos
|
||||||
-22
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
language: python
|
|
||||||
dist: xenial
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- python: '3.7'
|
|
||||||
env: RUN_FLAKE8=true
|
|
||||||
|
|
||||||
python:
|
|
||||||
- "3.7"
|
|
||||||
- "3.6"
|
|
||||||
- "2.7"
|
|
||||||
install:
|
|
||||||
- pip install -e .[develop]
|
|
||||||
script:
|
|
||||||
- test -n "$RUN_FLAKE8" || pytest
|
|
||||||
- test -z "$RUN_FLAKE8" || flake8 --ignore=D,E,W,F401 src/ tests setup.py
|
|
||||||
sudo: false
|
|
||||||
git:
|
|
||||||
depth: 250
|
|
||||||
+14
-11
@@ -18,19 +18,22 @@ prerelease
|
|||||||
HEAD
|
HEAD
|
||||||
\(detached.*
|
\(detached.*
|
||||||
|
|
||||||
# maintenance is currently the branch for preparation of maintenance release 1.4.1
|
# maintenance is currently the branch for preparation of maintenance release 1.4.3
|
||||||
# so are any fix/... and improve/... branches
|
# so are any fix/... and improve/... branches
|
||||||
maintenance 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
maintenance 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
||||||
fix/.* 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
fix/.* 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
||||||
improve/.* 1.4.1 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
improve/.* 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
||||||
|
|
||||||
# staging/maintenance is currently the branch for preparation of 1.4.0rc6
|
# staging/hotfix is the branch for preparation of the 1.4.2 hotfix release
|
||||||
|
staging/hotfix 1.4.2 3ab84ed7e4c3aaaf71fe0f184b465f25d689f929 pep440-dev
|
||||||
|
|
||||||
|
# staging/maintenance is currently the branch for preparation of 1.4.1rc5
|
||||||
# so is regressionfix/...
|
# so is regressionfix/...
|
||||||
staging/maintenance 1.4.0rc6 73f7c4d8a11a7aea7b0ece474d3bf37ad53c65d4 pep440-dev
|
staging/maintenance 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev
|
||||||
regressionfix/.* 1.4.0rc6 73f7c4d8a11a7aea7b0ece474d3bf37ad53c65d4 pep440-dev
|
regressionfix/.* 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev
|
||||||
|
|
||||||
# staging/devel is currently inactive (but has the 1.4.0rc6 namespace)
|
# staging/devel is currently inactive (but has the 1.4.1rc4 namespace)
|
||||||
staging/devel 1.4.0rc6 73f7c4d8a11a7aea7b0ece474d3bf37ad53c65d4 pep440-dev
|
staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev
|
||||||
|
|
||||||
# every other branch is a development branch and thus gets resolved to 1.5.0-dev for now
|
# every other branch is a development branch and thus gets resolved to 2.0.0.dev for now
|
||||||
.* 1.5.0 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
.* 2.0.0 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
||||||
@@ -115,6 +115,13 @@ date of first contribution):
|
|||||||
* [Ludovico de Nittis](https://github.com/RyuzakiKK)
|
* [Ludovico de Nittis](https://github.com/RyuzakiKK)
|
||||||
* [Dominik Paľo](https://github.com/DominikPalo)
|
* [Dominik Paľo](https://github.com/DominikPalo)
|
||||||
* [Kelly Anderson](https://github.com/cbxbiker61)
|
* [Kelly Anderson](https://github.com/cbxbiker61)
|
||||||
|
* [Jim Neill](https://github.com/jneilliii)
|
||||||
|
* [Dustin Kerber](https://github.com/kerber)
|
||||||
|
* [Tobias Schürg](https://github.com/tobiasschuerg)
|
||||||
|
* [Josh Friend](https://github.com/joshfriend)
|
||||||
|
* [Lachlan Cresswell](https://github.com/lachyc)
|
||||||
|
* [Khoi Pham](https://github.com/osubuu)
|
||||||
|
* [Federico Nembrini](https://github.com/FedericoNembrini)
|
||||||
|
|
||||||
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
|
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
|
[Daid Braam](https://github.com/daid). Parts of its communication layer and
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
See [the releases on Github](https://github.com/foosel/OctoPrint/releases) for detailed changelogs for all releases
|
See [the releases on Github](https://github.com/OctoPrint/OctoPrint/releases) for detailed changelogs for all releases
|
||||||
and release candidates.
|
and release candidates.
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
# OctoPrint
|
# OctoPrint
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
[](https://travis-ci.org/foosel/OctoPrint)
|

|
||||||
[](https://community.octoprint.org)
|

|
||||||
[](https://chat.octoprint.org)
|
[](https://community.octoprint.org)
|
||||||
|
[](https://discord.octoprint.org)
|
||||||
[](https://twitter.com/OctoPrint3d)
|
[](https://twitter.com/OctoPrint3d)
|
||||||
|
|
||||||
|
|
||||||
@@ -13,9 +14,9 @@ and released under the [GNU Affero General Public License V3](http://www.gnu.org
|
|||||||
|
|
||||||
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
|
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
|
||||||
|
|
||||||
The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme).
|
The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme). It also serves as central knowledge base.
|
||||||
|
|
||||||
The official IRC channel is [#octoprint on freenode](https://chat.octoprint.org). Its logs can be found [here](https://freenode.logbot.info/octoprint).
|
An invite to the Discord server can be found at [discord.octoprint.org](https://discord.octoprint.org).
|
||||||
|
|
||||||
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
|
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
|
||||||
|
|
||||||
@@ -30,17 +31,17 @@ If you enjoy OctoPrint, please consider becoming a regular supporter!**
|
|||||||
|
|
||||||
You are currently looking at the source code repository of OctoPrint. If you already installed it
|
You are currently looking at the source code repository of OctoPrint. If you already installed it
|
||||||
(e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only
|
(e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only
|
||||||
want to find out how to use it, [the documentation](http://docs.octoprint.org/) and [the public wiki](https://github.com/foosel/OctoPrint/wiki)
|
want to find out how to use it, [the documentation](http://docs.octoprint.org/) might be of more interest for you. You might also want to subscribe to join
|
||||||
might be of more interest for you. You might also want to subscribe to join
|
|
||||||
[the community forum at community.octoprint.org](https://community.octoprint.org) where there are other active users who might be
|
[the community forum at community.octoprint.org](https://community.octoprint.org) where there are other active users who might be
|
||||||
able to help you with any questions you might have.
|
able to help you with any questions you might have.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions of all kinds are welcome, not only in the form of code but also with regards to the
|
Contributions of all kinds are welcome, not only in the form of code but also with regards to the
|
||||||
[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), debugging help
|
[official documentation](http://docs.octoprint.org/), debugging help
|
||||||
in the [bug tracker](https://github.com/foosel/OctoPrint/issues), support of other users on
|
in the [bug tracker](https://github.com/OctoPrint/OctoPrint/issues), support of other users on
|
||||||
[the community forum at community.octoprint.org](https://community.octoprint.org)
|
[the community forum at community.octoprint.org](https://community.octoprint.org) or
|
||||||
|
[the official discord at discord.octoprint.org](https://discord.octoprint.org)
|
||||||
and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
|
and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
|
||||||
|
|
||||||
If you think something is bad about OctoPrint or its documentation the way it is, please help
|
If you think something is bad about OctoPrint or its documentation the way it is, please help
|
||||||
@@ -48,12 +49,12 @@ in any way to make it better instead of just complaining about it -- this is an
|
|||||||
after all :)
|
after all :)
|
||||||
|
|
||||||
For information about how to go about submitting bug reports or pull requests, please see the project's
|
For information about how to go about submitting bug reports or pull requests, please see the project's
|
||||||
[Contribution Guidelines](https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md).
|
[Contribution Guidelines](https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Installation instructions for installing from source for different operating
|
Installation instructions for installing from source for different operating
|
||||||
systems can be found [on the wiki](https://github.com/foosel/OctoPrint/wiki#assorted-guides).
|
systems can be found [on the forum](https://community.octoprint.org/tags/c/support/guides/15/setup).
|
||||||
|
|
||||||
If you want to run OctoPrint on a Raspberry Pi, you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi)
|
If you want to run OctoPrint on a Raspberry Pi, you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi)
|
||||||
which is a custom SD card image that includes OctoPrint plus dependencies.
|
which is a custom SD card image that includes OctoPrint plus dependencies.
|
||||||
@@ -61,12 +62,18 @@ which is a custom SD card image that includes OctoPrint plus dependencies.
|
|||||||
The generic steps that should basically be done regardless of operating system
|
The generic steps that should basically be done regardless of operating system
|
||||||
and runtime environment are the following (as *regular
|
and runtime environment are the following (as *regular
|
||||||
user*, please keep your hands *off* of the `sudo` command here!) - this assumes
|
user*, please keep your hands *off* of the `sudo` command here!) - this assumes
|
||||||
you already have Python 2.7, 3.6 or 3.7, pip and virtualenv set up on your system:
|
you already have Python 2.7, 3.6 or 3.7, pip and virtualenv and their dependencies set up on your system:
|
||||||
|
|
||||||
1. Checkout OctoPrint: `git clone https://github.com/foosel/OctoPrint.git`
|
1. Create a user-owned virtual environment therein: `virtualenv venv`. If you want to specify a specific python
|
||||||
|
to use instead of whatever version your system defaults to, you can also explicitly require that via the `--python`
|
||||||
|
parameter, e.g. `virtualenv --python=python3 venv`.
|
||||||
|
2. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install OctoPrint`
|
||||||
|
|
||||||
|
Or alternatively, for an install from source:
|
||||||
|
|
||||||
|
1. Checkout OctoPrint: `git clone https://github.com/OctoPrint/OctoPrint.git`
|
||||||
2. Change into the OctoPrint folder: `cd OctoPrint`
|
2. Change into the OctoPrint folder: `cd OctoPrint`
|
||||||
3. Create a user-owned virtual environment therein: `virtualenv venv` if your system default python version is
|
3. Create a user-owned virtual environment therein: `virtualenv venv`
|
||||||
python 2.7, otherwise you need to specify the version explicitly, e.g. `virtualenv --python=python2.7 venv`.
|
|
||||||
4. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install .`
|
4. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install .`
|
||||||
|
|
||||||
You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octoprint`, see [Usage](#usage)
|
You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octoprint`, see [Usage](#usage)
|
||||||
@@ -78,11 +85,7 @@ access control as necessary.
|
|||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
OctoPrint depends on a few python modules to do its job. Those are automatically installed when installing
|
OctoPrint depends on a few python modules to do its job. Those are automatically installed when installing
|
||||||
OctoPrint via `pip`:
|
OctoPrint via `pip`.
|
||||||
|
|
||||||
pip install .
|
|
||||||
|
|
||||||
You should do this every time after pulling from the repository, since the dependencies may have changed.
|
|
||||||
|
|
||||||
OctoPrint currently supports Python 2.7, 3.6 and 3.7.
|
OctoPrint currently supports Python 2.7, 3.6 and 3.7.
|
||||||
|
|
||||||
@@ -90,7 +93,7 @@ OctoPrint currently supports Python 2.7, 3.6 and 3.7.
|
|||||||
|
|
||||||
Running the pip install via
|
Running the pip install via
|
||||||
|
|
||||||
pip install .
|
pip install OctoPrint
|
||||||
|
|
||||||
installs the `octoprint` script in your Python installation's scripts folder
|
installs the `octoprint` script in your Python installation's scripts folder
|
||||||
(which, depending on whether you installed OctoPrint globally or into a virtual env, will be in your `PATH` or not). The
|
(which, depending on whether you installed OctoPrint globally or into a virtual env, will be in your `PATH` or not). The
|
||||||
|
|||||||
+12
-13
@@ -1,23 +1,23 @@
|
|||||||
# Supporters
|
# Supporters
|
||||||
|
|
||||||
Development of this version of OctoPrint wouldn't have been possible without
|
Development of this version of OctoPrint wouldn't have been possible without
|
||||||
[the financial support by the community](https://octoprint.org/support-octoprint/) -
|
[the financial support by the community](https://support.octoprint.org) -
|
||||||
thanks to everyone who contributed!
|
thanks to everyone who contributed!
|
||||||
|
|
||||||
## Patreon Patrons
|
## Patrons & Sponsors
|
||||||
|
|
||||||
* Alex Krilov
|
|
||||||
* Andrew Moorby
|
* Andrew Moorby
|
||||||
* Arnljot Arntsen
|
* Arnljot Arntsen
|
||||||
|
* Ash King
|
||||||
* BigTreeTech
|
* BigTreeTech
|
||||||
* Boris Hussein
|
* Boris Hussein
|
||||||
* Brad Jackson
|
* Brad Jackson
|
||||||
|
* BuildBee
|
||||||
* Christian Petropolis
|
* Christian Petropolis
|
||||||
* Christian Wolf
|
* Christian Wolf
|
||||||
* D Brian Kimmel
|
* D Brian Kimmel
|
||||||
* DeltaMaker 3D Printers
|
* DeltaMaker 3D Printers
|
||||||
* Dennis Breining
|
* Dennis Breining
|
||||||
* Dorian Gray
|
|
||||||
* Eric Betts
|
* Eric Betts
|
||||||
* Ernesto Martinez
|
* Ernesto Martinez
|
||||||
* Franziska Kunsmann
|
* Franziska Kunsmann
|
||||||
@@ -27,8 +27,9 @@ thanks to everyone who contributed!
|
|||||||
* Hog Duske
|
* Hog Duske
|
||||||
* Hugh Blemings
|
* Hugh Blemings
|
||||||
* jean-claude migneault
|
* jean-claude migneault
|
||||||
* Jeff Renfer
|
* Jeremy Cole
|
||||||
* Jeremiah Avery
|
* Joe Pasqua
|
||||||
|
* John Robinson
|
||||||
* Joshua Wills
|
* Joshua Wills
|
||||||
* Justin Kaufman
|
* Justin Kaufman
|
||||||
* Kaile Riser
|
* Kaile Riser
|
||||||
@@ -41,26 +42,24 @@ thanks to everyone who contributed!
|
|||||||
* Lee Dohm
|
* Lee Dohm
|
||||||
* Makespace Madrid
|
* Makespace Madrid
|
||||||
* Mark Walker
|
* Mark Walker
|
||||||
* Martin Majewski
|
|
||||||
* Michael Aumock
|
* Michael Aumock
|
||||||
* Miles Flavel
|
* Miles Flavel
|
||||||
* Mosaic Manufacturing
|
* Mosaic Manufacturing
|
||||||
* Neil R. Goldberg
|
* Neil R. Goldberg
|
||||||
* Patrick Glyré
|
|
||||||
* Patrick McGinnis
|
* Patrick McGinnis
|
||||||
* Prof Yuh Wen Chen
|
* Prof Yuh Wen Chen
|
||||||
|
* Raise3D
|
||||||
* Randy C. Will
|
* Randy C. Will
|
||||||
* Ranjib Dey
|
* Ranjib Dey
|
||||||
* Richard Michaud
|
* Richard Michaud
|
||||||
* Rigid3D
|
|
||||||
* Robert Gusek
|
* Robert Gusek
|
||||||
* Ronald Griehsler
|
* Ronald Griehsler
|
||||||
* Sacha Telgenhof
|
* Sacha Telgenhof
|
||||||
* Simon Hallam
|
* Sebastien Andrivet
|
||||||
* Stefan Krister
|
* Stefan Krister
|
||||||
* Steve Thompson
|
* Steve Thompson
|
||||||
|
* Stewart Danos
|
||||||
* Sven Mueller
|
* Sven Mueller
|
||||||
* Trent Shumay
|
|
||||||
* Ulrich Kempken
|
* Ulrich Kempken
|
||||||
|
|
||||||
and 1741 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)!
|
and 1943 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [Github Sponsors](https://github.com/users/foosel/sponsorship)!
|
||||||
+11
-1
@@ -24,10 +24,12 @@
|
|||||||
* [LESS](http://lesscss.org): Apache License 2.0
|
* [LESS](http://lesscss.org): Apache License 2.0
|
||||||
* [lodash](https://lodash.com): MIT
|
* [lodash](https://lodash.com): MIT
|
||||||
* [Loglevel](https://github.com/pimterry/loglevel): MIT
|
* [Loglevel](https://github.com/pimterry/loglevel): MIT
|
||||||
|
* [md5.js](https://blueimp.github.io/JavaScript-MD5/): MIT
|
||||||
* [Modernizr](http://modernizr.com): MIT
|
* [Modernizr](http://modernizr.com): MIT
|
||||||
* [Moment.js](http://momentjs.com/): MIT
|
* [Moment.js](http://momentjs.com/): MIT
|
||||||
* [PNotify](http://sciactive.com/pnotify/): GPL, LGPL, MPL (triple licensed)
|
* [PNotify](http://sciactive.com/pnotify/): GPL, LGPL, MPL (triple licensed)
|
||||||
* [pusher.color.js](http://cache.preserve.io/5g18q0pw/index.html) (original link dead): MIT
|
* [pusher.color.js](http://cache.preserve.io/5g18q0pw/index.html) (original link dead): MIT
|
||||||
|
* [ResizeSensor.js](https://github.com/procurios/ResizeSensor): MIT
|
||||||
* [SockJS](https://github.com/sockjs/sockjs-client): MIT
|
* [SockJS](https://github.com/sockjs/sockjs-client): MIT
|
||||||
* [sprintf-js](http://alexei.ro/): BSD
|
* [sprintf-js](http://alexei.ro/): BSD
|
||||||
|
|
||||||
@@ -39,12 +41,14 @@
|
|||||||
* [Click](http://click.pocoo.org/): BSD
|
* [Click](http://click.pocoo.org/): BSD
|
||||||
* [emoji](https://github.com/carpedm20/emoji/): BSD
|
* [emoji](https://github.com/carpedm20/emoji/): BSD
|
||||||
* [feedparser](https://github.com/kurtmckee/feedparser): BSD
|
* [feedparser](https://github.com/kurtmckee/feedparser): BSD
|
||||||
|
* [filetype](https://h2non.github.io/filetype.py/): MIT
|
||||||
* [Flask](http://flask.pocoo.org/): BSD
|
* [Flask](http://flask.pocoo.org/): BSD
|
||||||
* [Flask-Assets](http://github.com/miracle2k/flask-assets): BSD
|
* [Flask-Assets](http://github.com/miracle2k/flask-assets): BSD
|
||||||
* [Flask-Babel](http://github.com/mitsuhiko/flask-babel): BSD
|
* [Flask-Babel](http://github.com/mitsuhiko/flask-babel): BSD
|
||||||
* [Flask-Login](https://github.com/maxcountryman/flask-login): MIT
|
* [Flask-Login](https://github.com/maxcountryman/flask-login): MIT
|
||||||
* [Flask-Markdown](http://github.com/dcolish/flask-markdown): BSD
|
* [Flask-Markdown](http://github.com/dcolish/flask-markdown): BSD
|
||||||
* [Flask-Principal](http://packages.python.org/Flask-Principal/): MIT
|
* [Flask-Principal](http://packages.python.org/Flask-Principal/): MIT
|
||||||
|
* [frozendict](https://github.com/slezica/python-frozendict): MIT
|
||||||
* [future](https://python-future.org/): MIT
|
* [future](https://python-future.org/): MIT
|
||||||
* [futures](https://github.com/agronholm/pythonfutures): Python
|
* [futures](https://github.com/agronholm/pythonfutures): Python
|
||||||
* [monotonic](https://github.com/atdt/monotonic): Apache License 2.0
|
* [monotonic](https://github.com/atdt/monotonic): Apache License 2.0
|
||||||
@@ -58,19 +62,25 @@
|
|||||||
* [requests](http://python-requests.org/): Apache License 2.0
|
* [requests](http://python-requests.org/): Apache License 2.0
|
||||||
* [rsa](http://stuvel.eu/rsa): Apache License 2.0
|
* [rsa](http://stuvel.eu/rsa): Apache License 2.0
|
||||||
* [sarge](http://sarge.readthedocs.org/): BSD
|
* [sarge](http://sarge.readthedocs.org/): BSD
|
||||||
|
* [sentry-sdk](https://github.com/getsentry/sentry-python): BSD
|
||||||
* [scandir](https://github.com/benhoyt/scandir): BSD
|
* [scandir](https://github.com/benhoyt/scandir): BSD
|
||||||
* [semantic_version](https://github.com/rbarrois/python-semanticversion): BSD
|
* [semantic_version](https://github.com/rbarrois/python-semanticversion): BSD
|
||||||
* [SockJS-Tornado](http://github.com/mrjoes/sockjs-tornado/): MIT
|
* [SockJS-Tornado](http://github.com/mrjoes/sockjs-tornado/): MIT
|
||||||
* [Tornado](http://www.tornadoweb.org/): Apache License 2.0
|
* [Tornado](http://www.tornadoweb.org/): Apache License 2.0
|
||||||
|
* [typing](https://pypi.org/project/typing/): Python
|
||||||
* [watchdog](http://github.com/gorakhargosh/watchdog): Apache License 2.0
|
* [watchdog](http://github.com/gorakhargosh/watchdog): Apache License 2.0
|
||||||
* [websocket-client](https://github.com/liris/websocket-client): LGPLv3
|
* [websocket-client](https://github.com/liris/websocket-client): LGPLv3
|
||||||
* [wrapt](http://wrapt.readthedocs.org/): BSD
|
* [wrapt](http://wrapt.readthedocs.org/): BSD
|
||||||
|
|
||||||
## Development (testing, documentation generation, etc)
|
## Development (testing, documentation generation, etc)
|
||||||
|
|
||||||
|
* [cookiecutter](https://github.com/cookiecutter/cookiecutter): BSD
|
||||||
* [ddt](https://github.com/txels/ddt): MIT
|
* [ddt](https://github.com/txels/ddt): MIT
|
||||||
|
* [flake8](https://gitlab.com/pycqa/flake8): MIT
|
||||||
* [mock](https://github.com/testing-cabal/mock): BSD
|
* [mock](https://github.com/testing-cabal/mock): BSD
|
||||||
* [nose](http://pythonhosted.org/nose/): LGPL
|
* [pyinstrument](https://github.com/joerick/pyinstrument): BSD
|
||||||
|
* [pytest](https://docs.pytest.org/en/latest/): MIT
|
||||||
|
* [pytest-doctest-custom](http://github.com/danilobellini/pytest-doctest-custom): MIT
|
||||||
* [Sphinx](http://sphinx-doc.org/): BSD
|
* [Sphinx](http://sphinx-doc.org/): BSD
|
||||||
* [sphinxcontrib-httpdomain](https://bitbucket.org/birkenfeld/sphinx-contrib/src/default/httpdomain/): BSD
|
* [sphinxcontrib-httpdomain](https://bitbucket.org/birkenfeld/sphinx-contrib/src/default/httpdomain/): BSD
|
||||||
* [sphinxcontrib-mermad](https://github.com/mgaitan/sphinxcontrib-mermaid): BSD
|
* [sphinxcontrib-mermad](https://github.com/mgaitan/sphinxcontrib-mermaid): BSD
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
[python: src/octoprint/**.py]
|
[python: src/octoprint/**.py]
|
||||||
|
|
||||||
[jinja2: src/octoprint/templates/**.jinja2]
|
[jinja2: src/octoprint/templates/**.jinja2]
|
||||||
|
silent=false
|
||||||
|
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension, jinja2.ext.do, octoprint.util.jinja.trycatch
|
||||||
|
|
||||||
[jinja2: src/octoprint/plugins/**.jinja2]
|
[jinja2: src/octoprint/plugins/**.jinja2]
|
||||||
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension
|
silent=false
|
||||||
|
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension, jinja2.ext.do, octoprint.util.jinja.trycatch
|
||||||
|
|
||||||
[javascript: src/octoprint/static/js/app/**.js]
|
[javascript: src/octoprint/static/js/app/**.js]
|
||||||
|
extract_messages = gettext, ngettext
|
||||||
|
|
||||||
[javascript: src/octoprint/plugins/**.js]
|
[javascript: src/octoprint/plugins/**.js]
|
||||||
extract_messages = gettext, ngettext
|
extract_messages = gettext, ngettext
|
||||||
-177
@@ -1,177 +0,0 @@
|
|||||||
# Makefile for Sphinx documentation
|
|
||||||
#
|
|
||||||
|
|
||||||
# You can set these variables from the command line.
|
|
||||||
SPHINXOPTS =
|
|
||||||
SPHINXBUILD = sphinx-build
|
|
||||||
PAPER =
|
|
||||||
BUILDDIR = _build
|
|
||||||
|
|
||||||
# User-friendly check for sphinx-build
|
|
||||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
|
||||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Internal variables.
|
|
||||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
|
||||||
PAPEROPT_letter = -D latex_paper_size=letter
|
|
||||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
|
||||||
# the i18n builder cannot share the environment and doctrees with the others
|
|
||||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
|
||||||
|
|
||||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "Please use \`make <target>' where <target> is one of"
|
|
||||||
@echo " html to make standalone HTML files"
|
|
||||||
@echo " dirhtml to make HTML files named index.html in directories"
|
|
||||||
@echo " singlehtml to make a single large HTML file"
|
|
||||||
@echo " pickle to make pickle files"
|
|
||||||
@echo " json to make JSON files"
|
|
||||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
|
||||||
@echo " qthelp to make HTML files and a qthelp project"
|
|
||||||
@echo " devhelp to make HTML files and a Devhelp project"
|
|
||||||
@echo " epub to make an epub"
|
|
||||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
|
||||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
|
||||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
|
||||||
@echo " text to make text files"
|
|
||||||
@echo " man to make manual pages"
|
|
||||||
@echo " texinfo to make Texinfo files"
|
|
||||||
@echo " info to make Texinfo files and run them through makeinfo"
|
|
||||||
@echo " gettext to make PO message catalogs"
|
|
||||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
|
||||||
@echo " xml to make Docutils-native XML files"
|
|
||||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
|
||||||
@echo " linkcheck to check all external links for integrity"
|
|
||||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(BUILDDIR)/*
|
|
||||||
|
|
||||||
html:
|
|
||||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
|
||||||
|
|
||||||
dirhtml:
|
|
||||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
|
||||||
|
|
||||||
singlehtml:
|
|
||||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
|
||||||
|
|
||||||
pickle:
|
|
||||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
|
||||||
@echo
|
|
||||||
@echo "Build finished; now you can process the pickle files."
|
|
||||||
|
|
||||||
json:
|
|
||||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
|
||||||
@echo
|
|
||||||
@echo "Build finished; now you can process the JSON files."
|
|
||||||
|
|
||||||
htmlhelp:
|
|
||||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
|
||||||
@echo
|
|
||||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
|
||||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
|
||||||
|
|
||||||
qthelp:
|
|
||||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
|
||||||
@echo
|
|
||||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
|
||||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
|
||||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/OctoPrint.qhcp"
|
|
||||||
@echo "To view the help file:"
|
|
||||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OctoPrint.qhc"
|
|
||||||
|
|
||||||
devhelp:
|
|
||||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
|
||||||
@echo
|
|
||||||
@echo "Build finished."
|
|
||||||
@echo "To view the help file:"
|
|
||||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/OctoPrint"
|
|
||||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/OctoPrint"
|
|
||||||
@echo "# devhelp"
|
|
||||||
|
|
||||||
epub:
|
|
||||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
|
||||||
|
|
||||||
latex:
|
|
||||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
||||||
@echo
|
|
||||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
|
||||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
|
||||||
"(use \`make latexpdf' here to do that automatically)."
|
|
||||||
|
|
||||||
latexpdf:
|
|
||||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
||||||
@echo "Running LaTeX files through pdflatex..."
|
|
||||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
|
||||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
|
||||||
|
|
||||||
latexpdfja:
|
|
||||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
||||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
|
||||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
|
||||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
|
||||||
|
|
||||||
text:
|
|
||||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
|
||||||
|
|
||||||
man:
|
|
||||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
|
||||||
|
|
||||||
texinfo:
|
|
||||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
|
||||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
|
||||||
"(use \`make info' here to do that automatically)."
|
|
||||||
|
|
||||||
info:
|
|
||||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
||||||
@echo "Running Texinfo files through makeinfo..."
|
|
||||||
make -C $(BUILDDIR)/texinfo info
|
|
||||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
|
||||||
|
|
||||||
gettext:
|
|
||||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
|
||||||
|
|
||||||
changes:
|
|
||||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
|
||||||
@echo
|
|
||||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
|
||||||
|
|
||||||
linkcheck:
|
|
||||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
|
||||||
@echo
|
|
||||||
@echo "Link check complete; look for any errors in the above output " \
|
|
||||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
|
||||||
|
|
||||||
doctest:
|
|
||||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
|
||||||
@echo "Testing of doctests in the sources finished, look at the " \
|
|
||||||
"results in $(BUILDDIR)/doctest/output.txt."
|
|
||||||
|
|
||||||
xml:
|
|
||||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
|
||||||
|
|
||||||
pseudoxml:
|
|
||||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
|
||||||
@echo
|
|
||||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
|
||||||
+4
-2
@@ -572,7 +572,8 @@ Issue a file command
|
|||||||
is not operational when this parameter is present and set to ``true``, the request will fail with a response
|
is not operational when this parameter is present and set to ``true``, the request will fail with a response
|
||||||
of ``409 Conflict``.
|
of ``409 Conflict``.
|
||||||
|
|
||||||
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
|
Upon success, a status code of :http:statuscode:`204` and an empty body is returned. If there already is an
|
||||||
|
active print job, a :http:statuscode:`409` is returned.
|
||||||
|
|
||||||
Requires the ``FILES_SELECT`` permission.
|
Requires the ``FILES_SELECT`` permission.
|
||||||
|
|
||||||
@@ -768,7 +769,8 @@ Issue a file command
|
|||||||
:statuscode 400: If the ``command`` is unknown or the request is otherwise invalid
|
:statuscode 400: If the ``command`` is unknown or the request is otherwise invalid
|
||||||
:statuscode 415: If a ``slice`` command was issued against something other than an STL file.
|
:statuscode 415: If a ``slice`` command was issued against something other than an STL file.
|
||||||
:statuscode 404: If ``location`` is neither ``local`` nor ``sdcard`` or the requested file was not found
|
:statuscode 404: If ``location`` is neither ``local`` nor ``sdcard`` or the requested file was not found
|
||||||
:statuscode 409: If a selected file is supposed to start printing directly but the printer is not operational or
|
:statuscode 409: If a selected file is supposed to start printing directly but the printer is not operational
|
||||||
|
or if a file is to be selected but the printer is already printing or
|
||||||
if a file to be sliced is supposed to be selected or start printing directly but the printer
|
if a file to be sliced is supposed to be selected or start printing directly but the printer
|
||||||
is not operational or already printing.
|
is not operational or already printing.
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,14 @@ Test paths or URLs
|
|||||||
The ``server`` command returns :http:statuscode:`200` with a :ref:`Server test result <sec-api-util-datamodel-servertestresult>`
|
The ``server`` command returns :http:statuscode:`200` with a :ref:`Server test result <sec-api-util-datamodel-servertestresult>`
|
||||||
when the test could be performed. The status code of the response does NOT reflect the test result!
|
when the test could be performed. The status code of the response does NOT reflect the test result!
|
||||||
|
|
||||||
|
resolution
|
||||||
|
Tests whether a provided hostname can be resolved (via DNS lookup). Supported parameters are:
|
||||||
|
|
||||||
|
* ``name``: The host name to test. Mandatory.
|
||||||
|
|
||||||
|
The ``resolution`` command returns :http:statuscode:`200` with a :ref:`Resolution test result <sec-api-util-datamodel-resolutiontestresult>`
|
||||||
|
when the test could be performed. The status code of the response does NOT reflect the test result!
|
||||||
|
|
||||||
Requires the ``ADMIN`` permission.
|
Requires the ``ADMIN`` permission.
|
||||||
|
|
||||||
**Example 1**
|
**Example 1**
|
||||||
@@ -286,6 +294,32 @@ Test paths or URLs
|
|||||||
"result": true
|
"result": true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
**Example 7**
|
||||||
|
|
||||||
|
Test whether a host name can be resolved successfully.
|
||||||
|
|
||||||
|
.. sourcecode:: http
|
||||||
|
|
||||||
|
POST /api/util/test HTTP/1.1
|
||||||
|
Host: example.com
|
||||||
|
X-Api-Key: abcdef...
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"command": "resolution",
|
||||||
|
"name": "octoprint"
|
||||||
|
}
|
||||||
|
|
||||||
|
.. sourcecode:: http
|
||||||
|
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "octoprint.org",
|
||||||
|
"result": true
|
||||||
|
}
|
||||||
|
|
||||||
:json command: The command to execute, currently either ``path`` or ``url``
|
:json command: The command to execute, currently either ``path`` or ``url``
|
||||||
:json path: ``path`` command only: the path to test
|
:json path: ``path`` command only: the path to test
|
||||||
:json check_type: ``path`` command only: the type of path to test for, either ``file`` or ``dir``
|
:json check_type: ``path`` command only: the type of path to test for, either ``file`` or ``dir``
|
||||||
@@ -302,6 +336,7 @@ Test paths or URLs
|
|||||||
:json host: ``server`` command only: the server to test
|
:json host: ``server`` command only: the server to test
|
||||||
:json port: ``server`` command only: the port to test
|
:json port: ``server`` command only: the port to test
|
||||||
:json protocol: ``server`` command only: the protocol to test
|
:json protocol: ``server`` command only: the protocol to test
|
||||||
|
:json name: ``resolution`` command only: the host name to test
|
||||||
:statuscode 200: No error occurred
|
:statuscode 200: No error occurred
|
||||||
|
|
||||||
.. _sec-api-util-datamodel:
|
.. _sec-api-util-datamodel:
|
||||||
@@ -409,3 +444,25 @@ Server test result
|
|||||||
- 1
|
- 1
|
||||||
- bool
|
- bool
|
||||||
- ``true`` if the check passed.
|
- ``true`` if the check passed.
|
||||||
|
|
||||||
|
.. _sec-api-util-datamodel-resolutiontestresult:
|
||||||
|
|
||||||
|
Resolution test result
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``name``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The host name that was tested.
|
||||||
|
* - ``result``
|
||||||
|
- 1
|
||||||
|
- bool
|
||||||
|
- ``true`` if the check passed.
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
.. _sec-bundledplugins-action_command_notification:
|
||||||
|
|
||||||
|
Action Command Notification support
|
||||||
|
===================================
|
||||||
|
|
||||||
|
The OctoPrint Action Command Notification Support Plugin comes bundled with OctoPrint (starting with 1.4.1).
|
||||||
|
|
||||||
|
It allows firmware to trigger notifications users with the ``PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW`` permission
|
||||||
|
using :ref:`action commands <sec-features-action_commands>` about relevant events. These notifications will be shown
|
||||||
|
in the sidebar and if configured also as popup messages. The notifications in the sidebar panel can also be cleared
|
||||||
|
by users with the ``PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR` permission.
|
||||||
|
|
||||||
|
.. _fig-bundledplugins-action_command_notification-example:
|
||||||
|
.. figure:: ../images/bundledplugins-action_command_notification-example.png
|
||||||
|
:align: center
|
||||||
|
:alt: Simple notification example
|
||||||
|
|
||||||
|
A simple notification example triggered by the firmware
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-action_command_notification-configuration:
|
||||||
|
|
||||||
|
Configuring the plugin
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
The plugin supports the following configuration keys:
|
||||||
|
|
||||||
|
* ``enable``: Whether to enable the support of notifications (enabled by default).
|
||||||
|
* ``enable_popup``: Whether to enable the additional display of notifications as popups in the UI (disabled by default).
|
||||||
|
|
||||||
|
You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``.
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-action_command_notification-action_commands:
|
||||||
|
|
||||||
|
Supported action commands
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
notification <message>
|
||||||
|
Displays the notification ``<message>``
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-action_command_prompt-example:
|
||||||
|
|
||||||
|
Example communication with the firmware
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-action_command_prompt-sourcecode:
|
||||||
|
|
||||||
|
To display the :ref:`above notification <fig-bundledplugins-action_command_notification-example>` the firmware sent this action command:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
//action:notification Hello World!
|
||||||
|
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-action_command_notification-sourcecode:
|
||||||
|
|
||||||
|
|
||||||
|
Source code
|
||||||
|
-----------
|
||||||
|
|
||||||
|
The source of the Action Command Prompt Notification plugin is bundled with OctoPrint and can be found in
|
||||||
|
its source repository under ``src/octoprint/plugins/action_command_notification``.
|
||||||
@@ -19,17 +19,6 @@ placeholder for the selected option's index.
|
|||||||
|
|
||||||
A simple dialog example triggered by the firmware
|
A simple dialog example triggered by the firmware
|
||||||
|
|
||||||
.. _sec-bundledplugins-action_command_prompt-firststeps:
|
|
||||||
|
|
||||||
First Steps
|
|
||||||
-----------
|
|
||||||
|
|
||||||
In order for this plugin to work, you'll need to configure it with the command your firmware uses to accept
|
|
||||||
dialog selections. You can do that in the settings dialog.
|
|
||||||
|
|
||||||
Currently there is no agreed upon command for this since no firmware has yet made use of this feature, so OctoPrint
|
|
||||||
ships with an empty value here.
|
|
||||||
|
|
||||||
.. _sec-bundledplugins-action_command_prompt-configuration:
|
.. _sec-bundledplugins-action_command_prompt-configuration:
|
||||||
|
|
||||||
Configuring the plugin
|
Configuring the plugin
|
||||||
@@ -37,7 +26,13 @@ Configuring the plugin
|
|||||||
|
|
||||||
The plugin supports the following configuration keys:
|
The plugin supports the following configuration keys:
|
||||||
|
|
||||||
* ``selection_command``: The command to send to the firmware on choice, including the ``{choice}`` placeholder, e.g. ``M876 S{choice}``.
|
* ``enable``: Whether to always enable (``always``), disable (``never``) or ``detect`` support.
|
||||||
|
* ``enable_emergency_sending``: Will make the selection command be sent as an emergency command to jump the internal
|
||||||
|
send queue and even be sent to the printer if it's not signaling to be able to received. Only done if this is true
|
||||||
|
and the printer signals support for emergency command processing. Defaults to ``true``.
|
||||||
|
* ``enable_signaling``: If enabled, will send the configured command with the ``P1`` parameter to the printer to
|
||||||
|
signal prompt support of the host. Defaults to ``true``.
|
||||||
|
* ``command``: The command to send to the firmware on choice, defaults to ``M876``.
|
||||||
|
|
||||||
You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``.
|
You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``.
|
||||||
|
|
||||||
@@ -69,8 +64,6 @@ prompt_end
|
|||||||
Example communication with the firmware
|
Example communication with the firmware
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
.. _sec-bundledplugins-action_command_prompt-sourcecode:
|
|
||||||
|
|
||||||
To display the :ref:`above dialog <fig-bundledplugins-action_command_prompt-example>` the firmware sent these action commands:
|
To display the :ref:`above dialog <fig-bundledplugins-action_command_prompt-example>` the firmware sent these action commands:
|
||||||
|
|
||||||
.. code-block:: none
|
.. code-block:: none
|
||||||
@@ -103,6 +96,8 @@ This would produce the following output:
|
|||||||
|
|
||||||
If the user selects "Abort print", OctoPrint will send ``2`` as selected choice.
|
If the user selects "Abort print", OctoPrint will send ``2`` as selected choice.
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-action_command_prompt-sourcecode:
|
||||||
|
|
||||||
Source code
|
Source code
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
.. _sec-bundledplugins-file_check:
|
||||||
|
|
||||||
|
File Check
|
||||||
|
==========
|
||||||
|
|
||||||
|
The file check plugin - while considered bundled with OctoPrint - is a separate project on its own release
|
||||||
|
cycle and documented on `its Github repository <https://github.com/OctoPrint/OctoPrint-FileCheck>`_.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
.. _sec-bundledplugins-firmware_check:
|
||||||
|
|
||||||
|
Firmware Check
|
||||||
|
==============
|
||||||
|
|
||||||
|
The firmware check plugin - while considered bundled with OctoPrint - is a separate project on its own release
|
||||||
|
cycle and documented on `its Github repository <https://github.com/OctoPrint/OctoPrint-FirmwareCheck>`_.
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
.. _sec-bundledplugins-gcodeviewer:
|
||||||
|
|
||||||
|
GCode Viewer Plugin
|
||||||
|
===================
|
||||||
|
|
||||||
|
The GCode Viewer plugin provides a GCode viewer based on `Alex Ustyantsev's work <https://github.com/hudbrog/gCodeViewer>`_.
|
||||||
|
|
||||||
|
.. _fig-bundledplugins-gcodeviewer-example:
|
||||||
|
.. figure:: ../images/bundledplugins-gcodeviewer-example.png
|
||||||
|
:align: center
|
||||||
|
:alt: OctoPrint GCode Viewer Plugin
|
||||||
|
|
||||||
|
An example of the GCode Viewer in action.
|
||||||
|
|
||||||
|
The viewer has been included in OctoPrint ever since the first releases back in 2013, however as of
|
||||||
|
OctoPrint 1.4.1 it has been extracted into its own bundled plugin.
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-gcodeviewer-configuration:
|
||||||
|
|
||||||
|
Configuring the plugin
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
The plugin supports the following configuration keys:
|
||||||
|
|
||||||
|
* ``mobileSizeThreshold``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases
|
||||||
|
or release candidates). Defaults to ``false``.
|
||||||
|
* ``sizeThreshold``: Unique instance identifier, auto generated on first activation
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-gcodeviewer-sourcecode:
|
||||||
|
|
||||||
|
Source Code
|
||||||
|
-----------
|
||||||
|
|
||||||
|
The source of the GCode Viewer plugin is bundled with OctoPrint and can be
|
||||||
|
found in its source repository under ``src/octoprint/plugins/gcodeviewer``.
|
||||||
@@ -7,6 +7,7 @@ Bundled Plugins
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
action_command_notification.rst
|
||||||
action_command_prompt.rst
|
action_command_prompt.rst
|
||||||
announcements.rst
|
announcements.rst
|
||||||
tracking.rst
|
tracking.rst
|
||||||
@@ -14,8 +15,12 @@ Bundled Plugins
|
|||||||
backup.rst
|
backup.rst
|
||||||
discovery.rst
|
discovery.rst
|
||||||
errortracking.rst
|
errortracking.rst
|
||||||
|
file_check.rst
|
||||||
|
firmware_check.rst
|
||||||
|
gcodeviewer.rst
|
||||||
logging.rst
|
logging.rst
|
||||||
loginui.rst
|
loginui.rst
|
||||||
pluginmanager.rst
|
pluginmanager.rst
|
||||||
printer_safety_check.rst
|
printer_safety_check.rst
|
||||||
softwareupdate.rst
|
softwareupdate.rst
|
||||||
|
virtual_printer.rst
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
.. _sec-bundledplugins-printer_safety_check:
|
|
||||||
|
|
||||||
Printer Safety Check
|
|
||||||
====================
|
|
||||||
|
|
||||||
The Printer Safety Check plugin comes bundled with OctoPrint starting with version 1.3.7.
|
|
||||||
|
|
||||||
It tries to identify printers or rather printer firmwares with known safety issues, such as
|
|
||||||
disabled thermal runaway protection, and displays a warning box to logged in users on
|
|
||||||
such identification.
|
|
||||||
|
|
||||||
.. _fig-bundledplugins-printer_safety_check-example:
|
|
||||||
.. figure:: ../images/bundledplugins-printer_safety_check-example.png
|
|
||||||
:align: center
|
|
||||||
:alt: Printer Safety Check warning example
|
|
||||||
|
|
||||||
An example of a warning generated by the Printer Safety Check
|
|
||||||
|
|
||||||
Please refer to the `entry on the "unsafe firmware" warning in OctoPrint's FAQ <https://faq.octoprint.org/warning-firmware-unsafe>`_
|
|
||||||
for a list of currently identified printers.
|
|
||||||
|
|
||||||
If you know of further printers/printer firmwares that need to be added here, please
|
|
||||||
`get in touch on the forum and provide their response to an M115 <https://faq.octoprint.org/warning-firmware-unsafe>`_.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Feel free to disable the plugin in OctoPrint's Plugin Manager if you feel like it is unnecessary. Be advised though
|
|
||||||
that even if your printer might be running totally fine with a known unsafe configuration, that might change
|
|
||||||
unexpectedly and with `catastrophic <https://www.thissmarthouse.net/dont-burn-your-house-down-3d-printing-a-cautionary-tale/>`_
|
|
||||||
`results <https://www.reddit.com/r/3Dprinting/comments/6cekgk/house_fire_thanks_to_cheap_printer_from_china/>`_.
|
|
||||||
|
|
||||||
.. _sec-bundledplugins-printer_safety_check-events:
|
|
||||||
|
|
||||||
Events
|
|
||||||
------
|
|
||||||
|
|
||||||
warning
|
|
||||||
A printer safety warning was triggered.
|
|
||||||
|
|
||||||
Payload:
|
|
||||||
|
|
||||||
* ``check_type``: type of check that was triggered (e.g. ``m115``, ``received`` or ``cap``)
|
|
||||||
* ``check_name``: name of check that was triggered (e.g. ``aneta8``)
|
|
||||||
* ``warning_type``: type of warning that was triggered (e.g. ``firmware-unsafe``)
|
|
||||||
|
|
||||||
.. _sec-bundledplugins-printer_safety_check-source:
|
|
||||||
|
|
||||||
Source Code
|
|
||||||
-----------
|
|
||||||
|
|
||||||
The source of the Printer Safety Check plugin is bundled with OctoPrint and can be
|
|
||||||
found in its source repository under ``src/octoprint/plugins/printer_safety_check``.
|
|
||||||
@@ -37,9 +37,9 @@ There you can adjust the following settings:
|
|||||||
* **OctoPrint Release Channel** (if tracking releases): The release channel of OctoPrint to track for updates. If you only want stable versions,
|
* **OctoPrint Release Channel** (if tracking releases): The release channel of OctoPrint to track for updates. If you only want stable versions,
|
||||||
select "Stable" here which is also the default. "Maintenance RCs" will also allow you to update to maintenance release
|
select "Stable" here which is also the default. "Maintenance RCs" will also allow you to update to maintenance release
|
||||||
candidates, "Devel RCs" will also allow you to update to development release candidates. If in doubt, leave it at
|
candidates, "Devel RCs" will also allow you to update to development release candidates. If in doubt, leave it at
|
||||||
"Stable". `Read more about Release Channels here <https://github.com/foosel/OctoPrint/wiki/Using-Release-Channels>`_.
|
"Stable". `Read more about Release Channels here <https://community.octoprint.org/t/how-to-use-the-release-channels-to-help-test-release-candidates/402>`_.
|
||||||
* **OctoPrint checkout folder** (if tracking git commits): This must be the path to OctoPrint's git checkout folder
|
* **OctoPrint checkout folder** (if tracking git commits): This must be the path to OctoPrint's git checkout folder
|
||||||
(``/home/pi/OctoPrint`` for OctoPi or `manual installs following the Raspberry Pi setup guide <https://github.com/foosel/OctoPrint/wiki/Setup-on-a-Raspberry-Pi-running-Raspbian>`_).
|
(``/home/pi/OctoPrint`` for OctoPi or `manual installs following the Raspberry Pi setup guide <https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337/>`_).
|
||||||
Note that since OctoPrint 1.3.6 you will no longer need to set this to be able to update to releases, only if you
|
Note that since OctoPrint 1.3.6 you will no longer need to set this to be able to update to releases, only if you
|
||||||
want to be able to update against some bleeding edge git branch.
|
want to be able to update against some bleeding edge git branch.
|
||||||
* **Version cache TTL**: The "time to live" of the cache OctoPrint will use to temporarily persist the version information
|
* **Version cache TTL**: The "time to live" of the cache OctoPrint will use to temporarily persist the version information
|
||||||
@@ -133,7 +133,7 @@ Configuring the Plugin
|
|||||||
user: foosel
|
user: foosel
|
||||||
repo: OctoPrint
|
repo: OctoPrint
|
||||||
method: pip
|
method: pip
|
||||||
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
|
pip: 'https://github.com/OctoPrint/OctoPrint/archive/{target_version}.zip'
|
||||||
|
|
||||||
# further checks may be defined here
|
# further checks may be defined here
|
||||||
|
|
||||||
@@ -146,6 +146,9 @@ Configuring the Plugin
|
|||||||
Version checks
|
Version checks
|
||||||
++++++++++++++
|
++++++++++++++
|
||||||
|
|
||||||
|
Version check types are configured through the ``type`` parameter. The following
|
||||||
|
types are currently recognized:
|
||||||
|
|
||||||
* ``github_release``: Checks against releases published on Github. Additional
|
* ``github_release``: Checks against releases published on Github. Additional
|
||||||
config parameters:
|
config parameters:
|
||||||
|
|
||||||
@@ -196,10 +199,28 @@ Version checks
|
|||||||
* ``checkout_folder``: (mandatory) The full path to the folder with a valid git
|
* ``checkout_folder``: (mandatory) The full path to the folder with a valid git
|
||||||
repository to check.
|
repository to check.
|
||||||
|
|
||||||
* ``pypi_release``: Checks `pypi.org <https://pypi.org>`_ for new releases of a specified package.
|
* ``pypi_release``: Checks `pypi.org <https://pypi.org>`_ for new releases of a specified package. Additional
|
||||||
|
config parameters:
|
||||||
|
|
||||||
* ``package``: (mandatory) Name of the package which to check.
|
* ``package``: (mandatory) Name of the package which to check.
|
||||||
|
|
||||||
|
* ``httpheader``: Checks an HTTP header on a defined URL for changes. This can be used for easy checks
|
||||||
|
against things like ``ETag`` or ``Last-Modified`` headers. Additional
|
||||||
|
config parameters:
|
||||||
|
|
||||||
|
* ``header_url`` or ``url``: (mandatory) URL to check. ``url`` can be used to avoid duplication in case of updater
|
||||||
|
methods such as ``single_file_plugin``.
|
||||||
|
* ``header_name``: (mandatory) HTTP header to check, case-insensitive, e.g. ``ETag`` or ``Last-Modified``.
|
||||||
|
* ``header_method``: HTTP request method to use for the check, defaults to ``HEAD``.
|
||||||
|
* ``header_prefix``: Prefix to use for the obtained value in the version display. If not provided ``header_name``
|
||||||
|
will be used. If set to an empty string, no prefix will be added.
|
||||||
|
|
||||||
|
* ``jsondata``: Checks the provided JSON endpoint for changes. The JSON endpoint must return an object with the
|
||||||
|
property ``version``, which should contain the latest version, e.g. ``{"version":"1.2.3"}``. Additional
|
||||||
|
config parameters:
|
||||||
|
|
||||||
|
* ``jsondata``: (mandatory) URL from which to fetch the JSON data
|
||||||
|
|
||||||
* ``command_line``: Uses a provided script to determine whether an update
|
* ``command_line``: Uses a provided script to determine whether an update
|
||||||
is available. Additional config parameters:
|
is available. Additional config parameters:
|
||||||
|
|
||||||
@@ -233,20 +254,42 @@ Version checks
|
|||||||
Update methods
|
Update methods
|
||||||
++++++++++++++
|
++++++++++++++
|
||||||
|
|
||||||
* ``pip``: An URL to provide to ``pip install`` in order to perform the
|
Update methods are specified via the ``method`` parameter. Some update methods are assigned implicitly
|
||||||
update. May contain a placeholder ``{target}`` which will be the most
|
through the presence of their mandatory configuration parameters. The following methods are currently
|
||||||
recent version specifier as retrieved from the update check.
|
supported:
|
||||||
* ``update_script``: A script to execute in order to perform the update. May
|
|
||||||
contain placeholders ``{target}`` (for the most recent version specified
|
* ``pip``: Update by ``pip install``ing the supplied URL. May contain a
|
||||||
as retrieved from the update check), ``{branch}`` for the branch to switch
|
placeholder ``{target}`` which will be the most recent version specifier as retrieved from the update check.
|
||||||
to to access the release, ``{folder}`` for the working directory
|
Additional config parameters:
|
||||||
of the script and ``{python}`` for the python executable OctoPrint is
|
|
||||||
running under. The working directory must be specified either by an
|
* ``pip``: The URL to use for installing. Presence implies ``method: pip``.
|
||||||
``update_folder`` setting or if the ``git_commit`` check is used its
|
|
||||||
``checkout_folder`` setting.
|
* ``single_file_plugin``: Update a single file plugin by re-downloading it from a configured URL.
|
||||||
* ``python_updater``: Can only be specified by plugins through the
|
Additional config parameters:
|
||||||
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. A Python callable
|
|
||||||
which performs the update, see below for details.
|
* ``url``: (mandatory) The URL from which to install the single file plugin. Must be a single self contained
|
||||||
|
python file.
|
||||||
|
|
||||||
|
* ``update_script``: Update by executing a script.
|
||||||
|
Additional config parameters:
|
||||||
|
|
||||||
|
* ``update_script``: (mandatory) The path of the script to run. May
|
||||||
|
contain placeholders ``{target}`` (for the most recent version specified
|
||||||
|
as retrieved from the update check), ``{branch}`` for the branch to switch
|
||||||
|
to to access the release, ``{folder}`` for the working directory
|
||||||
|
of the script and ``{python}`` for the python executable OctoPrint is
|
||||||
|
running under. Presence implies ``method: update_script``.
|
||||||
|
* ``update_folder`` or ``checkout_folder``: (mandatory) The working directory.
|
||||||
|
``checkout_folder`` can be used to avoid duplication in case of check
|
||||||
|
types such as ``git_commit``.
|
||||||
|
|
||||||
|
* ``python_updater``: Update by executing a custom python callable.
|
||||||
|
Additional config parameters:
|
||||||
|
|
||||||
|
* ``python_updater``: (mandatory) Can only be specified by plugins through the
|
||||||
|
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. A Python callable
|
||||||
|
which performs the update, see below for details. Presence implies ``method: python_updater``.
|
||||||
|
|
||||||
* ``sleep_a_bit``: Does nothing but block for a configurable ``duration`` and log
|
* ``sleep_a_bit``: Does nothing but block for a configurable ``duration`` and log
|
||||||
a countdown in the meantime. Useful for debugging software update mechanisms
|
a countdown in the meantime. Useful for debugging software update mechanisms
|
||||||
during development.
|
during development.
|
||||||
@@ -273,7 +316,7 @@ Update methods
|
|||||||
user: foosel
|
user: foosel
|
||||||
repo: OctoPrint
|
repo: OctoPrint
|
||||||
method: pip
|
method: pip
|
||||||
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
|
pip: 'https://github.com/OctoPrint/OctoPrint/archive/{target_version}.zip'
|
||||||
update_script: '{python} "/path/to/octoprint-update.py" --python="{python}" "{folder}" "{target}"'
|
update_script: '{python} "/path/to/octoprint-update.py" --python="{python}" "{folder}" "{target}"'
|
||||||
checkout_folder: /path/to/octoprint/checkout/folder
|
checkout_folder: /path/to/octoprint/checkout/folder
|
||||||
|
|
||||||
@@ -329,6 +372,37 @@ The same, but tracking all commits pushed to branch ``devel`` (thus allowing
|
|||||||
branch: devel
|
branch: devel
|
||||||
pip: 'https://github.com/someUser/OctoPrint-SomePlugin/archive/{target}.zip'
|
pip: 'https://github.com/someUser/OctoPrint-SomePlugin/archive/{target}.zip'
|
||||||
|
|
||||||
|
Single file plugin hosted in a gist ``https://gist.github.com/someUser/somegist`` and updated whenever there are changes:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
softwareupdate:
|
||||||
|
checks:
|
||||||
|
some_plugin:
|
||||||
|
type: httpheader
|
||||||
|
header_name: ETag
|
||||||
|
url: 'https://gist.github.com/someUser/somegist/raw/some_plugin.py'
|
||||||
|
method: single_file_plugin
|
||||||
|
|
||||||
|
The same but updated when a ``version.json`` hosted alongside gets updated with a new version can be found at
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
softwareupdate:
|
||||||
|
checks:
|
||||||
|
some_plugin:
|
||||||
|
type: jsondata
|
||||||
|
jsondata: 'https://gist.github.com/someUser/somegist/raw/version.json'
|
||||||
|
url: 'https://gist.github.com/someUser/somegist/raw/some_plugin.py'
|
||||||
|
method: single_file_plugin
|
||||||
|
|
||||||
|
Note that for gist hosted single file plugins, you need to use the "Raw" install link but should remove the
|
||||||
|
commit identifier. E.g. ``https://gist.githubusercontent.com/<user>/<gistid>/raw/my_plugin.py`` instead of
|
||||||
|
``https://gist.githubusercontent.com/<user>/<gistid>/raw/<commit>/my_plugin.py``. Note that these URLs will
|
||||||
|
be cached by Github for a bit, so an update will not be immediately picked up.
|
||||||
|
|
||||||
.. _sec-bundledplugins-softwareupdate-events:
|
.. _sec-bundledplugins-softwareupdate-events:
|
||||||
|
|
||||||
Events
|
Events
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
.. _sec-bundledplugins-virtual_printer:
|
||||||
|
|
||||||
|
Virtual Printer
|
||||||
|
===============
|
||||||
|
|
||||||
|
The Virtual Printer plugin provides a virtual printer to connect to during development. It is able to simulate various
|
||||||
|
firmware quirks, communication issues and can be heavily configured through ``config.yaml``. See
|
||||||
|
:ref:`the development documentation on details and usage <sec-development-virtual-printer>`.
|
||||||
|
|
||||||
|
The virtual printer has been included in OctoPrint ever since the first releases back in 2013, however as of
|
||||||
|
OctoPrint 1.4.1 it has finally been fully extracted into its own bundled plugin.
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-virtual_printer-configuration:
|
||||||
|
|
||||||
|
Configuring the plugin
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Please refer to :ref:`the development documentation <sec-development-virtual-printer-config>`.
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-virtual_printer-sourcecode:
|
||||||
|
|
||||||
|
Source Code
|
||||||
|
-----------
|
||||||
|
|
||||||
|
The source of the Virtual Printer plugin is bundled with OctoPrint and can be
|
||||||
|
found in its source repository under ``src/octoprint/plugins/virtual_printer``.
|
||||||
+9
-10
@@ -35,8 +35,11 @@ needs_sphinx = '1.3'
|
|||||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||||
extensions = ['codeblockext', 'onlineinclude', 'sphinx.ext.todo', 'sphinx.ext.autodoc', 'sphinxcontrib.httpdomain',
|
extensions = ['codeblockext', 'onlineinclude', 'sphinx.ext.todo', 'sphinx.ext.autodoc', 'sphinxcontrib.httpdomain',
|
||||||
'sphinx.ext.napoleon', 'sphinxcontrib.mermaid']
|
'sphinx.ext.napoleon', 'sphinxcontrib.mermaid', 'sphinx.ext.intersphinx']
|
||||||
todo_include_todos = True
|
todo_include_todos = True
|
||||||
|
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
|
||||||
|
'python2': ('https://docs.python.org/2', None),
|
||||||
|
'pyserial': ('https://pythonhosted.org/pyserial', None)}
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ['_templates']
|
templates_path = ['_templates']
|
||||||
@@ -104,13 +107,9 @@ numfig = True
|
|||||||
|
|
||||||
# -- Options for HTML output ---------------------------------------------------
|
# -- Options for HTML output ---------------------------------------------------
|
||||||
|
|
||||||
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
|
import sphinx_rtd_theme
|
||||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
html_theme = 'sphinx_rtd_theme'
|
||||||
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||||
if not on_rtd: # only import and set the theme if we're building docs locally
|
|
||||||
import sphinx_rtd_theme
|
|
||||||
html_theme = 'sphinx_rtd_theme'
|
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|
||||||
|
|
||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
# a list of built-in themes.
|
# a list of built-in themes.
|
||||||
@@ -146,7 +145,7 @@ if not on_rtd: # only import and set the theme if we're building docs locally
|
|||||||
html_static_path = ['_static']
|
html_static_path = ['_static']
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.add_stylesheet("theme_overrides.css")
|
app.add_css_file("theme_overrides.css")
|
||||||
|
|
||||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
# using the given strftime format.
|
# using the given strftime format.
|
||||||
@@ -190,7 +189,7 @@ def setup(app):
|
|||||||
#html_file_suffix = None
|
#html_file_suffix = None
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = 'OctoPrintdoc'
|
htmlhelp_basename = 'OctoPrintDoc'
|
||||||
|
|
||||||
|
|
||||||
# -- Options for LaTeX output --------------------------------------------------
|
# -- Options for LaTeX output --------------------------------------------------
|
||||||
|
|||||||
@@ -283,184 +283,20 @@ The following settings are only relevant to you if you want to do OctoPrint deve
|
|||||||
# false, no minification will take place regardless of the minify setting below.
|
# false, no minification will take place regardless of the minify setting below.
|
||||||
bundle: true
|
bundle: true
|
||||||
|
|
||||||
# If set to true, OctoPrint will minify its viewmodels (that includes those of plugins). Note: if bundle is
|
# If set to true, OctoPrint will the core and library javascript assets. Note: if bundle is
|
||||||
# set to false, no minification will take place either.
|
# set to false, no minification will take place either.
|
||||||
minify: true
|
minify: true
|
||||||
|
|
||||||
|
# If set to true, OctoPrint will also minify the third party plugin javascript assets. Note: if bundle or
|
||||||
|
# minify are set to false, no minification of the plugin assets will take place either.
|
||||||
|
minify_plugins: false
|
||||||
|
|
||||||
# Whether to delete generated web assets on server startup (forcing a regeneration)
|
# Whether to delete generated web assets on server startup (forcing a regeneration)
|
||||||
clean_on_startup: true
|
clean_on_startup: true
|
||||||
|
|
||||||
# enable or disable the loading animation
|
# enable or disable the loading animation
|
||||||
showLoadingAnimation: true
|
showLoadingAnimation: true
|
||||||
|
|
||||||
# Settings for the virtual printer
|
|
||||||
virtualPrinter:
|
|
||||||
|
|
||||||
# Whether to enable the virtual printer and include it in the list of available serial connections.
|
|
||||||
# Defaults to false.
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
# Whether to send an additional "ok" after a resend request (like Repetier)
|
|
||||||
okAfterResend: false
|
|
||||||
|
|
||||||
# Whether to force checksums and line number in the communication (like Repetier), if set to true
|
|
||||||
# printer will only accept commands that come with linenumber and checksum and throw an error for
|
|
||||||
# lines that don't. Defaults to false
|
|
||||||
forceChecksum: false
|
|
||||||
|
|
||||||
# Whether to send "ok" responses with the line number that gets acknowledged by the "ok". Defaults
|
|
||||||
# to false.
|
|
||||||
okWithLinenumber: false
|
|
||||||
|
|
||||||
# Number of extruders to simulate on the virtual printer. Map from tool id (0, 1, ...) to temperature
|
|
||||||
# in °C
|
|
||||||
numExtruders: 1
|
|
||||||
|
|
||||||
# Allows pinning certain hotends to a fixed temperature
|
|
||||||
pinnedExtruders: null
|
|
||||||
|
|
||||||
# Whether to include the current tool temperature in the M105 output as separate T segment or not.
|
|
||||||
#
|
|
||||||
# True: > M105
|
|
||||||
# < ok T:23.5/0.0 T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
|
|
||||||
# False: > M105
|
|
||||||
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
|
|
||||||
includeCurrentToolInTemps: true
|
|
||||||
|
|
||||||
# Whether to include the selected filename in the M23 File opened response.
|
|
||||||
#
|
|
||||||
# True: > M23 filename.gcode
|
|
||||||
# < File opened: filename.gcode Size: 27
|
|
||||||
# False: > M23 filename.gcode
|
|
||||||
# > File opened
|
|
||||||
includeFilenameInOpened: true
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# < TargetExtr0:220.0
|
|
||||||
# < ok
|
|
||||||
# > M105
|
|
||||||
# < ok T0:34.3 T1:23.5 B:43.2
|
|
||||||
# False: > M109 S220.0
|
|
||||||
# < ok
|
|
||||||
# > M105
|
|
||||||
# < ok T0:34.3/220.0 T1:23.5/0.0 B:43.2/0.0
|
|
||||||
repetierStyleTargetTemperature: false
|
|
||||||
|
|
||||||
# If enabled, uses repetier style resends, sending multiple resends for the same line
|
|
||||||
# to make sure nothing gets lost on the line
|
|
||||||
repetierStyleResends: false
|
|
||||||
|
|
||||||
# If enabled, ok will be sent before a commands output, otherwise after or inline (M105)
|
|
||||||
#
|
|
||||||
# True: > M20
|
|
||||||
# < ok
|
|
||||||
# < Begin file list
|
|
||||||
# < End file list
|
|
||||||
# False: > M20
|
|
||||||
# < Begin file list
|
|
||||||
# < End file list
|
|
||||||
# < ok
|
|
||||||
okBeforeCommandOutput: false
|
|
||||||
|
|
||||||
# If enabled, reports the first extruder in M105 responses as T instead of T0
|
|
||||||
#
|
|
||||||
# True: > M105
|
|
||||||
# < ok T:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
|
|
||||||
# False: > M105
|
|
||||||
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
|
|
||||||
smoothieTemperatureReporting: false
|
|
||||||
|
|
||||||
# Whether M20 responses will include filesize or not
|
|
||||||
#
|
|
||||||
# True: <filename> <filesize in bytes>
|
|
||||||
# False: <filename>
|
|
||||||
extendedSdFileList: false
|
|
||||||
|
|
||||||
# Forced pause for retrieving from the outgoing buffer
|
|
||||||
throttle: 0.01
|
|
||||||
|
|
||||||
# Whether to send "wait" responses every "waitInterval" seconds when serial rx buffer is empty
|
|
||||||
sendWait: false
|
|
||||||
|
|
||||||
# Interval in which to send "wait" lines when rx buffer is empty
|
|
||||||
waitInterval: 1
|
|
||||||
|
|
||||||
# Size of the simulated RX buffer in bytes, when it's full a send from OctoPrint's
|
|
||||||
# side will block
|
|
||||||
rxBuffer: 64
|
|
||||||
|
|
||||||
# Size of simulated command buffer, number of commands. If full, buffered commands will block
|
|
||||||
# until a slot frees up
|
|
||||||
commandBuffer: 4
|
|
||||||
|
|
||||||
# Whether to support the M112 command with simulated kill
|
|
||||||
supportM112: true
|
|
||||||
|
|
||||||
# Whether to send messages received via M117 back as "echo:" lines
|
|
||||||
echoOnM117: true
|
|
||||||
|
|
||||||
# Whether to simulate broken M29 behaviour (missing ok after response)
|
|
||||||
brokenM29: true
|
|
||||||
|
|
||||||
# Whether F is supported as individual command
|
|
||||||
supportF: false
|
|
||||||
|
|
||||||
# Firmware name to report (useful for testing firmware detection)
|
|
||||||
firmwareName: Virtual Marlin 1.0
|
|
||||||
|
|
||||||
# Simulate a shared nozzle
|
|
||||||
sharedNozzle: false
|
|
||||||
|
|
||||||
# Send "busy" messages if busy processing something
|
|
||||||
sendBusy: false
|
|
||||||
|
|
||||||
# Simulate a reset on connect
|
|
||||||
simulateReset: true
|
|
||||||
|
|
||||||
# Lines to send on simulated reset
|
|
||||||
resetLines:
|
|
||||||
- start
|
|
||||||
- "Marlin: Virtual Marlin!"
|
|
||||||
- "SD card ok"
|
|
||||||
|
|
||||||
# Initial set of prepared oks to use instead of regular ok (e.g. to simulate
|
|
||||||
# mis-sent oks). Can also be filled at runtime via the debug command prepare_ok
|
|
||||||
preparedOks: []
|
|
||||||
|
|
||||||
# Format string for ok response.
|
|
||||||
#
|
|
||||||
# Placeholders:
|
|
||||||
# - lastN: last acknowledged line number
|
|
||||||
# - buffer: empty slots in internal command buffer
|
|
||||||
#
|
|
||||||
# Example format string for "extended" ok format:
|
|
||||||
# ok N{lastN} P{buffer}
|
|
||||||
okFormatString: ok
|
|
||||||
|
|
||||||
# Format string for M115 output.
|
|
||||||
#
|
|
||||||
# Placeholders:
|
|
||||||
# - firmare_name: The firmware name as defined in firmwareName
|
|
||||||
m115FormatString: "FIRMWARE_NAME: {firmware_name} PROTOCOL_VERSION:1.0"
|
|
||||||
|
|
||||||
# Whether to include capability report in M115 output
|
|
||||||
m115ReportCapabilites: false
|
|
||||||
|
|
||||||
# Capabilities to report if capability report is enabled
|
|
||||||
capabilities:
|
|
||||||
AUTOREPORT_TEMP: true
|
|
||||||
|
|
||||||
# Simulated ambient temperature in °C
|
|
||||||
ambientTemperature: 21.3
|
|
||||||
|
|
||||||
.. _sec-configuration-config_yaml-estimation:
|
.. _sec-configuration-config_yaml-estimation:
|
||||||
|
|
||||||
Estimation
|
Estimation
|
||||||
@@ -1025,6 +861,25 @@ Use the following settings to configure the server:
|
|||||||
- 192.168.1.254
|
- 192.168.1.254
|
||||||
- 192.168.23.42
|
- 192.168.23.42
|
||||||
|
|
||||||
|
# Whether to allow OctoPrint to be embedded in a frame or not. Note that depending on your setup you might
|
||||||
|
# have to set SameSite to None, Secure to true and serve OctoPrint through a reverse proxy that enables https
|
||||||
|
# for cookies and thus logging in to work
|
||||||
|
allowFraming: true
|
||||||
|
|
||||||
|
# Settings for further configuration of the cookies that OctoPrint sets (login, remember me, ...)
|
||||||
|
cookies:
|
||||||
|
# SameSite setting to use on the cookies. Possible values are None, Lax and Strict. Defaults to None but
|
||||||
|
# be advised that browsers will soon force this to Lax unless also being set as Secure and served over
|
||||||
|
# https, which will cause issues with embedding OctoPrint in frames.
|
||||||
|
#
|
||||||
|
# See also https://www.chromestatus.com/feature/5088147346030592,
|
||||||
|
# https://www.chromestatus.com/feature/5633521622188032 and issue #3482
|
||||||
|
samesite: lax
|
||||||
|
|
||||||
|
# Whether to set the Secure flag to true on cookies. Defaults to false. Only set to true if you are running
|
||||||
|
# OctoPrint behind a reverse proxy taking care of SSL termination.
|
||||||
|
secure: false
|
||||||
|
|
||||||
# Settings for file uploads to OctoPrint, such as maximum allowed file size and
|
# Settings for file uploads to OctoPrint, such as maximum allowed file size and
|
||||||
# header suffixes to use for streaming uploads. OctoPrint does some nifty things internally in
|
# header suffixes to use for streaming uploads. OctoPrint does some nifty things internally in
|
||||||
# order to allow streaming of large file uploads to the application rather than just storing
|
# order to allow streaming of large file uploads to the application rather than just storing
|
||||||
@@ -1126,9 +981,24 @@ Use the following settings to configure the server:
|
|||||||
* ``X-Scheme``: should contain your custom URL scheme to use (if different from ``http``), e.g. ``https``
|
* ``X-Scheme``: should contain your custom URL scheme to use (if different from ``http``), e.g. ``https``
|
||||||
|
|
||||||
If you use these headers OctoPrint will work both via the reverse proxy as well as when called directly. Take a look
|
If you use these headers OctoPrint will work both via the reverse proxy as well as when called directly. Take a look
|
||||||
`into OctoPrint's wiki <https://github.com/foosel/OctoPrint/wiki/Reverse-proxy-configuration-examples>`_ for some
|
`into OctoPrint's wiki <https://community.octoprint.org/t/reverse-proxy-configuration-examples/1107>`_ for some
|
||||||
examples on how to configure this.
|
examples on how to configure this.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If you want to embed OctoPrint in a frame, you'll need to set ``allowFraming`` to ``true`` or your browser will
|
||||||
|
prevent this.
|
||||||
|
|
||||||
|
In future browser builds you will also have to make sure you frame is on the same domain as OctoPrint or that
|
||||||
|
OctoPrint is served via https through a reverse proxy and has set ``cookies.secure`` to ``true`` or your browser
|
||||||
|
will refuse to persist cookies and logging in will not work.
|
||||||
|
|
||||||
|
See also `Cookies default to SameSite=Lax <https://www.chromestatus.com/feature/5088147346030592>`_ and
|
||||||
|
`Reject insecure SameSite=None cookies <https://www.chromestatus.com/feature/5633521622188032>`_ as well as
|
||||||
|
`this ticket <https://github.com/OctoPrint/OctoPrint/issues/3482>`_,
|
||||||
|
and `this twitter thread <https://twitter.com/foosel/status/1022030752349913088>`_ on why OctoPrint cannot
|
||||||
|
solve this on its own/ship with https that doesn't cause scary warnings in your browser.
|
||||||
|
|
||||||
.. _sec-configuration-config_yaml-slicing:
|
.. _sec-configuration-config_yaml-slicing:
|
||||||
|
|
||||||
Slicing
|
Slicing
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ used for the ``serial.log`` and the ``console`` handler used for the output to s
|
|||||||
maxBytes: 2097152 # 2 * 1024 * 1024 = 2 MB in bytes
|
maxBytes: 2097152 # 2 * 1024 * 1024 = 2 MB in bytes
|
||||||
filename: /path/to/octoprints/logs/serial.log
|
filename: /path/to/octoprints/logs/serial.log
|
||||||
|
|
||||||
You can find more information on the used logging handlers in the
|
You can find more information on the used logging handlers in the Python documentation on
|
||||||
`Python documentation on logging handlers <https://docs.python.org/2/library/logging.handlers.html>`_.
|
:py:mod:`logging.handlers`.
|
||||||
|
|
||||||
Changing logging formatters
|
Changing logging formatters
|
||||||
---------------------------
|
---------------------------
|
||||||
@@ -97,4 +97,4 @@ expressed in YAML as follows:
|
|||||||
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||||
|
|
||||||
The possible keys for the logging format can be found in the
|
The possible keys for the logging format can be found in the
|
||||||
`Python documentation on LogRecord attributes <https://docs.python.org/2/library/logging.html#logrecord-attributes>`_.
|
:ref:`Python documentation on LogRecord attributes <logrecord-attributes>`.
|
||||||
@@ -19,16 +19,22 @@ below.
|
|||||||
|
|
||||||
* Checkout the OctoPrint sources from their Git repository:
|
* Checkout the OctoPrint sources from their Git repository:
|
||||||
|
|
||||||
* ``git clone -b devel https://github.com/foosel/OctoPrint.git``
|
* ``git clone https://github.com/OctoPrint/OctoPrint.git``
|
||||||
|
|
||||||
* Enter the checked out source folder: ``cd OctoPrint``
|
* Enter the checked out source folder: ``cd OctoPrint``
|
||||||
* Create virtual environments in the checked out source folder for both Python 2.7 and Python 3.7 to use for
|
* Create virtual environments in the checked out source folder for both Python 2 and Python 3 to use for
|
||||||
installing and running OctoPrint and its dependencies (this avoids potential versioning issues for the dependencies
|
installing and running OctoPrint and its dependencies. Creating virtual environments avoids potential versioning
|
||||||
with system wide installed instances):
|
issues for the dependencies with system wide installed instances:
|
||||||
|
|
||||||
* PY2: ``virtualenv --python=python2 venv2``
|
* PY2: ``virtualenv --python=python2 venv2``
|
||||||
* PY3: ``virtualenv --python=python3 venv3``
|
* PY3: ``virtualenv --python=python3 venv3``
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
This assumes that `python2` and `python3` are binaries available directly on your ``PATH``. If your Python 2 and 3
|
||||||
|
binaries cannot be found on your ``PATH`` like this you'll need to specify the full paths to them here,
|
||||||
|
e.g. ``virtualenv --python=/path/to/python2/bin/python venv2``
|
||||||
|
|
||||||
* Activate one of the virtual environments:
|
* Activate one of the virtual environments:
|
||||||
|
|
||||||
* PY2: ``source venv2/bin/activate`` (Linux, macOS) or ``source venv2/Scripts/activate`` (Git Bash under Windows, see below)
|
* PY2: ``source venv2/bin/activate`` (Linux, macOS) or ``source venv2/Scripts/activate`` (Git Bash under Windows, see below)
|
||||||
@@ -41,52 +47,48 @@ below.
|
|||||||
* Install OctoPrint in `"editable" mode <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>`_,
|
* Install OctoPrint in `"editable" mode <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>`_,
|
||||||
including its regular *and* development and plugin development dependencies:
|
including its regular *and* development and plugin development dependencies:
|
||||||
|
|
||||||
* ``pip install -e .[develop,plugins]``
|
* ``pip install -e '.[develop,plugins]'``
|
||||||
|
|
||||||
When the virtual environment is activated you can then:
|
When the virtual environment is activated you can then:
|
||||||
|
|
||||||
* run the OctoPrint server via ``octoprint serve``
|
* run the OctoPrint server via ``octoprint serve``
|
||||||
* run the test suite from the checked out source folder via ``nosetests --with-doctest``
|
* run the test suite from the checked out source folder via ``pytest``
|
||||||
* build the documentation from the ``docs`` sub folder of the checked out sources via ``sphinx-build -b html . _build``
|
|
||||||
|
|
||||||
To switch the activated virtual environment, simply activate the new environment as described above.
|
To switch the activated virtual environment, simply activate the new environment as described above.
|
||||||
|
|
||||||
To deactivate the virtual environment and return to the system's default Python: ``deactivate``.
|
To deactivate the virtual environment and return to the system's default Python: ``deactivate``.
|
||||||
|
|
||||||
|
If you also want to be able to build the documentation that resides in the ``docs`` subfolder, you need to activate
|
||||||
|
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:
|
||||||
|
|
||||||
|
* ``sphinx-build -b html . _build``
|
||||||
|
|
||||||
.. _sec-development-environment-source-linux:
|
.. _sec-development-environment-source-linux:
|
||||||
|
|
||||||
Linux
|
Linux
|
||||||
.....
|
.....
|
||||||
|
|
||||||
.. todo::
|
|
||||||
|
|
||||||
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
|
|
||||||
|
|
||||||
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
|
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
|
||||||
location, please substitute accordingly.
|
location, please substitute accordingly.
|
||||||
|
|
||||||
First make sure you have python including its header files, pip, setuptools, virtualenv, git and some build requirements
|
First make sure you have python 2 and 3 including their header files, pip, setuptools, virtualenv, git and some build requirements
|
||||||
installed:
|
installed:
|
||||||
|
|
||||||
* On apt based distributions (e.g. Debian, Ubuntu, ...):
|
* On apt based distributions (e.g. Debian, Ubuntu, ...):
|
||||||
|
|
||||||
.. code-block:: none
|
.. code-block:: none
|
||||||
|
|
||||||
sudo apt-get install python python-pip python-dev python-setuptools python-virtualenv git libyaml-dev build-essential
|
sudo apt-get install python python-pip python-dev python-setuptools python-virtualenv python3 python3-virtualenv python3-dev git libyaml-dev build-essential
|
||||||
|
|
||||||
* On zypper based distributions (example below for SLES 12 SP2):
|
|
||||||
|
|
||||||
.. code-block:: none
|
|
||||||
|
|
||||||
sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/python/SLE_12_SP2/ python_devel
|
|
||||||
sudo zypper ref
|
|
||||||
sudo zypper in python python-pip python-devel python-setuptools python-virtualenv git libyaml-devel
|
|
||||||
sudo zypper in -t pattern Basis-Devel
|
|
||||||
|
|
||||||
.. todo::
|
.. todo::
|
||||||
|
|
||||||
Using a Linux distribution that doesn't use ``apt`` or ``zypper``? Please send a
|
Using a Linux distribution that doesn't use ``apt``? Please send a
|
||||||
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
|
`Pull Request <https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
|
||||||
steps into this guide!
|
steps into this guide!
|
||||||
|
|
||||||
Then:
|
Then:
|
||||||
@@ -94,36 +96,42 @@ Then:
|
|||||||
.. code-block:: none
|
.. code-block:: none
|
||||||
|
|
||||||
cd ~/devel
|
cd ~/devel
|
||||||
git clone -b devel https://github.com/foosel/OctoPrint.git
|
git clone https://github.com/OctoPrint/OctoPrint.git
|
||||||
cd OctoPrint
|
cd OctoPrint
|
||||||
virtualenv venv
|
virtualenv --python=python2 venv2
|
||||||
source ./venv/bin/activate
|
virtualenv --python=python3 venv3
|
||||||
|
source ./venv2/bin/activate
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -e .[develop,plugins]
|
pip install -e .[develop,plugins]
|
||||||
|
source ./venv3/bin/activate
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install -e .[develop,plugins,docs]
|
||||||
|
|
||||||
You can then start OctoPrint via ``~/devel/OctoPrint/venv/bin/octoprint`` or just ``octoprint`` if you activated the virtual
|
You can then start OctoPrint via ``octoprint`` after activating one of the two virtual environments.
|
||||||
environment.
|
|
||||||
|
|
||||||
.. _sec-development-environment-windows:
|
.. _sec-development-environment-windows:
|
||||||
|
|
||||||
Windows
|
Windows
|
||||||
.......
|
.......
|
||||||
|
|
||||||
.. todo::
|
|
||||||
|
|
||||||
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
|
|
||||||
|
|
||||||
This assumes you'll host your OctoPrint development checkout at ``C:\Devel\OctoPrint``. If you want to use a different
|
This assumes you'll host your OctoPrint development checkout at ``C:\Devel\OctoPrint``. If you want to use a different
|
||||||
location, please substitute accordingly.
|
location, please substitute accordingly.
|
||||||
|
|
||||||
First download & install:
|
First download & install:
|
||||||
|
|
||||||
* `Python 2.7.15 Windows x86 MSI installer <https://www.python.org/downloads/release/python-2715/>`_
|
* `Git for Windows <https://git-for-windows.github.io/>`_
|
||||||
|
* `Latest *stable* Python 2.7 and Python 3.8 releases from python.org <https://www.python.org/downloads/windows/>`_
|
||||||
|
(at the time of writing those are ``2.7.18`` and ``3.8.4``)
|
||||||
|
|
||||||
* make sure to have the installer add Python to the ``PATH`` and have it install ``pip`` too
|
* make sure to have the installer add Python to the ``PATH`` and have it install ``pip`` too
|
||||||
|
* it's recommended to install Python 2.7 into ``C:\Python27`` and Python 3 into ``C:\Python38`` - if you select
|
||||||
|
different install locations please substitute accordingly
|
||||||
|
|
||||||
* `Microsoft Visual C++ Compiler for Python 2.7 <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`_
|
* `Microsoft Visual C++ Compiler for Python 2.7 <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`_
|
||||||
* `Git for Windows <https://git-for-windows.github.io/>`_
|
* `Build Tools For Visual Studio 2019 <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019>`_
|
||||||
|
|
||||||
|
* install "C++ build tools" and ensure the latest versions of "MSVCv142 - VS 2019 C++ x64/x86 build tools" and
|
||||||
|
"Windows 10 SDK" are checked.
|
||||||
|
|
||||||
Open the Git Bash you just installed and in that:
|
Open the Git Bash you just installed and in that:
|
||||||
|
|
||||||
@@ -131,12 +139,16 @@ Open the Git Bash you just installed and in that:
|
|||||||
|
|
||||||
pip install virtualenv
|
pip install virtualenv
|
||||||
cd /c/Devel
|
cd /c/Devel
|
||||||
git clone https://github.com/foosel/OctoPrint.git
|
git clone https://github.com/OctoPrint/OctoPrint.git
|
||||||
cd OctoPrint
|
cd OctoPrint
|
||||||
virtualenv venv
|
virtualenv --python=C:\Python27\python.exe venv2
|
||||||
source ./venv/Scripts/activate
|
virtualenv --python=C:\Python38\python.exe venv3
|
||||||
|
source ./venv2/Scripts/activate
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install -e .[develop,plugins]
|
pip install -e .[develop,plugins]
|
||||||
|
source ./venv3/Scripts/activate
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install -e .[develop,plugins,docs]
|
||||||
|
|
||||||
.. _sec-development-environment-mac:
|
.. _sec-development-environment-mac:
|
||||||
|
|
||||||
@@ -145,12 +157,14 @@ Mac OS X
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
This guide is based on the `Setup Guide for Mac OS X on OctoPrint's wiki <https://github.com/foosel/OctoPrint/wiki/Setup-on-Mac/>`_.
|
This guide is based on the `Setup Guide for Mac OS X on OctoPrint's Community Forum <https://community.octoprint.org/t/setting-up-octoprint-on-macos/13425>`_.
|
||||||
Please report back if it works for you, due to lack of access to a Mac I cannot test it myself. Thanks.
|
Please report back if it works for you, due to lack of access to a Mac I cannot test it myself. Thanks.
|
||||||
|
|
||||||
.. todo::
|
.. todo::
|
||||||
|
|
||||||
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
|
This guide is not yet adapted to the concurrent use of Python 2 and 3 environments during development. Please send a
|
||||||
|
`Pull Request <https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
|
||||||
|
steps into this guide!
|
||||||
|
|
||||||
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
|
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
|
||||||
location, please substitute accordingly.
|
location, please substitute accordingly.
|
||||||
@@ -178,7 +192,7 @@ You'll need a user account with administrator privileges.
|
|||||||
.. code-block:: none
|
.. code-block:: none
|
||||||
|
|
||||||
cd ~/devel
|
cd ~/devel
|
||||||
git clone https://github.com/foosel/OctoPrint.git
|
git clone https://github.com/OctoPrint/OctoPrint.git
|
||||||
cd OctoPrint
|
cd OctoPrint
|
||||||
virtualenv venv
|
virtualenv venv
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
@@ -190,14 +204,10 @@ You'll need a user account with administrator privileges.
|
|||||||
IDE Setup
|
IDE Setup
|
||||||
---------
|
---------
|
||||||
|
|
||||||
.. todo::
|
|
||||||
|
|
||||||
This guide is not yet adapted to the concurrent use of Python 2.7 and 3.7 environments during development.
|
|
||||||
|
|
||||||
.. todo::
|
.. todo::
|
||||||
|
|
||||||
Using another IDE than the ones below? Please send a
|
Using another IDE than the ones below? Please send a
|
||||||
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
|
`Pull Request <https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
|
||||||
steps into this guide!
|
steps into this guide!
|
||||||
|
|
||||||
.. _sec-development-environment-ides-pycharm:
|
.. _sec-development-environment-ides-pycharm:
|
||||||
@@ -206,49 +216,70 @@ PyCharm
|
|||||||
.......
|
.......
|
||||||
|
|
||||||
- "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
|
- "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
|
||||||
- **(Linux, Windows)** "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...", select OctoPrint venv
|
- Register virtual environments:
|
||||||
folder (e.g. ``~/devel/OctoPrint/venv`` or ``C:\Devel\OctoPrint\venv``)
|
|
||||||
- **(macOS)** "PyCharm" > "Preferences ..." > "Project: OctoPrint" > "Project Interpreter" > "Add ..." >
|
- **(Linux, Windows)** "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...",
|
||||||
"Virtualenv Environment > "Existing Environment", select OctoPrint venv folder (e.g. ``~/devel/OctoPrint/venv``)
|
select OctoPrint ``venv2`` folder (e.g. ``~/devel/OctoPrint/venv2`` or ``C:\Devel\OctoPrint\venv2``).
|
||||||
|
- **(macOS)** "PyCharm" > "Preferences ..." > "Project: OctoPrint" > "Project Interpreter" > "Add ..." >
|
||||||
|
"Virtualenv Environment > "Existing Environment", select OctoPrint ``venv2`` folder (e.g. ``~/devel/OctoPrint/venv2``).
|
||||||
|
|
||||||
|
Repeat for the ``venv3`` folder.
|
||||||
|
|
||||||
- Right click "src" in project tree, mark as source folder
|
- Right click "src" in project tree, mark as source folder
|
||||||
- Add Run/Debug Configuration, select "Python":
|
- Add Run/Debug Configuration, select "Python":
|
||||||
|
|
||||||
* Name: OctoPrint server
|
* Name: OctoPrint server
|
||||||
* Script: path to ``run`` in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/run`` or ``C:\Devel\OctoPrint\run``)
|
* Module name: ``octoprint``
|
||||||
* Script parameters: ``serve --debug``
|
* Parameters: ``serve --debug``
|
||||||
* Project: ``OctoPrint``
|
* Project: ``OctoPrint``
|
||||||
* Python interpreter: the ``venv`` local virtual environment
|
* Python interpreter: Project Default
|
||||||
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
|
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
|
||||||
* If you want dependencies to auto-update on run if necessary: "Before Launch" > "+" > "Run external tool" > "+"
|
* If you want build artifacts to be cleaned up on run (recommended): "Before Launch" > "+" > "Run external tool" > "+"
|
||||||
|
|
||||||
* Name: Update OctoPrint dependencies
|
* Name: Clean build directory
|
||||||
* Program: ``$PyInterpreterDirectory$/pip`` (or ``$PyInterpreterDirectory$/pip.exe`` on Windows)
|
* Program: ``$ModuleSdkPath$``
|
||||||
* Parameters: ``install -e .[develop,plugins]``
|
* Parameters: ``setup.py clean``
|
||||||
* Working directory: ``$ProjectFileDir$``
|
* Working directory: ``$ProjectFileDir$``
|
||||||
|
|
||||||
- Add Run/Debug Configuration, select "Python tests" and therein "Nosetests":
|
* If you want dependencies to auto-update on run if necessary (recommended): "Before Launch" > "+" > "Run external tool" > "+"
|
||||||
|
|
||||||
* Name: OctoPrint nosetests
|
* Name: Update OctoPrint dependencies
|
||||||
* Target: Path, ``.``
|
* Program: ``$ModuleSdkPath$``
|
||||||
|
* Parameters: ``-m pip install -e .[develop,plugins]``
|
||||||
|
* Working directory: ``$ProjectFileDir$``
|
||||||
|
|
||||||
|
Note that sadly that seems to cause some hiccups on current PyCharm versions due to ``$PyInterpreterDirectory$``
|
||||||
|
being empty sometimes, so if this fails to run on your installation, you should update your dependencies manually
|
||||||
|
for now.
|
||||||
|
|
||||||
|
- Add Run/Debug Configuration, select "Python tests" and therein "pytest":
|
||||||
|
|
||||||
|
* Name: OctoPrint tests
|
||||||
|
* Target: Custom
|
||||||
* Project: ``OctoPrint``
|
* Project: ``OctoPrint``
|
||||||
* Python interpreter: the ``venv`` local virtual environment
|
* Python interpreter: Project Default
|
||||||
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
|
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
|
||||||
* Just like with the run configuration for the server you can also have the dependencies auto-update on run of
|
* Just like with the run configuration for the server you can also have the dependencies auto-update on run of
|
||||||
the tests, see above on how to set this up.
|
the tests, see above on how to set this up.
|
||||||
|
|
||||||
- Add Run/Debug Configuration, select "Python docs" and therein "Sphinx task"
|
- Add Run/Debug Configuration, select "Python":
|
||||||
|
|
||||||
* Name: OctoPrint docs
|
* Name: OctoPrint docs
|
||||||
* Command: ``html``
|
* Module name: ``sphinx.cmd.build``
|
||||||
* Input: the ``docs`` folder in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/docs`` or
|
* Parameters: ``-v -T -E ./docs ./docs/_build -b html``
|
||||||
``C:\Devel\OctoPrint\docs``)
|
|
||||||
* Output: the ``docs/_build`` folder in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/docs/_build`` or
|
|
||||||
``C:\Devel\OctoPrint\docs\_build``)
|
|
||||||
* Project: ``OctoPrint``
|
* Project: ``OctoPrint``
|
||||||
* Python interpreter: the ``venv`` local virtual environment
|
* Python interpreter: ``venv3`` environment (the docs build requires Python 3)
|
||||||
|
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
|
||||||
* Just like with the run configuration for the server you can also have the dependencies auto-update when building
|
* Just like with the run configuration for the server you can also have the dependencies auto-update when building
|
||||||
the documentation, see above on how to set this up.
|
the documentation, see above on how to set this up.
|
||||||
|
|
||||||
|
Note that this requires you to also have installed the additional ``docs`` dependencies into the Python 3 venv as
|
||||||
|
described above via ``pip install -e .[develop,plugins,docs]``.
|
||||||
|
|
||||||
|
To switch between Python 2 and 3, all you need to do now is change the Project Default Interpreter and restart
|
||||||
|
OctoPrint. On current PyCharm versions you can do that right from a small selection field in the footer of the IDE.
|
||||||
|
Otherwise go through Settings.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Make sure you are running a PyCharm version of 2016.1 or later, or manually fix
|
Make sure you are running a PyCharm version of 2016.1 or later, or manually fix
|
||||||
|
|||||||
@@ -9,3 +9,4 @@ Development
|
|||||||
|
|
||||||
environment.rst
|
environment.rst
|
||||||
virtual_printer.rst
|
virtual_printer.rst
|
||||||
|
profiling.rst
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
.. _sec-request-profiling:
|
||||||
|
|
||||||
|
Profiling requests
|
||||||
|
==================
|
||||||
|
|
||||||
|
Once you have a development environment set up, you will need to launch
|
||||||
|
OctoPrint using ``serve --debug`` as parameters.
|
||||||
|
|
||||||
|
At this point, you are able to make the exact same requests as before. To
|
||||||
|
profile a specific request, just add ``?perfprofile`` or ``&perfprofile`` to the
|
||||||
|
request parameters. The request will be rendered as usual, but you will receive
|
||||||
|
an html document with the profiling results instead of the contents of the
|
||||||
|
response.
|
||||||
|
|
||||||
|
Errors
|
||||||
|
------
|
||||||
|
|
||||||
|
If you receive a ``500: Internal Server Error`` and a ``ModuleNotFoundError: No
|
||||||
|
module named 'pyinstrument'`` in the console, you didn't install development
|
||||||
|
dependencies. Do that now using ``pip install -e '.[develop]'``.
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
Setting up the virtual printer for debugging
|
Setting up the virtual printer for debugging
|
||||||
============================================
|
============================================
|
||||||
|
|
||||||
OctoPrint includes, by default, a virtual printer plugin. This plugin allows you to debug OctoPrint's serial
|
OctoPrint includes, by default, a :ref:`virtual printer plugin <sec-bundledplugins-virtual_printer>`. This plugin allows you to debug OctoPrint's serial
|
||||||
communication without connecting to an actual printer. Furthermore, it is possible to create certain edge conditions
|
communication without connecting to an actual printer. Furthermore, it is possible to create certain edge conditions
|
||||||
that may be hard to reproduce with a real printer.
|
that may be hard to reproduce with a real printer.
|
||||||
|
|
||||||
@@ -12,33 +12,186 @@ that may be hard to reproduce with a real printer.
|
|||||||
Enabling the virtual printer
|
Enabling the virtual printer
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
The virtual printer is enabled by editing OctoPrint's config.yaml file. Details on the configuration file can
|
The virtual printer can be enabled through its Settings pane.
|
||||||
be found in the full :ref:`config.yaml documentation <sec-configuration-config_yaml>`.
|
|
||||||
|
|
||||||
The steps to take are as follows:
|
|
||||||
|
|
||||||
* Find config.yaml in the OctoPrint settings folder. Usually in ``~/.octoprint`` on Linux, in ``%APPDATA%/OctoPrint`` on Windows and in ``~/Library/Application Support/OctoPrint`` on macOS.
|
|
||||||
* Add or extend the ``devel`` section with:
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
devel:
|
|
||||||
virtualPrinter:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
* Restart OctoPrint.
|
|
||||||
* In the connection panel, a new option will appear in the Serial Port dropdown labeled ``VIRTUAL``.
|
|
||||||
* Select this option and click ``connect``.
|
|
||||||
* The virtual printer is now active.
|
|
||||||
|
|
||||||
.. _sec-development-virtual-printer-config:
|
.. _sec-development-virtual-printer-config:
|
||||||
|
|
||||||
Virtual printer configuration options
|
Virtual printer configuration options
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
The config.yaml file has many configuration options for the virtual printer that allow you to fine-tune its behavior.
|
There many configuration options via ``config.yaml`` for the virtual printer that allow you to fine-tune its behavior:
|
||||||
|
|
||||||
Please see the relevant :ref:`config.yaml section <sec-configuration-config_yaml-devel>` for the full details.
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
|
||||||
|
# Settings for the virtual printer
|
||||||
|
virtual_printer:
|
||||||
|
|
||||||
|
# Whether to enable the virtual printer and include it in the list of available serial connections.
|
||||||
|
# Defaults to false.
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# Whether to send an additional "ok" after a resend request (like Repetier)
|
||||||
|
okAfterResend: false
|
||||||
|
|
||||||
|
# Whether to force checksums and line number in the communication (like Repetier), if set to true
|
||||||
|
# printer will only accept commands that come with linenumber and checksum and throw an error for
|
||||||
|
# lines that don't. Defaults to false
|
||||||
|
forceChecksum: false
|
||||||
|
|
||||||
|
# Whether to send "ok" responses with the line number that gets acknowledged by the "ok". Defaults
|
||||||
|
# to false.
|
||||||
|
okWithLinenumber: false
|
||||||
|
|
||||||
|
# Number of extruders to simulate on the virtual printer. Map from tool id (0, 1, ...) to temperature
|
||||||
|
# in °C
|
||||||
|
numExtruders: 1
|
||||||
|
|
||||||
|
# Allows pinning certain hotends to a fixed temperature
|
||||||
|
pinnedExtruders: null
|
||||||
|
|
||||||
|
# Whether to include the current tool temperature in the M105 output as separate T segment or not.
|
||||||
|
#
|
||||||
|
# True: > M105
|
||||||
|
# < ok T:23.5/0.0 T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
|
||||||
|
# False: > M105
|
||||||
|
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
|
||||||
|
includeCurrentToolInTemps: true
|
||||||
|
|
||||||
|
# Whether to include the selected filename in the M23 File opened response.
|
||||||
|
#
|
||||||
|
# True: > M23 filename.gcode
|
||||||
|
# < File opened: filename.gcode Size: 27
|
||||||
|
# False: > M23 filename.gcode
|
||||||
|
# > File opened
|
||||||
|
includeFilenameInOpened: true
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# < TargetExtr0:220.0
|
||||||
|
# < ok
|
||||||
|
# > M105
|
||||||
|
# < ok T0:34.3 T1:23.5 B:43.2
|
||||||
|
# False: > M109 S220.0
|
||||||
|
# < ok
|
||||||
|
# > M105
|
||||||
|
# < ok T0:34.3/220.0 T1:23.5/0.0 B:43.2/0.0
|
||||||
|
repetierStyleTargetTemperature: false
|
||||||
|
|
||||||
|
# If enabled, uses repetier style resends, sending multiple resends for the same line
|
||||||
|
# to make sure nothing gets lost on the line
|
||||||
|
repetierStyleResends: false
|
||||||
|
|
||||||
|
# If enabled, ok will be sent before a commands output, otherwise after or inline (M105)
|
||||||
|
#
|
||||||
|
# True: > M20
|
||||||
|
# < ok
|
||||||
|
# < Begin file list
|
||||||
|
# < End file list
|
||||||
|
# False: > M20
|
||||||
|
# < Begin file list
|
||||||
|
# < End file list
|
||||||
|
# < ok
|
||||||
|
okBeforeCommandOutput: false
|
||||||
|
|
||||||
|
# If enabled, reports the first extruder in M105 responses as T instead of T0
|
||||||
|
#
|
||||||
|
# True: > M105
|
||||||
|
# < ok T:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
|
||||||
|
# False: > M105
|
||||||
|
# < ok T0:34.3/0.0 T1:23.5/0.0 B:43.2/0.0
|
||||||
|
smoothieTemperatureReporting: false
|
||||||
|
|
||||||
|
# Whether M20 responses will include filesize or not
|
||||||
|
#
|
||||||
|
# True: <filename> <filesize in bytes>
|
||||||
|
# False: <filename>
|
||||||
|
extendedSdFileList: false
|
||||||
|
|
||||||
|
# Forced pause for retrieving from the outgoing buffer
|
||||||
|
throttle: 0.01
|
||||||
|
|
||||||
|
# Whether to send "wait" responses every "waitInterval" seconds when serial rx buffer is empty
|
||||||
|
sendWait: false
|
||||||
|
|
||||||
|
# Interval in which to send "wait" lines when rx buffer is empty
|
||||||
|
waitInterval: 1
|
||||||
|
|
||||||
|
# Size of the simulated RX buffer in bytes, when it's full a send from OctoPrint's
|
||||||
|
# side will block
|
||||||
|
rxBuffer: 64
|
||||||
|
|
||||||
|
# Size of simulated command buffer, number of commands. If full, buffered commands will block
|
||||||
|
# until a slot frees up
|
||||||
|
commandBuffer: 4
|
||||||
|
|
||||||
|
# Whether to support the M112 command with simulated kill
|
||||||
|
supportM112: true
|
||||||
|
|
||||||
|
# Whether to send messages received via M117 back as "echo:" lines
|
||||||
|
echoOnM117: true
|
||||||
|
|
||||||
|
# Whether to simulate broken M29 behaviour (missing ok after response)
|
||||||
|
brokenM29: true
|
||||||
|
|
||||||
|
# Whether F is supported as individual command
|
||||||
|
supportF: false
|
||||||
|
|
||||||
|
# Firmware name to report (useful for testing firmware detection)
|
||||||
|
firmwareName: Virtual Marlin 1.0
|
||||||
|
|
||||||
|
# Simulate a shared nozzle
|
||||||
|
sharedNozzle: false
|
||||||
|
|
||||||
|
# Send "busy" messages if busy processing something
|
||||||
|
sendBusy: false
|
||||||
|
|
||||||
|
# Simulate a reset on connect
|
||||||
|
simulateReset: true
|
||||||
|
|
||||||
|
# Lines to send on simulated reset
|
||||||
|
resetLines:
|
||||||
|
- start
|
||||||
|
- "Marlin: Virtual Marlin!"
|
||||||
|
- "SD card ok"
|
||||||
|
|
||||||
|
# Initial set of prepared oks to use instead of regular ok (e.g. to simulate
|
||||||
|
# mis-sent oks). Can also be filled at runtime via the debug command prepare_ok
|
||||||
|
preparedOks: []
|
||||||
|
|
||||||
|
# Format string for ok response.
|
||||||
|
#
|
||||||
|
# Placeholders:
|
||||||
|
# - lastN: last acknowledged line number
|
||||||
|
# - buffer: empty slots in internal command buffer
|
||||||
|
#
|
||||||
|
# Example format string for "extended" ok format:
|
||||||
|
# ok N{lastN} P{buffer}
|
||||||
|
okFormatString: ok
|
||||||
|
|
||||||
|
# Format string for M115 output.
|
||||||
|
#
|
||||||
|
# Placeholders:
|
||||||
|
# - firmare_name: The firmware name as defined in firmwareName
|
||||||
|
m115FormatString: "FIRMWARE_NAME: {firmware_name} PROTOCOL_VERSION:1.0"
|
||||||
|
|
||||||
|
# Whether to include capability report in M115 output
|
||||||
|
m115ReportCapabilites: false
|
||||||
|
|
||||||
|
# Capabilities to report if capability report is enabled
|
||||||
|
capabilities:
|
||||||
|
AUTOREPORT_TEMP: true
|
||||||
|
|
||||||
|
# Simulated ambient temperature in °C
|
||||||
|
ambientTemperature: 21.3
|
||||||
|
|
||||||
.. _sec-development-virtual-printer-log:
|
.. _sec-development-virtual-printer-log:
|
||||||
|
|
||||||
@@ -46,7 +199,7 @@ Log file
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
Once activated, the virtual printer will log all serial communication in the ``plugin_virtual_printer_serial.log`` file
|
Once activated, the virtual printer will log all serial communication in the ``plugin_virtual_printer_serial.log`` file
|
||||||
that can be found in the OctoPrint settings folder.
|
that can be found in the OctoPrint logs folder.
|
||||||
|
|
||||||
.. _sec-development-virtual-printer-debug:
|
.. _sec-development-virtual-printer-debug:
|
||||||
|
|
||||||
|
|||||||
@@ -197,12 +197,15 @@ File handling
|
|||||||
-------------
|
-------------
|
||||||
|
|
||||||
Upload
|
Upload
|
||||||
A file has been uploaded through the web interface.
|
A file has been uploaded through the :ref:`REST API <sec-api-fileops-uploadfile>`.
|
||||||
|
|
||||||
Payload:
|
Payload:
|
||||||
* ``name``: the file's name
|
* ``name``: the file's name
|
||||||
* ``path``: the file's path within its storage location
|
* ``path``: the file's path within its storage location
|
||||||
* ``target``: the target storage location to which the file was uploaded, either ``local`` or ``sdcard``
|
* ``target``: the target storage location to which the file was uploaded, either ``local`` or ``sdcard``
|
||||||
|
* ``select``: whether the file will immediately be selected, as requested on the API by the corresponding parameter
|
||||||
|
* ``print``: whether the file will immediately start printing, as requested on the API by the corresponding parameter
|
||||||
|
* ``userdata``: optional ``userdata`` if provided on the API, will only be present if supplied in the upload request
|
||||||
|
|
||||||
.. deprecated:: 1.3.0
|
.. deprecated:: 1.3.0
|
||||||
|
|
||||||
|
|||||||
@@ -210,12 +210,12 @@ Controls
|
|||||||
* - ``input.slider.step``
|
* - ``input.slider.step``
|
||||||
- (Optional) Step size per slider "tick", defaults to 1.
|
- (Optional) Step size per slider "tick", defaults to 1.
|
||||||
* - ``regex``
|
* - ``regex``
|
||||||
- (Optional) A `regular expression <https://docs.python.org/2/library/re.html#regular-expression-syntax>`_ to
|
- (Optional) A :ref:`regular expression <re-syntax>` to
|
||||||
match against lines received from the printer to retrieve information from it (e.g. specific output). Together
|
match against lines received from the printer to retrieve information from it (e.g. specific output). Together
|
||||||
with ``template`` this allows rendition of received data from the printer within the UI.
|
with ``template`` this allows rendition of received data from the printer within the UI.
|
||||||
* - ``template``
|
* - ``template``
|
||||||
- (Optional) A template to use for rendering the match of ``regex``. May contain placeholders in
|
- (Optional) A template to use for rendering the match of ``regex``. May contain placeholders in
|
||||||
`Python Format String Syntax <https://docs.python.org/2/library/string.html#format-string-syntax>`_ for either named
|
:ref:`Python Format String Syntax <formatstrings>` for either named
|
||||||
groups within the regex (e.g. ``Temperature: {temperature}`` for a regex ``T:\s*(?P<temperature>\d+(\.\d*)``)
|
groups within the regex (e.g. ``Temperature: {temperature}`` for a regex ``T:\s*(?P<temperature>\d+(\.\d*)``)
|
||||||
or positional groups within the regex (e.g. ``Position: X={0}, Y={1}, Z={2}, E={3}`` for a regex
|
or positional groups within the regex (e.g. ``Position: X={0}, Y={1}, Z={2}, E={3}`` for a regex
|
||||||
``X:([0-9.]+) Y:([0-9.]+) Z:([0-9.]+) E:([0-9.]+)``).
|
``X:([0-9.]+) Y:([0-9.]+) Z:([0-9.]+) E:([0-9.]+)``).
|
||||||
|
|||||||
@@ -18,13 +18,7 @@ simple "send-as-is" scripts but making use of a full blown templating language i
|
|||||||
this end, OctoPrint injects some variables into the :ref:`template rendering context <sec-features-gcode_scripts-context>`
|
this end, OctoPrint injects some variables into the :ref:`template rendering context <sec-features-gcode_scripts-context>`
|
||||||
as described below.
|
as described below.
|
||||||
|
|
||||||
You can find the docs on the Jinja templating engine as used in OctoPrint at `jinja.octoprint.org <http://jinja.octoprint.org/templates.html>`_.
|
You can find the docs on the Jinja templating engine as used in OctoPrint `here <https://jinja.palletsprojects.com/en/2.11.x/templates/>`_.
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Due to backwards compatibility issues with Jinja versions 2.9+, OctoPrint currently only supports Jinja 2.8. For this
|
|
||||||
reason use the template documentation at `jinja.octoprint.org <http://jinja.octoprint.org/templates.html>`_ instead of the
|
|
||||||
documentation of current stable Jinja versions.
|
|
||||||
|
|
||||||
.. _sec-features-gcode_scripts-predefined:
|
.. _sec-features-gcode_scripts-predefined:
|
||||||
|
|
||||||
@@ -250,7 +244,6 @@ to the persisted pause position on resume, making sure to also reset the extrude
|
|||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
`Jinja Template Designer Documentation <http://jinja.octoprint.org/templates.html>`_
|
`Jinja Template Designer Documentation <https://jinja.palletsprojects.com/en/2.11.x/templates/>`_
|
||||||
Jinja's Template Designer Documentation describes the syntax and semantics of the template language used
|
Jinja's Template Designer Documentation describes the syntax and semantics of the template language used
|
||||||
also by OctoPrint's GCODE scripts. Linked here are the docs for Jinja 2.8.1, which OctoPrint still
|
also by OctoPrint's GCODE scripts.
|
||||||
relies on for backwards compatibility reasons.
|
|
||||||
@@ -28,7 +28,7 @@ Finding Plugins
|
|||||||
|
|
||||||
The official OctoPrint Plugin Repository can be found at `plugins.octoprint.org <http://plugins.octoprint.org>`_.
|
The official OctoPrint Plugin Repository can be found at `plugins.octoprint.org <http://plugins.octoprint.org>`_.
|
||||||
|
|
||||||
Some plugins may also be found in the list provided in `the OctoPrint wiki <https://github.com/foosel/OctoPrint/wiki#plugins>`_
|
Some plugins may also be found in the list provided in `the OctoPrint wiki <https://github.com/OctoPrint/OctoPrint/wiki#plugins>`_
|
||||||
and on the `OctoPrint organization Github page <https://github.com/OctoPrint>`_.
|
and on the `OctoPrint organization Github page <https://github.com/OctoPrint>`_.
|
||||||
|
|
||||||
.. _sec-features-plugins-installing:
|
.. _sec-features-plugins-installing:
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
@@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
Sets the current flowrate multiplier.
|
Sets the current flowrate multiplier.
|
||||||
|
|
||||||
``factor`` is expected to be a integer value between 75 and 125 representing the new flowrate percentage.
|
``factor`` is expected to be a integer value >0 representing the new flowrate percentage.
|
||||||
|
|
||||||
See the ``flowrate`` command in :ref:`Issue a tool command <sec-api-printer-toolcommand>` for more details.
|
See the ``flowrate`` command in :ref:`Issue a tool command <sec-api-printer-toolcommand>` for more details.
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@
|
|||||||
|
|
||||||
Sets the feedrate multiplier to use.
|
Sets the feedrate multiplier to use.
|
||||||
|
|
||||||
``factor`` is expected to be a integer value between 0 and 200 representing the new feedrate percentage.
|
``factor`` is expected to be a integer value >0 representing the new feedrate percentage.
|
||||||
|
|
||||||
See the ``feedrate`` command in :ref:`Issue a print head command <sec-api-printer-printheadcommand>` for more details.
|
See the ``feedrate`` command in :ref:`Issue a print head command <sec-api-printer-printheadcommand>` for more details.
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@
|
|||||||
|
|
||||||
.. code-block:: javascript
|
.. code-block:: javascript
|
||||||
|
|
||||||
OctoPrint.util.testUrl("127.0.0.1", 1234, {"protocol": "udp"})
|
OctoPrint.util.testServer("127.0.0.1", 1234, {"protocol": "udp"})
|
||||||
.done(function(response) {
|
.done(function(response) {
|
||||||
if (response.result) {
|
if (response.result) {
|
||||||
// check passed
|
// check passed
|
||||||
@@ -203,6 +203,30 @@
|
|||||||
:param object opts: Additional options for the request
|
:param object opts: Additional options for the request
|
||||||
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
|
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
|
||||||
|
|
||||||
|
.. js:function:: OctoPrintClient.util.testResolution(name, additional, opts)
|
||||||
|
|
||||||
|
Test if a host name can be resolved.
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
Test if ``octoprint.org`` can be resolved.
|
||||||
|
|
||||||
|
.. code-block:: javascript
|
||||||
|
|
||||||
|
OctoPrint.util.testResolution("octoprint.org")
|
||||||
|
.done(function(response) {
|
||||||
|
if (response.result) {
|
||||||
|
// check passed
|
||||||
|
} else {
|
||||||
|
// check failed
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
:param string name: Host name to test
|
||||||
|
:param object additional: Additional parameters for the test command
|
||||||
|
:param object opts: Additional options for the request
|
||||||
|
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
:ref:`Util API <sec-api-util>`
|
:ref:`Util API <sec-api-util>`
|
||||||
|
|||||||
-242
@@ -1,242 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
|
|
||||||
REM Command file for Sphinx documentation
|
|
||||||
|
|
||||||
if "%SPHINXBUILD%" == "" (
|
|
||||||
set SPHINXBUILD=sphinx-build
|
|
||||||
)
|
|
||||||
set BUILDDIR=_build
|
|
||||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
|
||||||
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
|
||||||
if NOT "%PAPER%" == "" (
|
|
||||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
|
||||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "" goto help
|
|
||||||
|
|
||||||
if "%1" == "help" (
|
|
||||||
:help
|
|
||||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
|
||||||
echo. html to make standalone HTML files
|
|
||||||
echo. dirhtml to make HTML files named index.html in directories
|
|
||||||
echo. singlehtml to make a single large HTML file
|
|
||||||
echo. pickle to make pickle files
|
|
||||||
echo. json to make JSON files
|
|
||||||
echo. htmlhelp to make HTML files and a HTML help project
|
|
||||||
echo. qthelp to make HTML files and a qthelp project
|
|
||||||
echo. devhelp to make HTML files and a Devhelp project
|
|
||||||
echo. epub to make an epub
|
|
||||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
|
||||||
echo. text to make text files
|
|
||||||
echo. man to make manual pages
|
|
||||||
echo. texinfo to make Texinfo files
|
|
||||||
echo. gettext to make PO message catalogs
|
|
||||||
echo. changes to make an overview over all changed/added/deprecated items
|
|
||||||
echo. xml to make Docutils-native XML files
|
|
||||||
echo. pseudoxml to make pseudoxml-XML files for display purposes
|
|
||||||
echo. linkcheck to check all external links for integrity
|
|
||||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "clean" (
|
|
||||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
|
||||||
del /q /s %BUILDDIR%\*
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
%SPHINXBUILD% 2> nul
|
|
||||||
if errorlevel 9009 (
|
|
||||||
echo.
|
|
||||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
||||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
||||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
||||||
echo.may add the Sphinx directory to PATH.
|
|
||||||
echo.
|
|
||||||
echo.If you don't have Sphinx installed, grab it from
|
|
||||||
echo.http://sphinx-doc.org/
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "html" (
|
|
||||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "dirhtml" (
|
|
||||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "singlehtml" (
|
|
||||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "pickle" (
|
|
||||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished; now you can process the pickle files.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "json" (
|
|
||||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished; now you can process the JSON files.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "htmlhelp" (
|
|
||||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
|
||||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "qthelp" (
|
|
||||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
|
||||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
|
||||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\OctoPrint.qhcp
|
|
||||||
echo.To view the help file:
|
|
||||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\OctoPrint.ghc
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "devhelp" (
|
|
||||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "epub" (
|
|
||||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "latex" (
|
|
||||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "latexpdf" (
|
|
||||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
|
||||||
cd %BUILDDIR%/latex
|
|
||||||
make all-pdf
|
|
||||||
cd %BUILDDIR%/..
|
|
||||||
echo.
|
|
||||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "latexpdfja" (
|
|
||||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
|
||||||
cd %BUILDDIR%/latex
|
|
||||||
make all-pdf-ja
|
|
||||||
cd %BUILDDIR%/..
|
|
||||||
echo.
|
|
||||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "text" (
|
|
||||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "man" (
|
|
||||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "texinfo" (
|
|
||||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "gettext" (
|
|
||||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "changes" (
|
|
||||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.The overview file is in %BUILDDIR%/changes.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "linkcheck" (
|
|
||||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Link check complete; look for any errors in the above output ^
|
|
||||||
or in %BUILDDIR%/linkcheck/output.txt.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "doctest" (
|
|
||||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Testing of doctests in the sources finished, look at the ^
|
|
||||||
results in %BUILDDIR%/doctest/output.txt.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "xml" (
|
|
||||||
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%1" == "pseudoxml" (
|
|
||||||
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
|
||||||
if errorlevel 1 exit /b 1
|
|
||||||
echo.
|
|
||||||
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
|
||||||
goto end
|
|
||||||
)
|
|
||||||
|
|
||||||
:end
|
|
||||||
@@ -4,6 +4,7 @@ octoprint.plugin
|
|||||||
----------------
|
----------------
|
||||||
|
|
||||||
.. automodule:: octoprint.plugin
|
.. automodule:: octoprint.plugin
|
||||||
|
:members:
|
||||||
|
|
||||||
.. _sec-modules-plugin-core:
|
.. _sec-modules-plugin-core:
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ octoprint.plugin.core
|
|||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
.. automodule:: octoprint.plugin.core
|
.. automodule:: octoprint.plugin.core
|
||||||
|
:members:
|
||||||
|
|
||||||
.. _sec-modules-plugin-types:
|
.. _sec-modules-plugin-types:
|
||||||
|
|
||||||
@@ -18,3 +20,4 @@ octoprint.plugin.types
|
|||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
.. automodule:: octoprint.plugin.types
|
.. automodule:: octoprint.plugin.types
|
||||||
|
:members:
|
||||||
@@ -4,6 +4,7 @@ octoprint.printer
|
|||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
.. automodule:: octoprint.printer
|
.. automodule:: octoprint.printer
|
||||||
|
:members:
|
||||||
|
|
||||||
.. _sec-modules-printer-profile:
|
.. _sec-modules-printer-profile:
|
||||||
|
|
||||||
@@ -11,3 +12,4 @@ octoprint.printer.profile
|
|||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
.. automodule:: octoprint.printer.profile
|
.. automodule:: octoprint.printer.profile
|
||||||
|
:members:
|
||||||
@@ -4,3 +4,4 @@ octoprint.settings
|
|||||||
------------------
|
------------------
|
||||||
|
|
||||||
.. automodule:: octoprint.settings
|
.. automodule:: octoprint.settings
|
||||||
|
:members:
|
||||||
@@ -4,10 +4,12 @@ octoprint.slicing
|
|||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
.. automodule:: octoprint.slicing
|
.. automodule:: octoprint.slicing
|
||||||
|
:members:
|
||||||
|
|
||||||
.. _sec-modules-slicing-exceptions:
|
.. _sec-modules-slicing-exceptions:
|
||||||
|
|
||||||
octoprint.slicing.exceptions
|
octoprint.slicing.exceptions
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
.. automodule:: octoprint.slicing.exceptions
|
.. automodule:: octoprint.slicing.exceptions
|
||||||
|
:members:
|
||||||
@@ -13,3 +13,11 @@ octoprint.util.commandline
|
|||||||
|
|
||||||
.. automodule:: octoprint.util.commandline
|
.. automodule:: octoprint.util.commandline
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
.. _sec-modules-util-platform:
|
||||||
|
|
||||||
|
octoprint.util.platform
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. automodule:: octoprint.util.platform
|
||||||
|
:members:
|
||||||
@@ -14,7 +14,7 @@ First of all let use make sure that you have OctoPrint checked out and set up fo
|
|||||||
development environment::
|
development environment::
|
||||||
|
|
||||||
$ cd ~/devel
|
$ cd ~/devel
|
||||||
$ git clone https://github.com/foosel/OctoPrint
|
$ git clone https://github.com/OctoPrint/OctoPrint
|
||||||
[...]
|
[...]
|
||||||
$ cd OctoPrint
|
$ cd OctoPrint
|
||||||
$ virtualenv venv
|
$ virtualenv venv
|
||||||
@@ -143,7 +143,7 @@ as a simple python file following the naming convention ``<plugin identifier>.py
|
|||||||
that can be done in one file. Distributing multiple files and getting your users to install them in the right way
|
that can be done in one file. Distributing multiple files and getting your users to install them in the right way
|
||||||
so that OctoPrint will be able to actually find and load them is certainly not impossible, but we want to do it in the
|
so that OctoPrint will be able to actually find and load them is certainly not impossible, but we want to do it in the
|
||||||
best way possible, meaning we want to make our plugin a fully installable Python module that your users will be able to
|
best way possible, meaning we want to make our plugin a fully installable Python module that your users will be able to
|
||||||
install directly via `OctoPrint's built-in Plugin Manager <https://github.com/foosel/OctoPrint/wiki/Plugin:-Plugin-Manager>`_
|
install directly via `OctoPrint's built-in Plugin Manager <https://docs.octoprint.org/en/master/bundledplugins/pluginmanager.html>`_
|
||||||
or alternatively manually utilizing Python's standard package manager ``pip`` directly.
|
or alternatively manually utilizing Python's standard package manager ``pip`` directly.
|
||||||
|
|
||||||
So let's begin. We'll use the `cookiecutter <https://github.com/audreyr/cookiecutter>`_ template for OctoPrint plugins
|
So let's begin. We'll use the `cookiecutter <https://github.com/audreyr/cookiecutter>`_ template for OctoPrint plugins
|
||||||
@@ -1091,7 +1091,7 @@ you haven't seen yet, :ref:`take a look at the available plugin mixins <sec-plug
|
|||||||
|
|
||||||
For some insight on how to create plugins that react to various events within OctoPrint,
|
For some insight on how to create plugins that react to various events within OctoPrint,
|
||||||
`the Growl Plugin <https://github.com/OctoPrint/OctoPrint-Growl>`_ might be a good example to learn from. For how to
|
`the Growl Plugin <https://github.com/OctoPrint/OctoPrint-Growl>`_ might be a good example to learn from. For how to
|
||||||
add support for a slicer, OctoPrint's own bundled `CuraEngine plugin <https://github.com/foosel/OctoPrint/wiki/Plugin:-Cura>`_
|
add support for a slicer, the `CuraEngine Legacy plugin <https://github.com/OctoPrint/OctoPrint-CuraEngineLegacy>`_
|
||||||
might give some hints. For extending OctoPrint's interface, the `NavbarTemp plugin <https://github.com/imrahil/OctoPrint-NavbarTemp>`_
|
might give some hints. For extending OctoPrint's interface, the `NavbarTemp plugin <https://github.com/imrahil/OctoPrint-NavbarTemp>`_
|
||||||
might show what's possible with a few lines of code already. Finally, just take a look at the
|
might show what's possible with a few lines of code already. Finally, just take a look at the
|
||||||
`official Plugin Repository <http://plugins.octoprint.org>`_ if you are looking for examples.
|
`official Plugin Repository <http://plugins.octoprint.org>`_ if you are looking for examples.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Helpers are methods that plugins can expose to other plugins in order to make co
|
|||||||
system. They are registered with the OctoPrint plugin system through the use of the control property ``__plugin_helpers__``.
|
system. They are registered with the OctoPrint plugin system through the use of the control property ``__plugin_helpers__``.
|
||||||
|
|
||||||
An example for providing some helper functions to the system can be found in the
|
An example for providing some helper functions to the system can be found in the
|
||||||
`Discovery Plugin <https://github.com/foosel/OctoPrint/wiki/Plugin:-Discovery>`_,
|
`Discovery Plugin <https://docs.octoprint.org/en/master/bundledplugins/discovery.html>`_,
|
||||||
which provides its SSDP browsing and Zeroconf browsing and publishing functions as helper methods.
|
which provides its SSDP browsing and Zeroconf browsing and publishing functions as helper methods.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|||||||
+29
-10
@@ -65,7 +65,7 @@ the general type of script for which to look for additions ("gcode") and the scr
|
|||||||
return a 2-tuple of prefix and postfix if has something for either of those, otherwise ``None``. OctoPrint will then take
|
return a 2-tuple of prefix and postfix if has something for either of those, otherwise ``None``. OctoPrint will then take
|
||||||
care to add prefix and suffix as necessary after a small round of preprocessing.
|
care to add prefix and suffix as necessary after a small round of preprocessing.
|
||||||
|
|
||||||
Plugins can easily add their own hooks too. For example, the `Software Update Plugin <https://github.com/foosel/OctoPrint/tree/master/src/octoprint/plugins/softwareupdate>`_
|
Plugins can easily add their own hooks too. For example, the `Software Update Plugin <https://docs.octoprint.org/en/master/bundledplugins/softwareupdate.html>`_
|
||||||
declares a custom hook "octoprint.plugin.softwareupdate.check_config" which other plugins can add handlers for in order
|
declares a custom hook "octoprint.plugin.softwareupdate.check_config" which other plugins can add handlers for in order
|
||||||
to register themselves with the Software Update Plugin by returning their own update check configuration.
|
to register themselves with the Software Update Plugin by returning their own update check configuration.
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ octoprint.access.permissions
|
|||||||
fields are as follows:
|
fields are as follows:
|
||||||
|
|
||||||
* ``key``: A key for the permission to be used for referring to it from source code. This will turned uppercase
|
* ``key``: A key for the permission to be used for referring to it from source code. This will turned uppercase
|
||||||
and prefixed with ``PLUGIN_<PLUGIN IDENTIFIER>_`` before being made available on ``octoprint.access.permissions.Permissions``,
|
and prefixed with ``PLUGIN_<PLUGIN IDENTIFIER>_`` before being made available on ``octoprint.access.permissions.Permissions``,
|
||||||
e.g. ``my_permission`` on the plugin with identifier ``example`` turns into ``PLUGIN_EXAMPLE_MY_PERMISSION`` and
|
e.g. ``my_permission`` on the plugin with identifier ``example`` turns into ``PLUGIN_EXAMPLE_MY_PERMISSION`` and
|
||||||
can be accessed as ``octoprint.access.permissions.Permissions.PLUGIN_EXAMPLE_MY_PERMISSION`` on the server and
|
can be accessed as ``octoprint.access.permissions.Permissions.PLUGIN_EXAMPLE_MY_PERMISSION`` on the server and
|
||||||
``permissions.PLUGIN_EXAMPLE_MY_PERMISSION`` on the ``AccessViewModel`` on the client. Must only contain a-z, A-Z, 0-9 and _.
|
``permissions.PLUGIN_EXAMPLE_MY_PERMISSION`` on the ``AccessViewModel`` on the client. Must only contain a-z, A-Z, 0-9 and _.
|
||||||
@@ -472,12 +472,12 @@ octoprint.comm.protocol.firmware.info
|
|||||||
This includes I/O of any kind.
|
This includes I/O of any kind.
|
||||||
|
|
||||||
:param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
|
:param object comm_instance: The :class:`~octoprint.util.comm.MachineCom` instance which triggered the hook.
|
||||||
:param str firmware_name: The name of the parsed capability
|
:param str firmware_name: The parsed name of the firmware
|
||||||
:param dict firmware_data: All data contained in the ``M115`` report
|
:param dict firmware_data: All data contained in the ``M115`` report
|
||||||
|
|
||||||
.. _sec-plugins-hook-comm-protocol-firmware-capabilities:
|
.. _sec-plugins-hook-comm-protocol-firmware-capabilities:
|
||||||
|
|
||||||
octoprint.comm.firmware.protocol.capabilities
|
octoprint.comm.protocol.firmware.capabilities
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. py:function:: firmware_capability_hook(comm_instance, capability, enabled, already_defined, *args, **kwargs)
|
.. py:function:: firmware_capability_hook(comm_instance, capability, enabled, already_defined, *args, **kwargs)
|
||||||
@@ -890,6 +890,25 @@ octoprint.comm.protocol.temperatures.received
|
|||||||
:tab-width: 4
|
:tab-width: 4
|
||||||
:caption: `sanitize_temperatures.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/sanitize_temperatures.py>`_
|
:caption: `sanitize_temperatures.py <https://github.com/OctoPrint/Plugin-Examples/blob/master/sanitize_temperatures.py>`_
|
||||||
|
|
||||||
|
.. _sec-plugins-hook-comm-transport-serial-additonal-port-names:
|
||||||
|
|
||||||
|
octoprint.comm.transport.serial.additional_port_names
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. py:function:: additional_port_names_hook(candidates, *args, **kwargs)
|
||||||
|
|
||||||
|
Return additional port names (not glob patterns!) to use as a serial connection to the printer. Expected to be
|
||||||
|
``list`` of ``string``s.
|
||||||
|
|
||||||
|
Useful in combination with :ref:`octoprint.comm.transport.serial.factory <sec-plugins-hook-comm-transport-serial-factory>`
|
||||||
|
to implement custom serial-like ports through plugins.
|
||||||
|
|
||||||
|
For an example of use see the bundled ``virtual_printer`` plugin.
|
||||||
|
|
||||||
|
:param list candidates: The port names already found on the system available for connection.
|
||||||
|
:return: Additional port names to offer up for connection.
|
||||||
|
:rtype: list
|
||||||
|
|
||||||
.. _sec-plugins-hook-comm-transport-serial-factory:
|
.. _sec-plugins-hook-comm-transport-serial-factory:
|
||||||
|
|
||||||
octoprint.comm.transport.serial.factory
|
octoprint.comm.transport.serial.factory
|
||||||
@@ -907,21 +926,21 @@ octoprint.comm.transport.serial.factory
|
|||||||
closely if directly utilizing :class:`~octoprint.util.comm.MachineCom` functionality.
|
closely if directly utilizing :class:`~octoprint.util.comm.MachineCom` functionality.
|
||||||
|
|
||||||
A valid serial instance is expected to provide the following methods, analogue to PySerial's
|
A valid serial instance is expected to provide the following methods, analogue to PySerial's
|
||||||
`serial.Serial <https://pythonhosted.org//pyserial/pyserial_api.html#serial.Serial>`_:
|
:py:class:`serial.Serial`:
|
||||||
|
|
||||||
readline(size=None, eol='\n')
|
readline(size=None, eol='\n')
|
||||||
Reads a line from the serial connection, compare `serial.Filelike.readline <https://pythonhosted.org//pyserial/pyserial_api.html#serial.FileLike.readline>`_.
|
Reads a line from the serial connection, compare :py:meth:`serial.Serial.readline`.
|
||||||
write(data)
|
write(data)
|
||||||
Writes data to the serial connection, compare `serial.Filelike.write <https://pythonhosted.org//pyserial/pyserial_api.html#serial.FileLike.write>`_.
|
Writes data to the serial connection, compare :py:meth:`serial.Serial.write`.
|
||||||
close()
|
close()
|
||||||
Closes the serial connection, compare `serial.Serial.close <https://pythonhosted.org//pyserial/pyserial_api.html#serial.Serial.close>`_.
|
Closes the serial connection, compare :py:meth:`serial.Serial.close`.
|
||||||
|
|
||||||
Additionally setting the following attributes need to be supported if baudrate detection is supposed to work:
|
Additionally setting the following attributes need to be supported if baudrate detection is supposed to work:
|
||||||
|
|
||||||
baudrate
|
baudrate
|
||||||
An integer describing the baudrate to use for the serial connection, compare `serial.Serial.baudrate <https://pythonhosted.org//pyserial/pyserial_api.html#serial.Serial.baudrate>`_.
|
An integer describing the baudrate to use for the serial connection, compare :py:attr:`serial.Serial.baudrate`.
|
||||||
timeout
|
timeout
|
||||||
An integer describing the read timeout on the serial connection, compare `serial.Serial.timeout <https://pythonhosted.org//pyserial/pyserial_api.html#serial.Serial.timeout>`_.
|
An integer describing the read timeout on the serial connection, compare :py:attr:`serial.Serial.timeout`.
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ An overview of these properties follows.
|
|||||||
data files etc). Plugins should not access this property directly but instead utilize :func:`~octoprint.plugin.types.OctoPrintPlugin.get_plugin_data_folder`
|
data files etc). Plugins should not access this property directly but instead utilize :func:`~octoprint.plugin.types.OctoPrintPlugin.get_plugin_data_folder`
|
||||||
which will make sure the path actually does exist and if not create it before returning it.
|
which will make sure the path actually does exist and if not create it before returning it.
|
||||||
``self._logger``
|
``self._logger``
|
||||||
A `python logger instance <https://docs.python.org/2/library/logging.html>`_ logging to the log target
|
A :py:class:`logging.Logger` instance logging to the log target
|
||||||
``octoprint.plugin.<plugin identifier>``.
|
``octoprint.plugin.<plugin identifier>``.
|
||||||
``self._settings``
|
``self._settings``
|
||||||
The plugin's personalized settings manager, injected only into plugins that include the :class:`~octoprint.plugin.SettingsPlugin` mixin.
|
The plugin's personalized settings manager, injected only into plugins that include the :class:`~octoprint.plugin.SettingsPlugin` mixin.
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ Then create an editable install of your plugin, start the server and start testi
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
If you want to migrate your existing OctoPrint install *on OctoPi* to Python 3, I suggest to first make a
|
If you want to migrate your existing OctoPrint install *on OctoPi 0.17.0* to Python 3, I suggest to first make a
|
||||||
:ref:`backup <sec-bundledplugins-backup>`, then move the existing venv ``/home/pi/oprint`` out of the way and
|
:ref:`backup <sec-bundledplugins-backup>`, then move the existing venv ``/home/pi/oprint`` out of the way and
|
||||||
create a new one based on Python 3 (which should already be present on current OctoPi images):
|
create a new one based on Python 3 (which should already be present on current OctoPi images):
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ Then create an editable install of your plugin, start the server and start testi
|
|||||||
mv ~/oprint ~/oprint.py2
|
mv ~/oprint ~/oprint.py2
|
||||||
virtualenv --python=/usr/bin/python3 oprint
|
virtualenv --python=/usr/bin/python3 oprint
|
||||||
source ~/oprint/bin/activate
|
source ~/oprint/bin/activate
|
||||||
pip install "OctoPrint>=1.4.0rc1"
|
pip install "OctoPrint>=1.4.0"
|
||||||
sudo service octoprint restart
|
sudo service octoprint restart
|
||||||
|
|
||||||
.. _sec-plugins-python3-markup:
|
.. _sec-plugins-python3-markup:
|
||||||
@@ -218,7 +218,7 @@ You can read more about this specific issue in the corresponding section of the
|
|||||||
`Python porting guide <https://docs.python.org/3/howto/pyporting.html#text-versus-binary-data>`__ and also in the
|
`Python porting guide <https://docs.python.org/3/howto/pyporting.html#text-versus-binary-data>`__ and also in the
|
||||||
`cheat sheet <https://python-future.org/compatible_idioms.html#strings-and-bytes>`__.
|
`cheat sheet <https://python-future.org/compatible_idioms.html#strings-and-bytes>`__.
|
||||||
|
|
||||||
.. _sec-plugins-python3-pitfalls-imports:
|
.. _sec-plugins-python3-pitfalls-absolute-imports:
|
||||||
|
|
||||||
Absolute imports
|
Absolute imports
|
||||||
................
|
................
|
||||||
@@ -246,6 +246,33 @@ You can read more about this specific issue in the
|
|||||||
`cheat sheet <https://python-future.org/compatible_idioms.html#imports-relative-to-a-package>`__ and also in
|
`cheat sheet <https://python-future.org/compatible_idioms.html#imports-relative-to-a-package>`__ and also in
|
||||||
`the book <http://python3porting.com/problems.html#relative-import-problems>`__.
|
`the book <http://python3porting.com/problems.html#relative-import-problems>`__.
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-pitfalls-version-specific-imports:
|
||||||
|
|
||||||
|
Version specific imports
|
||||||
|
........................
|
||||||
|
|
||||||
|
Sometimes it is necessary to use an import statement that is explicitly related to a specific Python version, e.g. due to
|
||||||
|
a package change between Python 2 and 3. You can do this by first trying the Python 3 import and if that doesn't work
|
||||||
|
out trying the Python 2 import instead:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
try:
|
||||||
|
import queue
|
||||||
|
except ImportError:
|
||||||
|
import Queue as queue
|
||||||
|
|
||||||
|
This should be the preferred method of handling situations like this. If you actually do need to do explicit version
|
||||||
|
specific imports that cannot be handled this way, you can check for the Python version like this:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
if sys.version[0] == '2':
|
||||||
|
# Python 2 specific imports
|
||||||
|
else:
|
||||||
|
# Python 3 specific imports
|
||||||
|
|
||||||
.. _sec-plugins-python3-pitfalls-intdiv:
|
.. _sec-plugins-python3-pitfalls-intdiv:
|
||||||
|
|
||||||
Integer division
|
Integer division
|
||||||
@@ -312,13 +339,14 @@ As a summary, follow this checklist to migrate your plugin to be compatible to b
|
|||||||
* Thorougly test your plugin under Python 3. Pay special attention to any kind of string handling issues, integer
|
* Thorougly test your plugin under Python 3. Pay special attention to any kind of string handling issues, integer
|
||||||
division, relative imports from your plugin package and how the results of ``map``, ``filter`` and ``zip`` are
|
division, relative imports from your plugin package and how the results of ``map``, ``filter`` and ``zip`` are
|
||||||
used in your code, as those have proven to be the biggest issues during past migrations.
|
used in your code, as those have proven to be the biggest issues during past migrations.
|
||||||
* Once everything works under both Python versions and you've prepared a new release of your plugin, update your
|
* Once everything works under both Python versions and you've prepared a new release of your plugin (don't forget to
|
||||||
registration file in the Official Plugin Repository to include the correct Python compatibility information as well:
|
increment the version!), update your registration file in the Official Plugin Repository to include the correct
|
||||||
|
Python compatibility information as well:
|
||||||
|
|
||||||
.. code-block:: yaml
|
.. code-block:: yaml
|
||||||
|
|
||||||
compatibility:
|
compatibility:
|
||||||
python: ">=2.7,<3"
|
python: ">=2.7,<4"
|
||||||
|
|
||||||
.. _sec-plugins-python3-furtherreading:
|
.. _sec-plugins-python3-furtherreading:
|
||||||
|
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ Web interface reconnect
|
|||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
`OctoPrint's core viewmodels <https://github.com/foosel/OctoPrint/tree/devel/src/octoprint/static/js/app/viewmodels>`_
|
`OctoPrint's core viewmodels <https://github.com/OctoPrint/OctoPrint/tree/master/src/octoprint/static/js/app/viewmodels>`_
|
||||||
OctoPrint's own view models use the same mechanisms for interacting with each other and the web application as
|
OctoPrint's own view models use the same mechanisms for interacting with each other and the web application as
|
||||||
plugins. Their source code is therefore a good point of reference on how to achieve certain things.
|
plugins. Their source code is therefore a good point of reference on how to achieve certain things.
|
||||||
`KnockoutJS documentation <http://knockoutjs.com/documentation/introduction.html>`_
|
`KnockoutJS documentation <http://knockoutjs.com/documentation/introduction.html>`_
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from sphinx.highlighting import PygmentsBridge
|
|||||||
from sphinx.ext import doctest
|
from sphinx.ext import doctest
|
||||||
from sphinx.util.texescape import tex_hl_escape_map_new
|
from sphinx.util.texescape import tex_hl_escape_map_new
|
||||||
|
|
||||||
from docutils.nodes import General, FixedTextElement, literal_block, container
|
from docutils import nodes
|
||||||
from docutils.parsers.rst import directives
|
from docutils.parsers.rst import directives
|
||||||
|
|
||||||
from six import text_type
|
from six import text_type
|
||||||
@@ -22,6 +22,10 @@ from pygments.filters import VisibleWhitespaceFilter, ErrorToken
|
|||||||
from pygments.lexers.python import PythonConsoleLexer
|
from pygments.lexers.python import PythonConsoleLexer
|
||||||
from pygments.util import ClassNotFound
|
from pygments.util import ClassNotFound
|
||||||
|
|
||||||
|
if False:
|
||||||
|
# For type annotation
|
||||||
|
from typing import Any, Dict, List, Tuple # NOQA
|
||||||
|
|
||||||
def _merge_dict(a, b):
|
def _merge_dict(a, b):
|
||||||
"""
|
"""
|
||||||
Little helper to merge two dicts a and b on the fly.
|
Little helper to merge two dicts a and b on the fly.
|
||||||
@@ -30,7 +34,7 @@ def _merge_dict(a, b):
|
|||||||
result.update(b)
|
result.update(b)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
class literal_block_ext(General, FixedTextElement):
|
class literal_block_ext(nodes.General, nodes.FixedTextElement):
|
||||||
"""
|
"""
|
||||||
Custom node which is basically the same as a :class:`literal_block`, just with whitespace support and introduced
|
Custom node which is basically the same as a :class:`literal_block`, just with whitespace support and introduced
|
||||||
in order to be able to have a custom visitor.
|
in order to be able to have a custom visitor.
|
||||||
@@ -59,6 +63,7 @@ class CodeBlockExt(CodeBlock):
|
|||||||
option_spec = _merge_dict(CodeBlock.option_spec, dict(whitespace=directives.flag))
|
option_spec = _merge_dict(CodeBlock.option_spec, dict(whitespace=directives.flag))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
# type: () -> List[nodes.Node]
|
||||||
# get result from parent implementation
|
# get result from parent implementation
|
||||||
code_block = CodeBlock.run(self)
|
code_block = CodeBlock.run(self)
|
||||||
|
|
||||||
@@ -67,7 +72,7 @@ class CodeBlockExt(CodeBlock):
|
|||||||
Recursive method to turn all literal blocks located within a node into :class:`literal_block_ext`.
|
Recursive method to turn all literal blocks located within a node into :class:`literal_block_ext`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if isinstance(node, container):
|
if isinstance(node, nodes.container):
|
||||||
# container node => handle all children
|
# container node => handle all children
|
||||||
children = []
|
children = []
|
||||||
for child in node.children:
|
for child in node.children:
|
||||||
@@ -75,7 +80,7 @@ class CodeBlockExt(CodeBlock):
|
|||||||
node.children = children
|
node.children = children
|
||||||
return node
|
return node
|
||||||
|
|
||||||
elif isinstance(node, literal_block):
|
elif isinstance(node, nodes.literal_block):
|
||||||
# literal block => replace it
|
# literal block => replace it
|
||||||
return self._wrap_literal_block(node)
|
return self._wrap_literal_block(node)
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ from contextlib import closing
|
|||||||
|
|
||||||
from sphinx.directives.code import LiteralIncludeReader, LiteralInclude, dedent_lines, \
|
from sphinx.directives.code import LiteralIncludeReader, LiteralInclude, dedent_lines, \
|
||||||
nodes, parselinenos, logger, container_wrapper
|
nodes, parselinenos, logger, container_wrapper
|
||||||
|
from sphinx.util.nodes import set_source_info
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
@@ -53,22 +54,20 @@ class OnlineIncludeDirective(LiteralInclude):
|
|||||||
if not document.settings.file_insertion_enabled:
|
if not document.settings.file_insertion_enabled:
|
||||||
return [document.reporter.warning('File insertion disabled',
|
return [document.reporter.warning('File insertion disabled',
|
||||||
line=self.lineno)]
|
line=self.lineno)]
|
||||||
env = document.settings.env
|
|
||||||
|
|
||||||
# convert options['diff'] to absolute path
|
# convert options['diff'] to absolute path
|
||||||
if 'diff' in self.options:
|
if 'diff' in self.options:
|
||||||
_, path = env.relfn2path(self.options['diff'])
|
_, path = self.env.relfn2path(self.options['diff'])
|
||||||
self.options['diff'] = path
|
self.options['diff'] = path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
location = self.state_machine.get_source_and_line(self.lineno)
|
location = self.state_machine.get_source_and_line(self.lineno)
|
||||||
url = self.arguments[0]
|
url = self.arguments[0]
|
||||||
|
|
||||||
reader = OnlineIncludeReader(url, self.options, env.config)
|
reader = OnlineIncludeReader(url, self.options, self.config)
|
||||||
text, lines = reader.read(location=location)
|
text, lines = reader.read(location=location)
|
||||||
|
|
||||||
retnode = nodes.literal_block(text, text, source=url)
|
retnode = nodes.literal_block(text, text, source=url)
|
||||||
self.set_source_info(retnode)
|
set_source_info(self, retnode)
|
||||||
if self.options.get('diff'): # if diff is set, set udiff
|
if self.options.get('diff'): # if diff is set, set udiff
|
||||||
retnode['language'] = 'udiff'
|
retnode['language'] = 'udiff'
|
||||||
elif 'language' in self.options:
|
elif 'language' in self.options:
|
||||||
|
|||||||
@@ -4,14 +4,36 @@ Assumes OctoPrint is installed under user pi at /home/pi/OctoPrint/venv/bin/octo
|
|||||||
setup you'll need to adjust octoprint.default (init) or octoprint.service (systemd) accordingly.
|
setup you'll need to adjust octoprint.default (init) or octoprint.service (systemd) accordingly.
|
||||||
|
|
||||||
## init
|
## init
|
||||||
|
Download the init.d files to the locations shown:
|
||||||
|
|
||||||
```
|
```
|
||||||
octoprint.default => /etc/default/octoprint
|
octoprint.default => /etc/default/octoprint
|
||||||
octoprint.init => /etc/init.d/octoprint
|
octoprint.init => /etc/init.d/octoprint
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Next, enable and start the `octoprint` service:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Enable octoprint service
|
||||||
|
sudo update-rc.d octoprint defaults
|
||||||
|
|
||||||
|
# and start it
|
||||||
|
sudo service octoprint start
|
||||||
|
```
|
||||||
|
|
||||||
## systemd
|
## systemd
|
||||||
|
Download the systemd files to the locations shown:
|
||||||
|
|
||||||
```
|
```
|
||||||
octoprint.service => /etc/systemd/system/octoprint.service
|
octoprint.service => /etc/systemd/system/octoprint.service
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Next, enable and start the `octoprint` service:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Enable octoprint service
|
||||||
|
sudo systemctl enable octoprint
|
||||||
|
|
||||||
|
# and start it
|
||||||
|
sudo systemctl start octoprint
|
||||||
|
```
|
||||||
@@ -4,6 +4,8 @@ After=network-online.target
|
|||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Environment="LC_ALL=C.UTF-8"
|
||||||
|
Environment="LANG=C.UTF-8"
|
||||||
Type=simple
|
Type=simple
|
||||||
User=pi
|
User=pi
|
||||||
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint
|
ExecStart=/home/pi/OctoPrint/venv/bin/octoprint
|
||||||
|
|||||||
@@ -12,3 +12,13 @@ versionfile_build = octoprint/_version.py
|
|||||||
tag_prefix =
|
tag_prefix =
|
||||||
parentdir_prefix =
|
parentdir_prefix =
|
||||||
lookupfile = .versioneer-lookup
|
lookupfile = .versioneer-lookup
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
ignore =
|
||||||
|
D
|
||||||
|
E
|
||||||
|
W
|
||||||
|
F401
|
||||||
|
F523
|
||||||
|
exclude =
|
||||||
|
src/octoprint/vendor
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
|
||||||
from distutils.command.build_py import build_py as _build_py
|
from distutils.command.build_py import build_py as _build_py
|
||||||
import os
|
import os
|
||||||
import versioneer
|
import versioneer
|
||||||
@@ -19,66 +18,72 @@ PYTHON_REQUIRES = ">=2.7.9, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
|
|||||||
|
|
||||||
# Requirements for setup.py
|
# Requirements for setup.py
|
||||||
SETUP_REQUIRES = [
|
SETUP_REQUIRES = [
|
||||||
"markdown>=3.1,<3.2",
|
"markdown>=3.1,<3.2" # newer versions require Python 3
|
||||||
]
|
]
|
||||||
|
|
||||||
# Requirements for our application
|
# Requirements for our application
|
||||||
INSTALL_REQUIRES = [
|
INSTALL_REQUIRES = [
|
||||||
|
# additional OctoPrint plugins that are maintained on a different release cycle
|
||||||
|
"OctoPrint-FirmwareCheck>=2020.06.22",
|
||||||
|
"OctoPrint-FileCheck>=2020.07.06",
|
||||||
|
|
||||||
# the following dependencies are non trivial to update since later versions introduce backwards incompatible
|
# the following dependencies are non trivial to update since later versions introduce backwards incompatible
|
||||||
# changes that might affect plugins, or due to other observed problems
|
# changes that might affect plugins, or due to other observed problems
|
||||||
|
|
||||||
"flask>=0.12,<0.13", # newer versions require newer Jinja versions
|
"markupsafe>=1.1,<2.0", # Jinja dependency, newer versions require Python 3
|
||||||
"Jinja2>=2.8.1,<2.9", # Jinja 2.9 has breaking changes WRT template scope - we can't
|
"tornado==5.1.1", # newer versions require Python 3
|
||||||
# guarantee backwards compatibility for plugins and such with that
|
"markdown>=3.1,<3.2", # newer versions require Python 3
|
||||||
# version, hence we need to pin to a lower version for now. See #1697
|
"rsa==4.0", # newer versions require Python 3
|
||||||
"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
|
# anything below this should be checked on releases for new versions
|
||||||
|
|
||||||
"Flask-Login>=0.4.1,<0.5",
|
"flask>=1.1.2,<2",
|
||||||
"Flask-Babel>=0.12,<0.13",
|
"Jinja2>=2.11.2,<3",
|
||||||
"Flask-Assets>=0.12,<0.13",
|
"Flask-Login>=0.5,<0.6", # flask-login doesn't use semver & breaks stuff on minor version increases
|
||||||
"blinker>=1.4,<1.5", # dependency of the now vendor bundled flask_principal
|
"Flask-Babel>=1.0,<2",
|
||||||
"werkzeug>=0.16,<0.17",
|
"Flask-Assets>=2.0,<3",
|
||||||
"cachelib>=0.1,<0.2",
|
"werkzeug>=1.0.1,<2",
|
||||||
"PyYAML>=5.1,<6",
|
"itsdangerous>=1.1.0,<2",
|
||||||
"markdown>=3.1,<3.2",
|
"cachelib>=0.1,<1",
|
||||||
"pyserial>=3.4,<3.5",
|
"PyYAML>=5.3.1,<6",
|
||||||
"netaddr>=0.7.19,<0.8",
|
"pyserial>=3.4,<4",
|
||||||
"watchdog>=0.9.0,<0.10",
|
"netaddr>=0.7.19,<1",
|
||||||
|
"watchdog>=0.10.2,<1",
|
||||||
"sarge==0.1.5post0",
|
"sarge==0.1.5post0",
|
||||||
"netifaces>=0.10.9,<0.11",
|
"netifaces>=0.10.9,<1",
|
||||||
"pylru>=1.2,<1.3",
|
"pylru>=1.2,<2",
|
||||||
"rsa>=4.0,<5",
|
"pkginfo>=1.5.0.1,<2",
|
||||||
"pkginfo>=1.5.0.1,<1.6",
|
"requests>=2.23.0,<3",
|
||||||
"requests>=2.22.0,<3",
|
"semantic_version>=2.8.5,<3",
|
||||||
"semantic_version>=2.8,<2.9",
|
"psutil>=5.7,<6",
|
||||||
"psutil>=5.6.5,<5.7",
|
"Click>=7.1.2,<8",
|
||||||
"Click>=7,<8",
|
"feedparser>=5.2.1,<6",
|
||||||
"awesome-slugify>=1.6.5,<1.7",
|
"future>=0.18.2,<1",
|
||||||
"feedparser>=5.2.1,<5.3",
|
"websocket-client>=0.57,<1",
|
||||||
"future>=0.18.2,<0.19",
|
"wrapt>=1.12.1,<2",
|
||||||
"websocket-client>=0.56,<0.57",
|
"emoji>=0.5.4,<1",
|
||||||
"wrapt>=1.11.2,<1.12",
|
"frozendict>=1.2,<2",
|
||||||
"emoji>=0.5.4,<0.6",
|
"sentry-sdk>=0.15.1,<1",
|
||||||
"frozendict>=1.2,<1.3",
|
"filetype>=1.0.7,<2",
|
||||||
"sentry-sdk==0.13.2",
|
|
||||||
"filetype>=1.0.5,<2"
|
# vendor bundle dependencies
|
||||||
|
"unidecode>=0.04.14,<0.05", # dependency of awesome-slugify
|
||||||
|
"blinker>=1.4,<2" # dependency of flask_principal
|
||||||
]
|
]
|
||||||
|
|
||||||
# Python 2 specific requirements
|
# Python 2 specific requirements
|
||||||
INSTALL_REQUIRES_PYTHON2 = [
|
INSTALL_REQUIRES_PYTHON2 = [
|
||||||
"futures>=3.3,<3.4",
|
"futures>=3.3,<4",
|
||||||
"monotonic>=1.5,<1.6",
|
"monotonic>=1.5,<2",
|
||||||
"scandir>=1.10,<1.11",
|
"scandir>=1.10,<2",
|
||||||
"chainmap>=1.0.3,<1.1",
|
"chainmap>=1.0.3,<2",
|
||||||
"typing>=3.7.4.1,<4"
|
"typing>=3.7.4.1,<4"
|
||||||
]
|
]
|
||||||
|
|
||||||
# OSX specific requirements
|
# OSX specific requirements
|
||||||
INSTALL_REQUIRES_OSX = [
|
INSTALL_REQUIRES_OSX = [
|
||||||
"appdirs>=1.4.3",
|
"appdirs>=1.4.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Additional requirements for optional install options
|
# Additional requirements for optional install options
|
||||||
@@ -87,25 +92,30 @@ EXTRA_REQUIRES = dict(
|
|||||||
develop=[
|
develop=[
|
||||||
# Testing dependencies - SEE ALSO tox.ini
|
# Testing dependencies - SEE ALSO tox.ini
|
||||||
"mock>=3.0.5,<4",
|
"mock>=3.0.5,<4",
|
||||||
"pytest==4.6.6",
|
"pytest==4.6.10",
|
||||||
"pytest-doctest-custom>=1.0.0,<1.1",
|
"pytest-doctest-custom>=1.0.0,<2",
|
||||||
"ddt",
|
"ddt",
|
||||||
|
|
||||||
# linter
|
# linter
|
||||||
"flake8",
|
"flake8",
|
||||||
|
|
||||||
# Documentation dependencies
|
# profiler
|
||||||
"sphinx>=1.8.5,<2",
|
"pyinstrument",
|
||||||
"sphinxcontrib-httpdomain",
|
|
||||||
"sphinxcontrib-mermaid>=0.3.1",
|
|
||||||
"sphinx_rtd_theme",
|
|
||||||
"readthedocs-sphinx-ext==0.5.17" # Later versions require Jinja >= 2.9
|
|
||||||
],
|
],
|
||||||
|
|
||||||
# Dependencies for developing OctoPrint plugins
|
# Dependencies for developing OctoPrint plugins
|
||||||
plugins=[
|
plugins=[
|
||||||
"cookiecutter>=1.6,<1.7"
|
"cookiecutter>=1.7.2,<1.8"
|
||||||
]
|
],
|
||||||
|
|
||||||
|
# Dependencies for building the documentation - Python 3 required!
|
||||||
|
docs=[
|
||||||
|
"sphinx>=3,<4",
|
||||||
|
"sphinxcontrib-httpdomain",
|
||||||
|
"sphinxcontrib-mermaid",
|
||||||
|
"sphinx_rtd_theme",
|
||||||
|
"readthedocs-sphinx-ext"
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Dependency links for any of the aforementioned dependencies
|
# Dependency links for any of the aforementioned dependencies
|
||||||
@@ -171,6 +181,9 @@ def md_to_html_build_py_factory(files, baseclass):
|
|||||||
dict(files=files))
|
dict(files=files))
|
||||||
|
|
||||||
def get_cmdclass():
|
def get_cmdclass():
|
||||||
|
# make sure these are always available, even when run by dependabot
|
||||||
|
global versioneer, octoprint_setuptools, md_to_html_build_py_factory
|
||||||
|
|
||||||
cmdclass = versioneer.get_cmdclass()
|
cmdclass = versioneer.get_cmdclass()
|
||||||
|
|
||||||
# add clean command
|
# add clean command
|
||||||
@@ -194,6 +207,10 @@ def get_cmdclass():
|
|||||||
|
|
||||||
|
|
||||||
def params():
|
def params():
|
||||||
|
# make sure these are always available, even when run by dependabot
|
||||||
|
global versioneer, get_cmdclass, read_file_contents, here, \
|
||||||
|
PYTHON_REQUIRES, SETUP_REQUIRES, INSTALL_REQUIRES, EXTRA_REQUIRES, DEPENDENCY_LINKS
|
||||||
|
|
||||||
name = "OctoPrint"
|
name = "OctoPrint"
|
||||||
version = versioneer.get_version()
|
version = versioneer.get_version()
|
||||||
cmdclass = get_cmdclass()
|
cmdclass = get_cmdclass()
|
||||||
@@ -247,7 +264,7 @@ def params():
|
|||||||
"Funding": "https://donate.octoprint.org"
|
"Funding": "https://donate.octoprint.org"
|
||||||
}
|
}
|
||||||
|
|
||||||
packages = find_packages(where="src")
|
packages = setuptools.find_packages(where="src")
|
||||||
package_dir = {
|
package_dir = {
|
||||||
"": "src",
|
"": "src",
|
||||||
}
|
}
|
||||||
@@ -261,10 +278,10 @@ def params():
|
|||||||
zip_safe = False
|
zip_safe = False
|
||||||
|
|
||||||
if os.environ.get('READTHEDOCS', None) == 'True':
|
if os.environ.get('READTHEDOCS', None) == 'True':
|
||||||
# we can't tell read the docs to please perform a pip install -e .[develop], so we help
|
# we can't tell read the docs to please perform a pip install -e .[docs], so we help
|
||||||
# it a bit here by explicitly adding the development dependencies, which include our
|
# it a bit here by explicitly adding the development dependencies, which include our
|
||||||
# documentation dependencies
|
# documentation dependencies
|
||||||
install_requires = install_requires + extras_require['develop']
|
install_requires = install_requires + extras_require['docs']
|
||||||
|
|
||||||
entry_points = {
|
entry_points = {
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
@@ -274,4 +291,4 @@ def params():
|
|||||||
|
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
setup(**params())
|
setuptools.setup(**params())
|
||||||
@@ -47,6 +47,13 @@ if version_info.major == 2 and version_info.minor <= 7 and version_info.micro <
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
elif version_info.major == 3 and version_info.minor >= 8 and sys.platform == "win32":
|
||||||
|
# Python 3.8 makes proactor event loop the default on Windows, Tornado doesn't like that
|
||||||
|
#
|
||||||
|
# see https://github.com/tornadoweb/tornado/issues/2608
|
||||||
|
import asyncio
|
||||||
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||||
|
|
||||||
del version_info
|
del version_info
|
||||||
|
|
||||||
#~~ custom exceptions
|
#~~ custom exceptions
|
||||||
@@ -559,15 +566,22 @@ def init_connectivity_checker(settings, event_manager):
|
|||||||
connectivityInterval = settings.getInt(["server", "onlineCheck", "interval"])
|
connectivityInterval = settings.getInt(["server", "onlineCheck", "interval"])
|
||||||
connectivityHost = settings.get(["server", "onlineCheck", "host"])
|
connectivityHost = settings.get(["server", "onlineCheck", "host"])
|
||||||
connectivityPort = settings.getInt(["server", "onlineCheck", "port"])
|
connectivityPort = settings.getInt(["server", "onlineCheck", "port"])
|
||||||
|
connectivityName = settings.get(["server", "onlineCheck", "name"])
|
||||||
|
|
||||||
def on_connectivity_change(old_value, new_value):
|
def on_connectivity_change(old_value, new_value, connection_working=None, resolution_working=None):
|
||||||
event_manager.fire(Events.CONNECTIVITY_CHANGED, payload=dict(old=old_value, new=new_value))
|
event_manager.fire(Events.CONNECTIVITY_CHANGED, payload=dict(old=old_value,
|
||||||
|
new=new_value,
|
||||||
|
connection=connection_working,
|
||||||
|
resolution=resolution_working))
|
||||||
|
|
||||||
connectivityChecker = ConnectivityChecker(connectivityInterval,
|
connectivityChecker = ConnectivityChecker(connectivityInterval,
|
||||||
connectivityHost,
|
connectivityHost,
|
||||||
port=connectivityPort,
|
port=connectivityPort,
|
||||||
|
name=connectivityName,
|
||||||
enabled=connectivityEnabled,
|
enabled=connectivityEnabled,
|
||||||
on_change=on_connectivity_change)
|
on_change=on_connectivity_change)
|
||||||
|
connectivityChecker.check_immediately()
|
||||||
|
connectivityChecker.log_full_report()
|
||||||
|
|
||||||
return connectivityChecker
|
return connectivityChecker
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ class GroupManager(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._logger = logging.getLogger(__name__)
|
self._logger = logging.getLogger(__name__)
|
||||||
self._group_change_listeners = []
|
self._group_change_listeners = []
|
||||||
|
|
||||||
|
self._default_groups = []
|
||||||
self._init_defaults()
|
self._init_defaults()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -62,39 +64,50 @@ class GroupManager(object):
|
|||||||
return self.find_group(GUEST_GROUP)
|
return self.find_group(GUEST_GROUP)
|
||||||
|
|
||||||
def _init_defaults(self):
|
def _init_defaults(self):
|
||||||
self.add_group(ADMIN_GROUP,
|
self._default_groups = {
|
||||||
"Admins",
|
ADMIN_GROUP: dict(name="Admins",
|
||||||
"Administrators",
|
description="Administrators",
|
||||||
self.default_permissions_for_group(ADMIN_GROUP),
|
permissions=self.default_permissions_for_group(ADMIN_GROUP),
|
||||||
[],
|
subgroups=[],
|
||||||
changeable=False,
|
changeable=False,
|
||||||
removable=False,
|
removable=False,
|
||||||
save=False)
|
default=False,
|
||||||
self.add_group(USER_GROUP,
|
toggleable=True),
|
||||||
"Users",
|
USER_GROUP: dict(name="Operator",
|
||||||
"All logged in users",
|
description="Group to gain operator access",
|
||||||
self.default_permissions_for_group(USER_GROUP),
|
permissions=self.default_permissions_for_group(USER_GROUP),
|
||||||
[],
|
subgroups=[],
|
||||||
default=True,
|
changeable=True,
|
||||||
removable=False,
|
default=True,
|
||||||
toggleable=False,
|
removable=False,
|
||||||
save=False)
|
toggleable=True),
|
||||||
self.add_group(GUEST_GROUP,
|
GUEST_GROUP: dict(name="Guests",
|
||||||
"Guests",
|
description="Anyone who is not currently logged in",
|
||||||
"Anyone who is not currently logged in",
|
permissions=self.default_permissions_for_group(GUEST_GROUP),
|
||||||
self.default_permissions_for_group(GUEST_GROUP),
|
subgroups=[],
|
||||||
[],
|
changeable=True,
|
||||||
removable=False,
|
default=False,
|
||||||
toggleable=False,
|
removable=False,
|
||||||
save=False),
|
toggleable=False),
|
||||||
self.add_group(READONLY_GROUP,
|
READONLY_GROUP: dict(name="Read-only Access",
|
||||||
"Read-only Access",
|
description="Group to gain read-only access",
|
||||||
"Group to gain read-only access",
|
permissions=self.default_permissions_for_group(READONLY_GROUP),
|
||||||
self.default_permissions_for_group(READONLY_GROUP),
|
subgroups=[],
|
||||||
[],
|
changeable=False,
|
||||||
changeable=False,
|
removable=False,
|
||||||
removable=False,
|
default=False,
|
||||||
save=False)
|
toggleable=True)
|
||||||
|
}
|
||||||
|
|
||||||
|
for key, g in self._default_groups.items():
|
||||||
|
self.add_group(key, g["name"], g["description"],
|
||||||
|
g["permissions"], g["subgroups"],
|
||||||
|
changeable=g.get("changeable", True),
|
||||||
|
removable=g.get("removable", True),
|
||||||
|
default=g.get("default", False),
|
||||||
|
toggleable=g.get("toggleable", True),
|
||||||
|
save=False)
|
||||||
|
|
||||||
|
|
||||||
def register_listener(self, listener):
|
def register_listener(self, listener):
|
||||||
self._group_change_listeners.append(listener)
|
self._group_change_listeners.append(listener)
|
||||||
@@ -164,6 +177,8 @@ class GroupChangeListener(object):
|
|||||||
|
|
||||||
|
|
||||||
class FilebasedGroupManager(GroupManager):
|
class FilebasedGroupManager(GroupManager):
|
||||||
|
FILE_VERSION = 2
|
||||||
|
|
||||||
def __init__(self, path=None):
|
def __init__(self, path=None):
|
||||||
if path is None:
|
if path is None:
|
||||||
path = settings().get(["accessControl", "groupfile"])
|
path = settings().get(["accessControl", "groupfile"])
|
||||||
@@ -188,23 +203,41 @@ class FilebasedGroupManager(GroupManager):
|
|||||||
groups = data
|
groups = data
|
||||||
data = dict(groups=groups)
|
data = dict(groups=groups)
|
||||||
|
|
||||||
|
file_version = data.get("_version", 1)
|
||||||
|
if file_version < self.FILE_VERSION:
|
||||||
|
# make sure we migrate the file on disk after loading
|
||||||
|
self._logger.info("Detected file version {} on group "
|
||||||
|
"storage, migrating to version {}".format(file_version, self.FILE_VERSION))
|
||||||
|
self._dirty = True
|
||||||
|
|
||||||
groups = data.get("groups", dict())
|
groups = data.get("groups", dict())
|
||||||
tracked_permissions = data.get("tracked", list())
|
tracked_permissions = data.get("tracked", list())
|
||||||
|
|
||||||
for key, attributes in groups.items():
|
for key, attributes in groups.items():
|
||||||
if key in self._groups:
|
if key in self._default_groups:
|
||||||
# group is already there (from the defaults most likely)
|
# group is a default group
|
||||||
if not self._groups[key].is_changeable():
|
if not self._default_groups[key].get("changeable", True):
|
||||||
# group may not be changed -> bail
|
# group may not be changed -> bail
|
||||||
continue
|
continue
|
||||||
|
|
||||||
removable = self._groups[key].is_removable()
|
name = self._default_groups[key].get("name", "")
|
||||||
changeable = self._groups[key].is_changeable()
|
description = self._default_groups[key].get("description", "")
|
||||||
toggleable = self._groups[key].is_toggleable()
|
removable = self._default_groups[key].get("removable", True)
|
||||||
|
changeable = self._default_groups[key].get("changeable", True)
|
||||||
|
toggleable = self._default_groups[key].get("toggleable", True)
|
||||||
|
|
||||||
|
if file_version == 1:
|
||||||
|
# 1.4.0/file version 1 has a bug that resets default to True for users group on modification
|
||||||
|
set_default = self._default_groups[key].get("default", False)
|
||||||
|
else:
|
||||||
|
set_default = attributes.get("default", False)
|
||||||
else:
|
else:
|
||||||
|
name = attributes.get("name", "")
|
||||||
|
description = attributes.get("description", "")
|
||||||
removable = True
|
removable = True
|
||||||
changeable = True
|
changeable = True
|
||||||
toggleable = True
|
toggleable = True
|
||||||
|
set_default = attributes.get("default", False)
|
||||||
|
|
||||||
permissions = self._to_permissions(*attributes.get("permissions", []))
|
permissions = self._to_permissions(*attributes.get("permissions", []))
|
||||||
default_permissions = self.default_permissions_for_group(key)
|
default_permissions = self.default_permissions_for_group(key)
|
||||||
@@ -214,11 +247,11 @@ class FilebasedGroupManager(GroupManager):
|
|||||||
|
|
||||||
subgroups = attributes.get("subgroups", [])
|
subgroups = attributes.get("subgroups", [])
|
||||||
|
|
||||||
group = Group(key, attributes.get("name", ""),
|
group = Group(key, name,
|
||||||
description=attributes.get("description", ""),
|
description=description,
|
||||||
permissions=permissions,
|
permissions=permissions,
|
||||||
subgroups=subgroups,
|
subgroups=subgroups,
|
||||||
default=attributes.get("default", False),
|
default=set_default,
|
||||||
removable=removable,
|
removable=removable,
|
||||||
changeable=changeable,
|
changeable=changeable,
|
||||||
toggleable=toggleable)
|
toggleable=toggleable)
|
||||||
@@ -227,6 +260,9 @@ class FilebasedGroupManager(GroupManager):
|
|||||||
for group in self._groups.values():
|
for group in self._groups.values():
|
||||||
group._subgroups = self._to_groups(*group._subgroups)
|
group._subgroups = self._to_groups(*group._subgroups)
|
||||||
|
|
||||||
|
if self._dirty:
|
||||||
|
self._save()
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
self._logger.exception("Error while loading groups from file {}".format(self._groupfile))
|
self._logger.exception("Error while loading groups from file {}".format(self._groupfile))
|
||||||
|
|
||||||
@@ -238,14 +274,16 @@ class FilebasedGroupManager(GroupManager):
|
|||||||
for key in self._groups.keys():
|
for key in self._groups.keys():
|
||||||
group = self._groups[key]
|
group = self._groups[key]
|
||||||
groups[key] = dict(
|
groups[key] = dict(
|
||||||
name=group._name,
|
|
||||||
description=group._description,
|
|
||||||
permissions=self._from_permissions(*group._permissions),
|
permissions=self._from_permissions(*group._permissions),
|
||||||
subgroups=self._from_groups(*group._subgroups),
|
subgroups=self._from_groups(*group._subgroups),
|
||||||
default=group._default
|
default=group._default
|
||||||
)
|
)
|
||||||
|
if not key in self._default_groups:
|
||||||
|
groups[key]["name"] = group.get_name()
|
||||||
|
groups[key]["description"] = group.get_description()
|
||||||
|
|
||||||
data = dict(groups=groups,
|
data = dict(_version=self.FILE_VERSION,
|
||||||
|
groups=groups,
|
||||||
tracked=[x.key for x in Permissions.all()])
|
tracked=[x.key for x in Permissions.all()])
|
||||||
|
|
||||||
with atomic_write(self._groupfile, mode='wt', permissions=0o600, max_permissions=0o666) as f:
|
with atomic_write(self._groupfile, mode='wt', permissions=0o600, max_permissions=0o666) as f:
|
||||||
|
|||||||
@@ -298,12 +298,14 @@ class Permissions(with_metaclass(PermissionsMetaClass)):
|
|||||||
dangerous=True)
|
dangerous=True)
|
||||||
|
|
||||||
FILES_LIST = OctoPrintPermission("File List",
|
FILES_LIST = OctoPrintPermission("File List",
|
||||||
gettext("Allows to retrieve a list of all uploaded files, including"
|
gettext("Allows to retrieve a list of all uploaded files and folders, including"
|
||||||
"their metadata (e.g. date, file size, analysis results, ...)"),
|
"their metadata (e.g. date, file size, analysis results, ...)"),
|
||||||
RoleNeed("files_list"),
|
RoleNeed("files_list"),
|
||||||
default_groups=[USER_GROUP, READONLY_GROUP])
|
default_groups=[USER_GROUP, READONLY_GROUP])
|
||||||
FILES_UPLOAD = OctoPrintPermission("File Upload",
|
FILES_UPLOAD = OctoPrintPermission("File Upload",
|
||||||
gettext("Allows users to upload new files"),
|
gettext("Allows users to upload new files, create new folders and copy existing ones. If "
|
||||||
|
"the File Delete permission is also set, File Upload also allows "
|
||||||
|
"moving files and folders."),
|
||||||
RoleNeed("files_upload"),
|
RoleNeed("files_upload"),
|
||||||
default_groups=[USER_GROUP])
|
default_groups=[USER_GROUP])
|
||||||
FILES_DOWNLOAD = OctoPrintPermission("File Download",
|
FILES_DOWNLOAD = OctoPrintPermission("File Download",
|
||||||
@@ -312,7 +314,8 @@ class Permissions(with_metaclass(PermissionsMetaClass)):
|
|||||||
RoleNeed("files_download"),
|
RoleNeed("files_download"),
|
||||||
default_groups=[USER_GROUP, READONLY_GROUP])
|
default_groups=[USER_GROUP, READONLY_GROUP])
|
||||||
FILES_DELETE = OctoPrintPermission("File Delete",
|
FILES_DELETE = OctoPrintPermission("File Delete",
|
||||||
gettext("Allows users to delete files"),
|
gettext("Allows users to delete files and folders. If the File Upload permission is "
|
||||||
|
"also set, File Delete also allows moving files and folders."),
|
||||||
RoleNeed("files_delete"),
|
RoleNeed("files_delete"),
|
||||||
default_groups=[USER_GROUP])
|
default_groups=[USER_GROUP])
|
||||||
FILES_SELECT = OctoPrintPermission("File Select",
|
FILES_SELECT = OctoPrintPermission("File Select",
|
||||||
|
|||||||
@@ -240,6 +240,13 @@ class UserManager(GroupChangeListener, object):
|
|||||||
del self._session_users_by_session[session]
|
del self._session_users_by_session[session]
|
||||||
del self._sessionids_by_userid[username]
|
del self._sessionids_by_userid[username]
|
||||||
|
|
||||||
|
def validate_user_session(self, userid, session):
|
||||||
|
if session in self._session_users_by_session:
|
||||||
|
user = self._session_users_by_session[session]
|
||||||
|
return userid == user.get_id()
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def find_user(self, userid=None, session=None):
|
def find_user(self, userid=None, session=None):
|
||||||
if session is not None and session in self._session_users_by_session:
|
if session is not None and session in self._session_users_by_session:
|
||||||
user = self._session_users_by_session[session]
|
user = self._session_users_by_session[session]
|
||||||
@@ -474,14 +481,19 @@ class FilebasedUserManager(UserManager):
|
|||||||
self._customized = True
|
self._customized = True
|
||||||
with io.open(self._userfile, 'rt', encoding='utf-8') as f:
|
with io.open(self._userfile, 'rt', encoding='utf-8') as f:
|
||||||
data = yaml.safe_load(f)
|
data = yaml.safe_load(f)
|
||||||
|
|
||||||
for name, attributes in data.items():
|
for name, attributes in data.items():
|
||||||
|
if not isinstance(attributes, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
permissions = []
|
permissions = []
|
||||||
if "permissions" in attributes:
|
if "permissions" in attributes:
|
||||||
permissions = attributes["permissions"]
|
permissions = attributes["permissions"]
|
||||||
|
|
||||||
groups = {self._group_manager.user_group} # the user group is mandatory for all logged in users
|
|
||||||
if "groups" in attributes:
|
if "groups" in attributes:
|
||||||
groups |= set(attributes["groups"])
|
groups = set(attributes["groups"])
|
||||||
|
else:
|
||||||
|
groups = {self._group_manager.user_group}
|
||||||
|
|
||||||
# migrate from roles to permissions
|
# migrate from roles to permissions
|
||||||
if "roles" in attributes and not "permissions" in attributes:
|
if "roles" in attributes and not "permissions" in attributes:
|
||||||
|
|||||||
@@ -8,8 +8,34 @@ __copyright__ = "Copyright (C) 2015 The OctoPrint Project - Released under terms
|
|||||||
import click
|
import click
|
||||||
click.disable_unicode_literals_warning = True
|
click.disable_unicode_literals_warning = True
|
||||||
import logging
|
import logging
|
||||||
|
import logging.config
|
||||||
|
|
||||||
from octoprint.cli import pass_octoprint_ctx, OctoPrintContext, get_ctx_obj_option
|
from octoprint.cli import pass_octoprint_ctx, OctoPrintContext, get_ctx_obj_option
|
||||||
|
from octoprint.util import dict_merge
|
||||||
|
|
||||||
|
LOGGING_CONFIG = {
|
||||||
|
"version": 1,
|
||||||
|
"formatters": {
|
||||||
|
"brief": {
|
||||||
|
"format": "%(message)s"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"handlers": {
|
||||||
|
"console": {
|
||||||
|
"class": "logging.StreamHandler",
|
||||||
|
"formatter": "brief",
|
||||||
|
"stream": "ext://sys.stdout"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"loggers": {
|
||||||
|
"octoprint.plugin.core": {
|
||||||
|
"level": logging.ERROR
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"level": logging.WARNING
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#~~ "octoprint plugin:command" commands
|
#~~ "octoprint plugin:command" commands
|
||||||
|
|
||||||
@@ -48,6 +74,9 @@ class OctoPrintPluginCommands(click.MultiCommand):
|
|||||||
if ctx.obj is None:
|
if ctx.obj is None:
|
||||||
ctx.obj = OctoPrintContext()
|
ctx.obj = OctoPrintContext()
|
||||||
|
|
||||||
|
logging_config = dict_merge(LOGGING_CONFIG, dict(root=dict(level=logging.DEBUG if ctx.obj.verbosity > 0 else logging.WARNING)))
|
||||||
|
logging.config.dictConfig(logging_config)
|
||||||
|
|
||||||
# initialize settings and plugin manager based on provided
|
# initialize settings and plugin manager based on provided
|
||||||
# context (basedir and configfile)
|
# context (basedir and configfile)
|
||||||
from octoprint import init_settings, init_pluginsystem, FatalStartupError
|
from octoprint import init_settings, init_pluginsystem, FatalStartupError
|
||||||
@@ -63,8 +92,6 @@ class OctoPrintPluginCommands(click.MultiCommand):
|
|||||||
# fetch registered hooks
|
# fetch registered hooks
|
||||||
self.hooks = self.plugin_manager.get_hooks("octoprint.cli.commands")
|
self.hooks = self.plugin_manager.get_hooks("octoprint.cli.commands")
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG if ctx.obj.verbosity > 0 else logging.WARN)
|
|
||||||
|
|
||||||
self._initialized = True
|
self._initialized = True
|
||||||
|
|
||||||
def list_commands(self, ctx):
|
def list_commands(self, ctx):
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ def run_server(basedir, configfile, host, port, v6_only, debug, allow_root, logg
|
|||||||
from octoprint import urllib3_ssl
|
from octoprint import urllib3_ssl
|
||||||
if not urllib3_ssl:
|
if not urllib3_ssl:
|
||||||
logging.getLogger("octoprint.server")\
|
logging.getLogger("octoprint.server")\
|
||||||
.warn("requests/urllib3 will run in an insecure SSL environment. "
|
.warning("requests/urllib3 will run in an insecure SSL environment. "
|
||||||
"You might see corresponding warnings logged later "
|
"You might see corresponding warnings logged later "
|
||||||
"(\"InsecurePlatformWarning\"). It is recommended to either "
|
"(\"InsecurePlatformWarning\"). It is recommended to either "
|
||||||
"update to a Python version >= 2.7.9 or alternatively "
|
"update to a Python version >= 2.7.9 or alternatively "
|
||||||
"install PyOpenSSL plus its dependencies. For details see "
|
"install PyOpenSSL plus its dependencies. For details see "
|
||||||
"https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl")
|
"https://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl")
|
||||||
logger.info(get_divider_line("*"))
|
logger.info(get_divider_line("*"))
|
||||||
|
|
||||||
def log_register_rollover(safe_mode=None, plugin_manager=None, environment_detector=None, **kwargs):
|
def log_register_rollover(safe_mode=None, plugin_manager=None, environment_detector=None, **kwargs):
|
||||||
|
|||||||
@@ -675,6 +675,9 @@ class FileManager(object):
|
|||||||
self._logger.exception("Could not read recovery data from file {}".format(self._recovery_file))
|
self._logger.exception("Could not read recovery data from file {}".format(self._recovery_file))
|
||||||
self.delete_recovery_data()
|
self.delete_recovery_data()
|
||||||
|
|
||||||
|
def get_additional_metadata(self, destination, path, key):
|
||||||
|
self._storage(destination).get_additional_metadata(path, key)
|
||||||
|
|
||||||
def set_additional_metadata(self, destination, path, key, data, overwrite=False, merge=False):
|
def set_additional_metadata(self, destination, path, key, data, overwrite=False, merge=False):
|
||||||
self._storage(destination).set_additional_metadata(path, key, data, overwrite=overwrite, merge=merge)
|
self._storage(destination).set_additional_metadata(path, key, data, overwrite=overwrite, merge=merge)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ import time
|
|||||||
from octoprint.events import Events, eventManager
|
from octoprint.events import Events, eventManager
|
||||||
from octoprint.settings import settings
|
from octoprint.settings import settings
|
||||||
from octoprint.util import monotonic_time
|
from octoprint.util import monotonic_time
|
||||||
from octoprint.util import get_fully_qualified_classname as fqcn
|
from octoprint.util import get_fully_qualified_classname as fqcn, dict_merge
|
||||||
|
from octoprint.util.platform import CLOSE_FDS
|
||||||
|
|
||||||
|
|
||||||
class QueueEntry(collections.namedtuple("QueueEntry", "name, path, type, location, absolute_path, printer_profile, analysis")):
|
class QueueEntry(collections.namedtuple("QueueEntry", "name, path, type, location, absolute_path, printer_profile, analysis")):
|
||||||
@@ -345,8 +346,12 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
|
|||||||
import sys
|
import sys
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
if self._current.analysis:
|
if self._current.analysis and all(map(lambda x: x in self._current.analysis, ("printingArea",
|
||||||
|
"dimensions",
|
||||||
|
"estimatedPrintTime",
|
||||||
|
"filament"))):
|
||||||
return self._current.analysis
|
return self._current.analysis
|
||||||
|
|
||||||
try:
|
try:
|
||||||
throttle = settings().getFloat(["gcodeAnalysis", "throttle_highprio"]) if high_priority \
|
throttle = settings().getFloat(["gcodeAnalysis", "throttle_highprio"]) if high_priority \
|
||||||
else settings().getFloat(["gcodeAnalysis", "throttle_normalprio"])
|
else settings().getFloat(["gcodeAnalysis", "throttle_normalprio"])
|
||||||
@@ -370,7 +375,7 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
|
|||||||
self._logger.info("Invoking analysis command: {}".format(" ".join(command)))
|
self._logger.info("Invoking analysis command: {}".format(" ".join(command)))
|
||||||
|
|
||||||
self._aborted = False
|
self._aborted = False
|
||||||
p = sarge.run(command, async_=True, stdout=sarge.Capture())
|
p = sarge.run(command, close_fds=CLOSE_FDS, async_=True, stdout=sarge.Capture())
|
||||||
|
|
||||||
while len(p.commands) == 0:
|
while len(p.commands) == 0:
|
||||||
# somewhat ugly... we can't use wait_events because
|
# somewhat ugly... we can't use wait_events because
|
||||||
@@ -421,7 +426,11 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue):
|
|||||||
"length": analysis["extrusion_length"][i],
|
"length": analysis["extrusion_length"][i],
|
||||||
"volume": analysis["extrusion_volume"][i]
|
"volume": analysis["extrusion_volume"][i]
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
|
if self._current.analysis and isinstance(self._current.analysis, dict):
|
||||||
|
return dict_merge(result, self._current.analysis)
|
||||||
|
else:
|
||||||
|
return result
|
||||||
finally:
|
finally:
|
||||||
self._gcode = None
|
self._gcode = None
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from contextlib import contextmanager
|
|||||||
from past.builtins import basestring
|
from past.builtins import basestring
|
||||||
|
|
||||||
from emoji import demojize
|
from emoji import demojize
|
||||||
from slugify import Slugify
|
from octoprint.vendor.awesome_slugify import Slugify
|
||||||
|
|
||||||
import octoprint.filemanager
|
import octoprint.filemanager
|
||||||
|
|
||||||
@@ -307,6 +307,15 @@ class StorageInterface(object):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def get_additional_metadata(self, path, key):
|
||||||
|
"""
|
||||||
|
Fetches additional metadata at ``key`` from the metadata of ``path``.
|
||||||
|
|
||||||
|
:param path: the virtual path to the file for which to fetch additional metadata
|
||||||
|
:param key: key of metadata to fetch
|
||||||
|
"""
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
def set_additional_metadata(self, path, key, data, overwrite=False, merge=False):
|
def set_additional_metadata(self, path, key, data, overwrite=False, merge=False):
|
||||||
"""
|
"""
|
||||||
Adds additional metadata to the metadata of ``path``. Metadata in ``data`` will be saved under ``key``.
|
Adds additional metadata to the metadata of ``path``. Metadata in ``data`` will be saved under ``key``.
|
||||||
@@ -488,7 +497,7 @@ class LocalFileStorage(StorageInterface):
|
|||||||
self._persisted_metadata_lock_mutex = threading.RLock()
|
self._persisted_metadata_lock_mutex = threading.RLock()
|
||||||
self._persisted_metadata_locks = dict()
|
self._persisted_metadata_locks = dict()
|
||||||
|
|
||||||
self._metadata_cache = pylru.lrucache(10)
|
self._metadata_cache = pylru.lrucache(100)
|
||||||
|
|
||||||
self._old_metadata = None
|
self._old_metadata = None
|
||||||
self._initialize_metadata()
|
self._initialize_metadata()
|
||||||
@@ -877,6 +886,15 @@ class LocalFileStorage(StorageInterface):
|
|||||||
path, name = self.sanitize(path)
|
path, name = self.sanitize(path)
|
||||||
self._delete_history(name, path, index)
|
self._delete_history(name, path, index)
|
||||||
|
|
||||||
|
def get_additional_metadata(self, path, key):
|
||||||
|
path, name = self.sanitize(path)
|
||||||
|
metadata = self._get_metadata(path)
|
||||||
|
|
||||||
|
if not name in metadata:
|
||||||
|
return
|
||||||
|
|
||||||
|
return metadata[name].get(key)
|
||||||
|
|
||||||
def set_additional_metadata(self, path, key, data, overwrite=False, merge=False):
|
def set_additional_metadata(self, path, key, data, overwrite=False, merge=False):
|
||||||
path, name = self.sanitize(path)
|
path, name = self.sanitize(path)
|
||||||
metadata = self._get_metadata(path)
|
metadata = self._get_metadata(path)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class StreamWrapper(AbstractFileWrapper):
|
|||||||
A wrapper allowing processing of one or more consecutive streams.
|
A wrapper allowing processing of one or more consecutive streams.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
*streams (io.IOBase): One or more streams to process one after another to save to storage.
|
*streams: One or more :py:`io.IOBase` streams to process one after another to save to storage.
|
||||||
"""
|
"""
|
||||||
def __init__(self, filename, *streams):
|
def __init__(self, filename, *streams):
|
||||||
if not len(streams) > 0:
|
if not len(streams) > 0:
|
||||||
@@ -88,7 +88,7 @@ class StreamWrapper(AbstractFileWrapper):
|
|||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
with atomic_write(path, mode='wb') as dest:
|
with atomic_write(path, mode='wb') as dest:
|
||||||
with self.stream() as source:
|
for source in self.streams:
|
||||||
shutil.copyfileobj(source, dest)
|
shutil.copyfileobj(source, dest)
|
||||||
|
|
||||||
def stream(self):
|
def stream(self):
|
||||||
@@ -107,7 +107,7 @@ class MultiStream(io.RawIOBase):
|
|||||||
their contents in the order they are provided to the constructor.
|
their contents in the order they are provided to the constructor.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
*streams (io.RawIOBase): One or more streams to concatenate.
|
*streams: One or more :py:`io.IOBase` streams to concatenate.
|
||||||
"""
|
"""
|
||||||
def __init__(self, *streams):
|
def __init__(self, *streams):
|
||||||
io.RawIOBase.__init__(self)
|
io.RawIOBase.__init__(self)
|
||||||
@@ -170,31 +170,32 @@ class LineProcessorStream(io.RawIOBase):
|
|||||||
def __init__(self, input_stream):
|
def __init__(self, input_stream):
|
||||||
io.RawIOBase.__init__(self)
|
io.RawIOBase.__init__(self)
|
||||||
self.input_stream = io.BufferedReader(input_stream)
|
self.input_stream = io.BufferedReader(input_stream)
|
||||||
self.leftover = None
|
self.leftover = bytearray()
|
||||||
|
|
||||||
def read(self, n=-1):
|
def read(self, n=-1):
|
||||||
if n == 0:
|
if n == 0:
|
||||||
return b''
|
return b''
|
||||||
|
|
||||||
result = b''
|
result = bytearray()
|
||||||
while len(result) < n or n == -1:
|
while len(result) < n or n == -1:
|
||||||
|
# add left over from previous loop
|
||||||
bytes_left = (n - len(result)) if n != -1 else -1
|
bytes_left = (n - len(result)) if n != -1 else -1
|
||||||
if self.leftover is not None:
|
if bytes_left != -1 and bytes_left < len(self.leftover):
|
||||||
if bytes_left != -1 and bytes_left < len(self.leftover):
|
# only s
|
||||||
result += self.leftover[:bytes_left]
|
result += self.leftover[:bytes_left]
|
||||||
self.leftover = self.leftover[bytes_left:]
|
self.leftover = self.leftover[bytes_left:]
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
result += self.leftover
|
result += self.leftover
|
||||||
self.leftover = None
|
self.leftover = bytearray()
|
||||||
|
|
||||||
|
# read one line from the underlying stream
|
||||||
processed_line = None
|
processed_line = None
|
||||||
while processed_line is None:
|
while processed_line is None:
|
||||||
line = self.input_stream.readline()
|
line = self.input_stream.readline()
|
||||||
if not line:
|
if not line:
|
||||||
break
|
break
|
||||||
processed_line = self.process_line(line)
|
processed_line = self.process_line(line)
|
||||||
|
|
||||||
if processed_line is None:
|
if processed_line is None:
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -206,7 +207,7 @@ class LineProcessorStream(io.RawIOBase):
|
|||||||
else:
|
else:
|
||||||
result += processed_line
|
result += processed_line
|
||||||
|
|
||||||
return result
|
return bytes(result)
|
||||||
|
|
||||||
def readinto(self, b):
|
def readinto(self, b):
|
||||||
n = len(b)
|
n = len(b)
|
||||||
|
|||||||
@@ -20,8 +20,11 @@ def log_to_handler(logger, handler, level, msg, exc_info=None, extra=None, *args
|
|||||||
extra: optional extra data
|
extra: optional extra data
|
||||||
*args: log args
|
*args: log args
|
||||||
"""
|
"""
|
||||||
from logging import _srcfile
|
|
||||||
import sys
|
import sys
|
||||||
|
try:
|
||||||
|
from logging import _srcfile
|
||||||
|
except ImportError:
|
||||||
|
_srcfile = None
|
||||||
|
|
||||||
# this is just the same as logging.Logger._log
|
# this is just the same as logging.Logger._log
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ class AsyncLogHandlerMixin(logging.Handler):
|
|||||||
super(AsyncLogHandlerMixin, self).__init__(*args, **kwargs)
|
super(AsyncLogHandlerMixin, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
|
if getattr(self._executor, "_shutdown", False):
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._executor.submit(self._emit, record)
|
self._executor.submit(self._emit, record)
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -25,6 +28,10 @@ class AsyncLogHandlerMixin(logging.Handler):
|
|||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
super(AsyncLogHandlerMixin, self).emit(record)
|
super(AsyncLogHandlerMixin, self).emit(record)
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self._executor.shutdown(wait=True)
|
||||||
|
super(AsyncLogHandlerMixin, self).close()
|
||||||
|
|
||||||
|
|
||||||
class CleaningTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler):
|
class CleaningTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler):
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ def _validate_plugin(phase, plugin_info):
|
|||||||
|
|
||||||
def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_entry_points=None, plugin_disabled_list=None,
|
def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_entry_points=None, plugin_disabled_list=None,
|
||||||
plugin_blacklist=None, plugin_restart_needing_hooks=None, plugin_obsolete_hooks=None,
|
plugin_blacklist=None, plugin_restart_needing_hooks=None, plugin_obsolete_hooks=None,
|
||||||
plugin_validators=None, compatibility_ignored_list=None):
|
plugin_considered_bundled=None, plugin_validators=None, compatibility_ignored_list=None):
|
||||||
"""
|
"""
|
||||||
Factory method for initially constructing and consecutively retrieving the :class:`~octoprint.plugin.core.PluginManager`
|
Factory method for initially constructing and consecutively retrieving the :class:`~octoprint.plugin.core.PluginManager`
|
||||||
singleton.
|
singleton.
|
||||||
@@ -63,6 +63,8 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
|
|||||||
to logging handlers
|
to logging handlers
|
||||||
plugin_obsolete_hooks (list): A list of hooks that have been declared obsolete. Plugins implementing them will
|
plugin_obsolete_hooks (list): A list of hooks that have been declared obsolete. Plugins implementing them will
|
||||||
not be enabled since they might depend on functionality that is no longer available.
|
not be enabled since they might depend on functionality that is no longer available.
|
||||||
|
plugin_considered_bundled (list): A list of plugin identifiers that are considered bundled plugins even if
|
||||||
|
installed separately.
|
||||||
plugin_validators (list): A list of additional plugin validators through which to process each plugin.
|
plugin_validators (list): A list of additional plugin validators through which to process each plugin.
|
||||||
compatibility_ignored_list (list): A list of plugin keys for which it will be ignored if they are flagged as
|
compatibility_ignored_list (list): A list of plugin keys for which it will be ignored if they are flagged as
|
||||||
incompatible. This is for development purposes only and should not be used in production.
|
incompatible. This is for development purposes only and should not be used in production.
|
||||||
@@ -95,6 +97,9 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
|
|||||||
if plugin_obsolete_hooks is None:
|
if plugin_obsolete_hooks is None:
|
||||||
plugin_obsolete_hooks = ["octoprint.comm.protocol.gcode"]
|
plugin_obsolete_hooks = ["octoprint.comm.protocol.gcode"]
|
||||||
|
|
||||||
|
if plugin_considered_bundled is None:
|
||||||
|
plugin_considered_bundled = ["firmware_check", "file_check"]
|
||||||
|
|
||||||
if plugin_validators is None:
|
if plugin_validators is None:
|
||||||
plugin_validators = [_validate_plugin]
|
plugin_validators = [_validate_plugin]
|
||||||
else:
|
else:
|
||||||
@@ -108,6 +113,7 @@ def plugin_manager(init=False, plugin_folders=None, plugin_bases=None, plugin_en
|
|||||||
plugin_blacklist=plugin_blacklist,
|
plugin_blacklist=plugin_blacklist,
|
||||||
plugin_restart_needing_hooks=plugin_restart_needing_hooks,
|
plugin_restart_needing_hooks=plugin_restart_needing_hooks,
|
||||||
plugin_obsolete_hooks=plugin_obsolete_hooks,
|
plugin_obsolete_hooks=plugin_obsolete_hooks,
|
||||||
|
plugin_considered_bundled=plugin_considered_bundled,
|
||||||
plugin_validators=plugin_validators,
|
plugin_validators=plugin_validators,
|
||||||
compatibility_ignored_list=compatibility_ignored_list)
|
compatibility_ignored_list=compatibility_ignored_list)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -119,21 +119,21 @@ class PluginInfo(object):
|
|||||||
""" Module attribute from which to retrieve the plugin's license. """
|
""" Module attribute from which to retrieve the plugin's license. """
|
||||||
|
|
||||||
attr_pythoncompat = '__plugin_pythoncompat__'
|
attr_pythoncompat = '__plugin_pythoncompat__'
|
||||||
"""
|
"""
|
||||||
Module attribute from which to retrieve the plugin's python compatibility string.
|
Module attribute from which to retrieve the plugin's python compatibility string.
|
||||||
|
|
||||||
If unset a default of ``>=2.7,<3`` will be assumed, meaning that the plugin will be considered compatible to
|
If unset a default of ``>=2.7,<3`` will be assumed, meaning that the plugin will be considered compatible to
|
||||||
Python 2 but not Python 3.
|
Python 2 but not Python 3.
|
||||||
|
|
||||||
To mark a plugin as Python 3 compatible, a string of ``>=2.7,<4`` is recommended.
|
To mark a plugin as Python 3 compatible, a string of ``>=2.7,<4`` is recommended.
|
||||||
|
|
||||||
Bundled plugins will automatically be assumed to be compatible.
|
Bundled plugins will automatically be assumed to be compatible.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
attr_hidden = '__plugin_hidden__'
|
attr_hidden = '__plugin_hidden__'
|
||||||
"""
|
"""
|
||||||
Module attribute from which to determine if the plugin's hidden or not.
|
Module attribute from which to determine if the plugin's hidden or not.
|
||||||
|
|
||||||
Only evaluated for bundled plugins, in order to hide them from the Plugin Manager
|
Only evaluated for bundled plugins, in order to hide them from the Plugin Manager
|
||||||
and similar places.
|
and similar places.
|
||||||
"""
|
"""
|
||||||
@@ -649,7 +649,8 @@ class PluginManager(object):
|
|||||||
|
|
||||||
def __init__(self, plugin_folders, plugin_bases, plugin_entry_points, logging_prefix=None,
|
def __init__(self, plugin_folders, plugin_bases, plugin_entry_points, logging_prefix=None,
|
||||||
plugin_disabled_list=None, plugin_blacklist=None, plugin_restart_needing_hooks=None,
|
plugin_disabled_list=None, plugin_blacklist=None, plugin_restart_needing_hooks=None,
|
||||||
plugin_obsolete_hooks=None, plugin_validators=None, compatibility_ignored_list=None):
|
plugin_obsolete_hooks=None, plugin_considered_bundled=None, plugin_validators=None,
|
||||||
|
compatibility_ignored_list=None):
|
||||||
self.logger = logging.getLogger(__name__)
|
self.logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
if logging_prefix is None:
|
if logging_prefix is None:
|
||||||
@@ -666,6 +667,8 @@ class PluginManager(object):
|
|||||||
plugin_blacklist = []
|
plugin_blacklist = []
|
||||||
if compatibility_ignored_list is None:
|
if compatibility_ignored_list is None:
|
||||||
compatibility_ignored_list = []
|
compatibility_ignored_list = []
|
||||||
|
if plugin_considered_bundled is None:
|
||||||
|
plugin_considered_bundled = []
|
||||||
|
|
||||||
self.plugin_folders = plugin_folders
|
self.plugin_folders = plugin_folders
|
||||||
self.plugin_bases = plugin_bases
|
self.plugin_bases = plugin_bases
|
||||||
@@ -677,6 +680,7 @@ class PluginManager(object):
|
|||||||
self.plugin_validators = plugin_validators
|
self.plugin_validators = plugin_validators
|
||||||
self.logging_prefix = logging_prefix
|
self.logging_prefix = logging_prefix
|
||||||
self.compatibility_ignored_list = compatibility_ignored_list
|
self.compatibility_ignored_list = compatibility_ignored_list
|
||||||
|
self.plugin_considered_bundled = plugin_considered_bundled
|
||||||
|
|
||||||
self.enabled_plugins = dict()
|
self.enabled_plugins = dict()
|
||||||
self.disabled_plugins = dict()
|
self.disabled_plugins = dict()
|
||||||
@@ -878,7 +882,8 @@ class PluginManager(object):
|
|||||||
# plugin is already defined or marked as uninstalled, ignore it
|
# plugin is already defined or marked as uninstalled, ignore it
|
||||||
continue
|
continue
|
||||||
|
|
||||||
kwargs = dict(module_name=module_name, version=version)
|
bundled = key in self.plugin_considered_bundled
|
||||||
|
kwargs = dict(module_name=module_name, version=version, bundled=bundled)
|
||||||
package_name = entry_point.dist.project_name
|
package_name = entry_point.dist.project_name
|
||||||
try:
|
try:
|
||||||
entry_point_metadata = EntryPointMetadata(entry_point)
|
entry_point_metadata = EntryPointMetadata(entry_point)
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||||
|
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
import octoprint.plugin
|
||||||
|
|
||||||
|
from octoprint.access import USER_GROUP
|
||||||
|
from octoprint.access.permissions import Permissions
|
||||||
|
from octoprint.events import Events
|
||||||
|
|
||||||
|
import flask
|
||||||
|
from flask_babel import gettext
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
class ActionCommandNotificationPlugin(octoprint.plugin.AssetPlugin,
|
||||||
|
octoprint.plugin.SettingsPlugin,
|
||||||
|
octoprint.plugin.SimpleApiPlugin,
|
||||||
|
octoprint.plugin.TemplatePlugin,
|
||||||
|
octoprint.plugin.EventHandlerPlugin):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._notifications = []
|
||||||
|
|
||||||
|
# Additional permissions hook
|
||||||
|
|
||||||
|
def get_additional_permissions(self):
|
||||||
|
return [
|
||||||
|
dict(key="SHOW",
|
||||||
|
name="Show printer notifications",
|
||||||
|
description=gettext("Allows to see printer notifications"),
|
||||||
|
default_groups=[USER_GROUP],
|
||||||
|
roles=["show"]),
|
||||||
|
dict(key="CLEAR",
|
||||||
|
name="Clear printer notifications",
|
||||||
|
description=gettext("Allows to clear printer notifications"),
|
||||||
|
default_groups=[USER_GROUP],
|
||||||
|
roles=["clear"])
|
||||||
|
]
|
||||||
|
|
||||||
|
#~ AssetPlugin
|
||||||
|
|
||||||
|
def get_assets(self):
|
||||||
|
return dict(js=["js/action_command_notification.js"],
|
||||||
|
clientjs=["clientjs/action_command_notification.js"],
|
||||||
|
css=["css/action_command_notification.css"])
|
||||||
|
|
||||||
|
#~ EventHandlerPlugin
|
||||||
|
|
||||||
|
def on_event(self, event, payload):
|
||||||
|
if event == Events.DISCONNECTED:
|
||||||
|
self._clear_notifications()
|
||||||
|
|
||||||
|
#~ SettingsPlugin
|
||||||
|
|
||||||
|
def get_settings_defaults(self):
|
||||||
|
return dict(enable=True,
|
||||||
|
enable_popups=False)
|
||||||
|
|
||||||
|
#~ SimpleApiPlugin
|
||||||
|
|
||||||
|
def on_api_get(self, request):
|
||||||
|
if not Permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW.can():
|
||||||
|
return flask.abort(403, "Insufficient permissions")
|
||||||
|
return flask.jsonify(notifications=[dict(timestamp=notification[0],
|
||||||
|
message=notification[1]) for notification in self._notifications])
|
||||||
|
|
||||||
|
def get_api_commands(self):
|
||||||
|
return dict(clear=[])
|
||||||
|
|
||||||
|
def on_api_command(self, command, data):
|
||||||
|
if command == "clear":
|
||||||
|
if not Permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR.can():
|
||||||
|
return flask.abort(403, "Insufficient permissions")
|
||||||
|
self._clear_notifications()
|
||||||
|
|
||||||
|
#~ TemplatePlugin
|
||||||
|
|
||||||
|
def get_template_configs(self):
|
||||||
|
return [
|
||||||
|
dict(type="settings",
|
||||||
|
name=gettext("Printer Notifications"),
|
||||||
|
custom_bindings=False),
|
||||||
|
dict(type="sidebar",
|
||||||
|
name=gettext("Printer Notifications"),
|
||||||
|
icon="bell-o",
|
||||||
|
styles_wrapper=["display: none"],
|
||||||
|
data_bind="visible: loginState.hasPermissionKo(access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW)"
|
||||||
|
" && settings.settings.plugins.action_command_notification.enable()")
|
||||||
|
]
|
||||||
|
|
||||||
|
#~ action command handler
|
||||||
|
|
||||||
|
def action_command_handler(self, comm, line, action, *args, **kwargs):
|
||||||
|
if not self._settings.get_boolean(["enable"]):
|
||||||
|
return
|
||||||
|
|
||||||
|
parts = action.split(None, 1)
|
||||||
|
if len(parts) == 1:
|
||||||
|
action = parts[0]
|
||||||
|
parameter = ""
|
||||||
|
else:
|
||||||
|
action, parameter = parts
|
||||||
|
|
||||||
|
if action != "notification":
|
||||||
|
return
|
||||||
|
|
||||||
|
message = parameter.strip()
|
||||||
|
self._notifications.append((time.time(), message))
|
||||||
|
self._plugin_manager.send_plugin_message(self._identifier, dict(message=message))
|
||||||
|
|
||||||
|
self._logger.info("Got a notification: {}".format(message))
|
||||||
|
|
||||||
|
def _clear_notifications(self):
|
||||||
|
self._notifications = []
|
||||||
|
self._plugin_manager.send_plugin_message(self._identifier, dict())
|
||||||
|
self._logger.info("Notifications cleared")
|
||||||
|
|
||||||
|
__plugin_name__ = "Action Command Notification Support"
|
||||||
|
__plugin_description__ = "Allows your printer to trigger notifications via action commands on the connection"
|
||||||
|
__plugin_author__ = "Gina Häußge"
|
||||||
|
__plugin_disabling_discouraged__ = gettext("Without this plugin your printer will no longer be able to trigger"
|
||||||
|
" notifications in OctoPrint")
|
||||||
|
__plugin_license__ = "AGPLv3"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
|
__plugin_implementation__ = ActionCommandNotificationPlugin()
|
||||||
|
__plugin_hooks__ = {
|
||||||
|
"octoprint.comm.protocol.action": __plugin_implementation__.action_command_handler,
|
||||||
|
"octoprint.access.permissions": __plugin_implementation__.get_additional_permissions
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
(function (global, factory) {
|
||||||
|
if (typeof define === "function" && define.amd) {
|
||||||
|
define(["OctoPrintClient"], factory);
|
||||||
|
} else {
|
||||||
|
factory(global.OctoPrintClient);
|
||||||
|
}
|
||||||
|
})(this, function(OctoPrintClient) {
|
||||||
|
var OctoPrintActionCommandNotificationClient = function(base) {
|
||||||
|
this.base = base;
|
||||||
|
};
|
||||||
|
|
||||||
|
OctoPrintActionCommandNotificationClient.prototype.get = function(refresh, opts) {
|
||||||
|
return this.base.get(this.base.getSimpleApiUrl("action_command_notification"), opts);
|
||||||
|
};
|
||||||
|
|
||||||
|
OctoPrintActionCommandNotificationClient.prototype.clear = function(opts) {
|
||||||
|
return this.base.simpleApiCommand("action_command_notification", "clear", {}, opts);
|
||||||
|
};
|
||||||
|
|
||||||
|
OctoPrintClient.registerPluginComponent("action_command_notification", OctoPrintActionCommandNotificationClient);
|
||||||
|
return OctoPrintActionCommandNotificationClient;
|
||||||
|
});
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
.sidebar_plugin_action_command_notification_entry {
|
||||||
|
padding: 5px;
|
||||||
|
line-height: 20px;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
}
|
||||||
+65
@@ -0,0 +1,65 @@
|
|||||||
|
$(function() {
|
||||||
|
function ActionCommandNotificationViewModel(parameters) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.loginState = parameters[0];
|
||||||
|
self.access = parameters[1];
|
||||||
|
self.settings = parameters[2];
|
||||||
|
|
||||||
|
self.notifications = ko.observableArray([]);
|
||||||
|
|
||||||
|
self.toDateTimeString = function(timestamp) {
|
||||||
|
return formatDate(timestamp);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.requestData = function() {
|
||||||
|
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW)) return;
|
||||||
|
|
||||||
|
OctoPrint.plugins.action_command_notification.get()
|
||||||
|
.done(self.fromResponse)
|
||||||
|
};
|
||||||
|
|
||||||
|
self.fromResponse = function(response) {
|
||||||
|
self.notifications(response.notifications);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.clear = function() {
|
||||||
|
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR)) return;
|
||||||
|
|
||||||
|
OctoPrint.plugins.action_command_notification.clear();
|
||||||
|
};
|
||||||
|
|
||||||
|
self.onStartup = self.onUserLoggedIn = self.onUserLoggedOut = function() {
|
||||||
|
self.requestData();
|
||||||
|
};
|
||||||
|
|
||||||
|
self.onDataUpdaterPluginMessage = function(plugin, data) {
|
||||||
|
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_SHOW)) return;
|
||||||
|
if (plugin !== "action_command_notification") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.requestData();
|
||||||
|
|
||||||
|
if (data.message && self.settings.settings.plugins.action_command_notification.enable_popups()) {
|
||||||
|
new PNotify({
|
||||||
|
title: gettext("Printer Notification"),
|
||||||
|
text: data.message,
|
||||||
|
hide: false,
|
||||||
|
icon: "fa fa-bell-o",
|
||||||
|
buttons: {
|
||||||
|
sticker: false,
|
||||||
|
closer: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
OCTOPRINT_VIEWMODELS.push({
|
||||||
|
construct: ActionCommandNotificationViewModel,
|
||||||
|
dependencies: ["loginStateViewModel", "accessViewModel", "settingsViewModel"],
|
||||||
|
elements: ["#sidebar_plugin_action_command_notification_wrapper"]
|
||||||
|
});
|
||||||
|
});
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
<h3>{{ _('Action Command Notification Settings') }}</h3>
|
||||||
|
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" data-bind="checked: settings.plugins.action_command_notification.enable"> {{ _('Enable') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" data-bind="checked: settings.plugins.action_command_notification.enable_popups"> {{ _('Enable popups') }}
|
||||||
|
<span class="help-block">{{ _("Check this if you want notifications to also show up as popups in addition to the notification list in the sidebar") }}</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<div style="display: none" data-bind="visible: notifications().length > 0">
|
||||||
|
<div class="scroll-wrapper" data-bind="foreach: notifications">
|
||||||
|
<div class="sidebar_plugin_action_command_notification_entry">
|
||||||
|
<div class="sidebar_plugin_action_command_notification_entry_timestamp"><small class="muted" data-bind="text: $root.toDateTimeString($data.timestamp)"></small></div>
|
||||||
|
<div class="sidebar_plugin_action_command_notification_entry_message" data-bind="text: message"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-block" data-bind="click: clear, visible: loginState.hasPermission(access.permissions.PLUGIN_ACTION_COMMAND_NOTIFICATION_CLEAR)">{{ _('Clear notifications') }}</button>
|
||||||
|
</div>
|
||||||
|
<div style="display: none" data-bind="visible: notifications().length == 0">
|
||||||
|
{{ _('There are currently no notifications from your printer.') }}
|
||||||
|
</div>
|
||||||
@@ -50,8 +50,8 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
|
|||||||
self._prompt = None
|
self._prompt = None
|
||||||
self._enable = "detected"
|
self._enable = "detected"
|
||||||
self._command = None
|
self._command = None
|
||||||
self._enable_emergency_sending = False
|
self._enable_emergency_sending = True
|
||||||
self._enable_signal_support = False
|
self._enable_signal_support = True
|
||||||
self._cap_prompt_support = False
|
self._cap_prompt_support = False
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
@@ -130,7 +130,7 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
|
|||||||
#~ TemplatePlugin
|
#~ TemplatePlugin
|
||||||
|
|
||||||
def get_template_configs(self):
|
def get_template_configs(self):
|
||||||
return [dict(type="settings", name=gettext("Action Command Prompt"), custom_bindings=False)]
|
return [dict(type="settings", name=gettext("Printer Dialogs"), custom_bindings=False)]
|
||||||
|
|
||||||
#~ action command handler
|
#~ action command handler
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin,
|
|||||||
if "{choice}" in self._command:
|
if "{choice}" in self._command:
|
||||||
self._printer.commands([self._command.format(choice=choice)])
|
self._printer.commands([self._command.format(choice=choice)])
|
||||||
else:
|
else:
|
||||||
self._printer.commands(["{command} S{choice}".format(command=self._command,
|
self._printer.commands(["{command} S{choice}".format(command=self._command,
|
||||||
choice=choice)])
|
choice=choice)])
|
||||||
|
|
||||||
|
|
||||||
@@ -233,6 +233,7 @@ __plugin_author__ = "Gina Häußge"
|
|||||||
__plugin_disabling_discouraged__ = gettext("Without this plugin your printer will no longer be able to trigger"
|
__plugin_disabling_discouraged__ = gettext("Without this plugin your printer will no longer be able to trigger"
|
||||||
" confirmation or selection prompts in OctoPrint")
|
" confirmation or selection prompts in OctoPrint")
|
||||||
__plugin_license__ = "AGPLv3"
|
__plugin_license__ = "AGPLv3"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = ActionCommandPromptPlugin()
|
__plugin_implementation__ = ActionCommandPromptPlugin()
|
||||||
__plugin_hooks__ = {
|
__plugin_hooks__ = {
|
||||||
"octoprint.comm.protocol.action": __plugin_implementation__.action_command_handler,
|
"octoprint.comm.protocol.action": __plugin_implementation__.action_command_handler,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class AnnouncementPlugin(octoprint.plugin.AssetPlugin,
|
|||||||
self._cached_channel_configs = None
|
self._cached_channel_configs = None
|
||||||
self._cached_channel_configs_mutex = threading.RLock()
|
self._cached_channel_configs_mutex = threading.RLock()
|
||||||
|
|
||||||
from slugify import Slugify
|
from octoprint.vendor.awesome_slugify import Slugify
|
||||||
self._slugify = Slugify()
|
self._slugify = Slugify()
|
||||||
self._slugify.safe_chars = "-_."
|
self._slugify.safe_chars = "-_."
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ class AnnouncementPlugin(octoprint.plugin.AssetPlugin,
|
|||||||
def get_template_configs(self):
|
def get_template_configs(self):
|
||||||
return [
|
return [
|
||||||
dict(type="settings", name=gettext("Announcements"), template="announcements_settings.jinja2", custom_bindings=True),
|
dict(type="settings", name=gettext("Announcements"), template="announcements_settings.jinja2", custom_bindings=True),
|
||||||
dict(type="navbar", template="announcements_navbar.jinja2", styles=["display: none"], data_bind="visible: loginState.hasPermission(access.permissions.PLUGIN_ANNOUNCEMENTS_ANNOUNCEMENT)")
|
dict(type="navbar", template="announcements_navbar.jinja2", styles=["display: none"], data_bind="visible: loginState.hasPermission(access.permissions.PLUGIN_ANNOUNCEMENTS_READ)")
|
||||||
]
|
]
|
||||||
|
|
||||||
# Blueprint Plugin
|
# Blueprint Plugin
|
||||||
@@ -536,6 +536,7 @@ __plugin_description__ = "Announcements all around OctoPrint"
|
|||||||
__plugin_disabling_discouraged__ = gettext("Without this plugin you might miss important announcements "
|
__plugin_disabling_discouraged__ = gettext("Without this plugin you might miss important announcements "
|
||||||
"regarding security or other critical issues concerning OctoPrint.")
|
"regarding security or other critical issues concerning OctoPrint.")
|
||||||
__plugin_license__ = "AGPLv3"
|
__plugin_license__ = "AGPLv3"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = AnnouncementPlugin()
|
__plugin_implementation__ = AnnouncementPlugin()
|
||||||
|
|
||||||
__plugin_hooks__ = {
|
__plugin_hooks__ = {
|
||||||
|
|||||||
@@ -256,7 +256,12 @@ class AppKeysPlugin(octoprint.plugin.AssetPlugin,
|
|||||||
if not app_name:
|
if not app_name:
|
||||||
return flask.abort(400)
|
return flask.abort(400)
|
||||||
|
|
||||||
self._add_api_key(user_id, app_name.strip())
|
selected_user_id = data.get("user", user_id)
|
||||||
|
if selected_user_id != user_id and not Permissions.PLUGIN_APPKEYS_ADMIN.can():
|
||||||
|
return flask.abort(403)
|
||||||
|
|
||||||
|
key = self._add_api_key(selected_user_id, app_name.strip())
|
||||||
|
return flask.jsonify(user_id=selected_user_id, app_id=app_name, api_key=key)
|
||||||
|
|
||||||
return NO_CONTENT
|
return NO_CONTENT
|
||||||
|
|
||||||
@@ -437,6 +442,8 @@ __plugin_description__ = "Implements a workflow for third party clients to obtai
|
|||||||
__plugin_author__ = "Gina Häußge, Aldo Hoeben"
|
__plugin_author__ = "Gina Häußge, Aldo Hoeben"
|
||||||
__plugin_disabling_discouraged__ = gettext("Without this plugin third party clients will no longer be able to "
|
__plugin_disabling_discouraged__ = gettext("Without this plugin third party clients will no longer be able to "
|
||||||
"obtain an API key without you manually copy-pasting it.")
|
"obtain an API key without you manually copy-pasting it.")
|
||||||
|
__plugin_license__ = "AGPLv3"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = AppKeysPlugin()
|
__plugin_implementation__ = AppKeysPlugin()
|
||||||
__plugin_hooks__ = {
|
__plugin_hooks__ = {
|
||||||
"octoprint.accesscontrol.keyvalidator": __plugin_implementation__.validate_api_key,
|
"octoprint.accesscontrol.keyvalidator": __plugin_implementation__.validate_api_key,
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
return this.base.simpleApiCommand("appkeys", "generate", {"app": app}, opts);
|
return this.base.simpleApiCommand("appkeys", "generate", {"app": app}, opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
OctoPrintAppKeysClient.prototype.generateKeyForUser = function(user, app, opts) {
|
||||||
|
return this.base.simpleApiCommand("appkeys", "generate", {"app": app, "user": user}, opts);
|
||||||
|
};
|
||||||
|
|
||||||
OctoPrintAppKeysClient.prototype.revokeKey = function(key, opts) {
|
OctoPrintAppKeysClient.prototype.revokeKey = function(key, opts) {
|
||||||
return this.base.simpleApiCommand("appkeys", "revoke", {"key": key}, opts);
|
return this.base.simpleApiCommand("appkeys", "revoke", {"key": key}, opts);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_actions,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_actions{width:75px;text-align:center}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_actions a,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_actions a{color:#000}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_user,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_user{width:100px}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_checkbox,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_checkbox{text-align:center;width:10px}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_checkbox input[type=checkbox],#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_checkbox input[type=checkbox]{margin-top:0}
|
#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_actions,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_actions{width:75px;text-align:center}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_actions a,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_actions a{color:#000}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_user,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_user{width:100px}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_checkbox,#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_checkbox{text-align:center;width:10px}#settings_plugin_appkeys_allkeys_table .settings_plugin_appkeys_checkbox input[type=checkbox],#settings_plugin_appkeys_userkeys_table .settings_plugin_appkeys_checkbox input[type=checkbox]{margin-top:0}#plugin_appkeys_keygenerated .control-text{display:inline-block}
|
||||||
@@ -1,7 +1,49 @@
|
|||||||
$(function() {
|
$(function() {
|
||||||
|
function AppKeysDialogViewModel(parameters) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.dialog = undefined;
|
||||||
|
|
||||||
|
self.onStartup = function() {
|
||||||
|
self.dialog = $("#plugin_appkeys_keygenerated");
|
||||||
|
};
|
||||||
|
|
||||||
|
self.showDialog = function(title, data) {
|
||||||
|
if (self.dialog === undefined) return;
|
||||||
|
|
||||||
|
var qrcode = {
|
||||||
|
text: data.api_key,
|
||||||
|
size: 180,
|
||||||
|
fill: "#000",
|
||||||
|
background: null,
|
||||||
|
label: "",
|
||||||
|
fontname: "sans",
|
||||||
|
fontcolor: "#000",
|
||||||
|
radius: 0,
|
||||||
|
ecLevel: "L"
|
||||||
|
};
|
||||||
|
|
||||||
|
self.dialog.find("#plugin_appkeys_keygenerated_title").text(title);
|
||||||
|
self.dialog.find("#plugin_appkeys_keygenerated_user").text(data.user_id);
|
||||||
|
self.dialog.find("#plugin_appkeys_keygenerated_app").text(data.app_id);
|
||||||
|
self.dialog.find("#plugin_appkeys_keygenerated_key_text").text(data.api_key);
|
||||||
|
self.dialog.find("#plugin_appkeys_keygenerated_key_copy")
|
||||||
|
.off()
|
||||||
|
.click(function() {
|
||||||
|
copyToClipboard(data.api_key);
|
||||||
|
});
|
||||||
|
self.dialog.find("#plugin_appkeys_keygenerated_key_qrcode")
|
||||||
|
.empty()
|
||||||
|
.qrcode(qrcode);
|
||||||
|
|
||||||
|
self.dialog.modal("show");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function UserAppKeysViewModel(parameters) {
|
function UserAppKeysViewModel(parameters) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.loginState = parameters[0];
|
self.dialog = parameters[0];
|
||||||
|
self.loginState = parameters[1];
|
||||||
|
|
||||||
self.keys = new ItemListHelper(
|
self.keys = new ItemListHelper(
|
||||||
"plugin.appkeys.userkeys",
|
"plugin.appkeys.userkeys",
|
||||||
@@ -144,7 +186,9 @@ $(function() {
|
|||||||
|
|
||||||
function AllAppKeysViewModel(parameters) {
|
function AllAppKeysViewModel(parameters) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.loginState = parameters[0];
|
self.dialog = parameters[0];
|
||||||
|
self.loginState = parameters[1];
|
||||||
|
self.access = parameters[2];
|
||||||
|
|
||||||
self.keys = new ItemListHelper(
|
self.keys = new ItemListHelper(
|
||||||
"plugin.appkeys.allkeys",
|
"plugin.appkeys.allkeys",
|
||||||
@@ -170,14 +214,21 @@ $(function() {
|
|||||||
self.users = ko.observableArray([]);
|
self.users = ko.observableArray([]);
|
||||||
self.apps = ko.observableArray([]);
|
self.apps = ko.observableArray([]);
|
||||||
|
|
||||||
|
self.editorApp = ko.observable();
|
||||||
|
self.editorUser = ko.observable();
|
||||||
|
|
||||||
self.markedForDeletion = ko.observableArray([]);
|
self.markedForDeletion = ko.observableArray([]);
|
||||||
|
|
||||||
self.onSettingsShown = function() {
|
self.onSettingsShown = function() {
|
||||||
self.requestData();
|
self.requestData();
|
||||||
|
self.editorUser(self.loginState.username());
|
||||||
|
self.editorApp("");
|
||||||
};
|
};
|
||||||
|
|
||||||
self.onUserLoggedIn = function() {
|
self.onUserLoggedIn = function() {
|
||||||
self.requestData();
|
self.requestData();
|
||||||
|
self.editorUser(self.loginState.username());
|
||||||
|
self.editorApp("");
|
||||||
};
|
};
|
||||||
|
|
||||||
self.requestData = function() {
|
self.requestData = function() {
|
||||||
@@ -204,6 +255,18 @@ $(function() {
|
|||||||
self.apps(apps);
|
self.apps(apps);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.generateKey = function() {
|
||||||
|
return OctoPrint.plugins.appkeys.generateKeyForUser(self.editorUser(), self.editorApp())
|
||||||
|
.done(self.requestData)
|
||||||
|
.done(function() {
|
||||||
|
self.editorUser(self.loginState.username());
|
||||||
|
self.editorApp("");
|
||||||
|
})
|
||||||
|
.done(function(data) {
|
||||||
|
self.dialog.showDialog(gettext("New key generated!"), data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
self.revokeKey = function(key) {
|
self.revokeKey = function(key) {
|
||||||
var perform = function() {
|
var perform = function() {
|
||||||
OctoPrint.plugins.appkeys.revokeKey(key)
|
OctoPrint.plugins.appkeys.revokeKey(key)
|
||||||
@@ -294,15 +357,21 @@ $(function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OCTOPRINT_VIEWMODELS.push([
|
||||||
|
AppKeysDialogViewModel,
|
||||||
|
[],
|
||||||
|
[]
|
||||||
|
]);
|
||||||
|
|
||||||
OCTOPRINT_VIEWMODELS.push([
|
OCTOPRINT_VIEWMODELS.push([
|
||||||
UserAppKeysViewModel,
|
UserAppKeysViewModel,
|
||||||
["loginStateViewModel"],
|
["appKeysDialogViewModel", "loginStateViewModel"],
|
||||||
["#usersettings_plugin_appkeys"]
|
["#usersettings_plugin_appkeys"]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
OCTOPRINT_VIEWMODELS.push([
|
OCTOPRINT_VIEWMODELS.push([
|
||||||
AllAppKeysViewModel,
|
AllAppKeysViewModel,
|
||||||
["loginStateViewModel"],
|
["appKeysDialogViewModel", "loginStateViewModel", "accessViewModel"],
|
||||||
["#settings_plugin_appkeys"]
|
["#settings_plugin_appkeys"]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -22,3 +22,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#plugin_appkeys_keygenerated {
|
||||||
|
.control-text {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<div id="plugin_appkeys_keygenerated" class="modal hide fade">
|
||||||
|
<div class="modal-header">
|
||||||
|
<a href="javascript:void(0)" class="close" data-dismiss="modal" aria-hidden="true">×</a>
|
||||||
|
<h3 id="plugin_appkeys_keygenerated_title"></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('User') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<strong id="plugin_appkeys_keygenerated_user" class="control-text"></strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('Application identifier') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<strong id="plugin_appkeys_keygenerated_app" class="control-text"></strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('API Key') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<strong id="plugin_appkeys_keygenerated_key_text" class="control-text"></strong>
|
||||||
|
<a href="javascript:void(0)" id="plugin_appkeys_keygenerated_key_copy" title="{{ _('Copy API Key to clipboard')|edq }}" class="control-text"><i class="fa fa-copy"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('QR Code') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<div id="plugin_appkeys_keygenerated_key_qrcode"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal" aria-hidden="true">{{ _('Close') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
<legend>{{ _('Registered application keys') }}</legend>
|
||||||
|
|
||||||
<div data-bind="visible: keys.allSize() <= 0">
|
<div data-bind="visible: keys.allSize() <= 0">
|
||||||
<p>{{ _('There are no application keys registered yet.') }}</p>
|
<p>{{ _('There are no application keys registered yet.') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,7 +43,7 @@
|
|||||||
<td class="settings_plugin_appkeys_checkbox"><input type="checkbox" data-bind="value: api_key, checked: $root.markedForDeletion"></td>
|
<td class="settings_plugin_appkeys_checkbox"><input type="checkbox" data-bind="value: api_key, checked: $root.markedForDeletion"></td>
|
||||||
<td class="settings_plugin_appkeys_user"><span data-bind="text: user_id"></span></td>
|
<td class="settings_plugin_appkeys_user"><span data-bind="text: user_id"></span></td>
|
||||||
<td class="settings_plugin_appkeys_app"><span data-bind="text: app_id"></span><br /><small class="muted">{{ _('API Key') }}: <span data-bind="text: api_key"></span> <a href="javascript:void(0)" title="{{ _('Copy API Key to clipboard')|edq }}" data-bind="click: function() { copyToClipboard(api_key) }"><i class="fa fa-copy"></i></a></small></td>
|
<td class="settings_plugin_appkeys_app"><span data-bind="text: app_id"></span><br /><small class="muted">{{ _('API Key') }}: <span data-bind="text: api_key"></span> <a href="javascript:void(0)" title="{{ _('Copy API Key to clipboard')|edq }}" data-bind="click: function() { copyToClipboard(api_key) }"><i class="fa fa-copy"></i></a></small></td>
|
||||||
<td class="settings_plugin_appkeys_actions"><a href="javascript:void(0)" title="{{ _('Revoke')|edq }}" class="fa fa-trash-o" data-bind="click: function() { $parent.revokeKey($data.api_key, $data.user_id) }"></a></td>
|
<td class="settings_plugin_appkeys_actions"><a href="javascript:void(0)" title="{{ _('Revoke')|edq }}" class="fa fa-trash-o" data-bind="click: function() { $parent.revokeKey($data.api_key, $data.user_id) }"></a> | <a href="javascript:void(0)" title="{{ _('Details')|edq }}" class="fa fa-search" data-bind="click: function() { $parent.dialog.showDialog(gettext('Details'), $data) }"></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -56,4 +58,26 @@
|
|||||||
<li data-bind="css: {disabled: keys.currentPage() === keys.lastPage()}"><a href="javascript:void(0)" data-bind="click: keys.nextPage">»</a></li>
|
<li data-bind="css: {disabled: keys.currentPage() === keys.lastPage()}"><a href="javascript:void(0)" data-bind="click: keys.nextPage">»</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<legend>{{ _('Manually generate an application key') }}</legend>
|
||||||
|
|
||||||
|
<form class="form-horizontal" onsubmit="return false;">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('User') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<select data-bind="options: access.users.listHelper.items, optionsText: 'name', optionsValue: 'name', value: editorUser"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('Application identifier') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" data-bind="value: editorApp">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<button class="btn btn-primary" data-bind="click: generateKey">Generate</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,7 +61,8 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
octoprint.plugin.TemplatePlugin,
|
octoprint.plugin.TemplatePlugin,
|
||||||
octoprint.plugin.AssetPlugin,
|
octoprint.plugin.AssetPlugin,
|
||||||
octoprint.plugin.BlueprintPlugin,
|
octoprint.plugin.BlueprintPlugin,
|
||||||
octoprint.plugin.StartupPlugin):
|
octoprint.plugin.StartupPlugin,
|
||||||
|
octoprint.plugin.WizardPlugin):
|
||||||
|
|
||||||
_pip_caller = None
|
_pip_caller = None
|
||||||
|
|
||||||
@@ -99,7 +100,8 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
##~~ TemplatePlugin
|
##~~ TemplatePlugin
|
||||||
|
|
||||||
def get_template_configs(self):
|
def get_template_configs(self):
|
||||||
return [dict(type="settings", name=gettext("Backup & Restore"))]
|
return [dict(type="settings", name=gettext("Backup & Restore")),
|
||||||
|
dict(type="wizard", name=gettext("Restore Backup?"))]
|
||||||
|
|
||||||
##~~ BlueprintPlugin
|
##~~ BlueprintPlugin
|
||||||
|
|
||||||
@@ -210,9 +212,10 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
return NO_CONTENT
|
return NO_CONTENT
|
||||||
|
|
||||||
@octoprint.plugin.BlueprintPlugin.route("/restore", methods=["POST"])
|
@octoprint.plugin.BlueprintPlugin.route("/restore", methods=["POST"])
|
||||||
@no_firstrun_access
|
|
||||||
@Permissions.PLUGIN_BACKUP_ACCESS.require(403)
|
|
||||||
def perform_restore(self):
|
def perform_restore(self):
|
||||||
|
if not Permissions.PLUGIN_BACKUP_ACCESS.can() and not self._settings.global_get(["server", "firstRun"]):
|
||||||
|
return flask.abort(403)
|
||||||
|
|
||||||
if not is_os_compatible(["!windows"]):
|
if not is_os_compatible(["!windows"]):
|
||||||
return flask.make_response("Invalid request, the restores are not supported on the underlying operating system", 400)
|
return flask.make_response("Invalid request, the restores are not supported on the underlying operating system", 400)
|
||||||
|
|
||||||
@@ -249,14 +252,14 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
compatible = octoprint_compatible and os_compatible
|
compatible = octoprint_compatible and os_compatible
|
||||||
if not compatible:
|
if not compatible:
|
||||||
if not octoprint_compatible and not os_compatible:
|
if not octoprint_compatible and not os_compatible:
|
||||||
self._logger.warn("Cannot install plugin {}, it is incompatible to this version "
|
self._logger.warning("Cannot install plugin {}, it is incompatible to this version "
|
||||||
"of OctoPrint and the underlying operating system".format(plugin["id"]))
|
"of OctoPrint and the underlying operating system".format(plugin["id"]))
|
||||||
elif not octoprint_compatible:
|
elif not octoprint_compatible:
|
||||||
self._logger.warn("Cannot install plugin {}, it is incompatible to this version "
|
self._logger.warning("Cannot install plugin {}, it is incompatible to this version "
|
||||||
"of OctoPrint".format(plugin["id"]))
|
"of OctoPrint".format(plugin["id"]))
|
||||||
elif not os_compatible:
|
elif not os_compatible:
|
||||||
self._logger.warn("Cannot install plugin {}, it is incompatible to the underlying "
|
self._logger.warning("Cannot install plugin {}, it is incompatible to the underlying "
|
||||||
"operating system".format(plugin["id"]))
|
"operating system".format(plugin["id"]))
|
||||||
self._send_client_message("plugin_incompatible", dict(plugin=plugin["id"],
|
self._send_client_message("plugin_incompatible", dict(plugin=plugin["id"],
|
||||||
octoprint_compatible=octoprint_compatible,
|
octoprint_compatible=octoprint_compatible,
|
||||||
os_compatible=os_compatible))
|
os_compatible=os_compatible))
|
||||||
@@ -325,6 +328,14 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
def is_blueprint_protected(self):
|
def is_blueprint_protected(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
##~~ WizardPlugin
|
||||||
|
|
||||||
|
def is_wizard_required(self):
|
||||||
|
return self._settings.global_get(["server", "firstRun"]) and is_os_compatible(["!windows"])
|
||||||
|
|
||||||
|
def get_wizard_details(self):
|
||||||
|
return dict(required=self.is_wizard_required())
|
||||||
|
|
||||||
##~~ tornado hook
|
##~~ tornado hook
|
||||||
|
|
||||||
def route_hook(self, *args, **kwargs):
|
def route_hook(self, *args, **kwargs):
|
||||||
@@ -355,15 +366,21 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
@click.option("--exclude", multiple=True,
|
@click.option("--exclude", multiple=True,
|
||||||
help="Identifiers of data folders to exclude, e.g. 'uploads' to exclude uploads or "
|
help="Identifiers of data folders to exclude, e.g. 'uploads' to exclude uploads or "
|
||||||
"'timelapse' to exclude timelapses.")
|
"'timelapse' to exclude timelapses.")
|
||||||
def backup_command(exclude):
|
@click.option("--path", type=click.Path(), default=None,
|
||||||
|
help="Specify full path to backup file to be created")
|
||||||
|
def backup_command(exclude, path):
|
||||||
"""
|
"""
|
||||||
Creates a new backup.
|
Creates a new backup.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
backup_file = build_backup_filename()
|
|
||||||
settings = octoprint.plugin.plugin_settings_for_settings_plugin("backup", self, settings=cli_group.settings)
|
settings = octoprint.plugin.plugin_settings_for_settings_plugin("backup", self, settings=cli_group.settings)
|
||||||
|
|
||||||
datafolder = os.path.join(settings.getBaseFolder("data"), "backup")
|
if path is not None:
|
||||||
|
datafolder, backup_file = os.path.split(os.path.abspath(path))
|
||||||
|
else:
|
||||||
|
backup_file = build_backup_filename()
|
||||||
|
datafolder = os.path.join(settings.getBaseFolder("data"), "backup")
|
||||||
|
|
||||||
if not os.path.isdir(datafolder):
|
if not os.path.isdir(datafolder):
|
||||||
os.makedirs(datafolder)
|
os.makedirs(datafolder)
|
||||||
|
|
||||||
@@ -374,6 +391,7 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
plugin_manager=cli_group.plugin_manager,
|
plugin_manager=cli_group.plugin_manager,
|
||||||
datafolder=datafolder)
|
datafolder=datafolder)
|
||||||
click.echo("Done.")
|
click.echo("Done.")
|
||||||
|
click.echo("Backup located at {}".format(os.path.join(datafolder, backup_file)))
|
||||||
|
|
||||||
@click.command("restore")
|
@click.command("restore")
|
||||||
@click.argument("path")
|
@click.argument("path")
|
||||||
@@ -796,12 +814,25 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
try:
|
try:
|
||||||
if callable(on_log_progress):
|
if callable(on_log_progress):
|
||||||
on_log_progress("Unpacking backup to {}...".format(temp))
|
on_log_progress("Unpacking backup to {}...".format(temp))
|
||||||
|
|
||||||
abstemp = os.path.abspath(temp)
|
abstemp = os.path.abspath(temp)
|
||||||
|
dirs = {}
|
||||||
for member in zip.infolist():
|
for member in zip.infolist():
|
||||||
abspath = os.path.abspath(os.path.join(temp, member.filename))
|
abspath = os.path.abspath(os.path.join(temp, member.filename))
|
||||||
if abspath.startswith(abstemp):
|
if abspath.startswith(abstemp):
|
||||||
|
date_time = time.mktime(member.date_time + (0, 0, -1))
|
||||||
|
|
||||||
zip.extract(member, temp)
|
zip.extract(member, temp)
|
||||||
|
|
||||||
|
if os.path.isdir(abspath):
|
||||||
|
dirs[abspath] = date_time
|
||||||
|
else:
|
||||||
|
os.utime(abspath, (date_time, date_time))
|
||||||
|
|
||||||
|
# set time on folders
|
||||||
|
for abspath, date_time in dirs.items():
|
||||||
|
os.utime(abspath, (date_time, date_time))
|
||||||
|
|
||||||
# sanity check
|
# sanity check
|
||||||
configfile = os.path.join(temp, "basedir", "config.yaml")
|
configfile = os.path.join(temp, "basedir", "config.yaml")
|
||||||
if not os.path.exists(configfile):
|
if not os.path.exists(configfile):
|
||||||
@@ -929,6 +960,9 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
|
||||||
# restart server
|
# restart server
|
||||||
|
if not restart_command:
|
||||||
|
restart_command = configdata.get("server", dict()).get("commands", dict()).get("serverRestartCommand")
|
||||||
|
|
||||||
if restart_command:
|
if restart_command:
|
||||||
import sarge
|
import sarge
|
||||||
|
|
||||||
@@ -938,7 +972,7 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
on_restore_done(path)
|
on_restore_done(path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sarge.run(restart_command, async_=True)
|
sarge.run(restart_command, close_fds=True, async_=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
if callable(on_log_error):
|
if callable(on_log_error):
|
||||||
on_log_error("Error while restarting via command {}".format(restart_command),
|
on_log_error("Error while restarting via command {}".format(restart_command),
|
||||||
@@ -949,6 +983,8 @@ class BackupPlugin(octoprint.plugin.SettingsPlugin,
|
|||||||
else:
|
else:
|
||||||
if callable(on_restore_done):
|
if callable(on_restore_done):
|
||||||
on_restore_done(path)
|
on_restore_done(path)
|
||||||
|
if callable(on_log_error):
|
||||||
|
on_log_error("No restart command configured. Please restart OctoPrint manually.")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -970,6 +1006,7 @@ __plugin_description__ = "Backup & restore your OctoPrint settings and data"
|
|||||||
__plugin_disabling_discouraged__ = gettext("Without this plugin you will no longer be able to backup "
|
__plugin_disabling_discouraged__ = gettext("Without this plugin you will no longer be able to backup "
|
||||||
"& restore your OctoPrint settings and data.")
|
"& restore your OctoPrint settings and data.")
|
||||||
__plugin_license__ = "AGPLv3"
|
__plugin_license__ = "AGPLv3"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = BackupPlugin()
|
__plugin_implementation__ = BackupPlugin()
|
||||||
__plugin_hooks__ = {
|
__plugin_hooks__ = {
|
||||||
"octoprint.server.http.routes": __plugin_implementation__.route_hook,
|
"octoprint.server.http.routes": __plugin_implementation__.route_hook,
|
||||||
|
|||||||
@@ -29,9 +29,10 @@ $(function() {
|
|||||||
self.backupInProgress = ko.observable(false);
|
self.backupInProgress = ko.observable(false);
|
||||||
self.restoreSupported = ko.observable(true);
|
self.restoreSupported = ko.observable(true);
|
||||||
|
|
||||||
self.backupUploadButton = $("#settings-backup-upload");
|
|
||||||
self.backupUploadData = undefined;
|
self.backupUploadData = undefined;
|
||||||
self.backupUploadButton.fileupload({
|
self.backupUploadName = ko.observable();
|
||||||
|
|
||||||
|
var backupFileuploadOptions = {
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
maxNumberOfFiles: 1,
|
maxNumberOfFiles: 1,
|
||||||
autoUpload: false,
|
autoUpload: false,
|
||||||
@@ -49,8 +50,11 @@ $(function() {
|
|||||||
self.backupUploadName(undefined);
|
self.backupUploadName(undefined);
|
||||||
self.backupUploadData = undefined;
|
self.backupUploadData = undefined;
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
self.backupUploadName = ko.observable();
|
|
||||||
|
$("#settings-backup-upload").fileupload(backupFileuploadOptions);
|
||||||
|
$("#wizard-backup-upload").fileupload(backupFileuploadOptions);
|
||||||
|
|
||||||
self.restoreInProgress = ko.observable(false);
|
self.restoreInProgress = ko.observable(false);
|
||||||
self.restoreTitle = ko.observable();
|
self.restoreTitle = ko.observable();
|
||||||
self.restoreDialog = undefined;
|
self.restoreDialog = undefined;
|
||||||
@@ -284,6 +288,6 @@ $(function() {
|
|||||||
OCTOPRINT_VIEWMODELS.push({
|
OCTOPRINT_VIEWMODELS.push({
|
||||||
construct: BackupViewModel,
|
construct: BackupViewModel,
|
||||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||||
elements: ["#settings_plugin_backup"]
|
elements: ["#settings_plugin_backup", "#wizard_plugin_backup"]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -96,26 +96,8 @@
|
|||||||
|
|
||||||
<p>{{ _('Restore settings & files from an uploaded backup archive.') }}</p>
|
<p>{{ _('Restore settings & files from an uploaded backup archive.') }}</p>
|
||||||
|
|
||||||
<form class="form-horizontal">
|
{% set plugin_backup_upload_form_id='settings-backup-upload' %}
|
||||||
<div class="control-group">
|
{% include "snippets/plugin/backup/backup_plugin_upload_form.jinja2" %}
|
||||||
<label class="control-label">{{ _('Backup file') }}</label>
|
|
||||||
<div class="controls">
|
|
||||||
<div class="input-prepend">
|
|
||||||
<span class="btn fileinput-button">
|
|
||||||
<span>{{ _('Browse...') }}</span>
|
|
||||||
<input id="settings-backup-upload" type="file" name="file" data-url="{{ url_for("plugin.backup.perform_restore") }}" accept=".zip">
|
|
||||||
</span>
|
|
||||||
<span class="add-on" data-bind="text: backupUploadName"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control-group">
|
|
||||||
<div class="controls">
|
|
||||||
<button class="btn btn-primary" data-bind="enable: !backupInProgress() && !restoreInProgress(), click: performRestoreFromUpload"><i class="fa fa-spinner fa-spin" data-bind="visible: restoreInProgress"></i> {{ _('Upload & restore') }}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div data-bind="visible: !restoreSupported()">
|
<div data-bind="visible: !restoreSupported()">
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<h3>{{ _('Restore from a backup?') }}</h3>
|
||||||
|
|
||||||
|
{% trans %}<p>
|
||||||
|
If you would like to restore OctoPrint configuration from a backup now is the time.
|
||||||
|
</p>{% endtrans %}
|
||||||
|
|
||||||
|
{% set plugin_backup_upload_form_id='wizard-backup-upload' %}
|
||||||
|
{% include "snippets/plugin/backup/backup_plugin_upload_form.jinja2" %}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
<form class="form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">{{ _('Backup file') }}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="input-prepend">
|
||||||
|
<span class="btn fileinput-button">
|
||||||
|
<span>{{ _('Browse...') }}</span>
|
||||||
|
<input id="{{ plugin_backup_upload_form_id }}" type="file" name="file" data-url="{{ url_for("plugin.backup.perform_restore") }}" accept=".zip">
|
||||||
|
</span>
|
||||||
|
<span class="add-on" data-bind="text: backupUploadName"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<button class="btn btn-primary" data-bind="enable: !backupInProgress() && !restoreInProgress(), click: performRestoreFromUpload"><i class="fa fa-spinner fa-spin" data-bind="visible: restoreInProgress"></i> {{ _('Upload & restore') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -123,4 +123,5 @@ __plugin_description__ = "Provides wizard dialogs for core components and functi
|
|||||||
__plugin_disabling_discouraged__ = gettext("Without this plugin OctoPrint will no longer be able to perform "
|
__plugin_disabling_discouraged__ = gettext("Without this plugin OctoPrint will no longer be able to perform "
|
||||||
"setup steps that might be required after an update.")
|
"setup steps that might be required after an update.")
|
||||||
__plugin_license__ = "AGPLv3"
|
__plugin_license__ = "AGPLv3"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = CoreWizardPlugin()
|
__plugin_implementation__ = CoreWizardPlugin()
|
||||||
Loaded 100 of 277 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user