Compare commits
2195 Commits
extjs4-por
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b5f45b486 | ||
|
|
05e13a6b20 | ||
|
|
b64084d248 | ||
|
|
e120536d87 | ||
|
|
f52cf760e4 | ||
|
|
94d790c159 | ||
|
|
f78506161d | ||
|
|
592b05cd87 | ||
|
|
6c8f9ce756 | ||
|
|
20efcfd345 | ||
|
|
19dba297ef | ||
|
|
cbacaf0545 | ||
|
|
75db47fc1f | ||
|
|
f1ec68704d | ||
|
|
ae3fbcca77 | ||
|
|
6a10e8f3cd | ||
|
|
b0dba97fec | ||
|
|
d7c520c85e | ||
|
|
ee3180fd94 | ||
|
|
47e548fdb5 | ||
|
|
cd63efd935 | ||
|
|
7f0a380576 | ||
|
|
68c75ccc05 | ||
|
|
96a0825add | ||
|
|
61a83bbd20 | ||
|
|
bc6611fc0d | ||
|
|
970a0ae240 | ||
|
|
5acb57b5af | ||
|
|
7fa0af3446 | ||
|
|
a954348567 | ||
|
|
13be64d355 | ||
|
|
11fe22e4cd | ||
|
|
a683b7e830 | ||
|
|
b0f80f9654 | ||
|
|
f9ca3932a8 | ||
|
|
5ec5271fdd | ||
|
|
e15731fcd4 | ||
|
|
2962f7cd2c | ||
|
|
c89a366dfb | ||
|
|
5f8acabb81 | ||
|
|
055a84bb15 | ||
|
|
03938839e0 | ||
|
|
8ff4683780 | ||
|
|
62a4052178 | ||
|
|
8ece036770 | ||
|
|
a5503c0c60 | ||
|
|
f754882498 | ||
|
|
191549074c | ||
|
|
2ec6e10c8e | ||
|
|
2bd095e5bf | ||
|
|
513d5f06e5 | ||
|
|
a1da2058bc | ||
|
|
af26fdfb37 | ||
|
|
66b5a2fc40 | ||
|
|
29f0789223 | ||
|
|
f8f997a6eb | ||
|
|
374997a8d7 | ||
|
|
dabb505376 | ||
|
|
aa74261d50 | ||
|
|
b29829f571 | ||
|
|
d559f67ab9 | ||
|
|
d4f8775f44 | ||
|
|
50647ab3a5 | ||
|
|
90744dc2e6 | ||
|
|
24a3987c3a | ||
|
|
e87236514d | ||
|
|
2fb41341c9 | ||
|
|
b76f2c0f20 | ||
|
|
bd88f78af6 | ||
|
|
bf97bec994 | ||
|
|
a27a77f8c1 | ||
|
|
e8fd07e5e3 | ||
|
|
1089adb844 | ||
|
|
4096cdfdfe | ||
|
|
099077fe20 | ||
|
|
a684029602 | ||
|
|
8b0c8392b6 | ||
|
|
222aeed2f3 | ||
|
|
ece31cf3cf | ||
|
|
0fbb3882f2 | ||
|
|
73394f1fc5 | ||
|
|
9b043cf2c1 | ||
|
|
1cd005c272 | ||
|
|
4107bf8f25 | ||
|
|
49bedda956 | ||
|
|
540d557cb2 | ||
|
|
d8acadb085 | ||
|
|
932c3c123f | ||
|
|
986375fa86 | ||
|
|
4497c9bbcc | ||
|
|
23f7c4dd6e | ||
|
|
a41f950d09 | ||
|
|
209716f7cd | ||
|
|
3dca30343f | ||
|
|
71cde7c05e | ||
|
|
dbf3495c4e | ||
|
|
fffc6ab7d7 | ||
|
|
a73e01f89f | ||
|
|
87ec04af16 | ||
|
|
d8746a8852 | ||
|
|
7c9a542006 | ||
|
|
e75ef7e31f | ||
|
|
4f87612a0f | ||
|
|
2cad0f46f2 | ||
|
|
5931d0cc0b | ||
|
|
9d4ca77ef7 | ||
|
|
ad27a278fd | ||
|
|
4f17fc41a5 | ||
|
|
15d2d27a53 | ||
|
|
65e5010e7f | ||
|
|
9b97c74025 | ||
|
|
d62362d6ae | ||
|
|
1a9affbbac | ||
|
|
2316088f5c | ||
|
|
d14310078b | ||
|
|
1696c69776 | ||
|
|
5f96ea4217 | ||
|
|
491a20cb08 | ||
|
|
490fb898af | ||
|
|
560a52a443 | ||
|
|
b9a208f18f | ||
|
|
6da4c4bf66 | ||
|
|
d2390cd247 | ||
|
|
c3cd7f5e5c | ||
|
|
2351d65844 | ||
|
|
e50927f575 | ||
|
|
79b7e6093f | ||
|
|
4f0c786649 | ||
|
|
fca08cf583 | ||
|
|
517b2c653b | ||
|
|
44dcbee5f4 | ||
|
|
efc9f465f0 | ||
|
|
5321d24f2a | ||
|
|
f30f7f4629 | ||
|
|
ec0bcc11f5 | ||
|
|
16895b4a49 | ||
|
|
f3784723ae | ||
|
|
7f5857296e | ||
|
|
897955f0a1 | ||
|
|
ff309ea4c5 | ||
|
|
3b11613cc7 | ||
|
|
a2d0cb7141 | ||
|
|
88ffd1b843 | ||
|
|
6a10e57f7e | ||
|
|
612e0061ed | ||
|
|
2eee7453cb | ||
|
|
58cc278145 | ||
|
|
a03e649da6 | ||
|
|
073bbbc09d | ||
|
|
bca0aa3532 | ||
|
|
cb588d0205 | ||
|
|
2b20e9689b | ||
|
|
65f7cf0d83 | ||
|
|
5ac8f4c81b | ||
|
|
c33c9082d9 | ||
|
|
62ae0f5ef6 | ||
|
|
24aa48187e | ||
|
|
342cca4367 | ||
|
|
9194092d7b | ||
|
|
5f6f65a065 | ||
|
|
967537a409 | ||
|
|
f74163489c | ||
|
|
7a110bd60f | ||
|
|
d56636426e | ||
|
|
de4fbd2e82 | ||
|
|
9c3982d4ff | ||
|
|
88fc21e993 | ||
|
|
54674576db | ||
|
|
89189adb24 | ||
|
|
a5a7da4a1a | ||
|
|
1e6cc03946 | ||
|
|
d8526ba653 | ||
|
|
c38f913948 | ||
|
|
0659fe4641 | ||
|
|
10501db63d | ||
|
|
2a312159b9 | ||
|
|
cb75192df4 | ||
|
|
588f600ba2 | ||
|
|
ea609cd3e0 | ||
|
|
4b6c7d01b2 | ||
|
|
b89b2c45b1 | ||
|
|
e38f1173cf | ||
|
|
e1e0999de6 | ||
|
|
5c9378ac5e | ||
|
|
f075f391cb | ||
|
|
8fb25f71f3 | ||
|
|
a3332079db | ||
|
|
0d6eec7a33 | ||
|
|
f16afc59ba | ||
|
|
e5388048a9 | ||
|
|
5374d237a7 | ||
|
|
2e466101fc | ||
|
|
8676a0d2a0 | ||
|
|
3ec23ad96b | ||
|
|
dcd3918f36 | ||
|
|
08c7f1960f | ||
|
|
8a4ec493c0 | ||
|
|
4d970754a4 | ||
|
|
f331b6c754 | ||
|
|
1022448e4f | ||
|
|
291540b601 | ||
|
|
092d07b68e | ||
|
|
da5d5bee20 | ||
|
|
6d9dc9bd42 | ||
|
|
937afd921c | ||
|
|
a4da8d29f8 | ||
|
|
8ec5ca9d08 | ||
|
|
9c90136f57 | ||
|
|
610a1bb313 | ||
|
|
23a48dd01c | ||
|
|
d02fa72e80 | ||
|
|
62d8749e74 | ||
|
|
76f0bf2e04 | ||
|
|
635f6d970d | ||
|
|
672e3c42a8 | ||
|
|
c1110e4ef3 | ||
|
|
742c8a941a | ||
|
|
3427ae4b90 | ||
|
|
034db27936 | ||
|
|
1e3c624613 | ||
|
|
3519f341d4 | ||
|
|
d6c96d6291 | ||
|
|
15c250e152 | ||
|
|
eb57412601 | ||
|
|
2f1c008a26 | ||
|
|
5e06aee5c8 | ||
|
|
351664ec07 | ||
|
|
5f1eada3ea | ||
|
|
bde4e4443e | ||
|
|
ed4bc5fa17 | ||
|
|
20afc31f3c | ||
|
|
9232a52fd6 | ||
|
|
23b3f144fc | ||
|
|
89d62eb509 | ||
|
|
00176ee2cd | ||
|
|
8737005b82 | ||
|
|
d08c3f72e9 | ||
|
|
40ebdf3f39 | ||
|
|
eeeb7fb69b | ||
|
|
3f9ae33793 | ||
|
|
0c7f53e305 | ||
|
|
63a4301a8b | ||
|
|
1b4ac88ce7 | ||
|
|
4b29436cd5 | ||
|
|
833b5a1f30 | ||
|
|
24b094a04a | ||
|
|
3365201011 | ||
|
|
c1ba403d4e | ||
|
|
8b62e50eb8 | ||
|
|
5b315e90c5 | ||
|
|
b711cd258a | ||
|
|
e1c4069a72 | ||
|
|
a2dee79439 | ||
|
|
7a54db3179 | ||
|
|
03e7952d26 | ||
|
|
7ee8750be4 | ||
|
|
f61001a15d | ||
|
|
86ddadacf7 | ||
|
|
632089940c | ||
|
|
5d7db3e727 | ||
|
|
4dd1f63b8b | ||
|
|
fc134cdffb | ||
|
|
36cb4c5a4f | ||
|
|
676bdb26e0 | ||
|
|
dff778ceeb | ||
|
|
bdadd2b515 | ||
|
|
a34543100c | ||
|
|
b8b044f451 | ||
|
|
2d87cde887 | ||
|
|
212efc4f52 | ||
|
|
879a397215 | ||
|
|
957cd5dd9c | ||
|
|
25087d3f2d | ||
|
|
d24109f0a2 | ||
|
|
647baebcf0 | ||
|
|
98ce3cd385 | ||
|
|
0c87d9bd7d | ||
|
|
aa35247e95 | ||
|
|
0dc4e18ac4 | ||
|
|
d4185505d1 | ||
|
|
04e58659fe | ||
|
|
5e738cf73a | ||
|
|
ce8595e8dd | ||
|
|
be74d96c6a | ||
|
|
4212bd6800 | ||
|
|
d40d40af31 | ||
|
|
cbf9ee8978 | ||
|
|
7abeb4ee0f | ||
|
|
bd4a3cba38 | ||
|
|
3cfa39a2ad | ||
|
|
a3b6d8d8e5 | ||
|
|
7e3692bb5a | ||
|
|
aa3a9a15cc | ||
|
|
0f92ea401f | ||
|
|
260d55aeae | ||
|
|
a9609a197d | ||
|
|
a8fac1381b | ||
|
|
65f6ede8b2 | ||
|
|
515dbcc5d9 | ||
|
|
827987fe7d | ||
|
|
1357ca7582 | ||
|
|
72d363968e | ||
|
|
c6b6902e9f | ||
|
|
6a5bb44d5b | ||
|
|
cbcf8eb863 | ||
|
|
09cfd9b89e | ||
|
|
b961e11df6 | ||
|
|
2ca683e8fe | ||
|
|
fd20addead | ||
|
|
535b13b5f1 | ||
|
|
d6a0276a78 | ||
|
|
9c0325b129 | ||
|
|
f885edd7fc | ||
|
|
2b171e58a3 | ||
|
|
d417c4b0f9 | ||
|
|
653f80eac8 | ||
|
|
76b89a7943 | ||
|
|
6ff7a5400f | ||
|
|
db021b9f41 | ||
|
|
ab4661f6fd | ||
|
|
396cadefda | ||
|
|
2296906ed3 | ||
|
|
1a134cab1b | ||
|
|
7d67792493 | ||
|
|
3c18e890e8 | ||
|
|
615500e6e6 | ||
|
|
1425fe5413 | ||
|
|
84643fb6f7 | ||
|
|
c8b621172e | ||
|
|
02e07dda2a | ||
|
|
b2e19561e6 | ||
|
|
389f4167b2 | ||
|
|
63cc745f5b | ||
|
|
1a4ac93fbb | ||
|
|
582f60ea0b | ||
|
|
157f6ff62a | ||
|
|
bf4244e8b2 | ||
|
|
25cfd58792 | ||
|
|
09d04aaac0 | ||
|
|
27b4e2d891 | ||
|
|
043344b986 | ||
|
|
3b8f71613b | ||
|
|
10fcbecc04 | ||
|
|
ab7f19fbb8 | ||
|
|
b665a4a6f7 | ||
|
|
2c45e59900 | ||
|
|
89868cc944 | ||
|
|
841cb889aa | ||
|
|
6b2f14e51e | ||
|
|
7e2192e875 | ||
|
|
f11a42b9bf | ||
|
|
845204178b | ||
|
|
d937a323fb | ||
|
|
d7c48d27d8 | ||
|
|
1bc766213c | ||
|
|
775aef5f9b | ||
|
|
83cac4978a | ||
|
|
2bb9a8e71c | ||
|
|
39783c7703 | ||
|
|
9f9f564e62 | ||
|
|
ab1b2bcf14 | ||
|
|
bb0c61bb3f | ||
|
|
a7dcf39a32 | ||
|
|
e43796ae51 | ||
|
|
6655fe67c3 | ||
|
|
2104b9831c | ||
|
|
e7127637cf | ||
|
|
6233e5c844 | ||
|
|
a01481b26f | ||
|
|
3d24998577 | ||
|
|
f24e9d152c | ||
|
|
f47089ae7d | ||
|
|
d70abd2986 | ||
|
|
7d998a45f2 | ||
|
|
3433a911cc | ||
|
|
967606fa0f | ||
|
|
97e7d95dd3 | ||
|
|
26c28445a5 | ||
|
|
74a459274c | ||
|
|
bb6e290bf8 | ||
|
|
4a79e1f100 | ||
|
|
bff93bb162 | ||
|
|
bffd091429 | ||
|
|
70d5931622 | ||
|
|
ce49cde49d | ||
|
|
a3bd2e547a | ||
|
|
64710ad226 | ||
|
|
cd6bad0e35 | ||
|
|
1310645f55 | ||
|
|
e6a7119595 | ||
|
|
0b39b529dd | ||
|
|
1d0e40c66b | ||
|
|
bcc89c73dd | ||
|
|
a6b47e18c9 | ||
|
|
5183c92543 | ||
|
|
7c1c3f62d1 | ||
|
|
729f062ea1 | ||
|
|
d879ee06a3 | ||
|
|
ed1b2a50fa | ||
|
|
c51e01ac46 | ||
|
|
4df5bd05ec | ||
|
|
cf4012bb60 | ||
|
|
bbcebe1306 | ||
|
|
bcaaeac852 | ||
|
|
4111f94597 | ||
|
|
dd7cc31918 | ||
|
|
d8d094cab6 | ||
|
|
dc6e93541b | ||
|
|
f6ffb940ab | ||
|
|
6fbb1bb370 | ||
|
|
8285b226eb | ||
|
|
194129c027 | ||
|
|
7d5a429466 | ||
|
|
ac5db1b262 | ||
|
|
a2857a318d | ||
|
|
13e1fa355d | ||
|
|
2e88fa1dfc | ||
|
|
366b10f07b | ||
|
|
92a048625a | ||
|
|
8199928160 | ||
|
|
545aca9a4c | ||
|
|
9f113eab23 | ||
|
|
bc6bc017cb | ||
|
|
535fda90e3 | ||
|
|
0ace086de4 | ||
|
|
bbb1b44a23 | ||
|
|
dfed17ac0d | ||
|
|
2f879c33f3 | ||
|
|
14b6ba10cf | ||
|
|
ae0b072b75 | ||
|
|
250afa6e0b | ||
|
|
b29b6fe69f | ||
|
|
f160d6312f | ||
|
|
a8d01fd52f | ||
|
|
3a5ec4f5f4 | ||
|
|
eebb93d4ee | ||
|
|
01fafd4fe0 | ||
|
|
ca0db4d1a7 | ||
|
|
ea72164798 | ||
|
|
e2ba980299 | ||
|
|
98051bdea2 | ||
|
|
20431cc771 | ||
|
|
82ecf8a416 | ||
|
|
9dcd90056d | ||
|
|
e2c7716ce2 | ||
|
|
e6c61c3f8c | ||
|
|
b834e33568 | ||
|
|
9ab2a50097 | ||
|
|
1838403e3b | ||
|
|
9e7c9fc1d3 | ||
|
|
9264cb749e | ||
|
|
c01679de1f | ||
|
|
3645feb486 | ||
|
|
d85f665091 | ||
|
|
5ec6ae3ad0 | ||
|
|
860730d43c | ||
|
|
c1ddcf6012 | ||
|
|
85bbdfe143 | ||
|
|
9f9827ca58 | ||
|
|
dcb3dad435 | ||
|
|
0e69b9199c | ||
|
|
88a3600ce3 | ||
|
|
91164d8dbf | ||
|
|
ec47720686 | ||
|
|
467ade1eb7 | ||
|
|
bb93a06fff | ||
|
|
80178f7310 | ||
|
|
ee354eb107 | ||
|
|
7d896599b8 | ||
|
|
55aee2b00f | ||
|
|
10d39c83cb | ||
|
|
0b2cb7539f | ||
|
|
6fdbf0ba5d | ||
|
|
a980f8e959 | ||
|
|
c90cf301df | ||
|
|
6f06cd5ebc | ||
|
|
86de5657ff | ||
|
|
4a335eeb61 | ||
|
|
86d582d52a | ||
|
|
673b6653a3 | ||
|
|
41732fe38b | ||
|
|
5964bcf897 | ||
|
|
3ed4a6e834 | ||
|
|
20fa106b8b | ||
|
|
654e2af4e5 | ||
|
|
d5dea44689 | ||
|
|
5743382c65 | ||
|
|
39f37e6133 | ||
|
|
0ed3554f95 | ||
|
|
ba6af99b05 | ||
|
|
9e29fe4111 | ||
|
|
a8a4fb69c0 | ||
|
|
6cf13d112b | ||
|
|
6973f96f8c | ||
|
|
0548bdb655 | ||
|
|
36606fc448 | ||
|
|
c415b097fe | ||
|
|
970fad7557 | ||
|
|
358ff74d0e | ||
|
|
b1cdc32f73 | ||
|
|
bcca07443c | ||
|
|
67d9c2efb4 | ||
|
|
34b0fdff1d | ||
|
|
f93e5e60b5 | ||
|
|
d8b1e2701c | ||
|
|
abf4c345f0 | ||
|
|
a09334e116 | ||
|
|
57ad9a25da | ||
|
|
5a2990ff90 | ||
|
|
759a618f74 | ||
|
|
23f1cfc926 | ||
|
|
57ea5ef5da | ||
|
|
944dc1659f | ||
|
|
2dc157578e | ||
|
|
8a59216061 | ||
|
|
cc1807cf97 | ||
|
|
63b7f6d382 | ||
|
|
5c4cbf58c5 | ||
|
|
5959a24d4c | ||
|
|
d4023e7dde | ||
|
|
0fd3c25684 | ||
|
|
4125e35ebd | ||
|
|
18d448d4a5 | ||
|
|
d5133f789a | ||
|
|
1cce6a297c | ||
|
|
ad20ec62f2 | ||
|
|
af2bed8a0f | ||
|
|
b93e868048 | ||
|
|
8d90ae5ffb | ||
|
|
ae4449642c | ||
|
|
bc2f4a30eb | ||
|
|
dc8766874e | ||
|
|
a33171732d | ||
|
|
b9a9e06c1d | ||
|
|
456e720b75 | ||
|
|
ae9bbdbae7 | ||
|
|
585ea88f1f | ||
|
|
f94f58918e | ||
|
|
3fc97672de | ||
|
|
e8e649a030 | ||
|
|
1e6c02ae83 | ||
|
|
b2e1f850d8 | ||
|
|
8bfa2cacbb | ||
|
|
c7e61f8c34 | ||
|
|
089c667d7f | ||
|
|
ebb955934d | ||
|
|
c7567ddee4 | ||
|
|
c655da38c8 | ||
|
|
4c0be7ddd4 | ||
|
|
38961d4253 | ||
|
|
6e81a11d8d | ||
|
|
be02be75be | ||
|
|
7b5ed9f1d6 | ||
|
|
e626f9fece | ||
|
|
3fab799dbf | ||
|
|
24c100d9b7 | ||
|
|
9bc2f62c80 | ||
|
|
1fa2de066f | ||
|
|
ae0b070c1b | ||
|
|
c3a2c67b98 | ||
|
|
200e8f552b | ||
|
|
4247013446 | ||
|
|
6ec32a85e4 | ||
|
|
633c56f54e | ||
|
|
23171ad205 | ||
|
|
277576268c | ||
|
|
74aa0db956 | ||
|
|
fe42fb2c31 | ||
|
|
4973538d6c | ||
|
|
de1e7c27df | ||
|
|
587b9afefe | ||
|
|
63b25311f5 | ||
|
|
d45dbfe064 | ||
|
|
3176b877a4 | ||
|
|
18541bce86 | ||
|
|
bebe08d92b | ||
|
|
0dbbb51cff | ||
|
|
bd78bd2643 | ||
|
|
7a3b164060 | ||
|
|
e7eb26416e | ||
|
|
b2b7703081 | ||
|
|
cbdde7bba5 | ||
|
|
4fd51a4ef9 | ||
|
|
333c81c1d7 | ||
|
|
21b5a15e5d | ||
|
|
edd431a304 | ||
|
|
d642fa3989 | ||
|
|
bae1647e99 | ||
|
|
decd7aca71 | ||
|
|
7cc9aaca49 | ||
|
|
196aa48727 | ||
|
|
af2972f697 | ||
|
|
d4addeedd6 | ||
|
|
8439698336 | ||
|
|
7d120690ab | ||
|
|
ee196f5035 | ||
|
|
ff85c334c7 | ||
|
|
0c574f33e1 | ||
|
|
a7c7309027 | ||
|
|
de2f998218 | ||
|
|
4982ba0b98 | ||
|
|
f57286fd51 | ||
|
|
12f7345d0c | ||
|
|
4e79ed8124 | ||
|
|
7787aa975f | ||
|
|
c13622a1e6 | ||
|
|
07a87fa15a | ||
|
|
2644169376 | ||
|
|
5988f5f04f | ||
|
|
95d826b77c | ||
|
|
9bcda41700 | ||
|
|
507c5df984 | ||
|
|
0ba87b424c | ||
|
|
53f818e176 | ||
|
|
00dcd60d56 | ||
|
|
1730230244 | ||
|
|
0728c03c1c | ||
|
|
354372b2ea | ||
|
|
d169aca8bd | ||
|
|
26720ca4c2 | ||
|
|
510a8b50b2 | ||
|
|
d190f149d1 | ||
|
|
24a31b1194 | ||
|
|
470490769f | ||
|
|
1259eca8ad | ||
|
|
f0316d3e31 | ||
|
|
9b580a87fa | ||
|
|
4bee1ce811 | ||
|
|
e3f537770f | ||
|
|
9b92bc2baf | ||
|
|
51b99caf24 | ||
|
|
850fd34522 | ||
|
|
9164dafe69 | ||
|
|
33e9545cd4 | ||
|
|
7b87a93862 | ||
|
|
51bde704b5 | ||
|
|
3f13c24362 | ||
|
|
6837d83f5b | ||
|
|
3c1d7da698 | ||
|
|
d6731b8cee | ||
|
|
fe80703f95 | ||
|
|
1808ac506a | ||
|
|
3174c7534d | ||
|
|
065729a389 | ||
|
|
d250e0a486 | ||
|
|
3f1ff54887 | ||
|
|
0424543e36 | ||
|
|
d0cb45808c | ||
|
|
0cc0882ac9 | ||
|
|
a7c4228ce7 | ||
|
|
ce3a8c0c17 | ||
|
|
ace531e8ae | ||
|
|
2c66a4c29e | ||
|
|
6e66452cf3 | ||
|
|
cb646f3a4f | ||
|
|
32d5392776 | ||
|
|
03ca4cfa46 | ||
|
|
fb4307f748 | ||
|
|
3893d3e214 | ||
|
|
2b90f309a6 | ||
|
|
fb71d049b1 | ||
|
|
89e245e2d3 | ||
|
|
3330e97d05 | ||
|
|
15741047ed | ||
|
|
eeccc47dde | ||
|
|
c169d8909f | ||
|
|
dc27d873b3 | ||
|
|
32dc683d5c | ||
|
|
06dfeed750 | ||
|
|
60c764ac33 | ||
|
|
5410c44bb1 | ||
|
|
d372be9b65 | ||
|
|
131b9f86a9 | ||
|
|
45e0d10932 | ||
|
|
596b5d5cd4 | ||
|
|
bb5dafc61d | ||
|
|
7e9a8b801c | ||
|
|
f30f421f50 | ||
|
|
bbce304f5a | ||
|
|
de3a6c443d | ||
|
|
7ad8431dd9 | ||
|
|
85364dc8ab | ||
|
|
bdb3b509ad | ||
|
|
8326206f87 | ||
|
|
85a1e478fe | ||
|
|
29191e6a58 | ||
|
|
15e0e0f30a | ||
|
|
d474576104 | ||
|
|
31555ee5ed | ||
|
|
2f11bb8303 | ||
|
|
ac48ad982e | ||
|
|
54a081bdfd | ||
|
|
989137ddc3 | ||
|
|
c72459d3ef | ||
|
|
5c1faf3d5e | ||
|
|
4feef3be78 | ||
|
|
3032e5eb21 | ||
|
|
481f779349 | ||
|
|
ede0f710f8 | ||
|
|
66718f6d8e | ||
|
|
fd5833c1d8 | ||
|
|
6f8a6e5045 | ||
|
|
78dc75d55d | ||
|
|
579f56b0bf | ||
|
|
9ebe30edfc | ||
|
|
e045d5e5c2 | ||
|
|
fefe742ea1 | ||
|
|
0c36b63f22 | ||
|
|
c9692bb5bd | ||
|
|
0353b82c0c | ||
|
|
23a34c6bac | ||
|
|
4e7b2e5b41 | ||
|
|
3668e77a75 | ||
|
|
a727ee67bc | ||
|
|
aa28d73f47 | ||
|
|
d485eb5c8f | ||
|
|
8a0b7d970a | ||
|
|
a76fde5feb | ||
|
|
648dc93655 | ||
|
|
f32c8aff90 | ||
|
|
9aed7a7f0c | ||
|
|
c8d084c563 | ||
|
|
7e04abd1e5 | ||
|
|
e2e13103b8 | ||
|
|
d8e5cbe689 | ||
|
|
19fdd2f88c | ||
|
|
e5e49f68ba | ||
|
|
5a3625f6cd | ||
|
|
bc50f6e5f6 | ||
|
|
8ff1bfc0b2 | ||
|
|
744ab08dfb | ||
|
|
d01100a258 | ||
|
|
722ca41584 | ||
|
|
1637da84e4 | ||
|
|
6d28f2c885 | ||
|
|
482606d80a | ||
|
|
73ea123f1a | ||
|
|
d09df063a5 | ||
|
|
676574ff19 | ||
|
|
665c047541 | ||
|
|
939835cef1 | ||
|
|
9e303b58a0 | ||
|
|
112a872bc1 | ||
|
|
6424333c35 | ||
|
|
267d331fac | ||
|
|
d1daeb4cb0 | ||
|
|
7c6c9eae7f | ||
|
|
036154fc36 | ||
|
|
e3abdf9901 | ||
|
|
af7e83bc76 | ||
|
|
4a274466ac | ||
|
|
eb38e0ffff | ||
|
|
321677e05a | ||
|
|
960f3a6552 | ||
|
|
35c78eee41 | ||
|
|
5348465e60 | ||
|
|
1d1bb2a2a7 | ||
|
|
767503ad88 | ||
|
|
1e696fe6ca | ||
|
|
90631cca88 | ||
|
|
50c476c41d | ||
|
|
8232505961 | ||
|
|
966678196e | ||
|
|
11e8957dea | ||
|
|
ec5c8bafb6 | ||
|
|
fb8dc42acf | ||
|
|
4df88c0df3 | ||
|
|
3529036f55 | ||
|
|
f2b77c8635 | ||
|
|
49e5611f65 | ||
|
|
d75afc007d | ||
|
|
b32c5d8247 | ||
|
|
b2db96e4df | ||
|
|
52a85cb91c | ||
|
|
beb4f8c8f9 | ||
|
|
3b1eeb0818 | ||
|
|
9ad2f50fa4 | ||
|
|
bbd2661acb | ||
|
|
b2a2995c0d | ||
|
|
5a9784ff4d | ||
|
|
ba41110c27 | ||
|
|
608ecae5fd | ||
|
|
04b8b14828 | ||
|
|
4619b31aa3 | ||
|
|
e3b8aaf276 | ||
|
|
1d9733014a | ||
|
|
304ad1e72d | ||
|
|
ff6cec251a | ||
|
|
84802da29b | ||
|
|
011afe3e89 | ||
|
|
b7162fab36 | ||
|
|
f6e2dab58a | ||
|
|
4a62c5eac2 | ||
|
|
dd30bad96a | ||
|
|
c2c0fe86f9 | ||
|
|
14d9b6cfcb | ||
|
|
df4d97c447 | ||
|
|
a7826c4f90 | ||
|
|
8c26c83c4d | ||
|
|
6b49f844dc | ||
|
|
4a344e382b | ||
|
|
108dd9e4b8 | ||
|
|
b71a2fa549 | ||
|
|
3ca012ee63 | ||
|
|
706d53ab4a | ||
|
|
2321f32f84 | ||
|
|
d1dd35d4b1 | ||
|
|
a5de64a19c | ||
|
|
5d7c1336b9 | ||
|
|
93898d6475 | ||
|
|
4caf05c092 | ||
|
|
6083a3078e | ||
|
|
0160bb1c91 | ||
|
|
e7ce389e84 | ||
|
|
0f2083db62 | ||
|
|
3ed7202253 | ||
|
|
089c0be89b | ||
|
|
fc902af10c | ||
|
|
a481c4d243 | ||
|
|
bb44411a50 | ||
|
|
1e4a24c474 | ||
|
|
993a0f71af | ||
|
|
283ad6137d | ||
|
|
6743b0c813 | ||
|
|
b69ba02652 | ||
|
|
915f2bf9e7 | ||
|
|
59b01b363c | ||
|
|
c5e623ae45 | ||
|
|
425af00ebf | ||
|
|
373c8a14b0 | ||
|
|
5f4a16630e | ||
|
|
3260db416a | ||
|
|
9cefbc6e5d | ||
|
|
14a5156e15 | ||
|
|
259c9f11e6 | ||
|
|
fd1261ab65 | ||
|
|
37d9e1f8fe | ||
|
|
a924cb73b0 | ||
|
|
3cbafec68d | ||
|
|
a48c01c3a5 | ||
|
|
7468078b71 | ||
|
|
98add5fecd | ||
|
|
5e1603317a | ||
|
|
943a9ded00 | ||
|
|
04370b38ec | ||
|
|
3aff57600f | ||
|
|
874249655d | ||
|
|
7ebd69218f | ||
|
|
0edebda1c7 | ||
|
|
7283e8b668 | ||
|
|
f3f380553a | ||
|
|
4a9d2d2129 | ||
|
|
cf343c21a8 | ||
|
|
179de3b0ff | ||
|
|
720d113a9a | ||
|
|
59c9584fe0 | ||
|
|
674610ef7d | ||
|
|
b8135617ae | ||
|
|
6ac296118d | ||
|
|
ecf9822ac0 | ||
|
|
c1249a2f3a | ||
|
|
36cbfa8c61 | ||
|
|
2657cc3921 | ||
|
|
441861786b | ||
|
|
0cdf0230e9 | ||
|
|
c8e6a4476d | ||
|
|
ccfe6b3c80 | ||
|
|
86549eb3ee | ||
|
|
243004c551 | ||
|
|
8ba8aec277 | ||
|
|
a5b07aa4ef | ||
|
|
c619674cf9 | ||
|
|
52d591c83b | ||
|
|
4313974f07 | ||
|
|
bde13515e6 | ||
|
|
93ab2445a1 | ||
|
|
eea3cb0553 | ||
|
|
6bd3c6fa88 | ||
|
|
b6e2ec3a3c | ||
|
|
bbe9de9463 | ||
|
|
2bdbcf9a39 | ||
|
|
fd80ed75fe | ||
|
|
0890cc1a33 | ||
|
|
e31acfc31c | ||
|
|
d0d070aaf0 | ||
|
|
1e41891943 | ||
|
|
e37c817151 | ||
|
|
af6b277d28 | ||
|
|
3a2ff0c188 | ||
|
|
d4a8a38586 | ||
|
|
a87ce825ad | ||
|
|
ac011d7f55 | ||
|
|
03c7a2b108 | ||
|
|
ca83ed79c5 | ||
|
|
54685226c4 | ||
|
|
61b059f015 | ||
|
|
f96b9c8a23 | ||
|
|
d8242b4ef0 | ||
|
|
f664fcb7a6 | ||
|
|
5c7a4549f7 | ||
|
|
a04718ebe5 | ||
|
|
59d8fc9a14 | ||
|
|
a438f13647 | ||
|
|
23ba57313a | ||
|
|
7f24a1a42d | ||
|
|
05566894ad | ||
|
|
4dc59b5255 | ||
|
|
08192033fb | ||
|
|
2f4cb0156c | ||
|
|
e26a3dc0e7 | ||
|
|
e827420569 | ||
|
|
e379e035c7 | ||
|
|
6de2813c3d | ||
|
|
20bae1bf90 | ||
|
|
2f8b4732b4 | ||
|
|
79c59a2b1e | ||
|
|
51c44a7c5a | ||
|
|
64da09675e | ||
|
|
82fd5e6e8a | ||
|
|
1e183a3258 | ||
|
|
891209d925 | ||
|
|
4d3cf756e4 | ||
|
|
27c87d56bb | ||
|
|
72c588ad33 | ||
|
|
41fed16d08 | ||
|
|
5607bb3d61 | ||
|
|
fab0af1b40 | ||
|
|
b5afe90764 | ||
|
|
fef160e7a7 | ||
|
|
e408dc14cc | ||
|
|
257c31c05f | ||
|
|
3f72905b3f | ||
|
|
c4282f29ab | ||
|
|
642913b0f8 | ||
|
|
2c3887ece9 | ||
|
|
9fab98a6ce | ||
|
|
81334389a9 | ||
|
|
d579efa041 | ||
|
|
da4b2b4849 | ||
|
|
da51e3a3d5 | ||
|
|
837dae242c | ||
|
|
7ad8a3cbb5 | ||
|
|
8b50f3cdbd | ||
|
|
16da4d851e | ||
|
|
a5bc73f0b3 | ||
|
|
258ad95b7a | ||
|
|
75714b60ca | ||
|
|
ca7cbd291f | ||
|
|
d77666cd3e | ||
|
|
1755347878 | ||
|
|
5978b433d3 | ||
|
|
37baf3de3c | ||
|
|
cfdddc4469 | ||
|
|
d505ebe926 | ||
|
|
c8a3fd72d4 | ||
|
|
9788ca08ea | ||
|
|
b4787235b5 | ||
|
|
9dd3b1617d | ||
|
|
58835eeb2e | ||
|
|
3a8ed2e9cb | ||
|
|
6b630c9fd2 | ||
|
|
db1b427b3f | ||
|
|
aa164cdbce | ||
|
|
9c27ed29ae | ||
|
|
d2385e9c75 | ||
|
|
01d27e22f8 | ||
|
|
abf90f1dd6 | ||
|
|
53215d87ee | ||
|
|
2d5dce4954 | ||
|
|
7e229ceb2f | ||
|
|
2a8388d262 | ||
|
|
4751b33d0c | ||
|
|
98eb810f89 | ||
|
|
7c07001bdc | ||
|
|
a81f17a802 | ||
|
|
dbadb9b0a6 | ||
|
|
c204b63653 | ||
|
|
48240db813 | ||
|
|
94a9f17838 | ||
|
|
5ca7bb365e | ||
|
|
260268f62b | ||
|
|
a8dac9bd3a | ||
|
|
d1acd964a5 | ||
|
|
5e493f2d3f | ||
|
|
d65ebb80c6 | ||
|
|
b9f3f549a1 | ||
|
|
67cefb1211 | ||
|
|
14b576e411 | ||
|
|
43edea01b7 | ||
|
|
262c8d71d5 | ||
|
|
80ee713893 | ||
|
|
3837a2c5d6 | ||
|
|
dc56e4557b | ||
|
|
717ceee0ea | ||
|
|
5713ff09f4 | ||
|
|
b6b1d40516 | ||
|
|
152eaa10dd | ||
|
|
d689ad72e8 | ||
|
|
d6fec88932 | ||
|
|
fd9e68e7e7 | ||
|
|
6971e08b0d | ||
|
|
cea50f319d | ||
|
|
6ce9f77e17 | ||
|
|
0f43b564c9 | ||
|
|
6bf906a849 | ||
|
|
983ee7b973 | ||
|
|
bd7d10b81e | ||
|
|
876e70d85f | ||
|
|
590f077963 | ||
|
|
2aa1ab2f2b | ||
|
|
2e08599f82 | ||
|
|
b450739333 | ||
|
|
e330ff0299 | ||
|
|
6c233da2ff | ||
|
|
fa309d0d18 | ||
|
|
9f187ed027 | ||
|
|
42e5876ebe | ||
|
|
46b726a4e0 | ||
|
|
0278e782e0 | ||
|
|
bf8f71f215 | ||
|
|
9adc9f886c | ||
|
|
50d504a38f | ||
|
|
c2d7f3c653 | ||
|
|
9e92178357 | ||
|
|
42c3580bf2 | ||
|
|
9237c931b2 | ||
|
|
1a62e00066 | ||
|
|
803d94c8ac | ||
|
|
ac2bbd68db | ||
|
|
8160cef2b3 | ||
|
|
c7fd8f5116 | ||
|
|
618d2f9f58 | ||
|
|
807d7a7aaf | ||
|
|
416fb5e1e3 | ||
|
|
1fb9960168 | ||
|
|
919e41f55e | ||
|
|
616523c732 | ||
|
|
bb0e699619 | ||
|
|
d5294d5733 | ||
|
|
3769d99532 | ||
|
|
c7b272561e | ||
|
|
21789e0692 | ||
|
|
1a2ff9b089 | ||
|
|
3ec8dc6858 | ||
|
|
9be1bd523a | ||
|
|
1f191c3ce1 | ||
|
|
91ed621ec8 | ||
|
|
6adbd14bf8 | ||
|
|
5826446509 | ||
|
|
84d2d20e13 | ||
|
|
3ed4c8d636 | ||
|
|
c15931e6f6 | ||
|
|
7c20ed777d | ||
|
|
5d0359331b | ||
|
|
b255fc40af | ||
|
|
7b523af05b | ||
|
|
bd65abd3b4 | ||
|
|
b4dd90ba2b | ||
|
|
c274d5114c | ||
|
|
c821cdd9c7 | ||
|
|
69871506e1 | ||
|
|
a99e29642c | ||
|
|
acdc19df1d | ||
|
|
2bad04848c | ||
|
|
bf3d6ae24b | ||
|
|
2984e2dc5d | ||
|
|
3b23f69786 | ||
|
|
9fbc63e6fb | ||
|
|
cb158ca866 | ||
|
|
857e2fd46e | ||
|
|
74f2f45fc0 | ||
|
|
b76d208212 | ||
|
|
dea43da4d2 | ||
|
|
d32796eab0 | ||
|
|
1a79d7c255 | ||
|
|
1afea60c6f | ||
|
|
a49b459a59 | ||
|
|
9a051b6979 | ||
|
|
64ac5fdf73 | ||
|
|
ec366c840c | ||
|
|
edf616baca | ||
|
|
58bc8b6ec7 | ||
|
|
2dea6ab5a5 | ||
|
|
c3247396f7 | ||
|
|
f3bfe177ce | ||
|
|
7c1f39d10e | ||
|
|
cd6669c024 | ||
|
|
5c69b56cd5 | ||
|
|
90d1bbbb31 | ||
|
|
e370d7dbdd | ||
|
|
38e0bc1257 | ||
|
|
47f14845ca | ||
|
|
70d8b65f0a | ||
|
|
5ebe14e452 | ||
|
|
36ecd5625a | ||
|
|
f036c1a6c5 | ||
|
|
64c67a07dd | ||
|
|
092d496944 | ||
|
|
5edb923904 | ||
|
|
6300f9154a | ||
|
|
c90af1ce6c | ||
|
|
7b54a2a1ee | ||
|
|
aa82efd4f1 | ||
|
|
6343f32d70 | ||
|
|
b86a021042 | ||
|
|
7af8a4cf14 | ||
|
|
38a480ac14 | ||
|
|
3b84eb635c | ||
|
|
6287a782a1 | ||
|
|
e468436b0c | ||
|
|
10e1a2a593 | ||
|
|
194d1291e1 | ||
|
|
085dc76e41 | ||
|
|
b0b9180943 | ||
|
|
af6f2b2107 | ||
|
|
887afa9389 | ||
|
|
d84ffa50c3 | ||
|
|
eda493e525 | ||
|
|
712b2715d4 | ||
|
|
d8c4d8c1aa | ||
|
|
5d1aff157e | ||
|
|
73220b5116 | ||
|
|
d58960d723 | ||
|
|
bcc1db12e5 | ||
|
|
533951afea | ||
|
|
93023c5bfc | ||
|
|
9319e07db5 | ||
|
|
9b18fb2b71 | ||
|
|
cae8a18437 | ||
|
|
374989a2ad | ||
|
|
fc6672adda | ||
|
|
0b17b52c9a | ||
|
|
9d13234e23 | ||
|
|
815f67467a | ||
|
|
bebc414136 | ||
|
|
d91e5d894f | ||
|
|
d13fca251e | ||
|
|
e632ca4418 | ||
|
|
a987c3ed39 | ||
|
|
382a99ad61 | ||
|
|
50bde1a607 | ||
|
|
080d137af8 | ||
|
|
02f6bfd578 | ||
|
|
77aa540dc3 | ||
|
|
1793e36127 | ||
|
|
979ad972fe | ||
|
|
ee7e632b94 | ||
|
|
075542e4a5 | ||
|
|
c1902e4396 | ||
|
|
aaac697a98 | ||
|
|
ac9e11d732 | ||
|
|
f36ecc470b | ||
|
|
bd14657055 | ||
|
|
6892a00b86 | ||
|
|
620a4eb409 | ||
|
|
ad7a1ec89f | ||
|
|
ca1eaa5e15 | ||
|
|
431357f623 | ||
|
|
7eb037b3f4 | ||
|
|
c619f05f94 | ||
|
|
550ddc0109 | ||
|
|
eaae568c7c | ||
|
|
d932c3ab99 | ||
|
|
803a33efde | ||
|
|
227863faf7 | ||
|
|
0e1582702a | ||
|
|
42b9f22a81 | ||
|
|
7e971550de | ||
|
|
6cf0ef080b | ||
|
|
c796acf791 | ||
|
|
27bf05f2fe | ||
|
|
c62c604418 | ||
|
|
fc9bc2976f | ||
|
|
058b0e41d2 | ||
|
|
0a3404fa55 | ||
|
|
ac09caefac | ||
|
|
ed6355fe86 | ||
|
|
471276716b | ||
|
|
b754f9f908 | ||
|
|
cde17925fc | ||
|
|
05ab06e3a5 | ||
|
|
f1e70829af | ||
|
|
f500d78487 | ||
|
|
ed48c4a0c5 | ||
|
|
1ff189c63a | ||
|
|
2583e9d888 | ||
|
|
d280fa9fbd | ||
|
|
807fa609f9 | ||
|
|
ad3cba929e | ||
|
|
3288353be0 | ||
|
|
6eb46c935e | ||
|
|
58388419fb | ||
|
|
4ae43c5f2a | ||
|
|
74f5dc0a76 | ||
|
|
f4dce731e9 | ||
|
|
aedb59f854 | ||
|
|
3a03bb8dd7 | ||
|
|
e232cd812a | ||
|
|
ebc00f3d7c | ||
|
|
32bc20d8ce | ||
|
|
82ac1bdfe0 | ||
|
|
56f5ce6ee1 | ||
|
|
4803600734 | ||
|
|
76cc3e79b9 | ||
|
|
14e775cbcf | ||
|
|
005db434f8 | ||
|
|
d4535c6164 | ||
|
|
dd3aeb45ea | ||
|
|
e4ec248eb6 | ||
|
|
cb8e9d3018 | ||
|
|
50200326a9 | ||
|
|
40c1597c67 | ||
|
|
d34705860a | ||
|
|
fb95d0ef58 | ||
|
|
0838202892 | ||
|
|
7f2e06d4e2 | ||
|
|
824067e238 | ||
|
|
084329f9f1 | ||
|
|
e1548cc974 | ||
|
|
8241b2ba3e | ||
|
|
e5e4ab4e05 | ||
|
|
a26101d6b9 | ||
|
|
24b8baf8cc | ||
|
|
5a6ca707e0 | ||
|
|
c9d4cd2e14 | ||
|
|
f96f47e463 | ||
|
|
037063f24e | ||
|
|
ca9d0abe4b | ||
|
|
a2a074fb4f | ||
|
|
07fa36aa58 | ||
|
|
774157f9b6 | ||
|
|
9df3f7b50e | ||
|
|
2c5025644c | ||
|
|
7b7e61485e | ||
|
|
0363dddbcc | ||
|
|
356f224a25 | ||
|
|
fbf5d5287f | ||
|
|
1557bf8882 | ||
|
|
8485fd591b | ||
|
|
f834ff6ec5 | ||
|
|
7fccfa0651 | ||
|
|
ff6b52edc6 | ||
|
|
7532d4d333 | ||
|
|
40c0c8ef6a | ||
|
|
3eefc81d9d | ||
|
|
da80f7cbda | ||
|
|
e75e65b2c1 | ||
|
|
0a10c8f3bf | ||
|
|
e6a6c8342f | ||
|
|
dd764a09a8 | ||
|
|
caf35bcdf4 | ||
|
|
d898ba9333 | ||
|
|
da1c07ff99 | ||
|
|
0a12d1507e | ||
|
|
1acd6e4c1c | ||
|
|
7414737cbf | ||
|
|
bb16af3731 | ||
|
|
239e679fee | ||
|
|
3767a9fd27 | ||
|
|
ff1f64d9bc | ||
|
|
aa5b7e7595 | ||
|
|
3b82059bdb | ||
|
|
520fc23371 | ||
|
|
62a144c730 | ||
|
|
f4e5fb446d | ||
|
|
9e13f671ee | ||
|
|
438d49be85 | ||
|
|
e883bbf10b | ||
|
|
19d1afdce0 | ||
|
|
8345237dcc | ||
|
|
50f6f2d3ec | ||
|
|
4b3684bc5d | ||
|
|
df3a3c77eb | ||
|
|
a3073c44e2 | ||
|
|
489550fd7a | ||
|
|
7d679eb480 | ||
|
|
23cbd581db | ||
|
|
0466c7144c | ||
|
|
d2a2631a70 | ||
|
|
1c3e14919f | ||
|
|
0ee8c7d70f | ||
|
|
c55a601db9 | ||
|
|
71b5e0a296 | ||
|
|
a4844f7b77 | ||
|
|
f4cb062380 | ||
|
|
81b3c69465 | ||
|
|
a36d1f6219 | ||
|
|
d7029dcfc6 | ||
|
|
24b71a400f | ||
|
|
7cc14baae3 | ||
|
|
9c01c87bbf | ||
|
|
941e4d7c1f | ||
|
|
d96633f3f7 | ||
|
|
05acddcc64 | ||
|
|
5c05d3d7ea | ||
|
|
7af7ecd82a | ||
|
|
522815d266 | ||
|
|
90db2b4c5c | ||
|
|
8dd918f2a4 | ||
|
|
b1df44cf05 | ||
|
|
bb5f20e3de | ||
|
|
9d662bf059 | ||
|
|
379ba33bb9 | ||
|
|
a39ebae0cd | ||
|
|
cbb60e3c3a | ||
|
|
6020809462 | ||
|
|
4196912966 | ||
|
|
8c4154bc1a | ||
|
|
a391bbd67b | ||
|
|
576df1f6e3 | ||
|
|
4ba98c997a | ||
|
|
9726481fb4 | ||
|
|
2c7bbc6ade | ||
|
|
faf3f96322 | ||
|
|
08363f28dd | ||
|
|
2aaae7c6a1 | ||
|
|
41f08e4e29 | ||
|
|
0ea6ad0669 | ||
|
|
cdeb3c211b | ||
|
|
ea028c7531 | ||
|
|
8d3ba87c63 | ||
|
|
448261394f | ||
|
|
8334bf9477 | ||
|
|
178c417fb0 | ||
|
|
a9e7aec5b6 | ||
|
|
a68d836beb | ||
|
|
1e75b7bd12 | ||
|
|
dd8d2c8557 | ||
|
|
aede6f9ce5 | ||
|
|
376a92f554 | ||
|
|
cb37198a9d | ||
|
|
3689eb508e | ||
|
|
af95fb0828 | ||
|
|
bdca70b330 | ||
|
|
bd2abb0127 | ||
|
|
d805f99534 | ||
|
|
11c6e387d5 | ||
|
|
3b950094af | ||
|
|
dd8e37a6ce | ||
|
|
62a9e3921d | ||
|
|
bdf39c1e89 | ||
|
|
784ecb94ea | ||
|
|
23ab85e253 | ||
|
|
bb9702910b | ||
|
|
284b86ebb6 | ||
|
|
3d4ea71dcf | ||
|
|
b66f313c2d | ||
|
|
7e86b41f92 | ||
|
|
fedca3167d | ||
|
|
6a5982f3ce | ||
|
|
4472c37884 | ||
|
|
66f2739be7 | ||
|
|
8dc9a0773c | ||
|
|
72493e6af3 | ||
|
|
a26c5eb56e | ||
|
|
14ee13bdd4 | ||
|
|
3b22dcadc9 | ||
|
|
b19845bf93 | ||
|
|
f2d81ff542 | ||
|
|
966f10bcb7 | ||
|
|
8ba0e7ce0e | ||
|
|
d9522261b1 | ||
|
|
83262afda1 | ||
|
|
142e96b246 | ||
|
|
2f68092740 | ||
|
|
c115738535 | ||
|
|
9b2283972c | ||
|
|
5537d59fb8 | ||
|
|
18bcf2d588 | ||
|
|
ebcf14df06 | ||
|
|
9a801b4b93 | ||
|
|
6b7df9ca08 | ||
|
|
5cc5d2e811 | ||
|
|
a4edb0080b | ||
|
|
fc9017cfb1 | ||
|
|
30a0f3c9ed | ||
|
|
d0b8e17873 | ||
|
|
b8ab6e4083 | ||
|
|
09c6e0cb5c | ||
|
|
6e0e01225e | ||
|
|
268c8d608c | ||
|
|
fbcddff6ea | ||
|
|
08b61eb50b | ||
|
|
45ef6ac56d | ||
|
|
a68c3140af | ||
|
|
91943ba7e3 | ||
|
|
403fdb31a1 | ||
|
|
20b05ae595 | ||
|
|
5167e93d12 | ||
|
|
5d88504c34 | ||
|
|
3315768b27 | ||
|
|
b5dcfc6f9e | ||
|
|
1ca08ccf95 | ||
|
|
fc7a136c70 | ||
|
|
e24e5916e0 | ||
|
|
4afd2513fa | ||
|
|
7cdedbea1f | ||
|
|
38bc5d07f0 | ||
|
|
3a53f4002a | ||
|
|
1e6c811768 | ||
|
|
95f859673e | ||
|
|
682acc11ec | ||
|
|
ec8d48f4fd | ||
|
|
4f3fcac2bf | ||
|
|
430f9c01d7 | ||
|
|
184d6be98d | ||
|
|
2a50159978 | ||
|
|
5a6f202cf1 | ||
|
|
e97140cbde | ||
|
|
ecb4f0e9da | ||
|
|
57b594041a | ||
|
|
2df2f882e0 | ||
|
|
da254a80cf | ||
|
|
4ad45b2d4a | ||
|
|
a9293285a0 | ||
|
|
b4b58380b6 | ||
|
|
48f79dbfca | ||
|
|
5c82c144cf | ||
|
|
849101950f | ||
|
|
210acf68c1 | ||
|
|
6bbb9832e9 | ||
|
|
1bc92ed3e3 | ||
|
|
6496383e82 | ||
|
|
14776d86f5 | ||
|
|
1de0c30bb0 | ||
|
|
b296803e01 | ||
|
|
68b893fa02 | ||
|
|
05792809b5 | ||
|
|
068cce353a | ||
|
|
82f2fc67c2 | ||
|
|
b77c4682d1 | ||
|
|
42b3edff64 | ||
|
|
83c0f8a16e | ||
|
|
af9fa15636 | ||
|
|
061590665e | ||
|
|
49ed3db352 | ||
|
|
32330f99fc | ||
|
|
a2c3fb3d5e | ||
|
|
069d820d39 | ||
|
|
1700b75cfe | ||
|
|
64d06f5650 | ||
|
|
97533145a7 | ||
|
|
8c6758720d | ||
|
|
d0718df82b | ||
|
|
f81cc81e20 | ||
|
|
79023eb5c6 | ||
|
|
35f7526c2a | ||
|
|
f8eede78ca | ||
|
|
a38186857d | ||
|
|
66ae8bdd5c | ||
|
|
d108091511 | ||
|
|
29a05978ec | ||
|
|
7e4d50b406 | ||
|
|
90419a4f2d | ||
|
|
8cc96d9b89 | ||
|
|
dc7a4df39a | ||
|
|
a1bc11ec09 | ||
|
|
711962da84 | ||
|
|
c5f7eeaacb | ||
|
|
670cd21685 | ||
|
|
9ba07d3883 | ||
|
|
713e264061 | ||
|
|
21f18a75bb | ||
|
|
3e610ec5ba | ||
|
|
e8288eec6a | ||
|
|
936ae3b171 | ||
|
|
834d30f85f | ||
|
|
231c17f6a9 | ||
|
|
acf2ad2f0c | ||
|
|
59f82f204f | ||
|
|
02cfc40e94 | ||
|
|
b9338a639e | ||
|
|
205444f670 | ||
|
|
480347296b | ||
|
|
7b53486821 | ||
|
|
49c2be40ab | ||
|
|
a65603e10c | ||
|
|
7393d31208 | ||
|
|
c82164c522 | ||
|
|
e30e2ef2c3 | ||
|
|
9347a78482 | ||
|
|
25c7e40574 | ||
|
|
739d8f329a | ||
|
|
2449f5b99e | ||
|
|
b3e323462c | ||
|
|
bf9bd267fd | ||
|
|
8685c7a604 | ||
|
|
62cca045be | ||
|
|
bd119bccf4 | ||
|
|
8920db694c | ||
|
|
d51ad7718c | ||
|
|
e66c854be5 | ||
|
|
cd8bef964a | ||
|
|
4d5e01abef | ||
|
|
7b44980912 | ||
|
|
7c22135bb4 | ||
|
|
21691c5cc1 | ||
|
|
533bdd398a | ||
|
|
98b54e6682 | ||
|
|
5eba762a20 | ||
|
|
27682cb666 | ||
|
|
67873f39dc | ||
|
|
7aa52e5f1b | ||
|
|
c31c1b00b1 | ||
|
|
52db7df6d8 | ||
|
|
c05fa40756 | ||
|
|
5fdaf73fdf | ||
|
|
30e5fc83b2 | ||
|
|
4afd1fa91d | ||
|
|
c5722011e8 | ||
|
|
02592e1b5e | ||
|
|
ccec01b729 | ||
|
|
6c295cd314 | ||
|
|
a9274d4b52 | ||
|
|
0a7e02bf34 | ||
|
|
19bc0fb468 | ||
|
|
d8a00cf517 | ||
|
|
48fb321699 | ||
|
|
f1a9e2ae32 | ||
|
|
2c66f21cc1 | ||
|
|
dfed6af0c0 | ||
|
|
dbf4f67c55 | ||
|
|
66b54d6a27 | ||
|
|
30705d6fc9 | ||
|
|
6c74e2d19c | ||
|
|
973e2d2ef8 | ||
|
|
067ca38321 | ||
|
|
bc7380c5d7 | ||
|
|
f2535e196d | ||
|
|
ea7ef950a3 | ||
|
|
813261df07 | ||
|
|
56d216adf7 | ||
|
|
60e60427fc | ||
|
|
49d4bb4969 | ||
|
|
9eb6b7c52a | ||
|
|
3d4acf7d37 | ||
|
|
5e2f6b0f40 | ||
|
|
881da401e1 | ||
|
|
9290cc1f7a | ||
|
|
c64da3ceb4 | ||
|
|
fff75b51ce | ||
|
|
eb804c2a4a | ||
|
|
cb87509e4f | ||
|
|
8d74c3f22a | ||
|
|
22946700dd | ||
|
|
32d5a0bab2 | ||
|
|
f415fa1a7e | ||
|
|
66e01991d6 | ||
|
|
09b5d2252c | ||
|
|
4a917c95ab | ||
|
|
65e1f16163 | ||
|
|
226d2bb964 | ||
|
|
aa5e5178d3 | ||
|
|
43f12ffdd4 | ||
|
|
14a55133af | ||
|
|
fa0911dbdf | ||
|
|
a5fa5d0451 | ||
|
|
59a29d5288 | ||
|
|
67e9787ba1 | ||
|
|
4486592f04 | ||
|
|
2ae9a4bdbb | ||
|
|
7dceb629ca | ||
|
|
0aed074796 | ||
|
|
a9ed6fe46a | ||
|
|
1d68579b57 | ||
|
|
f66274fd9d | ||
|
|
0a001f98e3 | ||
|
|
0531276b9b | ||
|
|
2be5474f3a | ||
|
|
bddfb2a5c6 | ||
|
|
dc0000059b | ||
|
|
72753a9ccb | ||
|
|
b193d87499 | ||
|
|
d9ce4ff634 | ||
|
|
01ee181607 | ||
|
|
2c4af8f136 | ||
|
|
ff8b5aca75 | ||
|
|
188315735b | ||
|
|
3b79be04bc | ||
|
|
a47b1a28f4 | ||
|
|
a2fcaa15c9 | ||
|
|
35842af019 | ||
|
|
7271472e13 | ||
|
|
64fd94e51e | ||
|
|
ce6abe0247 | ||
|
|
c3477ace9b | ||
|
|
ef7605f9ec | ||
|
|
58e9f66d64 | ||
|
|
7624683710 | ||
|
|
b5946c91ed | ||
|
|
246708e222 | ||
|
|
3180bc7104 | ||
|
|
d12f0365d5 | ||
|
|
01d2ef84ba | ||
|
|
80e56eb190 | ||
|
|
2b64d78163 | ||
|
|
169b9b9898 | ||
|
|
0da6739f94 | ||
|
|
bcbeca4b8a | ||
|
|
9e62304852 | ||
|
|
da6d0ba7bf | ||
|
|
ec56ea3ebe | ||
|
|
624f2f66cf | ||
|
|
b0c3c3dddc | ||
|
|
8eb2155eac | ||
|
|
0a41b86e47 | ||
|
|
7c808ab4b4 | ||
|
|
d260f6506f | ||
|
|
8ecc0e11a7 | ||
|
|
feaeee0379 | ||
|
|
de3740fa70 | ||
|
|
fe1f620731 | ||
|
|
63329e7199 | ||
|
|
e79cc6cd2d | ||
|
|
6376c49441 | ||
|
|
aafd31b552 | ||
|
|
2520093b3e | ||
|
|
3d569b23d6 | ||
|
|
4ab4998bf7 | ||
|
|
60c53b0ec1 | ||
|
|
852f6049bd | ||
|
|
1daaad422b | ||
|
|
f5d8cce4a2 | ||
|
|
9d48d04f0f | ||
|
|
d91a9504aa | ||
|
|
19234d6565 | ||
|
|
affe47a11c | ||
|
|
899c575ae8 | ||
|
|
b76cdc2227 | ||
|
|
a27b479f06 | ||
|
|
533228ff5e | ||
|
|
7dd276631a | ||
|
|
e3f3b6d751 | ||
|
|
77cb794e4d | ||
|
|
45f898870f | ||
|
|
5ae74f4017 | ||
|
|
2c4ef9dbb3 | ||
|
|
2bbc1013be | ||
|
|
4b49e456dd | ||
|
|
e2e09200c4 | ||
|
|
28d7c5d44a | ||
|
|
85f9247fd7 | ||
|
|
f8fbda97cd | ||
|
|
86ac98b9f9 | ||
|
|
35c85c6d1d | ||
|
|
02bc00bfa5 | ||
|
|
19184518e9 | ||
|
|
85c5449ba8 | ||
|
|
957f04912f | ||
|
|
e5f7042d00 | ||
|
|
1596475db2 | ||
|
|
42f5cc382d | ||
|
|
5479bdd85c | ||
|
|
b4f266457f | ||
|
|
77bdcfa7a4 | ||
|
|
235b7348ae | ||
|
|
cf669f3cfa | ||
|
|
e1b09f2694 | ||
|
|
88dd64e795 | ||
|
|
f077030dfc | ||
|
|
836acbf02b | ||
|
|
3101104738 | ||
|
|
391513d378 | ||
|
|
6bed403412 | ||
|
|
bc91804996 | ||
|
|
a754f1303f | ||
|
|
65f3c12d2d | ||
|
|
879cf1b53c | ||
|
|
105e4c0555 | ||
|
|
f7888757aa | ||
|
|
1a0ca9edbe | ||
|
|
a49d558aaf | ||
|
|
502f135b15 | ||
|
|
e263db90ce | ||
|
|
7bd53903a4 | ||
|
|
8d63ce3ce5 | ||
|
|
bf77f42674 | ||
|
|
7424cf2834 | ||
|
|
b6a3161280 | ||
|
|
daba92b992 | ||
|
|
5503f90473 | ||
|
|
d5a3851eef | ||
|
|
8c6d37d9bd | ||
|
|
e6498b6864 | ||
|
|
4b31061037 | ||
|
|
6e8e7a63cc | ||
|
|
53db149b12 | ||
|
|
d455d03608 | ||
|
|
3959b67cc0 | ||
|
|
04bc23abe9 | ||
|
|
a60dc95fed | ||
|
|
607be461e0 | ||
|
|
4dd6308db9 | ||
|
|
289730a3e3 | ||
|
|
1d34d5f6a5 | ||
|
|
64e1ab481b | ||
|
|
c92b3debb7 | ||
|
|
68c41e2915 | ||
|
|
31929c7004 | ||
|
|
937419bfcd | ||
|
|
9b3ff8f1b8 | ||
|
|
a44d86f285 | ||
|
|
400bd86749 | ||
|
|
31ec8830f4 | ||
|
|
2a3eb7b70c | ||
|
|
e183e2ff04 | ||
|
|
7598312969 | ||
|
|
e62f79d9ae | ||
|
|
662849c0c2 | ||
|
|
10251e460b | ||
|
|
6f9d69f9f3 | ||
|
|
091b42d317 | ||
|
|
463ac0c07e | ||
|
|
836178a0da | ||
|
|
1d9b550e35 | ||
|
|
93d4e345b8 | ||
|
|
a7cda7011b | ||
|
|
763af17e71 | ||
|
|
83df1159c0 | ||
|
|
a7c5b9f568 | ||
|
|
0da88fc74b | ||
|
|
b82b313e32 | ||
|
|
36d8c5517f | ||
|
|
b08573831e | ||
|
|
41e3b01285 | ||
|
|
cdfb337bae | ||
|
|
31ecaacbc8 | ||
|
|
5bcb104a01 | ||
|
|
6c75201b2e | ||
|
|
54491a9eaf | ||
|
|
c11262082e | ||
|
|
8c106ce8c4 | ||
|
|
b4f5e78a77 | ||
|
|
8735fe14a8 | ||
|
|
01c501b172 | ||
|
|
1f12bab923 | ||
|
|
810495264f | ||
|
|
754035c722 | ||
|
|
fbdda1b3a5 | ||
|
|
a992d8685f | ||
|
|
763f5de904 | ||
|
|
4b99a39779 | ||
|
|
5e19fd0122 | ||
|
|
823a1f0fc4 | ||
|
|
f3722ebc4f | ||
|
|
fbeea9159e | ||
|
|
0f67dc168b | ||
|
|
5cd86aa5bc | ||
|
|
8cb55983bb | ||
|
|
ffcfc060e9 | ||
|
|
6313ff19b3 | ||
|
|
61bd8aa154 | ||
|
|
637578375c | ||
|
|
18bcdd09d3 | ||
|
|
cc5ef89139 | ||
|
|
1a9506f832 | ||
|
|
e7d06ee132 | ||
|
|
7647f848e4 | ||
|
|
eec820774b | ||
|
|
8cbdaffedb | ||
|
|
e6267d9411 | ||
|
|
8f34e2abdb | ||
|
|
d3f0e00356 | ||
|
|
7c2725acdc | ||
|
|
f47c9186bf | ||
|
|
c9b77cbe94 | ||
|
|
725230dc81 | ||
|
|
73102f1362 | ||
|
|
ca1a5d33f4 | ||
|
|
3bf023e4df | ||
|
|
c556613b9f | ||
|
|
6c07b7378c | ||
|
|
4520fdd58b | ||
|
|
1ac62fce01 | ||
|
|
c2d301bf52 | ||
|
|
8658be3b05 | ||
|
|
2a8b8e93da | ||
|
|
ac6785eb1a | ||
|
|
848b14605e | ||
|
|
2a0048afbb | ||
|
|
cc943cea4a | ||
|
|
2f3623d430 | ||
|
|
fe44a5ba69 | ||
|
|
d3a0b9d877 | ||
|
|
25efa5437b | ||
|
|
67b40a8442 | ||
|
|
bcac44bcb4 | ||
|
|
58cb9e1c22 | ||
|
|
ce99b5f688 | ||
|
|
ce76c278ed | ||
|
|
bb5dbecbf2 | ||
|
|
eed46994da | ||
|
|
a5df53249a | ||
|
|
331cef16ef | ||
|
|
e79c695732 | ||
|
|
b4d7e42973 | ||
|
|
71183f6c19 | ||
|
|
0b5b585992 | ||
|
|
7492d48029 | ||
|
|
b4903b763e | ||
|
|
3d76ab1832 | ||
|
|
48cbf0d9b0 | ||
|
|
6b9ae264ff | ||
|
|
e90e608fdd | ||
|
|
6fe350fa52 | ||
|
|
c426f998e2 | ||
|
|
2187cef14f | ||
|
|
6b5cf3396d | ||
|
|
4f59a48f57 | ||
|
|
d48d3c9c2f | ||
|
|
4579886bb5 | ||
|
|
bd979da949 | ||
|
|
d5e340354e | ||
|
|
19bbf5ac8f | ||
|
|
b8deea5c76 | ||
|
|
88223fc058 | ||
|
|
09e43f3e41 | ||
|
|
751bc317ea | ||
|
|
60f196ff93 | ||
|
|
294fc48bd1 | ||
|
|
d3d07f7f11 | ||
|
|
ca272bb36a | ||
|
|
cd41089e49 | ||
|
|
b1cf5b9c40 | ||
|
|
c37cfdfa2f | ||
|
|
84bc2e78bc | ||
|
|
0676d7e2dc | ||
|
|
dd8dac0574 | ||
|
|
d6d1cc5f45 | ||
|
|
f016160c62 | ||
|
|
7119e0d95f | ||
|
|
ffb902ba06 | ||
|
|
dc14453f34 | ||
|
|
f83e772030 | ||
|
|
0c1dd44cd6 | ||
|
|
5b2be2d190 | ||
|
|
9d28aa9521 | ||
|
|
8298a93dcc | ||
|
|
a78731c8cd | ||
|
|
15492028fc | ||
|
|
db5a4f84f6 | ||
|
|
4b75ec5b55 | ||
|
|
1daae0135d | ||
|
|
dd511df194 | ||
|
|
e43e4e2ee0 | ||
|
|
b67bae31ba | ||
|
|
5cb85472c6 | ||
|
|
1c865ebeb9 | ||
|
|
a18bdcf7cd | ||
|
|
0a36baa7d7 | ||
|
|
47958f708f | ||
|
|
d030850638 | ||
|
|
9360378ae9 | ||
|
|
a3268dd403 | ||
|
|
b34e38df57 | ||
|
|
5188750332 | ||
|
|
7275cdd3d9 | ||
|
|
f6c201f02f | ||
|
|
1ec51cec18 | ||
|
|
2531271fe2 | ||
|
|
9055019cc2 | ||
|
|
9829bec390 | ||
|
|
183c47f810 | ||
|
|
129c09c5a7 | ||
|
|
c8384bf304 | ||
|
|
5e1caf3746 | ||
|
|
532b409a54 | ||
|
|
7dd4645a7b | ||
|
|
0bf1379cc5 | ||
|
|
6f98e1fddb | ||
|
|
d3f6616d5d | ||
|
|
8cdf914f5d | ||
|
|
6c6292135f | ||
|
|
75c4135d6e | ||
|
|
5927f2fa30 | ||
|
|
bd13457f33 | ||
|
|
8de9843e7e | ||
|
|
a73fb338f1 | ||
|
|
ae8751461a | ||
|
|
9c0c7b060c | ||
|
|
da5140e615 | ||
|
|
fa32d4e3f4 | ||
|
|
52541df3f9 | ||
|
|
39d75ee7d5 | ||
|
|
246a8409bf | ||
|
|
c554bf9edd | ||
|
|
ef522ba292 | ||
|
|
3602fb76c5 | ||
|
|
8dfc405c3e | ||
|
|
567f4e5c3d | ||
|
|
57b1820fd7 | ||
|
|
6a54c71c94 | ||
|
|
2b244f0628 | ||
|
|
be23d00042 | ||
|
|
d9a2597617 | ||
|
|
33e5cad75a | ||
|
|
8c9a89bcd2 | ||
|
|
0c93d20980 | ||
|
|
93a0040b68 | ||
|
|
e4a4f0eb4a | ||
|
|
78137540f2 | ||
|
|
76babd951d | ||
|
|
a66bd5e847 | ||
|
|
dcd3bc10e1 | ||
|
|
08f5841522 | ||
|
|
7a55a2e6ce | ||
|
|
ac79938c20 | ||
|
|
1da24fbeaa | ||
|
|
a20b39325e | ||
|
|
f7a4951e0d | ||
|
|
9abfc5b250 | ||
|
|
a41c950b11 | ||
|
|
718bf57b5d | ||
|
|
11e3a66484 | ||
|
|
9a322ed67f | ||
|
|
4e1573cb39 | ||
|
|
28e36c7edc | ||
|
|
bbdf710b52 | ||
|
|
3634f457b4 | ||
|
|
a956f0a5d7 | ||
|
|
265f9f295e | ||
|
|
6888c6ef60 | ||
|
|
50b84c3e91 | ||
|
|
9152d322ac | ||
|
|
18091c5ad6 | ||
|
|
4a58e339cb | ||
|
|
31dd1be090 | ||
|
|
3cc97accfc | ||
|
|
555717b9a0 | ||
|
|
cf58aa780a | ||
|
|
935777fb49 | ||
|
|
0dbea0ed01 | ||
|
|
84425d7786 | ||
|
|
3920a93cba | ||
|
|
4735a6c49a | ||
|
|
a8549ef882 | ||
|
|
0df1255ae5 | ||
|
|
f6d87c7a7e | ||
|
|
1f59b4d2ba | ||
|
|
1df173d684 | ||
|
|
b2f78786a5 | ||
|
|
314b6138d7 | ||
|
|
1bc3c293fa | ||
|
|
bbf0666539 | ||
|
|
2ed60de628 | ||
|
|
76546ec176 | ||
|
|
0a9a1db942 | ||
|
|
d589823f4a | ||
|
|
33decd1780 | ||
|
|
6269076c7e | ||
|
|
506a98aee2 | ||
|
|
8d1e4297ec | ||
|
|
8678121210 | ||
|
|
24d801d18a | ||
|
|
2e647c6b41 | ||
|
|
a47b2bc715 | ||
|
|
e1a3a9e077 | ||
|
|
3488a761b8 | ||
|
|
822ddc2182 | ||
|
|
f5f1f11f61 | ||
|
|
864785752f | ||
|
|
60e534f59b | ||
|
|
c0f76bef1b | ||
|
|
920e765790 | ||
|
|
cc99279ad1 | ||
|
|
48dd049cbd | ||
|
|
09c830c6ae | ||
|
|
39a896e59e | ||
|
|
ca6c647bd2 | ||
|
|
d2dc62f0b3 | ||
|
|
4983110d50 | ||
|
|
00bf1d31a2 | ||
|
|
2092a0d090 | ||
|
|
d3e70b7f7f | ||
|
|
d86168cb41 | ||
|
|
5a096768e0 | ||
|
|
c2f97356c6 | ||
|
|
b5cfbbcdec | ||
|
|
6326902287 | ||
|
|
a9af9cabb4 | ||
|
|
546aa58482 | ||
|
|
be79c586da | ||
|
|
819377b0bb | ||
|
|
b37965de3d | ||
|
|
d7391611dd | ||
|
|
fa1a1eb939 | ||
|
|
5a33e66c2c | ||
|
|
3bc25d44ee | ||
|
|
ba7e36c719 | ||
|
|
e6e0eefaa4 | ||
|
|
a750999e0e | ||
|
|
40a6b11a1b | ||
|
|
471757d6c6 | ||
|
|
2373eda462 | ||
|
|
a0a18e1036 | ||
|
|
04ed96d121 | ||
|
|
05758245a1 | ||
|
|
a28e40ea35 | ||
|
|
14bfa24195 | ||
|
|
8a261b26e8 | ||
|
|
a2c347a79c | ||
|
|
415bc22dd9 | ||
|
|
6edd159626 | ||
|
|
1a1518ac1d | ||
|
|
508dec4858 | ||
|
|
80b88bf047 | ||
|
|
249e331ae9 | ||
|
|
47ba11be1b | ||
|
|
163870afd9 | ||
|
|
117d29ae72 | ||
|
|
8dc5b07818 | ||
|
|
acb77213e1 | ||
|
|
e68358661a | ||
|
|
d9789504ff | ||
|
|
98101ea411 | ||
|
|
f33a6a68e4 | ||
|
|
03fefc279b | ||
|
|
e85be7cccb | ||
|
|
b8f2a1da1a | ||
|
|
b1ce567819 | ||
|
|
68db1d4c13 | ||
|
|
5796e025e6 | ||
|
|
8819ec0575 | ||
|
|
a24c679510 | ||
|
|
c2b4ccdc77 | ||
|
|
8d07a697d3 | ||
|
|
459c4aebb9 | ||
|
|
010fd165c6 | ||
|
|
27f0e86afd | ||
|
|
a436eb8aa6 | ||
|
|
3f5099bd05 | ||
|
|
2625bbc7fd | ||
|
|
0f18463df0 | ||
|
|
6b8428e262 | ||
|
|
a8a24bf0d9 | ||
|
|
c30a86e52a | ||
|
|
591f9a19e5 | ||
|
|
c62547d401 | ||
|
|
16f62bbcfe | ||
|
|
412d0e7be9 | ||
|
|
98c9aaf600 | ||
|
|
f5c8968aa6 | ||
|
|
149cbae4dc | ||
|
|
b689fe1d98 | ||
|
|
a6c1bc1d4a | ||
|
|
ab6dc2d11f | ||
|
|
ced1475233 | ||
|
|
1391f20658 | ||
|
|
b1439274c6 | ||
|
|
6422f11971 | ||
|
|
8e7432e71c | ||
|
|
5dc6dbf216 | ||
|
|
6cb1fd76cc | ||
|
|
934a0f6495 | ||
|
|
266127bb69 | ||
|
|
acecd6d522 | ||
|
|
2cdcae8d31 | ||
|
|
cb2212d2f3 | ||
|
|
9fd527f465 | ||
|
|
828b3204b8 | ||
|
|
8fdfdc2b25 | ||
|
|
bfae766f8a | ||
|
|
569dd0c585 | ||
|
|
211c27aaae | ||
|
|
e2608a0ac9 | ||
|
|
7625812c8c | ||
|
|
beb35c5c35 | ||
|
|
14eb3e51b0 | ||
|
|
d62da02bae | ||
|
|
61dbd349ab | ||
|
|
f102e988c9 | ||
|
|
78df634fed | ||
|
|
e6e677e7d0 | ||
|
|
edca36fa73 | ||
|
|
758f4ef920 | ||
|
|
30ee7fb170 | ||
|
|
8010f2fcc1 | ||
|
|
d98eb06f69 | ||
|
|
7f88f59272 | ||
|
|
f6127e1747 | ||
|
|
9ecc9ab7ad | ||
|
|
17d12fbaf2 | ||
|
|
068ba7bc6f | ||
|
|
713f7eff7a | ||
|
|
74181469bc | ||
|
|
b396b11611 | ||
|
|
8503687136 | ||
|
|
f0051ee81f | ||
|
|
31222a5ab6 | ||
|
|
752e5a7a8f | ||
|
|
2ecb54c4f7 | ||
|
|
7ae912114b | ||
|
|
e33d834cc9 | ||
|
|
9c0a450a47 | ||
|
|
debae00246 | ||
|
|
a1949bc020 | ||
|
|
968abf9d54 | ||
|
|
9053280e14 | ||
|
|
6d2e88eeee | ||
|
|
f1ddd236ce | ||
|
|
be5a0b3dc5 | ||
|
|
614b002d8b | ||
|
|
a494471ed4 | ||
|
|
31ff64b537 | ||
|
|
ba75ae4ccc | ||
|
|
fd28bf8619 | ||
|
|
ae6af18f0d | ||
|
|
b47dc73d30 | ||
|
|
1696fd1103 | ||
|
|
b5c63c4d58 | ||
|
|
330019bb3d | ||
|
|
4bbf9e2ea6 | ||
|
|
6e6f6313a8 | ||
|
|
af19e3bc62 | ||
|
|
40e4fb9b8e | ||
|
|
62c7209558 | ||
|
|
f897f03227 | ||
|
|
38210ae11e | ||
|
|
0ccf0730ea | ||
|
|
abc82c1439 | ||
|
|
e9239be691 | ||
|
|
8452b63d19 | ||
|
|
6f77703e29 | ||
|
|
2b01ba43cb | ||
|
|
eceaa0ae4f | ||
|
|
ae9eb15d5c | ||
|
|
2793e1ec53 | ||
|
|
ec27028f1b | ||
|
|
ba60ae09d5 | ||
|
|
aa0f41ac17 | ||
|
|
4a7876f203 | ||
|
|
101ad99c14 | ||
|
|
0d3ba7541e | ||
|
|
c8718ad643 | ||
|
|
da868347cf | ||
|
|
f4fab86767 | ||
|
|
517addb9f9 | ||
|
|
8c1ef7d6af | ||
|
|
c87245320d | ||
|
|
983c9dad99 | ||
|
|
f299be0eb9 | ||
|
|
a01f45cc7a | ||
|
|
3b1ac4e81f | ||
|
|
bebdec9ebb | ||
|
|
3a91f87679 | ||
|
|
be49fd6a40 | ||
|
|
c88ba97531 | ||
|
|
aa726f723b | ||
|
|
f8651b63c8 | ||
|
|
c020d71327 | ||
|
|
527d5541d7 | ||
|
|
57df1bb7c4 | ||
|
|
5ad9ff7333 | ||
|
|
7d7e3fad1e | ||
|
|
e8eb7a33f0 | ||
|
|
8da618a4f2 | ||
|
|
1c3d8c214c | ||
|
|
bbde86cfb8 | ||
|
|
5e36722047 | ||
|
|
ee35fe1cad | ||
|
|
a83fd1d597 | ||
|
|
4dbbb4d676 | ||
|
|
6c8e2b48e3 | ||
|
|
55892061f5 | ||
|
|
ae8ea820ef | ||
|
|
d06a0e4f40 | ||
|
|
9bfb565354 | ||
|
|
132a8f9f0c | ||
|
|
75b9fd5cb4 | ||
|
|
774e614f7b | ||
|
|
9e43956e1b | ||
|
|
9d16b50075 | ||
|
|
04b8949178 | ||
|
|
b69163b57d | ||
|
|
006624f568 | ||
|
|
4acf548436 | ||
|
|
d9193fcc4f | ||
|
|
a779a4a7ea | ||
|
|
2a3d8ae156 | ||
|
|
07d4aff13b | ||
|
|
838f9331be | ||
|
|
3c3f93db3e | ||
|
|
d98231a713 | ||
|
|
a50c83c284 | ||
|
|
05f30b58c1 | ||
|
|
a932767545 | ||
|
|
c29d3bb930 | ||
|
|
b4a73cabf3 | ||
|
|
16bbedaf2b | ||
|
|
b2eb5aeb8c | ||
|
|
3dcfa5cfd8 | ||
|
|
307ffe734a | ||
|
|
ead734cbf0 | ||
|
|
46ab11961e | ||
|
|
58adbe94b9 |
8
.gitattributes
vendored
8
.gitattributes
vendored
@ -1,10 +1,6 @@
|
|||||||
/libtorrent export-ignore
|
|
||||||
/win32 export-ignore
|
|
||||||
docs/build export-ignore
|
|
||||||
docs/source export-ignore
|
|
||||||
/tests export-ignore
|
|
||||||
deluge/scripts export-ignore
|
|
||||||
.gitattributes export-ignore
|
.gitattributes export-ignore
|
||||||
.gitmodules export-ignore
|
.gitmodules export-ignore
|
||||||
.gitignore export-ignore
|
.gitignore export-ignore
|
||||||
*.py diff=python
|
*.py diff=python
|
||||||
|
ext-all.js diff=minjs
|
||||||
|
*.state -merge -text
|
||||||
|
|||||||
100
.github/workflows/cd.yml
vendored
Normal file
100
.github/workflows/cd.yml
vendored
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
name: Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "deluge-*"
|
||||||
|
- "!deluge*-dev*"
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
types: [labeled, opened, synchronize, reopened]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
description: "Enter a tag or commit to package"
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
windows_package:
|
||||||
|
runs-on: windows-2019
|
||||||
|
if: (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'package'))
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch: [x64, x86]
|
||||||
|
python: ["3.9"]
|
||||||
|
libtorrent: [2.0.6, 1.2.15]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# Checkout Deluge source to subdir to enable packaging any tag/commit
|
||||||
|
- name: Checkout Deluge source
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.inputs.ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
path: deluge_src
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python}}
|
||||||
|
architecture: ${{ matrix.arch }}
|
||||||
|
cache: pip
|
||||||
|
|
||||||
|
- name: Prepare pip
|
||||||
|
run: python -m pip install wheel
|
||||||
|
|
||||||
|
- name: Install GTK
|
||||||
|
run: |
|
||||||
|
$WebClient = New-Object System.Net.WebClient
|
||||||
|
$WebClient.DownloadFile("https://github.com/deluge-torrent/gvsbuild-release/releases/download/latest/gvsbuild-py${{ matrix.python }}-vs16-${{ matrix.arch }}.zip","C:\GTK.zip")
|
||||||
|
7z x C:\GTK.zip -oc:\GTK
|
||||||
|
echo "C:\GTK\release\lib" | Out-File -FilePath $env:GITHUB_PATH -Append
|
||||||
|
echo "C:\GTK\release\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
|
||||||
|
echo "C:\GTK\release" | Out-File -FilePath $env:GITHUB_PATH -Append
|
||||||
|
python -m pip install --no-index --find-links="C:\GTK\release\python" pycairo PyGObject
|
||||||
|
|
||||||
|
- name: Install Python dependencies
|
||||||
|
run: >
|
||||||
|
python -m pip install
|
||||||
|
twisted[tls]==22.4.0
|
||||||
|
libtorrent==${{ matrix.libtorrent }}
|
||||||
|
pyinstaller==4.10
|
||||||
|
pygame
|
||||||
|
-r requirements.txt
|
||||||
|
|
||||||
|
- name: Install Deluge
|
||||||
|
working-directory: deluge_src
|
||||||
|
run: |
|
||||||
|
python -m pip install .
|
||||||
|
python setup.py install_scripts
|
||||||
|
|
||||||
|
- name: Freeze Deluge
|
||||||
|
working-directory: packaging/win
|
||||||
|
run: |
|
||||||
|
pyinstaller --clean delugewin.spec --distpath freeze
|
||||||
|
|
||||||
|
- name: Fix OpenSSL for libtorrent x64
|
||||||
|
if: ${{ matrix.arch == 'x64' }}
|
||||||
|
working-directory: packaging/win/freeze/Deluge
|
||||||
|
run: |
|
||||||
|
cp libssl-1_1.dll libssl-1_1-x64.dll
|
||||||
|
cp libcrypto-1_1.dll libcrypto-1_1-x64.dll
|
||||||
|
|
||||||
|
- name: Make Deluge Installer
|
||||||
|
working-directory: ./packaging/win
|
||||||
|
run: |
|
||||||
|
python setup_nsis.py
|
||||||
|
makensis /Darch=${{ matrix.arch }} deluge-win-installer.nsi
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: deluge-py${{ matrix.python }}-lt${{ matrix.libtorrent }}-${{ matrix.arch }}
|
||||||
|
path: packaging/win/*.exe
|
||||||
95
.github/workflows/ci.yml
vendored
Normal file
95
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-linux:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ["3.7", "3.10"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: "pip"
|
||||||
|
cache-dependency-path: "requirements*.txt"
|
||||||
|
|
||||||
|
- name: Sets env var for security
|
||||||
|
if: (github.event_name == 'pull_request' && contains(github.event.pull_request.body, 'security_test')) || (github.event_name == 'push' && contains(github.event.head_commit.message, 'security_test'))
|
||||||
|
run: echo "SECURITY_TESTS=True" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install --upgrade pip wheel
|
||||||
|
pip install -r requirements.txt -r requirements-tests.txt
|
||||||
|
pip install -e .
|
||||||
|
|
||||||
|
- name: Install security dependencies
|
||||||
|
if: contains(env.SECURITY_TESTS, 'True')
|
||||||
|
run: |
|
||||||
|
wget -O- $TESTSSL_URL$TESTSSL_VER | tar xz
|
||||||
|
mv -t deluge/tests/data testssl.sh-$TESTSSL_VER/testssl.sh testssl.sh-$TESTSSL_VER/etc/;
|
||||||
|
env:
|
||||||
|
TESTSSL_VER: 3.0.6
|
||||||
|
TESTSSL_URL: https://codeload.github.com/drwetter/testssl.sh/tar.gz/refs/tags/v
|
||||||
|
|
||||||
|
- name: Setup core dump directory
|
||||||
|
run: |
|
||||||
|
sudo mkdir /cores/ && sudo chmod 777 /cores/
|
||||||
|
echo "/cores/%E.%p" | sudo tee /proc/sys/kernel/core_pattern
|
||||||
|
|
||||||
|
- name: Test with pytest
|
||||||
|
run: |
|
||||||
|
ulimit -c unlimited # Enable core dumps to be captured
|
||||||
|
python -c 'from deluge._libtorrent import lt; print(lt.__version__)';
|
||||||
|
catchsegv python -X dev -m pytest -v -m "not (todo or gtkui)" deluge
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
# capture all crashes as build artifacts
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: crashes
|
||||||
|
path: /cores
|
||||||
|
|
||||||
|
test-windows:
|
||||||
|
runs-on: windows-2019
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ["3.7", "3.10"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: "pip"
|
||||||
|
cache-dependency-path: "requirements*.txt"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install --upgrade pip wheel
|
||||||
|
pip install -r requirements.txt -r requirements-tests.txt
|
||||||
|
pip install -e .
|
||||||
|
|
||||||
|
- name: Test with pytest
|
||||||
|
run: |
|
||||||
|
python -c 'import libtorrent as lt; print(lt.__version__)';
|
||||||
|
pytest -v -m "not (todo or gtkui or security)" deluge
|
||||||
45
.github/workflows/docs.yml
vendored
Normal file
45
.github/workflows/docs.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
name: Docs
|
||||||
|
|
||||||
|
# Controls when the action will run.
|
||||||
|
on:
|
||||||
|
# Triggers the workflow on push or pull request events but only for the main branch
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: "3.8"
|
||||||
|
- name: Cache pip
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
# This path is specific to Ubuntu
|
||||||
|
path: ~/.cache/pip
|
||||||
|
# Look to see if there is a cache hit for the corresponding requirements file
|
||||||
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pip-
|
||||||
|
${{ runner.os }}-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install --upgrade pip wheel
|
||||||
|
pip install tox
|
||||||
|
sudo apt-get install enchant
|
||||||
|
|
||||||
|
- name: Test with tox
|
||||||
|
env:
|
||||||
|
TOX_ENV: docs
|
||||||
|
run: |
|
||||||
|
tox -e $TOX_ENV
|
||||||
17
.github/workflows/lint.yml
vendored
Normal file
17
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: Linting
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
- name: Run pre-commit linting
|
||||||
|
uses: pre-commit/action@v2.0.2
|
||||||
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,11 +1,25 @@
|
|||||||
*~
|
*~
|
||||||
build
|
build
|
||||||
|
.cache
|
||||||
dist
|
dist
|
||||||
*egg-info
|
docs/source/modules/deluge*.rst
|
||||||
|
*.egg-info/
|
||||||
|
*.dist-info/
|
||||||
*.egg
|
*.egg
|
||||||
*.log
|
*.log
|
||||||
*.pyc
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
*.tar.*
|
*.tar.*
|
||||||
_trial_temp
|
.tox/
|
||||||
deluge/i18n/*/
|
deluge/i18n/*/
|
||||||
|
deluge.pot
|
||||||
|
deluge/ui/web/js/*.js
|
||||||
|
deluge/ui/web/js/extjs/ext-extensions*.js
|
||||||
*.desktop
|
*.desktop
|
||||||
|
*.appdata.xml
|
||||||
|
.build_data*
|
||||||
|
osx/app
|
||||||
|
RELEASE-VERSION
|
||||||
|
.venv*
|
||||||
|
# used by setuptools to cache downloaded eggs
|
||||||
|
/.eggs
|
||||||
|
|||||||
51
.pre-commit-config.yaml
Normal file
51
.pre-commit-config.yaml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
default_language_version:
|
||||||
|
python: python3
|
||||||
|
exclude: >
|
||||||
|
(?x)^(
|
||||||
|
deluge/ui/web/docs/template/.*|
|
||||||
|
deluge/tests/data/.*svg|
|
||||||
|
)$
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 22.3.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
name: Fmt Black
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v2.5.1
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
|
name: Fmt Prettier
|
||||||
|
# Workaround to list modified files only.
|
||||||
|
args: [--list-different]
|
||||||
|
- repo: https://github.com/pycqa/isort
|
||||||
|
rev: 5.10.1
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
name: Fmt isort
|
||||||
|
- repo: https://github.com/pycqa/flake8
|
||||||
|
rev: 4.0.1
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
name: Chk Flake8
|
||||||
|
additional_dependencies:
|
||||||
|
- pep8-naming==0.12.1
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.1.0
|
||||||
|
hooks:
|
||||||
|
- id: double-quote-string-fixer
|
||||||
|
name: Fix Double-quotes
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
name: Fix End-of-files
|
||||||
|
exclude_types: [javascript, css]
|
||||||
|
- id: mixed-line-ending
|
||||||
|
name: Fix Line endings
|
||||||
|
args: [--fix=auto]
|
||||||
|
- id: trailing-whitespace
|
||||||
|
name: Fix Trailing whitespace
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v2.31.0
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: [--py36-plus]
|
||||||
|
stages: [manual]
|
||||||
6
.prettierignore
Normal file
6
.prettierignore
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
deluge/ui/web/css/ext-*.css
|
||||||
|
deluge/ui/web/js/extjs/ext-*.js
|
||||||
|
deluge/ui/web/docs/
|
||||||
|
deluge/ui/web/themes/images/
|
||||||
|
*.py*
|
||||||
|
*.html
|
||||||
13
.prettierrc.yaml
Normal file
13
.prettierrc.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
trailingComma: "es5"
|
||||||
|
tabWidth: 4
|
||||||
|
singleQuote: true
|
||||||
|
overrides:
|
||||||
|
- files:
|
||||||
|
- "*.yaml"
|
||||||
|
- ".*.yaml"
|
||||||
|
- "*.yml"
|
||||||
|
- ".*.yml"
|
||||||
|
- "*.md"
|
||||||
|
options:
|
||||||
|
tabWidth: 2
|
||||||
|
singleQuote: false
|
||||||
420
.pylintrc
Normal file
420
.pylintrc
Normal file
@ -0,0 +1,420 @@
|
|||||||
|
[MASTER]
|
||||||
|
|
||||||
|
# Specify a configuration file.
|
||||||
|
#rcfile=
|
||||||
|
|
||||||
|
# Python code to execute, usually for sys.path manipulation such as
|
||||||
|
# pygtk.require().
|
||||||
|
#init-hook=
|
||||||
|
|
||||||
|
# Add files or directories to the blacklist. They should be base names, not
|
||||||
|
# paths.
|
||||||
|
ignore=CVS
|
||||||
|
|
||||||
|
# Add files or directories matching the regex patterns to the blacklist. The
|
||||||
|
# regex matches against base names, not paths.
|
||||||
|
ignore-patterns=
|
||||||
|
|
||||||
|
# Pickle collected data for later comparisons.
|
||||||
|
persistent=yes
|
||||||
|
|
||||||
|
# List of plugins (as comma separated values of python modules names) to load,
|
||||||
|
# usually to register additional checkers.
|
||||||
|
load-plugins=
|
||||||
|
|
||||||
|
# Use multiple processes to speed up Pylint.
|
||||||
|
jobs=2
|
||||||
|
|
||||||
|
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||||
|
# active Python interpreter and may run arbitrary code.
|
||||||
|
unsafe-load-any-extension=no
|
||||||
|
|
||||||
|
# A comma-separated list of package or module names from where C extensions may
|
||||||
|
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||||
|
# run arbitrary code
|
||||||
|
extension-pkg-whitelist=
|
||||||
|
|
||||||
|
# Allow optimization of some AST trees. This will activate a peephole AST
|
||||||
|
# optimizer, which will apply various small optimizations. For instance, it can
|
||||||
|
# be used to obtain the result of joining multiple strings with the addition
|
||||||
|
# operator. Joining a lot of strings can lead to a maximum recursion error in
|
||||||
|
# Pylint and this flag can prevent that. It has one side effect, the resulting
|
||||||
|
# AST will be different than the one from reality. This option is deprecated
|
||||||
|
# and it will be removed in Pylint 2.0.
|
||||||
|
optimize-ast=no
|
||||||
|
|
||||||
|
|
||||||
|
[MESSAGES CONTROL]
|
||||||
|
|
||||||
|
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||||
|
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
|
||||||
|
confidence=
|
||||||
|
|
||||||
|
# Enable the message, report, category or checker with the given id(s). You can
|
||||||
|
# either give multiple identifier separated by comma (,) or put this option
|
||||||
|
# multiple time (only on the command line, not in the configuration file where
|
||||||
|
# it should appear only once). See also the "--disable" option for examples.
|
||||||
|
#enable=
|
||||||
|
|
||||||
|
# Disable the message, report, category or checker with the given id(s). You
|
||||||
|
# can either give multiple identifiers separated by comma (,) or put this
|
||||||
|
# option multiple times (only on the command line, not in the configuration
|
||||||
|
# file where it should appear only once).You can also use "--disable=all" to
|
||||||
|
# disable everything first and then reenable specific checks. For example, if
|
||||||
|
# you want to run only the similarities checker, you can use "--disable=all
|
||||||
|
# --enable=similarities". If you want to run only the classes checker, but have
|
||||||
|
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||||
|
# --disable=W"
|
||||||
|
#
|
||||||
|
# Arranged by category and use symbolic names instead of ids.
|
||||||
|
disable=
|
||||||
|
# Convention
|
||||||
|
missing-docstring, invalid-name, bad-continuation,
|
||||||
|
# Error
|
||||||
|
no-member, no-name-in-module,
|
||||||
|
# Information
|
||||||
|
locally-disabled,
|
||||||
|
# Refactor
|
||||||
|
no-self-use, too-many-arguments, too-many-branches, too-many-instance-attributes,
|
||||||
|
too-many-locals, too-few-public-methods, too-many-public-methods, too-many-statements,
|
||||||
|
# Refactor msgs that should eventually be enabled:
|
||||||
|
redefined-variable-type, too-many-ancestors,
|
||||||
|
too-many-nested-blocks, too-many-return-statements,
|
||||||
|
# Warning
|
||||||
|
unused-argument, protected-access, import-error, unused-variable,
|
||||||
|
attribute-defined-outside-init,
|
||||||
|
# Warning msgs that should eventually be enabled:
|
||||||
|
arguments-differ, global-statement, fixme, broad-except
|
||||||
|
|
||||||
|
[REPORTS]
|
||||||
|
|
||||||
|
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||||
|
# (visual studio) and html. You can also give a reporter class, eg
|
||||||
|
# mypackage.mymodule.MyReporterClass.
|
||||||
|
output-format=parseable
|
||||||
|
|
||||||
|
# Put messages in a separate file for each module / package specified on the
|
||||||
|
# command line instead of printing them on stdout. Reports (if any) will be
|
||||||
|
# written in a file name "pylint_global.[txt|html]". This option is deprecated
|
||||||
|
# and it will be removed in Pylint 2.0.
|
||||||
|
files-output=no
|
||||||
|
|
||||||
|
# Tells whether to display a full report or only the messages
|
||||||
|
reports=no
|
||||||
|
|
||||||
|
# Python expression which should return a note less than 10 (10 is the highest
|
||||||
|
# note). You have access to the variables errors warning, statement which
|
||||||
|
# respectively contain the number of errors / warnings messages and the total
|
||||||
|
# number of statements analyzed. This is used by the global evaluation report
|
||||||
|
# (RP0004).
|
||||||
|
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||||
|
|
||||||
|
# Template used to display messages. This is a python new-style format string
|
||||||
|
# used to format the message information. See doc for all details
|
||||||
|
#msg-template=
|
||||||
|
|
||||||
|
|
||||||
|
[SPELLING]
|
||||||
|
|
||||||
|
# Spelling dictionary name. Available dictionaries: none. To make it working
|
||||||
|
# install python-enchant package.
|
||||||
|
spelling-dict=
|
||||||
|
|
||||||
|
# List of comma separated words that should not be checked.
|
||||||
|
spelling-ignore-words=
|
||||||
|
|
||||||
|
# A path to a file that contains private dictionary; one word per line.
|
||||||
|
spelling-private-dict-file=
|
||||||
|
|
||||||
|
# Tells whether to store unknown words to indicated private dictionary in
|
||||||
|
# --spelling-private-dict-file option instead of raising a message.
|
||||||
|
spelling-store-unknown-words=no
|
||||||
|
|
||||||
|
|
||||||
|
[BASIC]
|
||||||
|
|
||||||
|
# Good variable names which should always be accepted, separated by a comma
|
||||||
|
good-names=d,i,j,k,ex,Run,_,log
|
||||||
|
|
||||||
|
# Bad variable names which should always be refused, separated by a comma
|
||||||
|
bad-names=foo,bar,baz,toto,tutu,tata
|
||||||
|
|
||||||
|
# Colon-delimited sets of names that determine each other's naming style when
|
||||||
|
# the name regexes allow several styles.
|
||||||
|
name-group=
|
||||||
|
|
||||||
|
# Include a hint for the correct naming format with invalid-name
|
||||||
|
include-naming-hint=no
|
||||||
|
|
||||||
|
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||||
|
# to this list to register other decorators that produce valid properties.
|
||||||
|
property-classes=abc.abstractproperty
|
||||||
|
|
||||||
|
# Regular expression matching correct function names
|
||||||
|
function-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Naming hint for function names
|
||||||
|
function-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression matching correct variable names
|
||||||
|
variable-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Naming hint for variable names
|
||||||
|
variable-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression matching correct constant names
|
||||||
|
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||||
|
|
||||||
|
# Naming hint for constant names
|
||||||
|
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||||
|
|
||||||
|
# Regular expression matching correct attribute names
|
||||||
|
attr-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Naming hint for attribute names
|
||||||
|
attr-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression matching correct argument names
|
||||||
|
argument-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Naming hint for argument names
|
||||||
|
argument-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression matching correct class attribute names
|
||||||
|
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||||
|
|
||||||
|
# Naming hint for class attribute names
|
||||||
|
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||||
|
|
||||||
|
# Regular expression matching correct inline iteration names
|
||||||
|
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||||
|
|
||||||
|
# Naming hint for inline iteration names
|
||||||
|
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
|
||||||
|
|
||||||
|
# Regular expression matching correct class names
|
||||||
|
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||||
|
|
||||||
|
# Naming hint for class names
|
||||||
|
class-name-hint=[A-Z_][a-zA-Z0-9]+$
|
||||||
|
|
||||||
|
# Regular expression matching correct module names
|
||||||
|
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||||
|
|
||||||
|
# Naming hint for module names
|
||||||
|
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||||
|
|
||||||
|
# Regular expression matching correct method names
|
||||||
|
method-rgx=[a-z_][a-z0-9_]{2,40}$
|
||||||
|
|
||||||
|
# Naming hint for method names
|
||||||
|
method-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||||
|
|
||||||
|
# Regular expression which should only match function or class names that do
|
||||||
|
# not require a docstring.
|
||||||
|
no-docstring-rgx=__.*__
|
||||||
|
|
||||||
|
# Minimum line length for functions/classes that require docstrings, shorter
|
||||||
|
# ones are exempt.
|
||||||
|
docstring-min-length=-1
|
||||||
|
|
||||||
|
|
||||||
|
[ELIF]
|
||||||
|
|
||||||
|
# Maximum number of nested blocks for function / method body
|
||||||
|
max-nested-blocks=5
|
||||||
|
|
||||||
|
|
||||||
|
[LOGGING]
|
||||||
|
|
||||||
|
# Logging modules to check that the string format arguments are in logging
|
||||||
|
# function parameter format
|
||||||
|
logging-modules=logging
|
||||||
|
|
||||||
|
|
||||||
|
[FORMAT]
|
||||||
|
|
||||||
|
# Maximum number of characters on a single line.
|
||||||
|
max-line-length=120
|
||||||
|
|
||||||
|
# Regexp for a line that is allowed to be longer than the limit.
|
||||||
|
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||||
|
|
||||||
|
# Allow the body of an if to be on the same line as the test if there is no
|
||||||
|
# else.
|
||||||
|
single-line-if-stmt=no
|
||||||
|
|
||||||
|
# List of optional constructs for which whitespace checking is disabled. `dict-
|
||||||
|
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
|
||||||
|
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
|
||||||
|
# `empty-line` allows space-only lines.
|
||||||
|
no-space-check=trailing-comma,dict-separator
|
||||||
|
|
||||||
|
# Maximum number of lines in a module
|
||||||
|
max-module-lines=1550
|
||||||
|
|
||||||
|
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||||
|
# tab).
|
||||||
|
indent-string=' '
|
||||||
|
|
||||||
|
# Number of spaces of indent required inside a hanging or continued line.
|
||||||
|
indent-after-paren=4
|
||||||
|
|
||||||
|
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||||
|
expected-line-ending-format=LF
|
||||||
|
|
||||||
|
|
||||||
|
[MISCELLANEOUS]
|
||||||
|
|
||||||
|
# List of note tags to take in consideration, separated by a comma.
|
||||||
|
notes=FIXME,XXX,TODO
|
||||||
|
|
||||||
|
|
||||||
|
[VARIABLES]
|
||||||
|
|
||||||
|
# Tells whether we should check for unused import in __init__ files.
|
||||||
|
init-import=no
|
||||||
|
|
||||||
|
# A regular expression matching the name of dummy variables (i.e. expectedly
|
||||||
|
# not used).
|
||||||
|
dummy-variables-rgx=_$|dummy
|
||||||
|
|
||||||
|
# List of additional names supposed to be defined in builtins. Remember that
|
||||||
|
# you should avoid to define new builtins when possible.
|
||||||
|
additional-builtins=_,_n,__request__,WindowsError
|
||||||
|
|
||||||
|
# List of strings which can identify a callback function by name. A callback
|
||||||
|
# name must start or end with one of those strings.
|
||||||
|
callbacks=cb_,_cb
|
||||||
|
|
||||||
|
# List of qualified module names which can have objects that can redefine
|
||||||
|
# builtins.
|
||||||
|
redefining-builtins-modules=
|
||||||
|
|
||||||
|
|
||||||
|
[TYPECHECK]
|
||||||
|
|
||||||
|
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||||
|
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||||
|
ignore-mixin-members=yes
|
||||||
|
|
||||||
|
# List of module names for which member attributes should not be checked
|
||||||
|
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||||
|
# and thus existing member attributes cannot be deduced by static analysis. It
|
||||||
|
# supports qualified module names, as well as Unix pattern matching.
|
||||||
|
ignored-modules=
|
||||||
|
|
||||||
|
# List of class names for which member attributes should not be checked (useful
|
||||||
|
# for classes with dynamically set attributes). This supports the use of
|
||||||
|
# qualified names.
|
||||||
|
ignored-classes=SQLObject,twisted.internet.reactor
|
||||||
|
|
||||||
|
# List of members which are set dynamically and missed by pylint inference
|
||||||
|
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||||
|
# expressions are accepted.
|
||||||
|
generated-members=REQUEST,acl_users,aq_parent
|
||||||
|
|
||||||
|
# List of decorators that produce context managers, such as
|
||||||
|
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||||
|
# produce valid context managers.
|
||||||
|
contextmanager-decorators=contextlib.contextmanager
|
||||||
|
|
||||||
|
|
||||||
|
[SIMILARITIES]
|
||||||
|
|
||||||
|
# Minimum lines number of a similarity.
|
||||||
|
min-similarity-lines=4
|
||||||
|
|
||||||
|
# Ignore comments when computing similarities.
|
||||||
|
ignore-comments=yes
|
||||||
|
|
||||||
|
# Ignore docstrings when computing similarities.
|
||||||
|
ignore-docstrings=yes
|
||||||
|
|
||||||
|
# Ignore imports when computing similarities.
|
||||||
|
ignore-imports=no
|
||||||
|
|
||||||
|
|
||||||
|
[IMPORTS]
|
||||||
|
|
||||||
|
# Deprecated modules which should not be used, separated by a comma
|
||||||
|
deprecated-modules=regsub,TERMIOS,Bastion,rexec
|
||||||
|
|
||||||
|
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||||
|
# given file (report RP0402 must not be disabled)
|
||||||
|
import-graph=
|
||||||
|
|
||||||
|
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||||
|
# not be disabled)
|
||||||
|
ext-import-graph=
|
||||||
|
|
||||||
|
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||||
|
# not be disabled)
|
||||||
|
int-import-graph=
|
||||||
|
|
||||||
|
# Force import order to recognize a module as part of the standard
|
||||||
|
# compatibility libraries.
|
||||||
|
known-standard-library=
|
||||||
|
|
||||||
|
# Force import order to recognize a module as part of a third party library.
|
||||||
|
known-third-party=enchant
|
||||||
|
|
||||||
|
|
||||||
|
[DESIGN]
|
||||||
|
|
||||||
|
# Maximum number of arguments for function / method
|
||||||
|
max-args=7
|
||||||
|
|
||||||
|
# Argument names that match this expression will be ignored. Default to name
|
||||||
|
# with leading underscore
|
||||||
|
ignored-argument-names=_.*
|
||||||
|
|
||||||
|
# Maximum number of locals for function / method body
|
||||||
|
max-locals=15
|
||||||
|
|
||||||
|
# Maximum number of return / yield for function / method body
|
||||||
|
max-returns=6
|
||||||
|
|
||||||
|
# Maximum number of branch for function / method body
|
||||||
|
max-branches=12
|
||||||
|
|
||||||
|
# Maximum number of statements in function / method body
|
||||||
|
max-statements=50
|
||||||
|
|
||||||
|
# Maximum number of parents for a class (see R0901).
|
||||||
|
max-parents=7
|
||||||
|
|
||||||
|
# Maximum number of attributes for a class (see R0902).
|
||||||
|
max-attributes=7
|
||||||
|
|
||||||
|
# Minimum number of public methods for a class (see R0903).
|
||||||
|
min-public-methods=2
|
||||||
|
|
||||||
|
# Maximum number of public methods for a class (see R0904).
|
||||||
|
max-public-methods=20
|
||||||
|
|
||||||
|
# Maximum number of boolean expressions in a if statement
|
||||||
|
max-bool-expr=5
|
||||||
|
|
||||||
|
|
||||||
|
[CLASSES]
|
||||||
|
|
||||||
|
# List of method names used to declare (i.e. assign) instance attributes.
|
||||||
|
defining-attr-methods=__init__,__new__,setUp
|
||||||
|
|
||||||
|
# List of valid names for the first argument in a class method.
|
||||||
|
valid-classmethod-first-arg=cls
|
||||||
|
|
||||||
|
# List of valid names for the first argument in a metaclass class method.
|
||||||
|
valid-metaclass-classmethod-first-arg=mcs
|
||||||
|
|
||||||
|
# List of member names, which should be excluded from the protected access
|
||||||
|
# warning.
|
||||||
|
exclude-protected=_asdict,_fields,_replace,_source,_make
|
||||||
|
|
||||||
|
|
||||||
|
[EXCEPTIONS]
|
||||||
|
|
||||||
|
# Exceptions that will emit a warning when being caught. Defaults to
|
||||||
|
# "Exception"
|
||||||
|
overgeneral-exceptions=Exception
|
||||||
22
.readthedocs.yml
Normal file
22
.readthedocs.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# .readthedocs.yml
|
||||||
|
# Read the Docs configuration file
|
||||||
|
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||||
|
|
||||||
|
# Required
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
# Build documentation in the docs/ directory with Sphinx
|
||||||
|
sphinx:
|
||||||
|
configuration: docs/source/conf.py
|
||||||
|
|
||||||
|
# Optionally build your docs in additional formats such as PDF and ePub
|
||||||
|
formats: all
|
||||||
|
|
||||||
|
# Optionally set the version of Python and requirements required to build your docs
|
||||||
|
python:
|
||||||
|
version: 3.7
|
||||||
|
install:
|
||||||
|
- requirements: requirements.txt
|
||||||
|
- requirements: docs/requirements.txt
|
||||||
|
- method: setuptools
|
||||||
|
path: .
|
||||||
790
AUTHORS
Normal file
790
AUTHORS
Normal file
@ -0,0 +1,790 @@
|
|||||||
|
Authors:
|
||||||
|
* Andrew Resch ('andar') <andrewresch@gmail.com>
|
||||||
|
* Damien Churchill ('damoxc') <damoxc@gmail.com>
|
||||||
|
|
||||||
|
Main Developers:
|
||||||
|
* Andrew Resch
|
||||||
|
* Damien Churchill
|
||||||
|
* John Garland ('johnnyg') <johnnybg+deluge@gmail.com>
|
||||||
|
* Calum Lind ('cas') <calumlind+deluge@gmail.com>
|
||||||
|
|
||||||
|
libtorrent (http://www.libtorrent.org):
|
||||||
|
* Arvid Norberg
|
||||||
|
|
||||||
|
Contributors (and Past Developers):
|
||||||
|
* Zach Tibbitts <zach@collegegeek.org>
|
||||||
|
* Alon Zakai ('Kripken') <kripkensteiner@gmail.com>
|
||||||
|
* Marcos Mobley ('markybob') <markybob@gmail.com>
|
||||||
|
* Alex Dedul
|
||||||
|
* Sadrul Habib Chowdhury
|
||||||
|
* Ido Abramovich <ido.deluge@gmail.com>
|
||||||
|
* Martijn Voncken <mvoncken@gmail.com>
|
||||||
|
* Mark Stahler ('kramed') <markstahler@gmail.com>
|
||||||
|
* Pedro Algarvio ('s0undt3ch') <ufs@ufsoft.org>
|
||||||
|
* Cristian Greco ('cgreco') <cristian@regolo.cc>
|
||||||
|
* Chase Sterling ('gazpachoKing') <chase.sterling@gmail.com>
|
||||||
|
|
||||||
|
Plugin Developers:
|
||||||
|
* Autoadd : Chase Sterling
|
||||||
|
* Blocklist : John Garland
|
||||||
|
* Execute : Damien Churchill
|
||||||
|
* Extractor : Andrew Resch
|
||||||
|
* Label : Martijn Voncken
|
||||||
|
* Notifications : Pedro Algarvio
|
||||||
|
* Scheduler : Andrew Resch
|
||||||
|
* Webui : Damien Churchill
|
||||||
|
|
||||||
|
Images Authors:
|
||||||
|
|
||||||
|
* files: deluge/ui/data/pixmaps/*.svg, *.png
|
||||||
|
deluge/ui/web/icons/active.png, alert.png, all.png, checking.png, dht.png,
|
||||||
|
downloading.png, inactive.png, queued.png, seeding.png, traffic.png
|
||||||
|
deluge/ui/web/images/deluge*.png
|
||||||
|
deluge/ui/web/icons/apple-pre-*.png, deluge*.png
|
||||||
|
copyright: Calum Lind
|
||||||
|
license: GPLv3
|
||||||
|
|
||||||
|
* files: deluge/plugins/blocklist/blocklist/data/*.png
|
||||||
|
deluge/ui/data/pixmaps/tracker_warning16.png, tracker_all16.png, lock48.png
|
||||||
|
copyright: Gnome Icon Theme
|
||||||
|
license: GPLv2
|
||||||
|
url: http://ftp.acc.umu.se/pub/GNOME/sources/gnome-icon-theme
|
||||||
|
|
||||||
|
* files: deluge/ui/data/pixmaps/magnet*.svg, *.png
|
||||||
|
copyright: Matias Wilkman
|
||||||
|
license:
|
||||||
|
|
||||||
|
* files: deluge/ui/data/pixmaps/flags/*.png
|
||||||
|
copyright: Mark James <mjames@gmail.com>
|
||||||
|
license: Public Domain
|
||||||
|
url: http://famfamfam.com/lab/icons/flags/
|
||||||
|
|
||||||
|
* files: deluge/ui/web/icons/*.png
|
||||||
|
exceptions: apple-pre-*.png, active.png, alert.png, all.png, deluge.png, dht.png,
|
||||||
|
downloading.png, inactive.png, queued.png, seeding.png, traffic.png
|
||||||
|
copyright: Yusuke Kamiyamane <p@yusukekamiyamane.com>
|
||||||
|
license: Creative Commons Attribution 3.0 License
|
||||||
|
url: http://p.yusukekamiyamane.com/
|
||||||
|
|
||||||
|
* files: deluge/ui/web/images/spinner.gif, spinner-split.gif
|
||||||
|
copyright: Steven Chim
|
||||||
|
license: BSD license
|
||||||
|
url: http://members.upc.nl/j.chim/ext/spinner2/ext-spinner.html
|
||||||
|
|
||||||
|
Translation Contributors:
|
||||||
|
* files: deluge/i18n/*.po
|
||||||
|
|
||||||
|
Aaron Wang Shi
|
||||||
|
abbigss
|
||||||
|
ABCdatos
|
||||||
|
Abcx
|
||||||
|
Actam
|
||||||
|
Adam
|
||||||
|
adaminikisi
|
||||||
|
adi_oporanu
|
||||||
|
Adrian Goll
|
||||||
|
afby
|
||||||
|
Ahmades
|
||||||
|
Ahmad Farghal
|
||||||
|
Ahmad Gharbeia أحمد غربية
|
||||||
|
akira
|
||||||
|
Aki Sivula
|
||||||
|
Alan Pepelko
|
||||||
|
Alberto
|
||||||
|
Alberto Ferrer
|
||||||
|
alcatr4z
|
||||||
|
AlckO
|
||||||
|
Aleksej Korgenkov
|
||||||
|
Alessio Treglia
|
||||||
|
Alexander Ilyashov
|
||||||
|
Alexander Matveev
|
||||||
|
Alexander Saltykov
|
||||||
|
Alexander Taubenkorb
|
||||||
|
Alexander Telenga
|
||||||
|
Alexander Yurtsev
|
||||||
|
Alexandre Martani
|
||||||
|
Alexandre Rosenfeld
|
||||||
|
Alexandre Sapata Carbonell
|
||||||
|
Alexey Osipov
|
||||||
|
Alin Claudiu Radut
|
||||||
|
allah
|
||||||
|
AlSim
|
||||||
|
Alvaro Carrillanca P.
|
||||||
|
A.Matveev
|
||||||
|
Andras Hipsag
|
||||||
|
András Kárász
|
||||||
|
Andrea Ratto
|
||||||
|
Andreas Johansson
|
||||||
|
Andreas Str
|
||||||
|
André F. Oliveira
|
||||||
|
AndreiF
|
||||||
|
andrewh
|
||||||
|
Angel Guzman Maeso
|
||||||
|
Aníbal Deboni Neto
|
||||||
|
animarval
|
||||||
|
Antonio Cono
|
||||||
|
antoniojreyes
|
||||||
|
Anton Shestakov
|
||||||
|
Anton Yakutovich
|
||||||
|
antou
|
||||||
|
Arkadiusz Kalinowski
|
||||||
|
Artin
|
||||||
|
artir
|
||||||
|
Astur
|
||||||
|
Athanasios Lefteris
|
||||||
|
Athmane MOKRAOUI (ButterflyOfFire)
|
||||||
|
Augusta Carla Klug
|
||||||
|
Avoledo Marco
|
||||||
|
axaard
|
||||||
|
AxelRafn
|
||||||
|
Axezium
|
||||||
|
Ayont
|
||||||
|
b3rx
|
||||||
|
Bae Taegil
|
||||||
|
Bajusz Tamás
|
||||||
|
Balaam's Miracle
|
||||||
|
Ballestein
|
||||||
|
Bent Ole Fosse
|
||||||
|
berto89
|
||||||
|
bigx
|
||||||
|
Bjorn Inge Berg
|
||||||
|
blackbird
|
||||||
|
Blackeyed
|
||||||
|
blackmx
|
||||||
|
BlueSky
|
||||||
|
Blutheo
|
||||||
|
bmhm
|
||||||
|
bob00work
|
||||||
|
boenki
|
||||||
|
Bogdan Bădic-Spătariu
|
||||||
|
bonpu
|
||||||
|
Boone
|
||||||
|
boss01
|
||||||
|
Branislav Jovanović
|
||||||
|
bronze
|
||||||
|
brownie
|
||||||
|
Brus46
|
||||||
|
bumper
|
||||||
|
butely
|
||||||
|
BXCracer
|
||||||
|
c0nfidencal
|
||||||
|
Can Kaya
|
||||||
|
Carlos Alexandro Becker
|
||||||
|
cassianoleal
|
||||||
|
Cédric.h
|
||||||
|
César Rubén
|
||||||
|
chaoswizard
|
||||||
|
Chen Tao
|
||||||
|
chicha
|
||||||
|
Chien Cheng Wei
|
||||||
|
Christian Kopac
|
||||||
|
Christian Widell
|
||||||
|
Christoffer Brodd-Reijer
|
||||||
|
christooss
|
||||||
|
CityAceE
|
||||||
|
Clopy
|
||||||
|
Clusty
|
||||||
|
cnu
|
||||||
|
Commandant
|
||||||
|
Constantinos Koniaris
|
||||||
|
Coolmax
|
||||||
|
cosmix
|
||||||
|
Costin Chirvasuta
|
||||||
|
CoVaLiDiTy
|
||||||
|
cow_2001
|
||||||
|
Crispin Kirchner
|
||||||
|
crom
|
||||||
|
Cruster
|
||||||
|
Cybolic
|
||||||
|
Dan Bishop
|
||||||
|
Danek
|
||||||
|
Dani
|
||||||
|
Daniel Demarco
|
||||||
|
Daniel Ferreira
|
||||||
|
Daniel Frank
|
||||||
|
Daniel Holm
|
||||||
|
Daniel Høyer Iversen
|
||||||
|
Daniel Marynicz
|
||||||
|
Daniel Nylander
|
||||||
|
Daniel Patriche
|
||||||
|
Daniel Schildt
|
||||||
|
Daniil Sorokin
|
||||||
|
Dante Díaz
|
||||||
|
Daria Michalska
|
||||||
|
DarkenCZ
|
||||||
|
Darren
|
||||||
|
Daspah
|
||||||
|
David Eurenius
|
||||||
|
davidhjelm
|
||||||
|
David Machakhelidze
|
||||||
|
Dawid Dziurdzia
|
||||||
|
Daya Adianto
|
||||||
|
dcruz
|
||||||
|
Deady
|
||||||
|
Dereck Wonnacott
|
||||||
|
Devgru
|
||||||
|
Devid Antonio FiloniDevilDogTG
|
||||||
|
di0rz`
|
||||||
|
Dialecti Valsamou
|
||||||
|
Diego Medeiros
|
||||||
|
Dkzoffy
|
||||||
|
Dmitrij D. Czarkoff
|
||||||
|
Dmitriy Geels
|
||||||
|
Dmitry Olyenyov
|
||||||
|
Dominik Kozaczko
|
||||||
|
Dominik Lübben
|
||||||
|
doomster
|
||||||
|
Dorota Król
|
||||||
|
Doyen Philippe
|
||||||
|
Dread Knight
|
||||||
|
DreamSonic
|
||||||
|
duan
|
||||||
|
Duong Thanh An
|
||||||
|
DvoglavaZver
|
||||||
|
dwori
|
||||||
|
dylansmrjones
|
||||||
|
Ebuntor
|
||||||
|
Edgar Alejandro Jarquin Flores
|
||||||
|
Eetu
|
||||||
|
ekerazha
|
||||||
|
Elias Julkunen
|
||||||
|
elparia
|
||||||
|
Emberke
|
||||||
|
Emiliano Goday Caneda
|
||||||
|
EndelWar
|
||||||
|
eng.essam
|
||||||
|
enubuntu
|
||||||
|
ercangun
|
||||||
|
Erdal Ronahi
|
||||||
|
ergin üresin
|
||||||
|
Eric
|
||||||
|
Éric Lassauge
|
||||||
|
Erlend Finvåg
|
||||||
|
Errdil
|
||||||
|
ethan shalev
|
||||||
|
Evgeni Spasov
|
||||||
|
ezekielnin
|
||||||
|
Fabian Ordelmans
|
||||||
|
Fabio Mazanatti
|
||||||
|
Fábio Nogueira
|
||||||
|
FaCuZ
|
||||||
|
Felipe Lerena
|
||||||
|
Fernando Pereira
|
||||||
|
fjetland
|
||||||
|
Florian Schäfer
|
||||||
|
FoBoS
|
||||||
|
Folke
|
||||||
|
Force
|
||||||
|
fosk
|
||||||
|
fragarray
|
||||||
|
freddeg
|
||||||
|
Frédéric Perrin
|
||||||
|
Fredrik Kilegran
|
||||||
|
FreeAtMind
|
||||||
|
Fulvio Ciucci
|
||||||
|
Gabor Kelemen
|
||||||
|
Galatsanos Panagiotis
|
||||||
|
Gaussian
|
||||||
|
gdevitis
|
||||||
|
Georg Brzyk
|
||||||
|
George Dumitrescu
|
||||||
|
Georgi Arabadjiev
|
||||||
|
Georg Sieber
|
||||||
|
Gerd Radecke
|
||||||
|
Germán Heusdens
|
||||||
|
Gianni Vialetto
|
||||||
|
Gigih Aji Ibrahim
|
||||||
|
Giorgio Wicklein
|
||||||
|
Giovanni Rapagnani
|
||||||
|
Giuseppe
|
||||||
|
gl
|
||||||
|
glen
|
||||||
|
granjerox
|
||||||
|
Green Fish
|
||||||
|
greentea
|
||||||
|
Greyhound
|
||||||
|
G. U.
|
||||||
|
Guillaume BENOIT
|
||||||
|
Guillaume Pelletier
|
||||||
|
Gustavo Henrique Klug
|
||||||
|
gutocarvalho
|
||||||
|
Guybrush88
|
||||||
|
Hans Rødtang
|
||||||
|
HardDisk
|
||||||
|
Hargas Gábor
|
||||||
|
Heitor Thury Barreiros Barbosa
|
||||||
|
helios91940
|
||||||
|
helix84
|
||||||
|
Helton Rodrigues
|
||||||
|
Hendrik Luup
|
||||||
|
Henrique Ferreiro
|
||||||
|
Henry Goury-Laffont
|
||||||
|
Hezy Amiel
|
||||||
|
hidro
|
||||||
|
hoball
|
||||||
|
hokten
|
||||||
|
Holmsss
|
||||||
|
hristo.num
|
||||||
|
Hubert Życiński
|
||||||
|
Hyo
|
||||||
|
Iarwain
|
||||||
|
ibe
|
||||||
|
ibear
|
||||||
|
Id2ndR
|
||||||
|
Igor Zubarev
|
||||||
|
IKON (Ion)
|
||||||
|
imen
|
||||||
|
Ionuț Jula
|
||||||
|
Isabelle STEVANT
|
||||||
|
István Nyitrai
|
||||||
|
Ivan Petrovic
|
||||||
|
Ivan Prignano
|
||||||
|
IvaSerge
|
||||||
|
jackmc
|
||||||
|
Jacks0nxD
|
||||||
|
Jack Shen
|
||||||
|
Jacky Yeung
|
||||||
|
Jacques Stadler
|
||||||
|
Janek Thomaschewski
|
||||||
|
Jan Kaláb
|
||||||
|
Jan Niklas Hasse
|
||||||
|
Jasper Groenewegen
|
||||||
|
Javi Rodríguez
|
||||||
|
Jayasimha (ಜಯಸಿಂಹ)
|
||||||
|
jeannich
|
||||||
|
Jeff Bailes
|
||||||
|
Jesse Zilstorff
|
||||||
|
Joan Duran
|
||||||
|
João Santos
|
||||||
|
Joar Bagge
|
||||||
|
Joe Anderson
|
||||||
|
Joel Calado
|
||||||
|
Johan Linde
|
||||||
|
John Garland
|
||||||
|
Jojan
|
||||||
|
jollyr0ger
|
||||||
|
Jonas Bo Grimsgaard
|
||||||
|
Jonas Granqvist
|
||||||
|
Jonas Slivka
|
||||||
|
Jonathan Zeppettini
|
||||||
|
Jørgen
|
||||||
|
Jørgen Tellnes
|
||||||
|
josé
|
||||||
|
José Geraldo Gouvêa
|
||||||
|
José Iván León Islas
|
||||||
|
José Lou C.
|
||||||
|
Jose Sun
|
||||||
|
Jr.
|
||||||
|
Jukka Kauppinen
|
||||||
|
Julián Alarcón
|
||||||
|
julietgolf
|
||||||
|
Jusic
|
||||||
|
Justzupi
|
||||||
|
Kaarel
|
||||||
|
Kai Thomsen
|
||||||
|
Kalman Tarnay
|
||||||
|
Kamil Páral
|
||||||
|
Kane_F
|
||||||
|
kaotiks@gmail.com
|
||||||
|
Kateikyoushii
|
||||||
|
kaxhinaz
|
||||||
|
Kazuhiro NISHIYAMA
|
||||||
|
Kerberos
|
||||||
|
Keresztes Ákos
|
||||||
|
kevintyk
|
||||||
|
kiersie
|
||||||
|
Kimbo^
|
||||||
|
Kim Lübbe
|
||||||
|
kitzOgen
|
||||||
|
Kjetil Rydland
|
||||||
|
kluon
|
||||||
|
kmikz
|
||||||
|
Knedlyk
|
||||||
|
koleoptero
|
||||||
|
Kőrösi Krisztián
|
||||||
|
Kouta
|
||||||
|
Krakatos
|
||||||
|
Krešo Kunjas
|
||||||
|
kripken
|
||||||
|
Kristaps
|
||||||
|
Kristian Øllegaard
|
||||||
|
Kristoffer Egil Bonarjee
|
||||||
|
Krzysztof Janowski
|
||||||
|
Krzysztof Zawada
|
||||||
|
Larry Wei Liu
|
||||||
|
laughterwym
|
||||||
|
Laur Mõtus
|
||||||
|
lazka
|
||||||
|
leandrud
|
||||||
|
lê bình
|
||||||
|
Le Coz Florent
|
||||||
|
Leo
|
||||||
|
liorda
|
||||||
|
LKRaider
|
||||||
|
LoLo_SaG
|
||||||
|
Long Tran
|
||||||
|
Lorenz
|
||||||
|
Low Kian Seong
|
||||||
|
Luca Andrea Rossi
|
||||||
|
Luca Ferretti
|
||||||
|
Lucky LIX
|
||||||
|
Luis Gomes
|
||||||
|
Luis Reis
|
||||||
|
Łukasz Wyszyński
|
||||||
|
luojie-dune
|
||||||
|
maaark
|
||||||
|
Maciej Chojnacki
|
||||||
|
Maciej Meller
|
||||||
|
Mads Peter Rommedahl
|
||||||
|
Major Kong
|
||||||
|
Malaki
|
||||||
|
malde
|
||||||
|
Malte Lenz
|
||||||
|
Mantas Kriaučiūnas
|
||||||
|
Mara Sorella
|
||||||
|
Marcin
|
||||||
|
Marcin Falkiewicz
|
||||||
|
marcobra
|
||||||
|
Marco da Silva
|
||||||
|
Marco de Moulin
|
||||||
|
Marco Rodrigues
|
||||||
|
Marcos
|
||||||
|
Marcos Escalier
|
||||||
|
Marcos Mobley
|
||||||
|
Marcus Ekstrom
|
||||||
|
Marek Dębowski
|
||||||
|
Mário Buči
|
||||||
|
Mario Munda
|
||||||
|
Marius Andersen
|
||||||
|
Marius Hudea
|
||||||
|
Marius Mihai
|
||||||
|
Mariusz Cielecki
|
||||||
|
Mark Krapivner
|
||||||
|
marko-markovic
|
||||||
|
Markus Brummer
|
||||||
|
Markus Sutter
|
||||||
|
Martin
|
||||||
|
Martin Dybdal
|
||||||
|
Martin Iglesias
|
||||||
|
Martin Lettner
|
||||||
|
Martin Pihl
|
||||||
|
Masoud Kalali
|
||||||
|
mat02
|
||||||
|
Matej Urbančič
|
||||||
|
Mathias-K
|
||||||
|
Mathieu Arès
|
||||||
|
Mathieu D. (MatToufoutu)
|
||||||
|
Mathijs
|
||||||
|
Matrik
|
||||||
|
Matteo Renzulli
|
||||||
|
Matteo Settenvini
|
||||||
|
Matthew Gadd
|
||||||
|
Matthias Benkard
|
||||||
|
Matthias Mailänder
|
||||||
|
Mattias Ohlsson
|
||||||
|
Mauro de Carvalho
|
||||||
|
Max Molchanov
|
||||||
|
Me
|
||||||
|
MercuryCC
|
||||||
|
Mert Bozkurt
|
||||||
|
Mert Dirik
|
||||||
|
MFX
|
||||||
|
mhietar
|
||||||
|
mibtha
|
||||||
|
Michael Budde
|
||||||
|
Michael Kaliszka
|
||||||
|
Michalis Makaronides
|
||||||
|
Michał Tokarczyk
|
||||||
|
Miguel Pires da Rosa
|
||||||
|
Mihai Capotă
|
||||||
|
Miika Metsälä
|
||||||
|
Mikael Fernblad
|
||||||
|
Mike Sierra
|
||||||
|
mikhalek
|
||||||
|
Milan Prvulović
|
||||||
|
Milo Casagrande
|
||||||
|
Mindaugas
|
||||||
|
Miroslav Matejaš
|
||||||
|
misel
|
||||||
|
mithras
|
||||||
|
Mitja Pagon
|
||||||
|
M.Kitchen
|
||||||
|
Mohamed Magdy
|
||||||
|
moonkey
|
||||||
|
MrBlonde
|
||||||
|
muczy
|
||||||
|
Münir Ekinci
|
||||||
|
Mustafa Temizel
|
||||||
|
mvoncken
|
||||||
|
Mytonn
|
||||||
|
NagyMarton
|
||||||
|
neaion
|
||||||
|
Neil Lin
|
||||||
|
Nemo
|
||||||
|
Nerijus Arlauskas
|
||||||
|
Nicklas Larsson
|
||||||
|
Nicolaj Wyke
|
||||||
|
Nicola Piovesan
|
||||||
|
Nicolas Sabatier
|
||||||
|
Nicolas Velin
|
||||||
|
Nightfall
|
||||||
|
NiKoB
|
||||||
|
Nikolai M. Riabov
|
||||||
|
Niko_Thien
|
||||||
|
niska
|
||||||
|
Nithir
|
||||||
|
noisemonkey
|
||||||
|
nomemohes
|
||||||
|
nosense
|
||||||
|
null
|
||||||
|
Nuno Estêvão
|
||||||
|
Nuno Santos
|
||||||
|
nxxs
|
||||||
|
nyo
|
||||||
|
obo
|
||||||
|
Ojan
|
||||||
|
Olav Andreas Lindekleiv
|
||||||
|
oldbeggar
|
||||||
|
Olivier FAURAX
|
||||||
|
orphe
|
||||||
|
osantana
|
||||||
|
Osman Tosun
|
||||||
|
OssiR
|
||||||
|
otypoks
|
||||||
|
ounn
|
||||||
|
Oz123
|
||||||
|
Özgür BASKIN
|
||||||
|
Pablo Carmona A.
|
||||||
|
Pablo Ledesma
|
||||||
|
Pablo Navarro Castillo
|
||||||
|
Paco Molinero
|
||||||
|
Pål-Eivind Johnsen
|
||||||
|
pano
|
||||||
|
Paolo Naldini
|
||||||
|
Paracelsus
|
||||||
|
Patryk13_03
|
||||||
|
Patryk Skorupa
|
||||||
|
PattogoTehen
|
||||||
|
Paul Lange
|
||||||
|
Pavcio
|
||||||
|
Paweł Wysocki
|
||||||
|
Pedro Brites Moita
|
||||||
|
Pedro Clemente Pereira Neto
|
||||||
|
Pekka "PEXI" Niemistö
|
||||||
|
Penegal
|
||||||
|
Penzo
|
||||||
|
perdido
|
||||||
|
Peter Kotrcka
|
||||||
|
Peter Skov
|
||||||
|
Peter Van den Bosch
|
||||||
|
Petter Eklund
|
||||||
|
Petter Viklund
|
||||||
|
phatsphere
|
||||||
|
Phenomen
|
||||||
|
Philipi
|
||||||
|
Philippides Homer
|
||||||
|
phoenix
|
||||||
|
pidi
|
||||||
|
Pierre Quillery
|
||||||
|
Pierre Rudloff
|
||||||
|
Pierre Slamich
|
||||||
|
Pietrao
|
||||||
|
Piotr Strębski
|
||||||
|
Piotr Wicijowski
|
||||||
|
Pittmann Tamás
|
||||||
|
Playmolas
|
||||||
|
Prescott
|
||||||
|
Prescott_SK
|
||||||
|
pronull
|
||||||
|
Przemysław Kulczycki
|
||||||
|
Pumy
|
||||||
|
pushpika
|
||||||
|
PY
|
||||||
|
qubicllj
|
||||||
|
r21vo
|
||||||
|
Rafał Barański
|
||||||
|
rainofchaos
|
||||||
|
Rajbir
|
||||||
|
ras0ir
|
||||||
|
Rat
|
||||||
|
rd1381
|
||||||
|
Renato
|
||||||
|
Rene Hennig
|
||||||
|
Rene Pärts
|
||||||
|
Ricardo Duarte
|
||||||
|
Richard
|
||||||
|
Robert Hrovat
|
||||||
|
Roberth Sjonøy
|
||||||
|
Robert Lundmark
|
||||||
|
Robin Jakobsson
|
||||||
|
Robin Kåveland
|
||||||
|
Rodrigo Donado
|
||||||
|
Roel Groeneveld
|
||||||
|
rohmaru
|
||||||
|
Rolf Christensen
|
||||||
|
Rolf Leggewie
|
||||||
|
Roni Kantis
|
||||||
|
Ronmi
|
||||||
|
Rostislav Raykov
|
||||||
|
royto
|
||||||
|
RuiAmaro
|
||||||
|
Rui Araújo
|
||||||
|
Rui Moura
|
||||||
|
Rune Svendsen
|
||||||
|
Rusna
|
||||||
|
Rytis
|
||||||
|
Sabirov Mikhail
|
||||||
|
salseeg
|
||||||
|
Sami Koskinen
|
||||||
|
Samir van de Sand
|
||||||
|
Samuel Arroyo Acuña
|
||||||
|
Samuel R. C. Vale
|
||||||
|
Sanel
|
||||||
|
Santi
|
||||||
|
Santi Martínez Cantelli
|
||||||
|
Sardan
|
||||||
|
Sargate Kanogan
|
||||||
|
Sarmad Jari
|
||||||
|
Saša Bodiroža
|
||||||
|
sat0shi
|
||||||
|
Saulius Pranckevičius
|
||||||
|
Savvas Radevic
|
||||||
|
Sebastian Krauß
|
||||||
|
Sebastián Porta
|
||||||
|
Sedir
|
||||||
|
Sefa Denizoğlu
|
||||||
|
sekolands
|
||||||
|
Selim Suerkan
|
||||||
|
semsomi
|
||||||
|
Sergii Golovatiuk
|
||||||
|
setarcos
|
||||||
|
Sheki
|
||||||
|
Shironeko
|
||||||
|
Shlomil
|
||||||
|
silfiriel
|
||||||
|
Simone Tolotti
|
||||||
|
Simone Vendemia
|
||||||
|
sirkubador
|
||||||
|
Sławomir Więch
|
||||||
|
slip
|
||||||
|
slyon
|
||||||
|
smoke
|
||||||
|
Sonja
|
||||||
|
spectral
|
||||||
|
spin_555
|
||||||
|
spitf1r3
|
||||||
|
Spiziuz
|
||||||
|
Spyros Theodoritsis
|
||||||
|
SqUe
|
||||||
|
Squigly
|
||||||
|
srtck
|
||||||
|
Stefan Horning
|
||||||
|
Stefano Maggiolo
|
||||||
|
Stefano Roberto Soleti
|
||||||
|
steinberger
|
||||||
|
Stéphane Travostino
|
||||||
|
Stephan Klein
|
||||||
|
Steven De Winter
|
||||||
|
Stevie
|
||||||
|
Stian24
|
||||||
|
stylius
|
||||||
|
Sukarn Maini
|
||||||
|
Sunjae Park
|
||||||
|
Susana Pereira
|
||||||
|
szymon siglowy
|
||||||
|
takercena
|
||||||
|
TAS
|
||||||
|
Taygeto
|
||||||
|
temy4
|
||||||
|
texxxxxx
|
||||||
|
thamood
|
||||||
|
Thanos Chatziathanassiou
|
||||||
|
Tharawut Paripaiboon
|
||||||
|
Theodoor
|
||||||
|
Théophane Anestis
|
||||||
|
Thor Marius K. Høgås
|
||||||
|
Tiago Silva
|
||||||
|
Tiago Sousa
|
||||||
|
Tikkel
|
||||||
|
tim__b
|
||||||
|
Tim Bordemann
|
||||||
|
Tim Fuchs
|
||||||
|
Tim Kornhammar
|
||||||
|
Timo
|
||||||
|
Timo Jyrinki
|
||||||
|
Timothy Babych
|
||||||
|
TitkosRejtozo
|
||||||
|
Tom
|
||||||
|
Tomas Gustavsson
|
||||||
|
Tomas Valentukevičius
|
||||||
|
Tomasz Dominikowski
|
||||||
|
Tomislav Plavčić
|
||||||
|
Tom Mannerhagen
|
||||||
|
Tommy Mikkelsen
|
||||||
|
Tom Verdaat
|
||||||
|
Tony Manco
|
||||||
|
Tor Erling H. Opsahl
|
||||||
|
Toudi
|
||||||
|
tqm_z
|
||||||
|
Trapanator
|
||||||
|
Tribaal
|
||||||
|
Triton
|
||||||
|
TuniX12
|
||||||
|
Tuomo Sipola
|
||||||
|
turbojugend_gr
|
||||||
|
Turtle.net
|
||||||
|
twilight
|
||||||
|
tymmej
|
||||||
|
Ulrik
|
||||||
|
Umarzuki Mochlis
|
||||||
|
unikob
|
||||||
|
Vadim Gusev
|
||||||
|
Vagi
|
||||||
|
Valentin Bora
|
||||||
|
Valmantas Palikša
|
||||||
|
VASKITTU
|
||||||
|
Vassilis Skoullis
|
||||||
|
vetal17
|
||||||
|
vicedo
|
||||||
|
viki
|
||||||
|
villads hamann
|
||||||
|
Vincent Garibal
|
||||||
|
Vincent Ortalda
|
||||||
|
vinchi007
|
||||||
|
Vinícius de Figueiredo Silva
|
||||||
|
Vinzenz Vietzke
|
||||||
|
virtoo
|
||||||
|
virtual_spirit
|
||||||
|
Vitor Caike
|
||||||
|
Vitor Lamas Gatti
|
||||||
|
Vladimir Lazic
|
||||||
|
Vladimir Sharshov
|
||||||
|
Wanderlust
|
||||||
|
Wander Nauta
|
||||||
|
Ward De Ridder
|
||||||
|
WebCrusader
|
||||||
|
webdr
|
||||||
|
Wentao Tang
|
||||||
|
wilana
|
||||||
|
Wilfredo Ernesto Guerrero Campos
|
||||||
|
Wim Champagne
|
||||||
|
World Sucks
|
||||||
|
Xabi Ezpeleta
|
||||||
|
Xavi de Moner
|
||||||
|
XavierToo
|
||||||
|
XChesser
|
||||||
|
Xiaodong Xu
|
||||||
|
xyb
|
||||||
|
Yaron
|
||||||
|
Yasen Pramatarov
|
||||||
|
YesPoX
|
||||||
|
Yuren Ju
|
||||||
|
Yves MATHIEU
|
||||||
|
zekopeko
|
||||||
|
zhuqin
|
||||||
|
Zissan
|
||||||
|
Γιάννης Κατσαμπίρης
|
||||||
|
Артём Попов
|
||||||
|
Миша
|
||||||
|
Шаймарданов Максим
|
||||||
|
蔡查理
|
||||||
259
CHANGELOG.md
Normal file
259
CHANGELOG.md
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2.1.1 (2022-07-10)
|
||||||
|
|
||||||
|
### Core
|
||||||
|
|
||||||
|
- Fix missing trackers added via magnet
|
||||||
|
- Fix handling magnets with tracker tiers
|
||||||
|
|
||||||
|
## 2.1.0 (2022-06-28)
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
- Python 2 support removed (Python >= 3.6)
|
||||||
|
- libtorrent minimum requirement increased (>= 1.2).
|
||||||
|
|
||||||
|
### Core
|
||||||
|
|
||||||
|
- Add support for SVG tracker icons.
|
||||||
|
- Fix tracker icon error handling.
|
||||||
|
- Fix cleaning-up tracker icon temp files.
|
||||||
|
- Fix Plugin manager to handle new metadata 2.1.
|
||||||
|
- Hide passwords in config logs.
|
||||||
|
- Fix cleaning-up temp files in add_torrent_url.
|
||||||
|
- Fix KeyError in sessionproxy after torrent delete.
|
||||||
|
- Remove libtorrent deprecated functions.
|
||||||
|
- Fix file_completed_alert handling.
|
||||||
|
- Add plugin keys to get_torrents_status.
|
||||||
|
- Add support for pygeoip dependency.
|
||||||
|
- Fix crash logging to Windows protected folder.
|
||||||
|
- Add is_interface and is_interface_name to validate network interfaces.
|
||||||
|
- Fix is_url and is_infohash error with None value.
|
||||||
|
- Fix load_libintl error.
|
||||||
|
- Add support for IPv6 in host lists.
|
||||||
|
- Add systemd user services.
|
||||||
|
- Fix refresh and expire the torrent status cache.
|
||||||
|
- Fix crash when logging errors initializing gettext.
|
||||||
|
|
||||||
|
### Web UI
|
||||||
|
|
||||||
|
- Fix ETA column sorting in correct order (#3413).
|
||||||
|
- Fix defining foreground and background colors.
|
||||||
|
- Accept charset in content-type for json messages.
|
||||||
|
- Fix 'Complete Seen' and 'Completed' sorting.
|
||||||
|
- Fix encoding HTML entities for torrent attributes to prevent XSS.
|
||||||
|
|
||||||
|
### Gtk UI
|
||||||
|
|
||||||
|
- Fix download location textbox width.
|
||||||
|
- Fix obscured port number in Connection Manager.
|
||||||
|
- Increase connection manager default height.
|
||||||
|
- Fix bug with setting move completed in Options tab.
|
||||||
|
- Fix adding daemon accounts.
|
||||||
|
- Add workaround for crash on Windows with ico or gif icons.
|
||||||
|
- Hide account password length in log.
|
||||||
|
- Added a torrent menu option for magnet copy.
|
||||||
|
- Fix unable to prefetch magnet in thinclient mode.
|
||||||
|
- Use GtkSpinner when testing open port.
|
||||||
|
- Update About Dialog year.
|
||||||
|
- Fix Edit Torrents dialogs close issues.
|
||||||
|
- Fix ETA being copied to neighboring empty cells.
|
||||||
|
- Disable GTK CSD by default on Windows.
|
||||||
|
|
||||||
|
### Console UI
|
||||||
|
|
||||||
|
- Fix curses.init_pair raise ValueError on Py3.10.
|
||||||
|
- Swap j and k key's behavior to fit vim mode.
|
||||||
|
- Fix torrent details status error.
|
||||||
|
- Fix incorrect test for when a host is online.
|
||||||
|
- Add the torrent label to info command.
|
||||||
|
|
||||||
|
### AutoAdd
|
||||||
|
|
||||||
|
- Fix handling torrent decode errors.
|
||||||
|
- Fix error dialog not being shown on error.
|
||||||
|
|
||||||
|
### Blocklist
|
||||||
|
|
||||||
|
- Add frequency unit to interval label.
|
||||||
|
|
||||||
|
### Notifications
|
||||||
|
|
||||||
|
- Fix UnicodeEncodeError upon non-ascii torrent name.
|
||||||
|
|
||||||
|
## 2.0.5 (2021-12-15)
|
||||||
|
|
||||||
|
### WebUI
|
||||||
|
|
||||||
|
- Fix js minifying error resulting in WebUI blank screen.
|
||||||
|
- Silence erronous missing translations warning.
|
||||||
|
|
||||||
|
## 2.0.4 (2021-12-12)
|
||||||
|
|
||||||
|
### Packaging
|
||||||
|
|
||||||
|
- Fix python optional setup.py requirements
|
||||||
|
|
||||||
|
### Gtk UI
|
||||||
|
|
||||||
|
- Add detection of torrent URL on GTK UI focus
|
||||||
|
- Fix piecesbar crashing when enabled
|
||||||
|
- Remove num_blocks_cache_hits in stats
|
||||||
|
- Fix unhandled error with empty clipboard
|
||||||
|
- Add torrentdetails tabs position menu (#3441)
|
||||||
|
- Hide pygame community banner in console
|
||||||
|
- Fix cmp function for None types (#3309)
|
||||||
|
- Fix loading config with double-quotes in string
|
||||||
|
- Fix Status tab download speed and uploaded
|
||||||
|
|
||||||
|
### Web UI
|
||||||
|
|
||||||
|
- Handle torrent add failures
|
||||||
|
- Add menu option to copy magnet URI
|
||||||
|
- Fix md5sums in torrent files breaking file listing (#3388)
|
||||||
|
- Add country flag alt/title for accessibility
|
||||||
|
|
||||||
|
### Console UI
|
||||||
|
|
||||||
|
- Fix allowing use of windows-curses on Windows
|
||||||
|
- Fix hostlist status lookup errors
|
||||||
|
- Fix AttributeError setting config values
|
||||||
|
- Fix setting 'Skip' priority
|
||||||
|
|
||||||
|
### Core
|
||||||
|
|
||||||
|
- Add workaround libtorrent 2.0 file_progress error
|
||||||
|
- Fix allow enabling any plugin Python version
|
||||||
|
- Export torrent get_magnet_uri method
|
||||||
|
- Fix loading magnet with resume_data and no metadata (#3478)
|
||||||
|
- Fix httpdownloader reencoding torrent file downloads (#3440)
|
||||||
|
- Fix lt listen_interfaces not comma-separated (#3337)
|
||||||
|
- Fix unable to remove magnet with delete_copies enabled (#3325)
|
||||||
|
- Fix Python 3.8 compatibility
|
||||||
|
- Fix loading config with double-quotes in string
|
||||||
|
- Fix pickle loading non-ascii state error (#3298)
|
||||||
|
- Fix creation of pidfile via command option
|
||||||
|
- Fix for peer.client UnicodeDecodeError
|
||||||
|
- Fix show_file unhandled dbus error
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
- Add How-to guides about services.
|
||||||
|
|
||||||
|
### Stats plugin
|
||||||
|
|
||||||
|
- Fix constant session status key warnings
|
||||||
|
- Fix cairo error
|
||||||
|
|
||||||
|
### Notifications plugin
|
||||||
|
|
||||||
|
- Fix email KeyError with status name
|
||||||
|
- Fix unhandled TypeErrors on Python 3
|
||||||
|
|
||||||
|
### Autoadd plugin
|
||||||
|
|
||||||
|
- Fix magnet missing applied labels
|
||||||
|
|
||||||
|
### Execute plugin
|
||||||
|
|
||||||
|
- Fix failing to run on Windows (#3439)
|
||||||
|
|
||||||
|
## 2.0.3 (2019-06-12)
|
||||||
|
|
||||||
|
### Gtk UI
|
||||||
|
|
||||||
|
- Fix errors running on Wayland (#3265).
|
||||||
|
- Fix Peers Tab tooltip and context menu errors (#3266).
|
||||||
|
|
||||||
|
### Web UI
|
||||||
|
|
||||||
|
- Fix TypeError in Peers Tab setting country flag.
|
||||||
|
- Fix reverse proxy header TypeError (#3260).
|
||||||
|
- Fix request.base 'idna' codec error (#3261).
|
||||||
|
- Fix unable to change password (#3262).
|
||||||
|
|
||||||
|
### Extractor plugin
|
||||||
|
|
||||||
|
- Fix potential error starting plugin.
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
- Fix macOS install typo.
|
||||||
|
- Fix Windows install instructions.
|
||||||
|
|
||||||
|
## 2.0.2 (2019-06-08)
|
||||||
|
|
||||||
|
### Packaging
|
||||||
|
|
||||||
|
- Add systemd deluged and deluge-web service files to package tarball (#2034)
|
||||||
|
|
||||||
|
### Core
|
||||||
|
|
||||||
|
- Fix Python 2 compatibility issue with SimpleNamespace.
|
||||||
|
|
||||||
|
## 2.0.1 (2019-06-07)
|
||||||
|
|
||||||
|
### Packaging
|
||||||
|
|
||||||
|
- Fix `setup.py` build error without git installed.
|
||||||
|
|
||||||
|
## 2.0.0 (2019-06-06)
|
||||||
|
|
||||||
|
### Codebase
|
||||||
|
|
||||||
|
- Ported to Python 3
|
||||||
|
|
||||||
|
### Core
|
||||||
|
|
||||||
|
- Improved Logging
|
||||||
|
- Removed the AutoAdd feature on the core. It's now handled with the AutoAdd
|
||||||
|
plugin, which is also shipped with Deluge, and it does a better job and
|
||||||
|
now, it even supports multiple users perfectly.
|
||||||
|
- Authentication/Permission exceptions are now sent to clients and recreated
|
||||||
|
there to allow acting upon them.
|
||||||
|
- Updated SSL/TLS Protocol parameters for better security.
|
||||||
|
- Make the distinction between adding to the session new unmanaged torrents
|
||||||
|
and torrents loaded from state. This will break backwards compatibility.
|
||||||
|
- Pass a copy of an event instead of passing the event arguments to the
|
||||||
|
event handlers. This will break backwards compatibility.
|
||||||
|
- Allow changing ownership of torrents.
|
||||||
|
- File modifications on the auth file are now detected and when they happen,
|
||||||
|
the file is reloaded. Upon finding an old auth file with an old format, an
|
||||||
|
upgrade to the new format is made, file saved, and reloaded.
|
||||||
|
- Authentication no longer requires a username/password. If one or both of
|
||||||
|
these is missing, an authentication error will be sent to the client
|
||||||
|
which should then ask the username/password to the user.
|
||||||
|
- Implemented sequential downloads.
|
||||||
|
- Provide information about a torrent's pieces states
|
||||||
|
- Add Option To Specify Outgoing Connection Interface.
|
||||||
|
- Fix potential for host_id collision when creating hostlist entries.
|
||||||
|
|
||||||
|
### Gtk UI
|
||||||
|
|
||||||
|
- Ported to GTK3 (3rd-party plugins will need updated).
|
||||||
|
- Allow changing ownership of torrents.
|
||||||
|
- Host entries in the Connection Manager UI are now editable.
|
||||||
|
- Implemented sequential downloads UI handling.
|
||||||
|
- Add optional pieces bar instead of a regular progress bar in torrent status tab.
|
||||||
|
- Make torrent opening compatible with all Unicode paths.
|
||||||
|
- Fix magnet association button on Windows.
|
||||||
|
- Add keyboard shortcuts for changing queue position:
|
||||||
|
- Up: `Ctrl+Alt+Up`
|
||||||
|
- Down: `Ctrl+Alt+Down`
|
||||||
|
- Top: `Ctrl+Alt+Shift+Up`
|
||||||
|
- Bottom: `Ctrl+Alt+Shift+Down`
|
||||||
|
|
||||||
|
### Web UI
|
||||||
|
|
||||||
|
- Server (deluge-web) now daemonizes by default, use '-d' or '--do-not-daemonize' to disable.
|
||||||
|
- Fixed the '--base' option to work for regular use, not just with reverse proxies.
|
||||||
|
|
||||||
|
### Blocklist Plugin
|
||||||
|
|
||||||
|
- Implemented whitelist support to both core and GTK UI.
|
||||||
|
- Implemented IP filter cleaning before each update. Restarting the deluge
|
||||||
|
daemon is no longer needed.
|
||||||
|
- If "check_after_days" is 0(zero), the timer is not started anymore. It
|
||||||
|
would keep updating one call after the other. If the value changed, the
|
||||||
|
timer is now stopped and restarted using the new value.
|
||||||
149
ChangeLog
149
ChangeLog
@ -1,149 +0,0 @@
|
|||||||
=== Deluge 1.3.0 (In Development) ===
|
|
||||||
* Improved Logging
|
|
||||||
* Removed the AutoAdd feature on the core. It's now handled with the AutoAdd
|
|
||||||
plugin, which is also shipped with Deluge, and it does a better job and
|
|
||||||
now, it even supports multiple users perfectly.
|
|
||||||
* Authentication/Permission exceptions are now sent to clients and recreated
|
|
||||||
there to allow acting upon them.
|
|
||||||
* Enforced the use of the "deluge.plugins" namespace to reduce package
|
|
||||||
names clashing beetween regular packages and deluge plugins.
|
|
||||||
|
|
||||||
==== Core ====
|
|
||||||
* Implement #1063 option to delete torrent file copy on torrent removal - patch from Ghent
|
|
||||||
* Implement #457 progress bars for folders
|
|
||||||
* Implement #1012 httpdownloader supports gzip decoding
|
|
||||||
* #496: Remove deprecated functions in favour of get_session_status()
|
|
||||||
* #1112: Fix renaming files in add torrent dialog
|
|
||||||
* #1247: Fix deluge-gtk from hanging on shutdown
|
|
||||||
* #995: Rewrote tracker_icons
|
|
||||||
* Make the distinction between adding to the session new unmanaged torrents
|
|
||||||
and torrents loaded from state. This will break backwards compatability.
|
|
||||||
* Pass a copy of an event instead of passing the event arguments to the
|
|
||||||
event handlers. This will break backwards compatability.
|
|
||||||
* Allow changing ownership of torrents.
|
|
||||||
* File modifications on the auth file are now detected and when they happen,
|
|
||||||
the file is reloaded. Upon finding an old auth file with an old format, an
|
|
||||||
upgrade to the new format is made, file saved, and reloaded.
|
|
||||||
* Authentication no longer requires a username/password. If one or both of
|
|
||||||
these is missing, an authentication error will be sent to the client
|
|
||||||
which sould then ask the username/password to the user.
|
|
||||||
* Implemented sequential downloads.
|
|
||||||
* #378: Provide information about a torrent's pieces states
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Fix uncaught exception when closing deluge in classic mode
|
|
||||||
* Allow changing ownership of torrents
|
|
||||||
* Host entries in the Connection Manager UI are now editable. They're
|
|
||||||
now also migrated from the old format were automatic localhost logins were
|
|
||||||
possible, which no longer is, this fixes #1814.
|
|
||||||
* Implemented sequential downloads UI handling.
|
|
||||||
* #378: Allow showing a pieces bar instead of a regular progress bar in a
|
|
||||||
torrent's status tab.
|
|
||||||
|
|
||||||
==== WebUI ====
|
|
||||||
* Migrate to ExtJS 3.1
|
|
||||||
* Add gzip compression of HTTP data to the server
|
|
||||||
* Improve the efficiency of the TorrentGrid
|
|
||||||
|
|
||||||
==== Blocklist ====
|
|
||||||
* Implement local blocklist support
|
|
||||||
* #861: Pause transfers until blocklist is imported
|
|
||||||
|
|
||||||
=== Deluge 1.2.0 - "Bursting like an infected kidney" (10 January 2010) ===
|
|
||||||
==== Core ====
|
|
||||||
* Implement new RPC protocol DelugeRPC replacing XMLRPC
|
|
||||||
* Move to a twisted framework
|
|
||||||
* Add an 'Error' filter for Trackers to show trackers that currently have a tracker error
|
|
||||||
* Use system GeoIP database if available, this is now an optional dependency
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Remove SignalReceiver
|
|
||||||
* Implemented a cross-platform IPC method thus removing the DBUS dependency
|
|
||||||
* Implement a "True" Classic Mode where there is no longer a separate daemon process
|
|
||||||
* Add preferences option "Add torrent in paused state"
|
|
||||||
* Add tracker icons to the Tracker column
|
|
||||||
* Implement #259 show tooltip with country name in the peers tab
|
|
||||||
* Add an error category to the tracker sidebar list
|
|
||||||
* Add Find More Plugins button to Plugins preference page
|
|
||||||
* Fix #518 remove header in add torrent dialog to save vertical space
|
|
||||||
* Add a Cache preferences page to adjust cache settings and examine cache status
|
|
||||||
* Add ability to rename files prior to adding them
|
|
||||||
* Fix shutdown handler with GNOME session manager
|
|
||||||
* Allow 4 MiB piece sizes when creating a torrent
|
|
||||||
|
|
||||||
==== ConsoleUI ====
|
|
||||||
* Changed to use curses for a more interactive client
|
|
||||||
|
|
||||||
==== WebUI ====
|
|
||||||
* Move over to using Twisted-Web for the webserver.
|
|
||||||
* Move to only AJAX interface built upon Ext-JS.
|
|
||||||
|
|
||||||
==== Plugins ====
|
|
||||||
* Add Scheduler plugin
|
|
||||||
* Add Extractor plugin
|
|
||||||
|
|
||||||
==== Misc ====
|
|
||||||
* PyGTK dependency bumped to => 2.12 to use new tooltip system
|
|
||||||
* Add new scripts for invoking UIs: deluge-gtk, deluge-web, deluge-console
|
|
||||||
* Remove GeoIP database from the source tree
|
|
||||||
|
|
||||||
=== Deluge 1.1.0 - "Time gas!" (10 January 2009) ===
|
|
||||||
==== Core ====
|
|
||||||
* Implement #79 ability to change outgoing port range
|
|
||||||
* Implement #296 ability to change peer TOS byte
|
|
||||||
* Add per-torrent move on completed settings
|
|
||||||
* Implement #414 use async save_resume_data method
|
|
||||||
* Filter Manager with torrent filtering in get_torrents_status , for sidebar and plugins.
|
|
||||||
* Implement #368 add torrents by infohash/magnet uri (trackerless torrents)
|
|
||||||
* Remove remaining gtk functions in common
|
|
||||||
* Tracker icons.
|
|
||||||
* Add ETA for torrents with stop at seed ratio set
|
|
||||||
* Fix #47 the state and config files are no longer invalidated when there is no diskspace
|
|
||||||
* Fix #619 return "" instead of "Infinity" if seconds == 0 in ftime
|
|
||||||
* Add -P, --pidfile option to deluged
|
|
||||||
|
|
||||||
==== GtkUI ====
|
|
||||||
* Add peer progress to the peers tab
|
|
||||||
* Add ability to manually add peers
|
|
||||||
* Sorting # column will place downloaders above seeds
|
|
||||||
* Remove dependency on libtorrent for add torrent dialog
|
|
||||||
* Allow adding multiple trackers at once in the edit tracker dialog
|
|
||||||
* Implement #28 Create Torrent Dialog
|
|
||||||
* Redesiged sidebar with filters for Active and Tracker (see Filter Manager)
|
|
||||||
* Implement #428 the ability to rename files and directories
|
|
||||||
* Implement #229 add date added column
|
|
||||||
* Implement #596 show speeds in title
|
|
||||||
* Fix #636 not setting the daemon's config directory when using --config= with the UI in classic mode.
|
|
||||||
* Fix #624 do not allow changing file priorities when using compact allocation
|
|
||||||
* Fix #602 re-did files/peers tab state saving/loading
|
|
||||||
* Fix gtk warnings
|
|
||||||
* Add protocol traffic statusbar item
|
|
||||||
* Rework the Remove Torrent Dialog to only have 2 options, remove data and remove from session.
|
|
||||||
* Add "Install Plugin" and "Rescan Plugins" buttons to the Plugins preferences
|
|
||||||
* Make active port test use internal graphic instead of launching browser
|
|
||||||
|
|
||||||
==== WebUI ====
|
|
||||||
* Lots of smaller tweaks.
|
|
||||||
* All details tabs have the same features as in gtk-ui 1.0.x
|
|
||||||
* Persistent sessions #486
|
|
||||||
* Plugin improvements for easy use of templates and images in eggs. #497
|
|
||||||
* Classic template takes over some style elements from white template.
|
|
||||||
* https (for users that know how to create certificates)
|
|
||||||
* Easier apache mod_proxy use.
|
|
||||||
* Redesigned sidebar
|
|
||||||
|
|
||||||
==== AjaxUI ====
|
|
||||||
* Hosted in a webui template.
|
|
||||||
|
|
||||||
==== ConsoleUI ====
|
|
||||||
* New ConsoleUI written by Idoa01
|
|
||||||
* Callable from command-line for scripts.
|
|
||||||
|
|
||||||
==== Plugins ====
|
|
||||||
* Stats plugin for graphs.
|
|
||||||
* Label plugin for grouping torrents and per torrent settings.
|
|
||||||
|
|
||||||
==== Misc ====
|
|
||||||
* Implement #478 display UI options in usage help
|
|
||||||
* Fix #547 add description to name field per HIG entry 2.1.1.1
|
|
||||||
* Fix #531 set default log level to ERROR and add 2 command-line options, "-L, --loglevel" and "-q, --quiet".
|
|
||||||
29
DEPENDS
29
DEPENDS
@ -1,29 +0,0 @@
|
|||||||
=== Core ===
|
|
||||||
* python >= 2.5
|
|
||||||
* twisted >= 8.1
|
|
||||||
* twisted-web >= 8.1
|
|
||||||
* pyopenssl
|
|
||||||
* simplejson (if python < 2.6)
|
|
||||||
* setuptools
|
|
||||||
* gettext
|
|
||||||
* intltool
|
|
||||||
* pyxdg
|
|
||||||
* chardet
|
|
||||||
* geoip-database (optional)
|
|
||||||
|
|
||||||
* libtorrent >= 0.14, or build the included version
|
|
||||||
|
|
||||||
* If building included libtorrent::
|
|
||||||
* boost >= 1.34.1
|
|
||||||
* openssl
|
|
||||||
* zlib
|
|
||||||
|
|
||||||
=== Gtk ===
|
|
||||||
* python-notify (libnotify python wrapper)
|
|
||||||
* pygame
|
|
||||||
* pygtk >= 2.12
|
|
||||||
* librsvg
|
|
||||||
* xdg-utils
|
|
||||||
|
|
||||||
=== Web ===
|
|
||||||
* mako
|
|
||||||
100
DEPENDS.md
Normal file
100
DEPENDS.md
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
# Deluge dependencies
|
||||||
|
|
||||||
|
The following are required to install and run Deluge. They are separated into
|
||||||
|
sections to distinguish the precise requirements for each module.
|
||||||
|
|
||||||
|
All modules will require the [common](#common) section dependencies.
|
||||||
|
|
||||||
|
## Prerequisite
|
||||||
|
|
||||||
|
- [Python] _>= 3.6_
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
- [setuptools]
|
||||||
|
- [intltool] - Optional: Desktop file translation for \*nix.
|
||||||
|
- [closure-compiler] - Minify javascript (alternative is [rjsmin])
|
||||||
|
|
||||||
|
## Common
|
||||||
|
|
||||||
|
- [Twisted] _>= 17.1_ - Use `TLS` extras for `service_identity` and `idna`.
|
||||||
|
- [OpenSSL] _>= 1.0.1_
|
||||||
|
- [pyOpenSSL]
|
||||||
|
- [rencode] _>= 1.0.2_ - Encoding library.
|
||||||
|
- [PyXDG] - Access freedesktop.org standards for \*nix.
|
||||||
|
- [xdg-utils] - Provides xdg-open for \*nix.
|
||||||
|
- [zope.interface]
|
||||||
|
- [chardet] - Optional: Encoding detection.
|
||||||
|
- [setproctitle] - Optional: Renaming processes.
|
||||||
|
- [Pillow] - Optional: Support for resizing tracker icons.
|
||||||
|
- [dbus-python] - Optional: Show item location in filemanager.
|
||||||
|
- [ifaddr] - Optional: Verify network interfaces.
|
||||||
|
|
||||||
|
### Linux and BSD
|
||||||
|
|
||||||
|
- [distro] - Optional: OS platform information.
|
||||||
|
|
||||||
|
### Windows OS
|
||||||
|
|
||||||
|
- [pywin32]
|
||||||
|
- [certifi]
|
||||||
|
|
||||||
|
## Core (deluged daemon)
|
||||||
|
|
||||||
|
- [libtorrent] _>= 1.2.0_
|
||||||
|
- [GeoIP] or [pygeoip] - Optional: IP address country lookup. (_Debian: `python-geoip`_)
|
||||||
|
|
||||||
|
## GTK UI
|
||||||
|
|
||||||
|
- [GTK+] >= 3.10
|
||||||
|
- [PyGObject]
|
||||||
|
- [Pycairo]
|
||||||
|
- [librsvg] _>= 2_
|
||||||
|
- [libappindicator3] w/GIR - Optional: Ubuntu system tray icon.
|
||||||
|
|
||||||
|
### MacOS
|
||||||
|
|
||||||
|
- [GtkOSXApplication]
|
||||||
|
|
||||||
|
## Web UI
|
||||||
|
|
||||||
|
- [mako]
|
||||||
|
|
||||||
|
## Plugins
|
||||||
|
|
||||||
|
### Notifications
|
||||||
|
|
||||||
|
- [pygame] - Optional: Play sounds
|
||||||
|
- [libnotify] w/GIR - Optional: Desktop popups.
|
||||||
|
|
||||||
|
[python]: https://www.python.org/
|
||||||
|
[setuptools]: https://setuptools.readthedocs.io/en/latest/
|
||||||
|
[intltool]: https://freedesktop.org/wiki/Software/intltool/
|
||||||
|
[closure-compiler]: https://developers.google.com/closure/compiler/
|
||||||
|
[rjsmin]: https://pypi.org/project/rjsmin/
|
||||||
|
[openssl]: https://www.openssl.org/
|
||||||
|
[pyopenssl]: https://pyopenssl.org
|
||||||
|
[twisted]: https://twistedmatrix.com
|
||||||
|
[pillow]: https://pypi.org/project/Pillow/
|
||||||
|
[libtorrent]: https://libtorrent.org/
|
||||||
|
[zope.interface]: https://pypi.org/project/zope.interface/
|
||||||
|
[distro]: https://github.com/nir0s/distro
|
||||||
|
[pywin32]: https://github.com/mhammond/pywin32
|
||||||
|
[certifi]: https://pypi.org/project/certifi/
|
||||||
|
[dbus-python]: https://pypi.org/project/dbus-python/
|
||||||
|
[setproctitle]: https://pypi.org/project/setproctitle/
|
||||||
|
[gtkosxapplication]: https://github.com/jralls/gtk-mac-integration
|
||||||
|
[chardet]: https://chardet.github.io/
|
||||||
|
[rencode]: https://github.com/aresch/rencode
|
||||||
|
[pyxdg]: https://www.freedesktop.org/wiki/Software/pyxdg/
|
||||||
|
[xdg-utils]: https://www.freedesktop.org/wiki/Software/xdg-utils/
|
||||||
|
[gtk+]: https://www.gtk.org/
|
||||||
|
[pycairo]: https://cairographics.org/pycairo/
|
||||||
|
[pygobject]: https://pygobject.readthedocs.io/en/latest/
|
||||||
|
[geoip]: https://pypi.org/project/GeoIP/
|
||||||
|
[mako]: https://www.makotemplates.org/
|
||||||
|
[pygame]: https://www.pygame.org/
|
||||||
|
[libnotify]: https://developer.gnome.org/libnotify/
|
||||||
|
[python-appindicator]: https://packages.ubuntu.com/xenial/python-appindicator
|
||||||
|
[librsvg]: https://wiki.gnome.org/action/show/Projects/LibRsvg
|
||||||
|
[ifaddr]: https://pypi.org/project/ifaddr/
|
||||||
46
MANIFEST.in
46
MANIFEST.in
@ -1,12 +1,36 @@
|
|||||||
recursive-include docs/man *
|
include *.md
|
||||||
recursive-include deluge *
|
include AUTHORS
|
||||||
recursive-include win32 *
|
include LICENSE
|
||||||
|
include RELEASE-VERSION
|
||||||
|
include msgfmt.py
|
||||||
|
include minify_web_js.py
|
||||||
|
include version.py
|
||||||
|
include gen_web_gettext.py
|
||||||
|
|
||||||
recursive-exclude deluge *.egg-link
|
graft docs/man
|
||||||
exclude deluge/ui/web/gen_gettext.py
|
graft packaging/systemd
|
||||||
exclude deluge/ui/web/css/*-debug.css
|
|
||||||
exclude deluge/ui/web/js/build.sh
|
include deluge/i18n/*.po
|
||||||
exclude deluge/ui/web/js/Deluge*.js
|
recursive-exclude deluge/i18n *.mo
|
||||||
exclude deluge/ui/web/js/*-debug.js
|
|
||||||
prune deluge/ui/web/docs
|
graft deluge/plugins
|
||||||
prune deluge/scripts
|
recursive-exclude deluge/plugins create_dev_link.sh *.pyc *.egg
|
||||||
|
prune deluge/plugins/*/build
|
||||||
|
prune deluge/plugins/*/*.egg-info
|
||||||
|
|
||||||
|
graft deluge/tests/
|
||||||
|
recursive-exclude deluge/tests *.pyc
|
||||||
|
|
||||||
|
graft deluge/ui/data
|
||||||
|
recursive-exclude deluge/ui/data *.desktop *.xml
|
||||||
|
graft deluge/ui/gtk3/glade
|
||||||
|
|
||||||
|
include deluge/ui/web/index.html
|
||||||
|
include deluge/ui/web/css/*.css
|
||||||
|
include deluge/ui/web/js/*.js
|
||||||
|
graft deluge/ui/web/js/deluge-all/
|
||||||
|
graft deluge/ui/web/js/extjs/
|
||||||
|
graft deluge/ui/web/themes
|
||||||
|
graft deluge/ui/web/render
|
||||||
|
graft deluge/ui/web/icons
|
||||||
|
graft deluge/ui/web/images
|
||||||
|
|||||||
94
README
94
README
@ -1,94 +0,0 @@
|
|||||||
|
|
||||||
==========================
|
|
||||||
Deluge BitTorrent Client
|
|
||||||
==========================
|
|
||||||
|
|
||||||
Homepage: http://deluge-torrent.org
|
|
||||||
|
|
||||||
Authors:
|
|
||||||
Andrew Resch
|
|
||||||
Damien Churchill
|
|
||||||
|
|
||||||
For past developers and contributers see: http://dev.deluge-torrent.org/wiki/About
|
|
||||||
|
|
||||||
==========================
|
|
||||||
License
|
|
||||||
==========================
|
|
||||||
Deluge is under the GNU GPLv3 license.
|
|
||||||
Icon ui/data/pixmaps/deluge.svg and derivatives in ui/data/icons are copyright
|
|
||||||
Andrew Wedderburn and are under the GNU GPLv3.
|
|
||||||
All other icons in ui/data/pixmaps are copyright Andrew Resch and are under
|
|
||||||
the GNU GPLv3.
|
|
||||||
|
|
||||||
==========================
|
|
||||||
Contact/Support:
|
|
||||||
==========================
|
|
||||||
|
|
||||||
We have two options available for support:
|
|
||||||
|
|
||||||
Our Forum, at: http://forum.deluge-torrent.org
|
|
||||||
or
|
|
||||||
Our IRC Channel, at #deluge on Freenode: http://freenode.net
|
|
||||||
|
|
||||||
==========================
|
|
||||||
Installation Instructions:
|
|
||||||
==========================
|
|
||||||
|
|
||||||
For more detailed instructions see: http://dev.deluge-torrent.org/wiki/Installing/Source
|
|
||||||
|
|
||||||
See: DEPENDS for a full list of dependencies.
|
|
||||||
|
|
||||||
First, make sure you have the proper build dependencies installed. On a normal
|
|
||||||
Debian or Ubuntu system:
|
|
||||||
|
|
||||||
sudo apt-get install g++ make python-all-dev python-all python-dbus \
|
|
||||||
python-gtk2 python-notify librsvg2-common python-xdg python-support \
|
|
||||||
subversion libboost-dev libboost-python-dev \
|
|
||||||
libboost-thread-dev libboost-date-time-dev libboost-filesystem-dev \
|
|
||||||
libssl-dev zlib1g-dev python-setuptools \
|
|
||||||
python-mako python-twisted-web python-chardet python-simplejson
|
|
||||||
|
|
||||||
The names of the packages may vary depending on your OS / distro.
|
|
||||||
|
|
||||||
Once you have the needed libraries installed, build and install by running:
|
|
||||||
|
|
||||||
$ python setup.py build
|
|
||||||
$ sudo python setup.py install
|
|
||||||
|
|
||||||
==========================
|
|
||||||
FAQ
|
|
||||||
==========================
|
|
||||||
|
|
||||||
How to start the various user-interfaces
|
|
||||||
|
|
||||||
Gtk:
|
|
||||||
deluge-gtk
|
|
||||||
Console:
|
|
||||||
deluge-console
|
|
||||||
Web:
|
|
||||||
deluge-web
|
|
||||||
Go to http://localhost:8112/ default-password = "deluge"
|
|
||||||
|
|
||||||
Why is deluge still listed in my system tray even after I close it ?
|
|
||||||
|
|
||||||
You closed the gtk user-interface but you did not close the daemon. Choose "Quit & Shutdown Daemon" to close both Daemon and gtk-ui.
|
|
||||||
|
|
||||||
How do I start the daemon?
|
|
||||||
|
|
||||||
deluged
|
|
||||||
|
|
||||||
How do I start the daemon with logging to console?
|
|
||||||
|
|
||||||
deluged -d -L <log level>
|
|
||||||
|
|
||||||
I can't connect to the daemon from another machine
|
|
||||||
|
|
||||||
* Configure the daemon to allow remote connections
|
|
||||||
* Add a user to the auth file located in the config folder: ~/.config/deluge/auth
|
|
||||||
* Restart the daemon.
|
|
||||||
|
|
||||||
I upgraded from 0.5 and plugin x is missing
|
|
||||||
|
|
||||||
1.0 is a rewrite, all old 0.5 plugins have to be rewritten.
|
|
||||||
|
|
||||||
For the full FAQ see: http://dev.deluge-torrent.org/wiki/Faq
|
|
||||||
71
README.md
Normal file
71
README.md
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
# Deluge BitTorrent Client
|
||||||
|
|
||||||
|
[![build-status]][github-ci] [![docs-status]][rtd-deluge]
|
||||||
|
|
||||||
|
Deluge is a BitTorrent client that utilizes a daemon/client model.
|
||||||
|
It has various user interfaces available such as the GTK-UI, Web-UI and
|
||||||
|
Console-UI. It uses [libtorrent][lt] at its core to handle the BitTorrent
|
||||||
|
protocol.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
From [PyPi](https://pypi.org/project/deluge):
|
||||||
|
|
||||||
|
pip install deluge
|
||||||
|
|
||||||
|
with all optional dependencies:
|
||||||
|
|
||||||
|
pip install deluge[all]
|
||||||
|
|
||||||
|
From source code:
|
||||||
|
|
||||||
|
pip install .
|
||||||
|
|
||||||
|
with all optional dependencies:
|
||||||
|
|
||||||
|
pip install .[all]
|
||||||
|
|
||||||
|
See [DEPENDS](DEPENDS.md) and [Installing/Source] for dependency details.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The various user-interfaces and Deluge daemon can be started with the following commands.
|
||||||
|
|
||||||
|
Use the `--help` option for further command options.
|
||||||
|
|
||||||
|
### Gtk UI
|
||||||
|
|
||||||
|
`deluge` or `deluge-gtk`
|
||||||
|
|
||||||
|
### Console UI
|
||||||
|
|
||||||
|
`deluge-console`
|
||||||
|
|
||||||
|
### Web UI
|
||||||
|
|
||||||
|
`deluge-web`
|
||||||
|
|
||||||
|
Open http://localhost:8112 with default password `deluge`.
|
||||||
|
|
||||||
|
### Daemon
|
||||||
|
|
||||||
|
`deluged`
|
||||||
|
|
||||||
|
See the [Thinclient guide] to connect to the daemon from another computer.
|
||||||
|
|
||||||
|
## Contact
|
||||||
|
|
||||||
|
- [Homepage](https://deluge-torrent.org)
|
||||||
|
- [User guide][user guide]
|
||||||
|
- [Forum](https://forum.deluge-torrent.org)
|
||||||
|
- [IRC Libera.Chat #deluge](irc://irc.libera.chat/deluge)
|
||||||
|
- [Discord](https://discord.gg/nwaHSE6tqn)
|
||||||
|
|
||||||
|
[user guide]: https://dev.deluge-torrent.org/wiki/UserGuide
|
||||||
|
[thinclient guide]: https://dev.deluge-torrent.org/wiki/UserGuide/ThinClient
|
||||||
|
[installing/source]: https://dev.deluge-torrent.org/wiki/Installing/Source
|
||||||
|
[build-status]: https://github.com/deluge-torrent/deluge/actions/workflows/ci.yml/badge.svg?branch=develop "CI"
|
||||||
|
[github-ci]: https://github.com/deluge-torrent/deluge/actions/workflows/ci.yml
|
||||||
|
[docs-status]: https://readthedocs.org/projects/deluge/badge/?version=latest
|
||||||
|
[rtd-deluge]: https://deluge.readthedocs.io/en/latest/?badge=latest "Documentation Status"
|
||||||
|
[lt]: https://libtorrent.org
|
||||||
@ -1,21 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Fixes glade files which may have set gtk stock labels set to translatable
|
|
||||||
for x in `find . -name '*.glade' |grep -v '.git\|build'` ; do \
|
|
||||||
for y in gtk-add gtk-apply gtk-bold gtk-cancel gtk-cdrom gtk-clear \
|
|
||||||
gtk-close gtk-color-picker gtk-connect gtk-convert gtk-copy gtk-cut \
|
|
||||||
gtk-delete gtk-dialog-error gtk-dialog-info gtk-dialog-question \
|
|
||||||
gtk-dialog-warning gtk-dnd gtk-dnd-multiple gtk-edit gtk-execute gtk-find \
|
|
||||||
gtk-find-and-replace gtk-floppy gtk-goto-bottom gtk-goto-first \
|
|
||||||
gtk-goto-last gtk-goto-top gtk-go-back gtk-go-down gtk-go-forward \
|
|
||||||
gtk-go-up gtk-help gtk-home gtk-index gtk-italic gtk-jump-to \
|
|
||||||
gtk-justify-center gtk-justify-fill gtk-justify-left gtk-missing-image \
|
|
||||||
gtk-new gtk-no gtk-ok gtk-open gtk-paste gtk-preferences gtk-print \
|
|
||||||
gtk-print-preview gtk-properties gtk-quit gtk-redo gtk-refresh \
|
|
||||||
gtk-remove gtk-revert-to-saved gtk-save gtk-save-as gtk-select-color \
|
|
||||||
gtk-select-font gtk-sort-descending gtk-spell-check gtk-stop \
|
|
||||||
gtk-strikethrough gtk-undelete gtk-underline gtk-undo gtk-yes \
|
|
||||||
gtk-zoom-100 gtk-zoom-fit gtk-zoom-in gtk-zoom-out; do \
|
|
||||||
sed -i "s/<property\ name\=\"label\"\ translatable\=\"yes\">$y<\/property>/<property\ name\=\"label\"\ translatable\=\"no\">$y<\/property>/g" $x; \
|
|
||||||
done;\
|
|
||||||
done
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
# Paths to exclude
|
|
||||||
EXCLUSIONS = [
|
|
||||||
"deluge/scripts",
|
|
||||||
"deluge/i18n",
|
|
||||||
]
|
|
||||||
|
|
||||||
POTFILE_IN = "deluge/i18n/POTFILES.in"
|
|
||||||
|
|
||||||
pattern = "deluge\/plugins\/.*\/build"
|
|
||||||
compiled = re.compile(pattern)
|
|
||||||
|
|
||||||
sys.stdout.write("Creating " + POTFILE_IN + " ... ")
|
|
||||||
sys.stdout.flush()
|
|
||||||
to_translate = []
|
|
||||||
for (dirpath, dirnames, filenames) in os.walk("deluge"):
|
|
||||||
for filename in filenames:
|
|
||||||
if os.path.splitext(filename)[1] in (".py", ".glade", ".in") \
|
|
||||||
and dirpath not in EXCLUSIONS \
|
|
||||||
and not compiled.match(dirpath):
|
|
||||||
to_translate.append(os.path.join(dirpath, filename))
|
|
||||||
|
|
||||||
f = open(POTFILE_IN, "wb")
|
|
||||||
for line in to_translate:
|
|
||||||
f.write(line + "\n")
|
|
||||||
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
print "Done"
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
for size in 16 22 24 32 36 48 64 72 96 128 192 256; do mkdir -p deluge/ui/data/\
|
|
||||||
icons/hicolor/${size}x${size}/apps; rsvg-convert -w ${size} -h ${size} \
|
|
||||||
-o deluge/ui/data/icons/hicolor/${size}x${size}/apps/deluge.png deluge/ui/data/pixmaps\
|
|
||||||
/deluge.svg; mkdir -p deluge/ui/data/icons/scalable/apps/; cp deluge/ui/data/pixmaps/\
|
|
||||||
deluge.svg deluge/ui/data/icons/scalable/apps/deluge.svg; done
|
|
||||||
@ -1,4 +1 @@
|
|||||||
"""Deluge"""
|
"""Deluge"""
|
||||||
# this is a namespace package
|
|
||||||
import pkg_resources
|
|
||||||
pkg_resources.declare_namespace(__name__)
|
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
from new import classobj
|
|
||||||
from deluge.core.core import Core
|
|
||||||
from deluge.core.daemon import Daemon
|
|
||||||
|
|
||||||
class RpcApi:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def scan_for_methods(obj):
|
|
||||||
methods = {
|
|
||||||
'__doc__': 'Methods available in %s' % obj.__name__.lower()
|
|
||||||
}
|
|
||||||
for d in dir(obj):
|
|
||||||
if not hasattr(getattr(obj,d), '_rpcserver_export'):
|
|
||||||
continue
|
|
||||||
methods[d] = getattr(obj, d)
|
|
||||||
cobj = classobj(obj.__name__.lower(), (object,), methods)
|
|
||||||
setattr(RpcApi, obj.__name__.lower(), cobj)
|
|
||||||
|
|
||||||
scan_for_methods(Core)
|
|
||||||
scan_for_methods(Daemon)
|
|
||||||
@ -1,60 +1,35 @@
|
|||||||
#
|
#
|
||||||
# _libtorrent.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module is used to handle the importing of libtorrent.
|
This module is used to handle the importing of libtorrent and also controls
|
||||||
|
the minimum versions of libtorrent that this version of Deluge supports.
|
||||||
|
|
||||||
We use this module to control what versions of libtorrent this version of Deluge
|
Example:
|
||||||
supports.
|
>>> from deluge._libtorrent import lt
|
||||||
|
|
||||||
** Usage **
|
|
||||||
|
|
||||||
>>> from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from deluge.common import VersionSplit, get_version
|
||||||
REQUIRED_VERSION = "0.14.9.0"
|
from deluge.error import LibtorrentImportError
|
||||||
|
|
||||||
def check_version(LT):
|
|
||||||
from deluge.common import VersionSplit
|
|
||||||
if VersionSplit(lt.version) < VersionSplit(REQUIRED_VERSION):
|
|
||||||
raise ImportError("This version of Deluge requires libtorrent >=%s!" % REQUIRED_VERSION)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import deluge.libtorrent as lt
|
import deluge.libtorrent as lt
|
||||||
check_version(lt)
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import libtorrent as lt
|
try:
|
||||||
check_version(lt)
|
import libtorrent as lt
|
||||||
|
except ImportError as ex:
|
||||||
|
raise LibtorrentImportError('No libtorrent library found: %s' % (ex))
|
||||||
|
|
||||||
|
|
||||||
|
REQUIRED_VERSION = '1.2.0.0'
|
||||||
|
LT_VERSION = lt.__version__
|
||||||
|
|
||||||
|
if VersionSplit(LT_VERSION) < VersionSplit(REQUIRED_VERSION):
|
||||||
|
raise LibtorrentImportError(
|
||||||
|
f'Deluge {get_version()} requires libtorrent >= {REQUIRED_VERSION}'
|
||||||
|
)
|
||||||
|
|||||||
384
deluge/argparserbase.py
Normal file
384
deluge/argparserbase.py
Normal file
@ -0,0 +1,384 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||||
|
#
|
||||||
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
|
# See LICENSE for more details.
|
||||||
|
#
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
import deluge.log
|
||||||
|
from deluge import common
|
||||||
|
from deluge.configmanager import get_config_dir, set_config_dir
|
||||||
|
|
||||||
|
|
||||||
|
def find_subcommand(self, args=None, sys_argv=True):
|
||||||
|
"""Find if a subcommand has been supplied.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
args (list, optional): The argument list to search through.
|
||||||
|
sys_argv (bool): Use sys.argv[1:] if args is None.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
int: Index of the subcommand or '-1' if none found.
|
||||||
|
|
||||||
|
"""
|
||||||
|
subcommand_found = -1
|
||||||
|
if args is None:
|
||||||
|
args = sys.argv[1:] if sys_argv is None else []
|
||||||
|
|
||||||
|
for x in self._subparsers._actions:
|
||||||
|
if not isinstance(x, argparse._SubParsersAction):
|
||||||
|
continue
|
||||||
|
for sp_name in x._name_parser_map:
|
||||||
|
if sp_name in args:
|
||||||
|
subcommand_found = args.index(sp_name)
|
||||||
|
|
||||||
|
return subcommand_found
|
||||||
|
|
||||||
|
|
||||||
|
def set_default_subparser(self, name, abort_opts=None):
|
||||||
|
"""Sets the default argparse subparser.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name (str): The name of the default subparser.
|
||||||
|
abort_opts (list): The arguments to test for in case no subcommand is found.
|
||||||
|
If any of the values are found, the default subparser will
|
||||||
|
not be inserted into sys.argv.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
list: The arguments found in sys.argv if no subcommand found, else None
|
||||||
|
|
||||||
|
"""
|
||||||
|
found_abort_opts = []
|
||||||
|
abort_opts = [] if abort_opts is None else abort_opts
|
||||||
|
test_args = sys.argv[1:]
|
||||||
|
subparser_found = self.find_subcommand(args=test_args)
|
||||||
|
|
||||||
|
for i, arg in enumerate(test_args):
|
||||||
|
if subparser_found == i:
|
||||||
|
break
|
||||||
|
if arg in abort_opts:
|
||||||
|
found_abort_opts.append(arg)
|
||||||
|
|
||||||
|
if subparser_found == -1:
|
||||||
|
if found_abort_opts:
|
||||||
|
# Found one or more of arguments in abort_opts
|
||||||
|
return found_abort_opts
|
||||||
|
|
||||||
|
# insert default in first position, this implies no
|
||||||
|
# global options without a sub_parsers specified
|
||||||
|
sys.argv.insert(1, name)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
argparse.ArgumentParser.find_subcommand = find_subcommand
|
||||||
|
argparse.ArgumentParser.set_default_subparser = set_default_subparser
|
||||||
|
|
||||||
|
|
||||||
|
def _get_version_detail():
|
||||||
|
version_str = '%s\n' % (common.get_version())
|
||||||
|
try:
|
||||||
|
from deluge._libtorrent import LT_VERSION
|
||||||
|
|
||||||
|
version_str += 'libtorrent: %s\n' % LT_VERSION
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
version_str += 'Python: %s\n' % platform.python_version()
|
||||||
|
version_str += f'OS: {platform.system()} {common.get_os_version()}\n'
|
||||||
|
return version_str
|
||||||
|
|
||||||
|
|
||||||
|
class DelugeTextHelpFormatter(argparse.RawDescriptionHelpFormatter):
|
||||||
|
"""Help message formatter which retains formatting of all help text."""
|
||||||
|
|
||||||
|
def _split_lines(self, text, width):
|
||||||
|
"""
|
||||||
|
Do not remove whitespaces in string but still wrap text to max width.
|
||||||
|
Instead of passing the entire text to textwrap.wrap, split and pass each
|
||||||
|
line instead. This way list formatting is not mangled by textwrap.wrap.
|
||||||
|
"""
|
||||||
|
wrapped_lines = []
|
||||||
|
for line in text.splitlines():
|
||||||
|
wrapped_lines.extend(textwrap.wrap(line, width, subsequent_indent=' '))
|
||||||
|
return wrapped_lines
|
||||||
|
|
||||||
|
def _format_action_invocation(self, action):
|
||||||
|
"""
|
||||||
|
Combines the options with comma and displays the argument
|
||||||
|
value only once instead of after both options.
|
||||||
|
Instead of: -s <arg>, --long-opt <arg>
|
||||||
|
Show : -s, --long-opt <arg>
|
||||||
|
|
||||||
|
"""
|
||||||
|
if not action.option_strings:
|
||||||
|
(metavar,) = self._metavar_formatter(action, action.dest)(1)
|
||||||
|
return metavar
|
||||||
|
else:
|
||||||
|
parts = []
|
||||||
|
# if the Optional doesn't take a value, format is:
|
||||||
|
# -s, --long
|
||||||
|
if action.nargs == 0:
|
||||||
|
parts.extend(action.option_strings)
|
||||||
|
|
||||||
|
# if the Optional takes a value, format is:
|
||||||
|
# -s, --long ARGS
|
||||||
|
else:
|
||||||
|
default = action.dest.upper()
|
||||||
|
args_string = self._format_args(action, default)
|
||||||
|
opt = ', '.join(action.option_strings)
|
||||||
|
parts.append(f'{opt} {args_string}')
|
||||||
|
return ', '.join(parts)
|
||||||
|
|
||||||
|
|
||||||
|
class HelpAction(argparse._HelpAction):
|
||||||
|
def __call__(self, parser, namespace, values, option_string=None):
|
||||||
|
if hasattr(parser, 'subparser'):
|
||||||
|
subparser = getattr(parser, 'subparser')
|
||||||
|
subparser.print_help()
|
||||||
|
else:
|
||||||
|
parser.print_help()
|
||||||
|
parser.exit()
|
||||||
|
|
||||||
|
|
||||||
|
class ArgParserBase(argparse.ArgumentParser):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if 'formatter_class' not in kwargs:
|
||||||
|
kwargs['formatter_class'] = lambda prog: DelugeTextHelpFormatter(
|
||||||
|
prog, max_help_position=33, width=90
|
||||||
|
)
|
||||||
|
|
||||||
|
kwargs['add_help'] = kwargs.get('add_help', False)
|
||||||
|
common_help = kwargs.pop('common_help', True)
|
||||||
|
self.log_stream = sys.stdout
|
||||||
|
if 'log_stream' in kwargs:
|
||||||
|
self.log_stream = kwargs['log_stream']
|
||||||
|
del kwargs['log_stream']
|
||||||
|
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
self.common_setup = False
|
||||||
|
self.process_arg_group = False
|
||||||
|
self.group = self.add_argument_group(_('Common Options'))
|
||||||
|
if common_help:
|
||||||
|
self.group.add_argument(
|
||||||
|
'-h', '--help', action=HelpAction, help=_('Print this help message')
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'-V',
|
||||||
|
'--version',
|
||||||
|
action='version',
|
||||||
|
version='%(prog)s ' + _get_version_detail(),
|
||||||
|
help=_('Print version information'),
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'-v',
|
||||||
|
action='version',
|
||||||
|
version='%(prog)s ' + _get_version_detail(),
|
||||||
|
help=argparse.SUPPRESS,
|
||||||
|
) # Deprecated arg
|
||||||
|
self.group.add_argument(
|
||||||
|
'-c',
|
||||||
|
'--config',
|
||||||
|
metavar='<config>',
|
||||||
|
help=_('Set the config directory path'),
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'-l',
|
||||||
|
'--logfile',
|
||||||
|
metavar='<logfile>',
|
||||||
|
help=_('Output to specified logfile instead of stdout'),
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'-L',
|
||||||
|
'--loglevel',
|
||||||
|
choices=[level for k in deluge.log.levels for level in (k, k.upper())],
|
||||||
|
help=_('Set the log level (none, error, warning, info, debug)'),
|
||||||
|
metavar='<level>',
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'--logrotate',
|
||||||
|
nargs='?',
|
||||||
|
const='2M',
|
||||||
|
metavar='<max-size>',
|
||||||
|
help=_(
|
||||||
|
'Enable logfile rotation, with optional maximum logfile size, '
|
||||||
|
'default: %(const)s (Logfile rotation count is 5)'
|
||||||
|
),
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'-q',
|
||||||
|
'--quiet',
|
||||||
|
action='store_true',
|
||||||
|
help=_('Quieten logging output (Same as `--loglevel none`)'),
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'--profile',
|
||||||
|
metavar='<profile-file>',
|
||||||
|
nargs='?',
|
||||||
|
default=False,
|
||||||
|
help=_(
|
||||||
|
'Profile %(prog)s with cProfile. Outputs to stdout '
|
||||||
|
'unless a filename is specified'
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
def parse_args(self, args=None):
|
||||||
|
"""Parse UI arguments and handle common and process group options.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
Unknown arguments results in usage text printed and system exit.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
args (list, optional): The arguments to parse.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
argparse.Namespace: The parsed arguments.
|
||||||
|
|
||||||
|
"""
|
||||||
|
options = super().parse_args(args=args)
|
||||||
|
return self._handle_ui_options(options)
|
||||||
|
|
||||||
|
def parse_known_ui_args(self, args, withhold=None):
|
||||||
|
"""Parse UI arguments and handle common and process group options without error.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
args (list): The arguments to parse.
|
||||||
|
withhold (list): Values to ignore in the args list.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
argparse.Namespace: The parsed arguments.
|
||||||
|
|
||||||
|
"""
|
||||||
|
if withhold:
|
||||||
|
args = [a for a in args if a not in withhold]
|
||||||
|
options, remaining = super().parse_known_args(args=args)
|
||||||
|
options.remaining = remaining
|
||||||
|
# Handle common and process group options
|
||||||
|
return self._handle_ui_options(options)
|
||||||
|
|
||||||
|
def _handle_ui_options(self, options):
|
||||||
|
"""Handle UI common and process group options.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
options (argparse.Namespace): The parsed options.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
argparse.Namespace: The parsed options.
|
||||||
|
|
||||||
|
"""
|
||||||
|
if not self.common_setup:
|
||||||
|
self.common_setup = True
|
||||||
|
|
||||||
|
# Setup the logger
|
||||||
|
if options.quiet:
|
||||||
|
options.loglevel = 'none'
|
||||||
|
if options.loglevel:
|
||||||
|
options.loglevel = options.loglevel.lower()
|
||||||
|
|
||||||
|
logfile_mode = 'w'
|
||||||
|
logrotate = options.logrotate
|
||||||
|
if options.logrotate:
|
||||||
|
logfile_mode = 'a'
|
||||||
|
logrotate = common.parse_human_size(options.logrotate)
|
||||||
|
|
||||||
|
# Setup the logger
|
||||||
|
deluge.log.setup_logger(
|
||||||
|
level=options.loglevel,
|
||||||
|
filename=options.logfile,
|
||||||
|
filemode=logfile_mode,
|
||||||
|
logrotate=logrotate,
|
||||||
|
output_stream=self.log_stream,
|
||||||
|
)
|
||||||
|
|
||||||
|
if options.config:
|
||||||
|
if not set_config_dir(options.config):
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
log.error('There was an error setting the config dir! Exiting..')
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
if not os.path.exists(common.get_default_config_dir()):
|
||||||
|
os.makedirs(common.get_default_config_dir())
|
||||||
|
|
||||||
|
if self.process_arg_group:
|
||||||
|
self.process_arg_group = False
|
||||||
|
# If donotdaemonize is set, skip process forking.
|
||||||
|
if not (common.windows_check() or options.donotdaemonize):
|
||||||
|
if os.fork():
|
||||||
|
os._exit(0)
|
||||||
|
os.setsid()
|
||||||
|
# Do second fork
|
||||||
|
if os.fork():
|
||||||
|
os._exit(0)
|
||||||
|
# Ensure process doesn't keep any directory in use that may prevent a filesystem unmount.
|
||||||
|
os.chdir(get_config_dir())
|
||||||
|
|
||||||
|
# Write pid file before chuid
|
||||||
|
if options.pidfile:
|
||||||
|
with open(options.pidfile, 'w') as _file:
|
||||||
|
_file.write('%d\n' % os.getpid())
|
||||||
|
|
||||||
|
if not common.windows_check():
|
||||||
|
if options.group:
|
||||||
|
if not options.group.isdigit():
|
||||||
|
import grp
|
||||||
|
|
||||||
|
options.group = grp.getgrnam(options.group)[2]
|
||||||
|
os.setgid(options.group)
|
||||||
|
if options.user:
|
||||||
|
if not options.user.isdigit():
|
||||||
|
import pwd
|
||||||
|
|
||||||
|
options.user = pwd.getpwnam(options.user)[2]
|
||||||
|
os.setuid(options.user)
|
||||||
|
|
||||||
|
return options
|
||||||
|
|
||||||
|
def add_process_arg_group(self):
|
||||||
|
"""Adds a grouping of common process args to control a daemon to the parser"""
|
||||||
|
|
||||||
|
self.process_arg_group = True
|
||||||
|
self.group = self.add_argument_group(_('Process Control Options'))
|
||||||
|
self.group.add_argument(
|
||||||
|
'-P',
|
||||||
|
'--pidfile',
|
||||||
|
metavar='<pidfile>',
|
||||||
|
action='store',
|
||||||
|
help=_('Pidfile to store the process id'),
|
||||||
|
)
|
||||||
|
if not common.windows_check():
|
||||||
|
self.group.add_argument(
|
||||||
|
'-d',
|
||||||
|
'--do-not-daemonize',
|
||||||
|
dest='donotdaemonize',
|
||||||
|
action='store_true',
|
||||||
|
help=_('Do not daemonize (fork) this process'),
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'-f',
|
||||||
|
'--fork',
|
||||||
|
dest='donotdaemonize',
|
||||||
|
action='store_false',
|
||||||
|
help=argparse.SUPPRESS,
|
||||||
|
) # Deprecated arg
|
||||||
|
self.group.add_argument(
|
||||||
|
'-U',
|
||||||
|
'--user',
|
||||||
|
metavar='<user>',
|
||||||
|
action='store',
|
||||||
|
help=_('Change to this user on startup (Requires root)'),
|
||||||
|
)
|
||||||
|
self.group.add_argument(
|
||||||
|
'-g',
|
||||||
|
'--group',
|
||||||
|
metavar='<group>',
|
||||||
|
action='store',
|
||||||
|
help=_('Change to this group on startup (Requires root)'),
|
||||||
|
)
|
||||||
@ -9,121 +9,140 @@
|
|||||||
# License.
|
# License.
|
||||||
|
|
||||||
# Written by Petru Paler
|
# Written by Petru Paler
|
||||||
|
# Updated by Calum Lind to support Python 3.
|
||||||
|
|
||||||
|
|
||||||
|
class BTFailure(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
DICT_DELIM = b'd'
|
||||||
|
END_DELIM = b'e'
|
||||||
|
INT_DELIM = b'i'
|
||||||
|
LIST_DELIM = b'l'
|
||||||
|
BYTE_SEP = b':'
|
||||||
|
|
||||||
# Minor modifications made by Andrew Resch to replace the BTFailure errors with Exceptions
|
|
||||||
|
|
||||||
def decode_int(x, f):
|
def decode_int(x, f):
|
||||||
f += 1
|
f += 1
|
||||||
newf = x.index('e', f)
|
newf = x.index(END_DELIM, f)
|
||||||
n = int(x[f:newf])
|
n = int(x[f:newf])
|
||||||
if x[f] == '-':
|
if x[f : f + 1] == b'-' and x[f + 1 : f + 2] == b'0':
|
||||||
if x[f + 1] == '0':
|
|
||||||
raise ValueError
|
|
||||||
elif x[f] == '0' and newf != f+1:
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
return (n, newf+1)
|
elif x[f : f + 1] == b'0' and newf != f + 1:
|
||||||
|
raise ValueError
|
||||||
|
return (n, newf + 1)
|
||||||
|
|
||||||
|
|
||||||
def decode_string(x, f):
|
def decode_string(x, f):
|
||||||
colon = x.index(':', f)
|
colon = x.index(BYTE_SEP, f)
|
||||||
n = int(x[f:colon])
|
n = int(x[f:colon])
|
||||||
if x[f] == '0' and colon != f+1:
|
if x[f : f + 1] == b'0' and colon != f + 1:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
colon += 1
|
colon += 1
|
||||||
return (x[colon:colon+n], colon+n)
|
return (x[colon : colon + n], colon + n)
|
||||||
|
|
||||||
|
|
||||||
def decode_list(x, f):
|
def decode_list(x, f):
|
||||||
r, f = [], f+1
|
r, f = [], f + 1
|
||||||
while x[f] != 'e':
|
while x[f : f + 1] != END_DELIM:
|
||||||
v, f = decode_func[x[f]](x, f)
|
v, f = decode_func[x[f : f + 1]](x, f)
|
||||||
r.append(v)
|
r.append(v)
|
||||||
return (r, f + 1)
|
return (r, f + 1)
|
||||||
|
|
||||||
|
|
||||||
def decode_dict(x, f):
|
def decode_dict(x, f):
|
||||||
r, f = {}, f+1
|
r, f = {}, f + 1
|
||||||
while x[f] != 'e':
|
while x[f : f + 1] != END_DELIM:
|
||||||
k, f = decode_string(x, f)
|
k, f = decode_string(x, f)
|
||||||
r[k], f = decode_func[x[f]](x, f)
|
r[k], f = decode_func[x[f : f + 1]](x, f)
|
||||||
return (r, f + 1)
|
return (r, f + 1)
|
||||||
|
|
||||||
|
|
||||||
decode_func = {}
|
decode_func = {}
|
||||||
decode_func['l'] = decode_list
|
decode_func[LIST_DELIM] = decode_list
|
||||||
decode_func['d'] = decode_dict
|
decode_func[DICT_DELIM] = decode_dict
|
||||||
decode_func['i'] = decode_int
|
decode_func[INT_DELIM] = decode_int
|
||||||
decode_func['0'] = decode_string
|
decode_func[b'0'] = decode_string
|
||||||
decode_func['1'] = decode_string
|
decode_func[b'1'] = decode_string
|
||||||
decode_func['2'] = decode_string
|
decode_func[b'2'] = decode_string
|
||||||
decode_func['3'] = decode_string
|
decode_func[b'3'] = decode_string
|
||||||
decode_func['4'] = decode_string
|
decode_func[b'4'] = decode_string
|
||||||
decode_func['5'] = decode_string
|
decode_func[b'5'] = decode_string
|
||||||
decode_func['6'] = decode_string
|
decode_func[b'6'] = decode_string
|
||||||
decode_func['7'] = decode_string
|
decode_func[b'7'] = decode_string
|
||||||
decode_func['8'] = decode_string
|
decode_func[b'8'] = decode_string
|
||||||
decode_func['9'] = decode_string
|
decode_func[b'9'] = decode_string
|
||||||
|
|
||||||
|
|
||||||
def bdecode(x):
|
def bdecode(x):
|
||||||
try:
|
try:
|
||||||
r, l = decode_func[x[0]](x, 0)
|
r, __ = decode_func[x[0:1]](x, 0)
|
||||||
except (IndexError, KeyError, ValueError):
|
except (LookupError, TypeError, ValueError):
|
||||||
raise Exception("not a valid bencoded string")
|
raise BTFailure('Not a valid bencoded string')
|
||||||
|
else:
|
||||||
return r
|
return r
|
||||||
|
|
||||||
from types import StringType, IntType, LongType, DictType, ListType, TupleType
|
|
||||||
|
|
||||||
|
|
||||||
class Bencached(object):
|
class Bencached:
|
||||||
|
|
||||||
__slots__ = ['bencoded']
|
__slots__ = ['bencoded']
|
||||||
|
|
||||||
def __init__(self, s):
|
def __init__(self, s):
|
||||||
self.bencoded = s
|
self.bencoded = s
|
||||||
|
|
||||||
def encode_bencached(x,r):
|
|
||||||
|
def encode_bencached(x, r):
|
||||||
r.append(x.bencoded)
|
r.append(x.bencoded)
|
||||||
|
|
||||||
|
|
||||||
def encode_int(x, r):
|
def encode_int(x, r):
|
||||||
r.extend(('i', str(x), 'e'))
|
r.extend((INT_DELIM, str(x).encode('utf8'), END_DELIM))
|
||||||
|
|
||||||
|
|
||||||
def encode_bool(x, r):
|
def encode_bool(x, r):
|
||||||
if x:
|
encode_int(1 if x else 0, r)
|
||||||
encode_int(1, r)
|
|
||||||
else:
|
|
||||||
encode_int(0, r)
|
|
||||||
|
|
||||||
def encode_string(x, r):
|
def encode_string(x, r):
|
||||||
r.extend((str(len(x)), ':', x))
|
encode_bytes(x.encode('utf8'), r)
|
||||||
|
|
||||||
|
|
||||||
|
def encode_bytes(x, r):
|
||||||
|
r.extend((str(len(x)).encode('utf8'), BYTE_SEP, x))
|
||||||
|
|
||||||
|
|
||||||
def encode_list(x, r):
|
def encode_list(x, r):
|
||||||
r.append('l')
|
r.append(LIST_DELIM)
|
||||||
for i in x:
|
for i in x:
|
||||||
encode_func[type(i)](i, r)
|
encode_func[type(i)](i, r)
|
||||||
r.append('e')
|
r.append(END_DELIM)
|
||||||
|
|
||||||
def encode_dict(x,r):
|
|
||||||
r.append('d')
|
def encode_dict(x, r):
|
||||||
ilist = x.items()
|
r.append(DICT_DELIM)
|
||||||
ilist.sort()
|
for k, v in sorted(x.items()):
|
||||||
for k, v in ilist:
|
try:
|
||||||
r.extend((str(len(k)), ':', k))
|
k = k.encode('utf8')
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
r.extend((str(len(k)).encode('utf8'), BYTE_SEP, k))
|
||||||
encode_func[type(v)](v, r)
|
encode_func[type(v)](v, r)
|
||||||
r.append('e')
|
r.append(END_DELIM)
|
||||||
|
|
||||||
|
|
||||||
encode_func = {}
|
encode_func = {}
|
||||||
encode_func[Bencached] = encode_bencached
|
encode_func[Bencached] = encode_bencached
|
||||||
encode_func[IntType] = encode_int
|
encode_func[int] = encode_int
|
||||||
encode_func[LongType] = encode_int
|
encode_func[list] = encode_list
|
||||||
encode_func[StringType] = encode_string
|
encode_func[tuple] = encode_list
|
||||||
encode_func[ListType] = encode_list
|
encode_func[dict] = encode_dict
|
||||||
encode_func[TupleType] = encode_list
|
encode_func[bool] = encode_bool
|
||||||
encode_func[DictType] = encode_dict
|
encode_func[str] = encode_string
|
||||||
|
encode_func[bytes] = encode_bytes
|
||||||
|
|
||||||
try:
|
|
||||||
from types import BooleanType
|
|
||||||
encode_func[BooleanType] = encode_bool
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def bencode(x):
|
def bencode(x):
|
||||||
r = []
|
r = []
|
||||||
encode_func[type(x)](x, r)
|
encode_func[type(x)](x, r)
|
||||||
return ''.join(r)
|
return b''.join(r)
|
||||||
|
|||||||
1558
deluge/common.py
1558
deluge/common.py
File diff suppressed because it is too large
Load Diff
@ -1,50 +1,49 @@
|
|||||||
#
|
#
|
||||||
# component.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007-2010 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2010 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from twisted.internet.defer import maybeDeferred, succeed, DeferredList, fail
|
import traceback
|
||||||
from twisted.internet.task import LoopingCall
|
from collections import defaultdict
|
||||||
|
|
||||||
|
from twisted.internet import reactor
|
||||||
|
from twisted.internet.defer import DeferredList, fail, maybeDeferred, succeed
|
||||||
|
from twisted.internet.task import LoopingCall, deferLater
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ComponentAlreadyRegistered(Exception):
|
class ComponentAlreadyRegistered(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Component(object):
|
|
||||||
"""
|
class ComponentException(Exception):
|
||||||
Component objects are singletons managed by the :class:`ComponentRegistry`.
|
def __init__(self, message, tb):
|
||||||
|
super().__init__(message)
|
||||||
|
self.message = message
|
||||||
|
self.tb = tb
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
s = super().__str__()
|
||||||
|
return '{}\n{}'.format(s, ''.join(self.tb))
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if isinstance(other, self.__class__):
|
||||||
|
return self.message == other.message
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
return not self.__eq__(other)
|
||||||
|
|
||||||
|
|
||||||
|
class Component:
|
||||||
|
"""Component objects are singletons managed by the :class:`ComponentRegistry`.
|
||||||
|
|
||||||
When a new Component object is instantiated, it will be automatically
|
When a new Component object is instantiated, it will be automatically
|
||||||
registered with the :class:`ComponentRegistry`.
|
registered with the :class:`ComponentRegistry`.
|
||||||
|
|
||||||
@ -88,11 +87,20 @@ class Component(object):
|
|||||||
still be considered in a Started state.
|
still be considered in a Started state.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name, interval=1, depend=None):
|
def __init__(self, name, interval=1, depend=None):
|
||||||
|
"""Initialize component.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name (str): Name of component.
|
||||||
|
interval (int, optional): The interval in seconds to call the update function.
|
||||||
|
depend (list, optional): The names of components this component depends on.
|
||||||
|
|
||||||
|
"""
|
||||||
self._component_name = name
|
self._component_name = name
|
||||||
self._component_interval = interval
|
self._component_interval = interval
|
||||||
self._component_depend = depend
|
self._component_depend = depend
|
||||||
self._component_state = "Stopped"
|
self._component_state = 'Stopped'
|
||||||
self._component_timer = None
|
self._component_timer = None
|
||||||
self._component_starting_deferred = None
|
self._component_starting_deferred = None
|
||||||
self._component_stopping_deferred = None
|
self._component_stopping_deferred = None
|
||||||
@ -101,59 +109,64 @@ class Component(object):
|
|||||||
def __del__(self):
|
def __del__(self):
|
||||||
if _ComponentRegistry:
|
if _ComponentRegistry:
|
||||||
_ComponentRegistry.deregister(self)
|
_ComponentRegistry.deregister(self)
|
||||||
|
|
||||||
def _component_start_timer(self):
|
def _component_start_timer(self):
|
||||||
if hasattr(self, "update"):
|
if hasattr(self, 'update'):
|
||||||
self._component_timer = LoopingCall(self.update)
|
self._component_timer = LoopingCall(self.update)
|
||||||
self._component_timer.start(self._component_interval)
|
self._component_timer.start(self._component_interval)
|
||||||
|
|
||||||
def _component_start(self):
|
def _component_start(self):
|
||||||
def on_start(result):
|
def on_start(result):
|
||||||
self._component_state = "Started"
|
self._component_state = 'Started'
|
||||||
self._component_starting_deferred = None
|
self._component_starting_deferred = None
|
||||||
self._component_start_timer()
|
self._component_start_timer()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_start_fail(result):
|
def on_start_fail(result):
|
||||||
self._component_state = "Stopped"
|
self._component_state = 'Stopped'
|
||||||
self._component_starting_deferred = None
|
self._component_starting_deferred = None
|
||||||
log.error(result)
|
log.error(result)
|
||||||
return result
|
return fail(result)
|
||||||
|
|
||||||
if self._component_state == "Stopped":
|
if self._component_state == 'Stopped':
|
||||||
if hasattr(self, "start"):
|
if hasattr(self, 'start'):
|
||||||
self._component_state = "Starting"
|
self._component_state = 'Starting'
|
||||||
d = maybeDeferred(self.start)
|
d = deferLater(reactor, 0, self.start)
|
||||||
d.addCallback(on_start)
|
d.addCallbacks(on_start, on_start_fail)
|
||||||
d.addErrback(on_start_fail)
|
|
||||||
self._component_starting_deferred = d
|
self._component_starting_deferred = d
|
||||||
else:
|
else:
|
||||||
d = maybeDeferred(on_start, None)
|
d = maybeDeferred(on_start, None)
|
||||||
elif self._component_state == "Starting":
|
elif self._component_state == 'Starting':
|
||||||
return self._component_starting_deferred
|
return self._component_starting_deferred
|
||||||
elif self._component_state == "Started":
|
elif self._component_state == 'Started':
|
||||||
d = succeed(True)
|
d = succeed(True)
|
||||||
else:
|
else:
|
||||||
d = fail("Cannot start a component not in a Stopped state!")
|
d = fail(
|
||||||
|
ComponentException(
|
||||||
|
'Trying to start component "%s" but it is '
|
||||||
|
'not in a stopped state. Current state: %s'
|
||||||
|
% (self._component_name, self._component_state),
|
||||||
|
traceback.format_stack(limit=4),
|
||||||
|
)
|
||||||
|
)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def _component_stop(self):
|
def _component_stop(self):
|
||||||
def on_stop(result):
|
def on_stop(result):
|
||||||
self._component_state = "Stopped"
|
self._component_state = 'Stopped'
|
||||||
if self._component_timer and self._component_timer.running:
|
if self._component_timer and self._component_timer.running:
|
||||||
self._component_timer.stop()
|
self._component_timer.stop()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_stop_fail(result):
|
def on_stop_fail(result):
|
||||||
self._component_state = "Started"
|
self._component_state = 'Started'
|
||||||
self._component_stopping_deferred = None
|
self._component_stopping_deferred = None
|
||||||
log.error(result)
|
log.error(result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
if self._component_state != "Stopped" and self._component_state != "Stopping":
|
if self._component_state != 'Stopped' and self._component_state != 'Stopping':
|
||||||
if hasattr(self, "stop"):
|
if hasattr(self, 'stop'):
|
||||||
self._component_state = "Stopping"
|
self._component_state = 'Stopping'
|
||||||
d = maybeDeferred(self.stop)
|
d = maybeDeferred(self.stop)
|
||||||
d.addCallback(on_stop)
|
d.addCallback(on_stop)
|
||||||
d.addErrback(on_stop_fail)
|
d.addErrback(on_stop_fail)
|
||||||
@ -161,43 +174,55 @@ class Component(object):
|
|||||||
else:
|
else:
|
||||||
d = maybeDeferred(on_stop, None)
|
d = maybeDeferred(on_stop, None)
|
||||||
|
|
||||||
if self._component_state == "Stopping":
|
if self._component_state == 'Stopping':
|
||||||
return self._component_stopping_deferred
|
return self._component_stopping_deferred
|
||||||
|
|
||||||
return succeed(None)
|
return succeed(None)
|
||||||
|
|
||||||
def _component_pause(self):
|
def _component_pause(self):
|
||||||
def on_pause(result):
|
def on_pause(result):
|
||||||
self._component_state = "Paused"
|
self._component_state = 'Paused'
|
||||||
|
|
||||||
if self._component_state == "Started":
|
if self._component_state == 'Started':
|
||||||
if self._component_timer and self._component_timer.running:
|
if self._component_timer and self._component_timer.running:
|
||||||
d = maybeDeferred(self._component_timer.stop)
|
d = maybeDeferred(self._component_timer.stop)
|
||||||
d.addCallback(on_pause)
|
d.addCallback(on_pause)
|
||||||
else:
|
else:
|
||||||
d = succeed(None)
|
d = succeed(None)
|
||||||
elif self._component_state == "Paused":
|
elif self._component_state == 'Paused':
|
||||||
d = succeed(None)
|
d = succeed(None)
|
||||||
else:
|
else:
|
||||||
d = fail("Cannot pause a component in a non-Started state!")
|
d = fail(
|
||||||
|
ComponentException(
|
||||||
|
'Trying to pause component "%s" but it is '
|
||||||
|
'not in a started state. Current state: %s'
|
||||||
|
% (self._component_name, self._component_state),
|
||||||
|
traceback.format_stack(limit=4),
|
||||||
|
)
|
||||||
|
)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def _component_resume(self):
|
def _component_resume(self):
|
||||||
def on_resume(result):
|
def on_resume(result):
|
||||||
self._component_state = "Started"
|
self._component_state = 'Started'
|
||||||
|
|
||||||
if self._component_state == "Paused":
|
if self._component_state == 'Paused':
|
||||||
d = maybeDeferred(self._component_start_timer)
|
d = maybeDeferred(self._component_start_timer)
|
||||||
d.addCallback(on_resume)
|
d.addCallback(on_resume)
|
||||||
else:
|
else:
|
||||||
d = fail("Component cannot be resumed from a non-Paused state!")
|
d = fail(
|
||||||
|
ComponentException(
|
||||||
|
'Trying to resume component "%s" but it is '
|
||||||
|
'not in a paused state. Current state: %s'
|
||||||
|
% (self._component_name, self._component_state),
|
||||||
|
traceback.format_stack(limit=4),
|
||||||
|
)
|
||||||
|
)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def _component_shutdown(self):
|
def _component_shutdown(self):
|
||||||
def on_stop(result):
|
def on_stop(result):
|
||||||
if hasattr(self, "shutdown"):
|
if hasattr(self, 'shutdown'):
|
||||||
return maybeDeferred(self.shutdown)
|
return maybeDeferred(self.shutdown)
|
||||||
return succeed(None)
|
return succeed(None)
|
||||||
|
|
||||||
@ -205,69 +230,97 @@ class Component(object):
|
|||||||
d.addCallback(on_stop)
|
d.addCallback(on_stop)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
class ComponentRegistry(object):
|
def get_state(self):
|
||||||
"""
|
return self._component_state
|
||||||
The ComponentRegistry holds a list of currently registered
|
|
||||||
:class:`Component` objects. It is used to manage the Components by
|
def start(self):
|
||||||
starting, stopping, pausing and shutting them down.
|
pass
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ComponentRegistry:
|
||||||
|
"""The ComponentRegistry holds a list of currently registered :class:`Component` objects.
|
||||||
|
|
||||||
|
It is used to manage the Components by starting, stopping, pausing and shutting them down.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.components = {}
|
self.components = {}
|
||||||
|
# Stores all of the components that are dependent on a particular component
|
||||||
|
self.dependents = defaultdict(list)
|
||||||
|
|
||||||
def register(self, obj):
|
def register(self, obj):
|
||||||
"""
|
"""Register a component object with the registry.
|
||||||
Registers a component object with the registry. This is done
|
|
||||||
automatically when a Component object is instantiated.
|
|
||||||
|
|
||||||
:param obj: the Component object
|
Note:
|
||||||
:type obj: object
|
This is done automatically when a Component object is instantiated.
|
||||||
|
|
||||||
:raises ComponentAlreadyRegistered: if a component with the same name is already registered.
|
Args:
|
||||||
|
obj (Component): A component object to register.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ComponentAlreadyRegistered: If a component with the same name is already registered.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
name = obj._component_name
|
name = obj._component_name
|
||||||
if name in self.components:
|
if name in self.components:
|
||||||
raise ComponentAlreadyRegistered(
|
raise ComponentAlreadyRegistered(
|
||||||
"Component already registered with name %s" % name)
|
'Component already registered with name %s' % name
|
||||||
|
)
|
||||||
|
|
||||||
self.components[obj._component_name] = obj
|
self.components[obj._component_name] = obj
|
||||||
|
if obj._component_depend:
|
||||||
|
for depend in obj._component_depend:
|
||||||
|
self.dependents[depend].append(name)
|
||||||
|
|
||||||
def deregister(self, obj):
|
def deregister(self, obj):
|
||||||
"""
|
"""Deregister a component from the registry. A stop will be
|
||||||
Deregisters a component from the registry. A stop will be
|
|
||||||
issued to the component prior to deregistering it.
|
issued to the component prior to deregistering it.
|
||||||
|
|
||||||
:param obj: the Component object
|
Args:
|
||||||
:type obj: object
|
obj (Component): a component object to deregister
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred: a deferred object that will fire once the Component has been
|
||||||
|
successfully deregistered
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if obj in self.components.values():
|
if obj in self.components.values():
|
||||||
log.debug("Deregistering Component: %s", obj._component_name)
|
log.debug('Deregistering Component: %s', obj._component_name)
|
||||||
d = self.stop([obj._component_name])
|
d = self.stop([obj._component_name])
|
||||||
|
|
||||||
def on_stop(result, name):
|
def on_stop(result, name):
|
||||||
del self.components[name]
|
# Component may have been removed, so pop to ensure it doesn't fail
|
||||||
|
self.components.pop(name, None)
|
||||||
|
|
||||||
return d.addCallback(on_stop, obj._component_name)
|
return d.addCallback(on_stop, obj._component_name)
|
||||||
else:
|
else:
|
||||||
return succeed(None)
|
return succeed(None)
|
||||||
|
|
||||||
def start(self, names=[]):
|
def start(self, names=None):
|
||||||
"""
|
"""Start Components, and their dependencies, that are currently in a Stopped state.
|
||||||
Starts Components that are currently in a Stopped state and their
|
|
||||||
dependencies. If *names* is specified, will only start those
|
|
||||||
Components and their dependencies and if not it will start all
|
|
||||||
registered components.
|
|
||||||
|
|
||||||
:param names: a list of Components to start
|
Note:
|
||||||
:type names: list
|
If no names are specified then all registered components will be started.
|
||||||
|
|
||||||
:returns: a Deferred object that will fire once all Components have been sucessfully started
|
Args:
|
||||||
:rtype: twisted.internet.defer.Deferred
|
names (list): A list of Components to start and their dependencies.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred: Fired once all Components have been successfully started.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Start all the components if names is empty
|
# Start all the components if names is empty
|
||||||
if not names:
|
if not names:
|
||||||
names = self.components.keys()
|
names = list(self.components)
|
||||||
elif isinstance(names, str):
|
elif isinstance(names, str):
|
||||||
names = [names]
|
names = [names]
|
||||||
|
|
||||||
@ -287,109 +340,124 @@ class ComponentRegistry(object):
|
|||||||
|
|
||||||
return DeferredList(deferreds)
|
return DeferredList(deferreds)
|
||||||
|
|
||||||
def stop(self, names=[]):
|
def stop(self, names=None):
|
||||||
"""
|
"""Stop Components that are currently not in a Stopped state.
|
||||||
Stops Components that are currently not in a Stopped state. If
|
|
||||||
*names* is specified, then it will only stop those Components,
|
|
||||||
and if not it will stop all the registered Components.
|
|
||||||
|
|
||||||
:param names: a list of Components to start
|
Note:
|
||||||
:type names: list
|
If no names are specified then all registered components will be stopped.
|
||||||
|
|
||||||
:returns: a Deferred object that will fire once all Components have been sucessfully stopped
|
Args:
|
||||||
:rtype: twisted.internet.defer.Deferred
|
names (list): A list of Components to stop.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred: Fired once all Components have been successfully stopped.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not names:
|
if not names:
|
||||||
names = self.components.keys()
|
names = list(self.components)
|
||||||
elif isinstance(names, str):
|
elif isinstance(names, str):
|
||||||
names = [names]
|
names = [names]
|
||||||
|
|
||||||
|
def on_dependents_stopped(result, name):
|
||||||
|
return self.components[name]._component_stop()
|
||||||
|
|
||||||
|
stopped_in_deferred = set()
|
||||||
deferreds = []
|
deferreds = []
|
||||||
|
|
||||||
for name in names:
|
for name in names:
|
||||||
|
if name in stopped_in_deferred:
|
||||||
|
continue
|
||||||
if name in self.components:
|
if name in self.components:
|
||||||
deferreds.append(self.components[name]._component_stop())
|
if name in self.dependents:
|
||||||
|
# If other components depend on this component, stop them first
|
||||||
|
d = self.stop(self.dependents[name]).addCallback(
|
||||||
|
on_dependents_stopped, name
|
||||||
|
)
|
||||||
|
deferreds.append(d)
|
||||||
|
stopped_in_deferred.update(self.dependents[name])
|
||||||
|
else:
|
||||||
|
deferreds.append(self.components[name]._component_stop())
|
||||||
|
|
||||||
return DeferredList(deferreds)
|
return DeferredList(deferreds)
|
||||||
|
|
||||||
def pause(self, names=[]):
|
def pause(self, names=None):
|
||||||
"""
|
"""Pause Components that are currently in a Started state.
|
||||||
Pauses Components that are currently in a Started state. If
|
|
||||||
*names* is specified, then it will only pause those Components,
|
|
||||||
and if not it will pause all the registered Components.
|
|
||||||
|
|
||||||
:param names: a list of Components to pause
|
Note:
|
||||||
:type names: list
|
If no names are specified then all registered components will be paused.
|
||||||
|
|
||||||
:returns: a Deferred object that will fire once all Components have been sucessfully paused
|
Args:
|
||||||
:rtype: twisted.internet.defer.Deferred
|
names (list): A list of Components to pause.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred: Fired once all Components have been successfully paused.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not names:
|
if not names:
|
||||||
names = self.components.keys()
|
names = list(self.components)
|
||||||
elif isinstance(names, str):
|
elif isinstance(names, str):
|
||||||
names = [names]
|
names = [names]
|
||||||
|
|
||||||
deferreds = []
|
deferreds = []
|
||||||
|
|
||||||
for name in names:
|
for name in names:
|
||||||
if self.components[name]._component_state == "Started":
|
if self.components[name]._component_state == 'Started':
|
||||||
deferreds.append(self.components[name]._component_pause())
|
deferreds.append(self.components[name]._component_pause())
|
||||||
|
|
||||||
return DeferredList(deferreds)
|
return DeferredList(deferreds)
|
||||||
|
|
||||||
def resume(self, names=[]):
|
def resume(self, names=None):
|
||||||
"""
|
"""Resume Components that are currently in a Paused state.
|
||||||
Resumes Components that are currently in a Paused state. If
|
|
||||||
*names* is specified, then it will only resume those Components,
|
|
||||||
and if not it will resume all the registered Components.
|
|
||||||
|
|
||||||
:param names: a list of Components to resume
|
Note:
|
||||||
:type names: list
|
If no names are specified then all registered components will be resumed.
|
||||||
|
|
||||||
:returns: a Deferred object that will fire once all Components have been sucessfully resumed
|
Args:
|
||||||
:rtype: twisted.internet.defer.Deferred
|
names (list): A list of Components to to resume.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred: Fired once all Components have been successfully resumed.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not names:
|
if not names:
|
||||||
names = self.components.keys()
|
names = list(self.components)
|
||||||
elif isinstance(names, str):
|
elif isinstance(names, str):
|
||||||
names = [names]
|
names = [names]
|
||||||
|
|
||||||
deferreds = []
|
deferreds = []
|
||||||
|
|
||||||
for name in names:
|
for name in names:
|
||||||
if self.components[name]._component_state == "Paused":
|
if self.components[name]._component_state == 'Paused':
|
||||||
deferreds.append(self.components[name]._component_resume())
|
deferreds.append(self.components[name]._component_resume())
|
||||||
|
|
||||||
return DeferredList(deferreds)
|
return DeferredList(deferreds)
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
"""
|
"""Shutdown all Components regardless of state.
|
||||||
Shutdowns all Components regardless of state. This will call
|
|
||||||
:meth:`stop` on call the components prior to shutting down. This should
|
|
||||||
be called when the program is exiting to ensure all Components have a
|
|
||||||
chance to properly shutdown.
|
|
||||||
|
|
||||||
:returns: a Deferred object that will fire once all Components have been sucessfully resumed
|
This will call stop() on all the components prior to shutting down. This should be called
|
||||||
:rtype: twisted.internet.defer.Deferred
|
when the program is exiting to ensure all Components have a chance to properly shutdown.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred: Fired once all Components have been successfully shut down.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
deferreds = []
|
|
||||||
|
|
||||||
for component in self.components.values():
|
def on_stopped(result):
|
||||||
deferreds.append(component._component_shutdown())
|
return DeferredList(
|
||||||
|
[comp._component_shutdown() for comp in list(self.components.values())]
|
||||||
|
)
|
||||||
|
|
||||||
return DeferredList(deferreds)
|
return self.stop(list(self.components)).addCallback(on_stopped)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""
|
"""Update all Components that are in a Started state."""
|
||||||
Updates all Components that are in a Started state.
|
|
||||||
|
|
||||||
"""
|
|
||||||
for component in self.components.items():
|
for component in self.components.items():
|
||||||
component.update()
|
try:
|
||||||
|
component.update()
|
||||||
|
except BaseException as ex:
|
||||||
|
log.exception(ex)
|
||||||
|
|
||||||
|
|
||||||
_ComponentRegistry = ComponentRegistry()
|
_ComponentRegistry = ComponentRegistry()
|
||||||
|
|
||||||
@ -401,17 +469,18 @@ resume = _ComponentRegistry.resume
|
|||||||
update = _ComponentRegistry.update
|
update = _ComponentRegistry.update
|
||||||
shutdown = _ComponentRegistry.shutdown
|
shutdown = _ComponentRegistry.shutdown
|
||||||
|
|
||||||
|
|
||||||
def get(name):
|
def get(name):
|
||||||
"""
|
"""Return a reference to a component.
|
||||||
Return a reference to a component.
|
|
||||||
|
|
||||||
:param name: the Component name to get
|
Args:
|
||||||
:type name: string
|
name (str): The Component name to get.
|
||||||
|
|
||||||
:returns: the Component object
|
Returns:
|
||||||
:rtype: object
|
Component: The Component object.
|
||||||
|
|
||||||
:raises KeyError: if the Component does not exist
|
Raises:
|
||||||
|
KeyError: If the Component does not exist.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return _ComponentRegistry.components[name]
|
return _ComponentRegistry.components[name]
|
||||||
|
|||||||
590
deluge/config.py
590
deluge/config.py
@ -1,38 +1,10 @@
|
|||||||
#
|
#
|
||||||
# config.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
|
# See LICENSE for more details.
|
||||||
#
|
#
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Deluge Config Module
|
Deluge Config Module
|
||||||
@ -66,207 +38,247 @@ this can only be done for the 'config file version' and not for the 'format'
|
|||||||
version as this will be done internally.
|
version as this will be done internally.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
import json
|
||||||
import cPickle as pickle
|
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
|
||||||
import os
|
import os
|
||||||
|
import pickle
|
||||||
|
import shutil
|
||||||
|
from codecs import getwriter
|
||||||
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
import deluge.common
|
from deluge.common import JSON_FORMAT, get_default_config_dir
|
||||||
|
|
||||||
json = deluge.common.json
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
def prop(func):
|
|
||||||
"""Function decorator for defining property attributes
|
|
||||||
|
|
||||||
The decorated function is expected to return a dictionary
|
def find_json_objects(text, decoder=json.JSONDecoder()):
|
||||||
containing one or more of the following pairs:
|
"""Find json objects in text.
|
||||||
fget - function for getting attribute value
|
|
||||||
fset - function for setting attribute value
|
|
||||||
fdel - function for deleting attribute
|
|
||||||
This can be conveniently constructed by the locals() builtin
|
|
||||||
function; see:
|
|
||||||
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/205183
|
|
||||||
"""
|
|
||||||
return property(doc=func.__doc__, **func())
|
|
||||||
|
|
||||||
def find_json_objects(s):
|
Args:
|
||||||
"""
|
text (str): The text to find json objects within.
|
||||||
Find json objects in a string.
|
|
||||||
|
|
||||||
:param s: the string to find json objects in
|
Returns:
|
||||||
:type s: string
|
list: A list of tuples containing start and end locations of json
|
||||||
|
objects in the text. e.g. [(start, end), ...]
|
||||||
|
|
||||||
:returns: a list of tuples containing start and end locations of json objects in the string `s`
|
|
||||||
:rtype: [(start, end), ...]
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
objects = []
|
objects = []
|
||||||
opens = 0
|
offset = 0
|
||||||
start = s.find("{")
|
while True:
|
||||||
offset = start
|
try:
|
||||||
|
start = text.index('{', offset)
|
||||||
|
except ValueError:
|
||||||
|
break
|
||||||
|
|
||||||
if start < 0:
|
try:
|
||||||
return []
|
__, index = decoder.raw_decode(text[start:])
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
for index, c in enumerate(s[offset:]):
|
offset = start + 1
|
||||||
if c == "{":
|
else:
|
||||||
opens += 1
|
offset = start + index
|
||||||
elif c == "}":
|
objects.append((start, offset))
|
||||||
opens -= 1
|
|
||||||
if opens == 0:
|
|
||||||
objects.append((start, index+offset+1))
|
|
||||||
start = index + offset + 1
|
|
||||||
|
|
||||||
return objects
|
return objects
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
def cast_to_existing_type(value, old_value):
|
||||||
"""
|
"""Attempt to convert new value type to match old value type"""
|
||||||
This class is used to access/create/modify config files
|
types_match = isinstance(old_value, (type(None), type(value)))
|
||||||
|
if value is not None and not types_match:
|
||||||
|
old_type = type(old_value)
|
||||||
|
# Skip convert to bytes since requires knowledge of encoding and value should
|
||||||
|
# be unicode anyway.
|
||||||
|
if old_type is bytes:
|
||||||
|
return value
|
||||||
|
|
||||||
:param filename: the name of the config file
|
return old_type(value)
|
||||||
:param defaults: dictionary of default values
|
|
||||||
:param config_dir: the path to the config directory
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""This class is used to access/create/modify config files.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
filename (str): The config filename.
|
||||||
|
defaults (dict): The default config values to insert before loading the config file.
|
||||||
|
config_dir (str): the path to the config directory.
|
||||||
|
file_version (int): The file format for the default config values when creating
|
||||||
|
a fresh config. This value should be increased whenever a new migration function is
|
||||||
|
setup to convert old config files. (default: 1)
|
||||||
|
log_mask_funcs (dict): A dict of key:function, used to mask sensitive
|
||||||
|
key values (e.g. passwords) when logging is enabled.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, filename, defaults=None, config_dir=None):
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
filename,
|
||||||
|
defaults=None,
|
||||||
|
config_dir=None,
|
||||||
|
file_version=1,
|
||||||
|
log_mask_funcs=None,
|
||||||
|
):
|
||||||
self.__config = {}
|
self.__config = {}
|
||||||
self.__set_functions = {}
|
self.__set_functions = {}
|
||||||
self.__change_callbacks = []
|
self.__change_callbacks = []
|
||||||
|
self.__log_mask_funcs = log_mask_funcs if log_mask_funcs else {}
|
||||||
|
|
||||||
# These hold the version numbers and they will be set when loaded
|
# These hold the version numbers and they will be set when loaded
|
||||||
self.__version = {
|
self.__version = {'format': 1, 'file': file_version}
|
||||||
"format": 1,
|
|
||||||
"file": 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# This will get set with a reactor.callLater whenever a config option
|
# This will get set with a reactor.callLater whenever a config option
|
||||||
# is set.
|
# is set.
|
||||||
self._save_timer = None
|
self._save_timer = None
|
||||||
|
|
||||||
if defaults:
|
if defaults:
|
||||||
for key, value in defaults.iteritems():
|
for key, value in defaults.items():
|
||||||
self.set_item(key, value)
|
self.set_item(key, value, default=True)
|
||||||
|
|
||||||
# Load the config from file in the config_dir
|
# Load the config from file in the config_dir
|
||||||
if config_dir:
|
if config_dir:
|
||||||
self.__config_file = os.path.join(config_dir, filename)
|
self.__config_file = os.path.join(config_dir, filename)
|
||||||
else:
|
else:
|
||||||
self.__config_file = deluge.common.get_default_config_dir(filename)
|
self.__config_file = get_default_config_dir(filename)
|
||||||
|
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
|
def callLater(self, period, func, *args, **kwargs): # noqa: N802 ignore camelCase
|
||||||
|
"""Wrapper around reactor.callLater for test purpose."""
|
||||||
|
from twisted.internet import reactor
|
||||||
|
|
||||||
|
return reactor.callLater(period, func, *args, **kwargs)
|
||||||
|
|
||||||
def __contains__(self, item):
|
def __contains__(self, item):
|
||||||
return item in self.__config
|
return item in self.__config
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
"""
|
"""See set_item"""
|
||||||
See
|
|
||||||
:meth:`set_item`
|
|
||||||
"""
|
|
||||||
|
|
||||||
return self.set_item(key, value)
|
return self.set_item(key, value)
|
||||||
|
|
||||||
def set_item(self, key, value):
|
def set_item(self, key, value, default=False):
|
||||||
"""
|
"""Sets item 'key' to 'value' in the config dictionary.
|
||||||
Sets item 'key' to 'value' in the config dictionary, but does not allow
|
|
||||||
changing the item's type unless it is None. If the types do not match,
|
|
||||||
it will attempt to convert it to the set type before raising a ValueError.
|
|
||||||
|
|
||||||
:param key: string, item to change to change
|
Does not allow changing the item's type unless it is None.
|
||||||
:param value: the value to change item to, must be same type as what is currently in the config
|
|
||||||
|
|
||||||
:raises ValueError: raised when the type of value is not the same as\
|
If the types do not match, it will attempt to convert it to the
|
||||||
what is currently in the config and it could not convert the value
|
set type before raising a ValueError.
|
||||||
|
|
||||||
**Usage**
|
Args:
|
||||||
|
key (str): Item to change to change.
|
||||||
|
value (any): The value to change item to, must be same type as what is
|
||||||
|
currently in the config.
|
||||||
|
default (optional, bool): When setting a default value skip func or save
|
||||||
|
callbacks.
|
||||||
|
|
||||||
>>> config = Config("test.conf")
|
Raises:
|
||||||
>>> config["test"] = 5
|
ValueError: Raised when the type of value is not the same as what is
|
||||||
>>> config["test"]
|
currently in the config and it could not convert the value.
|
||||||
5
|
|
||||||
|
Examples:
|
||||||
|
>>> config = Config('test.conf')
|
||||||
|
>>> config['test'] = 5
|
||||||
|
>>> config['test']
|
||||||
|
5
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, bytes):
|
||||||
value = deluge.common.utf8_encoded(value)
|
value = value.decode()
|
||||||
|
|
||||||
|
if key in self.__config:
|
||||||
if not self.__config.has_key(key):
|
|
||||||
self.__config[key] = value
|
|
||||||
log.debug("Setting '%s' to %s of %s", key, value, type(value))
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.__config[key] == value:
|
|
||||||
return
|
|
||||||
|
|
||||||
# Do not allow the type to change unless it is None
|
|
||||||
oldtype, newtype = type(self.__config[key]), type(value)
|
|
||||||
|
|
||||||
if value is not None and oldtype != type(None) and oldtype != newtype:
|
|
||||||
try:
|
try:
|
||||||
if oldtype == unicode:
|
value = cast_to_existing_type(value, self.__config[key])
|
||||||
value = oldtype(value, "utf8")
|
|
||||||
else:
|
|
||||||
value = oldtype(value)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
log.warning("Type '%s' invalid for '%s'", newtype, key)
|
log.warning('Value Type "%s" invalid for key: %s', type(value), key)
|
||||||
raise
|
raise
|
||||||
|
else:
|
||||||
|
if self.__config[key] == value:
|
||||||
|
return
|
||||||
|
|
||||||
log.debug("Setting '%s' to %s of %s", key, value, type(value))
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
|
if key in self.__log_mask_funcs:
|
||||||
|
value = self.__log_mask_funcs[key](value)
|
||||||
|
log.debug(
|
||||||
|
'Setting key "%s" to: %s (of type: %s)',
|
||||||
|
key,
|
||||||
|
value,
|
||||||
|
type(value),
|
||||||
|
)
|
||||||
self.__config[key] = value
|
self.__config[key] = value
|
||||||
|
|
||||||
|
# Skip save or func callbacks if setting default value for keys
|
||||||
|
if default:
|
||||||
|
return
|
||||||
|
|
||||||
# Run the set_function for this key if any
|
# Run the set_function for this key if any
|
||||||
from twisted.internet import reactor
|
for func in self.__set_functions.get(key, []):
|
||||||
try:
|
self.callLater(0, func, key, value)
|
||||||
for func in self.__set_functions[key]:
|
|
||||||
reactor.callLater(0, func, key, value)
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
def do_change_callbacks(key, value):
|
def do_change_callbacks(key, value):
|
||||||
for func in self.__change_callbacks:
|
for func in self.__change_callbacks:
|
||||||
func(key, value)
|
func(key, value)
|
||||||
reactor.callLater(0, do_change_callbacks, key, value)
|
|
||||||
except:
|
self.callLater(0, do_change_callbacks, key, value)
|
||||||
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# We set the save_timer for 5 seconds if not already set
|
# We set the save_timer for 5 seconds if not already set
|
||||||
if not self._save_timer or not self._save_timer.active():
|
if not self._save_timer or not self._save_timer.active():
|
||||||
self._save_timer = reactor.callLater(5, self.save)
|
self._save_timer = self.callLater(5, self.save)
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
"""
|
"""See get_item"""
|
||||||
See
|
|
||||||
:meth:`get_item`
|
|
||||||
"""
|
|
||||||
return self.get_item(key)
|
return self.get_item(key)
|
||||||
|
|
||||||
def get_item(self, key):
|
def get_item(self, key):
|
||||||
"""
|
"""Gets the value of item 'key'.
|
||||||
Gets the value of item 'key'
|
|
||||||
|
|
||||||
:param key: the item for which you want it's value
|
Args:
|
||||||
:return: the value of item 'key'
|
key (str): The item for which you want it's value.
|
||||||
|
|
||||||
:raises KeyError: if 'key' is not in the config dictionary
|
Returns:
|
||||||
|
any: The value of item 'key'.
|
||||||
|
|
||||||
**Usage**
|
Raises:
|
||||||
|
ValueError: If 'key' is not in the config dictionary.
|
||||||
|
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
Examples:
|
||||||
>>> config["test"]
|
>>> config = Config('test.conf', defaults={'test': 5})
|
||||||
5
|
>>> config['test']
|
||||||
|
5
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if isinstance(self.__config[key], str):
|
return self.__config[key]
|
||||||
try:
|
|
||||||
return self.__config[key].decode("utf8")
|
def get(self, key, default=None):
|
||||||
except UnicodeDecodeError:
|
"""Gets the value of item 'key' if key is in the config, else default.
|
||||||
return self.__config[key]
|
|
||||||
else:
|
If default is not given, it defaults to None, so that this method
|
||||||
return self.__config[key]
|
never raises a KeyError.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (str): the item for which you want it's value
|
||||||
|
default (any): the default value if key is missing
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
any: The value of item 'key' or default.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
>>> config = Config('test.conf', defaults={'test': 5})
|
||||||
|
>>> config.get('test', 10)
|
||||||
|
5
|
||||||
|
>>> config.get('bad_key', 10)
|
||||||
|
10
|
||||||
|
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
return self.get_item(key)
|
||||||
|
except KeyError:
|
||||||
|
return default
|
||||||
|
|
||||||
def __delitem__(self, key):
|
def __delitem__(self, key):
|
||||||
"""
|
"""
|
||||||
@ -276,59 +288,62 @@ what is currently in the config and it could not convert the value
|
|||||||
self.del_item(key)
|
self.del_item(key)
|
||||||
|
|
||||||
def del_item(self, key):
|
def del_item(self, key):
|
||||||
"""
|
"""Deletes item with a specific key from the configuration.
|
||||||
Deletes item with a specific key from the configuration.
|
|
||||||
|
|
||||||
:param key: the item which you wish to delete.
|
Args:
|
||||||
:raises KeyError: if 'key' is not in the config dictionary
|
key (str): The item which you wish to delete.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: If 'key' is not in the config dictionary.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
>>> config = Config('test.conf', defaults={'test': 5})
|
||||||
|
>>> del config['test']
|
||||||
|
|
||||||
**Usage**
|
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
|
||||||
>>> del config["test"]
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
del self.__config[key]
|
del self.__config[key]
|
||||||
# We set the save_timer for 5 seconds if not already set
|
|
||||||
from twisted.internet import reactor
|
|
||||||
if not self._save_timer or not self._save_timer.active():
|
|
||||||
self._save_timer = reactor.callLater(5, self.save)
|
|
||||||
|
|
||||||
|
# We set the save_timer for 5 seconds if not already set
|
||||||
|
if not self._save_timer or not self._save_timer.active():
|
||||||
|
self._save_timer = self.callLater(5, self.save)
|
||||||
|
|
||||||
def register_change_callback(self, callback):
|
def register_change_callback(self, callback):
|
||||||
"""
|
"""Registers a callback function for any changed value.
|
||||||
Registers a callback function that will be called when a value is changed in the config dictionary
|
|
||||||
|
|
||||||
:param callback: the function, callback(key, value)
|
Will be called when any value is changed in the config dictionary.
|
||||||
|
|
||||||
**Usage**
|
Args:
|
||||||
|
callback (func): The function to call with parameters: f(key, value).
|
||||||
|
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
Examples:
|
||||||
>>> def cb(key, value):
|
>>> config = Config('test.conf', defaults={'test': 5})
|
||||||
... print key, value
|
>>> def cb(key, value):
|
||||||
...
|
... print key, value
|
||||||
>>> config.register_change_callback(cb)
|
...
|
||||||
|
>>> config.register_change_callback(cb)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.__change_callbacks.append(callback)
|
self.__change_callbacks.append(callback)
|
||||||
|
|
||||||
def register_set_function(self, key, function, apply_now=True):
|
def register_set_function(self, key, function, apply_now=True):
|
||||||
"""
|
"""Register a function to be called when a config value changes.
|
||||||
Register a function to be called when a config value changes
|
|
||||||
|
|
||||||
:param key: the item to monitor for change
|
Args:
|
||||||
:param function: the function to call when the value changes, f(key, value)
|
key (str): The item to monitor for change.
|
||||||
:keyword apply_now: if True, the function will be called after it's registered
|
function (func): The function to call when the value changes, f(key, value).
|
||||||
|
apply_now (bool): If True, the function will be called immediately after it's registered.
|
||||||
|
|
||||||
**Usage**
|
Examples:
|
||||||
|
>>> config = Config('test.conf', defaults={'test': 5})
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
>>> def cb(key, value):
|
||||||
>>> def cb(key, value):
|
... print key, value
|
||||||
... print key, value
|
...
|
||||||
...
|
>>> config.register_set_function('test', cb, apply_now=True)
|
||||||
>>> config.register_set_function("test", cb, apply_now=True)
|
test 5
|
||||||
test 5
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
log.debug("Registering function for %s key..", key)
|
log.debug('Registering function for %s key..', key)
|
||||||
if key not in self.__set_functions:
|
if key not in self.__set_functions:
|
||||||
self.__set_functions[key] = []
|
self.__set_functions[key] = []
|
||||||
|
|
||||||
@ -337,55 +352,52 @@ what is currently in the config and it could not convert the value
|
|||||||
# Run the function now if apply_now is set
|
# Run the function now if apply_now is set
|
||||||
if apply_now:
|
if apply_now:
|
||||||
function(key, self.__config[key])
|
function(key, self.__config[key])
|
||||||
return
|
|
||||||
|
|
||||||
def apply_all(self):
|
def apply_all(self):
|
||||||
"""
|
"""Calls all set functions.
|
||||||
Calls all set functions
|
|
||||||
|
|
||||||
**Usage**
|
Examples:
|
||||||
|
>>> config = Config('test.conf', defaults={'test': 5})
|
||||||
>>> config = Config("test.conf", defaults={"test": 5})
|
>>> def cb(key, value):
|
||||||
>>> def cb(key, value):
|
... print key, value
|
||||||
... print key, value
|
...
|
||||||
...
|
>>> config.register_set_function('test', cb, apply_now=False)
|
||||||
>>> config.register_set_function("test", cb, apply_now=False)
|
>>> config.apply_all()
|
||||||
>>> config.apply_all()
|
test 5
|
||||||
test 5
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
log.debug("Calling all set functions..")
|
log.debug('Calling all set functions..')
|
||||||
for key, value in self.__set_functions.iteritems():
|
for key, value in self.__set_functions.items():
|
||||||
for func in value:
|
for func in value:
|
||||||
func(key, self.__config[key])
|
func(key, self.__config[key])
|
||||||
|
|
||||||
def apply_set_functions(self, key):
|
def apply_set_functions(self, key):
|
||||||
"""
|
"""Calls set functions for `:param:key`.
|
||||||
Calls set functions for `:param:key`.
|
|
||||||
|
|
||||||
:param key: str, the config key
|
Args:
|
||||||
|
key (str): the config key
|
||||||
|
|
||||||
"""
|
"""
|
||||||
log.debug("Calling set functions for key %s..", key)
|
log.debug('Calling set functions for key %s..', key)
|
||||||
if key in self.__set_functions:
|
if key in self.__set_functions:
|
||||||
for func in self.__set_functions[key]:
|
for func in self.__set_functions[key]:
|
||||||
func(key, self.__config[key])
|
func(key, self.__config[key])
|
||||||
|
|
||||||
def load(self, filename=None):
|
def load(self, filename=None):
|
||||||
"""
|
"""Load a config file.
|
||||||
Load a config file
|
|
||||||
|
|
||||||
:param filename: if None, uses filename set in object initialization
|
|
||||||
|
|
||||||
|
Args:
|
||||||
|
filename (str): If None, uses filename set in object initialization
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not filename:
|
if not filename:
|
||||||
filename = self.__config_file
|
filename = self.__config_file
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = open(filename, "rb").read()
|
with open(filename, encoding='utf8') as _file:
|
||||||
except IOError, e:
|
data = _file.read()
|
||||||
log.warning("Unable to open config file %s: %s", filename, e)
|
except OSError as ex:
|
||||||
|
log.warning('Unable to open config file %s: %s', filename, ex)
|
||||||
return
|
return
|
||||||
|
|
||||||
objects = find_json_objects(data)
|
objects = find_json_objects(data)
|
||||||
@ -394,36 +406,54 @@ what is currently in the config and it could not convert the value
|
|||||||
# No json objects found, try depickling it
|
# No json objects found, try depickling it
|
||||||
try:
|
try:
|
||||||
self.__config.update(pickle.loads(data))
|
self.__config.update(pickle.loads(data))
|
||||||
except Exception, e:
|
except Exception as ex:
|
||||||
log.exception(e)
|
log.exception(ex)
|
||||||
log.warning("Unable to load config file: %s", filename)
|
log.warning('Unable to load config file: %s', filename)
|
||||||
elif len(objects) == 1:
|
elif len(objects) == 1:
|
||||||
start, end = objects[0]
|
start, end = objects[0]
|
||||||
try:
|
try:
|
||||||
self.__config.update(json.loads(data[start:end]))
|
self.__config.update(json.loads(data[start:end]))
|
||||||
except Exception, e:
|
except Exception as ex:
|
||||||
log.exception(e)
|
log.exception(ex)
|
||||||
log.warning("Unable to load config file: %s", filename)
|
log.warning('Unable to load config file: %s', filename)
|
||||||
elif len(objects) == 2:
|
elif len(objects) == 2:
|
||||||
try:
|
try:
|
||||||
start, end = objects[0]
|
start, end = objects[0]
|
||||||
self.__version.update(json.loads(data[start:end]))
|
self.__version.update(json.loads(data[start:end]))
|
||||||
start, end = objects[1]
|
start, end = objects[1]
|
||||||
self.__config.update(json.loads(data[start:end]))
|
self.__config.update(json.loads(data[start:end]))
|
||||||
except Exception, e:
|
except Exception as ex:
|
||||||
log.exception(e)
|
log.exception(ex)
|
||||||
log.warning("Unable to load config file: %s", filename)
|
log.warning('Unable to load config file: %s', filename)
|
||||||
|
|
||||||
log.debug("Config %s version: %s.%s loaded: %s", filename,
|
if not log.isEnabledFor(logging.DEBUG):
|
||||||
self.__version["format"], self.__version["file"], self.__config)
|
return
|
||||||
|
|
||||||
|
config = self.__config
|
||||||
|
if self.__log_mask_funcs:
|
||||||
|
config = {
|
||||||
|
key: self.__log_mask_funcs[key](config[key])
|
||||||
|
if key in self.__log_mask_funcs
|
||||||
|
else config[key]
|
||||||
|
for key in config
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug(
|
||||||
|
'Config %s version: %s.%s loaded: %s',
|
||||||
|
filename,
|
||||||
|
self.__version['format'],
|
||||||
|
self.__version['file'],
|
||||||
|
config,
|
||||||
|
)
|
||||||
|
|
||||||
def save(self, filename=None):
|
def save(self, filename=None):
|
||||||
"""
|
"""Save configuration to disk.
|
||||||
Save configuration to disk
|
|
||||||
|
|
||||||
:param filename: if None, uses filename set in object initiliazation
|
Args:
|
||||||
:rtype bool:
|
filename (str): If None, uses filename set in object initialization
|
||||||
:return: whether or not the save succeeded.
|
|
||||||
|
Returns:
|
||||||
|
bool: Whether or not the save succeeded.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not filename:
|
if not filename:
|
||||||
@ -431,7 +461,8 @@ what is currently in the config and it could not convert the value
|
|||||||
# Check to see if the current config differs from the one on disk
|
# Check to see if the current config differs from the one on disk
|
||||||
# We will only write a new config file if there is a difference
|
# We will only write a new config file if there is a difference
|
||||||
try:
|
try:
|
||||||
data = open(filename, "rb").read()
|
with open(filename, encoding='utf8') as _file:
|
||||||
|
data = _file.read()
|
||||||
objects = find_json_objects(data)
|
objects = find_json_objects(data)
|
||||||
start, end = objects[0]
|
start, end = objects[0]
|
||||||
version = json.loads(data[start:end])
|
version = json.loads(data[start:end])
|
||||||
@ -442,36 +473,41 @@ what is currently in the config and it could not convert the value
|
|||||||
if self._save_timer and self._save_timer.active():
|
if self._save_timer and self._save_timer.active():
|
||||||
self._save_timer.cancel()
|
self._save_timer.cancel()
|
||||||
return True
|
return True
|
||||||
except IOError, e:
|
except (OSError, IndexError) as ex:
|
||||||
log.warning("Unable to open config file: %s because: %s", filename, e)
|
log.warning('Unable to open config file: %s because: %s', filename, ex)
|
||||||
|
|
||||||
# Save the new config and make sure it's written to disk
|
# Save the new config and make sure it's written to disk
|
||||||
try:
|
try:
|
||||||
log.debug("Saving new config file %s", filename + ".new")
|
with NamedTemporaryFile(
|
||||||
f = open(filename + ".new", "wb")
|
prefix=os.path.basename(filename) + '.', delete=False
|
||||||
json.dump(self.__version, f, indent=2)
|
) as _file:
|
||||||
json.dump(self.__config, f, indent=2)
|
filename_tmp = _file.name
|
||||||
f.flush()
|
log.debug('Saving new config file %s', filename_tmp)
|
||||||
os.fsync(f.fileno())
|
json.dump(self.__version, getwriter('utf8')(_file), **JSON_FORMAT)
|
||||||
f.close()
|
json.dump(self.__config, getwriter('utf8')(_file), **JSON_FORMAT)
|
||||||
except IOError, e:
|
_file.flush()
|
||||||
log.error("Error writing new config file: %s", e)
|
os.fsync(_file.fileno())
|
||||||
|
except OSError as ex:
|
||||||
|
log.error('Error writing new config file: %s', ex)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Resolve symlinked config files before backing up and saving.
|
||||||
|
filename = os.path.realpath(filename)
|
||||||
|
|
||||||
# Make a backup of the old config
|
# Make a backup of the old config
|
||||||
try:
|
try:
|
||||||
log.debug("Backing up old config file to %s~", filename)
|
log.debug('Backing up old config file to %s.bak', filename)
|
||||||
shutil.move(filename, filename + "~")
|
shutil.move(filename, filename + '.bak')
|
||||||
except Exception, e:
|
except OSError as ex:
|
||||||
log.error("Error backing up old config..")
|
log.warning('Unable to backup old config: %s', ex)
|
||||||
|
|
||||||
# The new config file has been written successfully, so let's move it over
|
# The new config file has been written successfully, so let's move it over
|
||||||
# the existing one.
|
# the existing one.
|
||||||
try:
|
try:
|
||||||
log.debug("Moving new config file %s to %s..", filename + ".new", filename)
|
log.debug('Moving new config file %s to %s', filename_tmp, filename)
|
||||||
shutil.move(filename + ".new", filename)
|
shutil.move(filename_tmp, filename)
|
||||||
except Exception, e:
|
except OSError as ex:
|
||||||
log.error("Error moving new config file: %s", e)
|
log.error('Error moving new config file: %s', ex)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@ -480,47 +516,53 @@ what is currently in the config and it could not convert the value
|
|||||||
self._save_timer.cancel()
|
self._save_timer.cancel()
|
||||||
|
|
||||||
def run_converter(self, input_range, output_version, func):
|
def run_converter(self, input_range, output_version, func):
|
||||||
"""
|
"""Runs a function that will convert file versions.
|
||||||
Runs a function that will convert file versions in the `:param:input_range`
|
|
||||||
to the `:param:output_version`.
|
|
||||||
|
|
||||||
:param input_range: tuple, (int, int) the range of input versions this
|
Args:
|
||||||
function will accept
|
input_range (tuple): (int, int) The range of input versions this function will accept.
|
||||||
:param output_version: int, the version this function will return
|
output_version (int): The version this function will convert to.
|
||||||
:param func: func, the function that will do the conversion, it will take
|
func (func): The function that will do the conversion, it will take the config
|
||||||
the config dict as an argument and return the augmented dict
|
dict as an argument and return the augmented dict.
|
||||||
|
|
||||||
:raises ValueError: if the output_version is less than the input_range
|
Raises:
|
||||||
|
ValueError: If output_version is less than the input_range.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if output_version in input_range or output_version <= max(input_range):
|
if output_version in input_range or output_version <= max(input_range):
|
||||||
raise ValueError("output_version needs to be greater than input_range")
|
raise ValueError('output_version needs to be greater than input_range')
|
||||||
|
|
||||||
if self.__version["file"] not in input_range:
|
if self.__version['file'] not in input_range:
|
||||||
log.debug("File version %s is not in input_range %s, ignoring converter function..",
|
log.debug(
|
||||||
self.__version["file"], input_range)
|
'File version %s is not in input_range %s, ignoring converter function..',
|
||||||
|
self.__version['file'],
|
||||||
|
input_range,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.__config = func(self.__config)
|
self.__config = func(self.__config)
|
||||||
except Exception, e:
|
except Exception as ex:
|
||||||
log.exception(e)
|
log.exception(ex)
|
||||||
log.error("There was an exception try to convert config file %s %s to %s",
|
log.error(
|
||||||
self.__config_file, self.__version["file"], output_version)
|
'There was an exception try to convert config file %s %s to %s',
|
||||||
raise e
|
self.__config_file,
|
||||||
|
self.__version['file'],
|
||||||
|
output_version,
|
||||||
|
)
|
||||||
|
raise ex
|
||||||
else:
|
else:
|
||||||
self.__version["file"] = output_version
|
self.__version['file'] = output_version
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def config_file(self):
|
def config_file(self):
|
||||||
return self.__config_file
|
return self.__config_file
|
||||||
|
|
||||||
@prop
|
@property
|
||||||
def config():
|
def config(self):
|
||||||
"""The config dictionary"""
|
"""The config dictionary"""
|
||||||
def fget(self):
|
return self.__config
|
||||||
return self.__config
|
|
||||||
def fdel(self):
|
@config.deleter
|
||||||
return self.save()
|
def config(self):
|
||||||
return locals()
|
return self.save()
|
||||||
|
|||||||
@ -1,40 +1,13 @@
|
|||||||
#
|
#
|
||||||
# configmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.log
|
import deluge.log
|
||||||
@ -42,9 +15,10 @@ from deluge.config import Config
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class _ConfigManager:
|
class _ConfigManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
log.debug("ConfigManager started..")
|
log.debug('ConfigManager started..')
|
||||||
self.config_files = {}
|
self.config_files = {}
|
||||||
self.__config_directory = None
|
self.__config_directory = None
|
||||||
|
|
||||||
@ -69,16 +43,19 @@ class _ConfigManager:
|
|||||||
if not directory:
|
if not directory:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
log.info("Setting config directory to: %s", directory)
|
# Ensure absolute dirpath
|
||||||
|
directory = os.path.abspath(directory)
|
||||||
|
|
||||||
|
log.info('Setting config directory to: %s', directory)
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
# Try to create the config folder if it doesn't exist
|
# Try to create the config folder if it doesn't exist
|
||||||
try:
|
try:
|
||||||
os.makedirs(directory)
|
os.makedirs(directory)
|
||||||
except Exception, e:
|
except OSError as ex:
|
||||||
log.error("Unable to make config directory: %s", e)
|
log.error('Unable to make config directory: %s', ex)
|
||||||
return False
|
return False
|
||||||
elif not os.path.isdir(directory):
|
elif not os.path.isdir(directory):
|
||||||
log.error("Config directory needs to be a directory!")
|
log.error('Config directory needs to be a directory!')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.__config_directory = directory
|
self.__config_directory = directory
|
||||||
@ -109,30 +86,42 @@ class _ConfigManager:
|
|||||||
# We need to return True to keep the timer active
|
# We need to return True to keep the timer active
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_config(self, config_file, defaults=None):
|
def get_config(self, config_file, defaults=None, file_version=1):
|
||||||
"""Get a reference to the Config object for this filename"""
|
"""Get a reference to the Config object for this filename"""
|
||||||
log.debug("Getting config '%s'", config_file)
|
log.debug('Getting config: %s', config_file)
|
||||||
# Create the config object if not already created
|
# Create the config object if not already created
|
||||||
if config_file not in self.config_files.keys():
|
if config_file not in self.config_files:
|
||||||
self.config_files[config_file] = Config(config_file, defaults, self.config_directory)
|
self.config_files[config_file] = Config(
|
||||||
|
config_file,
|
||||||
|
defaults,
|
||||||
|
config_dir=self.config_directory,
|
||||||
|
file_version=file_version,
|
||||||
|
)
|
||||||
|
|
||||||
return self.config_files[config_file]
|
return self.config_files[config_file]
|
||||||
|
|
||||||
|
|
||||||
# Singleton functions
|
# Singleton functions
|
||||||
_configmanager = _ConfigManager()
|
_configmanager = _ConfigManager()
|
||||||
|
|
||||||
def ConfigManager(config, defaults=None):
|
|
||||||
return _configmanager.get_config(config, defaults)
|
def ConfigManager(config, defaults=None, file_version=1): # NOQA: N802
|
||||||
|
return _configmanager.get_config(
|
||||||
|
config, defaults=defaults, file_version=file_version
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def set_config_dir(directory):
|
def set_config_dir(directory):
|
||||||
"""Sets the config directory, else just uses default"""
|
"""Sets the config directory, else just uses default"""
|
||||||
return _configmanager.set_config_dir(directory)
|
return _configmanager.set_config_dir(deluge.common.decode_bytes(directory))
|
||||||
|
|
||||||
|
|
||||||
def get_config_dir(filename=None):
|
def get_config_dir(filename=None):
|
||||||
if filename != None:
|
if filename is not None:
|
||||||
return os.path.join(_configmanager.get_config_dir(), filename)
|
return os.path.join(_configmanager.get_config_dir(), filename)
|
||||||
else:
|
else:
|
||||||
return _configmanager.get_config_dir()
|
return _configmanager.get_config_dir()
|
||||||
|
|
||||||
|
|
||||||
def close(config):
|
def close(config):
|
||||||
return _configmanager.close(config)
|
return _configmanager.close(config)
|
||||||
|
|||||||
192
deluge/conftest.py
Normal file
192
deluge/conftest.py
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
#
|
||||||
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
|
# See LICENSE for more details.
|
||||||
|
#
|
||||||
|
|
||||||
|
import tempfile
|
||||||
|
import warnings
|
||||||
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
import pytest_twisted
|
||||||
|
from twisted.internet import reactor
|
||||||
|
from twisted.internet.defer import Deferred, maybeDeferred
|
||||||
|
from twisted.internet.error import CannotListenError
|
||||||
|
from twisted.python.failure import Failure
|
||||||
|
|
||||||
|
import deluge.component as _component
|
||||||
|
import deluge.configmanager
|
||||||
|
from deluge.common import get_localhost_auth
|
||||||
|
from deluge.tests import common
|
||||||
|
from deluge.ui.client import client as _client
|
||||||
|
|
||||||
|
DEFAULT_LISTEN_PORT = 58900
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def listen_port(request):
|
||||||
|
if request and 'daemon' in request.fixturenames:
|
||||||
|
try:
|
||||||
|
return request.getfixturevalue('daemon').listen_port
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return DEFAULT_LISTEN_PORT
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def mock_callback():
|
||||||
|
"""Returns a `Mock` object which can be registered as a callback to test against.
|
||||||
|
|
||||||
|
If callback was not called within `timeout` seconds, it will raise a TimeoutError.
|
||||||
|
The returned Mock instance will have a `deferred` attribute which will complete when the callback has been called.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def reset():
|
||||||
|
if mock.called:
|
||||||
|
original_reset_mock()
|
||||||
|
deferred = Deferred()
|
||||||
|
deferred.addTimeout(0.5, reactor)
|
||||||
|
mock.side_effect = lambda *args, **kw: deferred.callback((args, kw))
|
||||||
|
mock.deferred = deferred
|
||||||
|
|
||||||
|
mock = Mock()
|
||||||
|
original_reset_mock = mock.reset_mock
|
||||||
|
mock.reset_mock = reset
|
||||||
|
mock.reset_mock()
|
||||||
|
return mock
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def config_dir(tmp_path):
|
||||||
|
deluge.configmanager.set_config_dir(tmp_path)
|
||||||
|
yield tmp_path
|
||||||
|
|
||||||
|
|
||||||
|
@pytest_twisted.async_yield_fixture()
|
||||||
|
async def client(request, config_dir, monkeypatch, listen_port):
|
||||||
|
# monkeypatch.setattr(
|
||||||
|
# _client, 'connect', functools.partial(_client.connect, port=listen_port)
|
||||||
|
# )
|
||||||
|
try:
|
||||||
|
username, password = get_localhost_auth()
|
||||||
|
except Exception:
|
||||||
|
username, password = '', ''
|
||||||
|
await _client.connect(
|
||||||
|
'localhost',
|
||||||
|
port=listen_port,
|
||||||
|
username=username,
|
||||||
|
password=password,
|
||||||
|
)
|
||||||
|
yield _client
|
||||||
|
if _client.connected():
|
||||||
|
await _client.disconnect()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest_twisted.async_yield_fixture
|
||||||
|
async def daemon(request, config_dir):
|
||||||
|
listen_port = DEFAULT_LISTEN_PORT
|
||||||
|
logfile = f'daemon_{request.node.name}.log'
|
||||||
|
if hasattr(request.cls, 'daemon_custom_script'):
|
||||||
|
custom_script = request.cls.daemon_custom_script
|
||||||
|
else:
|
||||||
|
custom_script = ''
|
||||||
|
|
||||||
|
for dummy in range(10):
|
||||||
|
try:
|
||||||
|
d, daemon = common.start_core(
|
||||||
|
listen_port=listen_port,
|
||||||
|
logfile=logfile,
|
||||||
|
timeout=5,
|
||||||
|
timeout_msg='Timeout!',
|
||||||
|
custom_script=custom_script,
|
||||||
|
print_stdout=True,
|
||||||
|
print_stderr=True,
|
||||||
|
config_directory=config_dir,
|
||||||
|
)
|
||||||
|
await d
|
||||||
|
except CannotListenError as ex:
|
||||||
|
exception_error = ex
|
||||||
|
listen_port += 1
|
||||||
|
except (KeyboardInterrupt, SystemExit):
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise exception_error
|
||||||
|
daemon.listen_port = listen_port
|
||||||
|
yield daemon
|
||||||
|
await daemon.kill()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def common_fixture(config_dir, request, monkeypatch, listen_port):
|
||||||
|
"""Adds some instance attributes to test classes for backwards compatibility with old testing."""
|
||||||
|
|
||||||
|
def fail(self, reason):
|
||||||
|
if isinstance(reason, Failure):
|
||||||
|
reason = reason.value
|
||||||
|
return pytest.fail(str(reason))
|
||||||
|
|
||||||
|
if request.instance:
|
||||||
|
request.instance.patch = monkeypatch.setattr
|
||||||
|
request.instance.config_dir = config_dir
|
||||||
|
request.instance.listen_port = listen_port
|
||||||
|
request.instance.id = lambda: request.node.name
|
||||||
|
request.cls.fail = fail
|
||||||
|
|
||||||
|
|
||||||
|
@pytest_twisted.async_yield_fixture(scope='function')
|
||||||
|
async def component(request):
|
||||||
|
"""Verify component registry is clean, and clean up after test."""
|
||||||
|
if len(_component._ComponentRegistry.components) != 0:
|
||||||
|
warnings.warn(
|
||||||
|
'The component._ComponentRegistry.components is not empty on test setup.\n'
|
||||||
|
'This is probably caused by another test that did not clean up after finishing!: %s'
|
||||||
|
% _component._ComponentRegistry.components
|
||||||
|
)
|
||||||
|
|
||||||
|
yield _component
|
||||||
|
|
||||||
|
await _component.shutdown()
|
||||||
|
_component._ComponentRegistry.components.clear()
|
||||||
|
_component._ComponentRegistry.dependents.clear()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest_twisted.async_yield_fixture(scope='function')
|
||||||
|
async def base_fixture(common_fixture, component, request):
|
||||||
|
"""This fixture is autoused on all tests that subclass BaseTestCase"""
|
||||||
|
self = request.instance
|
||||||
|
|
||||||
|
if hasattr(self, 'set_up'):
|
||||||
|
try:
|
||||||
|
await maybeDeferred(self.set_up)
|
||||||
|
except Exception as exc:
|
||||||
|
warnings.warn('Error caught in test setup!\n%s' % exc)
|
||||||
|
pytest.fail('Error caught in test setup!\n%s' % exc)
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
if hasattr(self, 'tear_down'):
|
||||||
|
try:
|
||||||
|
await maybeDeferred(self.tear_down)
|
||||||
|
except Exception as exc:
|
||||||
|
pytest.fail('Error caught in test teardown!\n%s' % exc)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures('base_fixture')
|
||||||
|
class BaseTestCase:
|
||||||
|
"""This is the base class that should be used for all test classes
|
||||||
|
that create classes that inherit from deluge.component.Component. It
|
||||||
|
ensures that the component registry has been cleaned up when tests
|
||||||
|
have finished.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def mock_mkstemp(tmp_path):
|
||||||
|
"""Return known tempfile location to verify file deleted"""
|
||||||
|
tmp_file = tempfile.mkstemp(dir=tmp_path)
|
||||||
|
with patch('tempfile.mkstemp', return_value=tmp_file):
|
||||||
|
yield tmp_file
|
||||||
@ -1,72 +1,58 @@
|
|||||||
#
|
#
|
||||||
# alertmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
The AlertManager handles all the libtorrent alerts.
|
The AlertManager handles all the libtorrent alerts.
|
||||||
|
|
||||||
This should typically only be used by the Core. Plugins should utilize the
|
This should typically only be used by the Core. Plugins should utilize the
|
||||||
`:mod:EventManager` for similar functionality.
|
`:mod:EventManager` for similar functionality.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from types import SimpleNamespace
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge._libtorrent import lt
|
from deluge._libtorrent import lt
|
||||||
|
from deluge.common import decode_bytes
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class AlertManager(component.Component):
|
|
||||||
def __init__(self):
|
|
||||||
log.debug("AlertManager initialized..")
|
|
||||||
component.Component.__init__(self, "AlertManager", interval=0.05)
|
|
||||||
self.session = component.get("Core").session
|
|
||||||
|
|
||||||
self.session.set_alert_mask(
|
class AlertManager(component.Component):
|
||||||
lt.alert.category_t.error_notification |
|
"""AlertManager fetches and processes libtorrent alerts"""
|
||||||
lt.alert.category_t.port_mapping_notification |
|
|
||||||
lt.alert.category_t.storage_notification |
|
def __init__(self):
|
||||||
lt.alert.category_t.tracker_notification |
|
log.debug('AlertManager init...')
|
||||||
lt.alert.category_t.status_notification |
|
component.Component.__init__(self, 'AlertManager', interval=0.3)
|
||||||
lt.alert.category_t.ip_block_notification |
|
self.session = component.get('Core').session
|
||||||
lt.alert.category_t.performance_warning)
|
|
||||||
|
# Increase the alert queue size so that alerts don't get lost.
|
||||||
|
self.alert_queue_size = 10000
|
||||||
|
self.set_alert_queue_size(self.alert_queue_size)
|
||||||
|
|
||||||
|
alert_mask = (
|
||||||
|
lt.alert.category_t.error_notification
|
||||||
|
| lt.alert.category_t.port_mapping_notification
|
||||||
|
| lt.alert.category_t.storage_notification
|
||||||
|
| lt.alert.category_t.tracker_notification
|
||||||
|
| lt.alert.category_t.status_notification
|
||||||
|
| lt.alert.category_t.ip_block_notification
|
||||||
|
| lt.alert.category_t.performance_warning
|
||||||
|
| lt.alert.category_t.file_progress_notification
|
||||||
|
)
|
||||||
|
|
||||||
|
self.session.apply_settings({'alert_mask': alert_mask})
|
||||||
|
|
||||||
# handlers is a dictionary of lists {"alert_type": [handler1,h2,..]}
|
# handlers is a dictionary of lists {"alert_type": [handler1,h2,..]}
|
||||||
self.handlers = {}
|
self.handlers = {}
|
||||||
|
|
||||||
self.delayed_calls = []
|
self.delayed_calls = []
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
@ -74,8 +60,9 @@ class AlertManager(component.Component):
|
|||||||
self.handle_alerts()
|
self.handle_alerts()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
for dc in self.delayed_calls:
|
for delayed_call in self.delayed_calls:
|
||||||
dc.cancel()
|
if delayed_call.active():
|
||||||
|
delayed_call.cancel()
|
||||||
self.delayed_calls = []
|
self.delayed_calls = []
|
||||||
|
|
||||||
def register_handler(self, alert_type, handler):
|
def register_handler(self, alert_type, handler):
|
||||||
@ -94,7 +81,7 @@ class AlertManager(component.Component):
|
|||||||
|
|
||||||
# Append the handler to the list in the handlers dictionary
|
# Append the handler to the list in the handlers dictionary
|
||||||
self.handlers[alert_type].append(handler)
|
self.handlers[alert_type].append(handler)
|
||||||
log.debug("Registered handler for alert %s", alert_type)
|
log.debug('Registered handler for alert %s', alert_type)
|
||||||
|
|
||||||
def deregister_handler(self, handler):
|
def deregister_handler(self, handler):
|
||||||
"""
|
"""
|
||||||
@ -103,31 +90,53 @@ class AlertManager(component.Component):
|
|||||||
:param handler: func, the handler function to deregister
|
:param handler: func, the handler function to deregister
|
||||||
"""
|
"""
|
||||||
# Iterate through all handlers and remove 'handler' where found
|
# Iterate through all handlers and remove 'handler' where found
|
||||||
for (key, value) in self.handlers.items():
|
for (dummy_key, value) in self.handlers.items():
|
||||||
if handler in value:
|
if handler in value:
|
||||||
# Handler is in this alert type list
|
# Handler is in this alert type list
|
||||||
value.remove(handler)
|
value.remove(handler)
|
||||||
|
|
||||||
def handle_alerts(self, wait=False):
|
def handle_alerts(self):
|
||||||
"""
|
"""
|
||||||
Pops all libtorrent alerts in the session queue and handles them
|
Pops all libtorrent alerts in the session queue and handles them appropriately.
|
||||||
appropriately.
|
"""
|
||||||
|
alerts = self.session.pop_alerts()
|
||||||
|
if not alerts:
|
||||||
|
return
|
||||||
|
|
||||||
|
num_alerts = len(alerts)
|
||||||
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
|
log.debug('Alerts queued: %s', num_alerts)
|
||||||
|
if num_alerts > 0.9 * self.alert_queue_size:
|
||||||
|
log.warning(
|
||||||
|
'Warning total alerts queued, %s, passes 90%% of queue size.',
|
||||||
|
num_alerts,
|
||||||
|
)
|
||||||
|
|
||||||
:param wait: bool, if True then the handler functions will be run right
|
|
||||||
away and waited to return before processing the next alert
|
|
||||||
"""
|
|
||||||
alert = self.session.pop_alert()
|
|
||||||
# Loop through all alerts in the queue
|
# Loop through all alerts in the queue
|
||||||
while alert is not None:
|
for alert in alerts:
|
||||||
alert_type = type(alert).__name__
|
alert_type = type(alert).__name__
|
||||||
# Display the alert message
|
# Display the alert message
|
||||||
log.debug("%s: %s", alert_type, alert.message())
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
|
log.debug('%s: %s', alert_type, decode_bytes(alert.message()))
|
||||||
# Call any handlers for this alert type
|
# Call any handlers for this alert type
|
||||||
if alert_type in self.handlers:
|
if alert_type in self.handlers:
|
||||||
for handler in self.handlers[alert_type]:
|
for handler in self.handlers[alert_type]:
|
||||||
if not wait:
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
self.delayed_calls.append(reactor.callLater(0, handler, alert))
|
log.debug('Handling alert: %s', alert_type)
|
||||||
else:
|
# Copy alert attributes
|
||||||
handler(alert)
|
alert_copy = SimpleNamespace(
|
||||||
|
**{
|
||||||
|
attr: getattr(alert, attr)
|
||||||
|
for attr in dir(alert)
|
||||||
|
if not attr.startswith('__')
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.delayed_calls.append(reactor.callLater(0, handler, alert_copy))
|
||||||
|
|
||||||
alert = self.session.pop_alert()
|
def set_alert_queue_size(self, queue_size):
|
||||||
|
"""Sets the maximum size of the libtorrent alert queue"""
|
||||||
|
log.info('Alert Queue Size set to %s', queue_size)
|
||||||
|
self.alert_queue_size = queue_size
|
||||||
|
component.get('Core').apply_session_setting(
|
||||||
|
'alert_queue_size', self.alert_queue_size
|
||||||
|
)
|
||||||
|
|||||||
@ -1,69 +1,43 @@
|
|||||||
#
|
#
|
||||||
# authmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
|
||||||
import random
|
|
||||||
import stat
|
|
||||||
import shutil
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.configmanager as configmanager
|
import deluge.configmanager as configmanager
|
||||||
from deluge.common import (AUTH_LEVEL_ADMIN, AUTH_LEVEL_NONE, AUTH_LEVEL_NORMAL,
|
from deluge.common import (
|
||||||
AUTH_LEVEL_READONLY, AUTH_LEVEL_DEFAULT,
|
AUTH_LEVEL_ADMIN,
|
||||||
create_localclient_account)
|
AUTH_LEVEL_DEFAULT,
|
||||||
|
AUTH_LEVEL_NONE,
|
||||||
from deluge.error import AuthManagerError, AuthenticationRequired, BadLoginError
|
AUTH_LEVEL_NORMAL,
|
||||||
|
AUTH_LEVEL_READONLY,
|
||||||
|
create_localclient_account,
|
||||||
|
)
|
||||||
|
from deluge.error import AuthenticationRequired, AuthManagerError, BadLoginError
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
AUTH_LEVELS_MAPPING = {
|
AUTH_LEVELS_MAPPING = {
|
||||||
'NONE': AUTH_LEVEL_NONE,
|
'NONE': AUTH_LEVEL_NONE,
|
||||||
'READONLY': AUTH_LEVEL_READONLY,
|
'READONLY': AUTH_LEVEL_READONLY,
|
||||||
'DEFAULT': AUTH_LEVEL_NORMAL,
|
'DEFAULT': AUTH_LEVEL_DEFAULT,
|
||||||
'NORMAL': AUTH_LEVEL_DEFAULT,
|
'NORMAL': AUTH_LEVEL_NORMAL,
|
||||||
'ADMIN': AUTH_LEVEL_ADMIN
|
'ADMIN': AUTH_LEVEL_ADMIN,
|
||||||
}
|
}
|
||||||
|
AUTH_LEVELS_MAPPING_REVERSE = {v: k for k, v in AUTH_LEVELS_MAPPING.items()}
|
||||||
|
|
||||||
AUTH_LEVELS_MAPPING_REVERSE = {}
|
|
||||||
for key, value in AUTH_LEVELS_MAPPING.iteritems():
|
|
||||||
AUTH_LEVELS_MAPPING_REVERSE[value] = key
|
|
||||||
|
|
||||||
class Account(object):
|
class Account:
|
||||||
__slots__ = ('username', 'password', 'authlevel')
|
__slots__ = ('username', 'password', 'authlevel')
|
||||||
|
|
||||||
def __init__(self, username, password, authlevel):
|
def __init__(self, username, password, authlevel):
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
@ -74,17 +48,19 @@ class Account(object):
|
|||||||
'username': self.username,
|
'username': self.username,
|
||||||
'password': self.password,
|
'password': self.password,
|
||||||
'authlevel': AUTH_LEVELS_MAPPING_REVERSE[self.authlevel],
|
'authlevel': AUTH_LEVELS_MAPPING_REVERSE[self.authlevel],
|
||||||
'authlevel_int': self.authlevel
|
'authlevel_int': self.authlevel,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return ('<Account username="%(username)s" authlevel=%(authlevel)s>' %
|
return '<Account username="{username}" authlevel={authlevel}>'.format(
|
||||||
self.__dict__)
|
username=self.username,
|
||||||
|
authlevel=self.authlevel,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AuthManager(component.Component):
|
class AuthManager(component.Component):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
component.Component.__init__(self, "AuthManager", interval=10)
|
component.Component.__init__(self, 'AuthManager', interval=10)
|
||||||
self.__auth = {}
|
self.__auth = {}
|
||||||
self.__auth_modification_time = None
|
self.__auth_modification_time = None
|
||||||
|
|
||||||
@ -98,93 +74,96 @@ class AuthManager(component.Component):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
auth_file = configmanager.get_config_dir("auth")
|
auth_file = configmanager.get_config_dir('auth')
|
||||||
# Check for auth file and create if necessary
|
# Check for auth file and create if necessary
|
||||||
if not os.path.exists(auth_file):
|
if not os.path.isfile(auth_file):
|
||||||
log.info("Authfile not found, recreating it.")
|
log.info('Authfile not found, recreating it.')
|
||||||
self.__load_auth_file()
|
self.__load_auth_file()
|
||||||
return
|
return
|
||||||
|
|
||||||
auth_file_modification_time = os.stat(auth_file).st_mtime
|
auth_file_modification_time = os.stat(auth_file).st_mtime
|
||||||
if self.__auth_modification_time != auth_file_modification_time:
|
if self.__auth_modification_time != auth_file_modification_time:
|
||||||
log.info("Auth file changed, reloading it!")
|
log.info('Auth file changed, reloading it!')
|
||||||
self.__load_auth_file()
|
self.__load_auth_file()
|
||||||
|
|
||||||
def authorize(self, username, password):
|
def authorize(self, username, password):
|
||||||
"""
|
"""Authorizes users based on username and password.
|
||||||
Authorizes users based on username and password
|
|
||||||
|
|
||||||
:param username: str, username
|
Args:
|
||||||
:param password: str, password
|
username (str): Username
|
||||||
:returns: int, the auth level for this user
|
password (str): Password
|
||||||
:rtype: int
|
|
||||||
|
|
||||||
:raises AuthenticationRequired: if aditional details are required to
|
Returns:
|
||||||
authenticate.
|
int: The auth level for this user.
|
||||||
:raises BadLoginError: if the username does not exist or password does
|
|
||||||
not match.
|
Raises:
|
||||||
|
AuthenticationRequired: If additional details are required to authenticate.
|
||||||
|
BadLoginError: If the username does not exist or password does not match.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not username:
|
if not username:
|
||||||
raise AuthenticationRequired(
|
raise AuthenticationRequired(
|
||||||
"Username and Password are required.", username
|
'Username and Password are required.', username
|
||||||
)
|
)
|
||||||
|
|
||||||
if username not in self.__auth:
|
if username not in self.__auth:
|
||||||
# Let's try to re-load the file.. Maybe it's been updated
|
# Let's try to re-load the file.. Maybe it's been updated
|
||||||
self.__load_auth_file()
|
self.__load_auth_file()
|
||||||
if username not in self.__auth:
|
if username not in self.__auth:
|
||||||
raise BadLoginError("Username does not exist", username)
|
raise BadLoginError('Username does not exist', username)
|
||||||
|
|
||||||
if self.__auth[username].password == password:
|
if self.__auth[username].password == password:
|
||||||
# Return the users auth level
|
# Return the users auth level
|
||||||
return self.__auth[username].authlevel
|
return self.__auth[username].authlevel
|
||||||
elif not password and self.__auth[username].password:
|
elif not password and self.__auth[username].password:
|
||||||
raise AuthenticationRequired("Password is required", username)
|
raise AuthenticationRequired('Password is required', username)
|
||||||
else:
|
else:
|
||||||
raise BadLoginError("Password does not match", username)
|
raise BadLoginError('Password does not match', username)
|
||||||
|
|
||||||
def has_account(self, username):
|
def has_account(self, username):
|
||||||
return username in self.__auth
|
return username in self.__auth
|
||||||
|
|
||||||
def get_known_accounts(self):
|
def get_known_accounts(self):
|
||||||
"""
|
"""Returns a list of known deluge usernames."""
|
||||||
Returns a list of known deluge usernames.
|
|
||||||
"""
|
|
||||||
self.__load_auth_file()
|
self.__load_auth_file()
|
||||||
return [account.data() for account in self.__auth.values()]
|
return [account.data() for account in self.__auth.values()]
|
||||||
|
|
||||||
def create_account(self, username, password, authlevel):
|
def create_account(self, username, password, authlevel):
|
||||||
if username in self.__auth:
|
if username in self.__auth:
|
||||||
raise AuthManagerError("Username in use.", username)
|
raise AuthManagerError('Username in use.', username)
|
||||||
|
if authlevel not in AUTH_LEVELS_MAPPING:
|
||||||
|
raise AuthManagerError('Invalid auth level: %s' % authlevel)
|
||||||
try:
|
try:
|
||||||
self.__auth[username] = Account(username, password,
|
self.__auth[username] = Account(
|
||||||
AUTH_LEVELS_MAPPING[authlevel])
|
username, password, AUTH_LEVELS_MAPPING[authlevel]
|
||||||
|
)
|
||||||
self.write_auth_file()
|
self.write_auth_file()
|
||||||
return True
|
return True
|
||||||
except Exception, err:
|
except Exception as ex:
|
||||||
log.exception(err)
|
log.exception(ex)
|
||||||
raise err
|
raise ex
|
||||||
|
|
||||||
def update_account(self, username, password, authlevel):
|
def update_account(self, username, password, authlevel):
|
||||||
if username not in self.__auth:
|
if username not in self.__auth:
|
||||||
raise AuthManagerError("Username not known", username)
|
raise AuthManagerError('Username not known', username)
|
||||||
|
if authlevel not in AUTH_LEVELS_MAPPING:
|
||||||
|
raise AuthManagerError('Invalid auth level: %s' % authlevel)
|
||||||
try:
|
try:
|
||||||
self.__auth[username].username = username
|
self.__auth[username].username = username
|
||||||
self.__auth[username].password = password
|
self.__auth[username].password = password
|
||||||
self.__auth[username].authlevel = AUTH_LEVELS_MAPPING[authlevel]
|
self.__auth[username].authlevel = AUTH_LEVELS_MAPPING[authlevel]
|
||||||
self.write_auth_file()
|
self.write_auth_file()
|
||||||
return True
|
return True
|
||||||
except Exception, err:
|
except Exception as ex:
|
||||||
log.exception(err)
|
log.exception(ex)
|
||||||
raise err
|
raise ex
|
||||||
|
|
||||||
def remove_account(self, username):
|
def remove_account(self, username):
|
||||||
if username not in self.__auth:
|
if username not in self.__auth:
|
||||||
raise AuthManagerError("Username not known", username)
|
raise AuthManagerError('Username not known', username)
|
||||||
elif username == component.get("RPCServer").get_session_user():
|
elif username == component.get('RPCServer').get_session_user():
|
||||||
raise AuthManagerError(
|
raise AuthManagerError(
|
||||||
"You cannot delete your own account while logged in!", username
|
'You cannot delete your own account while logged in!', username
|
||||||
)
|
)
|
||||||
|
|
||||||
del self.__auth[username]
|
del self.__auth[username]
|
||||||
@ -192,36 +171,45 @@ class AuthManager(component.Component):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def write_auth_file(self):
|
def write_auth_file(self):
|
||||||
old_auth_file = configmanager.get_config_dir("auth")
|
filename = 'auth'
|
||||||
new_auth_file = old_auth_file + '.new'
|
filepath = os.path.join(configmanager.get_config_dir(), filename)
|
||||||
bak_auth_file = old_auth_file + '.bak'
|
filepath_bak = filepath + '.bak'
|
||||||
# Let's first create a backup
|
filepath_tmp = filepath + '.tmp'
|
||||||
if os.path.exists(old_auth_file):
|
|
||||||
shutil.copy2(old_auth_file, bak_auth_file)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fd = open(new_auth_file, "w")
|
if os.path.isfile(filepath):
|
||||||
for account in self.__auth.values():
|
log.debug('Creating backup of %s at: %s', filename, filepath_bak)
|
||||||
fd.write(
|
shutil.copy2(filepath, filepath_bak)
|
||||||
"%(username)s:%(password)s:%(authlevel_int)s\n" %
|
except OSError as ex:
|
||||||
account.data()
|
log.error('Unable to backup %s to %s: %s', filepath, filepath_bak, ex)
|
||||||
)
|
else:
|
||||||
fd.flush()
|
log.info('Saving the %s at: %s', filename, filepath)
|
||||||
os.fsync(fd.fileno())
|
try:
|
||||||
fd.close()
|
with open(filepath_tmp, 'w', encoding='utf8') as _file:
|
||||||
os.rename(new_auth_file, old_auth_file)
|
for account in self.__auth.values():
|
||||||
except:
|
_file.write(
|
||||||
# Something failed, let's restore the previous file
|
'%(username)s:%(password)s:%(authlevel_int)s\n'
|
||||||
if os.path.exists(bak_auth_file):
|
% account.data()
|
||||||
os.rename(bak_auth_file, old_auth_file)
|
)
|
||||||
|
_file.flush()
|
||||||
|
os.fsync(_file.fileno())
|
||||||
|
shutil.move(filepath_tmp, filepath)
|
||||||
|
except OSError as ex:
|
||||||
|
log.error('Unable to save %s: %s', filename, ex)
|
||||||
|
if os.path.isfile(filepath_bak):
|
||||||
|
log.info('Restoring backup of %s from: %s', filename, filepath_bak)
|
||||||
|
shutil.move(filepath_bak, filepath)
|
||||||
|
|
||||||
self.__load_auth_file()
|
self.__load_auth_file()
|
||||||
|
|
||||||
def __load_auth_file(self):
|
def __load_auth_file(self):
|
||||||
save_and_reload = False
|
save_and_reload = False
|
||||||
auth_file = configmanager.get_config_dir("auth")
|
filename = 'auth'
|
||||||
|
auth_file = configmanager.get_config_dir(filename)
|
||||||
|
auth_file_bak = auth_file + '.bak'
|
||||||
|
|
||||||
# Check for auth file and create if necessary
|
# Check for auth file and create if necessary
|
||||||
if not os.path.exists(auth_file):
|
if not os.path.isfile(auth_file):
|
||||||
create_localclient_account()
|
create_localclient_account()
|
||||||
return self.__load_auth_file()
|
return self.__load_auth_file()
|
||||||
|
|
||||||
@ -232,24 +220,33 @@ class AuthManager(component.Component):
|
|||||||
# File didn't change, no need for re-parsing's
|
# File didn't change, no need for re-parsing's
|
||||||
return
|
return
|
||||||
|
|
||||||
# Load the auth file into a dictionary: {username: Account(...)}
|
for _filepath in (auth_file, auth_file_bak):
|
||||||
f = open(auth_file, "r").readlines()
|
log.info('Opening %s for load: %s', filename, _filepath)
|
||||||
|
|
||||||
for line in f:
|
|
||||||
if line.startswith("#"):
|
|
||||||
# This is a comment line
|
|
||||||
continue
|
|
||||||
line = line.strip()
|
|
||||||
try:
|
try:
|
||||||
lsplit = line.split(":")
|
with open(_filepath, encoding='utf8') as _file:
|
||||||
except Exception, e:
|
file_data = _file.readlines()
|
||||||
log.error("Your auth file is malformed: %s", e)
|
except OSError as ex:
|
||||||
|
log.warning('Unable to load %s: %s', _filepath, ex)
|
||||||
|
file_data = []
|
||||||
|
else:
|
||||||
|
log.info('Successfully loaded %s: %s', filename, _filepath)
|
||||||
|
break
|
||||||
|
|
||||||
|
# Load the auth file into a dictionary: {username: Account(...)}
|
||||||
|
for line in file_data:
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith('#') or not line:
|
||||||
|
# This line is a comment or empty
|
||||||
continue
|
continue
|
||||||
|
lsplit = line.split(':')
|
||||||
if len(lsplit) == 2:
|
if len(lsplit) == 2:
|
||||||
username, password = lsplit
|
username, password = lsplit
|
||||||
log.warning("Your auth entry for %s contains no auth level, "
|
log.warning(
|
||||||
"using AUTH_LEVEL_DEFAULT(%s)..", username,
|
'Your auth entry for %s contains no auth level, '
|
||||||
AUTH_LEVEL_DEFAULT)
|
'using AUTH_LEVEL_DEFAULT(%s)..',
|
||||||
|
username,
|
||||||
|
AUTH_LEVEL_DEFAULT,
|
||||||
|
)
|
||||||
if username == 'localclient':
|
if username == 'localclient':
|
||||||
authlevel = AUTH_LEVEL_ADMIN
|
authlevel = AUTH_LEVEL_ADMIN
|
||||||
else:
|
else:
|
||||||
@ -259,8 +256,7 @@ class AuthManager(component.Component):
|
|||||||
elif len(lsplit) == 3:
|
elif len(lsplit) == 3:
|
||||||
username, password, authlevel = lsplit
|
username, password, authlevel = lsplit
|
||||||
else:
|
else:
|
||||||
log.error("Your auth file is malformed: "
|
log.error('Your auth file is malformed: Incorrect number of fields!')
|
||||||
"Incorrect number of fields!")
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
username = username.strip()
|
username = username.strip()
|
||||||
@ -271,19 +267,19 @@ class AuthManager(component.Component):
|
|||||||
try:
|
try:
|
||||||
authlevel = AUTH_LEVELS_MAPPING[authlevel]
|
authlevel = AUTH_LEVELS_MAPPING[authlevel]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.error("Your auth file is malformed: %r is not a valid auth "
|
log.error(
|
||||||
"level" % authlevel)
|
'Your auth file is malformed: %r is not a valid auth level',
|
||||||
|
authlevel,
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.__auth[username] = Account(username, password, authlevel)
|
self.__auth[username] = Account(username, password, authlevel)
|
||||||
|
|
||||||
if "localclient" not in self.__auth:
|
if 'localclient' not in self.__auth:
|
||||||
create_localclient_account(True)
|
create_localclient_account(True)
|
||||||
return self.__load_auth_file()
|
return self.__load_auth_file()
|
||||||
|
|
||||||
|
|
||||||
if save_and_reload:
|
if save_and_reload:
|
||||||
log.info("Re-writing auth file (upgrade)")
|
log.info('Re-writing auth file (upgrade)')
|
||||||
self.write_auth_file()
|
self.write_auth_file()
|
||||||
self.__auth_modification_time = auth_file_modification_time
|
self.__auth_modification_time = auth_file_modification_time
|
||||||
|
|
||||||
|
|||||||
1483
deluge/core/core.py
1483
deluge/core/core.py
File diff suppressed because it is too large
Load Diff
@ -1,201 +1,203 @@
|
|||||||
#
|
#
|
||||||
# daemon.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
"""The Deluge daemon"""
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import socket
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
import twisted.internet.error
|
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.configmanager
|
from deluge.common import get_version, is_ip, is_process_running, windows_check
|
||||||
import deluge.common
|
from deluge.configmanager import get_config_dir
|
||||||
|
from deluge.core.core import Core
|
||||||
from deluge.core.rpcserver import RPCServer, export
|
from deluge.core.rpcserver import RPCServer, export
|
||||||
import deluge.error
|
from deluge.error import DaemonRunningError
|
||||||
|
|
||||||
|
if windows_check():
|
||||||
|
from win32api import SetConsoleCtrlHandler
|
||||||
|
from win32con import CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Daemon(object):
|
|
||||||
def __init__(self, options=None, args=None, classic=False):
|
def is_daemon_running(pid_file):
|
||||||
# Check for another running instance of the daemon
|
"""
|
||||||
if os.path.isfile(deluge.configmanager.get_config_dir("deluged.pid")):
|
Check for another running instance of the daemon using the same pid file.
|
||||||
# Get the PID and the port of the supposedly running daemon
|
|
||||||
try:
|
Args:
|
||||||
(pid, port) = open(
|
pid_file: The location of the file with pid, port values.
|
||||||
deluge.configmanager.get_config_dir("deluged.pid")
|
|
||||||
).read().strip().split(";")
|
Returns:
|
||||||
pid = int(pid)
|
bool: True is daemon is running, False otherwise.
|
||||||
port = int(port)
|
|
||||||
except ValueError:
|
"""
|
||||||
pid = None
|
|
||||||
port = None
|
try:
|
||||||
|
with open(pid_file) as _file:
|
||||||
|
pid, port = (int(x) for x in _file.readline().strip().split(';'))
|
||||||
|
except (OSError, ValueError):
|
||||||
|
return False
|
||||||
|
|
||||||
|
if is_process_running(pid):
|
||||||
|
# Ensure it's a deluged process by trying to open a socket to it's port.
|
||||||
|
_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
try:
|
||||||
|
_socket.connect(('127.0.0.1', port))
|
||||||
|
except OSError:
|
||||||
|
# Can't connect, so pid is not a deluged process.
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
# This is a deluged process!
|
||||||
|
_socket.close()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def process_running(pid):
|
class Daemon:
|
||||||
if deluge.common.windows_check():
|
"""The Deluge Daemon class"""
|
||||||
# Do some fancy WMI junk to see if the PID exists in Windows
|
|
||||||
from win32com.client import GetObject
|
|
||||||
def get_proclist():
|
|
||||||
WMI = GetObject('winmgmts:')
|
|
||||||
processes = WMI.InstancesOf('Win32_Process')
|
|
||||||
return [process.Properties_('ProcessID').Value for process in processes]
|
|
||||||
return pid in get_proclist()
|
|
||||||
else:
|
|
||||||
# We can just use os.kill on UNIX to test if the process is running
|
|
||||||
try:
|
|
||||||
os.kill(pid, 0)
|
|
||||||
except OSError:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
if pid is not None and process_running(pid):
|
def __init__(
|
||||||
# Ok, so a process is running with this PID, let's make doubly-sure
|
self,
|
||||||
# it's a deluged process by trying to open a socket to it's port.
|
listen_interface=None,
|
||||||
import socket
|
outgoing_interface=None,
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
interface=None,
|
||||||
try:
|
port=None,
|
||||||
s.connect(("127.0.0.1", port))
|
standalone=False,
|
||||||
except socket.error:
|
read_only_config_keys=None,
|
||||||
# Can't connect, so it must not be a deluged process..
|
):
|
||||||
pass
|
"""
|
||||||
else:
|
Args:
|
||||||
# This is a deluged!
|
listen_interface (str, optional): The IP address to listen to
|
||||||
s.close()
|
BitTorrent connections on.
|
||||||
raise deluge.error.DaemonRunningError(
|
outgoing_interface (str, optional): The network interface name or
|
||||||
"There is a deluge daemon running with this config "
|
IP address to open outgoing BitTorrent connections on.
|
||||||
"directory!"
|
interface (str, optional): The IP address the daemon will
|
||||||
)
|
listen for UI connections on.
|
||||||
|
port (int, optional): The port the daemon will listen for UI
|
||||||
|
connections on.
|
||||||
|
standalone (bool, optional): If True the client is in Standalone
|
||||||
|
mode otherwise, if False, start the daemon as separate process.
|
||||||
|
read_only_config_keys (list of str, optional): A list of config
|
||||||
|
keys that will not be altered by core.set_config() RPC method.
|
||||||
|
"""
|
||||||
|
self.standalone = standalone
|
||||||
|
self.pid_file = get_config_dir('deluged.pid')
|
||||||
|
log.info('Deluge daemon %s', get_version())
|
||||||
|
if is_daemon_running(self.pid_file):
|
||||||
|
raise DaemonRunningError(
|
||||||
|
'Deluge daemon already running with this config directory!'
|
||||||
|
)
|
||||||
|
|
||||||
# Twisted catches signals to terminate, so just have it call the shutdown
|
# Twisted catches signals to terminate, so just have it call the shutdown method.
|
||||||
# method.
|
reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown)
|
||||||
reactor.addSystemEventTrigger("after", "shutdown", self.shutdown)
|
|
||||||
|
|
||||||
# Catch some Windows specific signals
|
# Catch some Windows specific signals
|
||||||
if deluge.common.windows_check():
|
if windows_check():
|
||||||
from win32api import SetConsoleCtrlHandler
|
|
||||||
from win32con import CTRL_CLOSE_EVENT
|
|
||||||
from win32con import CTRL_SHUTDOWN_EVENT
|
|
||||||
def win_handler(ctrl_type):
|
def win_handler(ctrl_type):
|
||||||
log.debug("ctrl_type: %s", ctrl_type)
|
"""Handle the Windows shutdown or close events."""
|
||||||
|
log.debug('windows handler ctrl_type: %s', ctrl_type)
|
||||||
if ctrl_type == CTRL_CLOSE_EVENT or ctrl_type == CTRL_SHUTDOWN_EVENT:
|
if ctrl_type == CTRL_CLOSE_EVENT or ctrl_type == CTRL_SHUTDOWN_EVENT:
|
||||||
self._shutdown()
|
self._shutdown()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
SetConsoleCtrlHandler(win_handler)
|
SetConsoleCtrlHandler(win_handler)
|
||||||
|
|
||||||
version = deluge.common.get_version()
|
|
||||||
|
|
||||||
log.info("Deluge daemon %s", version)
|
|
||||||
log.debug("options: %s", options)
|
|
||||||
log.debug("args: %s", args)
|
|
||||||
# Set the config directory
|
|
||||||
if options and options.config:
|
|
||||||
deluge.configmanager.set_config_dir(options.config)
|
|
||||||
|
|
||||||
from deluge.core.core import Core
|
|
||||||
# Start the core as a thread and join it until it's done
|
# Start the core as a thread and join it until it's done
|
||||||
self.core = Core()
|
self.core = Core(
|
||||||
|
listen_interface=listen_interface,
|
||||||
|
outgoing_interface=outgoing_interface,
|
||||||
|
read_only_config_keys=read_only_config_keys,
|
||||||
|
)
|
||||||
|
|
||||||
port = self.core.config["daemon_port"]
|
if port is None:
|
||||||
if options and options.port:
|
port = self.core.config['daemon_port']
|
||||||
port = options.port
|
self.port = port
|
||||||
if options and options.ui_interface:
|
|
||||||
interface = options.ui_interface
|
if interface and not is_ip(interface):
|
||||||
else:
|
log.error('Invalid UI interface (must be IP Address): %s', interface)
|
||||||
interface = ""
|
interface = None
|
||||||
|
|
||||||
self.rpcserver = RPCServer(
|
self.rpcserver = RPCServer(
|
||||||
port=port,
|
port=port,
|
||||||
allow_remote=self.core.config["allow_remote"],
|
allow_remote=self.core.config['allow_remote'],
|
||||||
listen=not classic,
|
listen=not standalone,
|
||||||
interface=interface
|
interface=interface,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
log.debug(
|
||||||
|
'Listening to UI on: %s:%s and bittorrent on: %s Making connections out on: %s',
|
||||||
|
interface,
|
||||||
|
port,
|
||||||
|
listen_interface,
|
||||||
|
outgoing_interface,
|
||||||
|
)
|
||||||
|
|
||||||
|
def start(self):
|
||||||
# Register the daemon and the core RPCs
|
# Register the daemon and the core RPCs
|
||||||
self.rpcserver.register_object(self.core)
|
self.rpcserver.register_object(self.core)
|
||||||
self.rpcserver.register_object(self)
|
self.rpcserver.register_object(self)
|
||||||
|
|
||||||
|
|
||||||
# Make sure we start the PreferencesManager first
|
# Make sure we start the PreferencesManager first
|
||||||
component.start("PreferencesManager")
|
component.start('PreferencesManager')
|
||||||
|
|
||||||
if not classic:
|
if not self.standalone:
|
||||||
# Write out a pid file all the time, we use this to see if a deluged is running
|
log.info('Deluge daemon starting...')
|
||||||
# We also include the running port number to do an additional test
|
# Create pid file to track if deluged is running, also includes the port number.
|
||||||
open(deluge.configmanager.get_config_dir("deluged.pid"), "wb").write(
|
pid = os.getpid()
|
||||||
"%s;%s\n" % (os.getpid(), port))
|
log.debug('Storing pid %s & port %s in: %s', pid, self.port, self.pid_file)
|
||||||
|
with open(self.pid_file, 'w') as _file:
|
||||||
|
_file.write(f'{pid};{self.port}\n')
|
||||||
|
|
||||||
component.start()
|
component.start()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
reactor.run()
|
reactor.run()
|
||||||
finally:
|
finally:
|
||||||
self._shutdown()
|
log.debug('Remove pid file: %s', self.pid_file)
|
||||||
|
os.remove(self.pid_file)
|
||||||
|
log.info('Deluge daemon shutdown successfully')
|
||||||
|
|
||||||
@export()
|
@export()
|
||||||
def shutdown(self, *args, **kwargs):
|
def shutdown(self, *args, **kwargs):
|
||||||
|
log.debug('Deluge daemon shutdown requested...')
|
||||||
reactor.callLater(0, reactor.stop)
|
reactor.callLater(0, reactor.stop)
|
||||||
|
|
||||||
def _shutdown(self, *args, **kwargs):
|
def _shutdown(self, *args, **kwargs):
|
||||||
try:
|
log.info('Deluge daemon shutting down, waiting for components to shutdown...')
|
||||||
os.remove(deluge.configmanager.get_config_dir("deluged.pid"))
|
if not self.standalone:
|
||||||
except Exception, e:
|
return component.shutdown()
|
||||||
log.exception(e)
|
|
||||||
log.error("Error removing deluged.pid!")
|
|
||||||
|
|
||||||
component.shutdown()
|
|
||||||
try:
|
|
||||||
reactor.stop()
|
|
||||||
except twisted.internet.error.ReactorNotRunning:
|
|
||||||
log.debug("Tried to stop the reactor but it is not running..")
|
|
||||||
|
|
||||||
@export()
|
@export()
|
||||||
def get_method_list(self):
|
def get_method_list(self):
|
||||||
"""
|
"""Returns a list of the exported methods."""
|
||||||
Returns a list of the exported methods.
|
|
||||||
"""
|
|
||||||
return self.rpcserver.get_method_list()
|
return self.rpcserver.get_method_list()
|
||||||
|
|
||||||
|
@export()
|
||||||
|
def get_version(self):
|
||||||
|
"""Returns the daemon version"""
|
||||||
|
return get_version()
|
||||||
|
|
||||||
@export(1)
|
@export(1)
|
||||||
def authorized_call(self, rpc):
|
def authorized_call(self, rpc):
|
||||||
"""
|
"""Determines if session auth_level is authorized to call RPC.
|
||||||
Returns True if authorized to call rpc.
|
|
||||||
|
|
||||||
:param rpc: a rpc, eg, "core.get_torrents_status"
|
Args:
|
||||||
:type rpc: string
|
rpc (str): A RPC, e.g. core.get_torrents_status
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if authorized to call RPC, otherwise False.
|
||||||
"""
|
"""
|
||||||
if not rpc in self.get_method_list():
|
if rpc not in self.get_method_list():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
auth_level = self.rpcserver.get_session_auth_level()
|
return (
|
||||||
return auth_level >= self.rpcserver.get_rpc_auth_level()
|
self.rpcserver.get_session_auth_level()
|
||||||
|
>= self.rpcserver.get_rpc_auth_level(rpc)
|
||||||
|
)
|
||||||
|
|||||||
140
deluge/core/daemon_entry.py
Normal file
140
deluge/core/daemon_entry.py
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||||
|
# Copyright (C) 2010 Pedro Algarvio <pedro@algarvio.me>
|
||||||
|
#
|
||||||
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
|
# See LICENSE for more details.
|
||||||
|
#
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from logging import DEBUG, FileHandler, getLogger
|
||||||
|
|
||||||
|
from twisted.internet.error import CannotListenError
|
||||||
|
|
||||||
|
from deluge.argparserbase import ArgParserBase
|
||||||
|
from deluge.common import run_profiled
|
||||||
|
from deluge.configmanager import get_config_dir
|
||||||
|
from deluge.i18n import setup_mock_translation
|
||||||
|
|
||||||
|
|
||||||
|
def add_daemon_options(parser):
|
||||||
|
group = parser.add_argument_group(_('Daemon Options'))
|
||||||
|
group.add_argument(
|
||||||
|
'-u',
|
||||||
|
'--ui-interface',
|
||||||
|
metavar='<ip-addr>',
|
||||||
|
action='store',
|
||||||
|
help=_('IP address to listen for UI connections'),
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
'-p',
|
||||||
|
'--port',
|
||||||
|
metavar='<port>',
|
||||||
|
action='store',
|
||||||
|
type=int,
|
||||||
|
help=_('Port to listen for UI connections on'),
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
'-i',
|
||||||
|
'--interface',
|
||||||
|
metavar='<ip-addr>',
|
||||||
|
dest='listen_interface',
|
||||||
|
action='store',
|
||||||
|
help=_('IP address to listen for BitTorrent connections'),
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
'-o',
|
||||||
|
'--outgoing-interface',
|
||||||
|
metavar='<interface>',
|
||||||
|
dest='outgoing_interface',
|
||||||
|
action='store',
|
||||||
|
help=_(
|
||||||
|
'The network interface name or IP address for outgoing BitTorrent connections.'
|
||||||
|
),
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
'--read-only-config-keys',
|
||||||
|
metavar='<comma-separated-keys>',
|
||||||
|
action='store',
|
||||||
|
help=_('Config keys to be unmodified by `set_config` RPC'),
|
||||||
|
type=str,
|
||||||
|
default='',
|
||||||
|
)
|
||||||
|
parser.add_process_arg_group()
|
||||||
|
|
||||||
|
|
||||||
|
def start_daemon(skip_start=False):
|
||||||
|
"""
|
||||||
|
Entry point for daemon script
|
||||||
|
|
||||||
|
Args:
|
||||||
|
skip_start (bool): If starting daemon should be skipped.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
deluge.core.daemon.Daemon: A new daemon object
|
||||||
|
|
||||||
|
"""
|
||||||
|
setup_mock_translation()
|
||||||
|
|
||||||
|
# Setup the argument parser
|
||||||
|
parser = ArgParserBase()
|
||||||
|
add_daemon_options(parser)
|
||||||
|
|
||||||
|
options = parser.parse_args()
|
||||||
|
|
||||||
|
# Check for any daemons running with this same config
|
||||||
|
from deluge.core.daemon import is_daemon_running
|
||||||
|
|
||||||
|
pid_file = get_config_dir('deluged.pid')
|
||||||
|
if is_daemon_running(pid_file):
|
||||||
|
print(
|
||||||
|
'Cannot run multiple daemons with same config directory.\n'
|
||||||
|
'If you believe this is an error, force starting by deleting: %s' % pid_file
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
log = getLogger(__name__)
|
||||||
|
|
||||||
|
# If no logfile specified add logging to default location (as well as stdout)
|
||||||
|
if not options.logfile:
|
||||||
|
options.logfile = get_config_dir('deluged.log')
|
||||||
|
file_handler = FileHandler(options.logfile)
|
||||||
|
log.addHandler(file_handler)
|
||||||
|
|
||||||
|
def run_daemon(options):
|
||||||
|
try:
|
||||||
|
from deluge.core.daemon import Daemon
|
||||||
|
|
||||||
|
daemon = Daemon(
|
||||||
|
listen_interface=options.listen_interface,
|
||||||
|
outgoing_interface=options.outgoing_interface,
|
||||||
|
interface=options.ui_interface,
|
||||||
|
port=options.port,
|
||||||
|
read_only_config_keys=options.read_only_config_keys.split(','),
|
||||||
|
)
|
||||||
|
if skip_start:
|
||||||
|
return daemon
|
||||||
|
else:
|
||||||
|
daemon.start()
|
||||||
|
except CannotListenError as ex:
|
||||||
|
log.error(
|
||||||
|
'Cannot start deluged, listen port in use.\n'
|
||||||
|
' Check for other running daemons or services using this port: %s:%s',
|
||||||
|
ex.interface,
|
||||||
|
ex.port,
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
except Exception as ex:
|
||||||
|
log.error('Unable to start deluged: %s', ex)
|
||||||
|
if log.isEnabledFor(DEBUG):
|
||||||
|
log.exception(ex)
|
||||||
|
sys.exit(1)
|
||||||
|
finally:
|
||||||
|
log.info('Exiting...')
|
||||||
|
if options.pidfile:
|
||||||
|
os.remove(options.pidfile)
|
||||||
|
|
||||||
|
return run_profiled(
|
||||||
|
run_daemon, options, output_file=options.profile, do_profile=options.profile
|
||||||
|
)
|
||||||
@ -1,46 +1,21 @@
|
|||||||
#
|
#
|
||||||
# eventmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EventManager(component.Component):
|
class EventManager(component.Component):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
component.Component.__init__(self, "EventManager")
|
component.Component.__init__(self, 'EventManager')
|
||||||
self.handlers = {}
|
self.handlers = {}
|
||||||
|
|
||||||
def emit(self, event):
|
def emit(self, event):
|
||||||
@ -50,15 +25,20 @@ class EventManager(component.Component):
|
|||||||
:param event: DelugeEvent
|
:param event: DelugeEvent
|
||||||
"""
|
"""
|
||||||
# Emit the event to the interested clients
|
# Emit the event to the interested clients
|
||||||
component.get("RPCServer").emit_event(event)
|
component.get('RPCServer').emit_event(event)
|
||||||
# Call any handlers for the event
|
# Call any handlers for the event
|
||||||
if event.name in self.handlers:
|
if event.name in self.handlers:
|
||||||
for handler in self.handlers[event.name]:
|
for handler in self.handlers[event.name]:
|
||||||
#log.debug("Running handler %s for event %s with args: %s", event.name, handler, event.args)
|
# log.debug('Running handler %s for event %s with args: %s', event.name, handler, event.args)
|
||||||
try:
|
try:
|
||||||
handler(*event.args)
|
handler(*event.args)
|
||||||
except:
|
except Exception as ex:
|
||||||
log.error("Event handler %s failed in %s", event.name, handler)
|
log.error(
|
||||||
|
'Event handler %s failed in %s with exception %s',
|
||||||
|
event.name,
|
||||||
|
handler,
|
||||||
|
ex,
|
||||||
|
)
|
||||||
|
|
||||||
def register_event_handler(self, event, handler):
|
def register_event_handler(self, event, handler):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -1,85 +1,61 @@
|
|||||||
#
|
#
|
||||||
# core.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import deluge.component as component
|
|
||||||
|
|
||||||
STATE_SORT = ["All", "Downloading", "Seeding", "Active", "Paused", "Queued"]
|
import deluge.component as component
|
||||||
|
from deluge.common import TORRENT_STATE
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
#special purpose filters:
|
STATE_SORT = ['All', 'Active'] + TORRENT_STATE
|
||||||
def filter_keywords(torrent_ids, values):
|
|
||||||
#cleanup.
|
|
||||||
keywords = ",".join([v.lower() for v in values])
|
|
||||||
keywords = keywords.split(",")
|
|
||||||
|
|
||||||
|
|
||||||
|
# Special purpose filters:
|
||||||
|
def filter_keywords(torrent_ids, values):
|
||||||
|
# Cleanup
|
||||||
|
keywords = ','.join([v.lower() for v in values])
|
||||||
|
keywords = keywords.split(',')
|
||||||
|
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
torrent_ids = filter_one_keyword(torrent_ids, keyword)
|
torrent_ids = filter_one_keyword(torrent_ids, keyword)
|
||||||
return torrent_ids
|
return torrent_ids
|
||||||
|
|
||||||
|
|
||||||
def filter_one_keyword(torrent_ids, keyword):
|
def filter_one_keyword(torrent_ids, keyword):
|
||||||
"""
|
"""
|
||||||
search torrent on keyword.
|
search torrent on keyword.
|
||||||
searches title,state,tracker-status,tracker,files
|
searches title,state,tracker-status,tracker,files
|
||||||
"""
|
"""
|
||||||
all_torrents = component.get("TorrentManager").torrents
|
all_torrents = component.get('TorrentManager').torrents
|
||||||
#filter:
|
|
||||||
found = False
|
|
||||||
for torrent_id in torrent_ids:
|
for torrent_id in torrent_ids:
|
||||||
torrent = all_torrents[torrent_id]
|
torrent = all_torrents[torrent_id]
|
||||||
if keyword in torrent.filename.lower():
|
if keyword in torrent.filename.lower():
|
||||||
yield torrent_id
|
yield torrent_id
|
||||||
elif keyword in torrent.state.lower():
|
elif keyword in torrent.state.lower():
|
||||||
yield torrent_id
|
yield torrent_id
|
||||||
elif torrent.trackers and keyword in torrent.trackers[0]["url"]:
|
elif torrent.trackers and keyword in torrent.trackers[0]['url']:
|
||||||
yield torrent_id
|
yield torrent_id
|
||||||
elif keyword in torrent_id:
|
elif keyword in torrent_id:
|
||||||
yield torrent_id
|
yield torrent_id
|
||||||
#i want to find broken torrents (search on "error", or "unregistered")
|
# Want to find broken torrents (search on "error", or "unregistered")
|
||||||
elif keyword in torrent.tracker_status.lower():
|
elif keyword in torrent.tracker_status.lower():
|
||||||
yield torrent_id
|
yield torrent_id
|
||||||
else:
|
else:
|
||||||
for t_file in torrent.get_files():
|
for t_file in torrent.get_files():
|
||||||
if keyword in t_file["path"].lower():
|
if keyword in t_file['path'].lower():
|
||||||
yield torrent_id
|
yield torrent_id
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def filter_by_name(torrent_ids, search_string):
|
def filter_by_name(torrent_ids, search_string):
|
||||||
all_torrents = component.get("TorrentManager").torrents
|
all_torrents = component.get('TorrentManager').torrents
|
||||||
try:
|
try:
|
||||||
search_string, match_case = search_string[0].split('::match')
|
search_string, match_case = search_string[0].split('::match')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -99,49 +75,51 @@ def filter_by_name(torrent_ids, search_string):
|
|||||||
if search_string in torrent_name:
|
if search_string in torrent_name:
|
||||||
yield torrent_id
|
yield torrent_id
|
||||||
|
|
||||||
|
|
||||||
def tracker_error_filter(torrent_ids, values):
|
def tracker_error_filter(torrent_ids, values):
|
||||||
filtered_torrent_ids = []
|
filtered_torrent_ids = []
|
||||||
tm = component.get("TorrentManager")
|
tm = component.get('TorrentManager')
|
||||||
|
|
||||||
# If this is a tracker_host, then we need to filter on it
|
# If this is a tracker_host, then we need to filter on it
|
||||||
if values[0] != "Error":
|
if values[0] != 'Error':
|
||||||
for torrent_id in torrent_ids:
|
for torrent_id in torrent_ids:
|
||||||
if values[0] == tm[torrent_id].get_status(["tracker_host"])["tracker_host"]:
|
if values[0] == tm[torrent_id].get_status(['tracker_host'])['tracker_host']:
|
||||||
filtered_torrent_ids.append(torrent_id)
|
filtered_torrent_ids.append(torrent_id)
|
||||||
return filtered_torrent_ids
|
return filtered_torrent_ids
|
||||||
|
|
||||||
# Check all the torrent's tracker_status for 'Error:' and only return torrent_ids
|
# Check torrent's tracker_status for 'Error:' and return those torrent_ids
|
||||||
# that have this substring in their tracker_status
|
|
||||||
for torrent_id in torrent_ids:
|
for torrent_id in torrent_ids:
|
||||||
if _("Error") + ":" in tm[torrent_id].get_status(["tracker_status"])["tracker_status"]:
|
if 'Error:' in tm[torrent_id].get_status(['tracker_status'])['tracker_status']:
|
||||||
filtered_torrent_ids.append(torrent_id)
|
filtered_torrent_ids.append(torrent_id)
|
||||||
|
|
||||||
return filtered_torrent_ids
|
return filtered_torrent_ids
|
||||||
|
|
||||||
class FilterManager(component.Component):
|
|
||||||
"""FilterManager
|
|
||||||
|
|
||||||
"""
|
class FilterManager(component.Component):
|
||||||
|
"""FilterManager"""
|
||||||
|
|
||||||
def __init__(self, core):
|
def __init__(self, core):
|
||||||
component.Component.__init__(self, "FilterManager")
|
component.Component.__init__(self, 'FilterManager')
|
||||||
log.debug("FilterManager init..")
|
log.debug('FilterManager init..')
|
||||||
self.core = core
|
self.core = core
|
||||||
self.torrents = core.torrentmanager
|
self.torrents = core.torrentmanager
|
||||||
self.registered_filters = {}
|
self.registered_filters = {}
|
||||||
self.register_filter("keyword", filter_keywords)
|
self.register_filter('keyword', filter_keywords)
|
||||||
self.register_filter("name", filter_by_name)
|
self.register_filter('name', filter_by_name)
|
||||||
self.tree_fields = {}
|
self.tree_fields = {}
|
||||||
|
|
||||||
self.register_tree_field("state", self._init_state_tree)
|
self.register_tree_field('state', self._init_state_tree)
|
||||||
def _init_tracker_tree():
|
|
||||||
return {"Error": 0}
|
|
||||||
self.register_tree_field("tracker_host", _init_tracker_tree)
|
|
||||||
|
|
||||||
self.register_filter("tracker_host", tracker_error_filter)
|
def _init_tracker_tree():
|
||||||
|
return {'Error': 0}
|
||||||
|
|
||||||
|
self.register_tree_field('tracker_host', _init_tracker_tree)
|
||||||
|
|
||||||
|
self.register_filter('tracker_host', tracker_error_filter)
|
||||||
|
|
||||||
def _init_users_tree():
|
def _init_users_tree():
|
||||||
return {"": 0}
|
return {'': 0}
|
||||||
self.register_tree_field("owner", _init_users_tree)
|
|
||||||
|
self.register_tree_field('owner', _init_users_tree)
|
||||||
|
|
||||||
def filter_torrent_ids(self, filter_dict):
|
def filter_torrent_ids(self, filter_dict):
|
||||||
"""
|
"""
|
||||||
@ -151,55 +129,61 @@ class FilterManager(component.Component):
|
|||||||
if not filter_dict:
|
if not filter_dict:
|
||||||
return self.torrents.get_torrent_list()
|
return self.torrents.get_torrent_list()
|
||||||
|
|
||||||
#sanitize input: filter-value must be a list of strings
|
# Sanitize input: filter-value must be a list of strings
|
||||||
for key, value in filter_dict.items():
|
for key, value in filter_dict.items():
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
filter_dict[key] = [value]
|
filter_dict[key] = [value]
|
||||||
|
|
||||||
|
# Optimized filter for id
|
||||||
if "id"in filter_dict: #optimized filter for id:
|
if 'id' in filter_dict:
|
||||||
torrent_ids = list(filter_dict["id"])
|
torrent_ids = list(filter_dict['id'])
|
||||||
del filter_dict["id"]
|
del filter_dict['id']
|
||||||
else:
|
else:
|
||||||
torrent_ids = self.torrents.get_torrent_list()
|
torrent_ids = self.torrents.get_torrent_list()
|
||||||
|
|
||||||
if not filter_dict: #return if there's nothing more to filter
|
# Return if there's nothing more to filter
|
||||||
|
if not filter_dict:
|
||||||
return torrent_ids
|
return torrent_ids
|
||||||
|
|
||||||
#special purpose: state=Active.
|
# Special purpose, state=Active.
|
||||||
if "state" in filter_dict:
|
if 'state' in filter_dict:
|
||||||
# We need to make sure this is a list for the logic below
|
# We need to make sure this is a list for the logic below
|
||||||
filter_dict["state"] = list(filter_dict["state"])
|
filter_dict['state'] = list(filter_dict['state'])
|
||||||
|
|
||||||
if "state" in filter_dict and "Active" in filter_dict["state"]:
|
if 'state' in filter_dict and 'Active' in filter_dict['state']:
|
||||||
filter_dict["state"].remove("Active")
|
filter_dict['state'].remove('Active')
|
||||||
if not filter_dict["state"]:
|
if not filter_dict['state']:
|
||||||
del filter_dict["state"]
|
del filter_dict['state']
|
||||||
torrent_ids = self.filter_state_active(torrent_ids)
|
torrent_ids = self.filter_state_active(torrent_ids)
|
||||||
|
|
||||||
if not filter_dict: #return if there's nothing more to filter
|
if not filter_dict:
|
||||||
return torrent_ids
|
return torrent_ids
|
||||||
|
|
||||||
#Registered filters:
|
# Registered filters
|
||||||
for field, values in filter_dict.items():
|
for field, values in list(filter_dict.items()):
|
||||||
if field in self.registered_filters:
|
if field in self.registered_filters:
|
||||||
# a set filters out the doubles.
|
# Filters out doubles
|
||||||
torrent_ids = list(set(self.registered_filters[field](torrent_ids, values)))
|
torrent_ids = list(
|
||||||
|
set(self.registered_filters[field](torrent_ids, values))
|
||||||
|
)
|
||||||
del filter_dict[field]
|
del filter_dict[field]
|
||||||
|
|
||||||
|
if not filter_dict:
|
||||||
if not filter_dict: #return if there's nothing more to filter
|
|
||||||
return torrent_ids
|
return torrent_ids
|
||||||
|
|
||||||
#leftover filter arguments:
|
torrent_keys, plugin_keys = self.torrents.separate_keys(
|
||||||
#default filter on status fields.
|
list(filter_dict), torrent_ids
|
||||||
status_func = self.core.get_torrent_status #premature optimalisation..
|
)
|
||||||
|
# Leftover filter arguments, default filter on status fields.
|
||||||
for torrent_id in list(torrent_ids):
|
for torrent_id in list(torrent_ids):
|
||||||
status = status_func(torrent_id, filter_dict.keys()) #status={key:value}
|
status = self.core.create_torrent_status(
|
||||||
for field, values in filter_dict.iteritems():
|
torrent_id, torrent_keys, plugin_keys
|
||||||
if (not status[field] in values) and torrent_id in torrent_ids:
|
)
|
||||||
|
for field, values in filter_dict.items():
|
||||||
|
if field in status and status[field] in values:
|
||||||
|
continue
|
||||||
|
elif torrent_id in torrent_ids:
|
||||||
torrent_ids.remove(torrent_id)
|
torrent_ids.remove(torrent_id)
|
||||||
|
|
||||||
return torrent_ids
|
return torrent_ids
|
||||||
|
|
||||||
def get_filter_tree(self, show_zero_hits=True, hide_cat=None):
|
def get_filter_tree(self, show_zero_hits=True, hide_cat=None):
|
||||||
@ -208,56 +192,58 @@ class FilterManager(component.Component):
|
|||||||
for use in sidebar.
|
for use in sidebar.
|
||||||
"""
|
"""
|
||||||
torrent_ids = self.torrents.get_torrent_list()
|
torrent_ids = self.torrents.get_torrent_list()
|
||||||
status_func = self.core.get_torrent_status #premature optimalisation..
|
tree_keys = list(self.tree_fields)
|
||||||
tree_keys = list(self.tree_fields.keys())
|
|
||||||
if hide_cat:
|
if hide_cat:
|
||||||
for cat in hide_cat:
|
for cat in hide_cat:
|
||||||
tree_keys.remove(cat)
|
tree_keys.remove(cat)
|
||||||
|
|
||||||
items = dict( (field, self.tree_fields[field]()) for field in tree_keys)
|
torrent_keys, plugin_keys = self.torrents.separate_keys(tree_keys, torrent_ids)
|
||||||
|
items = {field: self.tree_fields[field]() for field in tree_keys}
|
||||||
|
|
||||||
#count status fields.
|
|
||||||
for torrent_id in list(torrent_ids):
|
for torrent_id in list(torrent_ids):
|
||||||
status = status_func(torrent_id, tree_keys) #status={key:value}
|
status = self.core.create_torrent_status(
|
||||||
|
torrent_id, torrent_keys, plugin_keys
|
||||||
|
) # status={key:value}
|
||||||
for field in tree_keys:
|
for field in tree_keys:
|
||||||
value = status[field]
|
value = status[field]
|
||||||
items[field][value] = items[field].get(value, 0) + 1
|
items[field][value] = items[field].get(value, 0) + 1
|
||||||
|
|
||||||
if "tracker_host" in items:
|
if 'tracker_host' in items:
|
||||||
items["tracker_host"]["All"] = len(torrent_ids)
|
items['tracker_host']['All'] = len(torrent_ids)
|
||||||
items["tracker_host"]["Error"] = len(tracker_error_filter(torrent_ids, ("Error",)))
|
items['tracker_host']['Error'] = len(
|
||||||
|
tracker_error_filter(torrent_ids, ('Error',))
|
||||||
|
)
|
||||||
|
|
||||||
if "state" in tree_keys and not show_zero_hits:
|
if not show_zero_hits:
|
||||||
self._hide_state_items(items["state"])
|
for cat in ['state', 'owner', 'tracker_host']:
|
||||||
|
if cat in tree_keys:
|
||||||
|
self._hide_state_items(items[cat])
|
||||||
|
|
||||||
#return a dict of tuples:
|
# Return a dict of tuples:
|
||||||
sorted_items = {}
|
sorted_items = {field: sorted(items[field].items()) for field in tree_keys}
|
||||||
for field in tree_keys:
|
|
||||||
sorted_items[field] = sorted(items[field].iteritems())
|
|
||||||
|
|
||||||
if "state" in tree_keys:
|
if 'state' in tree_keys:
|
||||||
sorted_items["state"].sort(self._sort_state_items)
|
sorted_items['state'].sort(key=self._sort_state_item)
|
||||||
|
|
||||||
return sorted_items
|
return sorted_items
|
||||||
|
|
||||||
def _init_state_tree(self):
|
def _init_state_tree(self):
|
||||||
return {"All":len(self.torrents.get_torrent_list()),
|
init_state = {}
|
||||||
"Downloading":0,
|
init_state['All'] = len(self.torrents.get_torrent_list())
|
||||||
"Seeding":0,
|
for state in TORRENT_STATE:
|
||||||
"Paused":0,
|
init_state[state] = 0
|
||||||
"Checking":0,
|
init_state['Active'] = len(
|
||||||
"Queued":0,
|
self.filter_state_active(self.torrents.get_torrent_list())
|
||||||
"Error":0,
|
)
|
||||||
"Active":len(self.filter_state_active(self.torrents.get_torrent_list()))
|
return init_state
|
||||||
}
|
|
||||||
|
|
||||||
def register_filter(self, id, filter_func, filter_value = None):
|
def register_filter(self, filter_id, filter_func, filter_value=None):
|
||||||
self.registered_filters[id] = filter_func
|
self.registered_filters[filter_id] = filter_func
|
||||||
|
|
||||||
def deregister_filter(self, id):
|
def deregister_filter(self, filter_id):
|
||||||
del self.registered_filters[id]
|
del self.registered_filters[filter_id]
|
||||||
|
|
||||||
def register_tree_field(self, field, init_func = lambda : {}):
|
def register_tree_field(self, field, init_func=lambda: {}):
|
||||||
self.tree_fields[field] = init_func
|
self.tree_fields[field] = init_func
|
||||||
|
|
||||||
def deregister_tree_field(self, field):
|
def deregister_tree_field(self, field):
|
||||||
@ -265,30 +251,24 @@ class FilterManager(component.Component):
|
|||||||
del self.tree_fields[field]
|
del self.tree_fields[field]
|
||||||
|
|
||||||
def filter_state_active(self, torrent_ids):
|
def filter_state_active(self, torrent_ids):
|
||||||
get_status = self.core.get_torrent_status
|
|
||||||
for torrent_id in list(torrent_ids):
|
for torrent_id in list(torrent_ids):
|
||||||
status = get_status(torrent_id, ["download_payload_rate", "upload_payload_rate"])
|
status = self.torrents[torrent_id].get_status(
|
||||||
if status["download_payload_rate"] or status["upload_payload_rate"]:
|
['download_payload_rate', 'upload_payload_rate']
|
||||||
pass #ok
|
)
|
||||||
|
if status['download_payload_rate'] or status['upload_payload_rate']:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
torrent_ids.remove(torrent_id)
|
torrent_ids.remove(torrent_id)
|
||||||
return torrent_ids
|
return torrent_ids
|
||||||
|
|
||||||
def _hide_state_items(self, state_items):
|
def _hide_state_items(self, state_items):
|
||||||
"for hide(show)-zero hits"
|
"""For hide(show)-zero hits"""
|
||||||
for (value, count) in state_items.items():
|
for value, count in list(state_items.items()):
|
||||||
if value != "All" and count == 0:
|
if value != 'All' and count == 0:
|
||||||
del state_items[value]
|
del state_items[value]
|
||||||
|
|
||||||
def _sort_state_items(self, x, y):
|
def _sort_state_item(self, item):
|
||||||
""
|
try:
|
||||||
if x[0] in STATE_SORT:
|
return STATE_SORT.index(item[0])
|
||||||
ix = STATE_SORT.index(x[0])
|
except ValueError:
|
||||||
else:
|
return 99
|
||||||
ix = 99
|
|
||||||
if y[0] in STATE_SORT:
|
|
||||||
iy = STATE_SORT.index(y[0])
|
|
||||||
else:
|
|
||||||
iy = 99
|
|
||||||
|
|
||||||
return ix - iy
|
|
||||||
|
|||||||
@ -1,143 +0,0 @@
|
|||||||
#
|
|
||||||
# oldstateupgrader.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# Deluge is free software.
|
|
||||||
#
|
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import pickle
|
|
||||||
import cPickle
|
|
||||||
import shutil
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
from deluge.configmanager import ConfigManager, get_config_dir
|
|
||||||
import deluge.core.torrentmanager
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
#start : http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286203
|
|
||||||
def makeFakeClass(module, name):
|
|
||||||
class FakeThing(object):
|
|
||||||
pass
|
|
||||||
FakeThing.__name__ = name
|
|
||||||
FakeThing.__module__ = '(fake)' + module
|
|
||||||
return FakeThing
|
|
||||||
|
|
||||||
class PickleUpgrader(pickle.Unpickler):
|
|
||||||
def find_class(self, module, cname):
|
|
||||||
# Pickle tries to load a couple things like copy_reg and
|
|
||||||
# __builtin__.object even though a pickle file doesn't
|
|
||||||
# explicitly reference them (afaict): allow them to be loaded
|
|
||||||
# normally.
|
|
||||||
if module in ('copy_reg', '__builtin__'):
|
|
||||||
thing = pickle.Unpickler.find_class(self, module, cname)
|
|
||||||
return thing
|
|
||||||
return makeFakeClass(module, cname)
|
|
||||||
# end: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286203
|
|
||||||
|
|
||||||
class OldStateUpgrader:
|
|
||||||
def __init__(self):
|
|
||||||
self.config = ConfigManager("core.conf")
|
|
||||||
self.state05_location = os.path.join(get_config_dir(), "persistent.state")
|
|
||||||
self.state10_location = os.path.join(get_config_dir(), "state", "torrents.state")
|
|
||||||
if os.path.exists(self.state05_location) and not os.path.exists(self.state10_location):
|
|
||||||
# If the 0.5 state file exists and the 1.0 doesn't, then let's upgrade it
|
|
||||||
self.upgrade05()
|
|
||||||
|
|
||||||
def upgrade05(self):
|
|
||||||
try:
|
|
||||||
state = PickleUpgrader(open(self.state05_location, "rb")).load()
|
|
||||||
except Exception, e:
|
|
||||||
log.debug("Unable to open 0.5 state file: %s", e)
|
|
||||||
return
|
|
||||||
|
|
||||||
# Check to see if we can upgrade this file
|
|
||||||
if type(state).__name__ == 'list':
|
|
||||||
log.warning("0.5 state file is too old to upgrade")
|
|
||||||
return
|
|
||||||
|
|
||||||
new_state = deluge.core.torrentmanager.TorrentManagerState()
|
|
||||||
for ti, uid in state.torrents.items():
|
|
||||||
torrent_path = os.path.join(get_config_dir(), "torrentfiles", ti.filename)
|
|
||||||
try:
|
|
||||||
torrent_info = None
|
|
||||||
log.debug("Attempting to create torrent_info from %s", torrent_path)
|
|
||||||
_file = open(torrent_path, "rb")
|
|
||||||
torrent_info = lt.torrent_info(lt.bdecode(_file.read()))
|
|
||||||
_file.close()
|
|
||||||
except (IOError, RuntimeError), e:
|
|
||||||
log.warning("Unable to open %s: %s", torrent_path, e)
|
|
||||||
|
|
||||||
# Copy the torrent file to the new location
|
|
||||||
import shutil
|
|
||||||
shutil.copyfile(torrent_path, os.path.join(get_config_dir(), "state", str(torrent_info.info_hash()) + ".torrent"))
|
|
||||||
|
|
||||||
# Set the file prioritiy property if not already there
|
|
||||||
if not hasattr(ti, "priorities"):
|
|
||||||
ti.priorities = [1] * torrent_info.num_files()
|
|
||||||
|
|
||||||
# Create the new TorrentState object
|
|
||||||
new_torrent = deluge.core.torrentmanager.TorrentState(
|
|
||||||
torrent_id=str(torrent_info.info_hash()),
|
|
||||||
filename=ti.filename,
|
|
||||||
save_path=ti.save_dir,
|
|
||||||
compact=ti.compact,
|
|
||||||
paused=ti.user_paused,
|
|
||||||
total_uploaded=ti.uploaded_memory,
|
|
||||||
max_upload_speed=ti.upload_rate_limit,
|
|
||||||
max_download_speed=ti.download_rate_limit,
|
|
||||||
file_priorities=ti.priorities,
|
|
||||||
queue=state.queue.index(ti)
|
|
||||||
)
|
|
||||||
# Append the object to the state list
|
|
||||||
new_state.torrents.append(new_torrent)
|
|
||||||
|
|
||||||
# Now we need to write out the new state file
|
|
||||||
try:
|
|
||||||
log.debug("Saving torrent state file.")
|
|
||||||
state_file = open(
|
|
||||||
os.path.join(get_config_dir(), "state", "torrents.state"), "wb")
|
|
||||||
cPickle.dump(new_state, state_file)
|
|
||||||
state_file.close()
|
|
||||||
except IOError, e:
|
|
||||||
log.warning("Unable to save state file: %s", e)
|
|
||||||
return
|
|
||||||
|
|
||||||
# Rename the persistent.state file
|
|
||||||
try:
|
|
||||||
os.rename(self.state05_location, self.state05_location + ".old")
|
|
||||||
except Exception, e:
|
|
||||||
log.debug("Unable to rename old persistent.state file! %s", e)
|
|
||||||
@ -1,62 +1,37 @@
|
|||||||
#
|
#
|
||||||
# pluginmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
"""PluginManager for Core"""
|
"""PluginManager for Core"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from deluge.event import PluginEnabledEvent, PluginDisabledEvent
|
from twisted.internet import defer
|
||||||
import deluge.pluginmanagerbase
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
|
import deluge.pluginmanagerbase
|
||||||
|
from deluge.event import PluginDisabledEvent, PluginEnabledEvent
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
|
||||||
component.Component):
|
class PluginManager(deluge.pluginmanagerbase.PluginManagerBase, component.Component):
|
||||||
"""PluginManager handles the loading of plugins and provides plugins with
|
"""PluginManager handles the loading of plugins and provides plugins with
|
||||||
functions to access parts of the core."""
|
functions to access parts of the core."""
|
||||||
|
|
||||||
def __init__(self, core):
|
def __init__(self, core):
|
||||||
component.Component.__init__(self, "CorePluginManager")
|
component.Component.__init__(self, 'CorePluginManager')
|
||||||
|
|
||||||
self.status_fields = {}
|
self.status_fields = {}
|
||||||
|
|
||||||
# Call the PluginManagerBase constructor
|
# Call the PluginManagerBase constructor
|
||||||
deluge.pluginmanagerbase.PluginManagerBase.__init__(
|
deluge.pluginmanagerbase.PluginManagerBase.__init__(
|
||||||
self, "core.conf", "deluge.plugin.core")
|
self, 'core.conf', 'deluge.plugin.core'
|
||||||
|
)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
# Enable plugins that are enabled in the config
|
# Enable plugins that are enabled in the config
|
||||||
@ -70,28 +45,44 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
|||||||
self.stop()
|
self.stop()
|
||||||
|
|
||||||
def update_plugins(self):
|
def update_plugins(self):
|
||||||
for plugin in self.plugins.keys():
|
for plugin in self.plugins:
|
||||||
if hasattr(self.plugins[plugin], "update"):
|
if hasattr(self.plugins[plugin], 'update'):
|
||||||
try:
|
try:
|
||||||
self.plugins[plugin].update()
|
self.plugins[plugin].update()
|
||||||
except Exception, e:
|
except Exception as ex:
|
||||||
log.exception(e)
|
log.exception(ex)
|
||||||
|
|
||||||
def enable_plugin(self, name):
|
def enable_plugin(self, name):
|
||||||
|
d = defer.succeed(True)
|
||||||
if name not in self.plugins:
|
if name not in self.plugins:
|
||||||
super(PluginManager, self).enable_plugin(name)
|
d = deluge.pluginmanagerbase.PluginManagerBase.enable_plugin(self, name)
|
||||||
if name in self.plugins:
|
|
||||||
component.get("EventManager").emit(PluginEnabledEvent(name))
|
def on_enable_plugin(result):
|
||||||
|
if result is True and name in self.plugins:
|
||||||
|
component.get('EventManager').emit(PluginEnabledEvent(name))
|
||||||
|
return result
|
||||||
|
|
||||||
|
d.addBoth(on_enable_plugin)
|
||||||
|
return d
|
||||||
|
|
||||||
def disable_plugin(self, name):
|
def disable_plugin(self, name):
|
||||||
|
d = defer.succeed(True)
|
||||||
if name in self.plugins:
|
if name in self.plugins:
|
||||||
super(PluginManager, self).disable_plugin(name)
|
d = deluge.pluginmanagerbase.PluginManagerBase.disable_plugin(self, name)
|
||||||
if name not in self.plugins:
|
|
||||||
component.get("EventManager").emit(PluginDisabledEvent(name))
|
def on_disable_plugin(result):
|
||||||
|
if name not in self.plugins:
|
||||||
|
component.get('EventManager').emit(PluginDisabledEvent(name))
|
||||||
|
return result
|
||||||
|
|
||||||
|
d.addBoth(on_disable_plugin)
|
||||||
|
return d
|
||||||
|
|
||||||
def get_status(self, torrent_id, fields):
|
def get_status(self, torrent_id, fields):
|
||||||
"""Return the value of status fields for the selected torrent_id."""
|
"""Return the value of status fields for the selected torrent_id."""
|
||||||
status = {}
|
status = {}
|
||||||
|
if len(fields) == 0:
|
||||||
|
fields = list(self.status_fields)
|
||||||
for field in fields:
|
for field in fields:
|
||||||
try:
|
try:
|
||||||
status[field] = self.status_fields[field](torrent_id)
|
status[field] = self.status_fields[field](torrent_id)
|
||||||
@ -102,13 +93,13 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
|||||||
def register_status_field(self, field, function):
|
def register_status_field(self, field, function):
|
||||||
"""Register a new status field. This can be used in the same way the
|
"""Register a new status field. This can be used in the same way the
|
||||||
client requests other status information from core."""
|
client requests other status information from core."""
|
||||||
log.debug("Registering status field %s with PluginManager", field)
|
log.debug('Registering status field %s with PluginManager', field)
|
||||||
self.status_fields[field] = function
|
self.status_fields[field] = function
|
||||||
|
|
||||||
def deregister_status_field(self, field):
|
def deregister_status_field(self, field):
|
||||||
"""Deregisters a status field"""
|
"""Deregisters a status field"""
|
||||||
log.debug("Deregistering status field %s with PluginManager", field)
|
log.debug('Deregistering status field %s with PluginManager', field)
|
||||||
try:
|
try:
|
||||||
del self.status_fields[field]
|
del self.status_fields[field]
|
||||||
except:
|
except Exception:
|
||||||
log.warning("Unable to deregister status field %s", field)
|
log.warning('Unable to deregister status field %s', field)
|
||||||
|
|||||||
@ -1,165 +1,158 @@
|
|||||||
#
|
#
|
||||||
# preferencesmanager.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008-2010 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2008-2010 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import random
|
||||||
import threading
|
import threading
|
||||||
|
from urllib.parse import quote_plus
|
||||||
|
from urllib.request import urlopen
|
||||||
|
|
||||||
from twisted.internet.task import LoopingCall
|
from twisted.internet.task import LoopingCall
|
||||||
|
|
||||||
from deluge._libtorrent import lt
|
|
||||||
|
|
||||||
from deluge.event import *
|
|
||||||
import deluge.configmanager
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
|
import deluge.configmanager
|
||||||
|
from deluge._libtorrent import lt
|
||||||
|
from deluge.event import ConfigValueChangedEvent
|
||||||
|
|
||||||
|
GeoIP = None
|
||||||
|
try:
|
||||||
|
from GeoIP import GeoIP
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
from pygeoip import GeoIP
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_PREFS = {
|
DEFAULT_PREFS = {
|
||||||
"send_info": False,
|
'send_info': False,
|
||||||
"info_sent": 0.0,
|
'info_sent': 0.0,
|
||||||
"daemon_port": 58846,
|
'daemon_port': 58846,
|
||||||
"allow_remote": False,
|
'allow_remote': False,
|
||||||
"compact_allocation": False,
|
'pre_allocate_storage': False,
|
||||||
"download_location": deluge.common.get_default_download_dir(),
|
'download_location': deluge.common.get_default_download_dir(),
|
||||||
"listen_ports": [6881, 6891],
|
'listen_ports': [6881, 6891],
|
||||||
"listen_interface": "",
|
'listen_interface': '',
|
||||||
"copy_torrent_file": False,
|
'outgoing_interface': '',
|
||||||
"del_copy_torrent_file": False,
|
'random_port': True,
|
||||||
"torrentfiles_location": deluge.common.get_default_download_dir(),
|
'listen_random_port': None,
|
||||||
"plugins_location": os.path.join(deluge.configmanager.get_config_dir(), "plugins"),
|
'listen_use_sys_port': False,
|
||||||
"prioritize_first_last_pieces": False,
|
'listen_reuse_port': True,
|
||||||
"sequential_download": False,
|
'outgoing_ports': [0, 0],
|
||||||
"random_port": True,
|
'random_outgoing_ports': True,
|
||||||
"dht": True,
|
'copy_torrent_file': False,
|
||||||
"upnp": True,
|
'del_copy_torrent_file': False,
|
||||||
"natpmp": True,
|
'torrentfiles_location': deluge.common.get_default_download_dir(),
|
||||||
"utpex": True,
|
'plugins_location': os.path.join(deluge.configmanager.get_config_dir(), 'plugins'),
|
||||||
"lsd": True,
|
'prioritize_first_last_pieces': False,
|
||||||
"enc_in_policy": 1,
|
'sequential_download': False,
|
||||||
"enc_out_policy": 1,
|
'dht': True,
|
||||||
"enc_level": 2,
|
'upnp': True,
|
||||||
"enc_prefer_rc4": True,
|
'natpmp': True,
|
||||||
"max_connections_global": 200,
|
'utpex': True,
|
||||||
"max_upload_speed": -1.0,
|
'lsd': True,
|
||||||
"max_download_speed": -1.0,
|
'enc_in_policy': 1,
|
||||||
"max_upload_slots_global": 4,
|
'enc_out_policy': 1,
|
||||||
"max_half_open_connections": (lambda: deluge.common.windows_check() and
|
'enc_level': 2,
|
||||||
(lambda: deluge.common.vista_check() and 4 or 8)() or 50)(),
|
'max_connections_global': 200,
|
||||||
"max_connections_per_second": 20,
|
'max_upload_speed': -1.0,
|
||||||
"ignore_limits_on_local_network": True,
|
'max_download_speed': -1.0,
|
||||||
"max_connections_per_torrent": -1,
|
'max_upload_slots_global': 4,
|
||||||
"max_upload_slots_per_torrent": -1,
|
'max_half_open_connections': (
|
||||||
"max_upload_speed_per_torrent": -1,
|
lambda: deluge.common.windows_check()
|
||||||
"max_download_speed_per_torrent": -1,
|
and (lambda: deluge.common.vista_check() and 4 or 8)()
|
||||||
"enabled_plugins": [],
|
or 50
|
||||||
"add_paused": False,
|
)(),
|
||||||
"max_active_seeding": 5,
|
'max_connections_per_second': 20,
|
||||||
"max_active_downloading": 3,
|
'ignore_limits_on_local_network': True,
|
||||||
"max_active_limit": 8,
|
'max_connections_per_torrent': -1,
|
||||||
"dont_count_slow_torrents": False,
|
'max_upload_slots_per_torrent': -1,
|
||||||
"queue_new_to_top": False,
|
'max_upload_speed_per_torrent': -1,
|
||||||
"stop_seed_at_ratio": False,
|
'max_download_speed_per_torrent': -1,
|
||||||
"remove_seed_at_ratio": False,
|
'enabled_plugins': [],
|
||||||
"stop_seed_ratio": 2.00,
|
'add_paused': False,
|
||||||
"share_ratio_limit": 2.00,
|
'max_active_seeding': 5,
|
||||||
"seed_time_ratio_limit": 7.00,
|
'max_active_downloading': 3,
|
||||||
"seed_time_limit": 180,
|
'max_active_limit': 8,
|
||||||
"auto_managed": True,
|
'dont_count_slow_torrents': False,
|
||||||
"move_completed": False,
|
'queue_new_to_top': False,
|
||||||
"move_completed_path": deluge.common.get_default_download_dir(),
|
'stop_seed_at_ratio': False,
|
||||||
"new_release_check": True,
|
'remove_seed_at_ratio': False,
|
||||||
"proxies": {
|
'stop_seed_ratio': 2.00,
|
||||||
"peer": {
|
'share_ratio_limit': 2.00,
|
||||||
"type": 0,
|
'seed_time_ratio_limit': 7.00,
|
||||||
"hostname": "",
|
'seed_time_limit': 180,
|
||||||
"username": "",
|
'auto_managed': True,
|
||||||
"password": "",
|
'move_completed': False,
|
||||||
"port": 8080
|
'move_completed_path': deluge.common.get_default_download_dir(),
|
||||||
},
|
'move_completed_paths_list': [],
|
||||||
"web_seed": {
|
'download_location_paths_list': [],
|
||||||
"type": 0,
|
'path_chooser_show_chooser_button_on_localhost': True,
|
||||||
"hostname": "",
|
'path_chooser_auto_complete_enabled': True,
|
||||||
"username": "",
|
'path_chooser_accelerator_string': 'Tab',
|
||||||
"password": "",
|
'path_chooser_max_popup_rows': 20,
|
||||||
"port": 8080
|
'path_chooser_show_hidden_files': False,
|
||||||
},
|
'new_release_check': True,
|
||||||
"tracker": {
|
'proxy': {
|
||||||
"type": 0,
|
'type': 0,
|
||||||
"hostname": "",
|
'hostname': '',
|
||||||
"username": "",
|
'username': '',
|
||||||
"password": "",
|
'password': '',
|
||||||
"port": 8080
|
'port': 8080,
|
||||||
},
|
'proxy_hostnames': True,
|
||||||
"dht": {
|
'proxy_peer_connections': True,
|
||||||
"type": 0,
|
'proxy_tracker_connections': True,
|
||||||
"hostname": "",
|
'force_proxy': False,
|
||||||
"username": "",
|
'anonymous_mode': False,
|
||||||
"password": "",
|
|
||||||
"port": 8080
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
},
|
||||||
"outgoing_ports": [0, 0],
|
'peer_tos': '0x00',
|
||||||
"random_outgoing_ports": True,
|
'rate_limit_ip_overhead': True,
|
||||||
"peer_tos": "0x00",
|
'geoip_db_location': '/usr/share/GeoIP/GeoIP.dat',
|
||||||
"rate_limit_ip_overhead": True,
|
'cache_size': 512,
|
||||||
"geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
|
'cache_expiry': 60,
|
||||||
"cache_size": 512,
|
'auto_manage_prefer_seeds': False,
|
||||||
"cache_expiry": 60,
|
'shared': False,
|
||||||
"auto_manage_prefer_seeds": False,
|
'super_seeding': False,
|
||||||
"shared": False
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class PreferencesManager(component.Component):
|
class PreferencesManager(component.Component):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
component.Component.__init__(self, "PreferencesManager")
|
component.Component.__init__(self, 'PreferencesManager')
|
||||||
|
self.config = deluge.configmanager.ConfigManager('core.conf', DEFAULT_PREFS)
|
||||||
|
if 'proxies' in self.config:
|
||||||
|
log.warning(
|
||||||
|
'Updating config file for proxy, using "peer" values to fill new "proxy" setting'
|
||||||
|
)
|
||||||
|
self.config['proxy'].update(self.config['proxies']['peer'])
|
||||||
|
log.warning('New proxy config is: %s', self.config['proxy'])
|
||||||
|
del self.config['proxies']
|
||||||
|
if 'i2p_proxy' in self.config and self.config['i2p_proxy']['hostname']:
|
||||||
|
self.config['proxy'].update(self.config['i2p_proxy'])
|
||||||
|
self.config['proxy']['type'] = 6
|
||||||
|
del self.config['i2p_proxy']
|
||||||
|
if 'anonymous_mode' in self.config:
|
||||||
|
self.config['proxy']['anonymous_mode'] = self.config['anonymous_mode']
|
||||||
|
del self.config['anonymous_mode']
|
||||||
|
if 'proxy' in self.config:
|
||||||
|
for key in DEFAULT_PREFS['proxy']:
|
||||||
|
if key not in self.config['proxy']:
|
||||||
|
self.config['proxy'][key] = DEFAULT_PREFS['proxy'][key]
|
||||||
|
|
||||||
self.config = deluge.configmanager.ConfigManager("core.conf", DEFAULT_PREFS)
|
self.core = component.get('Core')
|
||||||
if 'public' in self.config:
|
|
||||||
log.debug("Updating configuration file: Renamed torrent's public "
|
|
||||||
"attribute to shared.")
|
|
||||||
self.config["shared"] = self.config["public"]
|
|
||||||
del self.config["public"]
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
self.core = component.get("Core")
|
|
||||||
self.session = component.get("Core").session
|
|
||||||
self.new_release_timer = None
|
self.new_release_timer = None
|
||||||
|
|
||||||
|
def start(self):
|
||||||
# Set the initial preferences on start-up
|
# Set the initial preferences on start-up
|
||||||
for key in DEFAULT_PREFS:
|
for key in DEFAULT_PREFS:
|
||||||
self.do_config_set_func(key, self.config[key])
|
self.do_config_set_func(key, self.config[key])
|
||||||
@ -172,123 +165,131 @@ class PreferencesManager(component.Component):
|
|||||||
|
|
||||||
# Config set functions
|
# Config set functions
|
||||||
def do_config_set_func(self, key, value):
|
def do_config_set_func(self, key, value):
|
||||||
on_set_func = getattr(self, "_on_set_" + key, None)
|
on_set_func = getattr(self, '_on_set_' + key, None)
|
||||||
if on_set_func:
|
if on_set_func:
|
||||||
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
|
log.debug('Config key: %s set to %s..', key, value)
|
||||||
on_set_func(key, value)
|
on_set_func(key, value)
|
||||||
|
|
||||||
def session_set_setting(self, key, value):
|
|
||||||
settings = self.session.settings()
|
|
||||||
setattr(settings, key, value)
|
|
||||||
self.session.set_settings(settings)
|
|
||||||
|
|
||||||
def _on_config_value_change(self, key, value):
|
def _on_config_value_change(self, key, value):
|
||||||
self.do_config_set_func(key, value)
|
if self.get_state() == 'Started':
|
||||||
component.get("EventManager").emit(ConfigValueChangedEvent(key, value))
|
self.do_config_set_func(key, value)
|
||||||
|
component.get('EventManager').emit(ConfigValueChangedEvent(key, value))
|
||||||
|
|
||||||
def _on_set_torrentfiles_location(self, key, value):
|
def _on_set_torrentfiles_location(self, key, value):
|
||||||
if self.config["copy_torrent_file"]:
|
if self.config['copy_torrent_file']:
|
||||||
try:
|
try:
|
||||||
os.makedirs(value)
|
os.makedirs(value)
|
||||||
except Exception, e:
|
except OSError as ex:
|
||||||
log.debug("Unable to make directory: %s", e)
|
log.debug('Unable to make directory: %s', ex)
|
||||||
|
|
||||||
def _on_set_listen_ports(self, key, value):
|
def _on_set_listen_ports(self, key, value):
|
||||||
# Only set the listen ports if random_port is not true
|
self.__set_listen_on()
|
||||||
if self.config["random_port"] is not True:
|
|
||||||
log.debug("listen port range set to %s-%s", value[0], value[1])
|
|
||||||
self.session.listen_on(
|
|
||||||
value[0], value[1], str(self.config["listen_interface"])
|
|
||||||
)
|
|
||||||
|
|
||||||
def _on_set_listen_interface(self, key, value):
|
def _on_set_listen_interface(self, key, value):
|
||||||
# Call the random_port callback since it'll do what we need
|
self.__set_listen_on()
|
||||||
self._on_set_random_port("random_port", self.config["random_port"])
|
|
||||||
|
def _on_set_outgoing_interface(self, key, value):
|
||||||
|
"""Set interface name or IP address for outgoing BitTorrent connections."""
|
||||||
|
value = value.strip() if value else ''
|
||||||
|
self.core.apply_session_settings({'outgoing_interfaces': value})
|
||||||
|
|
||||||
def _on_set_random_port(self, key, value):
|
def _on_set_random_port(self, key, value):
|
||||||
log.debug("random port value set to %s", value)
|
self.__set_listen_on()
|
||||||
# We need to check if the value has been changed to true and false
|
|
||||||
# and then handle accordingly.
|
|
||||||
if value:
|
|
||||||
import random
|
|
||||||
listen_ports = []
|
|
||||||
randrange = lambda: random.randrange(49152, 65525)
|
|
||||||
listen_ports.append(randrange())
|
|
||||||
listen_ports.append(listen_ports[0]+10)
|
|
||||||
else:
|
|
||||||
listen_ports = self.config["listen_ports"]
|
|
||||||
|
|
||||||
# Set the listen ports
|
def __set_listen_on(self):
|
||||||
log.debug("listen port range set to %s-%s", listen_ports[0],
|
"""Set the ports and interface address to listen for incoming connections on."""
|
||||||
listen_ports[1])
|
if self.config['random_port']:
|
||||||
self.session.listen_on(
|
if not self.config['listen_random_port']:
|
||||||
listen_ports[0], listen_ports[1],
|
self.config['listen_random_port'] = random.randrange(49152, 65525)
|
||||||
str(self.config["listen_interface"])
|
listen_ports = [
|
||||||
|
self.config['listen_random_port']
|
||||||
|
] * 2 # use single port range
|
||||||
|
else:
|
||||||
|
self.config['listen_random_port'] = None
|
||||||
|
listen_ports = self.config['listen_ports']
|
||||||
|
|
||||||
|
if self.config['listen_interface']:
|
||||||
|
interface = self.config['listen_interface'].strip()
|
||||||
|
else:
|
||||||
|
interface = '0.0.0.0'
|
||||||
|
|
||||||
|
log.debug(
|
||||||
|
'Listen Interface: %s, Ports: %s with use_sys_port: %s',
|
||||||
|
interface,
|
||||||
|
listen_ports,
|
||||||
|
self.config['listen_use_sys_port'],
|
||||||
|
)
|
||||||
|
interfaces = [
|
||||||
|
f'{interface}:{port}'
|
||||||
|
for port in range(listen_ports[0], listen_ports[1] + 1)
|
||||||
|
]
|
||||||
|
self.core.apply_session_settings(
|
||||||
|
{
|
||||||
|
'listen_system_port_fallback': self.config['listen_use_sys_port'],
|
||||||
|
'listen_interfaces': ','.join(interfaces),
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def _on_set_outgoing_ports(self, key, value):
|
def _on_set_outgoing_ports(self, key, value):
|
||||||
if not self.config["random_outgoing_ports"]:
|
self.__set_outgoing_ports()
|
||||||
log.debug("outgoing port range set to %s-%s", value[0], value[1])
|
|
||||||
self.session_set_setting("outgoing_ports", (value[0], value[1]))
|
|
||||||
|
|
||||||
def _on_set_random_outgoing_ports(self, key, value):
|
def _on_set_random_outgoing_ports(self, key, value):
|
||||||
if value:
|
self.__set_outgoing_ports()
|
||||||
self.session.outgoing_ports(0, 0)
|
|
||||||
|
def __set_outgoing_ports(self):
|
||||||
|
port = (
|
||||||
|
0
|
||||||
|
if self.config['random_outgoing_ports']
|
||||||
|
else self.config['outgoing_ports'][0]
|
||||||
|
)
|
||||||
|
if port:
|
||||||
|
num_ports = (
|
||||||
|
self.config['outgoing_ports'][1] - self.config['outgoing_ports'][0]
|
||||||
|
)
|
||||||
|
num_ports = num_ports if num_ports > 1 else 5
|
||||||
|
else:
|
||||||
|
num_ports = 0
|
||||||
|
log.debug('Outgoing port set to %s with range: %s', port, num_ports)
|
||||||
|
self.core.apply_session_settings(
|
||||||
|
{'outgoing_port': port, 'num_outgoing_ports': num_ports}
|
||||||
|
)
|
||||||
|
|
||||||
def _on_set_peer_tos(self, key, value):
|
def _on_set_peer_tos(self, key, value):
|
||||||
log.debug("setting peer_tos to: %s", value)
|
|
||||||
try:
|
try:
|
||||||
self.session_set_setting("peer_tos", chr(int(value, 16)))
|
self.core.apply_session_setting('peer_tos', int(value, 16))
|
||||||
except ValueError, e:
|
except ValueError as ex:
|
||||||
log.debug("Invalid tos byte: %s", e)
|
log.error('Invalid tos byte: %s', ex)
|
||||||
return
|
|
||||||
|
|
||||||
def _on_set_dht(self, key, value):
|
def _on_set_dht(self, key, value):
|
||||||
log.debug("dht value set to %s", value)
|
lt_bootstraps = self.core.session.get_settings()['dht_bootstrap_nodes']
|
||||||
state_file = deluge.configmanager.get_config_dir("dht.state")
|
# Update list of lt bootstraps, using set to remove duplicates.
|
||||||
if value:
|
dht_bootstraps = set(
|
||||||
state = None
|
lt_bootstraps.split(',')
|
||||||
try:
|
+ [
|
||||||
state = lt.bdecode(open(state_file, "rb").read())
|
'router.bittorrent.com:6881',
|
||||||
except Exception, e:
|
'router.utorrent.com:6881',
|
||||||
log.warning("Unable to read DHT state file: %s", e)
|
'router.bitcomet.com:6881',
|
||||||
|
'dht.transmissionbt.com:6881',
|
||||||
try:
|
'dht.aelitis.com:6881',
|
||||||
self.session.start_dht(state)
|
]
|
||||||
except Exception, e:
|
)
|
||||||
log.warning("Restoring old DHT state failed: %s", e)
|
self.core.apply_session_settings(
|
||||||
self.session.start_dht(None)
|
{'dht_bootstrap_nodes': ','.join(dht_bootstraps), 'enable_dht': value}
|
||||||
self.session.add_dht_router("router.bittorrent.com", 6881)
|
)
|
||||||
self.session.add_dht_router("router.utorrent.com", 6881)
|
|
||||||
self.session.add_dht_router("router.bitcomet.com", 6881)
|
|
||||||
else:
|
|
||||||
self.core.save_dht_state()
|
|
||||||
self.session.stop_dht()
|
|
||||||
|
|
||||||
def _on_set_upnp(self, key, value):
|
def _on_set_upnp(self, key, value):
|
||||||
log.debug("upnp value set to %s", value)
|
self.core.apply_session_setting('enable_upnp', value)
|
||||||
if value:
|
|
||||||
self.session.start_upnp()
|
|
||||||
else:
|
|
||||||
self.session.stop_upnp()
|
|
||||||
|
|
||||||
def _on_set_natpmp(self, key, value):
|
def _on_set_natpmp(self, key, value):
|
||||||
log.debug("natpmp value set to %s", value)
|
self.core.apply_session_setting('enable_natpmp', value)
|
||||||
if value:
|
|
||||||
self.session.start_natpmp()
|
|
||||||
else:
|
|
||||||
self.session.stop_natpmp()
|
|
||||||
|
|
||||||
def _on_set_lsd(self, key, value):
|
def _on_set_lsd(self, key, value):
|
||||||
log.debug("lsd value set to %s", value)
|
self.core.apply_session_setting('enable_lsd', value)
|
||||||
if value:
|
|
||||||
self.session.start_lsd()
|
|
||||||
else:
|
|
||||||
self.session.stop_lsd()
|
|
||||||
|
|
||||||
def _on_set_utpex(self, key, value):
|
def _on_set_utpex(self, key, value):
|
||||||
log.debug("utpex value set to %s", value)
|
|
||||||
if value:
|
if value:
|
||||||
self.session.add_extension(lt.create_ut_pex_plugin)
|
self.core.session.add_extension('ut_pex')
|
||||||
|
|
||||||
def _on_set_enc_in_policy(self, key, value):
|
def _on_set_enc_in_policy(self, key, value):
|
||||||
self._on_set_encryption(key, value)
|
self._on_set_encryption(key, value)
|
||||||
@ -299,179 +300,177 @@ class PreferencesManager(component.Component):
|
|||||||
def _on_set_enc_level(self, key, value):
|
def _on_set_enc_level(self, key, value):
|
||||||
self._on_set_encryption(key, value)
|
self._on_set_encryption(key, value)
|
||||||
|
|
||||||
def _on_set_enc_prefer_rc4(self, key, value):
|
|
||||||
self._on_set_encryption(key, value)
|
|
||||||
|
|
||||||
def _on_set_encryption(self, key, value):
|
def _on_set_encryption(self, key, value):
|
||||||
log.debug("encryption value %s set to %s..", key, value)
|
# Convert Deluge enc_level values to libtorrent enc_level values.
|
||||||
pe_settings = lt.pe_settings()
|
pe_enc_level = {
|
||||||
pe_settings.out_enc_policy = \
|
0: lt.enc_level.plaintext,
|
||||||
lt.enc_policy(self.config["enc_out_policy"])
|
1: lt.enc_level.rc4,
|
||||||
pe_settings.in_enc_policy = lt.enc_policy(self.config["enc_in_policy"])
|
2: lt.enc_level.both,
|
||||||
pe_settings.allowed_enc_level = lt.enc_level(self.config["enc_level"])
|
}
|
||||||
pe_settings.prefer_rc4 = self.config["enc_prefer_rc4"]
|
self.core.apply_session_settings(
|
||||||
self.session.set_pe_settings(pe_settings)
|
{
|
||||||
set = self.session.get_pe_settings()
|
'out_enc_policy': lt.enc_policy(self.config['enc_out_policy']),
|
||||||
log.debug("encryption settings:\n\t\t\tout_policy: %s\n\t\t\
|
'in_enc_policy': lt.enc_policy(self.config['enc_in_policy']),
|
||||||
in_policy: %s\n\t\t\tlevel: %s\n\t\t\tprefer_rc4: %s",
|
'allowed_enc_level': lt.enc_level(
|
||||||
set.out_enc_policy,
|
pe_enc_level[self.config['enc_level']]
|
||||||
set.in_enc_policy,
|
),
|
||||||
set.allowed_enc_level,
|
'prefer_rc4': True,
|
||||||
set.prefer_rc4)
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def _on_set_max_connections_global(self, key, value):
|
def _on_set_max_connections_global(self, key, value):
|
||||||
log.debug("max_connections_global set to %s..", value)
|
self.core.apply_session_setting('connections_limit', value)
|
||||||
self.session.set_max_connections(value)
|
|
||||||
|
|
||||||
def _on_set_max_upload_speed(self, key, value):
|
def _on_set_max_upload_speed(self, key, value):
|
||||||
log.debug("max_upload_speed set to %s..", value)
|
|
||||||
# We need to convert Kb/s to B/s
|
# We need to convert Kb/s to B/s
|
||||||
if value < 0:
|
value = -1 if value < 0 else int(value * 1024)
|
||||||
v = -1
|
self.core.apply_session_setting('upload_rate_limit', value)
|
||||||
else:
|
|
||||||
v = int(value * 1024)
|
|
||||||
|
|
||||||
self.session.set_upload_rate_limit(v)
|
|
||||||
|
|
||||||
def _on_set_max_download_speed(self, key, value):
|
def _on_set_max_download_speed(self, key, value):
|
||||||
log.debug("max_download_speed set to %s..", value)
|
|
||||||
# We need to convert Kb/s to B/s
|
# We need to convert Kb/s to B/s
|
||||||
if value < 0:
|
value = -1 if value < 0 else int(value * 1024)
|
||||||
v = -1
|
self.core.apply_session_setting('download_rate_limit', value)
|
||||||
else:
|
|
||||||
v = int(value * 1024)
|
|
||||||
self.session.set_download_rate_limit(v)
|
|
||||||
|
|
||||||
def _on_set_max_upload_slots_global(self, key, value):
|
def _on_set_max_upload_slots_global(self, key, value):
|
||||||
log.debug("max_upload_slots_global set to %s..", value)
|
self.core.apply_session_setting('unchoke_slots_limit', value)
|
||||||
self.session.set_max_uploads(value)
|
|
||||||
|
|
||||||
def _on_set_max_half_open_connections(self, key, value):
|
def _on_set_max_half_open_connections(self, key, value):
|
||||||
self.session.set_max_half_open_connections(value)
|
self.core.apply_session_setting('half_open_limit', value)
|
||||||
|
|
||||||
def _on_set_max_connections_per_second(self, key, value):
|
def _on_set_max_connections_per_second(self, key, value):
|
||||||
self.session_set_setting("connection_speed", value)
|
self.core.apply_session_setting('connection_speed', value)
|
||||||
|
|
||||||
def _on_set_ignore_limits_on_local_network(self, key, value):
|
def _on_set_ignore_limits_on_local_network(self, key, value):
|
||||||
self.session_set_setting("ignore_limits_on_local_network", value)
|
self.core.apply_session_setting('ignore_limits_on_local_network', value)
|
||||||
|
|
||||||
def _on_set_share_ratio_limit(self, key, value):
|
def _on_set_share_ratio_limit(self, key, value):
|
||||||
log.debug("%s set to %s..", key, value)
|
# This value is a float percentage in deluge, but libtorrent needs int percentage.
|
||||||
self.session_set_setting("share_ratio_limit", value)
|
self.core.apply_session_setting('share_ratio_limit', int(value * 100))
|
||||||
|
|
||||||
def _on_set_seed_time_ratio_limit(self, key, value):
|
def _on_set_seed_time_ratio_limit(self, key, value):
|
||||||
log.debug("%s set to %s..", key, value)
|
# This value is a float percentage in deluge, but libtorrent needs int percentage.
|
||||||
self.session_set_setting("seed_time_ratio_limit", value)
|
self.core.apply_session_setting('seed_time_ratio_limit', int(value * 100))
|
||||||
|
|
||||||
def _on_set_seed_time_limit(self, key, value):
|
def _on_set_seed_time_limit(self, key, value):
|
||||||
log.debug("%s set to %s..", key, value)
|
|
||||||
# This value is stored in minutes in deluge, but libtorrent wants seconds
|
# This value is stored in minutes in deluge, but libtorrent wants seconds
|
||||||
self.session_set_setting("seed_time_limit", int(value * 60))
|
self.core.apply_session_setting('seed_time_limit', int(value * 60))
|
||||||
|
|
||||||
def _on_set_max_active_downloading(self, key, value):
|
def _on_set_max_active_downloading(self, key, value):
|
||||||
log.debug("%s set to %s..", key, value)
|
self.core.apply_session_setting('active_downloads', value)
|
||||||
self.session_set_setting("active_downloads", value)
|
|
||||||
|
|
||||||
def _on_set_max_active_seeding(self, key, value):
|
def _on_set_max_active_seeding(self, key, value):
|
||||||
log.debug("%s set to %s..", key, value)
|
self.core.apply_session_setting('active_seeds', value)
|
||||||
self.session_set_setting("active_seeds", value)
|
|
||||||
|
|
||||||
def _on_set_max_active_limit(self, key, value):
|
def _on_set_max_active_limit(self, key, value):
|
||||||
log.debug("%s set to %s..", key, value)
|
self.core.apply_session_setting('active_limit', value)
|
||||||
self.session_set_setting("active_limit", value)
|
|
||||||
|
|
||||||
def _on_set_dont_count_slow_torrents(self, key, value):
|
def _on_set_dont_count_slow_torrents(self, key, value):
|
||||||
log.debug("%s set to %s..", key, value)
|
self.core.apply_session_setting('dont_count_slow_torrents', value)
|
||||||
self.session_set_setting("dont_count_slow_torrents", value)
|
|
||||||
|
|
||||||
def _on_set_send_info(self, key, value):
|
def _on_set_send_info(self, key, value):
|
||||||
log.debug("Sending anonymous stats..")
|
|
||||||
"""sends anonymous stats home"""
|
"""sends anonymous stats home"""
|
||||||
class Send_Info_Thread(threading.Thread):
|
log.debug('Sending anonymous stats..')
|
||||||
|
|
||||||
|
class SendInfoThread(threading.Thread):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.config = config
|
self.config = config
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
import time
|
import time
|
||||||
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
# check if we've done this within the last week or never
|
# check if we've done this within the last week or never
|
||||||
if (now - self.config["info_sent"]) >= (60 * 60 * 24 * 7):
|
if (now - self.config['info_sent']) >= (60 * 60 * 24 * 7):
|
||||||
import deluge.common
|
|
||||||
from urllib import quote_plus
|
|
||||||
from urllib2 import urlopen
|
|
||||||
import platform
|
|
||||||
try:
|
try:
|
||||||
url = "http://deluge-torrent.org/stats_get.php?processor=" + \
|
url = (
|
||||||
platform.machine() + "&python=" + platform.python_version() \
|
'http://deluge-torrent.org/stats_get.php?processor='
|
||||||
+ "&deluge=" + deluge.common.get_version() \
|
+ platform.machine()
|
||||||
+ "&os=" + platform.system() \
|
+ '&python='
|
||||||
+ "&plugins=" + quote_plus(":".join(self.config["enabled_plugins"]))
|
+ platform.python_version()
|
||||||
|
+ '&deluge='
|
||||||
|
+ deluge.common.get_version()
|
||||||
|
+ '&os='
|
||||||
|
+ platform.system()
|
||||||
|
+ '&plugins='
|
||||||
|
+ quote_plus(':'.join(self.config['enabled_plugins']))
|
||||||
|
)
|
||||||
urlopen(url)
|
urlopen(url)
|
||||||
except IOError, e:
|
except OSError as ex:
|
||||||
log.debug("Network error while trying to send info: %s", e)
|
log.debug('Network error while trying to send info: %s', ex)
|
||||||
else:
|
else:
|
||||||
self.config["info_sent"] = now
|
self.config['info_sent'] = now
|
||||||
|
|
||||||
if value:
|
if value:
|
||||||
Send_Info_Thread(self.config).start()
|
SendInfoThread(self.config).start()
|
||||||
|
|
||||||
def _on_set_new_release_check(self, key, value):
|
def _on_set_new_release_check(self, key, value):
|
||||||
if value:
|
if value:
|
||||||
log.debug("Checking for new release..")
|
log.debug('Checking for new release..')
|
||||||
threading.Thread(target=self.core.get_new_release).start()
|
threading.Thread(target=self.core.get_new_release).start()
|
||||||
if self.new_release_timer and self.new_release_timer.running:
|
if self.new_release_timer and self.new_release_timer.running:
|
||||||
self.new_release_timer.stop()
|
self.new_release_timer.stop()
|
||||||
# Set a timer to check for a new release every 3 days
|
# Set a timer to check for a new release every 3 days
|
||||||
self.new_release_timer = LoopingCall(
|
self.new_release_timer = LoopingCall(
|
||||||
self._on_set_new_release_check, "new_release_check", True)
|
self._on_set_new_release_check, 'new_release_check', True
|
||||||
|
)
|
||||||
self.new_release_timer.start(72 * 60 * 60, False)
|
self.new_release_timer.start(72 * 60 * 60, False)
|
||||||
else:
|
else:
|
||||||
if self.new_release_timer and self.new_release_timer.running:
|
if self.new_release_timer and self.new_release_timer.running:
|
||||||
self.new_release_timer.stop()
|
self.new_release_timer.stop()
|
||||||
|
|
||||||
def _on_set_proxies(self, key, value):
|
def _on_set_proxy(self, key, value):
|
||||||
for k, v in value.items():
|
# Initialise with type none and blank hostnames.
|
||||||
if v["type"]:
|
proxy_settings = {
|
||||||
proxy_settings = lt.proxy_settings()
|
'proxy_type': lt.proxy_type_t.none,
|
||||||
proxy_settings.type = lt.proxy_type(v["type"])
|
'i2p_hostname': '',
|
||||||
proxy_settings.username = str(v["username"])
|
'proxy_hostname': '',
|
||||||
proxy_settings.password = str(v["password"])
|
'proxy_hostnames': value['proxy_hostnames'],
|
||||||
proxy_settings.hostname = str(v["hostname"])
|
'proxy_peer_connections': value['proxy_peer_connections'],
|
||||||
proxy_settings.port = v["port"]
|
'proxy_tracker_connections': value['proxy_tracker_connections'],
|
||||||
log.debug("setting %s proxy settings", k)
|
'force_proxy': value['force_proxy'],
|
||||||
getattr(self.session, "set_%s_proxy" % k)(proxy_settings)
|
'anonymous_mode': value['anonymous_mode'],
|
||||||
|
}
|
||||||
|
|
||||||
|
if value['type'] == lt.proxy_type_t.i2p_proxy:
|
||||||
|
proxy_settings.update(
|
||||||
|
{
|
||||||
|
'proxy_type': lt.proxy_type_t.i2p_proxy,
|
||||||
|
'i2p_hostname': value['hostname'],
|
||||||
|
'i2p_port': value['port'],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
elif value['type'] != lt.proxy_type_t.none:
|
||||||
|
proxy_settings.update(
|
||||||
|
{
|
||||||
|
'proxy_type': value['type'],
|
||||||
|
'proxy_hostname': value['hostname'],
|
||||||
|
'proxy_port': value['port'],
|
||||||
|
'proxy_username': value['username'],
|
||||||
|
'proxy_password': value['password'],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.core.apply_session_settings(proxy_settings)
|
||||||
|
|
||||||
def _on_set_rate_limit_ip_overhead(self, key, value):
|
def _on_set_rate_limit_ip_overhead(self, key, value):
|
||||||
log.debug("%s: %s", key, value)
|
self.core.apply_session_setting('rate_limit_ip_overhead', value)
|
||||||
self.session_set_setting("rate_limit_ip_overhead", value)
|
|
||||||
|
|
||||||
def _on_set_geoip_db_location(self, key, value):
|
def _on_set_geoip_db_location(self, key, geoipdb_path):
|
||||||
log.debug("%s: %s", key, value)
|
|
||||||
# Load the GeoIP DB for country look-ups if available
|
# Load the GeoIP DB for country look-ups if available
|
||||||
geoip_db = ""
|
if os.path.exists(geoipdb_path):
|
||||||
if os.path.exists(value):
|
|
||||||
geoip_db = value
|
|
||||||
elif os.path.exists(deluge.common.resource_filename("deluge", os.path.join("data", "GeoIP.dat"))):
|
|
||||||
geoip_db = deluge.common.resource_filename(
|
|
||||||
"deluge", os.path.join("data", "GeoIP.dat")
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
log.warning("Unable to find GeoIP database file!")
|
|
||||||
|
|
||||||
if geoip_db:
|
|
||||||
try:
|
try:
|
||||||
self.session.load_country_db(str(geoip_db))
|
self.core.geoip_instance = GeoIP(geoipdb_path, 0)
|
||||||
except Exception, e:
|
except Exception as ex:
|
||||||
log.error("Unable to load geoip database!")
|
log.warning('GeoIP Unavailable: %s', ex)
|
||||||
log.exception(e)
|
else:
|
||||||
|
log.warning('Unable to find GeoIP database file: %s', geoipdb_path)
|
||||||
|
|
||||||
def _on_set_cache_size(self, key, value):
|
def _on_set_cache_size(self, key, value):
|
||||||
log.debug("%s: %s", key, value)
|
self.core.apply_session_setting('cache_size', value)
|
||||||
self.session_set_setting("cache_size", value)
|
|
||||||
|
|
||||||
def _on_set_cache_expiry(self, key, value):
|
def _on_set_cache_expiry(self, key, value):
|
||||||
log.debug("%s: %s", key, value)
|
self.core.apply_session_setting('cache_expiry', value)
|
||||||
self.session_set_setting("cache_expiry", value)
|
|
||||||
|
|
||||||
def _on_auto_manage_prefer_seeds(self, key, value):
|
def _on_auto_manage_prefer_seeds(self, key, value):
|
||||||
log.debug("%s set to %s..", key, value)
|
self.core.apply_session_setting('auto_manage_prefer_seeds', value)
|
||||||
self.session_set_setting("auto_manage_prefer_seeds", value)
|
|
||||||
|
|||||||
@ -1,64 +1,40 @@
|
|||||||
#
|
#
|
||||||
# rpcserver.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008,2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2008,2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
"""RPCServer Module"""
|
"""RPCServer Module"""
|
||||||
|
|
||||||
import sys
|
|
||||||
import zlib
|
|
||||||
import os
|
|
||||||
import stat
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
from collections import namedtuple
|
||||||
from twisted.internet.protocol import Factory, Protocol
|
|
||||||
from twisted.internet import reactor, defer
|
|
||||||
|
|
||||||
from OpenSSL import crypto, SSL
|
|
||||||
from types import FunctionType
|
from types import FunctionType
|
||||||
|
from typing import Callable, TypeVar, overload
|
||||||
|
|
||||||
try:
|
from twisted.internet import defer, reactor
|
||||||
import rencode
|
from twisted.internet.protocol import Factory, connectionDone
|
||||||
except ImportError:
|
|
||||||
import deluge.rencode as rencode
|
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.configmanager
|
import deluge.configmanager
|
||||||
from deluge.core.authmanager import (AUTH_LEVEL_NONE, AUTH_LEVEL_DEFAULT,
|
from deluge.core.authmanager import (
|
||||||
AUTH_LEVEL_ADMIN)
|
AUTH_LEVEL_ADMIN,
|
||||||
from deluge.error import (DelugeError, NotAuthorizedError, WrappedException,
|
AUTH_LEVEL_DEFAULT,
|
||||||
_ClientSideRecreateError, IncompatibleClient)
|
AUTH_LEVEL_NONE,
|
||||||
|
)
|
||||||
|
from deluge.crypto_utils import check_ssl_keys, get_context_factory
|
||||||
|
from deluge.error import (
|
||||||
|
DelugeError,
|
||||||
|
IncompatibleClient,
|
||||||
|
NotAuthorizedError,
|
||||||
|
WrappedException,
|
||||||
|
_ClientSideRecreateError,
|
||||||
|
)
|
||||||
|
from deluge.event import ClientDisconnectedEvent
|
||||||
|
from deluge.transfer import DelugeTransferProtocol
|
||||||
|
|
||||||
RPC_RESPONSE = 1
|
RPC_RESPONSE = 1
|
||||||
RPC_ERROR = 2
|
RPC_ERROR = 2
|
||||||
@ -66,6 +42,19 @@ RPC_EVENT = 3
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
TCallable = TypeVar('TCallable', bound=Callable)
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def export(func: TCallable) -> TCallable:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def export(auth_level: int) -> Callable[[TCallable], TCallable]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
def export(auth_level=AUTH_LEVEL_DEFAULT):
|
def export(auth_level=AUTH_LEVEL_DEFAULT):
|
||||||
"""
|
"""
|
||||||
Decorator function to register an object's method as an RPC. The object
|
Decorator function to register an object's method as an RPC. The object
|
||||||
@ -77,17 +66,27 @@ def export(auth_level=AUTH_LEVEL_DEFAULT):
|
|||||||
:type auth_level: int
|
:type auth_level: int
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def wrap(func, *args, **kwargs):
|
def wrap(func, *args, **kwargs):
|
||||||
func._rpcserver_export = True
|
func._rpcserver_export = True
|
||||||
func._rpcserver_auth_level = auth_level
|
func._rpcserver_auth_level = auth_level
|
||||||
doc = func.__doc__
|
|
||||||
func.__doc__ = "**RPC Exported Function** (*Auth Level: %s*)\n\n" % auth_level
|
rpc_text = '**RPC exported method** (*Auth level: %s*)' % auth_level
|
||||||
if doc:
|
|
||||||
func.__doc__ += doc
|
# Append the RPC text while ensuring correct docstring formatting.
|
||||||
|
if func.__doc__:
|
||||||
|
if func.__doc__.endswith(' '):
|
||||||
|
indent = func.__doc__.split('\n')[-1]
|
||||||
|
func.__doc__ += f'\n{indent}'
|
||||||
|
else:
|
||||||
|
func.__doc__ += '\n\n'
|
||||||
|
func.__doc__ += rpc_text
|
||||||
|
else:
|
||||||
|
func.__doc__ = rpc_text
|
||||||
|
|
||||||
return func
|
return func
|
||||||
|
|
||||||
if type(auth_level) is FunctionType:
|
if isinstance(auth_level, FunctionType):
|
||||||
func = auth_level
|
func = auth_level
|
||||||
auth_level = AUTH_LEVEL_DEFAULT
|
auth_level = AUTH_LEVEL_DEFAULT
|
||||||
return wrap(func)
|
return wrap(func)
|
||||||
@ -107,83 +106,56 @@ def format_request(call):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
s = call[1] + "("
|
s = call[1] + '('
|
||||||
if call[2]:
|
if call[2]:
|
||||||
s += ", ".join([str(x) for x in call[2]])
|
s += ', '.join([str(x) for x in call[2]])
|
||||||
if call[3]:
|
if call[3]:
|
||||||
if call[2]:
|
if call[2]:
|
||||||
s += ", "
|
s += ', '
|
||||||
s += ", ".join([key + "=" + str(value) for key, value in call[3].items()])
|
s += ', '.join([key + '=' + str(value) for key, value in call[3].items()])
|
||||||
s += ")"
|
s += ')'
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
return "UnicodeEncodeError, call: %s" % call
|
return 'UnicodeEncodeError, call: %s' % call
|
||||||
else:
|
else:
|
||||||
return s
|
return s
|
||||||
|
|
||||||
class ServerContextFactory(object):
|
|
||||||
def getContext(self):
|
|
||||||
"""
|
|
||||||
Create an SSL context.
|
|
||||||
|
|
||||||
This loads the servers cert/private key SSL files for use with the
|
class DelugeRPCProtocol(DelugeTransferProtocol):
|
||||||
SSL transport.
|
def __init__(self):
|
||||||
"""
|
super().__init__()
|
||||||
ssl_dir = deluge.configmanager.get_config_dir("ssl")
|
# namedtuple subclass with auth_level, username for the connected session.
|
||||||
ctx = SSL.Context(SSL.SSLv3_METHOD)
|
self.AuthLevel = namedtuple('SessionAuthlevel', 'auth_level, username')
|
||||||
ctx.use_certificate_file(os.path.join(ssl_dir, "daemon.cert"))
|
|
||||||
ctx.use_privatekey_file(os.path.join(ssl_dir, "daemon.pkey"))
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
class DelugeRPCProtocol(Protocol):
|
def message_received(self, request):
|
||||||
__buffer = None
|
|
||||||
|
|
||||||
def dataReceived(self, data):
|
|
||||||
"""
|
"""
|
||||||
This method is called whenever data is received from a client. The
|
This method is called whenever a message is received from a client. The
|
||||||
only message that a client sends to the server is a RPC Request message.
|
only message that a client sends to the server is a RPC Request message.
|
||||||
If the RPC Request message is valid, then the method is called in
|
If the RPC Request message is valid, then the method is called in
|
||||||
:meth:`dispatch`.
|
:meth:`dispatch`.
|
||||||
|
|
||||||
:param data: the data from the client. It should be a zlib compressed
|
:param request: the request from the client.
|
||||||
rencoded string.
|
:type data: tuple
|
||||||
:type data: str
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if self.__buffer:
|
if not isinstance(request, tuple):
|
||||||
# We have some data from the last dataReceived() so lets prepend it
|
log.debug('Received invalid message: type is not tuple')
|
||||||
data = self.__buffer + data
|
return
|
||||||
self.__buffer = None
|
|
||||||
|
|
||||||
while data:
|
if len(request) < 1:
|
||||||
dobj = zlib.decompressobj()
|
log.debug('Received invalid message: there are no items')
|
||||||
try:
|
return
|
||||||
request = rencode.loads(dobj.decompress(data))
|
|
||||||
except Exception, e:
|
|
||||||
#log.debug("Received possible invalid message (%r): %s", data, e)
|
|
||||||
# This could be cut-off data, so we'll save this in the buffer
|
|
||||||
# and try to prepend it on the next dataReceived()
|
|
||||||
self.__buffer = data
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
data = dobj.unused_data
|
|
||||||
|
|
||||||
if type(request) is not tuple:
|
for call in request:
|
||||||
log.debug("Received invalid message: type is not tuple")
|
if len(call) != 4:
|
||||||
return
|
log.debug(
|
||||||
|
'Received invalid rpc request: number of items ' 'in request is %s',
|
||||||
|
len(call),
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
# log.debug('RPCRequest: %s', format_request(call))
|
||||||
|
reactor.callLater(0, self.dispatch, *call)
|
||||||
|
|
||||||
if len(request) < 1:
|
def sendData(self, data): # NOQA: N802
|
||||||
log.debug("Received invalid message: there are no items")
|
|
||||||
return
|
|
||||||
|
|
||||||
for call in request:
|
|
||||||
if len(call) != 4:
|
|
||||||
log.debug("Received invalid rpc request: number of items "
|
|
||||||
"in request is %s", len(call))
|
|
||||||
continue
|
|
||||||
#log.debug("RPCRequest: %s", format_request(call))
|
|
||||||
reactor.callLater(0, self.dispatch, *call)
|
|
||||||
|
|
||||||
def sendData(self, data):
|
|
||||||
"""
|
"""
|
||||||
Sends the data to the client.
|
Sends the data to the client.
|
||||||
|
|
||||||
@ -192,19 +164,25 @@ class DelugeRPCProtocol(Protocol):
|
|||||||
:type data: object
|
:type data: object
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.transport.write(zlib.compress(rencode.dumps(data)))
|
try:
|
||||||
|
self.transfer_message(data)
|
||||||
|
except Exception as ex:
|
||||||
|
log.warning('Error occurred when sending message: %s.', ex)
|
||||||
|
log.exception(ex)
|
||||||
|
raise
|
||||||
|
|
||||||
def connectionMade(self):
|
def connectionMade(self): # NOQA: N802
|
||||||
"""
|
"""
|
||||||
This method is called when a new client connects.
|
This method is called when a new client connects.
|
||||||
"""
|
"""
|
||||||
peer = self.transport.getPeer()
|
peer = self.transport.getPeer()
|
||||||
log.info("Deluge Client connection made from: %s:%s",
|
log.info('Deluge Client connection made from: %s:%s', peer.host, peer.port)
|
||||||
peer.host, peer.port)
|
|
||||||
# Set the initial auth level of this session to AUTH_LEVEL_NONE
|
# Set the initial auth level of this session to AUTH_LEVEL_NONE
|
||||||
self.factory.authorized_sessions[self.transport.sessionno] = AUTH_LEVEL_NONE
|
self.factory.authorized_sessions[self.transport.sessionno] = self.AuthLevel(
|
||||||
|
AUTH_LEVEL_NONE, ''
|
||||||
|
)
|
||||||
|
|
||||||
def connectionLost(self, reason):
|
def connectionLost(self, reason=connectionDone): # NOQA: N802
|
||||||
"""
|
"""
|
||||||
This method is called when the client is disconnected.
|
This method is called when the client is disconnected.
|
||||||
|
|
||||||
@ -220,7 +198,11 @@ class DelugeRPCProtocol(Protocol):
|
|||||||
if self.transport.sessionno in self.factory.interested_events:
|
if self.transport.sessionno in self.factory.interested_events:
|
||||||
del self.factory.interested_events[self.transport.sessionno]
|
del self.factory.interested_events[self.transport.sessionno]
|
||||||
|
|
||||||
log.info("Deluge client disconnected: %s", reason.value)
|
if self.factory.state == 'running':
|
||||||
|
component.get('EventManager').emit(
|
||||||
|
ClientDisconnectedEvent(self.factory.session_id)
|
||||||
|
)
|
||||||
|
log.info('Deluge client disconnected: %s', reason.value)
|
||||||
|
|
||||||
def valid_session(self):
|
def valid_session(self):
|
||||||
return self.transport.sessionno in self.factory.authorized_sessions
|
return self.transport.sessionno in self.factory.authorized_sessions
|
||||||
@ -241,60 +223,77 @@ class DelugeRPCProtocol(Protocol):
|
|||||||
:type kwargs: dict
|
:type kwargs: dict
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def sendError():
|
|
||||||
|
def send_error():
|
||||||
"""
|
"""
|
||||||
Sends an error response with the contents of the exception that was raised.
|
Sends an error response with the contents of the exception that was raised.
|
||||||
"""
|
"""
|
||||||
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
|
exc_type, exc_value, dummy_exc_trace = sys.exc_info()
|
||||||
formated_tb = "".join(traceback.format_tb(exceptionTraceback))
|
formated_tb = traceback.format_exc()
|
||||||
try:
|
try:
|
||||||
self.sendData((
|
self.sendData(
|
||||||
RPC_ERROR,
|
(
|
||||||
request_id,
|
RPC_ERROR,
|
||||||
exceptionType.__name__,
|
request_id,
|
||||||
exceptionValue._args,
|
exc_type.__name__,
|
||||||
exceptionValue._kwargs,
|
exc_value._args,
|
||||||
formated_tb
|
exc_value._kwargs,
|
||||||
))
|
formated_tb,
|
||||||
except Exception, err:
|
)
|
||||||
# This most likely not a deluge exception, let's wrap it
|
)
|
||||||
log.error("An exception occurred while sending RPC_ERROR to "
|
except AttributeError:
|
||||||
"client. Wrapping it and resending. Error to "
|
# This is not a deluge exception (object has no attribute '_args), let's wrap it
|
||||||
"send(causing exception goes next):\n%s", formated_tb)
|
log.warning(
|
||||||
log.exception(err)
|
'An exception occurred while sending RPC_ERROR to '
|
||||||
|
'client. Wrapping it and resending. Error to '
|
||||||
|
'send(causing exception goes next):\n%s',
|
||||||
|
formated_tb,
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
raise WrappedException(str(exceptionValue), exceptionType.__name__, formated_tb)
|
raise WrappedException(
|
||||||
except:
|
str(exc_value), exc_type.__name__, formated_tb
|
||||||
sendError()
|
)
|
||||||
|
except WrappedException:
|
||||||
|
send_error()
|
||||||
|
except Exception as ex:
|
||||||
|
log.error(
|
||||||
|
'An exception occurred while sending RPC_ERROR to client: %s', ex
|
||||||
|
)
|
||||||
|
|
||||||
if method == "daemon.info":
|
if method == 'daemon.info':
|
||||||
# This is a special case and used in the initial connection process
|
# This is a special case and used in the initial connection process
|
||||||
self.sendData((RPC_RESPONSE, request_id, deluge.common.get_version()))
|
self.sendData((RPC_RESPONSE, request_id, deluge.common.get_version()))
|
||||||
return
|
return
|
||||||
elif method == "daemon.login":
|
elif method == 'daemon.login':
|
||||||
# This is a special case and used in the initial connection process
|
# This is a special case and used in the initial connection process
|
||||||
# We need to authenticate the user here
|
# We need to authenticate the user here
|
||||||
log.debug("RPC dispatch daemon.login")
|
log.debug('RPC dispatch daemon.login')
|
||||||
try:
|
try:
|
||||||
client_version = kwargs.pop('client_version', None)
|
client_version = kwargs.pop('client_version', None)
|
||||||
if client_version is None:
|
if client_version is None:
|
||||||
raise IncompatibleClient(deluge.common.get_version())
|
raise IncompatibleClient(deluge.common.get_version())
|
||||||
ret = component.get("AuthManager").authorize(*args, **kwargs)
|
ret = component.get('AuthManager').authorize(*args, **kwargs)
|
||||||
if ret:
|
if ret:
|
||||||
self.factory.authorized_sessions[self.transport.sessionno] = (ret, args[0])
|
self.factory.authorized_sessions[
|
||||||
|
self.transport.sessionno
|
||||||
|
] = self.AuthLevel(ret, args[0])
|
||||||
self.factory.session_protocols[self.transport.sessionno] = self
|
self.factory.session_protocols[self.transport.sessionno] = self
|
||||||
except Exception, e:
|
except Exception as ex:
|
||||||
sendError()
|
send_error()
|
||||||
if not isinstance(e, _ClientSideRecreateError):
|
if not isinstance(ex, _ClientSideRecreateError):
|
||||||
log.exception(e)
|
log.exception(ex)
|
||||||
else:
|
else:
|
||||||
self.sendData((RPC_RESPONSE, request_id, (ret)))
|
self.sendData((RPC_RESPONSE, request_id, (ret)))
|
||||||
if not ret:
|
if not ret:
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
finally:
|
return
|
||||||
return
|
|
||||||
elif method == "daemon.set_event_interest" and self.valid_session():
|
# Anything below requires a valid session
|
||||||
log.debug("RPC dispatch daemon.set_event_interest")
|
if not self.valid_session():
|
||||||
|
return
|
||||||
|
|
||||||
|
if method == 'daemon.set_event_interest':
|
||||||
|
log.debug('RPC dispatch daemon.set_event_interest')
|
||||||
# This special case is to allow clients to set which events they are
|
# This special case is to allow clients to set which events they are
|
||||||
# interested in receiving.
|
# interested in receiving.
|
||||||
# We are expecting a sequence from the client.
|
# We are expecting a sequence from the client.
|
||||||
@ -302,51 +301,66 @@ class DelugeRPCProtocol(Protocol):
|
|||||||
if self.transport.sessionno not in self.factory.interested_events:
|
if self.transport.sessionno not in self.factory.interested_events:
|
||||||
self.factory.interested_events[self.transport.sessionno] = []
|
self.factory.interested_events[self.transport.sessionno] = []
|
||||||
self.factory.interested_events[self.transport.sessionno].extend(args[0])
|
self.factory.interested_events[self.transport.sessionno].extend(args[0])
|
||||||
except Exception, e:
|
except Exception:
|
||||||
sendError()
|
send_error()
|
||||||
else:
|
else:
|
||||||
self.sendData((RPC_RESPONSE, request_id, (True)))
|
self.sendData((RPC_RESPONSE, request_id, (True)))
|
||||||
finally:
|
return
|
||||||
|
|
||||||
|
if method not in self.factory.methods:
|
||||||
|
try:
|
||||||
|
# Raise exception to be sent back to client
|
||||||
|
raise AttributeError('RPC call on invalid function: %s' % method)
|
||||||
|
except AttributeError:
|
||||||
|
send_error()
|
||||||
return
|
return
|
||||||
|
|
||||||
if method in self.factory.methods and self.valid_session():
|
log.debug('RPC dispatch %s', method)
|
||||||
log.debug("RPC dispatch %s", method)
|
try:
|
||||||
try:
|
method_auth_requirement = self.factory.methods[method]._rpcserver_auth_level
|
||||||
method_auth_requirement = self.factory.methods[method]._rpcserver_auth_level
|
auth_level = self.factory.authorized_sessions[
|
||||||
auth_level = self.factory.authorized_sessions[self.transport.sessionno][0]
|
self.transport.sessionno
|
||||||
if auth_level < method_auth_requirement:
|
].auth_level
|
||||||
# This session is not allowed to call this method
|
if auth_level < method_auth_requirement:
|
||||||
log.debug("Session %s is trying to call a method it is not "
|
# This session is not allowed to call this method
|
||||||
"authorized to call!", self.transport.sessionno)
|
log.debug(
|
||||||
raise NotAuthorizedError(auth_level, method_auth_requirement)
|
'Session %s is attempting an unauthorized method call!',
|
||||||
# Set the session_id in the factory so that methods can know
|
self.transport.sessionno,
|
||||||
# which session is calling it.
|
)
|
||||||
self.factory.session_id = self.transport.sessionno
|
raise NotAuthorizedError(auth_level, method_auth_requirement)
|
||||||
ret = self.factory.methods[method](*args, **kwargs)
|
# Set the session_id in the factory so that methods can know
|
||||||
except Exception, e:
|
# which session is calling it.
|
||||||
sendError()
|
self.factory.session_id = self.transport.sessionno
|
||||||
# Don't bother printing out DelugeErrors, because they are just
|
ret = self.factory.methods[method](*args, **kwargs)
|
||||||
# for the client
|
except Exception as ex:
|
||||||
if not isinstance(e, DelugeError):
|
send_error()
|
||||||
log.exception("Exception calling RPC request: %s", e)
|
# Don't bother printing out DelugeErrors, because they are just
|
||||||
else:
|
# for the client
|
||||||
# Check if the return value is a deferred, since we'll need to
|
if not isinstance(ex, DelugeError):
|
||||||
# wait for it to fire before sending the RPC_RESPONSE
|
log.exception('Exception calling RPC request: %s', ex)
|
||||||
if isinstance(ret, defer.Deferred):
|
else:
|
||||||
def on_success(result):
|
# Check if the return value is a deferred, since we'll need to
|
||||||
|
# wait for it to fire before sending the RPC_RESPONSE
|
||||||
|
if isinstance(ret, defer.Deferred):
|
||||||
|
|
||||||
|
def on_success(result):
|
||||||
|
try:
|
||||||
self.sendData((RPC_RESPONSE, request_id, result))
|
self.sendData((RPC_RESPONSE, request_id, result))
|
||||||
return result
|
except Exception:
|
||||||
|
send_error()
|
||||||
|
return result
|
||||||
|
|
||||||
def on_fail(failure):
|
def on_fail(failure):
|
||||||
try:
|
try:
|
||||||
failure.raiseException()
|
failure.raiseException()
|
||||||
except Exception, e:
|
except Exception:
|
||||||
sendError()
|
send_error()
|
||||||
return failure
|
return failure
|
||||||
|
|
||||||
|
ret.addCallbacks(on_success, on_fail)
|
||||||
|
else:
|
||||||
|
self.sendData((RPC_RESPONSE, request_id, ret))
|
||||||
|
|
||||||
ret.addCallbacks(on_success, on_fail)
|
|
||||||
else:
|
|
||||||
self.sendData((RPC_RESPONSE, request_id, ret))
|
|
||||||
|
|
||||||
class RPCServer(component.Component):
|
class RPCServer(component.Component):
|
||||||
"""
|
"""
|
||||||
@ -364,12 +378,13 @@ class RPCServer(component.Component):
|
|||||||
:type listen: bool
|
:type listen: bool
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, port=58846, interface="", allow_remote=False, listen=True):
|
def __init__(self, port=58846, interface='', allow_remote=False, listen=True):
|
||||||
component.Component.__init__(self, "RPCServer")
|
component.Component.__init__(self, 'RPCServer')
|
||||||
|
|
||||||
self.factory = Factory()
|
self.factory = Factory()
|
||||||
self.factory.protocol = DelugeRPCProtocol
|
self.factory.protocol = DelugeRPCProtocol
|
||||||
self.factory.session_id = -1
|
self.factory.session_id = -1
|
||||||
|
self.factory.state = 'running'
|
||||||
|
|
||||||
# Holds the registered methods
|
# Holds the registered methods
|
||||||
self.factory.methods = {}
|
self.factory.methods = {}
|
||||||
@ -385,24 +400,28 @@ class RPCServer(component.Component):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if allow_remote:
|
if allow_remote:
|
||||||
hostname = ""
|
hostname = ''
|
||||||
else:
|
else:
|
||||||
hostname = "localhost"
|
hostname = 'localhost'
|
||||||
|
|
||||||
if interface:
|
if interface:
|
||||||
hostname = interface
|
hostname = interface
|
||||||
|
|
||||||
log.info("Starting DelugeRPC server %s:%s", hostname, port)
|
log.info('Starting DelugeRPC server %s:%s', hostname, port)
|
||||||
|
|
||||||
# Check for SSL keys and generate some if needed
|
# Check for SSL keys and generate some if needed
|
||||||
check_ssl_keys()
|
check_ssl_keys()
|
||||||
|
|
||||||
|
cert = os.path.join(deluge.configmanager.get_config_dir('ssl'), 'daemon.cert')
|
||||||
|
pkey = os.path.join(deluge.configmanager.get_config_dir('ssl'), 'daemon.pkey')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
reactor.listenSSL(port, self.factory, ServerContextFactory(), interface=hostname)
|
reactor.listenSSL(
|
||||||
except Exception, e:
|
port, self.factory, get_context_factory(cert, pkey), interface=hostname
|
||||||
log.info("Daemon already running or port not available..")
|
)
|
||||||
log.error(e)
|
except Exception as ex:
|
||||||
sys.exit(0)
|
log.debug('Daemon already running or port not available.: %s', ex)
|
||||||
|
raise
|
||||||
|
|
||||||
def register_object(self, obj, name=None):
|
def register_object(self, obj, name=None):
|
||||||
"""
|
"""
|
||||||
@ -418,11 +437,11 @@ class RPCServer(component.Component):
|
|||||||
name = obj.__class__.__name__.lower()
|
name = obj.__class__.__name__.lower()
|
||||||
|
|
||||||
for d in dir(obj):
|
for d in dir(obj):
|
||||||
if d[0] == "_":
|
if d[0] == '_':
|
||||||
continue
|
continue
|
||||||
if getattr(getattr(obj, d), '_rpcserver_export', False):
|
if getattr(getattr(obj, d), '_rpcserver_export', False):
|
||||||
log.debug("Registering method: %s", name + "." + d)
|
log.debug('Registering method: %s', name + '.' + d)
|
||||||
self.factory.methods[name + "." + d] = getattr(obj, d)
|
self.factory.methods[name + '.' + d] = getattr(obj, d)
|
||||||
|
|
||||||
def deregister_object(self, obj):
|
def deregister_object(self, obj):
|
||||||
"""
|
"""
|
||||||
@ -432,7 +451,7 @@ class RPCServer(component.Component):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
for key, value in self.factory.methods.items():
|
for key, value in self.factory.methods.items():
|
||||||
if value.im_self == obj:
|
if value.__self__ == obj:
|
||||||
del self.factory.methods[key]
|
del self.factory.methods[key]
|
||||||
|
|
||||||
def get_object_method(self, name):
|
def get_object_method(self, name):
|
||||||
@ -456,7 +475,7 @@ class RPCServer(component.Component):
|
|||||||
:returns: the exported methods
|
:returns: the exported methods
|
||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
return self.factory.methods.keys()
|
return list(self.factory.methods)
|
||||||
|
|
||||||
def get_session_id(self):
|
def get_session_id(self):
|
||||||
"""
|
"""
|
||||||
@ -477,13 +496,13 @@ class RPCServer(component.Component):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if not self.listen:
|
if not self.listen:
|
||||||
return "localclient"
|
return 'localclient'
|
||||||
session_id = self.get_session_id()
|
session_id = self.get_session_id()
|
||||||
if session_id > -1 and session_id in self.factory.authorized_sessions:
|
if session_id > -1 and session_id in self.factory.authorized_sessions:
|
||||||
return self.factory.authorized_sessions[session_id][1]
|
return self.factory.authorized_sessions[session_id].username
|
||||||
else:
|
else:
|
||||||
# No connections made yet
|
# No connections made yet
|
||||||
return ""
|
return ''
|
||||||
|
|
||||||
def get_session_auth_level(self):
|
def get_session_auth_level(self):
|
||||||
"""
|
"""
|
||||||
@ -492,9 +511,9 @@ class RPCServer(component.Component):
|
|||||||
:returns: the auth level
|
:returns: the auth level
|
||||||
:rtype: int
|
:rtype: int
|
||||||
"""
|
"""
|
||||||
if not self.listen:
|
if not self.listen or not self.is_session_valid(self.get_session_id()):
|
||||||
return AUTH_LEVEL_ADMIN
|
return AUTH_LEVEL_ADMIN
|
||||||
return self.factory.authorized_sessions[self.get_session_id()][0]
|
return self.factory.authorized_sessions[self.get_session_id()].auth_level
|
||||||
|
|
||||||
def get_rpc_auth_level(self, rpc):
|
def get_rpc_auth_level(self, rpc):
|
||||||
"""
|
"""
|
||||||
@ -503,7 +522,7 @@ class RPCServer(component.Component):
|
|||||||
:returns: the auth level
|
:returns: the auth level
|
||||||
:rtype: int
|
:rtype: int
|
||||||
"""
|
"""
|
||||||
self.factory.methods[rpc]._rpcserver_auth_level
|
return self.factory.methods[rpc]._rpcserver_auth_level
|
||||||
|
|
||||||
def is_session_valid(self, session_id):
|
def is_session_valid(self, session_id):
|
||||||
"""
|
"""
|
||||||
@ -525,11 +544,11 @@ class RPCServer(component.Component):
|
|||||||
:param event: the event to emit
|
:param event: the event to emit
|
||||||
:type event: :class:`deluge.event.DelugeEvent`
|
:type event: :class:`deluge.event.DelugeEvent`
|
||||||
"""
|
"""
|
||||||
log.debug("intevents: %s", self.factory.interested_events)
|
log.debug('intevents: %s', self.factory.interested_events)
|
||||||
# Find sessions interested in this event
|
# Find sessions interested in this event
|
||||||
for session_id, interest in self.factory.interested_events.iteritems():
|
for session_id, interest in self.factory.interested_events.items():
|
||||||
if event.name in interest:
|
if event.name in interest:
|
||||||
log.debug("Emit Event: %s %s", event.name, event.args)
|
log.debug('Emit Event: %s %s', event.name, event.args)
|
||||||
# This session is interested so send a RPC_EVENT
|
# This session is interested so send a RPC_EVENT
|
||||||
self.factory.session_protocols[session_id].sendData(
|
self.factory.session_protocols[session_id].sendData(
|
||||||
(RPC_EVENT, event.name, event.args)
|
(RPC_EVENT, event.name, event.args)
|
||||||
@ -545,68 +564,35 @@ class RPCServer(component.Component):
|
|||||||
:type event: :class:`deluge.event.DelugeEvent`
|
:type event: :class:`deluge.event.DelugeEvent`
|
||||||
"""
|
"""
|
||||||
if not self.is_session_valid(session_id):
|
if not self.is_session_valid(session_id):
|
||||||
log.debug("Session ID %s is not valid. Not sending event \"%s\".", session_id, event.name)
|
log.debug(
|
||||||
|
'Session ID %s is not valid. Not sending event "%s".',
|
||||||
|
session_id,
|
||||||
|
event.name,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
if session_id not in self.factory.interested_events:
|
if session_id not in self.factory.interested_events:
|
||||||
log.debug("Session ID %s is not interested in any events. Not sending event \"%s\".", session_id, event.name)
|
log.debug(
|
||||||
|
'Session ID %s is not interested in any events. Not sending event "%s".',
|
||||||
|
session_id,
|
||||||
|
event.name,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
if event.name not in self.factory.interested_events[session_id]:
|
if event.name not in self.factory.interested_events[session_id]:
|
||||||
log.debug("Session ID %s is not interested in event \"%s\". Not sending it.", session_id, event.name)
|
log.debug(
|
||||||
|
'Session ID %s is not interested in event "%s". Not sending it.',
|
||||||
|
session_id,
|
||||||
|
event.name,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
log.debug("Sending event \"%s\" with args \"%s\" to session id \"%s\".",
|
log.debug(
|
||||||
event.name, event.args, session_id)
|
'Sending event "%s" with args "%s" to session id "%s".',
|
||||||
self.factory.session_protocols[session_id].sendData((RPC_EVENT, event.name, event.args))
|
event.name,
|
||||||
|
event.args,
|
||||||
|
session_id,
|
||||||
|
)
|
||||||
|
self.factory.session_protocols[session_id].sendData(
|
||||||
|
(RPC_EVENT, event.name, event.args)
|
||||||
|
)
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
def check_ssl_keys():
|
self.factory.state = 'stopping'
|
||||||
"""
|
|
||||||
Check for SSL cert/key and create them if necessary
|
|
||||||
"""
|
|
||||||
ssl_dir = deluge.configmanager.get_config_dir("ssl")
|
|
||||||
if not os.path.exists(ssl_dir):
|
|
||||||
# The ssl folder doesn't exist so we need to create it
|
|
||||||
os.makedirs(ssl_dir)
|
|
||||||
generate_ssl_keys()
|
|
||||||
else:
|
|
||||||
for f in ("daemon.pkey", "daemon.cert"):
|
|
||||||
if not os.path.exists(os.path.join(ssl_dir, f)):
|
|
||||||
generate_ssl_keys()
|
|
||||||
break
|
|
||||||
|
|
||||||
def generate_ssl_keys():
|
|
||||||
"""
|
|
||||||
This method generates a new SSL key/cert.
|
|
||||||
"""
|
|
||||||
digest = "md5"
|
|
||||||
# Generate key pair
|
|
||||||
pkey = crypto.PKey()
|
|
||||||
pkey.generate_key(crypto.TYPE_RSA, 1024)
|
|
||||||
|
|
||||||
# Generate cert request
|
|
||||||
req = crypto.X509Req()
|
|
||||||
subj = req.get_subject()
|
|
||||||
setattr(subj, "CN", "Deluge Daemon")
|
|
||||||
req.set_pubkey(pkey)
|
|
||||||
req.sign(pkey, digest)
|
|
||||||
|
|
||||||
# Generate certificate
|
|
||||||
cert = crypto.X509()
|
|
||||||
cert.set_serial_number(0)
|
|
||||||
cert.gmtime_adj_notBefore(0)
|
|
||||||
cert.gmtime_adj_notAfter(60*60*24*365*5) # Five Years
|
|
||||||
cert.set_issuer(req.get_subject())
|
|
||||||
cert.set_subject(req.get_subject())
|
|
||||||
cert.set_pubkey(req.get_pubkey())
|
|
||||||
cert.sign(pkey, digest)
|
|
||||||
|
|
||||||
# Write out files
|
|
||||||
ssl_dir = deluge.configmanager.get_config_dir("ssl")
|
|
||||||
open(os.path.join(ssl_dir, "daemon.pkey"), "w").write(
|
|
||||||
crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey)
|
|
||||||
)
|
|
||||||
open(os.path.join(ssl_dir, "daemon.cert"), "w").write(
|
|
||||||
crypto.dump_certificate(crypto.FILETYPE_PEM, cert)
|
|
||||||
)
|
|
||||||
# Make the files only readable by this user
|
|
||||||
for f in ("daemon.pkey", "daemon.cert"):
|
|
||||||
os.chmod(os.path.join(ssl_dir, f), stat.S_IREAD | stat.S_IWRITE)
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
136
deluge/crypto_utils.py
Normal file
136
deluge/crypto_utils.py
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2007,2008 Andrew Resch <andrewresch@gmail.com>
|
||||||
|
#
|
||||||
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
|
# See LICENSE for more details.
|
||||||
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import stat
|
||||||
|
|
||||||
|
from OpenSSL import crypto
|
||||||
|
from OpenSSL.crypto import FILETYPE_PEM
|
||||||
|
from twisted.internet.ssl import (
|
||||||
|
AcceptableCiphers,
|
||||||
|
Certificate,
|
||||||
|
CertificateOptions,
|
||||||
|
KeyPair,
|
||||||
|
TLSVersion,
|
||||||
|
)
|
||||||
|
|
||||||
|
import deluge.configmanager
|
||||||
|
|
||||||
|
# A TLS ciphers list.
|
||||||
|
# Sources for more information on TLS ciphers:
|
||||||
|
# - https://wiki.mozilla.org/Security/Server_Side_TLS
|
||||||
|
# - https://www.ssllabs.com/projects/best-practices/index.html
|
||||||
|
# - https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
|
||||||
|
#
|
||||||
|
# This list was inspired by the `urllib3` library
|
||||||
|
# - https://github.com/urllib3/urllib3/blob/master/urllib3/util/ssl_.py#L79
|
||||||
|
#
|
||||||
|
# The general intent is:
|
||||||
|
# - prefer cipher suites that offer perfect forward secrecy (ECDHE),
|
||||||
|
# - prefer AES-GCM over ChaCha20 because hardware-accelerated AES is common,
|
||||||
|
# - disable NULL authentication, MD5 MACs and DSS for security reasons.
|
||||||
|
TLS_CIPHERS = ':'.join(
|
||||||
|
[
|
||||||
|
'ECDH+AESGCM',
|
||||||
|
'ECDH+CHACHA20',
|
||||||
|
'AES256-GCM-SHA384',
|
||||||
|
'AES128-GCM-SHA256',
|
||||||
|
'!DSS' '!aNULL',
|
||||||
|
'!eNULL',
|
||||||
|
'!MD5',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
# This value tells OpenSSL to disable all SSL/TLS renegotiation.
|
||||||
|
SSL_OP_NO_RENEGOTIATION = 0x40000000
|
||||||
|
|
||||||
|
|
||||||
|
def get_context_factory(cert_path, pkey_path):
|
||||||
|
"""OpenSSL context factory.
|
||||||
|
|
||||||
|
Generates an OpenSSL context factory using Twisted's CertificateOptions class.
|
||||||
|
This will keep a server cipher order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
cert_path (string): The path to the certificate file
|
||||||
|
pkey_path (string): The path to the private key file
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
twisted.internet.ssl.CertificateOptions: An OpenSSL context factory
|
||||||
|
"""
|
||||||
|
|
||||||
|
with open(cert_path) as cert:
|
||||||
|
certificate = Certificate.loadPEM(cert.read()).original
|
||||||
|
with open(pkey_path) as pkey:
|
||||||
|
private_key = KeyPair.load(pkey.read(), FILETYPE_PEM).original
|
||||||
|
ciphers = AcceptableCiphers.fromOpenSSLCipherString(TLS_CIPHERS)
|
||||||
|
cert_options = CertificateOptions(
|
||||||
|
privateKey=private_key,
|
||||||
|
certificate=certificate,
|
||||||
|
raiseMinimumTo=TLSVersion.TLSv1_2,
|
||||||
|
acceptableCiphers=ciphers,
|
||||||
|
)
|
||||||
|
ctx = cert_options.getContext()
|
||||||
|
ctx.use_certificate_chain_file(cert_path)
|
||||||
|
ctx.set_options(SSL_OP_NO_RENEGOTIATION)
|
||||||
|
|
||||||
|
return cert_options
|
||||||
|
|
||||||
|
|
||||||
|
def check_ssl_keys():
|
||||||
|
"""
|
||||||
|
Check for SSL cert/key and create them if necessary
|
||||||
|
"""
|
||||||
|
ssl_dir = deluge.configmanager.get_config_dir('ssl')
|
||||||
|
if not os.path.exists(ssl_dir):
|
||||||
|
# The ssl folder doesn't exist so we need to create it
|
||||||
|
os.makedirs(ssl_dir)
|
||||||
|
generate_ssl_keys()
|
||||||
|
else:
|
||||||
|
for f in ('daemon.pkey', 'daemon.cert'):
|
||||||
|
if not os.path.exists(os.path.join(ssl_dir, f)):
|
||||||
|
generate_ssl_keys()
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
def generate_ssl_keys():
|
||||||
|
"""
|
||||||
|
This method generates a new SSL key/cert.
|
||||||
|
"""
|
||||||
|
digest = 'sha256'
|
||||||
|
|
||||||
|
# Generate key pair
|
||||||
|
pkey = crypto.PKey()
|
||||||
|
pkey.generate_key(crypto.TYPE_RSA, 2048)
|
||||||
|
|
||||||
|
# Generate cert request
|
||||||
|
req = crypto.X509Req()
|
||||||
|
subj = req.get_subject()
|
||||||
|
setattr(subj, 'CN', 'Deluge Daemon')
|
||||||
|
req.set_pubkey(pkey)
|
||||||
|
req.sign(pkey, digest)
|
||||||
|
|
||||||
|
# Generate certificate
|
||||||
|
cert = crypto.X509()
|
||||||
|
cert.set_serial_number(0)
|
||||||
|
cert.gmtime_adj_notBefore(0)
|
||||||
|
cert.gmtime_adj_notAfter(60 * 60 * 24 * 365 * 3) # Three Years
|
||||||
|
cert.set_issuer(req.get_subject())
|
||||||
|
cert.set_subject(req.get_subject())
|
||||||
|
cert.set_pubkey(req.get_pubkey())
|
||||||
|
cert.sign(pkey, digest)
|
||||||
|
|
||||||
|
# Write out files
|
||||||
|
ssl_dir = deluge.configmanager.get_config_dir('ssl')
|
||||||
|
with open(os.path.join(ssl_dir, 'daemon.pkey'), 'wb') as _file:
|
||||||
|
_file.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey))
|
||||||
|
with open(os.path.join(ssl_dir, 'daemon.cert'), 'wb') as _file:
|
||||||
|
_file.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))
|
||||||
|
# Make the files only readable by this user
|
||||||
|
for f in ('daemon.pkey', 'daemon.cert'):
|
||||||
|
os.chmod(os.path.join(ssl_dir, f), stat.S_IREAD | stat.S_IWRITE)
|
||||||
@ -1,39 +1,19 @@
|
|||||||
#
|
#
|
||||||
# decorators.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2010 John Garland <johnnybg+deluge@gmail.com>
|
# Copyright (C) 2010 John Garland <johnnybg+deluge@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import inspect
|
||||||
|
import re
|
||||||
|
import warnings
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
from typing import Any, Callable, Coroutine, TypeVar
|
||||||
|
|
||||||
|
from twisted.internet import defer
|
||||||
|
|
||||||
|
|
||||||
def proxy(proxy_func):
|
def proxy(proxy_func):
|
||||||
"""
|
"""
|
||||||
@ -43,9 +23,196 @@ def proxy(proxy_func):
|
|||||||
:param proxy_func: the proxy function
|
:param proxy_func: the proxy function
|
||||||
:type proxy_func: function
|
:type proxy_func: function
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
return proxy_func(func, *args, **kwargs)
|
return proxy_func(func, *args, **kwargs)
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
|
def overrides(*args):
|
||||||
|
"""
|
||||||
|
Decorater function to specify when class methods override
|
||||||
|
super class methods.
|
||||||
|
|
||||||
|
When used as
|
||||||
|
@overrides
|
||||||
|
def funcname
|
||||||
|
|
||||||
|
the argument will be the funcname function.
|
||||||
|
|
||||||
|
When used as
|
||||||
|
@overrides(BaseClass)
|
||||||
|
def funcname
|
||||||
|
|
||||||
|
the argument will be the BaseClass
|
||||||
|
|
||||||
|
"""
|
||||||
|
stack = inspect.stack()
|
||||||
|
if inspect.isfunction(args[0]):
|
||||||
|
return _overrides(stack, args[0])
|
||||||
|
else:
|
||||||
|
# One or more classes are specified, so return a function that will be
|
||||||
|
# called with the real function as argument
|
||||||
|
def ret_func(func, **kwargs):
|
||||||
|
return _overrides(stack, func, explicit_base_classes=args)
|
||||||
|
|
||||||
|
return ret_func
|
||||||
|
|
||||||
|
|
||||||
|
def _overrides(stack, method, explicit_base_classes=None):
|
||||||
|
# stack[0]=overrides, stack[1]=inside class def'n, stack[2]=outside class def'n
|
||||||
|
classes = {}
|
||||||
|
derived_class_locals = stack[2][0].f_locals
|
||||||
|
|
||||||
|
# Find all super classes
|
||||||
|
m = re.search(r'class\s(.+)\((.+)\)\s*\:', stack[2][4][0])
|
||||||
|
class_name = m.group(1)
|
||||||
|
base_classes = m.group(2)
|
||||||
|
|
||||||
|
# Handle multiple inheritance
|
||||||
|
base_classes = [s.strip() for s in base_classes.split(',')]
|
||||||
|
check_classes = base_classes
|
||||||
|
|
||||||
|
if not base_classes:
|
||||||
|
raise ValueError(
|
||||||
|
'overrides decorator: unable to determine base class of class "%s"'
|
||||||
|
% class_name
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_class(cls_name):
|
||||||
|
if '.' not in cls_name:
|
||||||
|
return derived_class_locals[cls_name]
|
||||||
|
else:
|
||||||
|
components = cls_name.split('.')
|
||||||
|
# obj is either a module or a class
|
||||||
|
obj = derived_class_locals[components[0]]
|
||||||
|
for c in components[1:]:
|
||||||
|
assert inspect.ismodule(obj) or inspect.isclass(obj)
|
||||||
|
obj = getattr(obj, c)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
if explicit_base_classes:
|
||||||
|
# One or more base classes are explicitly given, check only those classes
|
||||||
|
override_classes = re.search(r'\s*@overrides\((.+)\)\s*', stack[1][4][0]).group(
|
||||||
|
1
|
||||||
|
)
|
||||||
|
override_classes = [c.strip() for c in override_classes.split(',')]
|
||||||
|
check_classes = override_classes
|
||||||
|
|
||||||
|
for c in base_classes + check_classes:
|
||||||
|
classes[c] = get_class(c)
|
||||||
|
|
||||||
|
# Verify that the explicit override class is one of base classes
|
||||||
|
if explicit_base_classes:
|
||||||
|
from itertools import product
|
||||||
|
|
||||||
|
for bc, cc in product(base_classes, check_classes):
|
||||||
|
if issubclass(classes[bc], classes[cc]):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise Exception(
|
||||||
|
'Excplicit override class "%s" is not a super class of: %s'
|
||||||
|
% (explicit_base_classes, class_name)
|
||||||
|
)
|
||||||
|
if not all(hasattr(classes[cls], method.__name__) for cls in check_classes):
|
||||||
|
for cls in check_classes:
|
||||||
|
if not hasattr(classes[cls], method.__name__):
|
||||||
|
raise Exception(
|
||||||
|
'Function override "%s" not found in superclass: %s\n%s'
|
||||||
|
% (
|
||||||
|
method.__name__,
|
||||||
|
cls,
|
||||||
|
f'File: {stack[1][1]}:{stack[1][2]}',
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if not any(hasattr(classes[cls], method.__name__) for cls in check_classes):
|
||||||
|
raise Exception(
|
||||||
|
'Function override "%s" not found in any superclass: %s\n%s'
|
||||||
|
% (
|
||||||
|
method.__name__,
|
||||||
|
check_classes,
|
||||||
|
f'File: {stack[1][1]}:{stack[1][2]}',
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return method
|
||||||
|
|
||||||
|
|
||||||
|
def deprecated(func):
|
||||||
|
"""This is a decorator which can be used to mark function as deprecated.
|
||||||
|
|
||||||
|
It will result in a warning being emitted when the function is used.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
@wraps(func)
|
||||||
|
def depr_func(*args, **kwargs):
|
||||||
|
warnings.simplefilter('always', DeprecationWarning) # Turn off filter
|
||||||
|
warnings.warn(
|
||||||
|
f'Call to deprecated function {func.__name__}.',
|
||||||
|
category=DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
warnings.simplefilter('default', DeprecationWarning) # Reset filter
|
||||||
|
return func(*args, **kwargs)
|
||||||
|
|
||||||
|
return depr_func
|
||||||
|
|
||||||
|
|
||||||
|
class CoroutineDeferred(defer.Deferred):
|
||||||
|
"""Wraps a coroutine in a Deferred.
|
||||||
|
It will dynamically pass through the underlying coroutine without wrapping where apporpriate."""
|
||||||
|
|
||||||
|
def __init__(self, coro: Coroutine):
|
||||||
|
# Delay this import to make sure a reactor was installed first
|
||||||
|
from twisted.internet import reactor
|
||||||
|
|
||||||
|
super().__init__()
|
||||||
|
self.coro = coro
|
||||||
|
self.awaited = None
|
||||||
|
self.activate_deferred = reactor.callLater(0, self.activate)
|
||||||
|
|
||||||
|
def __await__(self):
|
||||||
|
if self.awaited in [None, True]:
|
||||||
|
self.awaited = True
|
||||||
|
return self.coro.__await__()
|
||||||
|
# Already in deferred mode
|
||||||
|
return super().__await__()
|
||||||
|
|
||||||
|
def activate(self):
|
||||||
|
"""If the result wasn't awaited before the next context switch, we turn it into a deferred."""
|
||||||
|
if self.awaited is None:
|
||||||
|
self.awaited = False
|
||||||
|
try:
|
||||||
|
d = defer.Deferred.fromCoroutine(self.coro)
|
||||||
|
except AttributeError:
|
||||||
|
# Fallback for Twisted <= 21.2 without fromCoroutine
|
||||||
|
d = defer.ensureDeferred(self.coro)
|
||||||
|
d.chainDeferred(self)
|
||||||
|
|
||||||
|
def addCallbacks(self, *args, **kwargs): # noqa: N802
|
||||||
|
assert not self.awaited, 'Cannot add callbacks to an already awaited coroutine.'
|
||||||
|
self.activate()
|
||||||
|
return super().addCallbacks(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
_RetT = TypeVar('_RetT')
|
||||||
|
|
||||||
|
|
||||||
|
def maybe_coroutine(
|
||||||
|
f: Callable[..., Coroutine[Any, Any, _RetT]]
|
||||||
|
) -> 'Callable[..., defer.Deferred[_RetT]]':
|
||||||
|
"""Wraps a coroutine function to make it usable as a normal function that returns a Deferred."""
|
||||||
|
|
||||||
|
@wraps(f)
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
# Uncomment for quick testing to make sure CoroutineDeferred magic isn't at fault
|
||||||
|
# return defer.ensureDeferred(f(*args, **kwargs))
|
||||||
|
return CoroutineDeferred(f(*args, **kwargs))
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
|||||||
119
deluge/error.py
119
deluge/error.py
@ -1,131 +1,96 @@
|
|||||||
#
|
#
|
||||||
# error.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||||
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
class DelugeError(Exception):
|
class DelugeError(Exception):
|
||||||
def _get_message(self):
|
|
||||||
return self._message
|
|
||||||
def _set_message(self, message):
|
|
||||||
self._message = message
|
|
||||||
message = property(_get_message, _set_message)
|
|
||||||
del _get_message, _set_message
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.message
|
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
inst = super(DelugeError, cls).__new__(cls, *args, **kwargs)
|
inst = super().__new__(cls, *args, **kwargs)
|
||||||
inst._args = args
|
inst._args = args
|
||||||
inst._kwargs = kwargs
|
inst._kwargs = kwargs
|
||||||
return inst
|
return inst
|
||||||
|
|
||||||
class NoCoreError(DelugeError):
|
def __init__(self, message=None):
|
||||||
pass
|
super().__init__(message)
|
||||||
|
self.message = message
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.message
|
||||||
|
|
||||||
|
|
||||||
class DaemonRunningError(DelugeError):
|
class DaemonRunningError(DelugeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class InvalidTorrentError(DelugeError):
|
class InvalidTorrentError(DelugeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class AddTorrentError(DelugeError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class InvalidPathError(DelugeError):
|
class InvalidPathError(DelugeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class WrappedException(DelugeError):
|
class WrappedException(DelugeError):
|
||||||
def _get_traceback(self):
|
|
||||||
return self._traceback
|
|
||||||
def _set_traceback(self, traceback):
|
|
||||||
self._traceback = traceback
|
|
||||||
traceback = property(_get_traceback, _set_traceback)
|
|
||||||
del _get_traceback, _set_traceback
|
|
||||||
|
|
||||||
def _get_type(self):
|
|
||||||
return self._type
|
|
||||||
def _set_type(self, type):
|
|
||||||
self._type = type
|
|
||||||
type = property(_get_type, _set_type)
|
|
||||||
del _get_type, _set_type
|
|
||||||
|
|
||||||
def __init__(self, message, exception_type, traceback):
|
def __init__(self, message, exception_type, traceback):
|
||||||
self.message = message
|
super().__init__(message)
|
||||||
self.type = exception_type
|
self.type = exception_type
|
||||||
self.traceback = traceback
|
self.traceback = traceback
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f'{self.message}\n{self.traceback}'
|
||||||
|
|
||||||
|
|
||||||
class _ClientSideRecreateError(DelugeError):
|
class _ClientSideRecreateError(DelugeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class IncompatibleClient(_ClientSideRecreateError):
|
class IncompatibleClient(_ClientSideRecreateError):
|
||||||
def __init__(self, daemon_version):
|
def __init__(self, daemon_version):
|
||||||
self.daemon_version = daemon_version
|
self.daemon_version = daemon_version
|
||||||
self.message = _(
|
msg = (
|
||||||
"Your deluge client is not compatible with the daemon. "
|
'Your deluge client is not compatible with the daemon. '
|
||||||
"Please upgrade your client to %(daemon_version)s"
|
'Please upgrade your client to %(daemon_version)s'
|
||||||
) % dict(daemon_version=self.daemon_version)
|
) % {'daemon_version': self.daemon_version}
|
||||||
|
super().__init__(message=msg)
|
||||||
|
|
||||||
|
|
||||||
class NotAuthorizedError(_ClientSideRecreateError):
|
class NotAuthorizedError(_ClientSideRecreateError):
|
||||||
|
|
||||||
def __init__(self, current_level, required_level):
|
def __init__(self, current_level, required_level):
|
||||||
self.message = _(
|
msg = ('Auth level too low: %(current_level)s < %(required_level)s') % {
|
||||||
"Auth level too low: %(current_level)s < %(required_level)s" %
|
'current_level': current_level,
|
||||||
dict(current_level=current_level, required_level=required_level)
|
'required_level': required_level,
|
||||||
)
|
}
|
||||||
|
super().__init__(message=msg)
|
||||||
self.current_level = current_level
|
self.current_level = current_level
|
||||||
self.required_level = required_level
|
self.required_level = required_level
|
||||||
|
|
||||||
|
|
||||||
class _UsernameBasedPasstroughError(_ClientSideRecreateError):
|
class _UsernameBasedPasstroughError(_ClientSideRecreateError):
|
||||||
|
|
||||||
def _get_username(self):
|
|
||||||
return self._username
|
|
||||||
def _set_username(self, username):
|
|
||||||
self._username = username
|
|
||||||
username = property(_get_username, _set_username)
|
|
||||||
del _get_username, _set_username
|
|
||||||
|
|
||||||
def __init__(self, message, username):
|
def __init__(self, message, username):
|
||||||
super(_UsernameBasedPasstroughError, self).__init__(message)
|
super().__init__(message)
|
||||||
self.message = message
|
|
||||||
self.username = username
|
self.username = username
|
||||||
|
|
||||||
|
|
||||||
class BadLoginError(_UsernameBasedPasstroughError):
|
class BadLoginError(_UsernameBasedPasstroughError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AuthenticationRequired(_UsernameBasedPasstroughError):
|
class AuthenticationRequired(_UsernameBasedPasstroughError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AuthManagerError(_UsernameBasedPasstroughError):
|
class AuthManagerError(_UsernameBasedPasstroughError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class LibtorrentImportError(ImportError):
|
||||||
|
pass
|
||||||
|
|||||||
137
deluge/event.py
137
deluge/event.py
@ -1,36 +1,9 @@
|
|||||||
#
|
#
|
||||||
# event.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -40,19 +13,21 @@ This module describes the types of events that can be generated by the daemon
|
|||||||
and subsequently emitted to the clients.
|
and subsequently emitted to the clients.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
known_events = {}
|
known_events = {}
|
||||||
|
|
||||||
|
|
||||||
class DelugeEventMetaClass(type):
|
class DelugeEventMetaClass(type):
|
||||||
"""
|
"""
|
||||||
This metaclass simply keeps a list of all events classes created.
|
This metaclass simply keeps a list of all events classes created.
|
||||||
"""
|
"""
|
||||||
def __init__(cls, name, bases, dct):
|
|
||||||
super(DelugeEventMetaClass, cls).__init__(name, bases, dct)
|
def __init__(cls, name, bases, dct): # pylint: disable=bad-mcs-method-argument
|
||||||
if name != "DelugeEvent":
|
super().__init__(name, bases, dct)
|
||||||
|
if name != 'DelugeEvent':
|
||||||
known_events[name] = cls
|
known_events[name] = cls
|
||||||
|
|
||||||
class DelugeEvent(object):
|
|
||||||
|
class DelugeEvent(metaclass=DelugeEventMetaClass):
|
||||||
"""
|
"""
|
||||||
The base class for all events.
|
The base class for all events.
|
||||||
|
|
||||||
@ -62,23 +37,24 @@ class DelugeEvent(object):
|
|||||||
:type args: list
|
:type args: list
|
||||||
|
|
||||||
"""
|
"""
|
||||||
__metaclass__ = DelugeEventMetaClass
|
|
||||||
|
|
||||||
def _get_name(self):
|
def _get_name(self):
|
||||||
return self.__class__.__name__
|
return self.__class__.__name__
|
||||||
|
|
||||||
def _get_args(self):
|
def _get_args(self):
|
||||||
if not hasattr(self, "_args"):
|
if not hasattr(self, '_args'):
|
||||||
return []
|
return []
|
||||||
return self._args
|
return self._args
|
||||||
|
|
||||||
name = property(fget=_get_name)
|
name = property(fget=_get_name)
|
||||||
args = property(fget=_get_args)
|
args = property(fget=_get_args)
|
||||||
|
|
||||||
|
|
||||||
class TorrentAddedEvent(DelugeEvent):
|
class TorrentAddedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a new torrent is successfully added to the session.
|
Emitted when a new torrent is successfully added to the session.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id, from_state):
|
def __init__(self, torrent_id, from_state):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id of the torrent that was added
|
:param torrent_id: the torrent_id of the torrent that was added
|
||||||
@ -88,10 +64,12 @@ class TorrentAddedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id, from_state]
|
self._args = [torrent_id, from_state]
|
||||||
|
|
||||||
|
|
||||||
class TorrentRemovedEvent(DelugeEvent):
|
class TorrentRemovedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a torrent has been removed from the session.
|
Emitted when a torrent has been removed from the session.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id):
|
def __init__(self, torrent_id):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id
|
:param torrent_id: the torrent_id
|
||||||
@ -99,10 +77,12 @@ class TorrentRemovedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id]
|
self._args = [torrent_id]
|
||||||
|
|
||||||
|
|
||||||
class PreTorrentRemovedEvent(DelugeEvent):
|
class PreTorrentRemovedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a torrent is about to be removed from the session.
|
Emitted when a torrent is about to be removed from the session.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id):
|
def __init__(self, torrent_id):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id
|
:param torrent_id: the torrent_id
|
||||||
@ -110,10 +90,12 @@ class PreTorrentRemovedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id]
|
self._args = [torrent_id]
|
||||||
|
|
||||||
|
|
||||||
class TorrentStateChangedEvent(DelugeEvent):
|
class TorrentStateChangedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a torrent changes state.
|
Emitted when a torrent changes state.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id, state):
|
def __init__(self, torrent_id, state):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id
|
:param torrent_id: the torrent_id
|
||||||
@ -123,16 +105,34 @@ class TorrentStateChangedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id, state]
|
self._args = [torrent_id, state]
|
||||||
|
|
||||||
|
|
||||||
|
class TorrentTrackerStatusEvent(DelugeEvent):
|
||||||
|
"""
|
||||||
|
Emitted when a torrents tracker status changes.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, torrent_id, status):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
torrent_id (str): the torrent_id
|
||||||
|
status (str): the new status
|
||||||
|
"""
|
||||||
|
self._args = [torrent_id, status]
|
||||||
|
|
||||||
|
|
||||||
class TorrentQueueChangedEvent(DelugeEvent):
|
class TorrentQueueChangedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when the queue order has changed.
|
Emitted when the queue order has changed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TorrentFolderRenamedEvent(DelugeEvent):
|
class TorrentFolderRenamedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a folder within a torrent has been renamed.
|
Emitted when a folder within a torrent has been renamed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id, old, new):
|
def __init__(self, torrent_id, old, new):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id
|
:param torrent_id: the torrent_id
|
||||||
@ -144,10 +144,12 @@ class TorrentFolderRenamedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id, old, new]
|
self._args = [torrent_id, old, new]
|
||||||
|
|
||||||
|
|
||||||
class TorrentFileRenamedEvent(DelugeEvent):
|
class TorrentFileRenamedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a file within a torrent has been renamed.
|
Emitted when a file within a torrent has been renamed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id, index, name):
|
def __init__(self, torrent_id, index, name):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id
|
:param torrent_id: the torrent_id
|
||||||
@ -159,10 +161,12 @@ class TorrentFileRenamedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id, index, name]
|
self._args = [torrent_id, index, name]
|
||||||
|
|
||||||
|
|
||||||
class TorrentFinishedEvent(DelugeEvent):
|
class TorrentFinishedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a torrent finishes downloading.
|
Emitted when a torrent finishes downloading.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id):
|
def __init__(self, torrent_id):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id
|
:param torrent_id: the torrent_id
|
||||||
@ -170,10 +174,12 @@ class TorrentFinishedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id]
|
self._args = [torrent_id]
|
||||||
|
|
||||||
|
|
||||||
class TorrentResumedEvent(DelugeEvent):
|
class TorrentResumedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a torrent resumes from a paused state.
|
Emitted when a torrent resumes from a paused state.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id):
|
def __init__(self, torrent_id):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id
|
:param torrent_id: the torrent_id
|
||||||
@ -181,13 +187,12 @@ class TorrentResumedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id]
|
self._args = [torrent_id]
|
||||||
|
|
||||||
|
|
||||||
class TorrentFileCompletedEvent(DelugeEvent):
|
class TorrentFileCompletedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a file completes.
|
Emitted when a file completes.
|
||||||
|
|
||||||
This will only work with libtorrent 0.15 or greater.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, torrent_id, index):
|
def __init__(self, torrent_id, index):
|
||||||
"""
|
"""
|
||||||
:param torrent_id: the torrent_id
|
:param torrent_id: the torrent_id
|
||||||
@ -197,17 +202,36 @@ class TorrentFileCompletedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id, index]
|
self._args = [torrent_id, index]
|
||||||
|
|
||||||
|
|
||||||
|
class TorrentStorageMovedEvent(DelugeEvent):
|
||||||
|
"""
|
||||||
|
Emitted when the storage location for a torrent has been moved.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, torrent_id, path):
|
||||||
|
"""
|
||||||
|
:param torrent_id: the torrent_id
|
||||||
|
:type torrent_id: string
|
||||||
|
:param path: the new location
|
||||||
|
:type path: string
|
||||||
|
"""
|
||||||
|
self._args = [torrent_id, path]
|
||||||
|
|
||||||
|
|
||||||
class CreateTorrentProgressEvent(DelugeEvent):
|
class CreateTorrentProgressEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when creating a torrent file remotely.
|
Emitted when creating a torrent file remotely.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, piece_count, num_pieces):
|
def __init__(self, piece_count, num_pieces):
|
||||||
self._args = [piece_count, num_pieces]
|
self._args = [piece_count, num_pieces]
|
||||||
|
|
||||||
|
|
||||||
class NewVersionAvailableEvent(DelugeEvent):
|
class NewVersionAvailableEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a more recent version of Deluge is available.
|
Emitted when a more recent version of Deluge is available.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, new_release):
|
def __init__(self, new_release):
|
||||||
"""
|
"""
|
||||||
:param new_release: the new version that is available
|
:param new_release: the new version that is available
|
||||||
@ -215,29 +239,37 @@ class NewVersionAvailableEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [new_release]
|
self._args = [new_release]
|
||||||
|
|
||||||
|
|
||||||
class SessionStartedEvent(DelugeEvent):
|
class SessionStartedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a session has started. This typically only happens once when
|
Emitted when a session has started. This typically only happens once when
|
||||||
the daemon is initially started.
|
the daemon is initially started.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SessionPausedEvent(DelugeEvent):
|
class SessionPausedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when the session has been paused.
|
Emitted when the session has been paused.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SessionResumedEvent(DelugeEvent):
|
class SessionResumedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when the session has been resumed.
|
Emitted when the session has been resumed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConfigValueChangedEvent(DelugeEvent):
|
class ConfigValueChangedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a config value changes in the Core.
|
Emitted when a config value changes in the Core.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, key, value):
|
def __init__(self, key, value):
|
||||||
"""
|
"""
|
||||||
:param key: the key that changed
|
:param key: the key that changed
|
||||||
@ -246,17 +278,42 @@ class ConfigValueChangedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [key, value]
|
self._args = [key, value]
|
||||||
|
|
||||||
|
|
||||||
class PluginEnabledEvent(DelugeEvent):
|
class PluginEnabledEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a plugin is enabled in the Core.
|
Emitted when a plugin is enabled in the Core.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, plugin_name):
|
def __init__(self, plugin_name):
|
||||||
self._args = [plugin_name]
|
self._args = [plugin_name]
|
||||||
|
|
||||||
|
|
||||||
class PluginDisabledEvent(DelugeEvent):
|
class PluginDisabledEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a plugin is disabled in the Core.
|
Emitted when a plugin is disabled in the Core.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, plugin_name):
|
def __init__(self, plugin_name):
|
||||||
self._args = [plugin_name]
|
self._args = [plugin_name]
|
||||||
|
|
||||||
|
|
||||||
|
class ClientDisconnectedEvent(DelugeEvent):
|
||||||
|
"""
|
||||||
|
Emitted when a client disconnects.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, session_id):
|
||||||
|
self._args = [session_id]
|
||||||
|
|
||||||
|
|
||||||
|
class ExternalIPEvent(DelugeEvent):
|
||||||
|
"""
|
||||||
|
Emitted when the external ip address is received from libtorrent.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, external_ip):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
external_ip (str): The IP address.
|
||||||
|
"""
|
||||||
|
self._args = [external_ip]
|
||||||
|
|||||||
@ -1,207 +1,333 @@
|
|||||||
#
|
#
|
||||||
# httpdownloader.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
||||||
#
|
#
|
||||||
# Deluge is free software.
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||||
#
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||||
# You may redistribute it and/or modify it under the terms of the
|
# See LICENSE for more details.
|
||||||
# GNU General Public License, as published by the Free Software
|
|
||||||
# Foundation; either version 3 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# deluge is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with deluge. If not, write to:
|
|
||||||
# The Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor
|
|
||||||
# Boston, MA 02110-1301, USA.
|
|
||||||
#
|
|
||||||
# In addition, as a special exception, the copyright holders give
|
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
|
||||||
# library.
|
|
||||||
# You must obey the GNU General Public License in all respects for all of
|
|
||||||
# the code used other than OpenSSL. If you modify file(s) with this
|
|
||||||
# exception, you may extend this exception to your version of the file(s),
|
|
||||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
|
||||||
# this exception statement from your version. If you delete this exception
|
|
||||||
# statement from all source files in the program, then also delete it here.
|
|
||||||
#
|
#
|
||||||
|
|
||||||
from twisted.web import client, http
|
import cgi
|
||||||
from twisted.web.error import PageRedirect
|
|
||||||
from twisted.python.failure import Failure
|
|
||||||
from twisted.internet import reactor
|
|
||||||
from common import get_version
|
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
|
from twisted.internet import reactor
|
||||||
|
from twisted.internet.defer import Deferred
|
||||||
|
from twisted.python.failure import Failure
|
||||||
|
from twisted.web import client, http
|
||||||
|
from twisted.web._newclient import HTTPClientParser
|
||||||
|
from twisted.web.error import Error, PageRedirect
|
||||||
|
from twisted.web.http_headers import Headers
|
||||||
|
from twisted.web.iweb import IAgent
|
||||||
|
from zope.interface import implementer
|
||||||
|
|
||||||
|
from deluge.common import get_version
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class HTTPDownloader(client.HTTPDownloader):
|
|
||||||
"""
|
class CompressionDecoder(client.GzipDecoder):
|
||||||
Factory class for downloading files and keeping track of progress.
|
"""A compression decoder for gzip, x-gzip and deflate."""
|
||||||
"""
|
|
||||||
def __init__(self, url, filename, part_callback=None, headers=None,
|
def deliverBody(self, protocol): # NOQA: N802
|
||||||
force_filename=False, allow_compression=True):
|
self.original.deliverBody(CompressionDecoderProtocol(protocol, self.original))
|
||||||
|
|
||||||
|
|
||||||
|
class CompressionDecoderProtocol(client._GzipProtocol):
|
||||||
|
"""A compression decoder protocol for CompressionDecoder."""
|
||||||
|
|
||||||
|
def __init__(self, protocol, response):
|
||||||
|
super().__init__(protocol, response)
|
||||||
|
self._zlibDecompress = zlib.decompressobj(32 + zlib.MAX_WBITS)
|
||||||
|
|
||||||
|
|
||||||
|
class BodyHandler(HTTPClientParser):
|
||||||
|
"""An HTTP parser that saves the response to a file."""
|
||||||
|
|
||||||
|
def __init__(self, request, finished, length, agent, encoding=None):
|
||||||
|
"""BodyHandler init.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request (t.w.i.IClientRequest): The parser request.
|
||||||
|
finished (Deferred): A Deferred to handle the finished response.
|
||||||
|
length (int): The length of the response.
|
||||||
|
agent (t.w.i.IAgent): The agent from which the request was sent.
|
||||||
"""
|
"""
|
||||||
:param url: the url to download from
|
super().__init__(request, finished)
|
||||||
:type url: string
|
self.agent = agent
|
||||||
:param filename: the filename to save the file as
|
self.finished = finished
|
||||||
:type filename: string
|
self.total_length = length
|
||||||
:param force_filename: forces use of the supplied filename, regardless of header content
|
|
||||||
:type force_filename: bool
|
|
||||||
:param part_callback: a function to be called when a part of data
|
|
||||||
is received, it's signature should be: func(data, current_length, total_length)
|
|
||||||
:type part_callback: function
|
|
||||||
:param headers: any optional headers to send
|
|
||||||
:type headers: dictionary
|
|
||||||
"""
|
|
||||||
self.part_callback = part_callback
|
|
||||||
self.current_length = 0
|
self.current_length = 0
|
||||||
self.decoder = None
|
self.data = b''
|
||||||
self.value = filename
|
self.encoding = encoding
|
||||||
|
|
||||||
|
def dataReceived(self, data): # NOQA: N802
|
||||||
|
self.current_length += len(data)
|
||||||
|
self.data += data
|
||||||
|
if self.agent.part_callback:
|
||||||
|
self.agent.part_callback(data, self.current_length, self.total_length)
|
||||||
|
|
||||||
|
def connectionLost(self, reason): # NOQA: N802
|
||||||
|
if self.encoding:
|
||||||
|
self.data = self.data.decode(self.encoding).encode('utf8')
|
||||||
|
with open(self.agent.filename, 'wb') as _file:
|
||||||
|
_file.write(self.data)
|
||||||
|
self.finished.callback(self.agent.filename)
|
||||||
|
self.state = 'DONE'
|
||||||
|
HTTPClientParser.connectionLost(self, reason)
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(IAgent)
|
||||||
|
class HTTPDownloaderAgent:
|
||||||
|
"""A File Downloader Agent."""
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
agent,
|
||||||
|
filename,
|
||||||
|
part_callback=None,
|
||||||
|
force_filename=False,
|
||||||
|
allow_compression=True,
|
||||||
|
handle_redirect=True,
|
||||||
|
):
|
||||||
|
"""HTTPDownloaderAgent init.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
agent (t.w.c.Agent): The agent which will send the requests.
|
||||||
|
filename (str): The filename to save the file as.
|
||||||
|
force_filename (bool): Forces use of the supplied filename,
|
||||||
|
regardless of header content.
|
||||||
|
part_callback (func): A function to be called when a part of data
|
||||||
|
is received, it's signature should be:
|
||||||
|
func(data, current_length, total_length)
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.handle_redirect = handle_redirect
|
||||||
|
self.agent = agent
|
||||||
|
self.filename = filename
|
||||||
|
self.part_callback = part_callback
|
||||||
self.force_filename = force_filename
|
self.force_filename = force_filename
|
||||||
self.allow_compression = allow_compression
|
self.allow_compression = allow_compression
|
||||||
agent = "Deluge/%s (http://deluge-torrent.org)" % get_version()
|
self.decoder = None
|
||||||
client.HTTPDownloader.__init__(self, url, filename, headers=headers, agent=agent)
|
|
||||||
|
|
||||||
def gotStatus(self, version, status, message):
|
def request_callback(self, response):
|
||||||
self.code = int(status)
|
finished = Deferred()
|
||||||
client.HTTPDownloader.gotStatus(self, version, status, message)
|
|
||||||
|
|
||||||
def gotHeaders(self, headers):
|
if not self.handle_redirect and response.code in (
|
||||||
if self.code == http.OK:
|
http.MOVED_PERMANENTLY,
|
||||||
if "content-length" in headers:
|
http.FOUND,
|
||||||
self.total_length = int(headers["content-length"][0])
|
http.SEE_OTHER,
|
||||||
else:
|
http.TEMPORARY_REDIRECT,
|
||||||
self.total_length = 0
|
):
|
||||||
|
location = response.headers.getRawHeaders(b'location')[0]
|
||||||
|
error = PageRedirect(response.code, location=location)
|
||||||
|
finished.errback(Failure(error))
|
||||||
|
elif response.code >= 400:
|
||||||
|
error = Error(response.code)
|
||||||
|
finished.errback(Failure(error))
|
||||||
|
else:
|
||||||
|
headers = response.headers
|
||||||
|
body_length = int(headers.getRawHeaders(b'content-length', default=[0])[0])
|
||||||
|
|
||||||
if self.allow_compression and "content-encoding" in headers and \
|
if headers.hasHeader(b'content-disposition') and not self.force_filename:
|
||||||
headers["content-encoding"][0] in ("gzip", "x-gzip", "deflate"):
|
content_disp = headers.getRawHeaders(b'content-disposition')[0].decode(
|
||||||
# Adding 32 to the wbits enables gzip & zlib decoding (with automatic header detection)
|
'utf-8'
|
||||||
# Adding 16 just enables gzip decoding (no zlib)
|
)
|
||||||
self.decoder = zlib.decompressobj(zlib.MAX_WBITS + 32)
|
content_disp_params = cgi.parse_header(content_disp)[1]
|
||||||
|
if 'filename' in content_disp_params:
|
||||||
|
new_file_name = content_disp_params['filename']
|
||||||
|
new_file_name = sanitise_filename(new_file_name)
|
||||||
|
new_file_name = os.path.join(
|
||||||
|
os.path.split(self.filename)[0], new_file_name
|
||||||
|
)
|
||||||
|
|
||||||
if "content-disposition" in headers and not self.force_filename:
|
count = 1
|
||||||
new_file_name = str(headers["content-disposition"][0]).split(";")[1].split("=")[1]
|
fileroot = os.path.splitext(new_file_name)[0]
|
||||||
new_file_name = sanitise_filename(new_file_name)
|
fileext = os.path.splitext(new_file_name)[1]
|
||||||
new_file_name = os.path.join(os.path.split(self.fileName)[0], new_file_name)
|
while os.path.isfile(new_file_name):
|
||||||
|
# Increment filename if already exists
|
||||||
|
new_file_name = f'{fileroot}-{count}{fileext}'
|
||||||
|
count += 1
|
||||||
|
|
||||||
count = 1
|
self.filename = new_file_name
|
||||||
fileroot = os.path.splitext(new_file_name)[0]
|
|
||||||
fileext = os.path.splitext(new_file_name)[1]
|
|
||||||
while os.path.isfile(new_file_name):
|
|
||||||
# Increment filename if already exists
|
|
||||||
new_file_name = "%s-%s%s" % (fileroot, count, fileext)
|
|
||||||
count += 1
|
|
||||||
|
|
||||||
self.fileName = new_file_name
|
cont_type_header = headers.getRawHeaders(b'content-type')[0].decode()
|
||||||
self.value = new_file_name
|
cont_type, params = cgi.parse_header(cont_type_header)
|
||||||
|
# Only re-ecode text content types.
|
||||||
|
encoding = None
|
||||||
|
if cont_type.startswith('text/'):
|
||||||
|
encoding = params.get('charset', None)
|
||||||
|
response.deliverBody(
|
||||||
|
BodyHandler(response.request, finished, body_length, self, encoding)
|
||||||
|
)
|
||||||
|
|
||||||
elif self.code in (http.MOVED_PERMANENTLY, http.FOUND, http.SEE_OTHER, http.TEMPORARY_REDIRECT):
|
return finished
|
||||||
location = headers["location"][0]
|
|
||||||
error = PageRedirect(self.code, location=location)
|
|
||||||
self.noPage(Failure(error))
|
|
||||||
|
|
||||||
return client.HTTPDownloader.gotHeaders(self, headers)
|
def request(self, method, uri, headers=None, body_producer=None):
|
||||||
|
"""Issue a new request to the wrapped agent.
|
||||||
|
|
||||||
def pagePart(self, data):
|
Args:
|
||||||
if self.code == http.OK:
|
method (bytes): The HTTP method to use.
|
||||||
self.current_length += len(data)
|
uri (bytes): The url to download from.
|
||||||
if self.decoder:
|
headers (t.w.h.Headers, optional): Any extra headers to send.
|
||||||
data = self.decoder.decompress(data)
|
body_producer (t.w.i.IBodyProducer, optional): Request body data.
|
||||||
if self.part_callback:
|
|
||||||
self.part_callback(data, self.current_length, self.total_length)
|
|
||||||
|
|
||||||
return client.HTTPDownloader.pagePart(self, data)
|
Returns:
|
||||||
|
Deferred: The filename of the of the downloaded file.
|
||||||
|
"""
|
||||||
|
if headers is None:
|
||||||
|
headers = Headers()
|
||||||
|
|
||||||
def pageEnd(self):
|
if not headers.hasHeader(b'User-Agent'):
|
||||||
if self.decoder:
|
version = get_version()
|
||||||
data = self.decoder.flush()
|
user_agent = 'Deluge/%s (https://deluge-torrent.org)' % version
|
||||||
self.current_length -= len(data)
|
headers.addRawHeader('User-Agent', user_agent)
|
||||||
self.decoder = None
|
|
||||||
self.pagePart(data)
|
d = self.agent.request(
|
||||||
|
method=method, uri=uri, headers=headers, bodyProducer=body_producer
|
||||||
|
)
|
||||||
|
d.addCallback(self.request_callback)
|
||||||
|
return d
|
||||||
|
|
||||||
return client.HTTPDownloader.pageEnd(self)
|
|
||||||
|
|
||||||
def sanitise_filename(filename):
|
def sanitise_filename(filename):
|
||||||
"""
|
"""Sanitises a filename to use as a download destination file.
|
||||||
Sanitises a filename to use as a download destination file.
|
|
||||||
Logs any filenames that could be considered malicious.
|
Logs any filenames that could be considered malicious.
|
||||||
|
|
||||||
:param filename: the filename to sanitise
|
filename (str): The filename to sanitise.
|
||||||
:type filename: string
|
|
||||||
:returns: the sanitised filename
|
Returns:
|
||||||
:rtype: string
|
str: The sanitised filename.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Remove any quotes
|
# Remove any quotes
|
||||||
filename = filename.strip("'\"")
|
filename = filename.strip('\'"')
|
||||||
|
|
||||||
if os.path.basename(filename) != filename:
|
if os.path.basename(filename) != filename:
|
||||||
# Dodgy server, log it
|
# Dodgy server, log it
|
||||||
log.warning("Potentially malicious server: trying to write to file '%s'" % filename)
|
log.warning(
|
||||||
|
'Potentially malicious server: trying to write to file: %s', filename
|
||||||
|
)
|
||||||
# Only use the basename
|
# Only use the basename
|
||||||
filename = os.path.basename(filename)
|
filename = os.path.basename(filename)
|
||||||
|
|
||||||
filename = filename.strip()
|
filename = filename.strip()
|
||||||
if filename.startswith(".") or ";" in filename or "|" in filename:
|
if filename.startswith('.') or ';' in filename or '|' in filename:
|
||||||
# Dodgy server, log it
|
# Dodgy server, log it
|
||||||
log.warning("Potentially malicious server: trying to write to file '%s'" % filename)
|
log.warning(
|
||||||
|
'Potentially malicious server: trying to write to file: %s', filename
|
||||||
|
)
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
def download_file(url, filename, callback=None, headers=None,
|
|
||||||
force_filename=False, allow_compression=True):
|
def _download_file(
|
||||||
|
url,
|
||||||
|
filename,
|
||||||
|
callback=None,
|
||||||
|
headers=None,
|
||||||
|
force_filename=False,
|
||||||
|
allow_compression=True,
|
||||||
|
handle_redirects=True,
|
||||||
|
):
|
||||||
|
"""Downloads a file from a specific URL and returns a Deferred.
|
||||||
|
|
||||||
|
A callback function can be specified to be called as parts are received.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
url (str): The url to download from.
|
||||||
|
filename (str): The filename to save the file as.
|
||||||
|
callback (func): A function to be called when partial data is received,
|
||||||
|
it's signature should be: func(data, current_length, total_length)
|
||||||
|
headers (dict): Any optional headers to send.
|
||||||
|
force_filename (bool): Force using the filename specified rather than
|
||||||
|
one the server may suggest.
|
||||||
|
allow_compression (bool): Allows gzip & deflate decoding.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred: The filename of the downloaded file.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
t.w.e.PageRedirect
|
||||||
|
t.w.e.Error: for all other HTTP response errors
|
||||||
"""
|
"""
|
||||||
Downloads a file from a specific URL and returns a Deferred. You can also
|
|
||||||
specify a callback function to be called as parts are received.
|
|
||||||
|
|
||||||
:param url: the url to download from
|
agent = client.Agent(reactor)
|
||||||
:type url: string
|
|
||||||
:param filename: the filename to save the file as
|
|
||||||
:type filename: string
|
|
||||||
:param callback: a function to be called when a part of data is received,
|
|
||||||
it's signature should be: func(data, current_length, total_length)
|
|
||||||
:type callback: function
|
|
||||||
:param headers: any optional headers to send
|
|
||||||
:type headers: dictionary
|
|
||||||
:param force_filename: force us to use the filename specified rather than
|
|
||||||
one the server may suggest
|
|
||||||
:type force_filename: boolean
|
|
||||||
:param allow_compression: allows gzip & deflate decoding
|
|
||||||
:type allow_compression: boolean
|
|
||||||
|
|
||||||
:returns: the filename of the downloaded file
|
|
||||||
:rtype: Deferred
|
|
||||||
|
|
||||||
:raises t.w.e.PageRedirect: when server responds with a temporary redirect
|
|
||||||
or permanently moved.
|
|
||||||
:raises t.w.e.Error: for all other HTTP response errors (besides OK)
|
|
||||||
"""
|
|
||||||
url = str(url)
|
|
||||||
filename = str(filename)
|
|
||||||
if headers:
|
|
||||||
for key, value in headers.items():
|
|
||||||
headers[str(key)] = str(value)
|
|
||||||
|
|
||||||
if allow_compression:
|
if allow_compression:
|
||||||
if not headers:
|
enc_accepted = ['gzip', 'x-gzip', 'deflate']
|
||||||
headers = {}
|
decoders = [(enc.encode(), CompressionDecoder) for enc in enc_accepted]
|
||||||
headers["accept-encoding"] = "deflate, gzip, x-gzip"
|
agent = client.ContentDecoderAgent(agent, decoders)
|
||||||
|
if handle_redirects:
|
||||||
|
agent = client.RedirectAgent(agent)
|
||||||
|
|
||||||
scheme, host, port, path = client._parse(url)
|
agent = HTTPDownloaderAgent(
|
||||||
factory = HTTPDownloader(url, filename, callback, headers, force_filename, allow_compression)
|
agent, filename, callback, force_filename, allow_compression, handle_redirects
|
||||||
if scheme == "https":
|
)
|
||||||
from twisted.internet import ssl
|
|
||||||
reactor.connectSSL(host, port, factory, ssl.ClientContextFactory())
|
|
||||||
else:
|
|
||||||
reactor.connectTCP(host, port, factory)
|
|
||||||
|
|
||||||
return factory.deferred
|
# The Headers init expects dict values to be a list.
|
||||||
|
if headers:
|
||||||
|
for name, value in list(headers.items()):
|
||||||
|
if not isinstance(value, list):
|
||||||
|
headers[name] = [value]
|
||||||
|
|
||||||
|
return agent.request(b'GET', url.encode(), Headers(headers))
|
||||||
|
|
||||||
|
|
||||||
|
def download_file(
|
||||||
|
url,
|
||||||
|
filename,
|
||||||
|
callback=None,
|
||||||
|
headers=None,
|
||||||
|
force_filename=False,
|
||||||
|
allow_compression=True,
|
||||||
|
handle_redirects=True,
|
||||||
|
):
|
||||||
|
"""Downloads a file from a specific URL and returns a Deferred.
|
||||||
|
|
||||||
|
A callback function can be specified to be called as parts are received.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
url (str): The url to download from.
|
||||||
|
filename (str): The filename to save the file as.
|
||||||
|
callback (func): A function to be called when partial data is received,
|
||||||
|
it's signature should be: func(data, current_length, total_length).
|
||||||
|
headers (dict): Any optional headers to send.
|
||||||
|
force_filename (bool): Force the filename specified rather than one the
|
||||||
|
server may suggest.
|
||||||
|
allow_compression (bool): Allows gzip & deflate decoding.
|
||||||
|
handle_redirects (bool): HTTP redirects handled automatically or not.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Deferred: The filename of the downloaded file.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
t.w.e.PageRedirect: If handle_redirects is False.
|
||||||
|
t.w.e.Error: For all other HTTP response errors.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def on_download_success(result):
|
||||||
|
log.debug('Download success!')
|
||||||
|
return result
|
||||||
|
|
||||||
|
def on_download_fail(failure):
|
||||||
|
log.warning(
|
||||||
|
'Error occurred downloading file from "%s": %s',
|
||||||
|
url,
|
||||||
|
failure.getErrorMessage(),
|
||||||
|
)
|
||||||
|
result = failure
|
||||||
|
return result
|
||||||
|
|
||||||
|
d = _download_file(
|
||||||
|
url,
|
||||||
|
filename,
|
||||||
|
callback=callback,
|
||||||
|
headers=headers,
|
||||||
|
force_filename=force_filename,
|
||||||
|
allow_compression=allow_compression,
|
||||||
|
handle_redirects=handle_redirects,
|
||||||
|
)
|
||||||
|
d.addCallbacks(on_download_success, on_download_fail)
|
||||||
|
return d
|
||||||
|
|||||||
15
deluge/i18n/__init__.py
Normal file
15
deluge/i18n/__init__.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from .util import (
|
||||||
|
I18N_DOMAIN,
|
||||||
|
get_languages,
|
||||||
|
set_language,
|
||||||
|
setup_mock_translation,
|
||||||
|
setup_translation,
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'I18N_DOMAIN',
|
||||||
|
'set_language',
|
||||||
|
'get_languages',
|
||||||
|
'setup_translation',
|
||||||
|
'setup_mock_translation',
|
||||||
|
]
|
||||||
6178
deluge/i18n/af.po
Normal file
6178
deluge/i18n/af.po
Normal file
File diff suppressed because it is too large
Load Diff
7788
deluge/i18n/ar.po
7788
deluge/i18n/ar.po
File diff suppressed because it is too large
Load Diff
8048
deluge/i18n/ast.po
8048
deluge/i18n/ast.po
File diff suppressed because it is too large
Load Diff
7272
deluge/i18n/be.po
7272
deluge/i18n/be.po
File diff suppressed because it is too large
Load Diff
8134
deluge/i18n/bg.po
8134
deluge/i18n/bg.po
File diff suppressed because it is too large
Load Diff
6763
deluge/i18n/bn.po
6763
deluge/i18n/bn.po
File diff suppressed because it is too large
Load Diff
6820
deluge/i18n/bs.po
6820
deluge/i18n/bs.po
File diff suppressed because it is too large
Load Diff
7930
deluge/i18n/ca.po
7930
deluge/i18n/ca.po
File diff suppressed because it is too large
Load Diff
8064
deluge/i18n/cs.po
8064
deluge/i18n/cs.po
File diff suppressed because it is too large
Load Diff
6812
deluge/i18n/cy.po
6812
deluge/i18n/cy.po
File diff suppressed because it is too large
Load Diff
8291
deluge/i18n/da.po
8291
deluge/i18n/da.po
File diff suppressed because it is too large
Load Diff
8177
deluge/i18n/de.po
8177
deluge/i18n/de.po
File diff suppressed because it is too large
Load Diff
8244
deluge/i18n/el.po
8244
deluge/i18n/el.po
File diff suppressed because it is too large
Load Diff
8240
deluge/i18n/en_AU.po
8240
deluge/i18n/en_AU.po
File diff suppressed because it is too large
Load Diff
8268
deluge/i18n/en_CA.po
8268
deluge/i18n/en_CA.po
File diff suppressed because it is too large
Load Diff
8326
deluge/i18n/en_GB.po
8326
deluge/i18n/en_GB.po
File diff suppressed because it is too large
Load Diff
6757
deluge/i18n/eo.po
6757
deluge/i18n/eo.po
File diff suppressed because it is too large
Load Diff
8237
deluge/i18n/es.po
8237
deluge/i18n/es.po
File diff suppressed because it is too large
Load Diff
8225
deluge/i18n/et.po
8225
deluge/i18n/et.po
File diff suppressed because it is too large
Load Diff
7470
deluge/i18n/eu.po
7470
deluge/i18n/eu.po
File diff suppressed because it is too large
Load Diff
6981
deluge/i18n/fa.po
6981
deluge/i18n/fa.po
File diff suppressed because it is too large
Load Diff
8211
deluge/i18n/fi.po
8211
deluge/i18n/fi.po
File diff suppressed because it is too large
Load Diff
6164
deluge/i18n/fo.po
Normal file
6164
deluge/i18n/fo.po
Normal file
File diff suppressed because it is too large
Load Diff
8451
deluge/i18n/fr.po
8451
deluge/i18n/fr.po
File diff suppressed because it is too large
Load Diff
7674
deluge/i18n/fy.po
7674
deluge/i18n/fy.po
File diff suppressed because it is too large
Load Diff
6164
deluge/i18n/ga.po
Normal file
6164
deluge/i18n/ga.po
Normal file
File diff suppressed because it is too large
Load Diff
7874
deluge/i18n/gl.po
7874
deluge/i18n/gl.po
File diff suppressed because it is too large
Load Diff
7963
deluge/i18n/he.po
7963
deluge/i18n/he.po
File diff suppressed because it is too large
Load Diff
7935
deluge/i18n/hi.po
7935
deluge/i18n/hi.po
File diff suppressed because it is too large
Load Diff
7699
deluge/i18n/hr.po
7699
deluge/i18n/hr.po
File diff suppressed because it is too large
Load Diff
8279
deluge/i18n/hu.po
8279
deluge/i18n/hu.po
File diff suppressed because it is too large
Load Diff
7078
deluge/i18n/id.po
7078
deluge/i18n/id.po
File diff suppressed because it is too large
Load Diff
8160
deluge/i18n/is.po
8160
deluge/i18n/is.po
File diff suppressed because it is too large
Load Diff
8249
deluge/i18n/it.po
8249
deluge/i18n/it.po
File diff suppressed because it is too large
Load Diff
6798
deluge/i18n/iu.po
6798
deluge/i18n/iu.po
File diff suppressed because it is too large
Load Diff
8009
deluge/i18n/ja.po
8009
deluge/i18n/ja.po
File diff suppressed because it is too large
Load Diff
7555
deluge/i18n/ka.po
7555
deluge/i18n/ka.po
File diff suppressed because it is too large
Load Diff
8077
deluge/i18n/kk.po
8077
deluge/i18n/kk.po
File diff suppressed because it is too large
Load Diff
6172
deluge/i18n/km.po
Normal file
6172
deluge/i18n/km.po
Normal file
File diff suppressed because it is too large
Load Diff
6962
deluge/i18n/kn.po
6962
deluge/i18n/kn.po
File diff suppressed because it is too large
Load Diff
8147
deluge/i18n/ko.po
8147
deluge/i18n/ko.po
File diff suppressed because it is too large
Load Diff
6774
deluge/i18n/ku.po
6774
deluge/i18n/ku.po
File diff suppressed because it is too large
Load Diff
6164
deluge/i18n/ky.po
Normal file
6164
deluge/i18n/ky.po
Normal file
File diff suppressed because it is too large
Load Diff
6755
deluge/i18n/la.po
6755
deluge/i18n/la.po
File diff suppressed because it is too large
Load Diff
114
deluge/i18n/languages.py
Normal file
114
deluge/i18n/languages.py
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
#
|
||||||
|
# This file is public domain.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Language code for this installation. All choices can be found here:
|
||||||
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
|
||||||
|
# Deferred translation
|
||||||
|
def _(message):
|
||||||
|
return message
|
||||||
|
|
||||||
|
|
||||||
|
# Languages we provide translations for, out of the box.
|
||||||
|
LANGUAGES = {
|
||||||
|
'af': _('Afrikaans'),
|
||||||
|
'ar': _('Arabic'),
|
||||||
|
'ast': _('Asturian'),
|
||||||
|
'az': _('Azerbaijani'),
|
||||||
|
'bg': _('Bulgarian'),
|
||||||
|
'be': _('Belarusian'),
|
||||||
|
'bn': _('Bengali'),
|
||||||
|
'br': _('Breton'),
|
||||||
|
'bs': _('Bosnian'),
|
||||||
|
'ca': _('Catalan'),
|
||||||
|
'cs': _('Czech'),
|
||||||
|
'cy': _('Welsh'),
|
||||||
|
'da': _('Danish'),
|
||||||
|
'de': _('German'),
|
||||||
|
'el': _('Greek'),
|
||||||
|
'en': _('English'),
|
||||||
|
'en_AU': _('English (Australia)'),
|
||||||
|
'en_CA': _('English (Canada)'),
|
||||||
|
'en_GB': _('English (United Kingdom)'),
|
||||||
|
'eo': _('Esperanto'),
|
||||||
|
'es': _('Spanish'),
|
||||||
|
'es-ar': _('Argentinian Spanish'),
|
||||||
|
'es-mx': _('Mexican Spanish'),
|
||||||
|
'es-ni': _('Nicaraguan Spanish'),
|
||||||
|
'es-ve': _('Venezuelan Spanish'),
|
||||||
|
'et': _('Estonian'),
|
||||||
|
'eu': _('Basque'),
|
||||||
|
'fa': _('Persian'),
|
||||||
|
'fi': _('Finnish'),
|
||||||
|
'fr': _('French'),
|
||||||
|
'fy': _('Frisian'),
|
||||||
|
'ga': _('Irish'),
|
||||||
|
'gl': _('Galician'),
|
||||||
|
'he': _('Hebrew'),
|
||||||
|
'hi': _('Hindi'),
|
||||||
|
'hr': _('Croatian'),
|
||||||
|
'hu': _('Hungarian'),
|
||||||
|
'ia': _('Interlingua'),
|
||||||
|
'id': _('Indonesian'),
|
||||||
|
'is': _('Icelandic'),
|
||||||
|
'it': _('Italian'),
|
||||||
|
'iu': _('Inuktitut'),
|
||||||
|
'ja': _('Japanese'),
|
||||||
|
'ka': _('Georgian'),
|
||||||
|
'kk': _('Kazakh'),
|
||||||
|
'km': _('Khmer'),
|
||||||
|
'kn': _('Kannada'),
|
||||||
|
'ko': _('Korean'),
|
||||||
|
'ku': _('Kurdish'),
|
||||||
|
'la': _('Latin'),
|
||||||
|
'lb': _('Luxembourgish'),
|
||||||
|
'lt': _('Lithuanian'),
|
||||||
|
'lv': _('Latvian'),
|
||||||
|
'mk': _('Macedonian'),
|
||||||
|
'ml': _('Malayalam'),
|
||||||
|
'mn': _('Mongolian'),
|
||||||
|
'ms': _('Mayaly'),
|
||||||
|
'my': _('Burmese'),
|
||||||
|
'nb': _('Norwegian Bokmal'),
|
||||||
|
'ne': _('Nepali'),
|
||||||
|
'nds': _('Low German'),
|
||||||
|
'nl': _('Dutch'),
|
||||||
|
'nn': _('Norwegian Nynorsk'),
|
||||||
|
'os': _('Ossetic'),
|
||||||
|
'pa': _('Punjabi'),
|
||||||
|
'pl': _('Polish'),
|
||||||
|
'pms': _('Piedmontese'),
|
||||||
|
'pt': _('Portuguese'),
|
||||||
|
'pt_BR': _('Brazilian Portuguese'),
|
||||||
|
'ro': _('Romanian'),
|
||||||
|
'ru': _('Russian'),
|
||||||
|
'sk': _('Slovak'),
|
||||||
|
'sl': _('Slovenian'),
|
||||||
|
'si': _('Sinhalese'),
|
||||||
|
'sq': _('Albanian'),
|
||||||
|
'sr': _('Serbian'),
|
||||||
|
'sr-latn': _('Serbian Latin'),
|
||||||
|
'sv': _('Swedish'),
|
||||||
|
'sw': _('Swahili'),
|
||||||
|
'ta': _('Tamil'),
|
||||||
|
'te': _('Telugu'),
|
||||||
|
'th': _('Thai'),
|
||||||
|
'tl': _('Tagalog'),
|
||||||
|
'tlh': _('Klingon'),
|
||||||
|
'tr': _('Turkish'),
|
||||||
|
'tt': _('Tatar'),
|
||||||
|
'udm': _('Udmurt'),
|
||||||
|
'uk': _('Ukrainian'),
|
||||||
|
'ur': _('Urdu'),
|
||||||
|
'vi': _('Vietnamese'),
|
||||||
|
'zh_CN': _('Chinese (Simplified)'),
|
||||||
|
'zh_HK': _('Chinese (Hong Kong)'),
|
||||||
|
'zh-hans': _('Simplified Chinese'),
|
||||||
|
'zh-hant': _('Traditional Chinese'),
|
||||||
|
'zh_TW': _('Chinese (Taiwan)'),
|
||||||
|
}
|
||||||
|
|
||||||
|
del _
|
||||||
6164
deluge/i18n/lb.po
Normal file
6164
deluge/i18n/lb.po
Normal file
File diff suppressed because it is too large
Load Diff
8222
deluge/i18n/lt.po
8222
deluge/i18n/lt.po
File diff suppressed because it is too large
Load Diff
8283
deluge/i18n/lv.po
8283
deluge/i18n/lv.po
File diff suppressed because it is too large
Load Diff
7457
deluge/i18n/mk.po
7457
deluge/i18n/mk.po
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user