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 | ||
|
|
6232a04e52 | ||
|
|
edfa786514 | ||
|
|
504137d249 | ||
|
|
b818042fc5 | ||
|
|
c37f83c6c3 | ||
|
|
fe7894fb5f | ||
|
|
f57afca557 | ||
|
|
38e8878ded | ||
|
|
230740708b | ||
|
|
0c3b0b8a40 | ||
|
|
cf560a47d5 | ||
|
|
d99af420ac | ||
|
|
73c2baa39e | ||
|
|
054df68741 | ||
|
|
f7756698e9 | ||
|
|
453ef0cb97 | ||
|
|
5015422086 | ||
|
|
2d85d8acf8 | ||
|
|
2af589a823 | ||
|
|
20c55f4d3d | ||
|
|
b7fdc82d30 | ||
|
|
770ebf2cf9 | ||
|
|
a75c641c18 | ||
|
|
38c09153ac | ||
|
|
e30e18e431 | ||
|
|
249d19f55b | ||
|
|
2e043ecf5b | ||
|
|
831edf234d | ||
|
|
b42c753d3f | ||
|
|
e0b09857c4 | ||
|
|
924cd5cb4c | ||
|
|
73f7c4d8a1 | ||
|
|
0d035496f5 | ||
|
|
10079b8d9d | ||
|
|
c31566a626 | ||
|
|
0cfc7a2976 | ||
|
|
de5a10163e | ||
|
|
0a22c4e66c | ||
|
|
a88d95af77 | ||
|
|
010221ab5b | ||
|
|
6471a04a86 | ||
|
|
7b2762c590 | ||
|
|
de0b97b99c | ||
|
|
60d2bd1ac1 | ||
|
|
4d716647e5 | ||
|
|
43ab47a260 | ||
|
|
88ecfbdb65 | ||
|
|
8087967683 | ||
|
|
cb43197105 | ||
|
|
b1b9329614 | ||
|
|
7317814ce0 | ||
|
|
66ef7b66bb | ||
|
|
be3ff5f043 | ||
|
|
c36fa6da90 | ||
|
|
aadcf650c7 | ||
|
|
95c3fa0b04 | ||
|
|
1d0829a1db | ||
|
|
8d31d6687e | ||
|
|
3f3cb556a7 | ||
|
|
4460c8bee0 | ||
|
|
89b597a656 | ||
|
|
e1a25a8913 | ||
|
|
482c2f7115 | ||
|
|
7fa4ebd1ec | ||
|
|
9c3b552aa8 | ||
|
|
3229e65a8d | ||
|
|
7191d39b51 | ||
|
|
58bc5171ee | ||
|
|
74f3bc9ae6 | ||
|
|
464d9c0757 | ||
|
|
94ae90ab80 | ||
|
|
33b89550a4 | ||
|
|
9661469532 | ||
|
|
b06c222a7d | ||
|
|
9f85b54681 | ||
|
|
5d1ad5d75d | ||
|
|
dc32f955b7 | ||
|
|
220592c267 | ||
|
|
0faa6879b4 | ||
|
|
71b5de91bf | ||
|
|
928d62a517 | ||
|
|
78bd3b1a52 | ||
|
|
b9bab0577b | ||
|
|
c41551a643 | ||
|
|
6c92dd1303 | ||
|
|
124f01ca2d | ||
|
|
0dece85fa7 | ||
|
|
caebf90ee9 | ||
|
|
0c77014903 | ||
|
|
231a796200 | ||
|
|
fe755405e8 | ||
|
|
2200f2186c | ||
|
|
b57b7cb606 | ||
|
|
f2b2496e58 | ||
|
|
e603b98d0d | ||
|
|
e235fc299f | ||
|
|
4f25ed546e | ||
|
|
f72b9db6a9 | ||
|
|
80e8e33283 | ||
|
|
00d0396417 | ||
|
|
59e39662f1 | ||
|
|
038e1b9a57 | ||
|
|
bbefeeeb02 | ||
|
|
2801da5c51 | ||
|
|
471dab9406 | ||
|
|
1deb247ce5 | ||
|
|
4469a2d84a | ||
|
|
2da7aa358d | ||
|
|
cbb083d7f6 | ||
|
|
d68de2c3c7 | ||
|
|
454c5e494a | ||
|
|
3b1874ea25 | ||
|
|
e0233dee13 | ||
|
|
84a99e1b53 | ||
|
|
b7e0e89bb4 | ||
|
|
d8c3063813 | ||
|
|
1485050234 | ||
|
|
6d7721f8f5 | ||
|
|
e3ae71eabd | ||
|
|
e88041c59e | ||
|
|
e17db4e1cf | ||
|
|
766a64c8f6 | ||
|
|
8485d2c9a7 | ||
|
|
397e691a6a | ||
|
|
6481f7cf6b | ||
|
|
46c527d24a | ||
|
|
5392f39cc4 | ||
|
|
4a324b4f5e | ||
|
|
2855b0e7a7 | ||
|
|
39e4cd3136 | ||
|
|
8fefa63c8c | ||
|
|
10532b9118 | ||
|
|
7f2eb470e4 | ||
|
|
8955b8e0b6 | ||
|
|
ee9d5048e2 | ||
|
|
09bb74b6c6 | ||
|
|
493dddf66e | ||
|
|
8173f8d0c4 | ||
|
|
01feec47d7 | ||
|
|
2b60dbc7e1 | ||
|
|
32f5f36e5a | ||
|
|
96294df710 | ||
|
|
ef54cbb148 | ||
|
|
9cd597a467 | ||
|
|
2263ebde72 | ||
|
|
1fd8d597ab | ||
|
|
2aec0b3a75 | ||
|
|
47d10a6d3e | ||
|
|
ee216ddc93 | ||
|
|
7756d312e2 | ||
|
|
19e03eeeb2 | ||
|
|
e73aeba03b | ||
|
|
87f3c5acce | ||
|
|
a38a3e67c9 | ||
|
|
547ae9e13e | ||
|
|
b031092f07 | ||
|
|
6e6dd2c34e | ||
|
|
759f4f8ea2 | ||
|
|
bee82bcde9 | ||
|
|
888fb97e66 | ||
|
|
9c775bd899 | ||
|
|
4bf3445eef | ||
|
|
47b3f51a3f | ||
|
|
2e6b85990d | ||
|
|
30a4b9e9ab | ||
|
|
81a259e51b | ||
|
|
e85e9661e0 | ||
|
|
1d60250942 | ||
|
|
e11463f6ce | ||
|
|
1146a1bb6f | ||
|
|
311fdd5aca | ||
|
|
6ddc55bf80 | ||
|
|
2c930ef069 | ||
|
|
3739bbc652 | ||
|
|
8d544e63f4 | ||
|
|
7e4cf6c5dc | ||
|
|
c8d162c999 | ||
|
|
017515dcc1 | ||
|
|
d8bd684f96 | ||
|
|
aad5c70eb0 | ||
|
|
ea2f0a9b17 | ||
|
|
c4131d5e4b | ||
|
|
21127bcf2a | ||
|
|
04da8afb07 | ||
|
|
c38f06cce2 | ||
|
|
968f952f69 | ||
|
|
ac3b6f6df8 | ||
|
|
a4444ccb68 | ||
|
|
270a0dcb1f | ||
|
|
a889bec4d8 | ||
|
|
7ee9bc32eb | ||
|
|
fd62c1fa3d | ||
|
|
a445cfe65e | ||
|
|
e20a9925dd | ||
|
|
09a4fb2515 | ||
|
|
cce7389a42 | ||
|
|
b138ea7a47 | ||
|
|
3b708ce079 | ||
|
|
4441618be5 | ||
|
|
0525c9ab40 | ||
|
|
0035e7c3ff | ||
|
|
073060d253 | ||
|
|
55980a1c2c | ||
|
|
852a2cf157 | ||
|
|
2e6ee57162 | ||
|
|
5c54f16ece | ||
|
|
04a13268ad | ||
|
|
49fdac7528 | ||
|
|
75f6ef4bae | ||
|
|
9fd608691b | ||
|
|
30d618267f | ||
|
|
204d212323 | ||
|
|
04528a635b | ||
|
|
db1c18075f | ||
|
|
3b556e9d79 | ||
|
|
8761273636 | ||
|
|
08efe80304 | ||
|
|
cc1d88c4c8 | ||
|
|
72eef3e224 | ||
|
|
84f6833597 | ||
|
|
2a94abdc49 | ||
|
|
fab5f34aaa | ||
|
|
76f79e5380 | ||
|
|
1b25029207 | ||
|
|
8df2a5436b | ||
|
|
72f005b7fe | ||
|
|
dbe07af426 | ||
|
|
1c3e463ac6 | ||
|
|
4b04e8fd79 | ||
|
|
c0096c41a0 | ||
|
|
aab629d80e | ||
|
|
4e2afbc170 | ||
|
|
cf16392e18 | ||
|
|
34e4a20866 | ||
|
|
1b3a8acf0d | ||
|
|
1ed6730400 | ||
|
|
dde99736e4 | ||
|
|
334f2c35f9 | ||
|
|
aacd59ae78 | ||
|
|
058dbd0c2e | ||
|
|
54c8923087 | ||
|
|
1025f0be43 | ||
|
|
295b96f259 | ||
|
|
adea0db344 | ||
|
|
9f2821fe96 | ||
|
|
dcc1148863 | ||
|
|
e972026ad0 | ||
|
|
6592be63f8 | ||
|
|
8b5626e49c | ||
|
|
be4a931e32 | ||
|
|
548da0d64f | ||
|
|
25f26170ff | ||
|
|
b6b562399e | ||
|
|
3654512085 | ||
|
|
e7dbd804ce | ||
|
|
7fd03265d4 | ||
|
|
369679bae5 | ||
|
|
27e1f2e6e7 | ||
|
|
109cbeea6a | ||
|
|
606199dcc9 | ||
|
|
75b5fe198f | ||
|
|
3c5aa60d2b | ||
|
|
1b876f1cf3 | ||
|
|
580e5f5122 | ||
|
|
22f6a38f0a | ||
|
|
620aa4dfe0 | ||
|
|
1ccc787222 | ||
|
|
f8e7ae7436 | ||
|
|
3ae284d9a7 | ||
|
|
caf5be562e | ||
|
|
c01a34f358 | ||
|
|
deee737660 | ||
|
|
8425c7b973 | ||
|
|
1e42db040d | ||
|
|
e2d4b64510 | ||
|
|
61136edeea | ||
|
|
7614ef40d3 | ||
|
|
935639a51a | ||
|
|
ec689e3939 | ||
|
|
84f95b1099 | ||
|
|
fd8788dd34 | ||
|
|
32a8646135 | ||
|
|
09cc7cf5f7 | ||
|
|
496e9f0ec4 | ||
|
|
18b2ecd64c | ||
|
|
cc6f61c62e | ||
|
|
de149613cb | ||
|
|
a7ca374955 | ||
|
|
d7d3272905 | ||
|
|
9eb29a8ce0 | ||
|
|
bf16bd1180 | ||
|
|
7b5315383b | ||
|
|
72729ad418 | ||
|
|
e6f902cbe7 | ||
|
|
9b14f32279 | ||
|
|
7ad4d75588 | ||
|
|
5a623b486c | ||
|
|
920283cf87 | ||
|
|
becd16b892 | ||
|
|
f59c1ce804 | ||
|
|
c71972c0f8 | ||
|
|
47a9a40ec9 | ||
|
|
5c1fffc3d0 | ||
|
|
fe090cc6cc | ||
|
|
ab3c4ab66c | ||
|
|
1d6b7244b5 | ||
|
|
ea17566aba | ||
|
|
315ed57916 | ||
|
|
1014582b4b | ||
|
|
cf77053901 | ||
|
|
f040482b18 | ||
|
|
523fadd930 | ||
|
|
97d0fbd2c9 | ||
|
|
3b820f6848 | ||
|
|
e8b9f385b4 | ||
|
|
95bc1006a0 | ||
|
|
14ef17163f | ||
|
|
9a1bd8af87 | ||
|
|
a292a12c4a | ||
|
|
200a3ef4eb | ||
|
|
88582beb55 | ||
|
|
6d7c8bbda6 | ||
|
|
9a7f92174a | ||
|
|
a301fc6da9 | ||
|
|
e08dc0b5aa | ||
|
|
a368a7f1c9 | ||
|
|
6a601d4f8e | ||
|
|
7a3b370469 | ||
|
|
e676d53e9f | ||
|
|
40b231f692 | ||
|
|
86664fdb39 | ||
|
|
4ebb5cf42d | ||
|
|
e8bee435af | ||
|
|
082f977f7a | ||
|
|
237a2c0add | ||
|
|
2e47f49f7a | ||
|
|
05919363e1 | ||
|
|
7c8547555c | ||
|
|
ce0c77f0bf | ||
|
|
aec041b014 | ||
|
|
58b32803df | ||
|
|
6d447f8408 | ||
|
|
54d359f730 | ||
|
|
4d9f0fca41 | ||
|
|
41146c2b7c | ||
|
|
99d7157cb7 | ||
|
|
c8b5662ff2 | ||
|
|
b781681e0f | ||
|
|
5edeecdc8c | ||
|
|
f82ec61463 | ||
|
|
372a8d2ea8 | ||
|
|
9c5d1dec59 | ||
|
|
feff5e0978 | ||
|
|
019bf5acd4 | ||
|
|
717aafee08 | ||
|
|
67c5a5e168 | ||
|
|
6310afa261 | ||
|
|
cd6ae6e47b | ||
|
|
b01e1c269d | ||
|
|
49fb0f87d5 | ||
|
|
8956e7a173 | ||
|
|
9fa20f0e52 | ||
|
|
6bf8384c35 | ||
|
|
1dacbc35bf | ||
|
|
7522dbed1d | ||
|
|
d433c919ec | ||
|
|
a6f701802f | ||
|
|
e03feeb7ac | ||
|
|
00068114a1 | ||
|
|
6a7e11eb7c | ||
|
|
6f987577f4 | ||
|
|
819d690bc3 | ||
|
|
dbfe487f13 | ||
|
|
47e9afa811 | ||
|
|
f9edea0c2c | ||
|
|
8ef3d1dcad | ||
|
|
fcfef25c93 | ||
|
|
604d2f7811 | ||
|
|
a721256204 | ||
|
|
24d2efd3ce | ||
|
|
5e8220055f | ||
|
|
38eff3fe6f | ||
|
|
4e47ecabf8 | ||
|
|
df9617ac1e | ||
|
|
0b23417f45 | ||
|
|
828ba56952 | ||
|
|
63723baf07 | ||
|
|
b60b20d784 | ||
|
|
1e0bdc8b8c | ||
|
|
b47b39af99 | ||
|
|
6bc4d8fca4 | ||
|
|
1e01e587f3 | ||
|
|
d8f5dd701b | ||
|
|
bee609a316 | ||
|
|
5794a347f1 | ||
|
|
5d8535cb9c | ||
|
|
21d3622c2e | ||
|
|
008cde6ef6 | ||
|
|
4df57cd8fe | ||
|
|
f53380c04e | ||
|
|
8af45e2f21 | ||
|
|
0da47858fa | ||
|
|
abfffa3231 | ||
|
|
e056ccdf29 | ||
|
|
e334d8b073 | ||
|
|
f1673c148f | ||
|
|
ae5a1dc6dc | ||
|
|
7fcc3551ca | ||
|
|
f3fdac7e5a | ||
|
|
bba95e9000 | ||
|
|
fa81791c29 | ||
|
|
a4072723bf | ||
|
|
d451acdd4f | ||
|
|
a1a15e40e0 | ||
|
|
0c264ca0d2 | ||
|
|
9e4b0f83d8 | ||
|
|
2b8d831308 | ||
|
|
fcb0f877b8 | ||
|
|
c74e3a0a0b | ||
|
|
ea64c017e8 | ||
|
|
70a104e32a | ||
|
|
75a37f5ce7 | ||
|
|
e4d083028c | ||
|
|
6bab550830 | ||
|
|
f9916783e9 | ||
|
|
e00375e586 | ||
|
|
41fab8a36c | ||
|
|
c05b6572c5 | ||
|
|
1ae6b73f7a | ||
|
|
670ca15997 | ||
|
|
ea5ef34cc1 | ||
|
|
958fc7600d | ||
|
|
13d894e74b | ||
|
|
353309fc60 | ||
|
|
3501179257 | ||
|
|
f993f744ba | ||
|
|
d987cb23c1 | ||
|
|
5b4f4e3d77 | ||
|
|
c66b451efd | ||
|
|
e14cb44e13 | ||
|
|
17ad63dabf | ||
|
|
39cda08d07 | ||
|
|
3a1611e5c4 | ||
|
|
7736cf1e6d | ||
|
|
41e74df8d3 | ||
|
|
ac3b8ebfcc | ||
|
|
e0543de8ef | ||
|
|
f243a52823 | ||
|
|
94013ddb70 | ||
|
|
9cfcbd3929 | ||
|
|
6cfbdc6062 | ||
|
|
d3334b29d9 | ||
|
|
94ce6f1dd1 | ||
|
|
c623e90ebc | ||
|
|
b6e49b59a7 | ||
|
|
f416e96414 | ||
|
|
347f53baa4 | ||
|
|
9ecf39febe | ||
|
|
582b03f21f | ||
|
|
ff0b94c78d | ||
|
|
f5c8b04958 | ||
|
|
36818057a3 | ||
|
|
a5cff5bc3d | ||
|
|
a4bff305b3 | ||
|
|
6b149e2fc9 | ||
|
|
337e49208a | ||
|
|
b052925424 | ||
|
|
970c867ee4 | ||
|
|
c69f20c648 | ||
|
|
88c93a7c11 | ||
|
|
54677f96f4 | ||
|
|
e522633c98 | ||
|
|
f72f948744 | ||
|
|
3ad4818488 | ||
|
|
b3cc44cea5 | ||
|
|
9cb3631ad0 | ||
|
|
743ff35bcf | ||
|
|
df706f61db | ||
|
|
791e759b40 | ||
|
|
22fdc1d933 | ||
|
|
aa383e3ca1 | ||
|
|
472fda6645 | ||
|
|
bd35de80c3 | ||
|
|
52fe19e5f9 | ||
|
|
c2f09b1715 | ||
|
|
1ccc1fa47b | ||
|
|
2972d38cef | ||
|
|
4662606907 | ||
|
|
2c50aa789a | ||
|
|
9e62b250ac | ||
|
|
03722e5e70 | ||
|
|
7867052339 | ||
|
|
8a0252ccfe | ||
|
|
e84293c415 | ||
|
|
250e83ad7e | ||
|
|
660724741c | ||
|
|
a5f87597ad | ||
|
|
ebef35a573 | ||
|
|
44fcd4e305 | ||
|
|
90704e292b | ||
|
|
b83dd76c89 | ||
|
|
7ab4b90d07 | ||
|
|
fd4ff2bf37 | ||
|
|
76f93d8875 | ||
|
|
30359f52ab | ||
|
|
0020f029d1 | ||
|
|
d248df3826 | ||
|
|
dc19ad4c4c | ||
|
|
88a962b3ab | ||
|
|
033e567d2a | ||
|
|
d03d4b7b4c | ||
|
|
38ddd3102d | ||
|
|
6dd501217a | ||
|
|
e58387b4f2 | ||
|
|
1de58b7be1 | ||
|
|
58d8deefcd | ||
|
|
f8e6e4e3db | ||
|
|
a92372ec7e | ||
|
|
7b773f6fd2 | ||
|
|
69681a27d6 | ||
|
|
0adcfc693d | ||
|
|
b73507fd2b | ||
|
|
bea6bd013c | ||
|
|
9a881012e2 | ||
|
|
d62df7643b | ||
|
|
7d40320a5b | ||
|
|
09456b923f | ||
|
|
39e6c11c39 | ||
|
|
5aef014773 | ||
|
|
9738884ff8 | ||
|
|
27b625a614 | ||
|
|
096e9fc326 | ||
|
|
f577d6b45d | ||
|
|
bd7a28af5b | ||
|
|
104b0a504c | ||
|
|
40bfbe0d7b | ||
|
|
4bf5984ace | ||
|
|
8369d311bf | ||
|
|
d8eb57548d | ||
|
|
d8072f0e05 | ||
|
|
3d7016f500 | ||
|
|
41e3a0390f | ||
|
|
42a9a1976d | ||
|
|
569991e55c | ||
|
|
b7adf115ee | ||
|
|
7cf0f552f5 | ||
|
|
246c614635 | ||
|
|
df62f08ec3 | ||
|
|
b6f71eeb3b | ||
|
|
e2a7e07a0a | ||
|
|
b3acd36092 | ||
|
|
7a037b9c66 | ||
|
|
c1cf359b43 | ||
|
|
2d883d6d20 | ||
|
|
2fa18f5855 | ||
|
|
a4ce92c963 | ||
|
|
c84d39a803 | ||
|
|
d59eaa2a91 | ||
|
|
f7ad87449a | ||
|
|
08bfae216c | ||
|
|
64db784d8d | ||
|
|
5a91b8db48 | ||
|
|
58f73f3ed9 | ||
|
|
1852578136 | ||
|
|
fdb2ba8146 | ||
|
|
92ea6ee9aa | ||
|
|
fb4e95bf8e | ||
|
|
cedbf039d2 | ||
|
|
d1711f0376 | ||
|
|
047b9f544a | ||
|
|
8ea7528d41 | ||
|
|
43bf55d503 | ||
|
|
b9a5e1db69 | ||
|
|
03d421c629 | ||
|
|
066e7d1e39 | ||
|
|
4fd641dc74 | ||
|
|
16b690089d | ||
|
|
a77fbfe0c2 | ||
|
|
b36a776f51 | ||
|
|
9c39dd7303 | ||
|
|
eb5a3d1d36 | ||
|
|
d465f23309 | ||
|
|
987a6b3cf8 | ||
|
|
6b3d68f9aa | ||
|
|
fcd34265c8 | ||
|
|
088b0cf1e7 | ||
|
|
e6061fdd9c | ||
|
|
cf8a30cc4e | ||
|
|
6ba1e10b8b | ||
|
|
2a96864c07 | ||
|
|
48fceac0fe | ||
|
|
ad246deb9e | ||
|
|
c2509fad9c | ||
|
|
eeb216e08d | ||
|
|
2761608c1e | ||
|
|
27536388f2 | ||
|
|
21c8bd54f5 | ||
|
|
fa5619fad7 | ||
|
|
022c59a094 | ||
|
|
bc8abdfc62 | ||
|
|
d8cffc4b22 | ||
|
|
312760f86a | ||
|
|
5ea22c602c | ||
|
|
7540aa6b72 | ||
|
|
84cc89832b | ||
|
|
9554079e4b | ||
|
|
481faf8da1 | ||
|
|
fd6c7cd48f | ||
|
|
9441ea572d | ||
|
|
0414e4a6a6 | ||
|
|
158f14df89 | ||
|
|
93a80fe256 | ||
|
|
398e10588c | ||
|
|
6d1f610085 | ||
|
|
bd95dad85e | ||
|
|
bf8301bd6a | ||
|
|
231006ab26 | ||
|
|
744f4d0f42 | ||
|
|
ad269751b8 | ||
|
|
4c77f07bc9 | ||
|
|
e974cb8ec5 | ||
|
|
48c02e1018 | ||
|
|
f398ee90b0 | ||
|
|
23fcdc0365 | ||
|
|
e91da1cd8d | ||
|
|
4e0d3725cb | ||
|
|
f45cb1560f | ||
|
|
7214b9f2c2 | ||
|
|
37990996b7 | ||
|
|
024b58097e | ||
|
|
2cc1fe7fe2 | ||
|
|
e0cd48df92 | ||
|
|
d45d2f5123 | ||
|
|
eb5e2c94a3 | ||
|
|
ced74f5b45 | ||
|
|
01e557a689 | ||
|
|
b8b01558ce | ||
|
|
08c90e0909 | ||
|
|
052408982a | ||
|
|
68c57cc4eb | ||
|
|
9eb4f3f843 | ||
|
|
4ad7b38648 | ||
|
|
ce2463588d | ||
|
|
9804e3eca0 | ||
|
|
e9fb3a3ebb | ||
|
|
b65b97870f | ||
|
|
0c243e0dc2 | ||
|
|
d88b1fbec0 | ||
|
|
0781cb1d41 | ||
|
|
eb2ed341a2 | ||
|
|
e5f6824304 | ||
|
|
880124bbe0 | ||
|
|
b719fd1c15 | ||
|
|
464b431741 | ||
|
|
ff0e4f50da | ||
|
|
8ba23e84ca | ||
|
|
4cbddf66d3 | ||
|
|
9ba9c3b9c5 | ||
|
|
adbcc07bae | ||
|
|
83ed6a4297 | ||
|
|
1c07974f6c | ||
|
|
c3e430b472 | ||
|
|
a8fef06aa8 | ||
|
|
281eb346a5 | ||
|
|
15c8bd7d6d | ||
|
|
d0d1da3456 | ||
|
|
7c73ff78bc | ||
|
|
e0309dc6c0 | ||
|
|
cd6009c180 | ||
|
|
29bd4e96d6 | ||
|
|
5d5ca0d7aa | ||
|
|
e7df4b8d6d | ||
|
|
fbd8a97ffd | ||
|
|
4147ffa503 | ||
|
|
be2ef79686 | ||
|
|
120406d115 | ||
|
|
d72ae6102b | ||
|
|
4adfad8708 | ||
|
|
2e6d65378f | ||
|
|
4ec1a9af39 | ||
|
|
1109bd35e7 | ||
|
|
24dc12023b | ||
|
|
f53be57f0d | ||
|
|
9db4559b0c | ||
|
|
23a249ca0f | ||
|
|
3171958a8c | ||
|
|
422f1b2b5e | ||
|
|
fed3ec9616 | ||
|
|
751867d5b8 | ||
|
|
c4fcc59efd | ||
|
|
528bbba6ed | ||
|
|
905c05ba06 | ||
|
|
fcacf28c45 | ||
|
|
3e5d82c665 | ||
|
|
1bea7654b8 | ||
|
|
38ea778ccf | ||
|
|
31f300f6d8 | ||
|
|
4e8bb688aa | ||
|
|
563d623278 | ||
|
|
24790e8b2a | ||
|
|
58806dee68 | ||
|
|
4fda12b512 | ||
|
|
0c62465a22 | ||
|
|
785b0caaf2 | ||
|
|
3d4c50d481 | ||
|
|
c0975ed15e | ||
|
|
ce6de6efa6 | ||
|
|
561c1fc338 | ||
|
|
e94affe588 | ||
|
|
43e3648ba7 | ||
|
|
63938c6fd3 | ||
|
|
9cab4d510a | ||
|
|
41621826d8 | ||
|
|
2149030dbb | ||
|
|
8c0bd7e5e3 | ||
|
|
5283682c47 | ||
|
|
b53d20d2ee | ||
|
|
ed6bdf97d1 | ||
|
|
93cfa564f7 | ||
|
|
579b8fce96 | ||
|
|
d1d9462423 | ||
|
|
299f9c4a26 | ||
|
|
5c27e974fb | ||
|
|
53bd4b1ea9 | ||
|
|
3d10fff7de | ||
|
|
8107d65504 | ||
|
|
9a4cebfb61 | ||
|
|
5c81833415 | ||
|
|
d88ca50de0 | ||
|
|
b75b53d05a | ||
|
|
c2cae5b2fc | ||
|
|
30e962b447 | ||
|
|
f710bb535e | ||
|
|
814b02900b | ||
|
|
4958353335 | ||
|
|
9884c52c4e | ||
|
|
0cd4fc8655 | ||
|
|
5d07c5a0b2 | ||
|
|
cf20b3a3c3 | ||
|
|
dbe4acd47d | ||
|
|
b7a0f5bee5 | ||
|
|
0adb62b485 | ||
|
|
a439608fe7 | ||
|
|
e82efd24d3 | ||
|
|
3d1f3ed068 | ||
|
|
bac972de53 | ||
|
|
95310991b8 | ||
|
|
f60a759dca | ||
|
|
4f6f829dc3 | ||
|
|
8962ebd175 | ||
|
|
218b3c87db | ||
|
|
c12a0f8cdf | ||
|
|
4a41ccb4e6 | ||
|
|
0d1f53d58d | ||
|
|
fea07917fa | ||
|
|
003c2e0dca | ||
|
|
ce38ef6289 | ||
|
|
2457c58817 | ||
|
|
ab6dd66bad | ||
|
|
d430fe35c5 | ||
|
|
9650c71155 | ||
|
|
95da7551d2 | ||
|
|
667473f90e | ||
|
|
cf9e17ebfd | ||
|
|
ec55909305 | ||
|
|
3e03f7c12a | ||
|
|
edc2005b2c | ||
|
|
72f3fa6eda | ||
|
|
48c02c6f55 | ||
|
|
8b7643332b | ||
|
|
639619ff93 | ||
|
|
0a08ef0ed4 | ||
|
|
b3f35c579b | ||
|
|
bcb74d01b6 | ||
|
|
8a8b88af13 | ||
|
|
58ed405c88 | ||
|
|
a3d4f80599 | ||
|
|
7bfd55f3f0 | ||
|
|
153b5de1d4 | ||
|
|
932b7a094d | ||
|
|
47b8c661e7 | ||
|
|
3bb0f51d08 | ||
|
|
32fc5ccd3e | ||
|
|
4f3cba32da | ||
|
|
b2c60ba884 | ||
|
|
537ed2d11f | ||
|
|
f318cc5e28 | ||
|
|
1001cc607e | ||
|
|
35d480bc48 | ||
|
|
37f51ef983 | ||
|
|
943d7ce31a | ||
|
|
bc54ddf19f | ||
|
|
7d091d18ee | ||
|
|
599e24634c | ||
|
|
e998edd083 | ||
|
|
e15ca55558 | ||
|
|
23a2801284 | ||
|
|
9a6da3f46f | ||
|
|
fbb881bb42 | ||
|
|
87d65c150b | ||
|
|
bb2fcd5b00 |
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
-9
@@ -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,21 +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
|
||||||
venv26
|
.eggs
|
||||||
venv27
|
.mypy_cache
|
||||||
venv33
|
.pytest_cache
|
||||||
venv34
|
.tox
|
||||||
venv35
|
|
||||||
venv36
|
venv*
|
||||||
|
testconf*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
tests/cypress/screenshots
|
||||||
|
tests/cypress/videos
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
language: python
|
|
||||||
python:
|
|
||||||
- "2.7"
|
|
||||||
install:
|
|
||||||
- pip install -e .[develop]
|
|
||||||
script:
|
|
||||||
- nosetests --with-doctest
|
|
||||||
sudo: false
|
|
||||||
git:
|
|
||||||
depth: 250
|
|
||||||
+15
-9
@@ -18,16 +18,22 @@ prerelease
|
|||||||
HEAD
|
HEAD
|
||||||
\(detached.*
|
\(detached.*
|
||||||
|
|
||||||
# maintenance is currently the branch for preparation of maintenance release 1.3.12
|
# 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.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
|
maintenance 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
||||||
fix/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
|
fix/.* 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
||||||
improve/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
|
improve/.* 1.4.3 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
||||||
|
|
||||||
# staging/maintenance is currently the branch for preparation of 1.3.12rc2
|
# 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.3.12rc2 2a42f02aecaedf2c55579984e0bc94e44402cc15 pep440-dev
|
staging/maintenance 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev
|
||||||
regressionfix/.* 1.3.12rc2 2a42f02aecaedf2c55579984e0bc94e44402cc15 pep440-dev
|
regressionfix/.* 1.4.1rc5 458ab91f915307857941f839a1b743430b8786a4 pep440-dev
|
||||||
|
|
||||||
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
|
# staging/devel is currently inactive (but has the 1.4.1rc4 namespace)
|
||||||
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
|
staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev
|
||||||
|
|
||||||
|
# every other branch is a development branch and thus gets resolved to 2.0.0.dev for now
|
||||||
|
.* 2.0.0 2da7aa358d950b4567aaab8f18d6b5779193e077 pep440-dev
|
||||||
+15
-1
@@ -69,12 +69,13 @@ date of first contribution):
|
|||||||
* [Philipp Baum](https://github.com/philphilphil)
|
* [Philipp Baum](https://github.com/philphilphil)
|
||||||
* [Kyle Evans](https://github.com/kevans91)
|
* [Kyle Evans](https://github.com/kevans91)
|
||||||
* [Javier Martínez Arrieta](https://github.com/Javierma)
|
* [Javier Martínez Arrieta](https://github.com/Javierma)
|
||||||
* ["MirceaDan"](https://github.com/ByReaL)
|
* [Mircea Dan Gheorghe](https://github.com/ByReaL)
|
||||||
* [Ovidiu Hossu](https://github.com/MoonshineSG)
|
* [Ovidiu Hossu](https://github.com/MoonshineSG)
|
||||||
* [Eyck Jentzsch](https://github.com/eyck)
|
* [Eyck Jentzsch](https://github.com/eyck)
|
||||||
* [Mathias Rangel Wulff](https://github.com/mathiasrw)
|
* [Mathias Rangel Wulff](https://github.com/mathiasrw)
|
||||||
* [Clemens Niemeyer](https://github.com/clemniem)
|
* [Clemens Niemeyer](https://github.com/clemniem)
|
||||||
* ["I-am-me"](https://github.com/I-am-me)
|
* ["I-am-me"](https://github.com/I-am-me)
|
||||||
|
* [J-J Heinonen](https://github.com/jammi)
|
||||||
* [Noah Martin](https://github.com/noahsmartin)
|
* [Noah Martin](https://github.com/noahsmartin)
|
||||||
* [Eyal Soha](https://github.com/eyal0)
|
* [Eyal Soha](https://github.com/eyal0)
|
||||||
* [Greg Hulands](https://github.com/ghulands)
|
* [Greg Hulands](https://github.com/ghulands)
|
||||||
@@ -91,11 +92,13 @@ date of first contribution):
|
|||||||
* [Ganey](https://github.com/ganey)
|
* [Ganey](https://github.com/ganey)
|
||||||
* [Sven Lohrmann](https://github.com/malnvenshorn)
|
* [Sven Lohrmann](https://github.com/malnvenshorn)
|
||||||
* [Andy Castille](https://github.com/klikini)
|
* [Andy Castille](https://github.com/klikini)
|
||||||
|
* [Zachary Nofzinger](https://github.com/ZachNo)
|
||||||
* [Gaston Dombiak](https://github.com/gdombiak)
|
* [Gaston Dombiak](https://github.com/gdombiak)
|
||||||
* [Brad Fisher](https://github.com/bradcfisher)
|
* [Brad Fisher](https://github.com/bradcfisher)
|
||||||
* [Aldo Hoeben](https://github.com/fieldofview)
|
* [Aldo Hoeben](https://github.com/fieldofview)
|
||||||
* [Henning Groß](https://github.com/hgross)
|
* [Henning Groß](https://github.com/hgross)
|
||||||
* [Jubaleth](https://github.com/jubaleth)
|
* [Jubaleth](https://github.com/jubaleth)
|
||||||
|
* [Matthias Urlichs](https://github.com/smurfix)
|
||||||
* [Daniel Joyce](https://github.com/DanielJoyce)
|
* [Daniel Joyce](https://github.com/DanielJoyce)
|
||||||
* [Andy Qua](https://github.com/AndyQ)
|
* [Andy Qua](https://github.com/AndyQ)
|
||||||
* [Fabio Santos](https://github.com/Fabi0San)
|
* [Fabio Santos](https://github.com/Fabi0San)
|
||||||
@@ -108,6 +111,17 @@ date of first contribution):
|
|||||||
* [Piotr Usewicz](https://github.com/pusewicz)
|
* [Piotr Usewicz](https://github.com/pusewicz)
|
||||||
* [Aliaksei Pilko](https://github.com/aliaksei135)
|
* [Aliaksei Pilko](https://github.com/aliaksei135)
|
||||||
* [Ben Yarmis](https://github.com/byarmis)
|
* [Ben Yarmis](https://github.com/byarmis)
|
||||||
|
* [Florian Heilmann](https://github.com/FHeilmann)
|
||||||
|
* [Ludovico de Nittis](https://github.com/RyuzakiKK)
|
||||||
|
* [Dominik Paľo](https://github.com/DominikPalo)
|
||||||
|
* [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
|
||||||
|
|||||||
+3
-1282
File diff suppressed because it is too large.
Load diff
@@ -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, 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,19 +85,15 @@ 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 .
|
OctoPrint currently supports Python 2.7, 3.6 and 3.7.
|
||||||
|
|
||||||
You should do this every time after pulling from the repository, since the dependencies may have changed.
|
|
||||||
|
|
||||||
OctoPrint currently only supports Python 2.7.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
+26
-20
@@ -1,59 +1,65 @@
|
|||||||
# 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
|
||||||
|
|
||||||
* Andre Bubel
|
|
||||||
* Andrew Moorby
|
* Andrew Moorby
|
||||||
* ANTONIO AUGUSTO DE LIMA PONTES
|
|
||||||
* Arnljot Arntsen
|
* Arnljot Arntsen
|
||||||
|
* Ash King
|
||||||
|
* BigTreeTech
|
||||||
* Boris Hussein
|
* Boris Hussein
|
||||||
* Brad Jackson
|
* Brad Jackson
|
||||||
|
* BuildBee
|
||||||
* Christian Petropolis
|
* Christian Petropolis
|
||||||
* Christian Wolf
|
* Christian Wolf
|
||||||
* COLLE+McVOY
|
|
||||||
* D Brian Kimmel
|
* D Brian Kimmel
|
||||||
* DeltaMaker 3D Printers
|
* DeltaMaker 3D Printers
|
||||||
* Dorian Gray
|
* Dennis Breining
|
||||||
* E3D BigBox
|
|
||||||
* Eric Betts
|
* Eric Betts
|
||||||
* Ernesto Martinez
|
* Ernesto Martinez
|
||||||
* Franziska Kunsmann
|
* Franziska Kunsmann
|
||||||
|
* GadgetAngel
|
||||||
* George Robles
|
* George Robles
|
||||||
|
* Greg Holloway
|
||||||
|
* Hog Duske
|
||||||
|
* Hugh Blemings
|
||||||
* jean-claude migneault
|
* jean-claude migneault
|
||||||
* Jeff Renfer
|
* Jeremy Cole
|
||||||
* Jefferson Hunt
|
* Joe Pasqua
|
||||||
* Jeremiah Avery
|
* John Robinson
|
||||||
* Joshua Wills
|
* Joshua Wills
|
||||||
* Justin Kaufman
|
* Justin Kaufman
|
||||||
* Kaile Riser
|
* Kaile Riser
|
||||||
* Kale Stedman
|
* Kale Stedman
|
||||||
* Kazuhiro Ogura
|
* Kazuhiro Ogura
|
||||||
|
* Kenneth Jiang
|
||||||
|
* Kurt Wubbels
|
||||||
|
* Kyle Menigoz
|
||||||
* LA 3D Printer Repair
|
* LA 3D Printer Repair
|
||||||
* Lee Dohm
|
* Lee Dohm
|
||||||
* LulzBot®
|
|
||||||
* Makespace Madrid
|
* Makespace Madrid
|
||||||
* Mark Walker
|
* Mark Walker
|
||||||
* Michael Aumock
|
* Michael Aumock
|
||||||
* Miles Flavel
|
* Miles Flavel
|
||||||
* Mosaic Manufacturing
|
* Mosaic Manufacturing
|
||||||
* OMER MEHMET SUTAS
|
* 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
|
||||||
* Robert Gusek
|
* Robert Gusek
|
||||||
* Samer Najia
|
* Ronald Griehsler
|
||||||
* Shawn Lewis
|
* Sacha Telgenhof
|
||||||
* Simon Hallam
|
* Sebastien Andrivet
|
||||||
* Stefan Krister
|
* Stefan Krister
|
||||||
|
* Steve Thompson
|
||||||
|
* Stewart Danos
|
||||||
* Sven Mueller
|
* Sven Mueller
|
||||||
* Trent Shumay
|
|
||||||
* Ulrich Kempken
|
* Ulrich Kempken
|
||||||
* Vladislav Kuzemchik
|
|
||||||
|
|
||||||
and 1615 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)!
|
||||||
+12
-1
@@ -9,6 +9,7 @@
|
|||||||
* [Bootstrap Slider Knockout Binding](https://github.com/cosminstefanxp/bootstrap-slider-knockout-binding): MIT
|
* [Bootstrap Slider Knockout Binding](https://github.com/cosminstefanxp/bootstrap-slider-knockout-binding): MIT
|
||||||
* [Bootstrap Slider](http://seiyria.com/bootstrap-slider/): Apache License 2.0
|
* [Bootstrap Slider](http://seiyria.com/bootstrap-slider/): Apache License 2.0
|
||||||
* [Bootstrap Tabdrop](http://www.eyecon.ro/bootstrap-tabdrop): Apache License 2.0
|
* [Bootstrap Tabdrop](http://www.eyecon.ro/bootstrap-tabdrop): Apache License 2.0
|
||||||
|
* [css-element-queries](https://github.com/marcj/css-element-queries): MIT
|
||||||
* [Detect Mobile Browser](http://detectmobilebrowsers.com/): Public Domain
|
* [Detect Mobile Browser](http://detectmobilebrowsers.com/): Public Domain
|
||||||
* [Flot](http://www.flotcharts.org/): MIT
|
* [Flot](http://www.flotcharts.org/): MIT
|
||||||
* [JavaScript MD5](https://github.com/blueimp/JavaScript-MD5): MIT
|
* [JavaScript MD5](https://github.com/blueimp/JavaScript-MD5): MIT
|
||||||
@@ -23,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
|
||||||
|
|
||||||
@@ -38,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
|
||||||
@@ -57,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."
|
|
||||||
@@ -0,0 +1,529 @@
|
|||||||
|
.. _sec-api-access:
|
||||||
|
|
||||||
|
**************
|
||||||
|
Access control
|
||||||
|
**************
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
|
||||||
|
.. _sec-api-access-permissions:
|
||||||
|
|
||||||
|
Permissions
|
||||||
|
===========
|
||||||
|
|
||||||
|
.. _sec-api-access-permissions-list:
|
||||||
|
|
||||||
|
List all permissions
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
.. http:get:: /api/access/permissions
|
||||||
|
|
||||||
|
Retrieves all permissions available in the system.
|
||||||
|
|
||||||
|
Will return a :http:statuscode:`200` with a :ref:`permission list <sec-api-access-datamodel-permissions-list>`
|
||||||
|
as body.
|
||||||
|
|
||||||
|
:status 200: No error
|
||||||
|
|
||||||
|
.. _sec-api-access-groups:
|
||||||
|
|
||||||
|
Groups
|
||||||
|
======
|
||||||
|
|
||||||
|
.. _sec-api-access-groups-list:
|
||||||
|
|
||||||
|
Get group list
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. http:get:: /api/access/groups
|
||||||
|
|
||||||
|
Retrieves all groups registered in the system.
|
||||||
|
|
||||||
|
Will return a :http:statuscode:`200` with a :ref:`group list <sec-api-access-datamodel-groups-list>`
|
||||||
|
as body.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:status 200: No error
|
||||||
|
|
||||||
|
.. _sec-api-access-groups-add:
|
||||||
|
|
||||||
|
Add a new group
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. http:post:: /api/access/groups
|
||||||
|
|
||||||
|
Adds a new group to the system.
|
||||||
|
|
||||||
|
Expects a :ref:`group registration request <sec-api-access-datamodel-groups-addgrouprequest>` as request body.
|
||||||
|
|
||||||
|
Will return a :ref:`group list response <sec-api-access-datamodel-groups-list>` on success.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:json key: The group's identifier
|
||||||
|
:json name: The user's name
|
||||||
|
:json description: A human readable description of the group
|
||||||
|
:json permissions: The permissions to assign to the group
|
||||||
|
:json subgroups: Subgroups assigned to the group
|
||||||
|
:json default: Whether the group should be assigned to new users by default or not
|
||||||
|
:status 200: No error
|
||||||
|
:status 400: If any of the mandatory fields is missing or the request is otherwise
|
||||||
|
invalid
|
||||||
|
:status 409: A group with the provided key does already exist
|
||||||
|
|
||||||
|
.. _sec-api-access-groups-retrieve:
|
||||||
|
|
||||||
|
Retrieve a group
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. http:get:: /api/access/groups/(string:key)
|
||||||
|
|
||||||
|
Retrieves an individual group record.
|
||||||
|
|
||||||
|
Will return a :http:statuscode:`200` with a :ref:`group record <sec-api-access-datamodel-groups-grouprecord>`
|
||||||
|
as body.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:status 200: No error
|
||||||
|
|
||||||
|
.. _sec-api-access-groups-modify:
|
||||||
|
|
||||||
|
Update a group
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. http:put:: /api/access/groups/(string:key)
|
||||||
|
|
||||||
|
Updates an existing group.
|
||||||
|
|
||||||
|
Expects a :ref:`group update request <sec-api-access-datamodel-groups-updategrouprequest>` as request body.
|
||||||
|
|
||||||
|
Will return a :ref:`group list response <sec-api-access-datamodel-groups-list>` on success.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:json description: A human readable description of the group
|
||||||
|
:json permissions: The permissions to assign to the group
|
||||||
|
:json subgroups: Subgroups assigned to the group
|
||||||
|
:json default: Whether the group should be assigned to new users by default or not
|
||||||
|
:status 200: No error
|
||||||
|
:status 400: If any of the mandatory fields is missing or the request is otherwise
|
||||||
|
invalid
|
||||||
|
|
||||||
|
.. _sec-api-access-groups-delete:
|
||||||
|
|
||||||
|
Delete a group
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. http:delete:: /api/access/groups/(string:key)
|
||||||
|
|
||||||
|
Deletes a group.
|
||||||
|
|
||||||
|
Will return a :ref:`group list response <sec-api-access-datamodel-groups-list>` on success.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:status 200: No error
|
||||||
|
|
||||||
|
.. _sec-api-access-users:
|
||||||
|
|
||||||
|
Users
|
||||||
|
=====
|
||||||
|
|
||||||
|
.. _sec-api-access-users-list:
|
||||||
|
|
||||||
|
Retrieve a list of users
|
||||||
|
========================
|
||||||
|
|
||||||
|
.. http:get:: /api/access/users
|
||||||
|
|
||||||
|
Retrieves a list of all registered users in OctoPrint.
|
||||||
|
|
||||||
|
Will return a :http:statuscode:`200` with a :ref:`user list response <sec-api-access-datamodel-users-userlistresponse>`
|
||||||
|
as body.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:status 200: No error
|
||||||
|
|
||||||
|
.. _sec-api-access-users-retrieve:
|
||||||
|
|
||||||
|
Retrieve a user
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. http:get:: /api/access/users/(string:username)
|
||||||
|
|
||||||
|
Retrieves information about a user.
|
||||||
|
|
||||||
|
Will return a :http:statuscode:`200` with a :ref:`user record <sec-api-access-datamodel-users-userrecord>`
|
||||||
|
as body.
|
||||||
|
|
||||||
|
Requires either the ``SETTINGS`` permission or to be logged in as the user.
|
||||||
|
|
||||||
|
:param username: Name of the user which to retrieve
|
||||||
|
:status 200: No error
|
||||||
|
:status 404: Unknown user
|
||||||
|
|
||||||
|
.. _sec-api-access-users-add:
|
||||||
|
|
||||||
|
Add a new user
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. http:post:: /api/access/users
|
||||||
|
|
||||||
|
Adds a user to OctoPrint.
|
||||||
|
|
||||||
|
Expects a :ref:`user registration request <sec-api-access-datamodel-users-adduserrequest>`
|
||||||
|
as request body.
|
||||||
|
|
||||||
|
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-access-users-list>`.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:json name: The user's name
|
||||||
|
:json password: The user's password
|
||||||
|
:json active: Whether to activate the account (true) or not (false)
|
||||||
|
:json admin: Whether to give the account admin rights (true) or not (false)
|
||||||
|
:status 200: No error
|
||||||
|
:status 400: If any of the mandatory fields is missing or the request is otherwise
|
||||||
|
invalid
|
||||||
|
:status 409: A user with the provided name does already exist
|
||||||
|
|
||||||
|
.. _sec-api-access-users-modify:
|
||||||
|
|
||||||
|
Update a user
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. http:put:: /api/access/users/(string:username)
|
||||||
|
|
||||||
|
Updates a user record.
|
||||||
|
|
||||||
|
Expects a :ref:`user update request <sec-api-access-datamodel-users-updateuserrequest>`
|
||||||
|
as request body.
|
||||||
|
|
||||||
|
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-access-users-list>`.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:param username: Name of the user to update
|
||||||
|
:json admin: Whether to mark the user as admin (true) or not (false), can be left out (no change)
|
||||||
|
:json active: Whether to mark the account as activated (true) or deactivated (false), can be left out (no change)
|
||||||
|
:status 200: No error
|
||||||
|
:status 404: Unknown user
|
||||||
|
|
||||||
|
.. _sec-api-access-users-delete:
|
||||||
|
|
||||||
|
Delete a user
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. http:delete:: /api/access/users/(string:username)
|
||||||
|
|
||||||
|
Delete a user record.
|
||||||
|
|
||||||
|
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-access-users-list>`.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:param username: Name of the user to delete
|
||||||
|
:status 200: No error
|
||||||
|
:status 404: Unknown user
|
||||||
|
|
||||||
|
.. _sec-api-access-users-password:
|
||||||
|
|
||||||
|
Change a user's password
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. http:put:: /api/access/users/(string:username)/password
|
||||||
|
|
||||||
|
Changes the password of a user.
|
||||||
|
|
||||||
|
Expects a JSON object with a single property ``password`` as request body.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission or to be logged in as the user.
|
||||||
|
|
||||||
|
:param username: Name of the user to change the password for
|
||||||
|
:json password: The new password to set
|
||||||
|
:status 200: No error
|
||||||
|
:status 400: If the request doesn't contain a ``password`` property or the request
|
||||||
|
is otherwise invalid
|
||||||
|
:status 403: No admin rights and not logged in as the user
|
||||||
|
:status 404: The user is unknown
|
||||||
|
|
||||||
|
.. _sec-api-access-users-settings-get:
|
||||||
|
|
||||||
|
Get a user's settings
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
.. http:get:: /api/access/users/(string:username)/settings
|
||||||
|
|
||||||
|
Retrieves a user's settings.
|
||||||
|
|
||||||
|
Will return a :http:statuscode:`200` with a JSON object representing the user's
|
||||||
|
personal settings (if any) as body.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission or to be logged in as the user.
|
||||||
|
|
||||||
|
:param username: Name of the user to retrieve the settings for
|
||||||
|
:status 200: No error
|
||||||
|
:status 403: No admin rights and not logged in as the user
|
||||||
|
:status 404: The user is unknown
|
||||||
|
|
||||||
|
.. _sec-api-access-users-settings-set:
|
||||||
|
|
||||||
|
Update a user's settings
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. http:patch:: /api/access/users/(string:username)/settings
|
||||||
|
|
||||||
|
Updates a user's settings.
|
||||||
|
|
||||||
|
Expects a new settings JSON object to merge with the current settings as
|
||||||
|
request body.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission or to be logged in as the user.
|
||||||
|
|
||||||
|
:param username: Name of the user to retrieve the settings for
|
||||||
|
:status 204: No error
|
||||||
|
:status 403: No admin rights and not logged in as the user
|
||||||
|
:status 404: The user is unknown
|
||||||
|
|
||||||
|
.. _sec-api-access-users-apikey-generate:
|
||||||
|
|
||||||
|
Regenerate a user's api key
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
.. http:post:: /api/access/users/(string:username)/apikey
|
||||||
|
|
||||||
|
Generates a new API key for the user.
|
||||||
|
|
||||||
|
Does not expect a body. Will return the generated API key as ``apikey``
|
||||||
|
property in the JSON object contained in the response body.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission or to be logged in as the user.
|
||||||
|
|
||||||
|
:param username: Name of the user to retrieve the settings for
|
||||||
|
:status 200: No error
|
||||||
|
:status 403: No admin rights and not logged in as the user
|
||||||
|
:status 404: The user is unknown
|
||||||
|
|
||||||
|
.. _sec-api-access-users-apikey-delete:
|
||||||
|
|
||||||
|
Delete a user's api key
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. http:delete:: /api/access/users/(string:username)/apikey
|
||||||
|
|
||||||
|
Deletes a user's personal API key.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission or to be logged in as the user.
|
||||||
|
|
||||||
|
:param username: Name of the user to retrieve the settings for
|
||||||
|
:status 204: No error
|
||||||
|
:status 403: No admin rights and not logged in as the user
|
||||||
|
:status 404: The user is unknown
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel:
|
||||||
|
|
||||||
|
Data model
|
||||||
|
==========
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-permissions:
|
||||||
|
|
||||||
|
Permissions
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-permissions-list:
|
||||||
|
|
||||||
|
Permission list response
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``permissions``
|
||||||
|
- 0..n
|
||||||
|
- List of :ref:`permission records <sec-api-datamodel-access-permissions>`
|
||||||
|
- The list of permissions
|
||||||
|
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-groups:
|
||||||
|
|
||||||
|
Groups
|
||||||
|
------
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-groups-list:
|
||||||
|
|
||||||
|
Group list response
|
||||||
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``groups``
|
||||||
|
- 0..n
|
||||||
|
- List of :ref:`group records <sec-api-datamodel-access-groups>`
|
||||||
|
- The list of groups
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-groups-addgrouprequest:
|
||||||
|
|
||||||
|
Group registration request
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``key``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The group's identifier
|
||||||
|
* - ``name``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The group's name
|
||||||
|
* - ``description``
|
||||||
|
- 0..1
|
||||||
|
- string
|
||||||
|
- The group's description. Set to empty if not provided.
|
||||||
|
* - ``permissions``
|
||||||
|
- 1..n
|
||||||
|
- List of string
|
||||||
|
- A list of identifier's of permissions to assign to the group
|
||||||
|
* - ``subgroups``
|
||||||
|
- 0..n
|
||||||
|
- List of string
|
||||||
|
- A list of identifier's of groups to assign to the group as subgroups
|
||||||
|
* - ``default``
|
||||||
|
- 0..1
|
||||||
|
- boolean
|
||||||
|
- Whether to assign the group to new users by default (true) or not (false, default value)
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-groups-updategrouprequest:
|
||||||
|
|
||||||
|
Group update request
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``description``
|
||||||
|
- 0..1
|
||||||
|
- string
|
||||||
|
- The group's description. Set to empty if not provided.
|
||||||
|
* - ``permissions``
|
||||||
|
- 1..n
|
||||||
|
- List of string
|
||||||
|
- A list of identifier's of permissions to assign to the group
|
||||||
|
* - ``subgroups``
|
||||||
|
- 0..n
|
||||||
|
- List of string
|
||||||
|
- A list of identifier's of groups to assign to the group as subgroups
|
||||||
|
* - ``default``
|
||||||
|
- 0..1
|
||||||
|
- boolean
|
||||||
|
- Whether to assign the group to new users by default (true) or not (false, default value)
|
||||||
|
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-users:
|
||||||
|
|
||||||
|
Users
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-users-userlistresponse:
|
||||||
|
|
||||||
|
User list response
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``users``
|
||||||
|
- 0..n
|
||||||
|
- List of :ref:`user records <sec-api-datamodel-access-users>`
|
||||||
|
- The list of users
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-users-adduserrequest:
|
||||||
|
|
||||||
|
User registration request
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``name``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The user's name
|
||||||
|
* - ``password``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The user's password
|
||||||
|
* - ``active``
|
||||||
|
- 1
|
||||||
|
- bool
|
||||||
|
- Whether to activate the account (true) or not (false)
|
||||||
|
* - ``groups``
|
||||||
|
- 0..n
|
||||||
|
- List of string
|
||||||
|
- A list of identifiers of groups to assign to the user
|
||||||
|
* - ``permissions``
|
||||||
|
- 0..n
|
||||||
|
- List of string
|
||||||
|
- A list of identifiers of permissions to assign to the user
|
||||||
|
|
||||||
|
.. _sec-api-access-datamodel-users-updateuserrequest:
|
||||||
|
|
||||||
|
User update request
|
||||||
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``active``
|
||||||
|
- 0..1
|
||||||
|
- bool
|
||||||
|
- If present will set the user's active flag to the provided value. True for
|
||||||
|
activating the account, false for deactivating it.
|
||||||
|
* - ``groups``
|
||||||
|
- 0..n
|
||||||
|
- List of string
|
||||||
|
- A list of identifiers of groups to assign to the user
|
||||||
|
* - ``permissions``
|
||||||
|
- 0..n
|
||||||
|
- List of string
|
||||||
|
- A list of identifiers of permissions to assign to the user
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
.. _sec-api-apps:
|
|
||||||
|
|
||||||
****
|
|
||||||
Apps
|
|
||||||
****
|
|
||||||
|
|
||||||
.. contents::
|
|
||||||
|
|
||||||
.. _sec-api-apps-sessionkey:
|
|
||||||
|
|
||||||
Session Keys
|
|
||||||
============
|
|
||||||
|
|
||||||
.. deprecated:: 1.3.11
|
|
||||||
|
|
||||||
This functionality will be removed in 1.4.0. Use the :ref:`Application Keys Plugin workflow <sec-bundledplugins-appkeys-workflow>` instead.
|
|
||||||
|
|
||||||
OctoPrint offers a special API key type for apps to use, the so called App Session Key. These keys have a time based
|
|
||||||
validity and are generated by OctoPrint for requesting apps.
|
|
||||||
|
|
||||||
Obtaining those keys is based on a handshake procedure backed by cryptographic signatures using RSA. OctoPrint needs to
|
|
||||||
be aware of apps and their associated public keys (this can be achieved either via entries in ``config.yaml`` or by
|
|
||||||
installing app specific plugins which implement the ``AppPlugin`` type).
|
|
||||||
|
|
||||||
Apps can be registered within OctoPrint via ``config.yaml`` by adding them to the ``api`` > ``apps`` section, using the
|
|
||||||
application's id concatenated with its version as key, with the public key provided as item ``pubkey`` (stripped of the
|
|
||||||
``BEGIN RSA PUBLIC KEY`` and ``END RSA PUBLIC KEY`` separators and also newlines) and optionally also whether the app is
|
|
||||||
enabled or not (defaults to enabled, so can be left out if it's not to be set to disabled explicitly).
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
.. sourcecode:: yaml
|
|
||||||
|
|
||||||
api:
|
|
||||||
apps:
|
|
||||||
"com.example.my_octoprint_app:0.9":
|
|
||||||
pubkey: MEgCQQDYkr5Fv/YXK5ZL1uwRN4A61IagZaYLGqJ5JJGFo8wDrmpAMRqE9kK4+5hIDblC5DzfEr5oP7OA3tRO48Rf5yInAgMBAAE=
|
|
||||||
enabled: false
|
|
||||||
"com.example.my_octoprint_app:1.0":
|
|
||||||
pubkey: MEgCQQCIWfi7Nc8bcnfZJJtA6a4RyMC+sKBlMOb25OVNNB4L2v0TiGO72jVKR4osvb4oztlbRW5GkdiY0T2LJcfDYvkJAgMBAAE=
|
|
||||||
|
|
||||||
In the example, the app ``com.example.my_octoprint_app`` in version 0.9 has been disabled (e.g. due to the key having
|
|
||||||
leaked) whereas version 1.0 is fully registered with OctoPrint and may verify app session keys.
|
|
||||||
|
|
||||||
|
|
||||||
.. _sec-api-apps-sessionkey-workflow:
|
|
||||||
|
|
||||||
Workflow
|
|
||||||
--------
|
|
||||||
|
|
||||||
Apps perform the handshake by first requesting a temporary key with very limited validity,
|
|
||||||
then sending a message back to OctoPrint containing their id, version, the temporary key and a signature created with their
|
|
||||||
private key over these three pieces of data. OctoPrint then tries to verify the signature and if successful unlocks the
|
|
||||||
key to be used as a fully recognized API key.
|
|
||||||
|
|
||||||
For performing the handshake a special API exists within OctoPrint for which no API key is needed which is described below.
|
|
||||||
|
|
||||||
.. _sec-api-apps-sessionkey-get:
|
|
||||||
|
|
||||||
Obtaining a temporary session key
|
|
||||||
---------------------------------
|
|
||||||
|
|
||||||
.. http:get:: /apps/auth
|
|
||||||
|
|
||||||
Retrieve a temporary session key with a minimum validity. It can only be used as a proper API key after having been
|
|
||||||
:ref:`verified <sec-api-apps-sessionkey-verify>`.
|
|
||||||
|
|
||||||
Returns the temporary session key and the timestamp until it's valid.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
|
|
||||||
.. sourcecode:: http
|
|
||||||
|
|
||||||
GET /apps/auth HTTP/1.1
|
|
||||||
Host: example.com
|
|
||||||
|
|
||||||
.. sourcecode:: http
|
|
||||||
|
|
||||||
HTTP/1.1 200 OK
|
|
||||||
Content-Type: application/json
|
|
||||||
|
|
||||||
{
|
|
||||||
"unverifiedKey": "F43A844750F74AD080FE9F438D47B33C",
|
|
||||||
"validUntil": 1416220357.011
|
|
||||||
}
|
|
||||||
|
|
||||||
:statuscode 200: No error
|
|
||||||
|
|
||||||
.. _sec-api-apps-sessionkey-verify:
|
|
||||||
|
|
||||||
Verifying a temporary session key
|
|
||||||
---------------------------------
|
|
||||||
|
|
||||||
.. http:post:: /apps/auth
|
|
||||||
|
|
||||||
Verify a formerly :ref:`retrieved <sec-api-apps-sessionkey-get>` temporary session key by providing credentials and a
|
|
||||||
cryptographic signature over these credentials and the temporary key.
|
|
||||||
|
|
||||||
Returns the now verified session key and the new validity.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
|
|
||||||
.. sourcecode:: http
|
|
||||||
|
|
||||||
POST /apps/auth HTTP/1.1
|
|
||||||
Host: example.com
|
|
||||||
Content-Type: application/json
|
|
||||||
|
|
||||||
{
|
|
||||||
"appid": "com.example.my_octoprint_app",
|
|
||||||
"appversion": "1.0",
|
|
||||||
"key": "F43A844750F74AD080FE9F438D47B33C",
|
|
||||||
"_sig": "LGVCiolQWDc4AVn1DOcWljY0cFQxWF4pldVveUjjmL9JhiL0LnCKBbGwZ/CwKBWswFAxPaxQ0kDusVdOmCUa/w=="
|
|
||||||
}
|
|
||||||
|
|
||||||
.. sourcecode:: http
|
|
||||||
|
|
||||||
HTTP/1.1 200 OK
|
|
||||||
Content-Type: application/json
|
|
||||||
|
|
||||||
{
|
|
||||||
"key": "F43A844750F74AD080FE9F438D47B33C",
|
|
||||||
"validUntil": 1416227497.011
|
|
||||||
}
|
|
||||||
|
|
||||||
.. _sec-api-apps-sessionkey-signature:
|
|
||||||
|
|
||||||
Creating the signature
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
The signature is created by concatenating the ``appid``, ``appversion`` and ``key`` fields, separated by a ``:`` (colon),
|
|
||||||
signing the result with the app's private key using SHA-1 and then BASE64-encoding the result, stripping newlines.
|
|
||||||
|
|
||||||
Example for signature generation using Python and the `Python RSA library <https://pypi.python.org/pypi/rsa>`_:
|
|
||||||
|
|
||||||
.. sourcecode:: python
|
|
||||||
|
|
||||||
import base64
|
|
||||||
import rsa
|
|
||||||
|
|
||||||
appid = "com.example.my_octoprint_app"
|
|
||||||
version = "1.0"
|
|
||||||
unverified_key = "F43A844750F74AD080FE9F438D47B33C"
|
|
||||||
message_to_sign = appid + ":" + version + ":" + unverified_key
|
|
||||||
// => "com.example.my_octoprint_app:1.0:F43A844750F74AD080FE9F438D47B33C"
|
|
||||||
|
|
||||||
private_key = rsa.PrivateKey.load_pkcs1("...")
|
|
||||||
signature = base64.encodestring(rsa.sign(message_to_sign, private_key, "SHA-1")).replace("\n", "")
|
|
||||||
// => "LGVCiolQWDc4AVn1DOcWljY0cFQxWF4pldVveUjjmL9JhiL0LnCKBbGwZ/CwKBWswFAxPaxQ0kDusVdOmCUa/w=="
|
|
||||||
|
|
||||||
|
|
||||||
.. _sec-api-apps-sessionkey-testing:
|
|
||||||
|
|
||||||
Testing your implementation
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
If you want to use app session keys, here is the key pair with which the above examples were created, in order for you
|
|
||||||
to verify your signature implementation::
|
|
||||||
|
|
||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIIBPQIBAAJBAIhZ+Ls1zxtyd9kkm0DprhHIwL6woGUw5vbk5U00Hgva/ROIY7va
|
|
||||||
NUpHiiy9vijO2VtFbkaR2JjRPYslx8Ni+QkCAwEAAQJARK4lFo+FEcs3yR2iQjEy
|
|
||||||
p+yaAbNQJ4hZXlVvltLAYICzOM3kyKx53/eKU59NjskLz9q6QxfleymYPWAgl4NW
|
|
||||||
fQIjAJVH8MjwNcaAquTM9z2OiFi3OC8WgaKOi5W/T+r2+B70wG8CHwDp08dqOZ/u
|
|
||||||
xcBiy4Wzpcme9bckqoVuS3gWMm+YqgcCIwCMFU07kkY0NyumtzxPdIA4F/7OGSWf
|
|
||||||
IHqWFEfvasAddHlbAh8A5UgkB3Zf7Bt+7aFSBnlvve6FWm/XDPL12xYztYgrAiIa
|
|
||||||
W3miN6FjIm+8TDowrk+nyYXG2GZefeY7QXOjYr6tlDn0
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
||||||
|
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
|
||||||
MEgCQQCIWfi7Nc8bcnfZJJtA6a4RyMC+sKBlMOb25OVNNB4L2v0TiGO72jVKR4os
|
|
||||||
vb4oztlbRW5GkdiY0T2LJcfDYvkJAgMBAAE=
|
|
||||||
-----END RSA PUBLIC KEY-----
|
|
||||||
|
|
||||||
@@ -16,6 +16,8 @@ Get connection settings
|
|||||||
Retrieve the current connection settings, including information regarding the available baudrates and
|
Retrieve the current connection settings, including information regarding the available baudrates and
|
||||||
serial ports and the current connection state.
|
serial ports and the current connection state.
|
||||||
|
|
||||||
|
Requires the ``STATUS`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
@@ -81,7 +83,7 @@ Issue a connection command
|
|||||||
for the lost acknowledgment should always be properly investigated and removed instead of depending on this
|
for the lost acknowledgment should always be properly investigated and removed instead of depending on this
|
||||||
"symptom solver".
|
"symptom solver".
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``CONNECTION`` permission.
|
||||||
|
|
||||||
**Example Connect Request**
|
**Example Connect Request**
|
||||||
|
|
||||||
|
|||||||
@@ -480,3 +480,173 @@ References
|
|||||||
- URL
|
- URL
|
||||||
- The model from which this file was generated (e.g. an STL, currently not used). Never present for
|
- The model from which this file was generated (e.g. an STL, currently not used). Never present for
|
||||||
folders.
|
folders.
|
||||||
|
|
||||||
|
.. _sec-api-datamodel-access:
|
||||||
|
|
||||||
|
Access control
|
||||||
|
==============
|
||||||
|
|
||||||
|
.. _sec-api-datamodel-access-users:
|
||||||
|
|
||||||
|
User record
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``name``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The user's name
|
||||||
|
* - ``active``
|
||||||
|
- 1
|
||||||
|
- bool
|
||||||
|
- Whether the user's account is active (true) or not (false)
|
||||||
|
* - ``user``
|
||||||
|
- 1
|
||||||
|
- bool
|
||||||
|
- Whether the user has user rights. Should always be true. Deprecated as of 1.4.0, use the ``users`` group instead.
|
||||||
|
* - ``admin``
|
||||||
|
- 1
|
||||||
|
- bool
|
||||||
|
- Whether the user has admin rights (true) or not (false). Deprecated as of 1.4.0, use the ``admins`` group instead.
|
||||||
|
* - ``apikey``
|
||||||
|
- 0..1
|
||||||
|
- string
|
||||||
|
- The user's personal API key
|
||||||
|
* - ``settings``
|
||||||
|
- 1
|
||||||
|
- object
|
||||||
|
- The user's personal settings, might be an empty object.
|
||||||
|
* - ``groups``
|
||||||
|
- 1..n
|
||||||
|
- List of string
|
||||||
|
- Groups assigned to the user
|
||||||
|
* - ``needs``
|
||||||
|
- 1
|
||||||
|
- :ref:`Needs object <sec-api-datamodel-access-needs>`
|
||||||
|
- Effective needs of the user
|
||||||
|
* - ``permissions``
|
||||||
|
- 0..n
|
||||||
|
- List of :ref:`Permissions <sec-api-datamodel-access-permissions>`
|
||||||
|
- The list of permissions assigned to the user (note: this does not include implicit permissions inherit from groups).
|
||||||
|
|
||||||
|
.. _sec-api-datamodel-access-permissions:
|
||||||
|
|
||||||
|
Permission record
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``key``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The permission's identifier
|
||||||
|
* - ``name``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The permission's name
|
||||||
|
* - ``dangerous``
|
||||||
|
- 1
|
||||||
|
- boolean
|
||||||
|
- Whether the permission should be considered dangerous due to a high reponsibility (true) or not (false).
|
||||||
|
* - ``default_groups``
|
||||||
|
- 1
|
||||||
|
- List of string
|
||||||
|
- List of group identifiers for which this permission is enabled by default
|
||||||
|
* - ``description``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- Human readable description of the permission
|
||||||
|
* - ``needs``
|
||||||
|
- 1
|
||||||
|
- :ref:`Needs object <sec-api-access-datamodel-general-needs>`
|
||||||
|
- Needs assigned to the permission
|
||||||
|
|
||||||
|
.. _sec-api-datamodel-access-groups:
|
||||||
|
|
||||||
|
Group record
|
||||||
|
------------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``key``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The group's identifier
|
||||||
|
* - ``name``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The group's name
|
||||||
|
* - ``description``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- A human readable description of the group
|
||||||
|
* - ``permissions``
|
||||||
|
- 0..n
|
||||||
|
- List of :ref:`Permissions <sec-api-datamodel-access-permissions>`
|
||||||
|
- The list of permissions assigned to the group (note: this does not include implicit permissions inherited from
|
||||||
|
subgroups).
|
||||||
|
* - ``subgroups``
|
||||||
|
- 0..n
|
||||||
|
- List of :ref:`Groups <sec-api-datamodel-access-groups>`
|
||||||
|
- Subgroups assigned to the group
|
||||||
|
* - ``needs``
|
||||||
|
- 1
|
||||||
|
- :ref:`Needs object <sec-api-datamodel-access-needs>`
|
||||||
|
- Effective needs of the group
|
||||||
|
* - ``default``
|
||||||
|
- 1
|
||||||
|
- boolean
|
||||||
|
- Whether this is a default group (true) or not (false)
|
||||||
|
* - ``removable``
|
||||||
|
- 1
|
||||||
|
- boolean
|
||||||
|
- Whether this group can be removed (true) or not (false)
|
||||||
|
* - ``changeable``
|
||||||
|
- 1
|
||||||
|
- boolean
|
||||||
|
- Whether this group can be modified (true) or not (false)
|
||||||
|
* - ``toggleable``
|
||||||
|
- 1
|
||||||
|
- boolean
|
||||||
|
- Whether this group can be assigned to users or other groups (true) or not (false)
|
||||||
|
|
||||||
|
.. _sec-api-datamodel-access-needs:
|
||||||
|
|
||||||
|
Needs
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``role``
|
||||||
|
- 0..1
|
||||||
|
- List of string
|
||||||
|
- List of ``role`` needs
|
||||||
|
* - ``group``
|
||||||
|
- 0..1
|
||||||
|
- List of string
|
||||||
|
- List of ``group`` needs
|
||||||
+19
-5
@@ -21,6 +21,8 @@ Retrieve all files
|
|||||||
|
|
||||||
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
|
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
|
||||||
|
|
||||||
|
Requires the ``FILES_LIST`` permission.
|
||||||
|
|
||||||
**Example 1**:
|
**Example 1**:
|
||||||
|
|
||||||
Fetch only the files and folders from the root folder.
|
Fetch only the files and folders from the root folder.
|
||||||
@@ -250,6 +252,8 @@ Retrieve files from specific location
|
|||||||
|
|
||||||
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
|
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
|
||||||
|
|
||||||
|
Requires the ``FILES_LIST`` permission.
|
||||||
|
|
||||||
**Example**:
|
**Example**:
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
@@ -327,7 +331,7 @@ Upload file or create folder
|
|||||||
Returns a :http:statuscode:`201` response with a ``Location`` header set to the management URL of the uploaded
|
Returns a :http:statuscode:`201` response with a ``Location`` header set to the management URL of the uploaded
|
||||||
file and an :ref:`Upload Response <sec-api-fileops-datamodel-uploadresponse>` as the body upon successful completion.
|
file and an :ref:`Upload Response <sec-api-fileops-datamodel-uploadresponse>` as the body upon successful completion.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``FILES_UPLOAD`` permission.
|
||||||
|
|
||||||
**Example for uploading a file**
|
**Example for uploading a file**
|
||||||
|
|
||||||
@@ -504,6 +508,8 @@ Retrieve a specific file's or folder's information
|
|||||||
On success, a :http:statuscode:`200` is returned, with a :ref:`file information item <sec-api-datamodel-files-file>`
|
On success, a :http:statuscode:`200` is returned, with a :ref:`file information item <sec-api-datamodel-files-file>`
|
||||||
as the response body.
|
as the response body.
|
||||||
|
|
||||||
|
Requires the ``FILES_LIST`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
@@ -566,7 +572,10 @@ 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.
|
||||||
|
|
||||||
slice
|
slice
|
||||||
Slices an STL file into GCODE. Note that this is an asynchronous operation that will take place in the background
|
Slices an STL file into GCODE. Note that this is an asynchronous operation that will take place in the background
|
||||||
@@ -598,6 +607,8 @@ Issue a file command
|
|||||||
Upon success, a status code of :http:statuscode:`202` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
|
Upon success, a status code of :http:statuscode:`202` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
|
||||||
body will be returned.
|
body will be returned.
|
||||||
|
|
||||||
|
Requires the ``SLICE`` permission.
|
||||||
|
|
||||||
copy
|
copy
|
||||||
Copies the file or folder to a new ``destination`` on the same ``location``. Additional parameters are:
|
Copies the file or folder to a new ``destination`` on the same ``location``. Additional parameters are:
|
||||||
|
|
||||||
@@ -609,6 +620,8 @@ Issue a file command
|
|||||||
Upon success, a status code of :http:statuscode:`201` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
|
Upon success, a status code of :http:statuscode:`201` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
|
||||||
body will be returned.
|
body will be returned.
|
||||||
|
|
||||||
|
Requires the ``FILES_UPLOAD`` permission.
|
||||||
|
|
||||||
move
|
move
|
||||||
Moves the file or folder to a new ``destination`` on the same ``location``. Additional parameters are:
|
Moves the file or folder to a new ``destination`` on the same ``location``. Additional parameters are:
|
||||||
|
|
||||||
@@ -622,7 +635,7 @@ Issue a file command
|
|||||||
Upon success, a status code of :http:statuscode:`201` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
|
Upon success, a status code of :http:statuscode:`201` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
|
||||||
body will be returned.
|
body will be returned.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``FILES_UPLOAD`` permission.
|
||||||
|
|
||||||
**Example Select Request**
|
**Example Select Request**
|
||||||
|
|
||||||
@@ -756,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.
|
||||||
|
|
||||||
@@ -773,7 +787,7 @@ Delete file
|
|||||||
|
|
||||||
Returns a :http:statuscode:`204` after successful deletion.
|
Returns a :http:statuscode:`204` after successful deletion.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``FILES_DELETE`` permission.
|
||||||
|
|
||||||
**Example Request**
|
**Example Request**
|
||||||
|
|
||||||
|
|||||||
+56
-33
@@ -148,8 +148,14 @@ Login
|
|||||||
via the ``passive`` flag.
|
via the ``passive`` flag.
|
||||||
|
|
||||||
Will return a :http:statuscode:`200` with a :ref:`login response <sec-api-general-datamodel-login>` on successful
|
Will return a :http:statuscode:`200` with a :ref:`login response <sec-api-general-datamodel-login>` on successful
|
||||||
login, whether active or passive. The active (username/password) login may also return a :http:statuscode:`401` in
|
login, whether active or passive. The active (username/password) login may also return a :http:statuscode:`403` in
|
||||||
case of a username/password mismatch or unknown user and a :http:statuscode:`403` in case of a deactivated account.
|
case of a username/password mismatch, unknown user or a deactivated account.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Previous versions of this API endpoint did return a :http:statuscode:`401` in case of a username/password
|
||||||
|
mismatch or an unknown user. That was incompatible with basic authentication since it was a wrong use of
|
||||||
|
the :http:statuscode:`401` code and got therefore changed as part of a bug fix.
|
||||||
|
|
||||||
:json passive: If present, performs a passive login only, returning information about the current user that's
|
:json passive: If present, performs a passive login only, returning information about the current user that's
|
||||||
active either through an existing session or the used API key
|
active either through an existing session or the used API key
|
||||||
@@ -157,8 +163,7 @@ Login
|
|||||||
:json pass: (active login only) Password
|
:json pass: (active login only) Password
|
||||||
:json remember: (active login only) Whether to set a "remember me" cookie on the session
|
:json remember: (active login only) Whether to set a "remember me" cookie on the session
|
||||||
:status 200: Successful login
|
:status 200: Successful login
|
||||||
:status 401: Username/password mismatch or unknown user
|
:status 403: Username/password mismatch, unknown user or deactivated account
|
||||||
:status 403: Deactivated account
|
|
||||||
|
|
||||||
.. _sec-api-general-logout:
|
.. _sec-api-general-logout:
|
||||||
|
|
||||||
@@ -175,6 +180,20 @@ Logout
|
|||||||
|
|
||||||
:status 204: No error
|
:status 204: No error
|
||||||
|
|
||||||
|
.. _sec-api-general-currentuser:
|
||||||
|
|
||||||
|
Current User
|
||||||
|
============
|
||||||
|
|
||||||
|
.. http:get:: /api/currentuser
|
||||||
|
|
||||||
|
Retrieves information about the current user.
|
||||||
|
|
||||||
|
Will return a :http:statuscode:`200` with a :ref:`current user object <sec-api-general-datamodel-currentuser>`
|
||||||
|
as body.
|
||||||
|
|
||||||
|
:status 200: No error
|
||||||
|
|
||||||
.. _sec-api-general-datamodel:
|
.. _sec-api-general-datamodel:
|
||||||
|
|
||||||
Data model
|
Data model
|
||||||
@@ -185,6 +204,30 @@ Data model
|
|||||||
Login response
|
Login response
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
The Login response is a :ref:`user record <sec-api-datamodel-access-users>` extended by the following fields:
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``session``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The session key, can be used to authenticate with the ``auth`` message on the :ref:`push API <sec-api-push>`.
|
||||||
|
* - ``_is_external_client``
|
||||||
|
- 1
|
||||||
|
- boolean
|
||||||
|
- Whether the client that made the request got detected as external from the local network or not.
|
||||||
|
|
||||||
|
.. _sec-api-general-datamodel-currentuser:
|
||||||
|
|
||||||
|
Current user
|
||||||
|
------------
|
||||||
|
|
||||||
.. list-table::
|
.. list-table::
|
||||||
:widths: 15 5 10 30
|
:widths: 15 5 10 30
|
||||||
:header-rows: 1
|
:header-rows: 1
|
||||||
@@ -196,32 +239,12 @@ Login response
|
|||||||
* - ``name``
|
* - ``name``
|
||||||
- 1
|
- 1
|
||||||
- string
|
- string
|
||||||
- the user's name/id
|
- The id of the current user. Unset if guest.
|
||||||
* - ``active``
|
* - ``permissions``
|
||||||
- 1
|
- 0..n
|
||||||
- boolean
|
- List of :ref:`permission records <sec-api-datamodel-access-permissions>`
|
||||||
- Whether the user's account is active or not
|
- The effective list of permissions assigned to the user
|
||||||
* - ``admin``
|
* - ``groups``
|
||||||
- 1
|
- 0..n
|
||||||
- boolean
|
- List of :ref:`permission records <sec-api-datamodel-access-groups>`
|
||||||
- Whether the user has admin rights or not
|
- The list of groups assigned to the user
|
||||||
* - ``user``
|
|
||||||
- 1
|
|
||||||
- boolean
|
|
||||||
- Whether the user has user rights or not (always ``true``)
|
|
||||||
* - ``apikey``
|
|
||||||
- 1
|
|
||||||
- string or None
|
|
||||||
- The user's API key, if set
|
|
||||||
* - ``settings``
|
|
||||||
- 1
|
|
||||||
- dict
|
|
||||||
- The user's settings, if any
|
|
||||||
* - ``session``
|
|
||||||
- 1
|
|
||||||
- string
|
|
||||||
- The session key, can be used to authenticate with the ``auth`` message on the :ref:`push API <sec-api-push>`.
|
|
||||||
* - ``_is_external_client``
|
|
||||||
- 1
|
|
||||||
- boolean
|
|
||||||
- Whether the client that made the request got detected as external from the local network or not.
|
|
||||||
+1
-2
@@ -9,7 +9,6 @@ REST API
|
|||||||
|
|
||||||
general.rst
|
general.rst
|
||||||
version.rst
|
version.rst
|
||||||
apps.rst
|
|
||||||
connection.rst
|
connection.rst
|
||||||
files.rst
|
files.rst
|
||||||
job.rst
|
job.rst
|
||||||
@@ -21,7 +20,7 @@ REST API
|
|||||||
slicing.rst
|
slicing.rst
|
||||||
system.rst
|
system.rst
|
||||||
timelapse.rst
|
timelapse.rst
|
||||||
users.rst
|
access.rst
|
||||||
util.rst
|
util.rst
|
||||||
wizard.rst
|
wizard.rst
|
||||||
push.rst
|
push.rst
|
||||||
|
|||||||
+3
-1
@@ -57,7 +57,7 @@ Issue a job command
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``PRINT`` permission.
|
||||||
|
|
||||||
**Example Start Request**
|
**Example Start Request**
|
||||||
|
|
||||||
@@ -180,6 +180,8 @@ Retrieve information about the current job
|
|||||||
|
|
||||||
Returns a :http:statuscode:`200` with a :ref:`sec-api-job-datamodel-response` in the body.
|
Returns a :http:statuscode:`200` with a :ref:`sec-api-job-datamodel-response` in the body.
|
||||||
|
|
||||||
|
Requires the ``STATUS`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ Languages
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
All language pack management operations require admin rights.
|
All language pack management operations require the ``SETTINGS`` permission.
|
||||||
|
|
||||||
.. contents::
|
.. contents::
|
||||||
|
|
||||||
|
|||||||
+54
-6
@@ -80,6 +80,8 @@ Retrieve the current printer state
|
|||||||
Returns a :http:statuscode:`200` with a :ref:`Full State Response <sec-api-printer-datamodel-fullstate>` in the
|
Returns a :http:statuscode:`200` with a :ref:`Full State Response <sec-api-printer-datamodel-fullstate>` in the
|
||||||
body upon success.
|
body upon success.
|
||||||
|
|
||||||
|
Requires the ``STATUS`` permission.
|
||||||
|
|
||||||
**Example 1**
|
**Example 1**
|
||||||
|
|
||||||
Include temperature history data, but limit it to two entries.
|
Include temperature history data, but limit it to two entries.
|
||||||
@@ -241,7 +243,7 @@ Issue a print head command
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``CONTROL`` permission.
|
||||||
|
|
||||||
**Example Jog Request**
|
**Example Jog Request**
|
||||||
|
|
||||||
@@ -380,7 +382,7 @@ Issue a tool command
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``CONTROL`` permission.
|
||||||
|
|
||||||
**Example Target Temperature Request**
|
**Example Target Temperature Request**
|
||||||
|
|
||||||
@@ -555,6 +557,8 @@ Retrieve the current tool state
|
|||||||
|
|
||||||
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
|
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
|
||||||
|
|
||||||
|
Requires the ``STATUS`` permission.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
If you want both tool and bed temperature information at the same time, take a look at
|
If you want both tool and bed temperature information at the same time, take a look at
|
||||||
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
|
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
|
||||||
@@ -645,7 +649,7 @@ Issue a bed command
|
|||||||
If no heated bed is configured for the currently selected printer profile, the resource will return
|
If no heated bed is configured for the currently selected printer profile, the resource will return
|
||||||
an :http:statuscode:`409`.
|
an :http:statuscode:`409`.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``CONTROL`` permission.
|
||||||
|
|
||||||
**Example Target Temperature Request**
|
**Example Target Temperature Request**
|
||||||
|
|
||||||
@@ -714,6 +718,8 @@ Retrieve the current bed state
|
|||||||
If no heated bed is configured for the currently selected printer profile, the resource will return
|
If no heated bed is configured for the currently selected printer profile, the resource will return
|
||||||
an :http:statuscode:`409`.
|
an :http:statuscode:`409`.
|
||||||
|
|
||||||
|
Requires the ``STATUS`` permission.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
If you want tool, bed and chamber temperature information at the same time, take a look at
|
If you want tool, bed and chamber temperature information at the same time, take a look at
|
||||||
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
|
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
|
||||||
@@ -793,7 +799,7 @@ Issue a chamber command
|
|||||||
If no heated chamber is configured for the currently selected printer profile, the resource will return
|
If no heated chamber is configured for the currently selected printer profile, the resource will return
|
||||||
an :http:statuscode:`409`.
|
an :http:statuscode:`409`.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``CONTROL`` permission.
|
||||||
|
|
||||||
**Example Target Temperature Request**
|
**Example Target Temperature Request**
|
||||||
|
|
||||||
@@ -862,6 +868,8 @@ Retrieve the current chamber state
|
|||||||
If no heated chamber is configured for the currently selected printer profile, the resource will return
|
If no heated chamber is configured for the currently selected printer profile, the resource will return
|
||||||
an :http:statuscode:`409`.
|
an :http:statuscode:`409`.
|
||||||
|
|
||||||
|
Requires the ``STATUS`` permission.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
If you want tool, bed and chamber temperature information at the same time, take a look at
|
If you want tool, bed and chamber temperature information at the same time, take a look at
|
||||||
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
|
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
|
||||||
@@ -944,7 +952,7 @@ Issue an SD command
|
|||||||
|
|
||||||
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.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``CONTROL`` permission.
|
||||||
|
|
||||||
**Example Init Request**
|
**Example Init Request**
|
||||||
|
|
||||||
@@ -1022,6 +1030,8 @@ Retrieve the current SD state
|
|||||||
Returns a :http:statuscode:`200` with an :ref:`SD State Response <sec-api-printer-datamodel-sdstate>` in the body
|
Returns a :http:statuscode:`200` with an :ref:`SD State Response <sec-api-printer-datamodel-sdstate>` in the body
|
||||||
upon success.
|
upon success.
|
||||||
|
|
||||||
|
Requires the ``STATUS`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
Read the current state of the SD card.
|
Read the current state of the SD card.
|
||||||
@@ -1058,7 +1068,7 @@ Send an arbitrary command to the printer
|
|||||||
|
|
||||||
If successful returns a :http:statuscode:`204` and an empty body.
|
If successful returns a :http:statuscode:`204` and an empty body.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``CONTROL`` permission.
|
||||||
|
|
||||||
**Example for sending a single command**
|
**Example for sending a single command**
|
||||||
|
|
||||||
@@ -1101,6 +1111,26 @@ Send an arbitrary command to the printer
|
|||||||
:json string commands: List of commands to send to the printer, mutually exclusive with ``command``.
|
:json string commands: List of commands to send to the printer, mutually exclusive with ``command``.
|
||||||
:statuscode 204: No error
|
:statuscode 204: No error
|
||||||
|
|
||||||
|
.. _sec-api-printer-customcontrols:
|
||||||
|
|
||||||
|
Retrieve custom controls
|
||||||
|
========================
|
||||||
|
|
||||||
|
.. http:get:: /api/printer/command/custom
|
||||||
|
|
||||||
|
Retrieves the :ref:`custom controls <sec-features-custom_controls>` as configured in
|
||||||
|
:ref:`config.yaml <sec-configuration-config_yaml>`.
|
||||||
|
|
||||||
|
Please refer to the documentation of :ref:`custom controls <sec-features-custom_controls>` on what
|
||||||
|
data structure to expect here.
|
||||||
|
|
||||||
|
Returns a :http:statuscode:`200` with an :ref:`Custom Controls Response <sec-api-printer-datamodel-customcontrols>`
|
||||||
|
in the body upon success.
|
||||||
|
|
||||||
|
Requires the ``CONTROL`` permission.
|
||||||
|
|
||||||
|
:statuscode 200: No error
|
||||||
|
|
||||||
.. _sec-api-printer-datamodel:
|
.. _sec-api-printer-datamodel:
|
||||||
|
|
||||||
Data model
|
Data model
|
||||||
@@ -1211,3 +1241,21 @@ Arbitrary Command Request
|
|||||||
- 0..1
|
- 0..1
|
||||||
- Map of key value pairs
|
- Map of key value pairs
|
||||||
- (only if ``script`` is set) additional template variables to provide to the script renderer
|
- (only if ``script`` is set) additional template variables to provide to the script renderer
|
||||||
|
|
||||||
|
.. _sec-api-printer-datamodel-customcontrols:
|
||||||
|
|
||||||
|
Custom Controls Response
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``controls``
|
||||||
|
- 0..n
|
||||||
|
- List of :ref:`custom controls <sec-features-custom_controls>`
|
||||||
|
- A list of custom control definitions as defined in ``config.yaml``.
|
||||||
@@ -21,6 +21,8 @@ Retrieve all printer profiles
|
|||||||
|
|
||||||
Returns a :http:statuscode:`200` with a list of :ref:`profiles <sec-api-printerprofiles-datamodel-profile>`.
|
Returns a :http:statuscode:`200` with a list of :ref:`profiles <sec-api-printerprofiles-datamodel-profile>`.
|
||||||
|
|
||||||
|
Requires the ``CONNECTION`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
@@ -124,6 +126,22 @@ Retrieve all printer profiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.. _sec-api-printerprofiles-get:
|
||||||
|
|
||||||
|
Retrieve a single printer profile
|
||||||
|
=================================
|
||||||
|
|
||||||
|
.. http:get:: /api/printerprofiles/(string:identifier)
|
||||||
|
|
||||||
|
Retrieves an existing single printer profile.
|
||||||
|
|
||||||
|
Returns a :http:statuscode:`200` with a :ref:`profile <sec-api-printerprofiles-datamodel-profile>`.
|
||||||
|
|
||||||
|
Requires the ``CONNECTION`` permission.
|
||||||
|
|
||||||
|
:statuscode 200: No error
|
||||||
|
:statuscode 404: The profile does not exist
|
||||||
|
|
||||||
.. _sec-api-printerprofiles-add:
|
.. _sec-api-printerprofiles-add:
|
||||||
|
|
||||||
Add a new printer profile
|
Add a new printer profile
|
||||||
@@ -143,7 +161,7 @@ Add a new printer profile
|
|||||||
Returns a :http:statuscode:`200` with the saved profile as property ``profile``
|
Returns a :http:statuscode:`200` with the saved profile as property ``profile``
|
||||||
in the JSON body upon success.
|
in the JSON body upon success.
|
||||||
|
|
||||||
Requires admin rights.
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
**Example 1**
|
**Example 1**
|
||||||
|
|
||||||
@@ -314,7 +332,7 @@ Update an existing printer profile
|
|||||||
Returns a :http:statuscode:`200` with the saved profile as property ``profile``
|
Returns a :http:statuscode:`200` with the saved profile as property ``profile``
|
||||||
in the JSON body upon success.
|
in the JSON body upon success.
|
||||||
|
|
||||||
Requires admin rights.
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
@@ -400,7 +418,7 @@ Remove an existing printer profile
|
|||||||
|
|
||||||
Returns a :http:statuscode:`204` an empty body upon success.
|
Returns a :http:statuscode:`204` an empty body upon success.
|
||||||
|
|
||||||
Requires admin rights.
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -29,6 +29,9 @@ following message types are currently available for usage by 3rd party clients:
|
|||||||
|
|
||||||
* ``connected``: Initial connection information, sent only right after establishing the socket connection. See
|
* ``connected``: Initial connection information, sent only right after establishing the socket connection. See
|
||||||
:ref:`the payload data model <sec-api-push-datamodel-connected>`.
|
:ref:`the payload data model <sec-api-push-datamodel-connected>`.
|
||||||
|
* ``reauthRequired``: A reauthentication of the current login session is required. The ``reason`` parameter in the
|
||||||
|
payload defines whether a full active login is necessary (values ``logout`` and ``removed``) or a simple passive
|
||||||
|
login will suffice (all other values).
|
||||||
* ``current``: Rate limited general state update, payload contains information about the printer's state, job progress,
|
* ``current``: Rate limited general state update, payload contains information about the printer's state, job progress,
|
||||||
accumulated temperature points and log lines since last update. OctoPrint will send these updates when new information
|
accumulated temperature points and log lines since last update. OctoPrint will send these updates when new information
|
||||||
is available, but not more often than twice per second in order to not flood the client with messages (e.g.
|
is available, but not more often than twice per second in order to not flood the client with messages (e.g.
|
||||||
@@ -51,9 +54,8 @@ OctoPrint's SockJS socket also accepts two commands from the client to the serve
|
|||||||
|
|
||||||
* ``auth`` (since 1.3.10): With the ``auth`` message, clients may associate an
|
* ``auth`` (since 1.3.10): With the ``auth`` message, clients may associate an
|
||||||
existing user session with the socket. That is of special importance to receive
|
existing user session with the socket. That is of special importance to receive
|
||||||
any kind of messages if the bundled :ref:`Forcelogin Plugin <sec-bundledplugins-forcelogin>` is enabled
|
any kind of messages, since the permission system will prevent any kind of status messages to be sent to connected
|
||||||
(as it is by default), since it will prevent any kind of status messages to be sent to connected unauthenticated
|
clients lacking the ``STATUS`` permission.
|
||||||
clients.
|
|
||||||
|
|
||||||
The ``auth`` message expects the user id of the user to authenticate followed by ``:`` and a session key to be
|
The ``auth`` message expects the user id of the user to authenticate followed by ``:`` and a session key to be
|
||||||
obtained from the successful payload of a :ref:`(passive or active) login via the API <sec-api-general-login>`.
|
obtained from the successful payload of a :ref:`(passive or active) login via the API <sec-api-general-login>`.
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ Retrieve current settings
|
|||||||
The :ref:`data model <sec-api-settings-datamodel>` is similar to what can be found in
|
The :ref:`data model <sec-api-settings-datamodel>` is similar to what can be found in
|
||||||
:ref:`config.yaml <sec-configuration-config_yaml>`, see below for details.
|
:ref:`config.yaml <sec-configuration-config_yaml>`, see below for details.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS_READ`` permission.
|
||||||
|
|
||||||
.. _sec-api-settings-save:
|
.. _sec-api-settings-save:
|
||||||
|
|
||||||
Save settings
|
Save settings
|
||||||
@@ -36,7 +38,7 @@ Save settings
|
|||||||
|
|
||||||
Returns the currently active settings on success, as part of a :http:statuscode:`200` response.
|
Returns the currently active settings on success, as part of a :http:statuscode:`200` response.
|
||||||
|
|
||||||
Requires admin rights.
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
@@ -514,6 +516,8 @@ mapped from the same fields in ``config.yaml`` unless otherwise noted:
|
|||||||
-
|
-
|
||||||
* - ``webcam.ffmpegThreads``
|
* - ``webcam.ffmpegThreads``
|
||||||
-
|
-
|
||||||
|
* - ``webcam.ffmpegVideoCodec``
|
||||||
|
-
|
||||||
* - ``webcam.watermark``
|
* - ``webcam.watermark``
|
||||||
-
|
-
|
||||||
* - ``webcam.flipH``
|
* - ``webcam.flipH``
|
||||||
|
|||||||
+62
-2
@@ -28,6 +28,8 @@ List All Slicers and Slicing Profiles
|
|||||||
Returns a :http:statuscode:`200` response with a :ref:`Slicer list <sec-api-slicing-datamodel-slicerlist>`
|
Returns a :http:statuscode:`200` response with a :ref:`Slicer list <sec-api-slicing-datamodel-slicerlist>`
|
||||||
as the body upon successful completion.
|
as the body upon successful completion.
|
||||||
|
|
||||||
|
Requires the ``SLICE`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
@@ -77,6 +79,8 @@ List Slicing Profiles of a Specific Slicer
|
|||||||
Returns a :http:statuscode:`200` response with a :ref:`Profile list <sec-api-slicing-datamodel-profilelist>`
|
Returns a :http:statuscode:`200` response with a :ref:`Profile list <sec-api-slicing-datamodel-profilelist>`
|
||||||
as the body upon successful completion.
|
as the body upon successful completion.
|
||||||
|
|
||||||
|
Requires the ``SLICE`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
@@ -121,6 +125,8 @@ Retrieve Specific Profile
|
|||||||
Returns a :http:statuscode:`200` response with a :ref:`full Profile <sec-api-slicing-datamodel-profile>`
|
Returns a :http:statuscode:`200` response with a :ref:`full Profile <sec-api-slicing-datamodel-profile>`
|
||||||
as the body upon successful completion.
|
as the body upon successful completion.
|
||||||
|
|
||||||
|
Requires the ``SLICE`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
@@ -168,7 +174,7 @@ Add Slicing Profile
|
|||||||
Returns a :http:statuscode:`201` and an :ref:`abridged Profile <sec-api-slicing-datamodel-profile>` in the body
|
Returns a :http:statuscode:`201` and an :ref:`abridged Profile <sec-api-slicing-datamodel-profile>` in the body
|
||||||
upon successful completion.
|
upon successful completion.
|
||||||
|
|
||||||
Requires admin rights.
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
@@ -206,6 +212,31 @@ Add Slicing Profile
|
|||||||
:statuscode 201: No error
|
:statuscode 201: No error
|
||||||
:statuscode 404: If the ``slicer`` was unknown to the system.
|
:statuscode 404: If the ``slicer`` was unknown to the system.
|
||||||
|
|
||||||
|
.. _sec-api-slicing-patch:
|
||||||
|
|
||||||
|
Update Slicing Profile
|
||||||
|
======================
|
||||||
|
|
||||||
|
.. http:patch:: /api/slicing/(string:slicer)/profiles/(string:key)
|
||||||
|
|
||||||
|
Updates the slicing profile identified by ``key`` for the slicer ``slicer``.
|
||||||
|
|
||||||
|
Expects a :ref:`profile update request <sec-api-slicing-datamodel-profileupdate>` as body.
|
||||||
|
|
||||||
|
Returns a :http:statuscode:`201` and an :ref:`abridged Profile <sec-api-slicing-datamodel-profile>` in the body
|
||||||
|
upon successful completion.
|
||||||
|
|
||||||
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
|
:param slicer: The identifying key of the slicer for which to update the profile
|
||||||
|
:param key: The identifying key of the profile to update
|
||||||
|
:json data: New profile overrides to apply
|
||||||
|
:json displayName: New display name
|
||||||
|
:json description: New description
|
||||||
|
:json default: Whether to make the profile default (true) or not (false) for the slicer
|
||||||
|
:statuscode 200: No error
|
||||||
|
:statuscode 404: Slicer or profile do not exist
|
||||||
|
|
||||||
.. _sec-api-slicing-delete:
|
.. _sec-api-slicing-delete:
|
||||||
|
|
||||||
Delete Slicing Profile
|
Delete Slicing Profile
|
||||||
@@ -216,7 +247,7 @@ Delete Slicing Profile
|
|||||||
Delete the slicing profile identified by ``key`` for the slicer ``slicer``. If the profile doesn't exist, the
|
Delete the slicing profile identified by ``key`` for the slicer ``slicer``. If the profile doesn't exist, the
|
||||||
request will succeed anyway.
|
request will succeed anyway.
|
||||||
|
|
||||||
Requires admin rights.
|
Requires the ``SETTINGS`` permission.
|
||||||
|
|
||||||
:param slicer: The identifying key of the slicer for which to delete the profile
|
:param slicer: The identifying key of the slicer for which to delete the profile
|
||||||
:param key: The identifying key of the profile to delete
|
:param key: The identifying key of the profile to delete
|
||||||
@@ -340,3 +371,32 @@ Profile
|
|||||||
only the keys differing from the defaults when saving/updating a profile. The keys to be found in here a slicer
|
only the keys differing from the defaults when saving/updating a profile. The keys to be found in here a slicer
|
||||||
specific. Will be left out for list responses.
|
specific. Will be left out for list responses.
|
||||||
|
|
||||||
|
.. _sec-api-slicing-datamodel-profileupdate:
|
||||||
|
|
||||||
|
Profile Update Request
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``data``
|
||||||
|
- 0..1
|
||||||
|
- Object
|
||||||
|
- The profile data
|
||||||
|
* - ``displayName``
|
||||||
|
- 0..1
|
||||||
|
- ``string``
|
||||||
|
- The new display name for the profile
|
||||||
|
* - ``description``
|
||||||
|
- 0..1
|
||||||
|
- ``string``
|
||||||
|
- The new description for the profile
|
||||||
|
* - ``default``
|
||||||
|
- 0..1
|
||||||
|
- ``boolean``
|
||||||
|
- Whether to mark the profile as default for the slicer (true) or not (false)
|
||||||
+50
-24
@@ -6,7 +6,7 @@ System
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
All system operations require admin rights.
|
All system operations require the ``SYSTEM`` permission.
|
||||||
|
|
||||||
.. _sec-api-system-command-list:
|
.. _sec-api-system-command-list:
|
||||||
|
|
||||||
@@ -20,6 +20,8 @@ List all registered system commands
|
|||||||
A :http:statuscode:`200` with a :ref:`List all response <sec-api-system-commands-listall>`
|
A :http:statuscode:`200` with a :ref:`List all response <sec-api-system-commands-listall>`
|
||||||
will be returned.
|
will be returned.
|
||||||
|
|
||||||
|
Requires the ``SYSTEM`` permission.
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
.. sourcecode:: http
|
.. sourcecode:: http
|
||||||
@@ -38,30 +40,21 @@ List all registered system commands
|
|||||||
{
|
{
|
||||||
"action": "shutdown",
|
"action": "shutdown",
|
||||||
"name": "Shutdown",
|
"name": "Shutdown",
|
||||||
"command": "sudo shutdown -h now",
|
|
||||||
"confirm": "<strong>You are about to shutdown the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
"confirm": "<strong>You are about to shutdown the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
||||||
"async": true,
|
|
||||||
"ignore": true,
|
|
||||||
"source": "core",
|
"source": "core",
|
||||||
"resource": "http://example.com/api/system/commands/core/shutdown"
|
"resource": "http://example.com/api/system/commands/core/shutdown"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"action": "reboot",
|
"action": "reboot",
|
||||||
"name": "Reboot",
|
"name": "Reboot",
|
||||||
"command": "sudo reboot",
|
|
||||||
"confirm": "<strong>You are about to reboot the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
"confirm": "<strong>You are about to reboot the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
||||||
"async": true,
|
|
||||||
"ignore": true,
|
|
||||||
"source": "core",
|
"source": "core",
|
||||||
"resource": "http://example.com/api/system/commands/core/reboot"
|
"resource": "http://example.com/api/system/commands/core/reboot"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"action": "restart",
|
"action": "restart",
|
||||||
"name": "Restart OctoPrint",
|
"name": "Restart OctoPrint",
|
||||||
"command": "sudo service octoprint restart",
|
|
||||||
"confirm": "<strong>You are about to restart the OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
"confirm": "<strong>You are about to restart the OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
||||||
"async": true,
|
|
||||||
"ignore": true,
|
|
||||||
"source": "core",
|
"source": "core",
|
||||||
"resource": "http://example.com/api/system/commands/core/restart"
|
"resource": "http://example.com/api/system/commands/core/restart"
|
||||||
}
|
}
|
||||||
@@ -99,30 +92,21 @@ List all registered system commands for a source
|
|||||||
{
|
{
|
||||||
"action": "shutdown",
|
"action": "shutdown",
|
||||||
"name": "Shutdown",
|
"name": "Shutdown",
|
||||||
"command": "sudo shutdown -h now",
|
"confirm": "<strong>You are about to shutdown the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
||||||
"confirm": "<b>You are about to shutdown the system.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
|
||||||
"async": true,
|
|
||||||
"ignore": true,
|
|
||||||
"source": "core",
|
"source": "core",
|
||||||
"resource": "http://example.com/api/system/commands/core/shutdown"
|
"resource": "http://example.com/api/system/commands/core/shutdown"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"action": "reboot",
|
"action": "reboot",
|
||||||
"name": "Reboot",
|
"name": "Reboot",
|
||||||
"command": "sudo reboot",
|
"confirm": "<strong>You are about to reboot the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
||||||
"confirm": "<b>You are about to reboot the system.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
|
||||||
"async": true,
|
|
||||||
"ignore": true,
|
|
||||||
"source": "core",
|
"source": "core",
|
||||||
"resource": "http://example.com/api/system/commands/core/reboot"
|
"resource": "http://example.com/api/system/commands/core/reboot"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"action": "restart",
|
"action": "restart",
|
||||||
"name": "Restart OctoPrint",
|
"name": "Restart OctoPrint",
|
||||||
"command": "sudo service octoprint restart",
|
"confirm": "<strong>You are about to restart the OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
||||||
"confirm": "<b>You are about to restart the OctoPrint server.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
|
|
||||||
"async": true,
|
|
||||||
"ignore": true,
|
|
||||||
"source": "core",
|
"source": "core",
|
||||||
"resource": "http://example.com/api/system/commands/core/restart"
|
"resource": "http://example.com/api/system/commands/core/restart"
|
||||||
}
|
}
|
||||||
@@ -184,18 +168,60 @@ List all response
|
|||||||
- Description
|
- Description
|
||||||
* - ``core``
|
* - ``core``
|
||||||
- 0..n
|
- 0..n
|
||||||
- List of :ref:`command definitions <sec-api-system-commands-definiton>`
|
- List of :ref:`client command definitions <sec-api-client-system-commands-definiton>`
|
||||||
- List of all core commands defined.
|
- List of all core commands defined.
|
||||||
* - ``custom``
|
* - ``custom``
|
||||||
- 0..n
|
- 0..n
|
||||||
- List of :ref:`command definitions <sec-api-system-commands-definiton>`
|
- List of :ref:`client command definitions <sec-api-client-system-commands-definiton>`
|
||||||
- List of all custom commands defined in ``config.yaml``.
|
- List of all custom commands defined in ``config.yaml``.
|
||||||
|
|
||||||
|
.. _sec-api-client-system-commands-definiton:
|
||||||
|
|
||||||
|
Client command definitions
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
A restricted form of the full :ref:`command definition <sec-api-system-commands-definiton>`.
|
||||||
|
For exposing via the API.
|
||||||
|
|
||||||
|
.. list-table::
|
||||||
|
:widths: 15 5 10 30
|
||||||
|
:header-rows: 1
|
||||||
|
|
||||||
|
* - Name
|
||||||
|
- Multiplicity
|
||||||
|
- Type
|
||||||
|
- Description
|
||||||
|
* - ``name``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The name of the command to display in the System menu.
|
||||||
|
* - ``action``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- An identifier to refer to the command programmatically. The special ``action`` string
|
||||||
|
``divider`` signifies a divider in the menu.
|
||||||
|
* - ``confirm``
|
||||||
|
- 0..1
|
||||||
|
- string
|
||||||
|
- If present and set, this text will be displayed to the user in a confirmation dialog
|
||||||
|
they have to acknowledge in order to really execute the command.
|
||||||
|
* - ``source``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- Source of the command definition, currently either ``core`` (for system actions defined by
|
||||||
|
OctoPrint itself) or ``custom`` (for custom system commands defined by the user through ``config.yaml``).
|
||||||
|
* - ``resource``
|
||||||
|
- 1
|
||||||
|
- string
|
||||||
|
- The URL of the command to use for executing it.
|
||||||
|
|
||||||
.. _sec-api-system-commands-definiton:
|
.. _sec-api-system-commands-definiton:
|
||||||
|
|
||||||
Command definition
|
Command definition
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
The full command definition is not available via the API.
|
||||||
|
|
||||||
.. list-table::
|
.. list-table::
|
||||||
:widths: 15 5 10 30
|
:widths: 15 5 10 30
|
||||||
:header-rows: 1
|
:header-rows: 1
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ Retrieve a list of timelapses and the current config
|
|||||||
Returns a :ref:`timelapse list <sec-api-timelapse-datamodel-list>` in the
|
Returns a :ref:`timelapse list <sec-api-timelapse-datamodel-list>` in the
|
||||||
response body.
|
response body.
|
||||||
|
|
||||||
|
Requires the ``TIMELAPSE_LIST`` permission.
|
||||||
|
|
||||||
:param unrendered: If provided and true, also include unrendered timelapses
|
:param unrendered: If provided and true, also include unrendered timelapses
|
||||||
|
|
||||||
.. _sec-api-timelapse-delete:
|
.. _sec-api-timelapse-delete:
|
||||||
@@ -29,7 +31,7 @@ Delete a timelapse
|
|||||||
|
|
||||||
Delete the timelapse ``filename``.
|
Delete the timelapse ``filename``.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``TIMELAPSE_DELETE`` permission.
|
||||||
|
|
||||||
.. _sec-api-timelapse-render:
|
.. _sec-api-timelapse-render:
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ Issue a command for an unrendered timelapse
|
|||||||
Current only supports to render the unrendered timelapse ``name`` via the
|
Current only supports to render the unrendered timelapse ``name`` via the
|
||||||
``render`` command.
|
``render`` command.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``TIMELAPSE_ADMIN`` permission.
|
||||||
|
|
||||||
:json command: The command to issue, currently only ``render`` is supported
|
:json command: The command to issue, currently only ``render`` is supported
|
||||||
|
|
||||||
@@ -54,7 +56,7 @@ Delete an unrendered timelapse
|
|||||||
|
|
||||||
Delete the unrendered timelapse ``name``.
|
Delete the unrendered timelapse ``name``.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``TIMELAPSE_DELETE`` permission.
|
||||||
|
|
||||||
.. _sec-api-timelapse-saveconfig:
|
.. _sec-api-timelapse-saveconfig:
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ Change current timelapse config
|
|||||||
|
|
||||||
The configuration is expected as the request body.
|
The configuration is expected as the request body.
|
||||||
|
|
||||||
Requires user rights.
|
Requires the ``TIMELAPSE_ADMIN`` permission.
|
||||||
|
|
||||||
.. _sec-api-timelapse-datamodel:
|
.. _sec-api-timelapse-datamodel:
|
||||||
|
|
||||||
|
|||||||
+2
-307
@@ -4,311 +4,6 @@
|
|||||||
User
|
User
|
||||||
****
|
****
|
||||||
|
|
||||||
.. contents::
|
.. note::
|
||||||
|
|
||||||
.. _sec-api-users-list:
|
This API endpoint has been moved and is now part of :ref:`Access Control <sec-api-access-users>`.
|
||||||
|
|
||||||
Retrieve a list of users
|
|
||||||
========================
|
|
||||||
|
|
||||||
.. http:get:: /api/users
|
|
||||||
|
|
||||||
Retrieves a list of all registered users in OctoPrint.
|
|
||||||
|
|
||||||
Will return a :http:statuscode:`200` with a :ref:`user list response <sec-api-users-datamodel-userlistresponse>`
|
|
||||||
as body.
|
|
||||||
|
|
||||||
Requires admin rights.
|
|
||||||
|
|
||||||
:status 200: No error
|
|
||||||
|
|
||||||
.. _sec-api-users-retrieve:
|
|
||||||
|
|
||||||
Retrieve a user
|
|
||||||
===============
|
|
||||||
|
|
||||||
.. http:get:: /api/users/(string:username)
|
|
||||||
|
|
||||||
Retrieves information about a user.
|
|
||||||
|
|
||||||
Will return a :http:statuscode:`200` with a :ref:`user record <sec-api-users-datamodel-userrecord>`
|
|
||||||
as body.
|
|
||||||
|
|
||||||
Requires either admin rights or to be logged in as the user.
|
|
||||||
|
|
||||||
:param username: Name of the user which to retrieve
|
|
||||||
:status 200: No error
|
|
||||||
:status 404: Unknown user
|
|
||||||
|
|
||||||
.. _sec-api-users-add:
|
|
||||||
|
|
||||||
Add a user
|
|
||||||
==========
|
|
||||||
|
|
||||||
.. http:post:: /api/users
|
|
||||||
|
|
||||||
Adds a user to OctoPrint.
|
|
||||||
|
|
||||||
Expects a :ref:`user registration request <sec-api-users-datamodel-adduserrequest>`
|
|
||||||
as request body.
|
|
||||||
|
|
||||||
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
|
|
||||||
|
|
||||||
Requires admin rights.
|
|
||||||
|
|
||||||
:json name: The user's name
|
|
||||||
:json password: The user's password
|
|
||||||
:json active: Whether to activate the account (true) or not (false)
|
|
||||||
:json admin: Whether to give the account admin rights (true) or not (false)
|
|
||||||
:status 200: No error
|
|
||||||
:status 400: If any of the mandatory fields is missing or the request is otherwise
|
|
||||||
invalid
|
|
||||||
:status 409: A user with the provided name does already exist
|
|
||||||
|
|
||||||
.. _sec-api-users-update:
|
|
||||||
|
|
||||||
Update a user
|
|
||||||
=============
|
|
||||||
|
|
||||||
.. http:put:: /api/users/(string:username)
|
|
||||||
|
|
||||||
Updates a user record.
|
|
||||||
|
|
||||||
Expects a :ref:`user update request <sec-api-users-datamodel-updateuserrequest>`
|
|
||||||
as request body.
|
|
||||||
|
|
||||||
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
|
|
||||||
|
|
||||||
Requires admin rights.
|
|
||||||
|
|
||||||
:param username: Name of the user to update
|
|
||||||
:json admin: Whether to mark the user as admin (true) or not (false), can be left out (no change)
|
|
||||||
:json active: Whether to mark the account as activated (true) or deactivated (false), can be left out (no change)
|
|
||||||
:status 200: No error
|
|
||||||
:status 404: Unknown user
|
|
||||||
|
|
||||||
.. _sec-api-users-delete:
|
|
||||||
|
|
||||||
Delete a user
|
|
||||||
=============
|
|
||||||
|
|
||||||
.. http:delete:: /api/users/(string:username)
|
|
||||||
|
|
||||||
Delete a user record.
|
|
||||||
|
|
||||||
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
|
|
||||||
|
|
||||||
Requires admin rights.
|
|
||||||
|
|
||||||
:param username: Name of the user to delete
|
|
||||||
:status 200: No error
|
|
||||||
:status 404: Unknown user
|
|
||||||
|
|
||||||
.. _sec-api-users-resetpassword:
|
|
||||||
|
|
||||||
Reset a user's password
|
|
||||||
=======================
|
|
||||||
|
|
||||||
.. http:put:: /api/users/(string:username)/password
|
|
||||||
|
|
||||||
Changes the password of a user.
|
|
||||||
|
|
||||||
Expects a JSON object with a single property ``password`` as request body.
|
|
||||||
|
|
||||||
Requires admin rights or to be logged in as the user.
|
|
||||||
|
|
||||||
:param username: Name of the user to change the password for
|
|
||||||
:json password: The new password to set
|
|
||||||
:status 200: No error
|
|
||||||
:status 400: If the request doesn't contain a ``password`` property or the request
|
|
||||||
is otherwise invalid
|
|
||||||
:status 403: No admin rights and not logged in as the user
|
|
||||||
:status 404: The user is unknown
|
|
||||||
|
|
||||||
.. _sec-api-users-getsettings:
|
|
||||||
|
|
||||||
Retrieve a user's settings
|
|
||||||
==========================
|
|
||||||
|
|
||||||
.. http:get:: /api/users/(string:username)/settings
|
|
||||||
|
|
||||||
Retrieves a user's settings.
|
|
||||||
|
|
||||||
Will return a :http:statuscode:`200` with a JSON object representing the user's
|
|
||||||
personal settings (if any) as body.
|
|
||||||
|
|
||||||
Requires admin rights or to be logged in as the user.
|
|
||||||
|
|
||||||
:param username: Name of the user to retrieve the settings for
|
|
||||||
:status 200: No error
|
|
||||||
:status 403: No admin rights and not logged in as the user
|
|
||||||
:status 404: The user is unknown
|
|
||||||
|
|
||||||
.. _sec-api-users-updatesettings:
|
|
||||||
|
|
||||||
Update a user's settings
|
|
||||||
========================
|
|
||||||
|
|
||||||
.. http:patch:: /api/users/(string:username)/settings
|
|
||||||
|
|
||||||
Updates a user's settings.
|
|
||||||
|
|
||||||
Expects a new settings JSON object to merge with the current settings as
|
|
||||||
request body.
|
|
||||||
|
|
||||||
Requires admin rights or to be logged in as the user.
|
|
||||||
|
|
||||||
:param username: Name of the user to retrieve the settings for
|
|
||||||
:status 204: No error
|
|
||||||
:status 403: No admin rights and not logged in as the user
|
|
||||||
:status 404: The user is unknown
|
|
||||||
|
|
||||||
.. _sec-api-users-generateapikey:
|
|
||||||
|
|
||||||
Regenerate a user's personal API key
|
|
||||||
====================================
|
|
||||||
|
|
||||||
.. http:post:: /api/users/(string:username)/apikey
|
|
||||||
|
|
||||||
Generates a new API key for the user.
|
|
||||||
|
|
||||||
Does not expect a body. Will return the generated API key as ``apikey``
|
|
||||||
property in the JSON object contained in the response body.
|
|
||||||
|
|
||||||
Requires admin rights or to be logged in as the user.
|
|
||||||
|
|
||||||
:param username: Name of the user to retrieve the settings for
|
|
||||||
:status 200: No error
|
|
||||||
:status 403: No admin rights and not logged in as the user
|
|
||||||
:status 404: The user is unknown
|
|
||||||
|
|
||||||
.. _sec-api-users-deleteapikey:
|
|
||||||
|
|
||||||
Delete a user's personal API key
|
|
||||||
================================
|
|
||||||
|
|
||||||
.. http:delete:: /api/users/(string:username)/apikey
|
|
||||||
|
|
||||||
Deletes a user's personal API key.
|
|
||||||
|
|
||||||
Requires admin rights or to be logged in as the user.
|
|
||||||
|
|
||||||
:param username: Name of the user to retrieve the settings for
|
|
||||||
:status 204: No error
|
|
||||||
:status 403: No admin rights and not logged in as the user
|
|
||||||
:status 404: The user is unknown
|
|
||||||
|
|
||||||
.. _sec-api-users-datamodel:
|
|
||||||
|
|
||||||
Data model
|
|
||||||
==========
|
|
||||||
|
|
||||||
.. _sec-api-users-datamodel-userlistresponse:
|
|
||||||
|
|
||||||
User list response
|
|
||||||
------------------
|
|
||||||
|
|
||||||
.. list-table::
|
|
||||||
:widths: 15 5 10 30
|
|
||||||
:header-rows: 1
|
|
||||||
|
|
||||||
* - Name
|
|
||||||
- Multiplicity
|
|
||||||
- Type
|
|
||||||
- Description
|
|
||||||
* - ``users``
|
|
||||||
- 0..n
|
|
||||||
- List of :ref:`user records <sec-api-users-datamodel-userrecord>`
|
|
||||||
- The list of registered users
|
|
||||||
|
|
||||||
.. _sec-api-users-datamodel-userrecord:
|
|
||||||
|
|
||||||
User record
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. list-table::
|
|
||||||
:widths: 15 5 10 30
|
|
||||||
:header-rows: 1
|
|
||||||
|
|
||||||
* - Name
|
|
||||||
- Multiplicity
|
|
||||||
- Type
|
|
||||||
- Description
|
|
||||||
* - ``name``
|
|
||||||
- 1
|
|
||||||
- string
|
|
||||||
- The user's name
|
|
||||||
* - ``active``
|
|
||||||
- 1
|
|
||||||
- bool
|
|
||||||
- Whether the user's account is active (true) or not (false)
|
|
||||||
* - ``user``
|
|
||||||
- 1
|
|
||||||
- bool
|
|
||||||
- Whether the user has user rights. Should always be true.
|
|
||||||
* - ``admin``
|
|
||||||
- 1
|
|
||||||
- bool
|
|
||||||
- Whether the user has admin rights (true) or not (false)
|
|
||||||
* - ``apikey``
|
|
||||||
- 0..1
|
|
||||||
- string
|
|
||||||
- The user's personal API key
|
|
||||||
* - ``settings``
|
|
||||||
- 1
|
|
||||||
- object
|
|
||||||
- The user's personal settings, might be an empty object.
|
|
||||||
|
|
||||||
.. _sec-api-users-datamodel-adduserrequest:
|
|
||||||
|
|
||||||
User registration request
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
.. list-table::
|
|
||||||
:widths: 15 5 10 30
|
|
||||||
:header-rows: 1
|
|
||||||
|
|
||||||
* - Name
|
|
||||||
- Multiplicity
|
|
||||||
- Type
|
|
||||||
- Description
|
|
||||||
* - ``name``
|
|
||||||
- 1
|
|
||||||
- string
|
|
||||||
- The user's name
|
|
||||||
* - ``password``
|
|
||||||
- 1
|
|
||||||
- string
|
|
||||||
- The user's password
|
|
||||||
* - ``active``
|
|
||||||
- 1
|
|
||||||
- bool
|
|
||||||
- Whether to activate the account (true) or not (false)
|
|
||||||
* - ``admin``
|
|
||||||
- 0..1
|
|
||||||
- bool
|
|
||||||
- Whether to give the user admin rights (true) or not (false or not present)
|
|
||||||
|
|
||||||
.. _sec-api-users-datamodel-updateuserrequest:
|
|
||||||
|
|
||||||
User update request
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
.. list-table::
|
|
||||||
:widths: 15 5 10 30
|
|
||||||
:header-rows: 1
|
|
||||||
|
|
||||||
* - Name
|
|
||||||
- Multiplicity
|
|
||||||
- Type
|
|
||||||
- Description
|
|
||||||
* - ``active``
|
|
||||||
- 0..1
|
|
||||||
- bool
|
|
||||||
- If present will set the user's active flag to the provided value. True for
|
|
||||||
activating the account, false for deactivating it.
|
|
||||||
* - ``admin``
|
|
||||||
- 0..1
|
|
||||||
- bool
|
|
||||||
- If present will set the user's admin flag to the provided value. True for
|
|
||||||
admin rights, false for no admin rights.
|
|
||||||
+58
-1
@@ -99,7 +99,15 @@ 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!
|
||||||
|
|
||||||
Requires admin rights.
|
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.
|
||||||
|
|
||||||
**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.
|
||||||
+1
-1
@@ -6,7 +6,7 @@ Wizard
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
All wizard operations require either admin rights or the ``firstRun`` flag to be ``true``.
|
All wizard operations require either the ``ADMIN`` permission or the ``firstRun`` flag to be ``true``.
|
||||||
|
|
||||||
.. contents::
|
.. contents::
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Command line usage
|
|||||||
------------------
|
------------------
|
||||||
|
|
||||||
The Backup Plugin implements a command line interface that allows creation and restoration of backups.
|
The Backup Plugin implements a command line interface that allows creation and restoration of backups.
|
||||||
It adds two new commands, ``backup:backup`` and ``backup_restore``.
|
It adds two new commands, ``backup:backup`` and ``backup:restore``.
|
||||||
|
|
||||||
.. code-block:: none
|
.. code-block:: none
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ network running Microsoft Windows. You will be able to just double click on the
|
|||||||
OctoPrint instance icon in "Networks > Other Devices" in your Windows Explorer,
|
OctoPrint instance icon in "Networks > Other Devices" in your Windows Explorer,
|
||||||
which will take you directly to the web frontend.
|
which will take you directly to the web frontend.
|
||||||
|
|
||||||
The ZeroConf support allows OctoPrint to announce itself to Safari on MacOS X
|
The ZeroConf support allows OctoPrint to announce itself to Safari on macOS
|
||||||
on the same network.
|
on the same network.
|
||||||
|
|
||||||
Linux users should install `Avahi <http://avahi.org>`_ and can then use one
|
Linux users should install `Avahi <http://avahi.org>`_ and can then use one
|
||||||
|
|||||||
@@ -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>`_.
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
.. _sec-bundledplugins-forcelogin:
|
|
||||||
|
|
||||||
ForceLogin Plugin
|
|
||||||
=================
|
|
||||||
|
|
||||||
The ForceLogin Plugin comes bundled with OctoPrint (starting with version 1.3.10). It removes the anonymous
|
|
||||||
read-only access that up until 1.3.10 was standard when accessing OctoPrint instances without being logged in and
|
|
||||||
instead forces users to log in if they want to get any kind of information from OctoPrint.
|
|
||||||
|
|
||||||
.. _fig-bundledplugins-forcelogin:
|
|
||||||
.. figure:: ../images/bundledplugins-forcelogin-dialog.png
|
|
||||||
:align: center
|
|
||||||
:alt: Forced login dialog
|
|
||||||
|
|
||||||
OctoPrint's new forced login dialog.
|
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
Keep in mind that **OctoPrint does not manage your webcam**, it merely embeds it. If you have a webcam,
|
|
||||||
it will still be accessible to users who are not logged in under its (guessable) URL. If you need to restrict
|
|
||||||
access to your webcam, you'll need to find a way to do so directly on the webcam server which - again -
|
|
||||||
is not OctoPrint itself.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
If you want back the old behaviour of allowing anonymous read-only access to your OctoPrint instance, disable
|
|
||||||
the ForceLogin Plugin in OctoPrint's plugin manager.
|
|
||||||
|
|
||||||
.. _sec-bundledplugins-forcelogin-sourcecode:
|
|
||||||
|
|
||||||
Source code
|
|
||||||
-----------
|
|
||||||
|
|
||||||
The source of the ForceLogin plugin is bundled with OctoPrint and can be found in
|
|
||||||
its source repository under ``src/octoprint/plugins/forcelogin``.
|
|
||||||
@@ -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
|
||||||
forcelogin.rst
|
file_check.rst
|
||||||
|
firmware_check.rst
|
||||||
|
gcodeviewer.rst
|
||||||
logging.rst
|
logging.rst
|
||||||
|
loginui.rst
|
||||||
pluginmanager.rst
|
pluginmanager.rst
|
||||||
printer_safety_check.rst
|
printer_safety_check.rst
|
||||||
softwareupdate.rst
|
softwareupdate.rst
|
||||||
|
virtual_printer.rst
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
.. _sec-bundledplugins-loginui:
|
||||||
|
|
||||||
|
Login UI
|
||||||
|
========
|
||||||
|
|
||||||
|
The Login UI plugin has been bundled since OctoPrint 1.4.0 and replaces the ForceLogin plugin bundled with prior
|
||||||
|
versions since 1.3.10.
|
||||||
|
|
||||||
|
If anonymous read-only access is disabled in the :ref:`Access Control settings <sec-features-access_control>`
|
||||||
|
it provides a stand alone login dialog that gets displayed instead of OctoPrint's regular UI.
|
||||||
|
|
||||||
|
.. _fig-bundledplugins-loginui:
|
||||||
|
.. figure:: ../images/bundledplugins-loginui-dialog.png
|
||||||
|
:align: center
|
||||||
|
:alt: Login dialog
|
||||||
|
|
||||||
|
OctoPrint's login dialog.
|
||||||
|
|
||||||
|
The plugin allows theming of the dialog through :ref:`a plugin hook <sec-bundledplugins-loginui-hooks-theming>`.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Since the plugin is absolutely required for the case of anonymous read-only access because in this case the
|
||||||
|
UI itself could not even fully initialize due to a lack of permissions required to do so, it is hidden in the plugin
|
||||||
|
manager and cannot be disabled through that.
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-loginui-hooks:
|
||||||
|
|
||||||
|
Hooks
|
||||||
|
-----
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-loginui-hooks-theming:
|
||||||
|
|
||||||
|
octoprint.plugin.loginui.theming
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. py:function:: loginui_theming_hook(*args, **kwargs)
|
||||||
|
|
||||||
|
Support theming of the login dialog, just in case the core UI is themed as well. Use to return a list of additional
|
||||||
|
CSS file URLs to inject into the login dialog HTML.
|
||||||
|
|
||||||
|
Example usage by a plugin:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def loginui_theming():
|
||||||
|
from flask import url_for
|
||||||
|
return [url_for("plugin.myplugin.static", filename="css/loginui_theme.css")]
|
||||||
|
|
||||||
|
__plugin_hooks__ = {
|
||||||
|
"octoprint.plugin.loginui.theming": loginui_theming
|
||||||
|
}
|
||||||
|
|
||||||
|
Only a list of ready-made URLs to CSS files is supported, neither LESS nor JS. Best use
|
||||||
|
url_for like in the example above to be prepared for any configured prefix URLs.
|
||||||
|
|
||||||
|
:return: A list of additional CSS URLs to inject into the login dialog.
|
||||||
|
:rtype: A list of strings.
|
||||||
|
|
||||||
|
.. _sec-bundledplugins-loginui-sourcecode:
|
||||||
|
|
||||||
|
Source Code
|
||||||
|
-----------
|
||||||
|
|
||||||
|
The source of the Anonymous Usage Tracking plugin is bundled with OctoPrint and can be
|
||||||
|
found in its source repository under ``src/octoprint/plugins/loginui``.
|
||||||
@@ -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,6 +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. Additional
|
||||||
|
config parameters:
|
||||||
|
|
||||||
|
* ``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:
|
||||||
|
|
||||||
@@ -229,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.
|
||||||
@@ -269,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
|
||||||
|
|
||||||
@@ -325,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
|
||||||
@@ -385,8 +463,8 @@ octoprint.plugin.softwareupdate.check_config
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
def get_update_information(*args, **kwargs):
|
def get_update_information(*args, **kwargs):
|
||||||
return dict(
|
return dict(
|
||||||
|
|||||||
@@ -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``.
|
||||||
+19
-18
@@ -1,4 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
#
|
#
|
||||||
# OctoPrint documentation build configuration file, created by
|
# OctoPrint documentation build configuration file, created by
|
||||||
# sphinx-quickstart on Mon Dec 02 17:08:50 2013.
|
# sphinx-quickstart on Mon Dec 02 17:08:50 2013.
|
||||||
@@ -33,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']
|
||||||
@@ -49,8 +54,8 @@ source_suffix = '.rst'
|
|||||||
master_doc = 'index'
|
master_doc = 'index'
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u'OctoPrint'
|
project = 'OctoPrint'
|
||||||
copyright = u'%d-%d, Gina Häußge' % (year_since, year_current) if year_current > year_since else u'%d, Gina Häußge' % year_since
|
copyright = '%d-%d, Gina Häußge' % (year_since, year_current) if year_current > year_since else '%d, Gina Häußge' % year_since
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
@@ -102,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.
|
||||||
@@ -144,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.
|
||||||
@@ -188,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 --------------------------------------------------
|
||||||
@@ -207,8 +208,8 @@ htmlhelp_basename = 'OctoPrintdoc'
|
|||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||||
#latex_documents = [
|
#latex_documents = [
|
||||||
# ('index', 'OctoPrint.tex', u'OctoPrint Documentation',
|
# ('index', 'OctoPrint.tex', 'OctoPrint Documentation',
|
||||||
# u'Gina Häußge', 'manual'),
|
# 'Gina Häußge', 'manual'),
|
||||||
#]
|
#]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
@@ -237,8 +238,8 @@ htmlhelp_basename = 'OctoPrintdoc'
|
|||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [
|
man_pages = [
|
||||||
('index', 'octoprint', u'OctoPrint Documentation',
|
('index', 'octoprint', 'OctoPrint Documentation',
|
||||||
[u'Gina Häußge'], 1)
|
['Gina Häußge'], 1)
|
||||||
]
|
]
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
# If true, show URL addresses after external links.
|
||||||
@@ -251,8 +252,8 @@ man_pages = [
|
|||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
('index', 'OctoPrint', u'OctoPrint Documentation',
|
('index', 'OctoPrint', 'OctoPrint Documentation',
|
||||||
u'Gina Häußge', 'OctoPrint', 'One line description of project.',
|
'Gina Häußge', 'OctoPrint', 'One line description of project.',
|
||||||
'Miscellaneous'),
|
'Miscellaneous'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ config.yaml
|
|||||||
|
|
||||||
If not specified via the command line, the main configuration file ``config.yaml`` for OctoPrint is expected in its
|
If not specified via the command line, the main configuration file ``config.yaml`` for OctoPrint is expected in its
|
||||||
settings folder, which unless defined differently via the command line is located at ``~/.octoprint`` on Linux, at
|
settings folder, which unless defined differently via the command line is located at ``~/.octoprint`` on Linux, at
|
||||||
``%APPDATA%/OctoPrint`` on Windows and at ``~/Library/Application Support/OctoPrint`` on MacOS. If the file is not there,
|
``%APPDATA%/OctoPrint`` on Windows and at ``~/Library/Application Support/OctoPrint`` on macOS. If the file is not there,
|
||||||
you can just create it - it will only get created by OctoPrint once you save settings that deviate from the default
|
you can just create it - it will only get created by OctoPrint once you save settings that deviate from the default
|
||||||
settings.
|
settings.
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ Use the following settings to enable access control:
|
|||||||
# The user manager implementation to use for accessing user information. Currently only a filebased
|
# The user manager implementation to use for accessing user information. Currently only a filebased
|
||||||
# user manager is implemented which stores configured accounts in a YAML file (Default: users.yaml
|
# user manager is implemented which stores configured accounts in a YAML file (Default: users.yaml
|
||||||
# in the default configuration folder, see below)
|
# in the default configuration folder, see below)
|
||||||
userManager: octoprint.users.FilebasedUserManager
|
userManager: octoprint.access.users.FilebasedUserManager
|
||||||
|
|
||||||
# The YAML user file to use. If left out defaults to users.yaml in the default configuration folder.
|
# The YAML user file to use. If left out defaults to users.yaml in the default configuration folder.
|
||||||
userFile: /path/to/users.yaml
|
userFile: /path/to/users.yaml
|
||||||
@@ -283,180 +283,19 @@ 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
|
||||||
|
|
||||||
# Settings for the virtual printer
|
# enable or disable the loading animation
|
||||||
virtualPrinter:
|
showLoadingAnimation: true
|
||||||
|
|
||||||
# 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:
|
||||||
|
|
||||||
@@ -684,6 +523,11 @@ plugins are tracked:
|
|||||||
_disabled:
|
_disabled:
|
||||||
- ...
|
- ...
|
||||||
|
|
||||||
|
# Identifiers of plugins for which python compatibility information will be ignored and
|
||||||
|
# the plugin considered compatible in any case. Only for development, do NOT use in production.
|
||||||
|
_forcedCompatible:
|
||||||
|
- ...
|
||||||
|
|
||||||
# The rest are individual plugin settings, each tracked by their identifier, e.g.:
|
# The rest are individual plugin settings, each tracked by their identifier, e.g.:
|
||||||
some_plugin:
|
some_plugin:
|
||||||
some_setting: true
|
some_setting: true
|
||||||
@@ -1017,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
|
||||||
@@ -1118,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
|
||||||
@@ -1244,6 +1122,9 @@ Use the following settings to configure webcam support:
|
|||||||
# Should be left at 1 for RPi1.
|
# Should be left at 1 for RPi1.
|
||||||
ffmpegThreads: 1
|
ffmpegThreads: 1
|
||||||
|
|
||||||
|
# Videocodec to be used for encoding. Defaults to mpeg2video.
|
||||||
|
ffmpegVideoCodec: mpeg2video
|
||||||
|
|
||||||
# The bitrate to use for rendering the timelapse video. This gets directly passed to ffmpeg.
|
# The bitrate to use for rendering the timelapse video. This gets directly passed to ffmpeg.
|
||||||
bitrate: 5000k
|
bitrate: 5000k
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ logging.yaml
|
|||||||
|
|
||||||
The logging configuration file ``logging.yaml`` for OctoPrint is expected in its settings folder, which unless defined
|
The logging configuration file ``logging.yaml`` for OctoPrint is expected in its settings folder, which unless defined
|
||||||
differently on the command line is located at ``~/.octoprint`` on Linux, at ``%APPDATA%/OctoPrint`` on Windows and at
|
differently on the command line is located at ``~/.octoprint`` on Linux, at ``%APPDATA%/OctoPrint`` on Windows and at
|
||||||
``~/Library/Application Support/OctoPrint`` on MacOS.
|
``~/Library/Application Support/OctoPrint`` on macOS.
|
||||||
|
|
||||||
You can use it to change the log levels of the individual components within OctoPrint, which might be necessary to help
|
You can use it to change the log levels of the individual components within OctoPrint, which might be necessary to help
|
||||||
in debugging issues you are experiencing, or to change the configuration of the logging handlers themselves, e.g. in
|
in debugging issues you are experiencing, or to change the configuration of the logging handlers themselves, e.g. in
|
||||||
@@ -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>`.
|
||||||
@@ -14,24 +14,59 @@ below.
|
|||||||
* Prerequisites:
|
* Prerequisites:
|
||||||
|
|
||||||
* `Python 2.7 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
|
* `Python 2.7 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
|
||||||
|
* `Python 3.7 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
|
||||||
* `Git <https://git-scm.com>`_
|
* `Git <https://git-scm.com>`_
|
||||||
|
|
||||||
* Checkout the OctoPrint sources from their Git repository: ``git clone https://github.com/foosel/OctoPrint.git``
|
* Checkout the OctoPrint sources from their Git repository:
|
||||||
|
|
||||||
|
* ``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 a virtual environment in the checked out source folder to use for installing and running OctoPrint and its
|
* Create virtual environments in the checked out source folder for both Python 2 and Python 3 to use for
|
||||||
dependencies (this avoids potential versioning issues for the dependencies with system wide installed
|
installing and running OctoPrint and its dependencies. Creating virtual environments avoids potential versioning
|
||||||
instances): ``virtualenv venv``
|
issues for the dependencies with system wide installed instances:
|
||||||
* Activate the virtual environment: ``source venv/bin/activate`` (Linux, MacOS) or
|
|
||||||
``source venv/Scripts/activate`` (Git Bash under Windows, see below)
|
* PY2: ``virtualenv --python=python2 venv2``
|
||||||
* Update ``pip`` in the virtual environment: ``pip install --upgrade pip``
|
* 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:
|
||||||
|
|
||||||
|
* PY2: ``source venv2/bin/activate`` (Linux, macOS) or ``source venv2/Scripts/activate`` (Git Bash under Windows, see below)
|
||||||
|
* PY3: ``source venv3/bin/activate`` (Linux, macOS) or ``source venv3/Scripts/activate`` (Git Bash under Windows, see below)
|
||||||
|
|
||||||
|
* Update ``pip`` in the virtual environment:
|
||||||
|
|
||||||
|
* ``pip install --upgrade pip``
|
||||||
|
|
||||||
* 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: ``pip install -e .[develop,plugins]``
|
including its regular *and* development and plugin development dependencies:
|
||||||
|
|
||||||
|
* ``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 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:
|
||||||
|
|
||||||
@@ -41,28 +76,19 @@ Linux
|
|||||||
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:
|
||||||
@@ -70,15 +96,18 @@ Then:
|
|||||||
.. 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 --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:
|
||||||
|
|
||||||
@@ -90,12 +119,19 @@ location, please substitute accordingly.
|
|||||||
|
|
||||||
First download & install:
|
First download & install:
|
||||||
|
|
||||||
* `Python 2.7.12 Windows x86 MSI installer <https://www.python.org/downloads/release/python-2712/>`_
|
* `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:
|
||||||
|
|
||||||
@@ -103,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:
|
||||||
|
|
||||||
@@ -117,9 +157,15 @@ 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::
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
@@ -146,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
|
||||||
@@ -161,7 +207,7 @@ IDE Setup
|
|||||||
.. 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:
|
||||||
@@ -170,47 +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``)
|
||||||
- "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``)
|
|
||||||
|
- **(Linux, Windows)** "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...",
|
||||||
|
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:
|
||||||
|
|
||||||
|
|||||||
+37
-7
@@ -100,20 +100,44 @@ Shutdown
|
|||||||
The server is shutting down.
|
The server is shutting down.
|
||||||
|
|
||||||
ClientOpened
|
ClientOpened
|
||||||
A client has connected to the web server.
|
A client has connected to the push socket.
|
||||||
|
|
||||||
Payload:
|
Payload:
|
||||||
|
|
||||||
* ``remoteAddress``: the remote address (IP) of the client that connected
|
* ``remoteAddress``: the remote address (IP) of the client that connected. On the push socket only available with
|
||||||
|
a valid login session.
|
||||||
|
|
||||||
**Note:** Name changed in version 1.1.0
|
**Note:** Name changed in version 1.1.0
|
||||||
|
|
||||||
ClientClosed
|
ClientAuthed
|
||||||
A client has disconnected from the webserver
|
A client has authenticated a user session on the push socket.
|
||||||
|
|
||||||
Payload:
|
Payload:
|
||||||
|
|
||||||
* ``remoteAddress``: the remote address (IP) of the client that disconnected
|
* ``remoteAddress``: the remote address (IP) of the client that authed. On the push socket only available with a
|
||||||
|
valid login session.
|
||||||
|
* ``username``: the name of the user who authed. On the push socket only available with a valid login session.
|
||||||
|
|
||||||
|
ClientClosed
|
||||||
|
A client has disconnected from the push socket.
|
||||||
|
|
||||||
|
Payload:
|
||||||
|
|
||||||
|
* ``remoteAddress``: the remote address (IP) of the client that disconnected. On the push socket only available
|
||||||
|
with a valid login session.
|
||||||
|
|
||||||
|
UserLoggedIn
|
||||||
|
A user logged in. On the push socket only available with a valid login session with admin rights.
|
||||||
|
|
||||||
|
Payload:
|
||||||
|
|
||||||
|
* ``username``: the name of the user who logged in
|
||||||
|
|
||||||
|
UserLoggedOut
|
||||||
|
A user logged out. On the push socket only available with a valid login session with admin rights.
|
||||||
|
|
||||||
|
Payload:
|
||||||
|
* ``username``: the name of the user who logged out
|
||||||
|
|
||||||
ConnectivityChanged
|
ConnectivityChanged
|
||||||
The server's internet connectivity changed
|
The server's internet connectivity changed
|
||||||
@@ -151,6 +175,9 @@ Error
|
|||||||
An unrecoverable error has been encountered, either as reported by the firmware (e.g. a thermal runaway) or
|
An unrecoverable error has been encountered, either as reported by the firmware (e.g. a thermal runaway) or
|
||||||
on the connection.
|
on the connection.
|
||||||
|
|
||||||
|
Note that this event will not fire for error messages from the firmware that are handled (and as such recovered from)
|
||||||
|
either by OctoPrint or a plugin.
|
||||||
|
|
||||||
Payload:
|
Payload:
|
||||||
|
|
||||||
* ``error``: the error string
|
* ``error``: the error string
|
||||||
@@ -170,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
|
||||||
|
|
||||||
@@ -669,7 +699,7 @@ SettingsUpdated
|
|||||||
.. _sec-events-available_events-printer_profile:
|
.. _sec-events-available_events-printer_profile:
|
||||||
|
|
||||||
Printer Profile
|
Printer Profile
|
||||||
--------
|
---------------
|
||||||
|
|
||||||
PrinterProfileModified
|
PrinterProfileModified
|
||||||
A printer profile was modified.
|
A printer profile was modified.
|
||||||
|
|||||||
@@ -3,8 +3,20 @@
|
|||||||
Access Control
|
Access Control
|
||||||
==============
|
==============
|
||||||
|
|
||||||
When Access Control is enabled, anonymous users (not logged in) will only see
|
OctoPrint's bundled access control feature allows granular permission control
|
||||||
the read-only parts of the UI which are the following:
|
over which users or user groups are allowed to access which parts of OctoPrint.
|
||||||
|
|
||||||
|
The default permissions will deny any kind of access to anonymous (not logged in)
|
||||||
|
users out of the box.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Please note that OctoPrint does *not* control the webcam and merely embeds it, and
|
||||||
|
thus also cannot limit access to it. If an anonymous user correctly guesses the
|
||||||
|
webcam URL, they will thus be able to see it.
|
||||||
|
|
||||||
|
If read-only access for anonymous users is enabled, anonymous users will have
|
||||||
|
read-only access to the following parts of the UI:
|
||||||
|
|
||||||
* printer state
|
* printer state
|
||||||
* available gcode files and stats (upload is disabled)
|
* available gcode files and stats (upload is disabled)
|
||||||
@@ -16,8 +28,8 @@ the read-only parts of the UI which are the following:
|
|||||||
* any components provided through plugins which are enabled for anonymous
|
* any components provided through plugins which are enabled for anonymous
|
||||||
users
|
users
|
||||||
|
|
||||||
Logged in users will get access to everything besides the Settings and System
|
Logged in users without admin flag will be allowed to access everything besides the
|
||||||
Commands, which are admin-only.
|
Settings and System Commands, which are admin-only.
|
||||||
|
|
||||||
If Access Control is disabled, everything is directly accessible. **That also
|
If Access Control is disabled, everything is directly accessible. **That also
|
||||||
includes all administrative functionality as well as full control over the
|
includes all administrative functionality as well as full control over the
|
||||||
@@ -39,6 +51,29 @@ internet or other untrusted networks!).
|
|||||||
publicly reachable by everyone with an internet connection, even with access
|
publicly reachable by everyone with an internet connection, even with access
|
||||||
control enabled.
|
control enabled.
|
||||||
|
|
||||||
|
.. _sec-features-access_control-hooks:
|
||||||
|
|
||||||
|
Available Extension Hooks
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
There are two hooks for plugins to utilize in order to
|
||||||
|
add new configurable permissions into the system and/or adjust the styling of the
|
||||||
|
login dialog.
|
||||||
|
|
||||||
|
.. _sec-features-access_control-hooks-permissions:
|
||||||
|
|
||||||
|
octoprint.access.permissions
|
||||||
|
............................
|
||||||
|
|
||||||
|
See :ref:`here <sec-plugins-hook-permissions>`.
|
||||||
|
|
||||||
|
.. _sec-features-access_control-hooks-loginui:
|
||||||
|
|
||||||
|
octoprint.plugin.loginui.theming
|
||||||
|
................................
|
||||||
|
|
||||||
|
See :ref:`here <sec-bundledplugins-loginui-hooks-theming>`.
|
||||||
|
|
||||||
.. _sec-features-access_control-rerunning_wizard:
|
.. _sec-features-access_control-rerunning_wizard:
|
||||||
|
|
||||||
Rerunning the wizard
|
Rerunning the wizard
|
||||||
|
|||||||
@@ -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.]+)``).
|
||||||
|
|||||||
@@ -11,20 +11,14 @@ is clicked.
|
|||||||
|
|
||||||
Unless :ref:`configured otherwise <sec-configuration-config_yaml-folder>`, OctoPrint expects scripts to be located in
|
Unless :ref:`configured otherwise <sec-configuration-config_yaml-folder>`, OctoPrint expects scripts to be located in
|
||||||
the ``scripts/gcode`` folder in OctoPrint configuration directory (per default ``~/.octoprint`` on Linux, ``%APPDATA%\OctoPrint``
|
the ``scripts/gcode`` folder in OctoPrint configuration directory (per default ``~/.octoprint`` on Linux, ``%APPDATA%\OctoPrint``
|
||||||
on Windows and ``~/Library/Application Support/OctoPrint`` on MacOS).
|
on Windows and ``~/Library/Application Support/OctoPrint`` on macOS).
|
||||||
|
|
||||||
These GCODE scripts are backed by the templating engine Jinja2, allowing more than just
|
These GCODE scripts are backed by the templating engine Jinja2, allowing more than just
|
||||||
simple "send-as-is" scripts but making use of a full blown templating language in order to create your scripts. To
|
simple "send-as-is" scripts but making use of a full blown templating language in order to create your scripts. To
|
||||||
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:
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ When OctoPrint is running in safe mode the following changes to its normal opera
|
|||||||
* OctoPrint will not enable any of the installed third party plugins. OctoPrint considers all plugins third
|
* OctoPrint will not enable any of the installed third party plugins. OctoPrint considers all plugins third
|
||||||
party plugins that do not ship with OctoPrint's sources, so any plugins installed either via `pip` or
|
party plugins that do not ship with OctoPrint's sources, so any plugins installed either via `pip` or
|
||||||
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint/plugins`` (Windows) and
|
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint/plugins`` (Windows) and
|
||||||
``~/Library/Application Support/OctoPrint/plugins`` (MacOS).
|
``~/Library/Application Support/OctoPrint/plugins`` (macOS).
|
||||||
* OctoPrint will not enable any of the installed third party language packs. OctoPrint considers all language packs
|
* OctoPrint will not enable any of the installed third party language packs. OctoPrint considers all language packs
|
||||||
third party language packs that do not ship with OctoPrint's sources, so any language plugins installed
|
third party language packs that do not ship with OctoPrint's sources, so any language plugins installed
|
||||||
through the language pack manager within settings and/or stored in the language pack folder at
|
through the language pack manager within settings and/or stored in the language pack folder at
|
||||||
``~/.octoprint/translations`` (Linux), ``%APPDATA%/OctoPrint/translations`` (Windows) or
|
``~/.octoprint/translations`` (Linux), ``%APPDATA%/OctoPrint/translations`` (Windows) or
|
||||||
``~/Library/Application Support/OctoPrint/translations`` (MacOS).
|
``~/Library/Application Support/OctoPrint/translations`` (macOS).
|
||||||
* OctoPrint will still allow to uninstall third party plugins through the built-in Plugin Manager.
|
* OctoPrint will still allow to uninstall third party plugins through the built-in Plugin Manager.
|
||||||
* OctoPrint will still allow to disable (bundled) plugins that are still enabled.
|
* OctoPrint will still allow to disable (bundled) plugins that are still enabled.
|
||||||
* OctoPrint will not allow to enable third party plugins.
|
* OctoPrint will not allow to enable third party plugins.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 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.
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
To register for all message types, provide ``*`` as the type to register for.
|
To register for all message types, provide ``*`` as the type to register for.
|
||||||
|
|
||||||
``handler`` is expected to be a function accepting one object parameter ``eventObj``, consisting
|
``handler`` is expected to be a function accepting one object parameter ``eventObj``, consisting
|
||||||
of the received message as property ``key`` and the received payload (if any) as property ``data``.
|
of the received message as property ``event`` and the received payload (if any) as property ``data``.
|
||||||
|
|
||||||
.. code-block:: javascript
|
.. code-block:: javascript
|
||||||
|
|
||||||
|
|||||||
@@ -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:
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
.. _sec-modules-users:
|
.. _sec-modules-users:
|
||||||
|
|
||||||
octoprint.users
|
octoprint.access.users
|
||||||
---------------
|
----------------------
|
||||||
|
|
||||||
.. automodule:: octoprint.users
|
.. automodule:: octoprint.access.users
|
||||||
:members:
|
: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:
|
||||||
@@ -13,6 +13,7 @@ plugin subsystem about themselves. These are simple package attributes defined i
|
|||||||
# ...
|
# ...
|
||||||
|
|
||||||
__plugin_name__ = "My Plugin"
|
__plugin_name__ = "My Plugin"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
def __plugin_load__():
|
def __plugin_load__():
|
||||||
# whatever you need to do to load your plugin, if anything at all
|
# whatever you need to do to load your plugin, if anything at all
|
||||||
pass
|
pass
|
||||||
@@ -52,6 +53,20 @@ The following properties are recognized:
|
|||||||
``__plugin_license__``
|
``__plugin_license__``
|
||||||
License of your plugin, optional, overrides the license specified in ``setup.py`` if provided.
|
License of your plugin, optional, overrides the license specified in ``setup.py`` if provided.
|
||||||
|
|
||||||
|
.. _sec-plugins-controlproperties-plugin_pythoncompat:
|
||||||
|
|
||||||
|
``__plugin_pythoncompat__``
|
||||||
|
Python compatibility string of your plugin, optional, defaults to ``>=2.7,<3`` if not set and thus Python 2 but no
|
||||||
|
Python 3 compatibility.
|
||||||
|
|
||||||
|
If your plugin is compatible to Python 3, you should set this to ``>=2.7,<4``, otherwise your plugin will not load
|
||||||
|
on OctoPrint instances installed under Python 3.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
|
|
||||||
|
|
||||||
.. _sec-plugins-controlproperties-plugin_implementation:
|
.. _sec-plugins-controlproperties-plugin_implementation:
|
||||||
|
|
||||||
``__plugin_implementation__``
|
``__plugin_implementation__``
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -41,6 +41,9 @@ development environment::
|
|||||||
|
|
||||||
[...]
|
[...]
|
||||||
|
|
||||||
|
Setting up a local development environment will most likely be less painful than developing directly
|
||||||
|
on the Pi. So do yourself the favor and do that instead where possible.
|
||||||
|
|
||||||
.. important::
|
.. important::
|
||||||
|
|
||||||
This tutorial assumes you are running OctoPrint 1.3.0 and up. Please make sure your version of
|
This tutorial assumes you are running OctoPrint 1.3.0 and up. Please make sure your version of
|
||||||
@@ -54,12 +57,13 @@ We'll start at the most basic form a plugin can take - just a few simple lines o
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
__plugin_version__ = "1.0.0"
|
__plugin_version__ = "1.0.0"
|
||||||
__plugin_description__ = "A quick \"Hello World\" example plugin for OctoPrint"
|
__plugin_description__ = "A quick \"Hello World\" example plugin for OctoPrint"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
|
|
||||||
Saving this as ``helloworld.py`` in ``~/.octoprint/plugins`` yields you something resembling these log entries upon server startup::
|
Saving this as ``helloworld.py`` in ``~/.octoprint/plugins`` yields you something resembling these log entries upon server startup::
|
||||||
|
|
||||||
@@ -75,7 +79,10 @@ Saving this as ``helloworld.py`` in ``~/.octoprint/plugins`` yields you somethin
|
|||||||
|
|
||||||
OctoPrint found that plugin in the folder and took a look into it. The name and the version it displays in that log
|
OctoPrint found that plugin in the folder and took a look into it. The name and the version it displays in that log
|
||||||
entry it got from the ``__plugin_name__`` and ``__plugin_version__`` lines. It also read the description from
|
entry it got from the ``__plugin_name__`` and ``__plugin_version__`` lines. It also read the description from
|
||||||
``__plugin_description__`` and stored it in an internal data structure, but we'll just ignore this for now.
|
``__plugin_description__`` and stored it in an internal data structure, but we'll just ignore this for now. Additionally
|
||||||
|
there is ``__plugin_pythoncompat__`` which tells OctoPrint here that your plugin can be run under any Python versions
|
||||||
|
between 2.7 and 4. That is necessary so that your plugin will be loadable in OctoPrint instances running under either
|
||||||
|
Python 2 or Python 3, and compatibility to both should be your goal.
|
||||||
|
|
||||||
.. _sec-plugins-gettingstarted-sayinghello:
|
.. _sec-plugins-gettingstarted-sayinghello:
|
||||||
|
|
||||||
@@ -86,11 +93,11 @@ Apart from being discovered by OctoPrint, our plugin does nothing yet. We want t
|
|||||||
"Hello World!" to the log upon server startup. Modify our ``helloworld.py`` like this:
|
"Hello World!" to the log upon server startup. Modify our ``helloworld.py`` like this:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:emphasize-lines: 4-8,13
|
:emphasize-lines: 4-8,14
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -101,6 +108,7 @@ Apart from being discovered by OctoPrint, our plugin does nothing yet. We want t
|
|||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
__plugin_version__ = "1.0.0"
|
__plugin_version__ = "1.0.0"
|
||||||
__plugin_description__ = "A quick \"Hello World\" example plugin for OctoPrint"
|
__plugin_description__ = "A quick \"Hello World\" example plugin for OctoPrint"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
and restart OctoPrint. You now get this output in the log::
|
and restart OctoPrint. You now get this output in the log::
|
||||||
@@ -135,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
|
||||||
@@ -284,13 +292,13 @@ of information now defined twice:
|
|||||||
|
|
||||||
The nice thing about our plugin now being a proper Python package is that OctoPrint can and will access the metadata defined
|
The nice thing about our plugin now being a proper Python package is that OctoPrint can and will access the metadata defined
|
||||||
within ``setup.py``! So, we don't really need to define all this data twice. Remove ``__plugin_name__``, ``__plugin_version__``
|
within ``setup.py``! So, we don't really need to define all this data twice. Remove ``__plugin_name__``, ``__plugin_version__``
|
||||||
and ``__plugin_description__`` from ``__init__.py``:
|
and ``__plugin_description__`` from ``__init__.py``, but leave ``__plugin_implementation__`` and ``__plugin_pythoncompat__``:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -298,6 +306,7 @@ and ``__plugin_description__`` from ``__init__.py``:
|
|||||||
def on_after_startup(self):
|
def on_after_startup(self):
|
||||||
self._logger.info("Hello World!")
|
self._logger.info("Hello World!")
|
||||||
|
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
and restart OctoPrint::
|
and restart OctoPrint::
|
||||||
@@ -314,8 +323,8 @@ Our "Hello World" Plugin still gets detected fine, but it's now listed under the
|
|||||||
:emphasize-lines: 10
|
:emphasize-lines: 10
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -324,6 +333,7 @@ Our "Hello World" Plugin still gets detected fine, but it's now listed under the
|
|||||||
self._logger.info("Hello World!")
|
self._logger.info("Hello World!")
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
|
|
||||||
@@ -362,8 +372,8 @@ add the :class:`TemplatePlugin` to our ``HelloWorldPlugin`` class:
|
|||||||
:emphasize-lines: 7
|
:emphasize-lines: 7
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -373,6 +383,7 @@ add the :class:`TemplatePlugin` to our ``HelloWorldPlugin`` class:
|
|||||||
self._logger.info("Hello World!")
|
self._logger.info("Hello World!")
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
Next, we'll create a sub folder ``templates`` underneath our ``octoprint_helloworld`` folder, and within that a file
|
Next, we'll create a sub folder ``templates`` underneath our ``octoprint_helloworld`` folder, and within that a file
|
||||||
@@ -428,8 +439,8 @@ Let's take a look at how all that would look in our plugin's ``__init__.py``:
|
|||||||
:emphasize-lines: 8, 10, 12-13
|
:emphasize-lines: 8, 10, 12-13
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -443,6 +454,7 @@ Let's take a look at how all that would look in our plugin's ``__init__.py``:
|
|||||||
return dict(url="https://en.wikipedia.org/wiki/Hello_world")
|
return dict(url="https://en.wikipedia.org/wiki/Hello_world")
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
Restart OctoPrint. You should see something like this::
|
Restart OctoPrint. You should see something like this::
|
||||||
@@ -462,8 +474,8 @@ Adjust your plugin's ``__init__.py`` like this:
|
|||||||
:emphasize-lines: 15-16
|
:emphasize-lines: 15-16
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -480,6 +492,7 @@ Adjust your plugin's ``__init__.py`` like this:
|
|||||||
return dict(url=self._settings.get(["url"]))
|
return dict(url=self._settings.get(["url"]))
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
Also adjust your plugin's ``templates/helloworld_navbar.jinja2`` like this:
|
Also adjust your plugin's ``templates/helloworld_navbar.jinja2`` like this:
|
||||||
@@ -569,8 +582,8 @@ again since we don't use that anymore:
|
|||||||
:emphasize-lines: 15-19
|
:emphasize-lines: 15-19
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -590,6 +603,7 @@ again since we don't use that anymore:
|
|||||||
]
|
]
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
Restart OctoPrint and shift-reload your browser. Your link in the navigation bar should still point to the URL we
|
Restart OctoPrint and shift-reload your browser. Your link in the navigation bar should still point to the URL we
|
||||||
@@ -666,8 +680,8 @@ like so:
|
|||||||
:emphasize-lines: 9,22-25
|
:emphasize-lines: 9,22-25
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -693,6 +707,7 @@ like so:
|
|||||||
)
|
)
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
Note how we did not add another entry to the return value of :func:`~octoprint.plugin.TemplatePlugin.get_template_configs`.
|
Note how we did not add another entry to the return value of :func:`~octoprint.plugin.TemplatePlugin.get_template_configs`.
|
||||||
@@ -846,8 +861,8 @@ a reference to our CSS file:
|
|||||||
:emphasize-lines: 26
|
:emphasize-lines: 26
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -875,6 +890,7 @@ a reference to our CSS file:
|
|||||||
)
|
)
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
OctoPrint by default bundles all CSS, JavaScript and LESS files to reduce the amount of requests necessary to fully
|
OctoPrint by default bundles all CSS, JavaScript and LESS files to reduce the amount of requests necessary to fully
|
||||||
@@ -931,8 +947,8 @@ Then adjust our returned assets to include our LESS file as well:
|
|||||||
:emphasize-lines: 27
|
:emphasize-lines: 27
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import octoprint.plugin
|
import octoprint.plugin
|
||||||
|
|
||||||
@@ -961,6 +977,7 @@ Then adjust our returned assets to include our LESS file as well:
|
|||||||
)
|
)
|
||||||
|
|
||||||
__plugin_name__ = "Hello World"
|
__plugin_name__ = "Hello World"
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
__plugin_implementation__ = HelloWorldPlugin()
|
__plugin_implementation__ = HelloWorldPlugin()
|
||||||
|
|
||||||
|
|
||||||
@@ -1074,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
|
||||||
|
|||||||
+158
-69
@@ -28,6 +28,7 @@ or as ``postfix`` (after the existing lines).
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
|
from past import basestring
|
||||||
self._gcode_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.scripts")
|
self._gcode_hooks = self._pluginManager.get_hooks("octoprint.comm.protocol.scripts")
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
@@ -35,7 +36,7 @@ or as ``postfix`` (after the existing lines).
|
|||||||
for hook in self._gcodescript_hooks:
|
for hook in self._gcodescript_hooks:
|
||||||
try:
|
try:
|
||||||
retval = self._gcodescript_hooks[hook](self, "gcode", scriptName)
|
retval = self._gcodescript_hooks[hook](self, "gcode", scriptName)
|
||||||
except:
|
except Exception:
|
||||||
self._logger.exception("Error while processing gcodescript hook %s" % hook)
|
self._logger.exception("Error while processing gcodescript hook %s" % hook)
|
||||||
else:
|
else:
|
||||||
if retval is None:
|
if retval is None:
|
||||||
@@ -44,10 +45,8 @@ or as ``postfix`` (after the existing lines).
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
def to_list(data):
|
def to_list(data):
|
||||||
if isinstance(data, str):
|
if isinstance(data, basestring):
|
||||||
data = map(str.strip, data.split("\n"))
|
data = map(x.strip() for x in data.split("\n"))
|
||||||
elif isinstance(data, unicode):
|
|
||||||
data = map(unicode.strip, data.split("\n"))
|
|
||||||
|
|
||||||
if isinstance(data, (list, tuple)):
|
if isinstance(data, (list, tuple)):
|
||||||
return list(data)
|
return list(data)
|
||||||
@@ -66,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.
|
||||||
|
|
||||||
@@ -201,34 +200,93 @@ Available plugin hooks
|
|||||||
.. contents::
|
.. contents::
|
||||||
:local:
|
:local:
|
||||||
|
|
||||||
.. _sec-plugins-hook-accesscontrol-appkey:
|
.. _sec-plugins-hook-permissions:
|
||||||
|
|
||||||
octoprint.accesscontrol.appkey
|
octoprint.access.permissions
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. py:function:: additional_permissions_hook(*args, **kwargs)
|
||||||
|
|
||||||
|
Return a list of additional permissions to register in the system on behalf of the plugin. Use this
|
||||||
|
to add granular permissions to your plugin which can be configured for users and user groups in the general
|
||||||
|
access control settings of OctoPrint.
|
||||||
|
|
||||||
|
Additional permissions must be modelled as ``dict``s with at least a ``key`` and ``name`` field. Possible
|
||||||
|
fields are as follows:
|
||||||
|
|
||||||
|
* ``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``,
|
||||||
|
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
|
||||||
|
``permissions.PLUGIN_EXAMPLE_MY_PERMISSION`` on the ``AccessViewModel`` on the client. Must only contain a-z, A-Z, 0-9 and _.
|
||||||
|
* ``name``: A human readable name for the permission.
|
||||||
|
* ``description``: A human readable description of the permission.
|
||||||
|
* ``permissions``: A list of permissions this permission includes, by key.
|
||||||
|
* ``roles``: A list of roles this permission includes. Roles are simple strings you define. Usually one role will
|
||||||
|
suffice.
|
||||||
|
* ``dangerous``: Whether this permission should be considered dangerous (``True``) or not (``False``)
|
||||||
|
* ``default_groups``: A list of standard groups this permission should be apply to by default. Standard groups
|
||||||
|
are ``admins``, ``users``, ``readonly`` and ``guests``
|
||||||
|
|
||||||
|
The following example is based on some actual code included in the bundled Application Keys plugin and defines
|
||||||
|
one additional permission called ``ADMIN`` with a role ``admin`` which is marked as dangerous (since it gives
|
||||||
|
access to the management to other user's application keys) and by default will only be given to the standard admin
|
||||||
|
group:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def get_additional_permissions(*args, **kwargs):
|
||||||
|
return [
|
||||||
|
dict(key="ADMIN",
|
||||||
|
name="Admin access",
|
||||||
|
description=gettext("Allows administrating all application keys"),
|
||||||
|
roles=["admin"],
|
||||||
|
dangerous=True,
|
||||||
|
default_groups=[ADMIN_GROUP])
|
||||||
|
]
|
||||||
|
|
||||||
|
__plugin_hooks__ = {
|
||||||
|
"octoprint.access.permissions": get_additional_permissions
|
||||||
|
}
|
||||||
|
|
||||||
|
Once registered it can be referenced under the key ``PLUGIN_APPKEYS_ADMIN``.
|
||||||
|
|
||||||
|
:return: A list of additional permissions to register in the system.
|
||||||
|
:rtype: A list of dicts.
|
||||||
|
|
||||||
|
.. _sec-plugins-hook-users-factory:
|
||||||
|
|
||||||
|
octoprint.access.users.factory
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. py:function:: acl_appkey_hook(*args, **kwargs)
|
.. py:function:: user_manager_factory_hook(components, settings, *args, **kwargs)
|
||||||
|
|
||||||
.. deprecated:: 1.3.11
|
Return a :class:`~octoprint.access.users.UserManager` instance to use as global user manager object. This will
|
||||||
|
be called only once during initial server startup.
|
||||||
|
|
||||||
This functionality will be removed in 1.4.0. Use the :ref:`Application Keys Plugin workflow <sec-bundledplugins-appkeys-workflow>` instead.
|
The provided ``components`` is a dictionary containing the already initialized system components:
|
||||||
|
|
||||||
By handling this hook plugins may register additional :ref:`App session key providers <sec-api-apps-sessionkey>`
|
* ``plugin_manager``: The :class:`~octoprint.plugin.core.PluginManager`
|
||||||
within the system.
|
* ``printer_profile_manager``: The :class:`~octoprint.printer.profile.PrinterProfileManager`
|
||||||
|
* ``event_bus``: The :class:`~octoprint.events.EventManager`
|
||||||
|
* ``analysis_queue``: The :class:`~octoprint.filemanager.analysis.AnalysisQueue`
|
||||||
|
* ``slicing_manager``: The :class:`~octoprint.slicing.SlicingManager`
|
||||||
|
* ``file_manager``: The :class:`~octoprint.filemanager.FileManager`
|
||||||
|
* ``plugin_lifecycle_manager``: The :class:`~octoprint.server.LifecycleManager`
|
||||||
|
* ``preemptive_cache``: The :class:`~octoprint.server.util.flask.PreemptiveCache`
|
||||||
|
|
||||||
Overrides this to return your additional app information to be used for validating app session keys. You'll
|
If the factory returns anything but ``None``, it will be assigned to the global ``userManager`` instance.
|
||||||
need to return a list of 3-tuples of the format (id, version, public key).
|
|
||||||
|
|
||||||
The ``id`` should be the (unique) identifier of the app. Using a domain prefix might make sense here, e.g.
|
If none of the registered factories return a user manager instance, the class referenced by the ``config.yaml``
|
||||||
``org.octoprint.example.MyApp``.
|
entry ``accessControl.userManager`` will be initialized if possible, otherwise a stock
|
||||||
|
:class:`~octoprint.access.users.FilebasedUserManager` will be instantiated, linked to the default user storage
|
||||||
|
file ``~/.octoprint/users.yaml``.
|
||||||
|
|
||||||
``version`` should be a string specifying the version of the app for which the public key is valid. You can
|
:param dict components: System components to use for user manager instance initialization
|
||||||
provide the string ``any`` here, in which case the provided public key will be valid for all versions of the
|
:param SettingsManager settings: The global settings manager instance to fetch configuration values from if necessary
|
||||||
app for which no specific public key is defined.
|
:return: The ``userManager`` instance to use globally.
|
||||||
|
:rtype: UserManager subclass or None
|
||||||
|
|
||||||
Finally, the public key is expected to be provided as a PKCS1 string without newlines.
|
|
||||||
|
|
||||||
:return: A list of 3-tuples as described above
|
|
||||||
:rtype: list
|
|
||||||
|
|
||||||
.. _sec-plugins-hook-accesscontrol-keyvalidator:
|
.. _sec-plugins-hook-accesscontrol-keyvalidator:
|
||||||
|
|
||||||
@@ -241,7 +299,7 @@ octoprint.accesscontrol.keyvalidator
|
|||||||
|
|
||||||
``apikey`` will be the API key as read from the request headers.
|
``apikey`` will be the API key as read from the request headers.
|
||||||
|
|
||||||
Hook handlers are expected to return a :class:`~octoprint.users.User` instance here that will then be considered that
|
Hook handlers are expected to return a :class:`~octoprint.access.users.User` instance here that will then be considered that
|
||||||
user making the request. By returning ``None`` or nothing at all, hook handlers signal that they do not handle the
|
user making the request. By returning ``None`` or nothing at all, hook handlers signal that they do not handle the
|
||||||
provided key.
|
provided key.
|
||||||
|
|
||||||
@@ -259,7 +317,7 @@ octoprint.accesscontrol.keyvalidator
|
|||||||
|
|
||||||
:param str apikey: The API key to validate
|
:param str apikey: The API key to validate
|
||||||
:return: The user in whose name the request will be processed further
|
:return: The user in whose name the request will be processed further
|
||||||
:rtype: :class:`~octoprint.users.User`
|
:rtype: :class:`~octoprint.access.users.User`
|
||||||
|
|
||||||
.. _sec-plugins-hook-cli-commands:
|
.. _sec-plugins-hook-cli-commands:
|
||||||
|
|
||||||
@@ -414,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)
|
||||||
@@ -832,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
|
||||||
@@ -849,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:**
|
||||||
|
|
||||||
@@ -1044,6 +1121,27 @@ octoprint.filemanager.preprocessor
|
|||||||
:return: The `file_object` as passed in or None, or a replaced version to use instead for further processing.
|
:return: The `file_object` as passed in or None, or a replaced version to use instead for further processing.
|
||||||
:rtype: AbstractFileWrapper or None
|
:rtype: AbstractFileWrapper or None
|
||||||
|
|
||||||
|
.. _sec-plugins-hook-plugin-loginui-theming:
|
||||||
|
|
||||||
|
octoprint.plugin.loginui.theming
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
See :ref:`here <sec-bundledplugins-loginui-hooks-theming>`.
|
||||||
|
|
||||||
|
.. _sec-plugins-hook-plugin-pluginmanager-reconnect:
|
||||||
|
|
||||||
|
octoprint.plugin.pluginmanager.reconnect_hooks
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
See :ref:`here <sec-bundledplugins-pluginmanager-hooks-reconnect_hooks>`.
|
||||||
|
|
||||||
|
.. _sec-plugins-hook-plugin-softwareupdate-check_config:
|
||||||
|
|
||||||
|
octoprint.plugin.softwareupdate.check_config
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
See :ref:`here <sec-bundledplugins-softwareupdate-hooks-check_config>`.
|
||||||
|
|
||||||
.. _sec-plugins-hook-printer-factory:
|
.. _sec-plugins-hook-printer-factory:
|
||||||
|
|
||||||
octoprint.printer.factory
|
octoprint.printer.factory
|
||||||
@@ -1062,9 +1160,8 @@ octoprint.printer.factory
|
|||||||
* ``analysis_queue``: The :class:`~octoprint.filemanager.analysis.AnalysisQueue`
|
* ``analysis_queue``: The :class:`~octoprint.filemanager.analysis.AnalysisQueue`
|
||||||
* ``slicing_manager``: The :class:`~octoprint.slicing.SlicingManager`
|
* ``slicing_manager``: The :class:`~octoprint.slicing.SlicingManager`
|
||||||
* ``file_manager``: The :class:`~octoprint.filemanager.FileManager`
|
* ``file_manager``: The :class:`~octoprint.filemanager.FileManager`
|
||||||
* ``app_session_manager``: The :class:`~octoprint.server.util.flask.AppSessionManager`
|
|
||||||
* ``plugin_lifecycle_manager``: The :class:`~octoprint.server.LifecycleManager`
|
* ``plugin_lifecycle_manager``: The :class:`~octoprint.server.LifecycleManager`
|
||||||
* ``user_manager``: The :class:`~octoprint.users.UserManager`
|
* ``user_manager``: The :class:`~octoprint.access.users.UserManager`
|
||||||
* ``preemptive_cache``: The :class:`~octoprint.server.util.flask.PreemptiveCache`
|
* ``preemptive_cache``: The :class:`~octoprint.server.util.flask.PreemptiveCache`
|
||||||
|
|
||||||
If the factory returns anything but ``None``, it will be assigned to the global ``printer`` instance.
|
If the factory returns anything but ``None``, it will be assigned to the global ``printer`` instance.
|
||||||
@@ -1216,8 +1313,7 @@ octoprint.server.api.after_request
|
|||||||
|
|
||||||
Allows adding additional after-request-handlers to API endpoints defined by OctoPrint itself and installed plugins.
|
Allows adding additional after-request-handlers to API endpoints defined by OctoPrint itself and installed plugins.
|
||||||
|
|
||||||
Your plugin might need this to further restrict access to API methods. See the bundled "Force Login" plugin for a
|
Your plugin might need this to further restrict access to API methods.
|
||||||
usage example.
|
|
||||||
|
|
||||||
.. important::
|
.. important::
|
||||||
|
|
||||||
@@ -1232,8 +1328,7 @@ octoprint.server.api.before_request
|
|||||||
|
|
||||||
Allows adding additional before-request-handlers to API endpoints defined by OctoPrint itself and installed plugins.
|
Allows adding additional before-request-handlers to API endpoints defined by OctoPrint itself and installed plugins.
|
||||||
|
|
||||||
Your plugin might need this to further restrict access to API methods. See the bundled "Force Login" plugin for a
|
Your plugin might need this to further restrict access to API methods.
|
||||||
usage example.
|
|
||||||
|
|
||||||
.. important::
|
.. important::
|
||||||
|
|
||||||
@@ -1248,8 +1343,7 @@ octoprint.server.http.access_validator
|
|||||||
|
|
||||||
Allows adding additional access validators to the default tornado routers.
|
Allows adding additional access validators to the default tornado routers.
|
||||||
|
|
||||||
Your plugin might need to this to restrict acccess to downloads and webcam snapshots further. See the bundled
|
Your plugin might need to this to restrict acccess to downloads and webcam snapshots further.
|
||||||
"Force Login" plugin for a usage example.
|
|
||||||
|
|
||||||
.. important::
|
.. important::
|
||||||
|
|
||||||
@@ -1373,8 +1467,6 @@ octoprint.server.sockjs.authed
|
|||||||
|
|
||||||
Allows plugins to be notified that a user got authenticated or deauthenticated on the socket (e.g. due to logout).
|
Allows plugins to be notified that a user got authenticated or deauthenticated on the socket (e.g. due to logout).
|
||||||
|
|
||||||
See the bundled :ref:`Forcelogin Plugin <sec-bundledplugins-forcelogin>` for an example on how to utilize this.
|
|
||||||
|
|
||||||
:param object socket: the socket object which is about to be registered
|
:param object socket: the socket object which is about to be registered
|
||||||
:param object user: the user that got authenticated on the socket, or None if the user got deauthenticated
|
:param object user: the user that got authenticated on the socket, or None if the user got deauthenticated
|
||||||
|
|
||||||
@@ -1556,37 +1648,34 @@ octoprint.ui.web.templatetypes
|
|||||||
:return: a list of 3-tuples (template type, rule, sorting spec)
|
:return: a list of 3-tuples (template type, rule, sorting spec)
|
||||||
:rtype: list
|
:rtype: list
|
||||||
|
|
||||||
.. _sec-plugins-hook-users-factory:
|
.. _sec-plugins-hook-timelapse-capture-pre:
|
||||||
|
|
||||||
octoprint.users.factory
|
octoprint.timelapse.capture.pre
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. py:function:: user_manager_factory_hook(components, settings, *args, **kwargs)
|
.. py:function:: capture_pre_hook(filename)
|
||||||
|
|
||||||
Return a :class:`~octoprint.users.UserManager` instance to use as global user manager object. This will
|
Perform specific actions prior to capturing a timelapse frame.
|
||||||
be called only once during initial server startup.
|
|
||||||
|
|
||||||
The provided ``components`` is a dictionary containing the already initialized system components:
|
``filename`` will be the future path of the frame to be saved.
|
||||||
|
|
||||||
* ``plugin_manager``: The :class:`~octoprint.plugin.core.PluginManager`
|
:param str filename: The future path of the frame to be saved.
|
||||||
* ``printer_profile_manager``: The :class:`~octoprint.printer.profile.PrinterProfileManager`
|
:return: None
|
||||||
* ``event_bus``: The :class:`~octoprint.events.EventManager`
|
:rtype: None
|
||||||
* ``analysis_queue``: The :class:`~octoprint.filemanager.analysis.AnalysisQueue`
|
|
||||||
* ``slicing_manager``: The :class:`~octoprint.slicing.SlicingManager`
|
|
||||||
* ``file_manager``: The :class:`~octoprint.filemanager.FileManager`
|
|
||||||
* ``app_session_manager``: The :class:`~octoprint.server.util.flask.AppSessionManager`
|
|
||||||
* ``plugin_lifecycle_manager``: The :class:`~octoprint.server.LifecycleManager`
|
|
||||||
* ``preemptive_cache``: The :class:`~octoprint.server.util.flask.PreemptiveCache`
|
|
||||||
|
|
||||||
If the factory returns anything but ``None``, it will be assigned to the global ``userManager`` instance.
|
.. _sec-plugins-hook-timelapse-capture-post:
|
||||||
|
|
||||||
If none of the registered factories return a user manager instance, the class referenced by the ``config.yaml``
|
octoprint.timelapse.capture.post
|
||||||
entry ``accessControl.userManager`` will be initialized if possible, otherwise a stock
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
:class:`~octoprint.users.FilebasedUserManager` will be instantiated, linked to the default user storage
|
|
||||||
file ``~/.octoprint/users.yaml``.
|
|
||||||
|
|
||||||
:param dict components: System components to use for user manager instance initialization
|
.. py:function:: capture_post_hook(filename, success)
|
||||||
:param SettingsManager settings: The global settings manager instance to fetch configuration values from if necessary
|
|
||||||
:return: The ``userManager`` instance to use globally.
|
|
||||||
:rtype: UserManager subclass or None
|
|
||||||
|
|
||||||
|
Perform specific actions after capturing a timelapse frame.
|
||||||
|
|
||||||
|
``filename`` will be the path of the frame that should have been saved.
|
||||||
|
``sucesss`` indicates whether the capture was successful or not.
|
||||||
|
|
||||||
|
:param str filename: The path of the frame that should have been saved.
|
||||||
|
:param boolean success: Indicates whether the capture was successful or not.
|
||||||
|
:return: None
|
||||||
|
:rtype: None
|
||||||
@@ -16,3 +16,4 @@ Developing Plugins
|
|||||||
viewmodels.rst
|
viewmodels.rst
|
||||||
gettingstarted.rst
|
gettingstarted.rst
|
||||||
distributing.rst
|
distributing.rst
|
||||||
|
python3_migration.rst
|
||||||
@@ -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.
|
||||||
@@ -41,10 +41,8 @@ An overview of these properties follows.
|
|||||||
OctoPrint's file manager, an instance of :class:`octoprint.filemanager.FileManager`.
|
OctoPrint's file manager, an instance of :class:`octoprint.filemanager.FileManager`.
|
||||||
``self._printer``
|
``self._printer``
|
||||||
OctoPrint's printer management object, an instance of :class:`octoprint.printer.PrinterInterface`.
|
OctoPrint's printer management object, an instance of :class:`octoprint.printer.PrinterInterface`.
|
||||||
``self._app_session_manager``
|
|
||||||
OctoPrint's application session manager, an instance of :class:`octoprint.server.util.flask.AppSessionManager`.
|
|
||||||
``self._user_manager``
|
``self._user_manager``
|
||||||
OctoPrint's user manager, an instance of :class:`octoprint.users.UserManager`.
|
OctoPrint's user manager, an instance of :class:`octoprint.access.users.UserManager`.
|
||||||
``self._connectivity_checker``
|
``self._connectivity_checker``
|
||||||
OctoPrint's connectivity checker, an instance of :class:`octoprint.util.ConnectivityChecker`.
|
OctoPrint's connectivity checker, an instance of :class:`octoprint.util.ConnectivityChecker`.
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ Now, the execution order of the ``on_after_startup`` method will be determined b
|
|||||||
|
|
||||||
This will result in the following messages to be generated:
|
This will result in the following messages to be generated:
|
||||||
|
|
||||||
.. code-block:: plain
|
.. code-block:: none
|
||||||
|
|
||||||
Plugin B starting up
|
Plugin B starting up
|
||||||
Plugin C starting up
|
Plugin C starting up
|
||||||
|
|||||||
@@ -0,0 +1,377 @@
|
|||||||
|
.. _sec-plugins-python3:
|
||||||
|
|
||||||
|
Migrating to Python 3
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Python 2 is now EOL as of January 1st 2020. With the release of 1.4.0 OctoPrint will be compatible to both Python 2 and
|
||||||
|
Python 3.
|
||||||
|
|
||||||
|
However, the same doesn't automatically hold true for all of the third party plugins for OctoPrint out there - it will
|
||||||
|
fall to their authors to ensure compatibility to both Python versions.
|
||||||
|
|
||||||
|
This guide is supposed to help plugin authors in making sure their plugins run under Python 2 as well as Python 3,
|
||||||
|
which for now is the goal for OctoPrint's ecosystem, as we'll have to live with existing legacy Python 2 installations
|
||||||
|
for a while to come (the plan is to stay Python 2 compatible until roughly a year after the release of 1.4.0).
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
:local:
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-venv:
|
||||||
|
|
||||||
|
How to get a Python 3 virtual environment with OctoPrint
|
||||||
|
--------------------------------------------------------
|
||||||
|
|
||||||
|
In order to test your plugins for Python 3 compatibility and also to allow for ongoing maintenance against both Python
|
||||||
|
versions, you should create a Python 3 virtual environment next to your Python 2 one. You can then quickly switch between
|
||||||
|
Python 2 and Python 3 simply by ``activate``-ing whichever one you need.
|
||||||
|
|
||||||
|
You can create a Python 3 virtualenv next to your (existing) Python 2 virtualenv and then just activate which one you
|
||||||
|
currently want to use.
|
||||||
|
|
||||||
|
After installing Python 3 on your development system it's as easy as supplying ``--python=/path/to/python3executable``
|
||||||
|
to ``virtualenv``, e.g.:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
virtualenv --python=/usr/bin/python3 venv3
|
||||||
|
|
||||||
|
That will have the virtualenv be created based on Python 3, regardless of whether it's currently running under Python
|
||||||
|
2 or 3. The same works for Python 2 btw:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
virtualenv --python=/usr/bin/python2 venv2
|
||||||
|
|
||||||
|
After creating the virtual environment, make sure to activate & install OctoPrint into it:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
source venv3/bin/activate
|
||||||
|
pip install "OctoPrint>=1.4.0rc1"
|
||||||
|
|
||||||
|
Then create an editable install of your plugin, start the server and start testing:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
pip install -e path/to/your/plugin
|
||||||
|
octoprint serve --debug
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
On Windows that will probably look something like this instead:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
virtualenv --python=C:/Python37/python.exe venv37
|
||||||
|
venv3/Script/activate.bat
|
||||||
|
pip install "OctoPrint>=1.4.0rc1"
|
||||||
|
pip install -e path/to/your/plugin
|
||||||
|
octoprint serve --debug
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
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
|
||||||
|
create a new one based on Python 3 (which should already be present on current OctoPi images):
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
mv ~/oprint ~/oprint.py2
|
||||||
|
virtualenv --python=/usr/bin/python3 oprint
|
||||||
|
source ~/oprint/bin/activate
|
||||||
|
pip install "OctoPrint>=1.4.0"
|
||||||
|
sudo service octoprint restart
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-markup:
|
||||||
|
|
||||||
|
Telling OctoPrint your plugin is Python 3 ready
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
In order for OctoPrint to even load your plugin when it's running under Python 3, it first needs to know your plugin is
|
||||||
|
compatible to a Python 3 environment. By default OctoPrint will assume your plugin isn't and refuse to load it when
|
||||||
|
running under Python 3 itself.
|
||||||
|
|
||||||
|
To tell OctoPrint about this, all you need is to set the ``__plugin_pythoncompat__`` property in your plugins's ``__init__.py``
|
||||||
|
accordingly, e.g.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
|
|
||||||
|
This would tell OctoPrint that your plugin is compatible to all Python versions between 2.7 and 3.x. This should be
|
||||||
|
your target compatibility range for now.
|
||||||
|
|
||||||
|
If at a later date you want to go all-in on Python 3 and mark your plugin as no longer supporting Python 2, tell
|
||||||
|
OctoPrint about this as well:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
__plugin_pythoncompat__ = ">=3,<4"
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
You can also tell OctoPrint to ignore the Python compatibility flags for a specific plugin via `config.yaml`:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
_forcedCompatible:
|
||||||
|
- "myplugin"
|
||||||
|
- "anotherplugin"
|
||||||
|
|
||||||
|
Note that this should only be used temporarily during testing and migration, or to mark an important plugin
|
||||||
|
not under your own control that actually works fine under Python 3 out of the box as compatible while waiting
|
||||||
|
until the plugin author has pushed an update including the needed flags. Do not just blindly mark third party
|
||||||
|
plugins as compatible and then open support requests if that causes issues in your setup.
|
||||||
|
|
||||||
|
Once your plugin is ensured to be compatible and you've released a new version that includes the necessary compatibility
|
||||||
|
flag and changes, is done you also need to mark up your plugin in the Official Plugin Repository (if it's registered
|
||||||
|
therein) so that OctoPrint's built-in Plugin Manager will see that your plugin is compatible as well and allow users
|
||||||
|
to install it through it. In order to do that, you need to add a new flag compatibility.python to the front matter in
|
||||||
|
your plugin registration file and file a pull request for that. Adjust the markdown file so that it contains this:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
compatibility:
|
||||||
|
python: ">=2.7,<3"
|
||||||
|
|
||||||
|
The value here follows the same mechanism as the ``__plugin_pythoncompat__`` property, so ``>=2.7,<3`` for 2 and 3
|
||||||
|
support and ``>=3,<4`` for 3+ support.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Do **not** just mark your plugin as compatible without diligent testing that it actually does work as expected and
|
||||||
|
without flooding ``octoprint.log`` with warnings and errors!
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-pitfalls:
|
||||||
|
|
||||||
|
Common pitfalls during migration
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
Some of the changes in Python 3 compared to Python 2 are sadly backwards incompatible and usually cause a number of
|
||||||
|
common issues in code written for Python 2 when run under Python 3. By now they are pretty well documented and there
|
||||||
|
exist a number of helpful and comprehensive migration guides, three of which I want to mention here.
|
||||||
|
|
||||||
|
One is the official Python 3 porting guide `Porting Python 2 Code to Python 3 <https://docs.python.org/3/howto/pyporting.html>`__
|
||||||
|
which sums up all the important changes and also gives hints on how best to go about running a project which supports
|
||||||
|
both versions for now.
|
||||||
|
|
||||||
|
The second is the `Writing Python 2-3 compatible code <https://python-future.org/compatible_idioms.html>`__ cheat sheet
|
||||||
|
from the Python-Future project, which is a comprehensive list of idioms that are compatible to both Python 2 and 3 and
|
||||||
|
will make your code run under both, utilizing `future <https://python-future.org/>`__ and `six <https://six.readthedocs.io/>`__.
|
||||||
|
I can strongly recommend this cheat sheet, it's what primarily guided me during the migration phase as well.
|
||||||
|
|
||||||
|
The third one is the free online book `Support Python 3: An in-depth guide <http://python3porting.com/toc.html>`__, and
|
||||||
|
especially its chapter on `Common migration problems <http://python3porting.com/problems.html>`__ in which you'll find
|
||||||
|
extensive descriptions of the most troublesome changes in Python 3 and how to overcome them. Please note that with
|
||||||
|
regards to the contents of this book, we are aiming for the "Python 2 and Python 3 without conversion" strategy, so
|
||||||
|
code that runs in both environments. Sadly this book is a bit outdated by now and still references some long-out versions
|
||||||
|
as "upcoming", so with regards to compatible idioms to use, best stick to the Python-Future cheat sheet.
|
||||||
|
|
||||||
|
Looking at the issues encountered by some plugin authors and also my own experiences during the Python 3 migration of
|
||||||
|
OctoPrint's code, the most common problems for these scenarios seem to be byte vs unicode issues, trouble with absolute
|
||||||
|
imports, changes in integer division behaviour and the switch of map, filter and zip to return iterators instead of
|
||||||
|
lists and causing issues in the following code due to that.
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-pitfalls-strings:
|
||||||
|
|
||||||
|
Bytes vs unicode
|
||||||
|
................
|
||||||
|
|
||||||
|
One of if not the most problematic change between Python 2 and 3 surely must be the change in string handling. Under
|
||||||
|
Python 2 your basic string was a byte string, but it could also magically turn into a unicode string depending on what
|
||||||
|
you wrote into it. That did cause some confusion, especially in APIs, and caused quite a mess, which is why the decision
|
||||||
|
was made to go for distinct text and binary types instead, and making the string literal always be a (unicode) text.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Please note that these changes in string handling also affect several Python APIs that operate on files and streams
|
||||||
|
and thus might also affect parts of OctoPrint's plugin interface that inherit from these APIs. Currently only one such
|
||||||
|
case has been reported, as OctoPrint's :py:class:`~octoprint.filemanager.util.LineProcessorStream` will return bytes
|
||||||
|
instead of str on its ``process_line`` function under Python 3 - so here's a heads-up if your plugin happens to utilize that.
|
||||||
|
|
||||||
|
Obviously, that will lead to issues in code using "just strings" when run under Python 2 vs 3. The first step to solve
|
||||||
|
these problems would be to make your scripts behave the same under Python 2 and 3 by putting this right at the top of
|
||||||
|
all your plugin's python files:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
That will make your files behave as if they were running under Python 3, even when run under Python 2, and your string
|
||||||
|
literals will now be the text data type, which - annoyingly - is a different one under Python 2 vs 3, ``unicode`` vs ``str`` to
|
||||||
|
be exact. Heads-up here - under Python 2 there's also a ``str`` type, but that one is for binary data. Yes, I know, this
|
||||||
|
ain't fun.
|
||||||
|
|
||||||
|
In any case, once you've done this, make sure that everything in your code that should be text is text (``unicode`` under
|
||||||
|
Python 2, ``str`` under Python 3), and everything that should be binary is binary (``str`` under Python 2, ``bytes`` under Python 3).
|
||||||
|
A good rule of thumb is that you usually want to use text as much as possible within your application and only convert
|
||||||
|
to/from bytes at the outskirts, e.g. when writing to a file, a socket or something else machine like. Note that you do
|
||||||
|
NOT need to convert to bytes when implementing API endpoints that return JSON, as that should use text with unicode
|
||||||
|
anyhow.
|
||||||
|
|
||||||
|
OctoPrint includes two utility methods you should use to ensure your strings enter/exit your code in the right format,
|
||||||
|
under both Python versions: :py:func:`octoprint.util.to_bytes` and :py:func:`octoprint.util.to_unicode`. Use them to ensure the correct data
|
||||||
|
types and to avoid weird conversion and encoding issues during runtime.
|
||||||
|
|
||||||
|
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
|
||||||
|
`cheat sheet <https://python-future.org/compatible_idioms.html#strings-and-bytes>`__.
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-pitfalls-absolute-imports:
|
||||||
|
|
||||||
|
Absolute imports
|
||||||
|
................
|
||||||
|
|
||||||
|
Python 3 now defaults to absolute imports, meaning that trying to import a sub package with a
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import my_sub_package
|
||||||
|
|
||||||
|
will now fail with an error. You'll need to explicitly make the import a relative one:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from . import my_sub_package
|
||||||
|
|
||||||
|
To make your code behave the same in that regard unter both Python 2 and Python 3, you should add the corresponding
|
||||||
|
future import:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from __future__ import absolute_imports
|
||||||
|
|
||||||
|
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
|
||||||
|
`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:
|
||||||
|
|
||||||
|
Integer division
|
||||||
|
................
|
||||||
|
|
||||||
|
When you divide two integers in Python 2 you'll get back an integer, rounded down. In Python 3 however you'll now get
|
||||||
|
a float. That means you might have to revisit some places where you do integer divisions and might rely on the result
|
||||||
|
to be an integer as well (e.g. when using a calculation result as an index in an array or something like that).
|
||||||
|
|
||||||
|
Yet again there's a future-import to apply to your files in order to at least have them behave the same in that regard
|
||||||
|
under both Python 2 and Python 3:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
|
||||||
|
You can read more about this specific issue in the `Python porting guide <https://docs.python.org/3/howto/pyporting.html#division>`__
|
||||||
|
and in the `cheat sheet <https://python-future.org/compatible_idioms.html#division>`__.
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-pitfalls-iterators:
|
||||||
|
|
||||||
|
Iterators instead of list from map, filter, zip
|
||||||
|
...............................................
|
||||||
|
|
||||||
|
The built-in functions ``map``, ``filter`` and ``zip`` return a ``list`` with their result in Python 2. In Python 3 they have been
|
||||||
|
switched to returning iterators. That can cause trouble with code handling the result (e.g. if you try to return it as
|
||||||
|
part of a JSON response on an API endpoint).
|
||||||
|
|
||||||
|
The easiest way to solve this is to make sure to wrap any ``map``/``filter``/``zip`` calls into a ``list`` constructor if the result is
|
||||||
|
to be used outside of the calling code (even though that comes with a small performance penalty under Python 2):
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
result1 = filter(lambda x: x is not None, my_collection)
|
||||||
|
result2 = list(filter(lambda x: x is not None, my_collection))
|
||||||
|
|
||||||
|
assert(isinstance(result1, list)) # Python 2 passes, Python 3 fails
|
||||||
|
assert(isinstance(result2, list)) # Python 2 and 3 pass
|
||||||
|
|
||||||
|
There also exist further options, take a look at the `cheat sheet <https://python-future.org/compatible_idioms.html#map>`__.
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-checklist:
|
||||||
|
|
||||||
|
Checklist
|
||||||
|
---------
|
||||||
|
|
||||||
|
As a summary, follow this checklist to migrate your plugin to be compatible to both Python 2 and 3:
|
||||||
|
|
||||||
|
* Create a Python 3 virtualenv and install OctoPrint and your plugin into it for testing.
|
||||||
|
* Tell OctoPrint your plugin is Python 2 and 3 compatible by adding a new property ``__plugin_pycompat__`` to its
|
||||||
|
``__init__.py``:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
__plugin_pythoncompat__ = ">=2.7,<4"
|
||||||
|
|
||||||
|
* Add a compatibility header to all `py` files to ensure similar basic behaviour under Python 2 and Python 3:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
* 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
|
||||||
|
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 (don't forget to
|
||||||
|
increment the version!), update your registration file in the Official Plugin Repository to include the correct
|
||||||
|
Python compatibility information as well:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
compatibility:
|
||||||
|
python: ">=2.7,<4"
|
||||||
|
|
||||||
|
.. _sec-plugins-python3-furtherreading:
|
||||||
|
|
||||||
|
Further reading
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
|
||||||
|
`Porting Python 2 Code to Python 3 <https://docs.python.org/3/howto/pyporting.html>`__
|
||||||
|
The official Python 3 porting guide which sums up all the important changes and also gives hints on how best to
|
||||||
|
go about running a project which supports both versions for now.
|
||||||
|
|
||||||
|
`Cheat Sheet: Writing Python 2-3 compatible code <https://python-future.org/compatible_idioms.html>`__
|
||||||
|
A comprehensive list of idioms that are compatible to both Python 2 and 3 and will make your code run under both,
|
||||||
|
utilizing `future <https://python-future.org/>`__ and `six <https://six.readthedocs.io/>`__. Strongly recommended.
|
||||||
|
|
||||||
|
`Supporting Python 3: An in-depth guide <http://python3porting.com/bookindex.html>`__
|
||||||
|
A free online book on the switch to Python 3. Sadly seems a bit outdated by now, so with regards to compatible
|
||||||
|
idioms to use, best stick to the cheat sheet. Gives some interesting background however.
|
||||||
|
|
||||||
|
`Towards Python 3 and OctoPrint 1.4.0 <https://community.octoprint.org/t/towards-python-3-and-octoprint-1-4-0/12382?u=foosel>`__
|
||||||
|
Forum topic discussing OctoPrint 1.4.0's roadmap including Python 3 compatibility and time frame.
|
||||||
|
|
||||||
|
`Migrating plugins to Python 2 & 3 compatibility - experiences? <https://community.octoprint.org/t/migrating-plugins-to-python-2-3-compatibility-experiences/16294?u=foosel>`__
|
||||||
|
Forum topic collecting experiences by plugin developers in migrating their plugins to achieve Python 2 & 3
|
||||||
|
compatibility.
|
||||||
|
|
||||||
|
|
||||||
+44
-31
@@ -220,6 +220,11 @@ onUserLoggedIn(user)
|
|||||||
onUserLoggedOut()
|
onUserLoggedOut()
|
||||||
Called when a user gets logged out of the web app.
|
Called when a user gets logged out of the web app.
|
||||||
|
|
||||||
|
onUserPermissionsChanged(user)
|
||||||
|
Called when a change in the permissions of the current user is detected. The user data of the just logged in user
|
||||||
|
will be provided as only parameter. Note that this may also be triggered for not logged in guests if the guest
|
||||||
|
group is modified. In this case ``user`` will be undefined.
|
||||||
|
|
||||||
onTabChange(next, current)
|
onTabChange(next, current)
|
||||||
Called before the main tab view switches to a new tab, so `before` the new tab becomes visible. Called with the
|
Called before the main tab view switches to a new tab, so `before` the new tab becomes visible. Called with the
|
||||||
next (changed to) and current (still visible) tab's hash (e.g. ``#control``). Note that ``current`` might be undefined
|
next (changed to) and current (still visible) tab's hash (e.g. ``#control``). Note that ``current`` might be undefined
|
||||||
@@ -313,13 +318,13 @@ Web interface startup
|
|||||||
|
|
||||||
sequenceDiagram
|
sequenceDiagram
|
||||||
participant Main
|
participant Main
|
||||||
participant onServerConnect
|
|
||||||
participant fetchSettings
|
|
||||||
participant bindViewModels
|
|
||||||
participant DataUpdater
|
participant DataUpdater
|
||||||
participant LoginStateViewModel
|
participant LoginStateViewModel
|
||||||
|
participant SettingsViewModel
|
||||||
|
participant UiStateViewModel
|
||||||
|
|
||||||
Note right of DataUpdater: connectCallback = undefined
|
Note over DataUpdater: connectCallback = undefined
|
||||||
|
Note over UiStateViewModel: loaded = false
|
||||||
|
|
||||||
activate Main
|
activate Main
|
||||||
|
|
||||||
@@ -337,52 +342,60 @@ Web interface startup
|
|||||||
Main->>+DataUpdater: connectCallback = onServerConnect
|
Main->>+DataUpdater: connectCallback = onServerConnect
|
||||||
Note right of DataUpdater: connectCallback = onServerConnect
|
Note right of DataUpdater: connectCallback = onServerConnect
|
||||||
DataUpdater-->>-Main: ok
|
DataUpdater-->>-Main: ok
|
||||||
Main->>+onServerConnect: call
|
Main->>+Main: onServerConnect
|
||||||
onServerConnect->>+LoginStateViewModel: passiveLogin
|
Main->>+LoginStateViewModel: passiveLogin
|
||||||
LoginStateViewModel-->>onServerConnect: ok
|
LoginStateViewModel-->>Main: ok
|
||||||
onServerConnect-->>Main: ok
|
Main-->>Main: ok
|
||||||
deactivate onServerConnect
|
deactivate Main
|
||||||
deactivate Main
|
deactivate Main
|
||||||
|
|
||||||
LoginStateViewModel->>+LoginStateViewModel: asynchronous passive login
|
LoginStateViewModel->>+LoginStateViewModel: asynchronous passive login
|
||||||
Note over Main,LoginStateViewModel: Session available!
|
Note over Main,UiStateViewModel: Session available!
|
||||||
LoginStateViewModel-X+onServerConnect: done
|
LoginStateViewModel-X+Main: done
|
||||||
deactivate LoginStateViewModel
|
deactivate LoginStateViewModel
|
||||||
deactivate LoginStateViewModel
|
deactivate LoginStateViewModel
|
||||||
|
|
||||||
onServerConnect->>+DataUpdater: initialized
|
Main->>+DataUpdater: initialized
|
||||||
Note right of DataUpdater: initialized = true
|
Note right of DataUpdater: initialized = true
|
||||||
DataUpdater->DataUpdater: trigger stored callbacks
|
DataUpdater->DataUpdater: trigger stored callbacks
|
||||||
DataUpdater-->>-onServerConnect: ok
|
DataUpdater-->>-Main: ok
|
||||||
onServerConnect-X+Main: done
|
|
||||||
deactivate onServerConnect
|
|
||||||
|
|
||||||
Main->>+fetchSettings: call
|
Main->>+Main: fetchSettings
|
||||||
Note right of fetchSettings: trigger onStartup
|
Note right of Main: trigger onStartup
|
||||||
|
|
||||||
fetchSettings-->>Main: ok
|
Main->>+SettingsViewModel: requestData
|
||||||
|
SettingsViewModel-->>Main: ok
|
||||||
|
deactivate Main
|
||||||
deactivate Main
|
deactivate Main
|
||||||
|
|
||||||
fetchSettings->>+fetchSettings: asynchronous settings fetch
|
SettingsViewModel->>+SettingsViewModel: asynchronous settings fetch
|
||||||
fetchSettings->>+bindViewModels: call
|
Note over Main,UiStateViewModel: Settings available!
|
||||||
|
SettingsViewModel-X+Main: done
|
||||||
|
deactivate SettingsViewModel
|
||||||
|
deactivate SettingsViewModel
|
||||||
|
|
||||||
|
Main->>+Main: bindViewModels
|
||||||
|
|
||||||
loop for each view model
|
loop for each view model
|
||||||
bindViewModels->bindViewModels: trigger onBeforeBinding
|
Main->Main: trigger onBeforeBinding
|
||||||
bindViewModels->bindViewModels: trigger onBoundTo
|
Main->Main: trigger onBoundTo
|
||||||
bindViewModels->bindViewModels: trigger onAfterBinding
|
Main->Main: trigger onAfterBinding
|
||||||
end
|
end
|
||||||
|
|
||||||
bindViewModels->bindViewModels: trigger onAllBound
|
Main->Main: trigger onAllBound
|
||||||
opt User is logged in
|
opt User is logged in
|
||||||
bindViewModels->>+LoginStateViewModel: onAllBound
|
Main->>+LoginStateViewModel: onAllBound
|
||||||
LoginStateViewModel->LoginStateViewModel: trigger onUserLoggedIn
|
LoginStateViewModel->LoginStateViewModel: trigger onUserLoggedIn
|
||||||
LoginStateViewModel-->>-bindViewModels: ok
|
LoginStateViewModel-->>-Main: ok
|
||||||
end
|
end
|
||||||
bindViewModels->bindViewModels: trigger onStartupComplete
|
|
||||||
bindViewModels-->>-fetchSettings: ok
|
|
||||||
|
|
||||||
deactivate fetchSettings
|
Main->>+UiStateViewModel: loaded
|
||||||
deactivate fetchSettings
|
Note right of UiStateViewModel: loaded = true
|
||||||
|
UiStateViewModel-->>-Main: ok
|
||||||
|
|
||||||
|
Main->Main: trigger onStartupComplete
|
||||||
|
deactivate Main
|
||||||
|
deactivate Main
|
||||||
|
|
||||||
|
|
||||||
.. _sec-plugins-viewmodels-reconnect:
|
.. _sec-plugins-viewmodels-reconnect:
|
||||||
@@ -425,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>`_
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
__author__ = "Gina Häußge <osd@foosel.net>"
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
__license__ = 'The MIT License <http://opensource.org/licenses/MIT>'
|
__license__ = 'The MIT License <http://opensource.org/licenses/MIT>'
|
||||||
@@ -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)
|
||||||
|
|
||||||
@@ -84,7 +89,7 @@ class CodeBlockExt(CodeBlock):
|
|||||||
return node
|
return node
|
||||||
|
|
||||||
# replace all created literal_blocks with literal_block_ext instances
|
# replace all created literal_blocks with literal_block_ext instances
|
||||||
return map(find_and_wrap_literal_block, code_block)
|
return list(map(find_and_wrap_literal_block, code_block))
|
||||||
|
|
||||||
def _wrap_literal_block(self, node):
|
def _wrap_literal_block(self, node):
|
||||||
literal = literal_block_ext.from_literal_block(node)
|
literal = literal_block_ext.from_literal_block(node)
|
||||||
@@ -160,10 +165,10 @@ class PygmentsBridgeExt(object):
|
|||||||
# for py3, recognize interactive sessions, but do not try parsing...
|
# for py3, recognize interactive sessions, but do not try parsing...
|
||||||
lexer = sphinx.highlighting.lexers['pycon3']
|
lexer = sphinx.highlighting.lexers['pycon3']
|
||||||
elif lang == 'guess':
|
elif lang == 'guess':
|
||||||
try:
|
# try:
|
||||||
lexer = sphinx.highlighting.guess_lexer(source)
|
lexer = sphinx.highlighting.guess_lexer(source)
|
||||||
except Exception:
|
# except Exception:
|
||||||
lexer = sphinx.highlighting.lexers['none']
|
# lexer = sphinx.highlighting.lexers['none']
|
||||||
else:
|
else:
|
||||||
if lang in sphinx.highlighting.lexers:
|
if lang in sphinx.highlighting.lexers:
|
||||||
lexer = sphinx.highlighting.lexers[lang]
|
lexer = sphinx.highlighting.lexers[lang]
|
||||||
@@ -255,4 +260,4 @@ def setup(app):
|
|||||||
handler = (visit_literal_block_ext, depart_literal_block_ext)
|
handler = (visit_literal_block_ext, depart_literal_block_ext)
|
||||||
app.add_node(literal_block_ext, html=handler, latex=handler, text=handler)
|
app.add_node(literal_block_ext, html=handler, latex=handler, text=handler)
|
||||||
|
|
||||||
return dict(version="0.1")
|
return dict(version="0.1")
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
__author__ = "Gina Häußge <osd@foosel.net>"
|
__author__ = "Gina Häußge <osd@foosel.net>"
|
||||||
__license__ = 'The MIT License <http://opensource.org/licenses/MIT>'
|
__license__ = 'The MIT License <http://opensource.org/licenses/MIT>'
|
||||||
@@ -11,7 +11,8 @@ import requests
|
|||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
|
|
||||||
from sphinx.directives.code import LiteralIncludeReader, LiteralInclude, dedent_lines, \
|
from sphinx.directives.code import LiteralIncludeReader, LiteralInclude, dedent_lines, \
|
||||||
nodes, set_source_info, 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
|
||||||
@@ -39,11 +40,10 @@ class OnlineIncludeReader(LiteralIncludeReader):
|
|||||||
|
|
||||||
return lines
|
return lines
|
||||||
except (IOError, OSError):
|
except (IOError, OSError):
|
||||||
raise IOError(_('Include file %r not found or reading it failed') % filename)
|
raise IOError('Include file %r not found or reading it failed' % filename)
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
raise UnicodeError(_('Encoding %r used for reading included file %r seems to '
|
raise UnicodeError('Encoding %r used for reading included file %r seems to '
|
||||||
'be wrong, try giving an :encoding: option') %
|
'be wrong, try giving an :encoding: option' % (self.encoding, filename))
|
||||||
(self.encoding, filename))
|
|
||||||
|
|
||||||
|
|
||||||
class OnlineIncludeDirective(LiteralInclude):
|
class OnlineIncludeDirective(LiteralInclude):
|
||||||
@@ -54,18 +54,16 @@ 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)
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[pytest]
|
||||||
|
testpaths = src tests
|
||||||
|
addopts = --doctest-modules
|
||||||
|
--doctest-repr=octoprint.util:pp
|
||||||
|
--ignore=src/octoprint/vendor
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -8,15 +10,17 @@ basedir = os.path.dirname(os.path.realpath(__file__))
|
|||||||
old = os.path.join(basedir, "octoprint")
|
old = os.path.join(basedir, "octoprint")
|
||||||
if os.path.exists(old):
|
if os.path.exists(old):
|
||||||
# rename left-overs from old file structure
|
# rename left-overs from old file structure
|
||||||
print """
|
print("""
|
||||||
Found left-overs from old file structure, renaming to
|
Found left-overs from old file structure, renaming to
|
||||||
"octoprint.backup". Please remove this manually (I don't
|
"octoprint.backup". Please remove this manually (I don't
|
||||||
dare to do so myself since you might have changes in there
|
dare to do so myself since you might have changes in there
|
||||||
I don't know anything about).
|
I don't know anything about).
|
||||||
"""
|
""")
|
||||||
os.rename(old, os.path.join(basedir, "octoprint.backup"))
|
os.rename(old, os.path.join(basedir, "octoprint.backup"))
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(basedir, "src"))
|
sys.path.insert(0, os.path.join(basedir, "src"))
|
||||||
|
|
||||||
import octoprint
|
import octoprint
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
sys.argv.append("serve")
|
||||||
octoprint.main()
|
octoprint.main()
|
||||||
+23
-1
@@ -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/service/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
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
license_file = LICENSE.txt
|
license_file = LICENSE.txt
|
||||||
|
|
||||||
|
[bdist_wheel]
|
||||||
|
universal = 1
|
||||||
|
|
||||||
[versioneer]
|
[versioneer]
|
||||||
VCS = git
|
VCS = git
|
||||||
style = pep440-tag
|
style = pep440-tag
|
||||||
@@ -9,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
|
||||||
@@ -9,91 +8,136 @@ import versioneer
|
|||||||
import sys
|
import sys
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "src"))
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "src"))
|
||||||
import octoprint_setuptools
|
import octoprint_setuptools
|
||||||
|
import setuptools
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Supported python versions
|
# Supported python versions
|
||||||
PYTHON_REQUIRES = ">=2.7.9,<3"
|
# we test against 2.7, 3.6 and 3.7, so that's what we'll mark as supported
|
||||||
|
PYTHON_REQUIRES = ">=2.7.9, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4"
|
||||||
|
|
||||||
|
# Requirements for setup.py
|
||||||
|
SETUP_REQUIRES = [
|
||||||
|
"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.10.1,<0.11", # 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
|
||||||
"Flask-Login>=0.2.11,<0.3", # some functions changed to properties in 0.3
|
|
||||||
"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-Principal>=0.4,<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
|
||||||
"werkzeug>=0.15.1,<0.16",
|
"Flask-Babel>=1.0,<2",
|
||||||
"cachelib>=0.1,<0.2",
|
"Flask-Assets>=2.0,<3",
|
||||||
"PyYAML>=5.1,<6",
|
"werkzeug>=1.0.1,<2",
|
||||||
"markdown>=3.0,<3.1",
|
"itsdangerous>=1.1.0,<2",
|
||||||
"pyserial>=3.4,<3.5",
|
"cachelib>=0.1,<1",
|
||||||
"netaddr>=0.7.19,<0.8",
|
"PyYAML>=5.3.1,<6",
|
||||||
"watchdog>=0.9.0,<0.10",
|
"pyserial>=3.4,<4",
|
||||||
|
"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.21.0,<3",
|
"semantic_version>=2.8.5,<3",
|
||||||
"semantic_version>=2.6,<2.7",
|
"psutil>=5.7,<6",
|
||||||
"psutil>=5.6.1,<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",
|
||||||
"chainmap>=1.0.3,<1.1",
|
"wrapt>=1.12.1,<2",
|
||||||
"future>=0.17.1,<0.18",
|
"emoji>=0.5.4,<1",
|
||||||
"scandir>=1.10,<1.11",
|
"frozendict>=1.2,<2",
|
||||||
"websocket-client>=0.56,<0.57",
|
"sentry-sdk>=0.15.1,<1",
|
||||||
"wrapt>=1.11.1,<1.12",
|
"filetype>=1.0.7,<2",
|
||||||
"futures>=3.2,<3.3",
|
|
||||||
"emoji>=0.5.1,<0.6",
|
# vendor bundle dependencies
|
||||||
"monotonic>=1.5,<1.6",
|
"unidecode>=0.04.14,<0.05", # dependency of awesome-slugify
|
||||||
"frozendict>=1.2,<1.3",
|
"blinker>=1.4,<2" # dependency of flask_principal
|
||||||
"sentry-sdk==0.7.7",
|
|
||||||
"typing>=3.6.6,<4",
|
|
||||||
"filetype>=1.0.5,<2"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if sys.platform == "darwin":
|
# Python 2 specific requirements
|
||||||
INSTALL_REQUIRES.append("appdirs>=1.4.0")
|
INSTALL_REQUIRES_PYTHON2 = [
|
||||||
|
"futures>=3.3,<4",
|
||||||
|
"monotonic>=1.5,<2",
|
||||||
|
"scandir>=1.10,<2",
|
||||||
|
"chainmap>=1.0.3,<2",
|
||||||
|
"typing>=3.7.4.1,<4"
|
||||||
|
]
|
||||||
|
|
||||||
|
# OSX specific requirements
|
||||||
|
INSTALL_REQUIRES_OSX = [
|
||||||
|
"appdirs>=1.4.4",
|
||||||
|
]
|
||||||
|
|
||||||
# Additional requirements for optional install options
|
# Additional requirements for optional install options
|
||||||
EXTRA_REQUIRES = dict(
|
EXTRA_REQUIRES = dict(
|
||||||
# Dependencies for developing OctoPrint
|
# Dependencies for developing OctoPrint
|
||||||
develop=[
|
develop=[
|
||||||
# Testing dependencies
|
# Testing dependencies - SEE ALSO tox.ini
|
||||||
"mock>=2.0.0,<3",
|
"mock>=3.0.5,<4",
|
||||||
"nose>=1.3.7,<1.4",
|
"pytest==4.6.10",
|
||||||
|
"pytest-doctest-custom>=1.0.0,<2",
|
||||||
"ddt",
|
"ddt",
|
||||||
|
|
||||||
# Documentation dependencies
|
# linter
|
||||||
"sphinx>=1.6,<1.7",
|
"flake8",
|
||||||
"sphinxcontrib-httpdomain",
|
|
||||||
"sphinxcontrib-mermaid>=0.3",
|
# profiler
|
||||||
"sphinx_rtd_theme",
|
"pyinstrument",
|
||||||
"readthedocs-sphinx-ext==0.5.7"
|
|
||||||
],
|
],
|
||||||
|
|
||||||
# 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
|
||||||
DEPENDENCY_LINKS = []
|
DEPENDENCY_LINKS = []
|
||||||
|
|
||||||
|
# adapted from https://hynek.me/articles/conditional-python-dependencies/
|
||||||
|
if int(setuptools.__version__.split(".", 1)[0]) < 18:
|
||||||
|
# no bdist_wheel support for setuptools < 18 since we build universal wheels and our optional dependencies
|
||||||
|
# would get lost there
|
||||||
|
assert "bdist_wheel" not in sys.argv
|
||||||
|
|
||||||
|
# add optional dependencies for setuptools versions < 18 that don't yet support environment markers
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
|
INSTALL_REQUIRES += INSTALL_REQUIRES_PYTHON2
|
||||||
|
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
INSTALL_REQUIRES += INSTALL_REQUIRES_OSX
|
||||||
|
else:
|
||||||
|
# environment markers supported
|
||||||
|
EXTRA_REQUIRES[":python_version < '3'"] = INSTALL_REQUIRES_PYTHON2
|
||||||
|
EXTRA_REQUIRES[":sys_platform == 'darwin'"] = INSTALL_REQUIRES_OSX
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------------------------------------
|
||||||
# Anything below here is just command setup and general setup configuration
|
# Anything below here is just command setup and general setup configuration
|
||||||
|
|
||||||
@@ -104,14 +148,14 @@ def read_file_contents(path):
|
|||||||
with codecs.open(path, encoding="utf-8") as f:
|
with codecs.open(path, encoding="utf-8") as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
def data_copy_build_py_factory(files, baseclass):
|
def md_to_html_build_py_factory(files, baseclass):
|
||||||
class data_copy_build_py(baseclass):
|
class md_to_html_build_py(baseclass):
|
||||||
files = dict()
|
files = dict()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
import shutil
|
print("RUNNING md_to_html_build_py")
|
||||||
if not self.dry_run:
|
if not self.dry_run:
|
||||||
for directory, files in self.__class__.files.items():
|
for directory, files in self.files.items():
|
||||||
target_dir = os.path.join(self.build_lib, directory)
|
target_dir = os.path.join(self.build_lib, directory)
|
||||||
self.mkpath(target_dir)
|
self.mkpath(target_dir)
|
||||||
|
|
||||||
@@ -119,18 +163,27 @@ def data_copy_build_py_factory(files, baseclass):
|
|||||||
if isinstance(entry, tuple):
|
if isinstance(entry, tuple):
|
||||||
if len(entry) != 2:
|
if len(entry) != 2:
|
||||||
continue
|
continue
|
||||||
source, dest = entry
|
source, dest = entry[0], os.path.join(target_dir, entry[1])
|
||||||
else:
|
else:
|
||||||
source = dest = entry
|
source = entry
|
||||||
shutil.copy(source, os.path.join(target_dir, dest))
|
dest = os.path.join(target_dir, source + ".html")
|
||||||
|
|
||||||
|
print("Rendering markdown from {} to {}".format(source, dest))
|
||||||
|
|
||||||
|
from markdown import markdownFromFile
|
||||||
|
markdownFromFile(input=source,
|
||||||
|
output=dest,
|
||||||
|
encoding="utf-8")
|
||||||
baseclass.run(self)
|
baseclass.run(self)
|
||||||
|
|
||||||
return type(data_copy_build_py)(data_copy_build_py.__name__,
|
return type(md_to_html_build_py)(md_to_html_build_py.__name__,
|
||||||
(data_copy_build_py,),
|
(md_to_html_build_py,),
|
||||||
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
|
||||||
@@ -142,10 +195,9 @@ def get_cmdclass():
|
|||||||
bundled_dir = os.path.join("src", "octoprint", "translations")
|
bundled_dir = os.path.join("src", "octoprint", "translations")
|
||||||
cmdclass.update(octoprint_setuptools.get_babel_commandclasses(pot_file=pot_file, output_dir=translation_dir, pack_name_prefix="OctoPrint-i18n-", pack_path_prefix="", bundled_dir=bundled_dir))
|
cmdclass.update(octoprint_setuptools.get_babel_commandclasses(pot_file=pot_file, output_dir=translation_dir, pack_name_prefix="OctoPrint-i18n-", pack_path_prefix="", bundled_dir=bundled_dir))
|
||||||
|
|
||||||
cmdclass["build_py"] = data_copy_build_py_factory({
|
cmdclass["build_py"] = md_to_html_build_py_factory({
|
||||||
"octoprint/templates/_data": [
|
"octoprint/templates/_data": [
|
||||||
"AUTHORS.md",
|
"AUTHORS.md",
|
||||||
"CHANGELOG.md",
|
|
||||||
"SUPPORTERS.md",
|
"SUPPORTERS.md",
|
||||||
"THIRDPARTYLICENSES.md",
|
"THIRDPARTYLICENSES.md",
|
||||||
]
|
]
|
||||||
@@ -155,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()
|
||||||
@@ -164,6 +220,7 @@ def params():
|
|||||||
long_description_content_type = "text/markdown"
|
long_description_content_type = "text/markdown"
|
||||||
|
|
||||||
python_requires = PYTHON_REQUIRES
|
python_requires = PYTHON_REQUIRES
|
||||||
|
setup_requires = SETUP_REQUIRES
|
||||||
install_requires = INSTALL_REQUIRES
|
install_requires = INSTALL_REQUIRES
|
||||||
extras_require = EXTRA_REQUIRES
|
extras_require = EXTRA_REQUIRES
|
||||||
dependency_links = DEPENDENCY_LINKS
|
dependency_links = DEPENDENCY_LINKS
|
||||||
@@ -185,6 +242,10 @@ def params():
|
|||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 2",
|
"Programming Language :: Python :: 2",
|
||||||
"Programming Language :: Python :: 2.7",
|
"Programming Language :: Python :: 2.7",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.6",
|
||||||
|
"Programming Language :: Python :: 3.7",
|
||||||
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: Implementation :: CPython",
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
"Programming Language :: JavaScript",
|
"Programming Language :: JavaScript",
|
||||||
"Topic :: Printing",
|
"Topic :: Printing",
|
||||||
@@ -203,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",
|
||||||
}
|
}
|
||||||
@@ -217,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": [
|
||||||
@@ -230,4 +291,4 @@ def params():
|
|||||||
|
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
setup(**params())
|
setuptools.setup(**params())
|
||||||
+35
-15
@@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
import io
|
||||||
import sys
|
import sys
|
||||||
import logging as log
|
import logging as log
|
||||||
|
|
||||||
@@ -46,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
|
||||||
@@ -297,7 +305,7 @@ def init_logging(settings, use_logging_file=True, logging_file=None, default_con
|
|||||||
config_from_file = {}
|
config_from_file = {}
|
||||||
if os.path.exists(logging_file) and os.path.isfile(logging_file):
|
if os.path.exists(logging_file) and os.path.isfile(logging_file):
|
||||||
import yaml
|
import yaml
|
||||||
with open(logging_file, "r") as f:
|
with io.open(logging_file, 'rt', encoding='utf-8') as f:
|
||||||
config_from_file = yaml.safe_load(f)
|
config_from_file = yaml.safe_load(f)
|
||||||
|
|
||||||
# we merge that with the default config
|
# we merge that with the default config
|
||||||
@@ -370,13 +378,16 @@ def init_pluginsystem(settings, safe_mode=False, ignore_blacklist=True, connecti
|
|||||||
return True
|
return True
|
||||||
plugin_validators.append(validator)
|
plugin_validators.append(validator)
|
||||||
|
|
||||||
|
compatibility_ignored_list = settings.get(["plugins", "_forcedCompatible"])
|
||||||
|
|
||||||
from octoprint.plugin import plugin_manager
|
from octoprint.plugin import plugin_manager
|
||||||
pm = plugin_manager(init=True,
|
pm = plugin_manager(init=True,
|
||||||
plugin_folders=plugin_folders,
|
plugin_folders=plugin_folders,
|
||||||
plugin_entry_points=plugin_entry_points,
|
plugin_entry_points=plugin_entry_points,
|
||||||
plugin_disabled_list=plugin_disabled_list,
|
plugin_disabled_list=plugin_disabled_list,
|
||||||
plugin_blacklist=plugin_blacklist,
|
plugin_blacklist=plugin_blacklist,
|
||||||
plugin_validators=plugin_validators)
|
plugin_validators=plugin_validators,
|
||||||
|
compatibility_ignored_list=compatibility_ignored_list)
|
||||||
|
|
||||||
settings_overlays = dict()
|
settings_overlays = dict()
|
||||||
disabled_from_overlays = dict()
|
disabled_from_overlays = dict()
|
||||||
@@ -406,7 +417,9 @@ def init_pluginsystem(settings, safe_mode=False, ignore_blacklist=True, connecti
|
|||||||
if not startup:
|
if not startup:
|
||||||
return
|
return
|
||||||
|
|
||||||
sorted_disabled_from_overlays = sorted([(key, value[0], value[1]) for key, value in disabled_from_overlays.items()], key=lambda x: (x[2] is None, x[2], x[0]))
|
from octoprint.util import sv
|
||||||
|
|
||||||
|
sorted_disabled_from_overlays = sorted([(key, value[0], value[1]) for key, value in disabled_from_overlays.items()], key=lambda x: (x[2] is None, sv(x[2]), sv(x[0])))
|
||||||
|
|
||||||
disabled_list = pm.plugin_disabled_list
|
disabled_list = pm.plugin_disabled_list
|
||||||
already_processed = []
|
already_processed = []
|
||||||
@@ -489,7 +502,7 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
|
|||||||
if os.stat(path).st_mtime + ttl < time.time():
|
if os.stat(path).st_mtime + ttl < time.time():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
with bom_aware_open(path, encoding="utf-8", mode="r") as f:
|
with bom_aware_open(path, encoding="utf-8", mode='rt') as f:
|
||||||
result = yaml.safe_load(f)
|
result = yaml.safe_load(f)
|
||||||
|
|
||||||
if isinstance(result, list):
|
if isinstance(result, list):
|
||||||
@@ -503,12 +516,12 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
|
|||||||
|
|
||||||
if cache is not None:
|
if cache is not None:
|
||||||
try:
|
try:
|
||||||
with bom_aware_open(cache, encoding="utf-8", mode="w") as f:
|
with bom_aware_open(cache, encoding="utf-8", mode='wt') as f:
|
||||||
yaml.safe_dump(result, f)
|
yaml.safe_dump(result, f)
|
||||||
except:
|
except Exception as e:
|
||||||
logger.info("Fetched plugin blacklist but couldn't write it to its cache file.")
|
logger.info("Fetched plugin blacklist but couldn't write it to its cache file: %s", e)
|
||||||
except:
|
except Exception as e:
|
||||||
logger.info("Unable to fetch plugin blacklist from {}, proceeding without it.".format(url))
|
logger.info("Unable to fetch plugin blacklist from {}, proceeding without it: {}".format(url, e))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -535,7 +548,7 @@ def get_plugin_blacklist(settings, connectivity_checker=None):
|
|||||||
logger.info("Blacklist processing done")
|
logger.info("Blacklist processing done")
|
||||||
|
|
||||||
return blacklist
|
return blacklist
|
||||||
except:
|
except Exception:
|
||||||
logger.exception("Something went wrong while processing the plugin blacklist. Proceeding without it.")
|
logger.exception("Something went wrong while processing the plugin blacklist. Proceeding without it.")
|
||||||
|
|
||||||
|
|
||||||
@@ -553,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
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python
|
||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
import sys
|
|
||||||
if sys.version_info[0] >= 3:
|
|
||||||
raise RuntimeError("Sorry, OctoPrint does not yet support Python 3")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import octoprint
|
import octoprint
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
ADMIN_GROUP = "admins"
|
||||||
|
USER_GROUP = "users"
|
||||||
|
GUEST_GROUP = "guests"
|
||||||
|
READONLY_GROUP = "readonly"
|
||||||
@@ -0,0 +1,614 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
__author__ = "Marc Hannappel <salandora@gmail.com>"
|
||||||
|
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||||
|
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||||
|
|
||||||
|
import io
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from past.builtins import basestring
|
||||||
|
|
||||||
|
from octoprint.settings import settings
|
||||||
|
from octoprint.util import atomic_write
|
||||||
|
from octoprint.access import ADMIN_GROUP, USER_GROUP, GUEST_GROUP, READONLY_GROUP
|
||||||
|
from octoprint.access.permissions import Permissions, OctoPrintPermission
|
||||||
|
from octoprint.vendor.flask_principal import Need, Permission
|
||||||
|
|
||||||
|
|
||||||
|
GroupNeed = partial(Need, 'group')
|
||||||
|
GroupNeed.__doc__ = """A need with the method preset to `"group"`."""
|
||||||
|
|
||||||
|
|
||||||
|
class GroupPermission(Permission):
|
||||||
|
def __init__(self, key):
|
||||||
|
need = GroupNeed(key)
|
||||||
|
super(GroupPermission, self).__init__(need)
|
||||||
|
|
||||||
|
|
||||||
|
class GroupManager(object):
|
||||||
|
@classmethod
|
||||||
|
def default_permissions_for_group(cls, group):
|
||||||
|
result = []
|
||||||
|
for permission in Permissions.all():
|
||||||
|
if group in permission.default_groups:
|
||||||
|
result.append(permission)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._logger = logging.getLogger(__name__)
|
||||||
|
self._group_change_listeners = []
|
||||||
|
|
||||||
|
self._default_groups = []
|
||||||
|
self._init_defaults()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def groups(self):
|
||||||
|
return []
|
||||||
|
|
||||||
|
@property
|
||||||
|
def admin_group(self):
|
||||||
|
return self.find_group(ADMIN_GROUP)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def user_group(self):
|
||||||
|
return self.find_group(USER_GROUP)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def guest_group(self):
|
||||||
|
return self.find_group(GUEST_GROUP)
|
||||||
|
|
||||||
|
def _init_defaults(self):
|
||||||
|
self._default_groups = {
|
||||||
|
ADMIN_GROUP: dict(name="Admins",
|
||||||
|
description="Administrators",
|
||||||
|
permissions=self.default_permissions_for_group(ADMIN_GROUP),
|
||||||
|
subgroups=[],
|
||||||
|
changeable=False,
|
||||||
|
removable=False,
|
||||||
|
default=False,
|
||||||
|
toggleable=True),
|
||||||
|
USER_GROUP: dict(name="Operator",
|
||||||
|
description="Group to gain operator access",
|
||||||
|
permissions=self.default_permissions_for_group(USER_GROUP),
|
||||||
|
subgroups=[],
|
||||||
|
changeable=True,
|
||||||
|
default=True,
|
||||||
|
removable=False,
|
||||||
|
toggleable=True),
|
||||||
|
GUEST_GROUP: dict(name="Guests",
|
||||||
|
description="Anyone who is not currently logged in",
|
||||||
|
permissions=self.default_permissions_for_group(GUEST_GROUP),
|
||||||
|
subgroups=[],
|
||||||
|
changeable=True,
|
||||||
|
default=False,
|
||||||
|
removable=False,
|
||||||
|
toggleable=False),
|
||||||
|
READONLY_GROUP: dict(name="Read-only Access",
|
||||||
|
description="Group to gain read-only access",
|
||||||
|
permissions=self.default_permissions_for_group(READONLY_GROUP),
|
||||||
|
subgroups=[],
|
||||||
|
changeable=False,
|
||||||
|
removable=False,
|
||||||
|
default=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):
|
||||||
|
self._group_change_listeners.append(listener)
|
||||||
|
|
||||||
|
def unregister_listener(self, listener):
|
||||||
|
self._group_change_listeners.remove(listener)
|
||||||
|
|
||||||
|
def add_group(self, key, name, description, permissions, subgroups,
|
||||||
|
default=False, removable=True, changeable=True, toggleable=True, save=True, notify=True):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_group(self, key, description=None, permissions=None, subgroups=None, default=None, save=True, notify=True):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def remove_group(self, key, save=True, notify=True):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def find_group(self, key):
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _to_permissions(self, *permissions):
|
||||||
|
return list(filter(lambda x: x is not None,
|
||||||
|
[Permissions.find(permission) for permission in permissions]))
|
||||||
|
|
||||||
|
def _from_permissions(self, *permissions):
|
||||||
|
return [permission.key for permission in permissions]
|
||||||
|
|
||||||
|
def _from_groups(self, *groups):
|
||||||
|
return [group.key for group in groups]
|
||||||
|
|
||||||
|
def _to_groups(self, *groups):
|
||||||
|
return list(filter(lambda x: x is not None,
|
||||||
|
[self._to_group(g) for g in groups]))
|
||||||
|
|
||||||
|
def _to_group(self, group):
|
||||||
|
# noinspection PyCompatibility
|
||||||
|
if isinstance(group, Group):
|
||||||
|
return group
|
||||||
|
elif isinstance(group, basestring):
|
||||||
|
return self.find_group(group)
|
||||||
|
elif isinstance(group, dict):
|
||||||
|
return self.find_group(group.get("key"))
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _notify_listeners(self, action, group, *args, **kwargs):
|
||||||
|
method = "on_group_{}".format(action)
|
||||||
|
for listener in self._group_change_listeners:
|
||||||
|
try:
|
||||||
|
getattr(listener, method)(group, *args, **kwargs)
|
||||||
|
except Exception:
|
||||||
|
self._logger.exception("Error notifying listener {!r} via {}".format(listener, method))
|
||||||
|
|
||||||
|
class GroupChangeListener(object):
|
||||||
|
|
||||||
|
def on_group_added(self, group):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def on_group_removed(self, group):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def on_group_permissions_changed(self, group, added=None, removed=None):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def on_group_subgroups_changed(self, group, added=None, removed=None):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class FilebasedGroupManager(GroupManager):
|
||||||
|
FILE_VERSION = 2
|
||||||
|
|
||||||
|
def __init__(self, path=None):
|
||||||
|
if path is None:
|
||||||
|
path = settings().get(["accessControl", "groupfile"])
|
||||||
|
if path is None:
|
||||||
|
path = os.path.join(settings().getBaseFolder("base"), "groups.yaml")
|
||||||
|
|
||||||
|
self._groupfile = path
|
||||||
|
self._groups = dict()
|
||||||
|
self._dirty = False
|
||||||
|
|
||||||
|
GroupManager.__init__(self)
|
||||||
|
|
||||||
|
self._load()
|
||||||
|
|
||||||
|
def _load(self):
|
||||||
|
if os.path.exists(self._groupfile) and os.path.isfile(self._groupfile):
|
||||||
|
try:
|
||||||
|
with io.open(self._groupfile, 'rt', encoding='utf-8') as f:
|
||||||
|
data = yaml.safe_load(f)
|
||||||
|
|
||||||
|
if not "groups" in data:
|
||||||
|
groups = data
|
||||||
|
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())
|
||||||
|
tracked_permissions = data.get("tracked", list())
|
||||||
|
|
||||||
|
for key, attributes in groups.items():
|
||||||
|
if key in self._default_groups:
|
||||||
|
# group is a default group
|
||||||
|
if not self._default_groups[key].get("changeable", True):
|
||||||
|
# group may not be changed -> bail
|
||||||
|
continue
|
||||||
|
|
||||||
|
name = self._default_groups[key].get("name", "")
|
||||||
|
description = self._default_groups[key].get("description", "")
|
||||||
|
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:
|
||||||
|
name = attributes.get("name", "")
|
||||||
|
description = attributes.get("description", "")
|
||||||
|
removable = True
|
||||||
|
changeable = True
|
||||||
|
toggleable = True
|
||||||
|
set_default = attributes.get("default", False)
|
||||||
|
|
||||||
|
permissions = self._to_permissions(*attributes.get("permissions", []))
|
||||||
|
default_permissions = self.default_permissions_for_group(key)
|
||||||
|
for permission in default_permissions:
|
||||||
|
if not permission.key in tracked_permissions and not permission in permissions:
|
||||||
|
permissions.append(permission)
|
||||||
|
|
||||||
|
subgroups = attributes.get("subgroups", [])
|
||||||
|
|
||||||
|
group = Group(key, name,
|
||||||
|
description=description,
|
||||||
|
permissions=permissions,
|
||||||
|
subgroups=subgroups,
|
||||||
|
default=set_default,
|
||||||
|
removable=removable,
|
||||||
|
changeable=changeable,
|
||||||
|
toggleable=toggleable)
|
||||||
|
self._groups[key] = group
|
||||||
|
|
||||||
|
for group in self._groups.values():
|
||||||
|
group._subgroups = self._to_groups(*group._subgroups)
|
||||||
|
|
||||||
|
if self._dirty:
|
||||||
|
self._save()
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
self._logger.exception("Error while loading groups from file {}".format(self._groupfile))
|
||||||
|
|
||||||
|
def _save(self, force=False):
|
||||||
|
if self._groupfile is None or not self._dirty and not force:
|
||||||
|
return
|
||||||
|
|
||||||
|
groups = dict()
|
||||||
|
for key in self._groups.keys():
|
||||||
|
group = self._groups[key]
|
||||||
|
groups[key] = dict(
|
||||||
|
permissions=self._from_permissions(*group._permissions),
|
||||||
|
subgroups=self._from_groups(*group._subgroups),
|
||||||
|
default=group._default
|
||||||
|
)
|
||||||
|
if not key in self._default_groups:
|
||||||
|
groups[key]["name"] = group.get_name()
|
||||||
|
groups[key]["description"] = group.get_description()
|
||||||
|
|
||||||
|
data = dict(_version=self.FILE_VERSION,
|
||||||
|
groups=groups,
|
||||||
|
tracked=[x.key for x in Permissions.all()])
|
||||||
|
|
||||||
|
with atomic_write(self._groupfile, mode='wt', permissions=0o600, max_permissions=0o666) as f:
|
||||||
|
import yaml
|
||||||
|
yaml.safe_dump(data, f, default_flow_style=False, indent=4, allow_unicode=True)
|
||||||
|
self._dirty = False
|
||||||
|
self._load()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def groups(self):
|
||||||
|
return list(self._groups.values())
|
||||||
|
|
||||||
|
@property
|
||||||
|
def default_groups(self):
|
||||||
|
return [group for group in self._groups.values() if group.is_default()]
|
||||||
|
|
||||||
|
def find_group(self, key):
|
||||||
|
if key is None:
|
||||||
|
return None
|
||||||
|
return self._groups.get(key)
|
||||||
|
|
||||||
|
def add_group(self, key, name, description, permissions, subgroups, default=False, removable=True,
|
||||||
|
changeable=True, toggleable=True, overwrite=False, notify=True, save=True):
|
||||||
|
if key in self._groups and not overwrite:
|
||||||
|
raise GroupAlreadyExists(key)
|
||||||
|
|
||||||
|
if not permissions:
|
||||||
|
permissions = []
|
||||||
|
|
||||||
|
permissions = self._to_permissions(*permissions)
|
||||||
|
assert(all(map(lambda p: isinstance(p, OctoPrintPermission), permissions)))
|
||||||
|
|
||||||
|
subgroups = self._to_groups(*subgroups)
|
||||||
|
assert(all(map(lambda g: isinstance(g, Group), subgroups)))
|
||||||
|
|
||||||
|
group = Group(key, name,
|
||||||
|
description=description,
|
||||||
|
permissions=permissions,
|
||||||
|
subgroups=subgroups,
|
||||||
|
default=default,
|
||||||
|
changeable=changeable,
|
||||||
|
removable=removable,
|
||||||
|
toggleable=toggleable)
|
||||||
|
self._groups[key] = group
|
||||||
|
|
||||||
|
if save:
|
||||||
|
self._dirty = True
|
||||||
|
self._save()
|
||||||
|
|
||||||
|
if notify:
|
||||||
|
self._notify_listeners("added", group)
|
||||||
|
|
||||||
|
def remove_group(self, key, save=True, notify=True):
|
||||||
|
"""Removes a Group by key"""
|
||||||
|
group = self._to_group(key)
|
||||||
|
if group is None:
|
||||||
|
raise UnknownGroup(key)
|
||||||
|
|
||||||
|
if not group.is_removable():
|
||||||
|
raise GroupUnremovable(key)
|
||||||
|
|
||||||
|
del self._groups[key]
|
||||||
|
self._dirty = True
|
||||||
|
|
||||||
|
if save:
|
||||||
|
self._save()
|
||||||
|
|
||||||
|
if notify:
|
||||||
|
self._notify_listeners("removed", group)
|
||||||
|
|
||||||
|
def update_group(self, key, description=None, permissions=None, subgroups=None, default=None, save=True, notify=True):
|
||||||
|
group = self._to_group(key)
|
||||||
|
if group is None:
|
||||||
|
raise UnknownGroup(key)
|
||||||
|
|
||||||
|
if not group.is_changeable():
|
||||||
|
raise GroupCantBeChanged(key)
|
||||||
|
|
||||||
|
if description is not None and description != group.get_description():
|
||||||
|
group.change_description(description)
|
||||||
|
self._dirty = True
|
||||||
|
|
||||||
|
notifications = []
|
||||||
|
|
||||||
|
if permissions is not None:
|
||||||
|
permissions = self._to_permissions(*permissions)
|
||||||
|
assert (all(map(lambda p: isinstance(p, OctoPrintPermission), permissions)))
|
||||||
|
|
||||||
|
removed_permissions = list(set(group._permissions) - set(permissions))
|
||||||
|
added_permissions = list(set(permissions) - set(group._permissions))
|
||||||
|
|
||||||
|
if removed_permissions:
|
||||||
|
self._dirty |= group.remove_permissions_from_group(removed_permissions)
|
||||||
|
if added_permissions:
|
||||||
|
self._dirty |= group.add_permissions_to_group(added_permissions)
|
||||||
|
|
||||||
|
notifications.append((("permissions_changed", group),
|
||||||
|
dict(added=added_permissions, removed=removed_permissions)))
|
||||||
|
|
||||||
|
if subgroups is not None:
|
||||||
|
subgroups = self._to_groups(*subgroups)
|
||||||
|
assert(all(map(lambda g: isinstance(g, Group), subgroups)))
|
||||||
|
|
||||||
|
removed_subgroups = list(set(group._subgroups) - set(subgroups))
|
||||||
|
added_subgroups = list(set(subgroups) - set(group._subgroups))
|
||||||
|
|
||||||
|
if removed_subgroups:
|
||||||
|
self._dirty = group.remove_subgroups_from_group(removed_subgroups)
|
||||||
|
if added_subgroups:
|
||||||
|
self._dirty = group.add_subgroups_to_group(added_subgroups)
|
||||||
|
|
||||||
|
notifications.append((("subgroups_changed", group),
|
||||||
|
dict(added=added_subgroups, removed=removed_subgroups)))
|
||||||
|
|
||||||
|
if default is not None:
|
||||||
|
group.change_default(default)
|
||||||
|
self._dirty = True
|
||||||
|
|
||||||
|
if self._dirty:
|
||||||
|
if save:
|
||||||
|
self._save()
|
||||||
|
|
||||||
|
if notify:
|
||||||
|
for args, kwargs in notifications:
|
||||||
|
self._notify_listeners(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class GroupAlreadyExists(Exception):
|
||||||
|
def __init__(self, key):
|
||||||
|
Exception.__init__(self, "Group %s already exists" % key)
|
||||||
|
|
||||||
|
|
||||||
|
class UnknownGroup(Exception):
|
||||||
|
def __init__(self, key):
|
||||||
|
Exception.__init__(self, "Unknown group: %s" % key)
|
||||||
|
|
||||||
|
|
||||||
|
class GroupUnremovable(Exception):
|
||||||
|
def __init__(self, key):
|
||||||
|
Exception.__init__(self, "Group can't be removed: %s" % key)
|
||||||
|
|
||||||
|
|
||||||
|
class GroupCantBeChanged(Exception):
|
||||||
|
def __init__(self, key):
|
||||||
|
Exception.__init__(self, "Group can't be changed: %s" % key)
|
||||||
|
|
||||||
|
|
||||||
|
class Group(object):
|
||||||
|
def __init__(self, key, name, description="", permissions=None, subgroups=None, default=False, removable=True, changeable=True, toggleable=True):
|
||||||
|
self._key = key
|
||||||
|
self._name = name
|
||||||
|
self._description = description
|
||||||
|
self._permissions = permissions
|
||||||
|
self._subgroups = subgroups
|
||||||
|
self._default = default
|
||||||
|
self._removable = removable
|
||||||
|
self._changeable = changeable
|
||||||
|
self._toggleable = toggleable
|
||||||
|
|
||||||
|
def as_dict(self):
|
||||||
|
from octoprint.access.permissions import OctoPrintPermission
|
||||||
|
return dict(
|
||||||
|
key=self.key,
|
||||||
|
name=self.get_name(),
|
||||||
|
description=self._description,
|
||||||
|
permissions=list(map(lambda p: p.key, self._permissions)),
|
||||||
|
subgroups=list(map(lambda g: g.key, self._subgroups)),
|
||||||
|
needs=OctoPrintPermission.convert_needs_to_dict(self.needs),
|
||||||
|
default=self._default,
|
||||||
|
removable=self._removable,
|
||||||
|
changeable=self._changeable,
|
||||||
|
toggleable=self._toggleable
|
||||||
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def key(self):
|
||||||
|
return self._key
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
def get_description(self):
|
||||||
|
return self._description
|
||||||
|
|
||||||
|
def is_default(self):
|
||||||
|
return self._default
|
||||||
|
|
||||||
|
def is_changeable(self):
|
||||||
|
return self._changeable
|
||||||
|
|
||||||
|
def is_removable(self):
|
||||||
|
return self._removable
|
||||||
|
|
||||||
|
def is_toggleable(self):
|
||||||
|
return self._toggleable
|
||||||
|
|
||||||
|
def add_permissions_to_group(self, permissions):
|
||||||
|
"""Adds a list of permissions to a group"""
|
||||||
|
if not self.is_changeable():
|
||||||
|
raise GroupCantBeChanged(self.key)
|
||||||
|
|
||||||
|
# Make sure the permissions variable is of type list
|
||||||
|
if not isinstance(permissions, list):
|
||||||
|
permissions = [permissions]
|
||||||
|
|
||||||
|
assert(all(map(lambda p: isinstance(p, OctoPrintPermission), permissions)))
|
||||||
|
|
||||||
|
dirty = False
|
||||||
|
for permission in permissions:
|
||||||
|
if permissions not in self.permissions:
|
||||||
|
self._permissions.append(permission)
|
||||||
|
dirty = True
|
||||||
|
|
||||||
|
return dirty
|
||||||
|
|
||||||
|
def remove_permissions_from_group(self, permissions):
|
||||||
|
"""Removes a list of permissions from a group"""
|
||||||
|
if not self.is_changeable():
|
||||||
|
raise GroupCantBeChanged(self.key)
|
||||||
|
|
||||||
|
# Make sure the permissions variable is of type list
|
||||||
|
if not isinstance(permissions, list):
|
||||||
|
permissions = [permissions]
|
||||||
|
|
||||||
|
assert(all(map(lambda p: isinstance(p, OctoPrintPermission), permissions)))
|
||||||
|
|
||||||
|
dirty = False
|
||||||
|
for permission in permissions:
|
||||||
|
if permission in self._permissions:
|
||||||
|
self._permissions.remove(permission)
|
||||||
|
dirty = True
|
||||||
|
|
||||||
|
return dirty
|
||||||
|
|
||||||
|
def add_subgroups_to_group(self, subgroups):
|
||||||
|
"""Adds a list of subgroups to a group"""
|
||||||
|
if not self.is_changeable():
|
||||||
|
raise GroupCantBeChanged(self.key)
|
||||||
|
|
||||||
|
# Make sure the subgroups variable is of type list
|
||||||
|
if not isinstance(subgroups, list):
|
||||||
|
subgroups = [subgroups]
|
||||||
|
|
||||||
|
assert(all(map(lambda g: isinstance(g, Group), subgroups)))
|
||||||
|
|
||||||
|
dirty = False
|
||||||
|
for group in subgroups:
|
||||||
|
if group.is_toggleable() and group not in self._subgroups:
|
||||||
|
self._subgroups.append(group)
|
||||||
|
dirty = True
|
||||||
|
|
||||||
|
return dirty
|
||||||
|
|
||||||
|
def remove_subgroups_from_group(self, subgroups):
|
||||||
|
"""Removes a list of subgroups from a group"""
|
||||||
|
"""Adds a list of subgroups to a group"""
|
||||||
|
if not self.is_changeable():
|
||||||
|
raise GroupCantBeChanged(self.key)
|
||||||
|
|
||||||
|
# Make sure the subgroups variable is of type list
|
||||||
|
if not isinstance(subgroups, list):
|
||||||
|
subgroups = [subgroups]
|
||||||
|
|
||||||
|
assert (all(map(lambda g: isinstance(g, Group), subgroups)))
|
||||||
|
|
||||||
|
dirty = False
|
||||||
|
for group in subgroups:
|
||||||
|
if group.is_toggleable() and group in self._subgroups:
|
||||||
|
self._subgroups.remove(group)
|
||||||
|
dirty = True
|
||||||
|
|
||||||
|
return dirty
|
||||||
|
|
||||||
|
def change_default(self, default):
|
||||||
|
"""Changes the default flag of a Group"""
|
||||||
|
if not self.is_changeable():
|
||||||
|
raise GroupCantBeChanged(self.key)
|
||||||
|
|
||||||
|
self._default = default
|
||||||
|
|
||||||
|
def change_description(self, description):
|
||||||
|
"""Changes the description of a group"""
|
||||||
|
self._description = description
|
||||||
|
|
||||||
|
@property
|
||||||
|
def permissions(self):
|
||||||
|
if Permissions.ADMIN in self._permissions:
|
||||||
|
return Permissions.all()
|
||||||
|
|
||||||
|
return list(filter(lambda p: p is not None, self._permissions))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def subgroups(self):
|
||||||
|
return filter(lambda g: g is not None, self._subgroups)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def needs(self):
|
||||||
|
needs = set()
|
||||||
|
needs.add(GroupNeed(self.key))
|
||||||
|
for p in self.permissions:
|
||||||
|
needs = needs.union(p.needs)
|
||||||
|
for g in self.subgroups:
|
||||||
|
needs = needs.union(g.needs)
|
||||||
|
|
||||||
|
return needs
|
||||||
|
|
||||||
|
def has_permission(self, permission):
|
||||||
|
if Permissions.ADMIN.get_name() in self._permissions:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return permission.needs.issubset(self.needs)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '{}("{}", "{}", description="{}", permissions={!r}, ' \
|
||||||
|
'default={}, removable={}, changeable={})'.format(self.__class__.__name__,
|
||||||
|
self._key,
|
||||||
|
self._name,
|
||||||
|
self._description,
|
||||||
|
self._permissions,
|
||||||
|
bool(self._default),
|
||||||
|
bool(self._removable),
|
||||||
|
bool(self._changeable))
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return self.key.__hash__()
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return isinstance(other, Group) and other.key == self.key
|
||||||
Loaded 100 of 488 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user