mirror of
https://github.com/gogs/gogs.git
synced 2026-02-28 09:10:57 +01:00
Compare commits
669 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efb68a0a96 | ||
|
|
7027ac9308 | ||
|
|
b9560374cd | ||
|
|
a5926f2689 | ||
|
|
f1304bde34 | ||
|
|
3549fb0ea8 | ||
|
|
a2cac952a4 | ||
|
|
bba401a5dc | ||
|
|
1b7adf57e9 | ||
|
|
cfed11f092 | ||
|
|
f67c59135f | ||
|
|
fdc8c34258 | ||
|
|
18a80b291b | ||
|
|
52d15ddec8 | ||
|
|
2a3660dae3 | ||
|
|
09ca5d125a | ||
|
|
27cb01cd5f | ||
|
|
7fe61558f6 | ||
|
|
33659ed9a5 | ||
|
|
e004ec08e9 | ||
|
|
132590fab8 | ||
|
|
e21d8a7d35 | ||
|
|
d84d6dfdae | ||
|
|
b92384020c | ||
|
|
d89e630bc0 | ||
|
|
59a7c7c5a5 | ||
|
|
25d6ae69d1 | ||
|
|
f8977f4847 | ||
|
|
e79e4b1580 | ||
|
|
40bc130b19 | ||
|
|
0ddb1eb769 | ||
|
|
ab7206d6b7 | ||
|
|
f7be61c819 | ||
|
|
85c35a6b8b | ||
|
|
7269b06fd5 | ||
|
|
8d2fe064c5 | ||
|
|
6498fce04b | ||
|
|
033a7f0224 | ||
|
|
31d8011843 | ||
|
|
d8290c9bac | ||
|
|
bdfdf3cacb | ||
|
|
8db8771be7 | ||
|
|
9fc4ded369 | ||
|
|
881ee6a4df | ||
|
|
aee46bac01 | ||
|
|
714de0a3af | ||
|
|
863a4d5bc4 | ||
|
|
f36f9e07b7 | ||
|
|
7df0794e14 | ||
|
|
000b906259 | ||
|
|
87b442433c | ||
|
|
097f1b5759 | ||
|
|
dcb10a41d4 | ||
|
|
2a7a03e5b3 | ||
|
|
05a33107c9 | ||
|
|
8b0e815d98 | ||
|
|
f19fc230d4 | ||
|
|
9476e58de9 | ||
|
|
9ddd545473 | ||
|
|
0730ec4087 | ||
|
|
8826186c30 | ||
|
|
565974f8f7 | ||
|
|
399887cc0e | ||
|
|
fd5ea4b79e | ||
|
|
830efc90da | ||
|
|
8e0aeb4ad5 | ||
|
|
c80f0232f1 | ||
|
|
1240fef0ca | ||
|
|
85f375433d | ||
|
|
af0741da07 | ||
|
|
00a864e693 | ||
|
|
d55c5b9e28 | ||
|
|
bc67c34bea | ||
|
|
d1a2228f1c | ||
|
|
7b310b1abb | ||
|
|
2886eb76b6 | ||
|
|
1858d2066b | ||
|
|
3e740278bd | ||
|
|
9611f29966 | ||
|
|
c5ce33047e | ||
|
|
da8dba53a7 | ||
|
|
bf5595f9a0 | ||
|
|
1ed67798ac | ||
|
|
36661f53e6 | ||
|
|
801fc536f2 | ||
|
|
99e009665c | ||
|
|
72ec3e8da0 | ||
|
|
2bce24068d | ||
|
|
9554ad514e | ||
|
|
df3621e050 | ||
|
|
5e6091a30a | ||
|
|
80447f1168 | ||
|
|
bc1a578914 | ||
|
|
cc9a84b83a | ||
|
|
c30063eefb | ||
|
|
ae2f4866d0 | ||
|
|
676bd764fa | ||
|
|
1bbf4c9768 | ||
|
|
7e36bf448d | ||
|
|
d78008b546 | ||
|
|
1d6df04ecb | ||
|
|
084dce53ac | ||
|
|
5cdecd74c7 | ||
|
|
85e01bfe01 | ||
|
|
73ddf401ee | ||
|
|
4c8ef90157 | ||
|
|
69e332f432 | ||
|
|
9bc63bda7d | ||
|
|
66d51804c9 | ||
|
|
444032664b | ||
|
|
272d387c0c | ||
|
|
32760ba49d | ||
|
|
08dbf08d39 | ||
|
|
d2aff9a46a | ||
|
|
56b735f67b | ||
|
|
904bf1a50b | ||
|
|
8829174574 | ||
|
|
6558990e3a | ||
|
|
a6ec6def8d | ||
|
|
c40e815763 | ||
|
|
c4a33892d3 | ||
|
|
1aec1a2dda | ||
|
|
81287ba022 | ||
|
|
9baf2b38d0 | ||
|
|
50de06056b | ||
|
|
74b31566cf | ||
|
|
66c9c86219 | ||
|
|
ce55807542 | ||
|
|
510d5a5d74 | ||
|
|
cd0ddcfa01 | ||
|
|
3d79f59671 | ||
|
|
b40922f4d4 | ||
|
|
12639c577f | ||
|
|
95a594d75a | ||
|
|
f2c263c54f | ||
|
|
21a1b8e5a3 | ||
|
|
03c6a395aa | ||
|
|
1661421a65 | ||
|
|
e325c8499a | ||
|
|
97a373f5e7 | ||
|
|
b765229a6d | ||
|
|
e0a2d23baf | ||
|
|
fa60502a70 | ||
|
|
97fb62f51e | ||
|
|
a60edbe88c | ||
|
|
bba707de36 | ||
|
|
78add502d7 | ||
|
|
36b4c57ff1 | ||
|
|
3e32b14ad4 | ||
|
|
202a29a475 | ||
|
|
352d8943e4 | ||
|
|
ccc20f7c70 | ||
|
|
5fbf27bb07 | ||
|
|
d0dd90958a | ||
|
|
ba8b6f5d78 | ||
|
|
872cd0d3bd | ||
|
|
5acc948562 | ||
|
|
2935ee440c | ||
|
|
371372d65d | ||
|
|
5fbf8531e6 | ||
|
|
7af7584d25 | ||
|
|
5605af973b | ||
|
|
78defd238c | ||
|
|
08c6d07aad | ||
|
|
9a1d5d2489 | ||
|
|
9820b8e134 | ||
|
|
7c7014262b | ||
|
|
57f6ec672a | ||
|
|
9d5c0c80a4 | ||
|
|
e527c9b330 | ||
|
|
e8c9bb2c66 | ||
|
|
0bfbefc38a | ||
|
|
51abaf788c | ||
|
|
be7ce72ebe | ||
|
|
99eeb08419 | ||
|
|
a8e05fdf1b | ||
|
|
6fc2107529 | ||
|
|
fa0a389dc4 | ||
|
|
6f6fda1481 | ||
|
|
5f84e8f4ff | ||
|
|
2cb754b5af | ||
|
|
8023494a94 | ||
|
|
755eec745f | ||
|
|
669552e255 | ||
|
|
17d2675dd2 | ||
|
|
b95e78f7e6 | ||
|
|
568c9b353e | ||
|
|
dabf5b057c | ||
|
|
7bbf644dd5 | ||
|
|
3428baa3b5 | ||
|
|
78672b9227 | ||
|
|
8453ffb7ed | ||
|
|
645c194a00 | ||
|
|
d4cbbc864a | ||
|
|
b1185e121f | ||
|
|
febaddfd1d | ||
|
|
9813161411 | ||
|
|
5e81383413 | ||
|
|
02a81ddb62 | ||
|
|
27a51f5bcc | ||
|
|
91480f3791 | ||
|
|
7de3dd01de | ||
|
|
35c75f06a0 | ||
|
|
545d320648 | ||
|
|
5c4bc3c848 | ||
|
|
3f38ff6c09 | ||
|
|
8dd07c0ddd | ||
|
|
76f7ad45e6 | ||
|
|
872590d8b5 | ||
|
|
7921e60f30 | ||
|
|
0db84e4f63 | ||
|
|
0a739cf9ac | ||
|
|
3e23241f58 | ||
|
|
6407caa761 | ||
|
|
ef8eef7519 | ||
|
|
71cefc95ab | ||
|
|
957361d755 | ||
|
|
cd369b667f | ||
|
|
ef430ae7ab | ||
|
|
a447aecd95 | ||
|
|
aea2b54c99 | ||
|
|
cf3021ecca | ||
|
|
c084a5ba73 | ||
|
|
5ed5912ef5 | ||
|
|
09cb8c67cb | ||
|
|
a03a1e87e9 | ||
|
|
aad91d4b21 | ||
|
|
f0da8a68c2 | ||
|
|
12fb42de5a | ||
|
|
4e2477a1a5 | ||
|
|
f7617997ce | ||
|
|
204ef41b09 | ||
|
|
dedb156d4a | ||
|
|
30d7397f97 | ||
|
|
0f3414ec39 | ||
|
|
2032080d86 | ||
|
|
8ccde45c5f | ||
|
|
eafa365453 | ||
|
|
ad7beb78d0 | ||
|
|
835e85b5ce | ||
|
|
c4eeb803e1 | ||
|
|
3e7e9ee289 | ||
|
|
87855d42a0 | ||
|
|
620c0ef297 | ||
|
|
cbcd08aa17 | ||
|
|
c20f5dc2ea | ||
|
|
a41a1fe60d | ||
|
|
da0240aacd | ||
|
|
9a7349ce64 | ||
|
|
4d702eb345 | ||
|
|
9df99681fb | ||
|
|
bfe5b86004 | ||
|
|
3db84c8893 | ||
|
|
70b0023b82 | ||
|
|
43e5de7f83 | ||
|
|
fa1db64ff0 | ||
|
|
ef1cbcd761 | ||
|
|
1129f756c8 | ||
|
|
967856f36e | ||
|
|
a76a948a02 | ||
|
|
d43c5895bc | ||
|
|
3c025b3950 | ||
|
|
34304e6a0c | ||
|
|
4617bef895 | ||
|
|
c850c01007 | ||
|
|
469cbc8813 | ||
|
|
6e9f1c52b1 | ||
|
|
812f71e21b | ||
|
|
94b100ce43 | ||
|
|
40557a4f79 | ||
|
|
8e4debe99d | ||
|
|
dc2e140360 | ||
|
|
5bbd5be0ca | ||
|
|
0d06c7e5f2 | ||
|
|
636a78fed1 | ||
|
|
e194cf3291 | ||
|
|
ed73af6fa1 | ||
|
|
267870537d | ||
|
|
ccca60a5a1 | ||
|
|
ec26b78d3c | ||
|
|
18718afb36 | ||
|
|
0b4fcf1224 | ||
|
|
dcb252eff4 | ||
|
|
78103f1df3 | ||
|
|
536f65b8ad | ||
|
|
887ad1ec8b | ||
|
|
aab2dbc505 | ||
|
|
5a97cc69ed | ||
|
|
6418caf23a | ||
|
|
9a3e1790a1 | ||
|
|
3969d704a0 | ||
|
|
0f907301b7 | ||
|
|
590f9e599c | ||
|
|
63e47405b2 | ||
|
|
c127d84777 | ||
|
|
63cc14062a | ||
|
|
7ffdabb28f | ||
|
|
9b014d05e4 | ||
|
|
097c8e05e6 | ||
|
|
21088a40f5 | ||
|
|
10f932b952 | ||
|
|
fd5412ec47 | ||
|
|
baa255e899 | ||
|
|
3c6da63216 | ||
|
|
aed4271c8d | ||
|
|
be8ac7fb75 | ||
|
|
7f3015b32b | ||
|
|
13b032f829 | ||
|
|
ae7f3eed78 | ||
|
|
a481672c5c | ||
|
|
0820b24f0b | ||
|
|
36292060d6 | ||
|
|
cdffdeddc9 | ||
|
|
465dc962b5 | ||
|
|
3f42cb7c23 | ||
|
|
3ad20773a2 | ||
|
|
e57aebb316 | ||
|
|
269da8fe7a | ||
|
|
e4ea5cf598 | ||
|
|
be123588ce | ||
|
|
99713e1180 | ||
|
|
5dbfe3c26c | ||
|
|
1c46d68aba | ||
|
|
4ce2fa520a | ||
|
|
a357cda957 | ||
|
|
54e17c7cca | ||
|
|
86e2627175 | ||
|
|
e5ae41e21f | ||
|
|
6e448b0714 | ||
|
|
ee9b7f322f | ||
|
|
57ac15aa20 | ||
|
|
7dbeee94e3 | ||
|
|
1d55ecd29c | ||
|
|
b5ba2bd268 | ||
|
|
19e9104289 | ||
|
|
165e3e8f18 | ||
|
|
32b09681b2 | ||
|
|
8644c571db | ||
|
|
43b33440b5 | ||
|
|
72ba273cc9 | ||
|
|
4cf7a1fca5 | ||
|
|
80be060735 | ||
|
|
8e6c254c03 | ||
|
|
3624b2a7f1 | ||
|
|
e0f9c628c5 | ||
|
|
cc703ee663 | ||
|
|
b2801a2e98 | ||
|
|
ceb415df8a | ||
|
|
63770d93a1 | ||
|
|
9bdff5bd97 | ||
|
|
d5d04a66f3 | ||
|
|
29a40c97f3 | ||
|
|
98f614a58e | ||
|
|
47d29a1ee0 | ||
|
|
fb53cc4fa8 | ||
|
|
f393dc6520 | ||
|
|
ea507e20d4 | ||
|
|
314193029a | ||
|
|
9c82073091 | ||
|
|
9924e65ca1 | ||
|
|
adda10f4a4 | ||
|
|
514d7e1922 | ||
|
|
bf703ef617 | ||
|
|
c280415e0b | ||
|
|
9d2cef23f2 | ||
|
|
ad5ec45dd6 | ||
|
|
8bfa7ae745 | ||
|
|
6c8d630bef | ||
|
|
f147ad619a | ||
|
|
8d3276cab0 | ||
|
|
d952b4200c | ||
|
|
e07674bff1 | ||
|
|
fb0972afad | ||
|
|
9961f9a53c | ||
|
|
1161c71ac1 | ||
|
|
c018b1a88d | ||
|
|
29561acb43 | ||
|
|
2da9908e29 | ||
|
|
a13a6b14ec | ||
|
|
a3e1383cac | ||
|
|
f160b4f33c | ||
|
|
1f58d6f5d9 | ||
|
|
a80d8d96fa | ||
|
|
302c863cda | ||
|
|
4fcbf553aa | ||
|
|
a0318db2f9 | ||
|
|
c6058e5ea8 | ||
|
|
4f2f3c2857 | ||
|
|
925ccc2608 | ||
|
|
11f9d738e8 | ||
|
|
63baf76ab2 | ||
|
|
9c3aa6936a | ||
|
|
32c5fa514c | ||
|
|
eaa7d71fc7 | ||
|
|
e1332c5239 | ||
|
|
afc6cbc479 | ||
|
|
1f059502dc | ||
|
|
01a516b584 | ||
|
|
48c98c92c8 | ||
|
|
6fe43eb8d4 | ||
|
|
2657f88d9a | ||
|
|
ddb7f55035 | ||
|
|
fbf274b751 | ||
|
|
422043f422 | ||
|
|
617bbe3fee | ||
|
|
9085dfa426 | ||
|
|
6696610aea | ||
|
|
e323604d78 | ||
|
|
4ee6bc4fca | ||
|
|
ab13a29cb5 | ||
|
|
ff690fd976 | ||
|
|
bcfa78b8b5 | ||
|
|
6227b59b1a | ||
|
|
e0a6e6dd1a | ||
|
|
bf5fcfb49c | ||
|
|
ff48aeddef | ||
|
|
d72fdc9900 | ||
|
|
5543a0b6dc | ||
|
|
2f820e01d8 | ||
|
|
688ec6ecbd | ||
|
|
87854c95a9 | ||
|
|
80055bde86 | ||
|
|
e33a104448 | ||
|
|
dce17c86ac | ||
|
|
b1bdbd7f94 | ||
|
|
50ba08e2c6 | ||
|
|
5e9a45f74a | ||
|
|
1331134316 | ||
|
|
4e8a1bf9c9 | ||
|
|
c82807a713 | ||
|
|
342baf1dda | ||
|
|
fdc6b64f15 | ||
|
|
02fb088b80 | ||
|
|
5660570d92 | ||
|
|
93f8f92523 | ||
|
|
a4c3ab48a5 | ||
|
|
7fd22bea1e | ||
|
|
04890904f9 | ||
|
|
a0a95d797e | ||
|
|
956f011dd3 | ||
|
|
16e162b669 | ||
|
|
61641d9c63 | ||
|
|
44f1ef2493 | ||
|
|
be82716b66 | ||
|
|
57ad8d50b7 | ||
|
|
f6c94c29d5 | ||
|
|
4744996f9a | ||
|
|
db6b71ad03 | ||
|
|
f4486f3eec | ||
|
|
4f042d12bd | ||
|
|
7869cfccb9 | ||
|
|
eb264a112b | ||
|
|
839a9bb054 | ||
|
|
9d5e827a1e | ||
|
|
b70db61854 | ||
|
|
16bddd593a | ||
|
|
e880a2fa48 | ||
|
|
46fc36c3a6 | ||
|
|
a1bb3741d5 | ||
|
|
99f2400e3b | ||
|
|
4a4392192b | ||
|
|
e8dd480f10 | ||
|
|
9100786beb | ||
|
|
b0084b1adc | ||
|
|
5ed5aa5228 | ||
|
|
33ec0632ff | ||
|
|
f276b37bbb | ||
|
|
cca2a53d6f | ||
|
|
5d5c4535cb | ||
|
|
2eee1e9bc2 | ||
|
|
98dbbae2ef | ||
|
|
c117f9e73f | ||
|
|
f979d0d6b9 | ||
|
|
a913aff1d0 | ||
|
|
54e95fa367 | ||
|
|
f1130ce5e9 | ||
|
|
f5b2e5f836 | ||
|
|
1769bb2f26 | ||
|
|
83a10ce880 | ||
|
|
7ec3f1b2d8 | ||
|
|
3fe87cba85 | ||
|
|
ca0b6dfa38 | ||
|
|
1482bd8fb4 | ||
|
|
0970d6cc38 | ||
|
|
98eeec4cbb | ||
|
|
68fb62347f | ||
|
|
a196245a87 | ||
|
|
605a38759f | ||
|
|
fd4b123e88 | ||
|
|
d122aa6d88 | ||
|
|
2c73ced0db | ||
|
|
fd7b0a2ba4 | ||
|
|
27f9b7a144 | ||
|
|
f68e279150 | ||
|
|
70398ed01a | ||
|
|
d2231bb54c | ||
|
|
65e628d1f4 | ||
|
|
c5dbc24ca4 | ||
|
|
bf58679390 | ||
|
|
cdc87623dc | ||
|
|
b33f255c40 | ||
|
|
26c0113ea0 | ||
|
|
55019bfbc5 | ||
|
|
4d6de6c7b9 | ||
|
|
7d84cc96e8 | ||
|
|
2eabeba6b7 | ||
|
|
045c21de4f | ||
|
|
4ef9494637 | ||
|
|
43ffacd05b | ||
|
|
501f70e248 | ||
|
|
09dba7d63e | ||
|
|
3f4c040f3f | ||
|
|
830494a8aa | ||
|
|
25713ab209 | ||
|
|
914ffa496f | ||
|
|
a742ee543e | ||
|
|
e867283406 | ||
|
|
a03f380fa8 | ||
|
|
8eb15815f1 | ||
|
|
11ca10ab2f | ||
|
|
23a857d107 | ||
|
|
495d939ca5 | ||
|
|
7d89e765ab | ||
|
|
31fd45ba02 | ||
|
|
abd8c2a7ca | ||
|
|
e05b1385fb | ||
|
|
8b6766ecbe | ||
|
|
269281ab76 | ||
|
|
4b08d3aacf | ||
|
|
33d32585b1 | ||
|
|
6fb7229bea | ||
|
|
7407f9caf3 | ||
|
|
d76772adb9 | ||
|
|
8ca14e2109 | ||
|
|
7cb5a15c9b | ||
|
|
e573855a4f | ||
|
|
94bccbb148 | ||
|
|
24f614f6db | ||
|
|
cb505b22ec | ||
|
|
6e3dba2cc5 | ||
|
|
bbdfe25769 | ||
|
|
c1eb4d894a | ||
|
|
5f653898f3 | ||
|
|
d189b83ac1 | ||
|
|
d34c3bb751 | ||
|
|
3b7465f817 | ||
|
|
d8136c9c3c | ||
|
|
1652dd5068 | ||
|
|
02687cbdf3 | ||
|
|
07c3d497a7 | ||
|
|
816c0ed5e7 | ||
|
|
a641854cad | ||
|
|
bb0bc0a240 | ||
|
|
7b60756f2c | ||
|
|
163fcec59f | ||
|
|
79ea34e70e | ||
|
|
e10096ee2e | ||
|
|
a9e6d49dc6 | ||
|
|
3e856928a2 | ||
|
|
8bbaf9550a | ||
|
|
e7d8fadb08 | ||
|
|
3bd5fc6d6f | ||
|
|
cd2020429a | ||
|
|
ff9872104e | ||
|
|
a3f807106a | ||
|
|
100cd181bc | ||
|
|
03c2468c2f | ||
|
|
fa17989763 | ||
|
|
75109bbd65 | ||
|
|
6ce8fa49ea | ||
|
|
0a187dbef5 | ||
|
|
f6c4fbeb37 | ||
|
|
ad71775ae8 | ||
|
|
0dfb5560cd | ||
|
|
1c88a541cb | ||
|
|
a7584d16e4 | ||
|
|
480a4ae8c5 | ||
|
|
cc1eb5643e | ||
|
|
a2333d95d5 | ||
|
|
89c99167b2 | ||
|
|
d0ea4c7b68 | ||
|
|
2a1dc0085b | ||
|
|
46af92c57e | ||
|
|
52fbb9788a | ||
|
|
00ebb5019f | ||
|
|
dc5546633f | ||
|
|
eb463000a9 | ||
|
|
49dc57e336 | ||
|
|
de46c06d2e | ||
|
|
b36448a537 | ||
|
|
48bfbb7ddf | ||
|
|
1e9f376d3d | ||
|
|
a85f242030 | ||
|
|
cdc843f06b | ||
|
|
0d6856dbe7 | ||
|
|
494e5fd40c | ||
|
|
2401e68d7e | ||
|
|
31805e2bbe | ||
|
|
6700257558 | ||
|
|
41b0a7b97c | ||
|
|
62240b6bc1 | ||
|
|
ce05a8d7b6 | ||
|
|
62d23e9154 | ||
|
|
9fdf4bc277 | ||
|
|
8a8f84d245 | ||
|
|
59d0e73c35 | ||
|
|
1badb2bbcc | ||
|
|
89b68bdd45 | ||
|
|
597387ad40 | ||
|
|
cfa0968191 | ||
|
|
9dfb7de371 | ||
|
|
1b734501bd | ||
|
|
861a20f464 | ||
|
|
8bab21d795 | ||
|
|
0da329462e | ||
|
|
3684e70dc4 | ||
|
|
83578cff65 | ||
|
|
3f2f648035 | ||
|
|
d0f887a1ed | ||
|
|
35a86d04c0 | ||
|
|
37cbfc032a | ||
|
|
5898d56205 | ||
|
|
cf7901fe6a | ||
|
|
e5af34a078 | ||
|
|
51550e5b2e | ||
|
|
eb4691cb2f | ||
|
|
912481019f | ||
|
|
184f1ae135 | ||
|
|
efc05ea1de | ||
|
|
521c5f0e10 | ||
|
|
32ae6896fa | ||
|
|
4b58c01603 | ||
|
|
ff690840d4 | ||
|
|
0c5e50a888 | ||
|
|
7ded30ba5b | ||
|
|
683e58878a | ||
|
|
649d0e1681 | ||
|
|
d7956b3fb8 | ||
|
|
2a95bc1395 | ||
|
|
e554e49c16 | ||
|
|
9abb37b45e | ||
|
|
22f8536577 | ||
|
|
8952eb1ce0 | ||
|
|
ee7bfe2ebe | ||
|
|
b270b34c98 | ||
|
|
b01e967a9f | ||
|
|
baacba96ca | ||
|
|
8bc502a1ea | ||
|
|
e5aaf23bb2 | ||
|
|
a90a014033 | ||
|
|
88072a1e9b | ||
|
|
f0cdf30134 | ||
|
|
22bb5104c8 | ||
|
|
1560abe553 | ||
|
|
65ad26feba | ||
|
|
b60d5ecc3e | ||
|
|
8a6119551b | ||
|
|
4b8d72dec2 | ||
|
|
5435b259cc | ||
|
|
dbdaf934e1 | ||
|
|
d6ff275c58 | ||
|
|
b32407456a | ||
|
|
2a9da4b8e5 | ||
|
|
9a5e49cccb | ||
|
|
338fc122fa | ||
|
|
34d18a19a3 | ||
|
|
066d91e113 | ||
|
|
bb84bb8ac3 | ||
|
|
213b366959 |
17
.bra.toml
Normal file
17
.bra.toml
Normal file
@@ -0,0 +1,17 @@
|
||||
[run]
|
||||
init_cmds = [["./gogs", "web"]]
|
||||
watch_all = true
|
||||
watch_dirs = [
|
||||
"$WORKDIR/conf/locale",
|
||||
"$WORKDIR/cmd",
|
||||
"$WORKDIR/models",
|
||||
"$WORKDIR/modules",
|
||||
"$WORKDIR/routers"
|
||||
]
|
||||
watch_exts = [".go", ".ini"]
|
||||
build_delay = 1500
|
||||
cmds = [
|
||||
["go", "install"],
|
||||
["go", "build"],
|
||||
["./gogs", "web"]
|
||||
]
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -7,6 +7,7 @@ data/
|
||||
.idea/
|
||||
*.iml
|
||||
public/img/avatar/
|
||||
files/
|
||||
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
@@ -31,6 +32,10 @@ _testmain.go
|
||||
|
||||
*.exe
|
||||
*.exe~
|
||||
gogs
|
||||
/gogs
|
||||
profile/
|
||||
__pycache__
|
||||
*.pem
|
||||
output*
|
||||
config.codekit
|
||||
.brackets.json
|
||||
|
||||
10
.gobuild.yml
10
.gobuild.yml
@@ -1,10 +1,12 @@
|
||||
filesets:
|
||||
includes:
|
||||
- templates
|
||||
- public
|
||||
- conf
|
||||
- etc
|
||||
- public
|
||||
- scripts
|
||||
- templates
|
||||
- LICENSE
|
||||
- README.md
|
||||
- README_ZH.md
|
||||
- start.bat
|
||||
- start.sh
|
||||
excludes:
|
||||
- \.git
|
||||
|
||||
42
.gopmfile
42
.gopmfile
@@ -2,24 +2,30 @@
|
||||
path = github.com/gogits/gogs
|
||||
|
||||
[deps]
|
||||
github.com/Unknwon/cae =
|
||||
github.com/Unknwon/com =
|
||||
github.com/Unknwon/goconfig =
|
||||
github.com/codegangsta/cli =
|
||||
github.com/go-martini/martini =
|
||||
github.com/go-sql-driver/mysql =
|
||||
github.com/go-xorm/xorm =
|
||||
github.com/gogits/cache =
|
||||
github.com/gogits/gfm =
|
||||
github.com/gogits/git =
|
||||
github.com/gogits/logs =
|
||||
github.com/gogits/oauth2 =
|
||||
github.com/gogits/session =
|
||||
github.com/lib/pq =
|
||||
github.com/nfnt/resize =
|
||||
github.com/qiniu/log =
|
||||
github.com/robfig/cron =
|
||||
github.com/beego/memcache = commit:2aea774416
|
||||
github.com/beego/redigo = commit:856744a0d5
|
||||
github.com/Unknwon/cae = commit:2e70a1351b
|
||||
github.com/Unknwon/com = commit:2cbcbc6916
|
||||
github.com/Unknwon/goconfig = commit:0f8d8dc1c0
|
||||
github.com/Unknwon/i18n = commit:47baeff8d0
|
||||
github.com/Unknwon/macaron = commit:f22f45d79a
|
||||
github.com/codegangsta/cli = commit:7381bc4e62
|
||||
github.com/go-sql-driver/mysql = commit:8111ee3ec3
|
||||
github.com/go-xorm/core = commit:750aae0fa5
|
||||
github.com/go-xorm/xorm = commit:2d8b3135b1
|
||||
github.com/gogits/gfm = commit:40f747a9c0
|
||||
github.com/gogits/oauth2 = commit:99cbec870a
|
||||
github.com/lib/pq = commit:b021d0ef20
|
||||
github.com/macaron-contrib/cache = commit:204d8e5137
|
||||
github.com/macaron-contrib/captcha = commit:8f3f1ac0e3
|
||||
github.com/macaron-contrib/csrf = commit:cd84c01723
|
||||
github.com/macaron-contrib/i18n = commit:489cc194b5
|
||||
github.com/macaron-contrib/session = commit:80a88a1bba
|
||||
github.com/macaron-contrib/toolbox = commit:57127bcc89
|
||||
github.com/mattn/go-sqlite3 = commit:a80c27ba33
|
||||
github.com/nfnt/resize = commit:581d15cb53
|
||||
github.com/saintfish/chardet = commit:3af4cd4741
|
||||
|
||||
[res]
|
||||
include = templates|public|conf
|
||||
include = conf|etc|public|scripts|templates
|
||||
|
||||
|
||||
14
.pkgr.yml
Normal file
14
.pkgr.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
buildpack: "https://github.com/kr/heroku-buildpack-go.git"
|
||||
targets:
|
||||
ubuntu-14.04:
|
||||
build_dependencies:
|
||||
- mercurial
|
||||
- bzr
|
||||
dependencies:
|
||||
- git
|
||||
before:
|
||||
- mv packager/Procfile .
|
||||
- mv packager/.godir .
|
||||
after:
|
||||
- mv bin/main gogs
|
||||
after_install: ./packager/debian/postinst
|
||||
6
.travis.yml
Normal file
6
.travis.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.2
|
||||
- 1.3
|
||||
- tip
|
||||
@@ -1,14 +1,54 @@
|
||||
# Contributing to Gogs
|
||||
|
||||
> Thanks [drone](https://github.com/drone/drone) because this guidelines sheet is forked from its [CONTRIBUTING.md](https://github.com/drone/drone/blob/master/CONTRIBUTING.md).
|
||||
> This guidelines sheet is forked from [CONTRIBUTING.md](https://github.com/drone/drone/blob/master/CONTRIBUTING.md).
|
||||
|
||||
**This document is pre^2 release, we're not ready for receiving contribution until v0.5.0 release.**
|
||||
|
||||
Want to hack on Gogs? Awesome! Here are instructions to get you started. They are probably not perfect, please let us know if anything feels wrong or incomplete.
|
||||
Gogs is not perfect and it has bugs, or incomplete features for rare cases. You're welcome to tell us or contribute some code. This document describles details about how can you contribute to Gogs project.
|
||||
|
||||
## Contribution guidelines
|
||||
|
||||
### Pull requests are always welcome
|
||||
Depends on the situation, you will:
|
||||
|
||||
- Find bug, create an issue
|
||||
- Need more functionality, make a feature request
|
||||
- Want to contribute code, open a pull request
|
||||
- Run into issue, need help
|
||||
|
||||
### Bug Report
|
||||
|
||||
If you find or consider something is a bug, please create a issue on [GitHub](https://github.com/gogits/gogs/issues). To reduce unnecessary time wasting of interacting and waiting with team members, please use following form as template in the first place:
|
||||
|
||||
```
|
||||
- **Bug Description**:
|
||||
- **Gogs Version**:
|
||||
- **Git Version**:
|
||||
- **System Type**:
|
||||
- **Error Log**:
|
||||
- **Other information**:
|
||||
```
|
||||
|
||||
Please take a moment to check that an issue on [GitHub](https://github.com/gogits/gogs/issues) doesn't already exist documenting your bug report or improvement proposal. If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests.
|
||||
|
||||
#### Bug Report Example
|
||||
|
||||
- **Bug Description**: Crash when create repository with license|
|
||||
- **Gogs Version**: `v0.4.9.0901`
|
||||
- **Git Version**: `1.9.0`
|
||||
- **System Type**: `Ubuntu 12.04`
|
||||
- **Error Log**:
|
||||
|
||||
```
|
||||
2014/09/01 07:21:49 [E] nil pointer
|
||||
```
|
||||
|
||||
- **Other information**: Use SQLite3 as database
|
||||
|
||||
### Feature Request
|
||||
|
||||
There is no standard form of making a feature request, just try to describle the feature as clear as possible because team members may not have experience with the functionality you're talking about.
|
||||
|
||||
### Pull Request
|
||||
|
||||
Pull requests are always welcome, but note that **ALL PULL REQUESTS MUST SEND TO `DEV` BRANCH**.
|
||||
|
||||
We are always thrilled to receive pull requests, and do our best to process them as fast as possible. Not sure if that typo is worth a pull request? Do it! We will appreciate it.
|
||||
|
||||
@@ -16,16 +56,16 @@ If your pull request is not accepted on the first try, don't be discouraged! If
|
||||
|
||||
We're trying very hard to keep Gogs lean and focused. We don't want it to do everything for everybody. This means that we might decide against incorporating a new feature.
|
||||
|
||||
### Ask For Help
|
||||
|
||||
Before open any new issue, please check your problem on [Troubleshooting](http://gogs.io/docs/intro/troubleshooting.md) and [FAQs](http://gogs.io/docs/intro/faqs.html) pages.
|
||||
|
||||
## Things To Notice
|
||||
|
||||
Please take a moment to check that an issue on [GitHub](https://github.com/gogits/gogs/issues) or card on [Trello](https://trello.com/b/uxAoeLUl/gogs-go-git-service) doesn't already exist documenting your bug report or improvement proposal. If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests.
|
||||
|
||||
### Discuss your design on the mailing list
|
||||
|
||||
We recommend discussing your plans [on the mailing list](https://groups.google.com/forum/#!forum/gogits) before starting to code - especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give feedback on your design, and maybe point out if someone else is working on the same thing.
|
||||
|
||||
We may close your pull request if not first discussed on the mailing list. We aren't doing this to be jerks. We are doing this to prevent people from spending large amounts of time on changes that may need to be designed or architected in a specific way, or may not align with the vision of the project.
|
||||
|
||||
### Create issues...
|
||||
|
||||
Any significant improvement should be documented as [a GitHub issue](https://github.com/gogits/gogs/issues) before anybody starts working on it.
|
||||
|
||||
### ...but check for existing issues first!
|
||||
|
||||
Please take a moment to check that an issue doesn't already exist documenting your bug report or improvement proposal. If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests.
|
||||
We may close your pull request if not first discussed on the mailing list. We aren't doing this to be jerks. We are doing this to prevent people from spending large amounts of time on changes that may need to be designed or architected in a specific way, or may not align with the vision of the project.
|
||||
65
README.md
65
README.md
@@ -1,15 +1,15 @@
|
||||
Gogs - Go Git Service [](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [](https://drone.io/github.com/gogits/gogs/latest)
|
||||
=====================
|
||||
|
||||
Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language.
|
||||
Gogs(Go Git Service) is a painless self-hosted Git Service written in Go.
|
||||
|
||||

|
||||

|
||||
|
||||
##### Current version: 0.3.0 Alpha
|
||||
##### Current version: 0.5.0 Beta
|
||||
|
||||
### NOTICES
|
||||
|
||||
- Due to testing purpose, data of [try.gogits.org](http://try.gogits.org) has been reset in **April 14, 2014** and will reset multiple times after. Please do **NOT** put your important data on the site.
|
||||
- Due to testing purpose, data of [try.gogits.org](http://try.gogits.org) has been reset in **June 21, 2014** and will reset multiple times after. Please do **NOT** put your important data on the site.
|
||||
- Demo site [try.gogits.org](http://try.gogits.org) is running under `dev` branch.
|
||||
|
||||
#### Other language version
|
||||
@@ -18,39 +18,50 @@ Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language
|
||||
|
||||
## Purpose
|
||||
|
||||
Since we choose to use pure Go implementation of Git manipulation, Gogs certainly supports **ALL platforms** that Go supports, including Linux, Mac OS X, and Windows with **ZERO** dependency.
|
||||
|
||||
More importantly, Gogs only needs one binary to setup your own project hosting on the fly!
|
||||
The goal of this project is to make the easiest, fastest and most painless way to set up a self-hosted Git service. With Go, this can be done in independent binary distribution across **ALL platforms** that Go supports, including Linux, Mac OS X, and Windows.
|
||||
|
||||
## Overview
|
||||
|
||||
- Please see [Wiki](https://github.com/gogits/gogs/wiki) for project design, known issues, and change log.
|
||||
- Please see [Documentation](http://gogs.io/docs/intro/) for project design, known issues, and change log.
|
||||
- See [Trello Board](https://trello.com/b/uxAoeLUl/gogs-go-git-service) to follow the develop team.
|
||||
- Try it before anything? Do it [online](http://try.gogits.org/Unknown/gogs) or go down to **Installation -> Install from binary** section!
|
||||
- Having troubles? Get help from [Troubleshooting](https://github.com/gogits/gogs/wiki/Troubleshooting).
|
||||
- Having troubles? Get help from [Troubleshooting](http://gogs.io/docs/intro/troubleshooting.md).
|
||||
|
||||
## Features
|
||||
|
||||
- Activity timeline
|
||||
- SSH/HTTP(S) protocol support.
|
||||
- Register/delete/rename account.
|
||||
- Create/migrate/mirror/delete/watch/rename/transfer public/private repository.
|
||||
- Repository viewer/release/issue tracker.
|
||||
- Gravatar and cache support.
|
||||
- Mail service(register, issue).
|
||||
- Administration panel.
|
||||
- Supports MySQL, PostgreSQL and SQLite3.
|
||||
- SSH/HTTP(S) protocol support
|
||||
- SMTP/LDAP/reverse proxy authentication support
|
||||
- Register/delete/rename account
|
||||
- Create/manage/delete organization with team management
|
||||
- Create/migrate/mirror/delete/watch/rename/transfer public/private repository
|
||||
- Repository viewer/release/issue tracker
|
||||
- Repository and Organization level webhooks
|
||||
- Add/remove repository collaborators
|
||||
- Gravatar and cache support
|
||||
- Mail service(register, issue)
|
||||
- Administration panel
|
||||
- Slack webhook integration
|
||||
- Supports MySQL, PostgreSQL and SQLite3
|
||||
- Social account login(GitHub, Google, QQ, Weibo)
|
||||
- Multi-language support(English, Chinese, Germany etc.)
|
||||
|
||||
## System Requirements
|
||||
|
||||
- A cheap Raspberry Pi is powerful enough to match the minimal requirement.
|
||||
- 4 CPU Cores and 1GB RAM would be the baseline for teamwork.
|
||||
|
||||
## Installation
|
||||
|
||||
Make sure you install [Prerequirements](https://github.com/gogits/gogs/wiki/Prerequirements) first.
|
||||
Make sure you install [Prerequirements](http://gogs.io/docs/installation/) first.
|
||||
|
||||
There are 3 ways to install Gogs:
|
||||
There are 5 ways to install Gogs:
|
||||
|
||||
- [Install from binary](https://github.com/gogits/gogs/wiki/Install-from-binary): **STRONGLY RECOMMENDED**
|
||||
- [Install from source](https://github.com/gogits/gogs/wiki/Install-from-source)
|
||||
- [Ship with Docker](https://github.com/gogits/gogs/tree/master/dockerfiles)
|
||||
- [Install from binary](http://gogs.io/docs/installation/install_from_binary.md): **STRONGLY RECOMMENDED**
|
||||
- [Install from source](http://gogs.io/docs/installation/install_from_source.md)
|
||||
- [Install from packages](http://gogs.io/docs/installation/install_from_packages.md)
|
||||
- [Ship with Docker](https://github.com/gogits/gogs/tree/master/docker)
|
||||
- [Install with Vagrant](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
@@ -58,17 +69,13 @@ There are 3 ways to install Gogs:
|
||||
- Mail Service, modules design is inspired by [WeTalk](https://github.com/beego/wetalk).
|
||||
- System Monitor Status is inspired by [GoBlog](https://github.com/fuxiaohei/goblog).
|
||||
- Usage and modification from [beego](http://beego.me) modules.
|
||||
- Thanks [lavachen](http://www.lavachen.cn/) for designing Logo.
|
||||
- Thanks [lavachen](http://www.lavachen.cn/) and [Rocker](http://weibo.com/rocker1989) for designing Logo.
|
||||
- Thanks [gobuild.io](http://gobuild.io) for providing binary compile and download service.
|
||||
- Great thanks to [Docker China](http://www.dockboard.org/) for providing [dockerfiles](https://github.com/gogits/gogs/tree/master/dockerfiles).
|
||||
|
||||
## Contributors
|
||||
|
||||
This project was launched by [Unknown](https://github.com/Unknwon) and [lunny](https://github.com/lunny); [fuxiaohei](https://github.com/fuxiaohei), [slene](https://github.com/slene) and [codeskyblue](https://github.com/codeskyblue) joined the team soon after. See [contributors page](https://github.com/gogits/gogs/graphs/contributors) for full list of contributors.
|
||||
|
||||
[][koding]
|
||||
[koding]: https://koding.com/Teamwork?import=https://github.com/gogits/gogs/archive/master.zip&c=git1
|
||||
The [core team](http://gogs.io/team) of this project. See [contributors page](https://github.com/gogits/gogs/graphs/contributors) for full list of contributors.
|
||||
|
||||
## License
|
||||
|
||||
Gogs is under the MIT License. See the [LICENSE](https://github.com/gogits/gogs/blob/master/LICENSE) file for the full license text.
|
||||
This project is under the MIT License. See the [LICENSE](https://github.com/gogits/gogs/blob/master/LICENSE) file for the full license text.
|
||||
|
||||
53
README_ZH.md
53
README_ZH.md
@@ -1,47 +1,58 @@
|
||||
Gogs - Go Git Service [](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [](https://drone.io/github.com/gogits/gogs/latest)
|
||||
=====================
|
||||
|
||||
Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。
|
||||
Gogs(Go Git Service) 是一个基于 Go 语言的自助 Git 服务。
|
||||
|
||||

|
||||

|
||||
|
||||
##### 当前版本:0.3.0 Alpha
|
||||
##### 当前版本:0.5.0 Beta
|
||||
|
||||
## 开发目的
|
||||
|
||||
Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依赖,并且支持 Go 语言所支持的 **所有平台**,包括 Linux、Mac OS X 以及 Windows。
|
||||
|
||||
更重要的是,您只需要一个可执行文件就能借助 Gogs 快速搭建属于您自己的代码托管服务!
|
||||
Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自助 Git 服务。使用 Go 语言开发使得 Gogs 能够通过独立的二进制分发,并且支持 Go 语言支持的 **所有平台**,包括 Linux、Mac OS X 以及 Windows。
|
||||
|
||||
## 项目概览
|
||||
|
||||
- 有关项目设计、已知问题和变更日志,请通过 [Wiki](https://github.com/gogits/gogs/wiki) 查看。
|
||||
- 有关项目设计、已知问题和变更日志,请通过 [使用手册](http://gogs.io/docs/intro/) 查看。
|
||||
- 您可以到 [Trello Board](https://trello.com/b/uxAoeLUl/gogs-go-git-service) 跟随开发团队的脚步。
|
||||
- 想要先睹为快?通过 [在线体验](http://try.gogits.org/Unknown/gogs) 或查看 **安装部署 -> 二进制安装** 小节。
|
||||
- 使用过程中遇到问题?尝试从 [故障排查](https://github.com/gogits/gogs/wiki/Troubleshooting) 页面获取帮助。
|
||||
- 使用过程中遇到问题?尝试从 [故障排查](http://gogs.io/docs/intro/troubleshooting.md) 页面获取帮助。
|
||||
|
||||
## 功能特性
|
||||
|
||||
- 活动时间线
|
||||
- SSH/HTTP(S) 协议支持
|
||||
- 注册/删除/重命名用户
|
||||
- 支持 SSH/HTTP(S) 协议
|
||||
- 支持 SMTP/LDAP/反向代理 用户认证
|
||||
- 注册/删除/重命名 用户
|
||||
- 创建/管理/删除 组织以及团队管理功能
|
||||
- 创建/迁移/镜像/删除/关注/重命名/转移 公开/私有 仓库
|
||||
- 仓库 浏览器/发布/缺陷追踪
|
||||
- 仓库 浏览/发布/工单管理
|
||||
- 仓库和组织级别 Web 钩子
|
||||
- 添加/删除 仓库协作者
|
||||
- Gravatar 以及缓存支持
|
||||
- 邮件服务(注册、Issue)
|
||||
- 管理员面板
|
||||
- Slack Web 钩子集成
|
||||
- 支持 MySQL、PostgreSQL 以及 SQLite3 数据库
|
||||
- 社交帐号登录(GitHub、Google、QQ、微博)
|
||||
- 多语言支持(英文、简体中文、德语等等)
|
||||
|
||||
## 系统要求
|
||||
|
||||
- 最低的系统硬件要求为一个廉价的树莓派
|
||||
- 如果用于团队项目,建议使用 4 核 CPU 及 1GB 内存
|
||||
|
||||
## 安装部署
|
||||
|
||||
在安装 Gogs 之前,您需要先安装 [基本环境](https://github.com/gogits/gogs/wiki/Prerequirements)。
|
||||
在安装 Gogs 之前,您需要先安装 [基本环境](http://gogs.io/docs/installation/)。
|
||||
|
||||
然后,您可以通过以下 3 种方式来安装 Gogs:
|
||||
然后,您可以通过以下 5 种方式来安装 Gogs:
|
||||
|
||||
- [二进制安装](https://github.com/gogits/gogs/wiki/Install-from-binary): **强烈推荐**
|
||||
- [源码安装](https://github.com/gogits/gogs/wiki/Install-from-source)
|
||||
- [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/dockerfiles)
|
||||
- [二进制安装](http://gogs.io/docs/installation/install_from_binary.md): **强烈推荐**
|
||||
- [源码安装](http://gogs.io/docs/installation/install_from_source.md)
|
||||
- [包管理安装](http://gogs.io/docs/installation/install_from_packages.md)
|
||||
- [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/docker)
|
||||
- [通过 Vagrant 安装](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
|
||||
|
||||
## 特别鸣谢
|
||||
|
||||
@@ -50,16 +61,12 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
|
||||
- [beego](http://beego.me) 模块的使用与修改。
|
||||
- [martini](http://martini.codegangsta.io/) 的路由与中间件机制。
|
||||
- 感谢 [gobuild.io](http://gobuild.io) 提供二进制编译与下载服务。
|
||||
- 感谢 [lavachen](http://www.lavachen.cn/) 设计的 Logo。
|
||||
- 感谢 [Docker 中文社区](http://www.dockboard.org/) 提供的 [dockerfiles](https://github.com/gogits/gogs/tree/master/dockerfiles)。
|
||||
- 感谢 [lavachen](http://www.lavachen.cn/) 和 [Rocker](http://weibo.com/rocker1989) 设计的 Logo。
|
||||
|
||||
## 贡献成员
|
||||
|
||||
本项目最初由 [Unknown](https://github.com/Unknwon) 和 [lunny](https://github.com/lunny) 发起,随后 [fuxiaohei](https://github.com/fuxiaohei)、[slene](https://github.com/slene) 以及 [codeskyblue](https://github.com/codeskyblue) 加入到开发团队。您可以通过查看 [贡献者页面](https://github.com/gogits/gogs/graphs/contributors) 获取完整的贡献者列表。
|
||||
|
||||
[][koding]
|
||||
[koding]: https://koding.com/Teamwork?import=https://github.com/gogits/gogs/archive/master.zip&c=git1
|
||||
本项目的 [开发团队](http://gogs.io/team)。您可以通过查看 [贡献者页面](https://github.com/gogits/gogs/graphs/contributors) 获取完整的贡献者列表。
|
||||
|
||||
## 授权许可
|
||||
|
||||
Gogs 采用 MIT 开源授权许可证,完整的授权说明已放置在 [LICENSE](https://github.com/gogits/gogs/blob/master/LICENSE) 文件中。
|
||||
本项目采用 MIT 开源授权许可证,完整的授权说明已放置在 [LICENSE](https://github.com/gogits/gogs/blob/master/LICENSE) 文件中。
|
||||
24
bee.json
24
bee.json
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"version": 0,
|
||||
"gopm": {
|
||||
"enable": false,
|
||||
"install": false
|
||||
},
|
||||
"go_install": true,
|
||||
"watch_ext": [],
|
||||
"dir_structure": {
|
||||
"watch_all": true,
|
||||
"controllers": "routers",
|
||||
"models": "",
|
||||
"others": [
|
||||
"modules",
|
||||
"$GOPATH/src/github.com/gogits/logs",
|
||||
"$GOPATH/src/github.com/gogits/git",
|
||||
"$GOPATH/src/github.com/gogits/gfm"
|
||||
]
|
||||
},
|
||||
"cmd_args": [
|
||||
"web"
|
||||
],
|
||||
"envs": []
|
||||
}
|
||||
69
cmd/dump.go
Normal file
69
cmd/dump.go
Normal file
@@ -0,0 +1,69 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/Unknwon/cae/zip"
|
||||
"github.com/codegangsta/cli"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
var CmdDump = cli.Command{
|
||||
Name: "dump",
|
||||
Usage: "Dump Gogs files and database",
|
||||
Description: `Dump compresses all related files and database into zip file.
|
||||
It can be used for backup and capture Gogs server image to send to maintainer`,
|
||||
Action: runDump,
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{"verbose, v", "show process details", ""},
|
||||
},
|
||||
}
|
||||
|
||||
func runDump(ctx *cli.Context) {
|
||||
setting.NewConfigContext()
|
||||
models.LoadModelsConfig()
|
||||
models.SetEngine()
|
||||
|
||||
log.Printf("Dumping local repositories...%s", setting.RepoRootPath)
|
||||
zip.Verbose = ctx.Bool("verbose")
|
||||
defer os.Remove("gogs-repo.zip")
|
||||
if err := zip.PackTo(setting.RepoRootPath, "gogs-repo.zip", true); err != nil {
|
||||
log.Fatalf("Fail to dump local repositories: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("Dumping database...")
|
||||
defer os.Remove("gogs-db.sql")
|
||||
if err := models.DumpDatabase("gogs-db.sql"); err != nil {
|
||||
log.Fatalf("Fail to dump database: %v", err)
|
||||
}
|
||||
|
||||
fileName := fmt.Sprintf("gogs-dump-%d.zip", time.Now().Unix())
|
||||
log.Printf("Packing dump files...")
|
||||
z, err := zip.Create(fileName)
|
||||
if err != nil {
|
||||
os.Remove(fileName)
|
||||
log.Fatalf("Fail to create %s: %v", fileName, err)
|
||||
}
|
||||
|
||||
workDir, _ := setting.WorkDir()
|
||||
z.AddFile("gogs-repo.zip", path.Join(workDir, "gogs-repo.zip"))
|
||||
z.AddFile("gogs-db.sql", path.Join(workDir, "gogs-db.sql"))
|
||||
z.AddFile("custom/conf/app.ini", path.Join(workDir, "custom/conf/app.ini"))
|
||||
z.AddDir("log", path.Join(workDir, "log"))
|
||||
if err = z.Close(); err != nil {
|
||||
os.Remove(fileName)
|
||||
log.Fatalf("Fail to save %s: %v", fileName, err)
|
||||
}
|
||||
|
||||
log.Println("Finish dumping!")
|
||||
}
|
||||
181
cmd/fix.go
Normal file
181
cmd/fix.go
Normal file
@@ -0,0 +1,181 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
var CmdFix = cli.Command{
|
||||
Name: "fix",
|
||||
Usage: "This command for upgrade from old version",
|
||||
Action: runFix,
|
||||
Subcommands: fixCommands,
|
||||
Flags: []cli.Flag{},
|
||||
}
|
||||
|
||||
func runFix(ctx *cli.Context) {
|
||||
}
|
||||
|
||||
var fixCommands = []cli.Command{
|
||||
{
|
||||
Name: "location",
|
||||
Usage: "Change Gogs app location",
|
||||
Description: `Command location fixes location change of Gogs
|
||||
|
||||
gogs fix location <old Gogs path>
|
||||
`,
|
||||
Action: runFixLocation,
|
||||
},
|
||||
}
|
||||
|
||||
// rewriteAuthorizedKeys replaces old Gogs path to the new one.
|
||||
func rewriteAuthorizedKeys(sshPath, oldPath, newPath string) error {
|
||||
fr, err := os.Open(sshPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fr.Close()
|
||||
|
||||
tmpPath := sshPath + ".tmp"
|
||||
fw, err := os.Create(tmpPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fw.Close()
|
||||
|
||||
oldPath = "command=\"" + oldPath + " serv"
|
||||
newPath = "command=\"" + newPath + " serv"
|
||||
buf := bufio.NewReader(fr)
|
||||
for {
|
||||
line, errRead := buf.ReadString('\n')
|
||||
line = strings.TrimSpace(line)
|
||||
|
||||
if errRead != nil {
|
||||
if errRead != io.EOF {
|
||||
return errRead
|
||||
}
|
||||
|
||||
// Reached end of file, if nothing to read then break,
|
||||
// otherwise handle the last line.
|
||||
if len(line) == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Still finding the line, copy the line that currently read.
|
||||
if _, err = fw.WriteString(strings.Replace(line, oldPath, newPath, 1) + "\n"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if errRead == io.EOF {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if err = os.Remove(sshPath); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Rename(tmpPath, sshPath)
|
||||
}
|
||||
|
||||
func rewriteUpdateHook(path, appPath string) error {
|
||||
if runtime.GOOS == "windows" {
|
||||
rp := strings.NewReplacer("\\", "/")
|
||||
appPath = "\"" + rp.Replace(appPath) + "\""
|
||||
} else {
|
||||
rp := strings.NewReplacer("\\", "/", " ", "\\ ")
|
||||
appPath = rp.Replace(appPath)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(path, []byte(fmt.Sprintf(models.TPL_UPDATE_HOOK,
|
||||
setting.ScriptType, appPath)), os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func walkDir(rootPath, recPath, appPath string, depth int) error {
|
||||
depth++
|
||||
if depth > 3 {
|
||||
return nil
|
||||
} else if depth == 3 {
|
||||
if err := rewriteUpdateHook(path.Join(rootPath, "hooks/update"), appPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
dir, err := os.Open(rootPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dir.Close()
|
||||
|
||||
fis, err := dir.Readdir(0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, fi := range fis {
|
||||
if strings.Contains(fi.Name(), ".DS_Store") {
|
||||
continue
|
||||
}
|
||||
|
||||
relPath := path.Join(recPath, fi.Name())
|
||||
curPath := path.Join(rootPath, fi.Name())
|
||||
if fi.IsDir() {
|
||||
if err = walkDir(curPath, relPath, appPath, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func runFixLocation(ctx *cli.Context) {
|
||||
if len(ctx.Args()) != 1 {
|
||||
fmt.Println("Incorrect arguments number, expect 1")
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
execPath, _ := setting.ExecPath()
|
||||
|
||||
oldPath := ctx.Args().First()
|
||||
fmt.Printf("Old location: %s\n", oldPath)
|
||||
fmt.Println("This command should be executed in the new Gogs path")
|
||||
fmt.Printf("Do you want to change Gogs app path from old location to:\n")
|
||||
fmt.Printf("-> %s?\n", execPath)
|
||||
fmt.Print("Press <enter> to continue, use <Ctrl+c> to exit.")
|
||||
fmt.Scanln()
|
||||
|
||||
// Fix in authorized_keys file.
|
||||
sshPath := path.Join(models.SshPath, "authorized_keys")
|
||||
fmt.Printf("Fixing pathes in file: %s\n", sshPath)
|
||||
if err := rewriteAuthorizedKeys(sshPath, oldPath, execPath); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Fix position in gogs-repositories.
|
||||
setting.NewConfigContext()
|
||||
fmt.Printf("Fixing pathes in repositories: %s\n", setting.RepoRootPath)
|
||||
if err := walkDir(setting.RepoRootPath, "", execPath, 0); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("Fix position finished!")
|
||||
}
|
||||
212
cmd/serve.go
Normal file
212
cmd/serve.go
Normal file
@@ -0,0 +1,212 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/codegangsta/cli"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
"github.com/gogits/gogs/modules/uuid"
|
||||
)
|
||||
|
||||
var CmdServ = cli.Command{
|
||||
Name: "serv",
|
||||
Usage: "This command should only be called by SSH shell",
|
||||
Description: `Serv provide access auth for repositories`,
|
||||
Action: runServ,
|
||||
Flags: []cli.Flag{},
|
||||
}
|
||||
|
||||
func setup(logPath string) {
|
||||
setting.NewConfigContext()
|
||||
log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath))
|
||||
models.LoadModelsConfig()
|
||||
|
||||
if models.UseSQLite3 {
|
||||
workDir, _ := setting.WorkDir()
|
||||
os.Chdir(workDir)
|
||||
}
|
||||
|
||||
models.SetEngine()
|
||||
}
|
||||
|
||||
func parseCmd(cmd string) (string, string) {
|
||||
ss := strings.SplitN(cmd, " ", 2)
|
||||
if len(ss) != 2 {
|
||||
return "", ""
|
||||
}
|
||||
|
||||
verb, args := ss[0], ss[1]
|
||||
if verb == "git" {
|
||||
ss = strings.SplitN(args, " ", 2)
|
||||
args = ss[1]
|
||||
verb = fmt.Sprintf("%s %s", verb, ss[0])
|
||||
}
|
||||
return verb, strings.Replace(args, "'/", "'", 1)
|
||||
}
|
||||
|
||||
var (
|
||||
COMMANDS_READONLY = map[string]models.AccessType{
|
||||
"git-upload-pack": models.WRITABLE,
|
||||
"git upload-pack": models.WRITABLE,
|
||||
"git-upload-archive": models.WRITABLE,
|
||||
}
|
||||
|
||||
COMMANDS_WRITE = map[string]models.AccessType{
|
||||
"git-receive-pack": models.READABLE,
|
||||
"git receive-pack": models.READABLE,
|
||||
}
|
||||
)
|
||||
|
||||
func In(b string, sl map[string]models.AccessType) bool {
|
||||
_, e := sl[b]
|
||||
return e
|
||||
}
|
||||
|
||||
func runServ(k *cli.Context) {
|
||||
setup("serv.log")
|
||||
|
||||
keys := strings.Split(os.Args[2], "-")
|
||||
if len(keys) != 2 {
|
||||
println("Gogs: auth file format error")
|
||||
log.GitLogger.Fatal(2, "Invalid auth file format: %s", os.Args[2])
|
||||
}
|
||||
|
||||
keyId, err := com.StrTo(keys[1]).Int64()
|
||||
if err != nil {
|
||||
println("Gogs: auth file format error")
|
||||
log.GitLogger.Fatal(2, "Invalid auth file format: %v", err)
|
||||
}
|
||||
user, err := models.GetUserByKeyId(keyId)
|
||||
if err != nil {
|
||||
if err == models.ErrUserNotKeyOwner {
|
||||
println("Gogs: you are not the owner of SSH key")
|
||||
log.GitLogger.Fatal(2, "Invalid owner of SSH key: %d", keyId)
|
||||
}
|
||||
println("Gogs: internal error:", err)
|
||||
log.GitLogger.Fatal(2, "Fail to get user by key ID(%d): %v", keyId, err)
|
||||
}
|
||||
|
||||
cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
|
||||
if cmd == "" {
|
||||
println("Hi", user.Name, "! You've successfully authenticated, but Gogs does not provide shell access.")
|
||||
return
|
||||
}
|
||||
|
||||
verb, args := parseCmd(cmd)
|
||||
repoPath := strings.Trim(args, "'")
|
||||
rr := strings.SplitN(repoPath, "/", 2)
|
||||
if len(rr) != 2 {
|
||||
println("Gogs: unavailable repository", args)
|
||||
log.GitLogger.Fatal(2, "Unavailable repository: %v", args)
|
||||
}
|
||||
repoUserName := rr[0]
|
||||
repoName := strings.TrimSuffix(rr[1], ".git")
|
||||
|
||||
isWrite := In(verb, COMMANDS_WRITE)
|
||||
isRead := In(verb, COMMANDS_READONLY)
|
||||
|
||||
repoUser, err := models.GetUserByName(repoUserName)
|
||||
if err != nil {
|
||||
if err == models.ErrUserNotExist {
|
||||
println("Gogs: given repository owner are not registered")
|
||||
log.GitLogger.Fatal(2, "Unregistered owner: %s", repoUserName)
|
||||
}
|
||||
println("Gogs: internal error:", err)
|
||||
log.GitLogger.Fatal(2, "Fail to get repository owner(%s): %v", repoUserName, err)
|
||||
}
|
||||
|
||||
// Access check.
|
||||
switch {
|
||||
case isWrite:
|
||||
has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.WRITABLE)
|
||||
if err != nil {
|
||||
println("Gogs: internal error:", err)
|
||||
log.GitLogger.Fatal(2, "Fail to check write access:", err)
|
||||
} else if !has {
|
||||
println("You have no right to write this repository")
|
||||
log.GitLogger.Fatal(2, "User %s has no right to write repository %s", user.Name, repoPath)
|
||||
}
|
||||
case isRead:
|
||||
repo, err := models.GetRepositoryByName(repoUser.Id, repoName)
|
||||
if err != nil {
|
||||
if err == models.ErrRepoNotExist {
|
||||
println("Gogs: given repository does not exist")
|
||||
log.GitLogger.Fatal(2, "Repository does not exist: %s/%s", repoUser.Name, repoName)
|
||||
}
|
||||
println("Gogs: internal error:", err)
|
||||
log.GitLogger.Fatal(2, "Fail to get repository: %v", err)
|
||||
}
|
||||
|
||||
if !repo.IsPrivate {
|
||||
break
|
||||
}
|
||||
|
||||
has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.READABLE)
|
||||
if err != nil {
|
||||
println("Gogs: internal error:", err)
|
||||
log.GitLogger.Fatal(2, "Fail to check read access:", err)
|
||||
} else if !has {
|
||||
println("You have no right to access this repository")
|
||||
log.GitLogger.Fatal(2, "User %s has no right to read repository %s", user.Name, repoPath)
|
||||
}
|
||||
default:
|
||||
println("Unknown command")
|
||||
return
|
||||
}
|
||||
|
||||
uuid := uuid.NewV4().String()
|
||||
os.Setenv("uuid", uuid)
|
||||
|
||||
gitcmd := exec.Command(verb, repoPath)
|
||||
gitcmd.Dir = setting.RepoRootPath
|
||||
gitcmd.Stdout = os.Stdout
|
||||
gitcmd.Stdin = os.Stdin
|
||||
gitcmd.Stderr = os.Stderr
|
||||
if err = gitcmd.Run(); err != nil {
|
||||
println("Gogs: internal error:", err.Error())
|
||||
log.GitLogger.Fatal(2, "Fail to execute git command: %v", err)
|
||||
}
|
||||
|
||||
if isWrite {
|
||||
tasks, err := models.GetUpdateTasksByUuid(uuid)
|
||||
if err != nil {
|
||||
log.GitLogger.Fatal(2, "GetUpdateTasksByUuid: %v", err)
|
||||
}
|
||||
|
||||
for _, task := range tasks {
|
||||
err = models.Update(task.RefName, task.OldCommitId, task.NewCommitId,
|
||||
user.Name, repoUserName, repoName, user.Id)
|
||||
if err != nil {
|
||||
log.GitLogger.Error(2, "Fail to update: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err = models.DelUpdateTasksByUuid(uuid); err != nil {
|
||||
log.GitLogger.Fatal(2, "DelUpdateTasksByUuid: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Update key activity.
|
||||
key, err := models.GetPublicKeyById(keyId)
|
||||
if err != nil {
|
||||
log.GitLogger.Fatal(2, "GetPublicKeyById: %v", err)
|
||||
}
|
||||
key.Updated = time.Now()
|
||||
if err = models.UpdatePublicKey(key); err != nil {
|
||||
log.GitLogger.Fatal(2, "UpdatePublicKey: %v", err)
|
||||
}
|
||||
}
|
||||
51
cmd/update.go
Normal file
51
cmd/update.go
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
var CmdUpdate = cli.Command{
|
||||
Name: "update",
|
||||
Usage: "This command should only be called by SSH shell",
|
||||
Description: `Update get pushed info and insert into database`,
|
||||
Action: runUpdate,
|
||||
Flags: []cli.Flag{},
|
||||
}
|
||||
|
||||
func runUpdate(c *cli.Context) {
|
||||
cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
|
||||
if cmd == "" {
|
||||
return
|
||||
}
|
||||
|
||||
setup("update.log")
|
||||
|
||||
args := c.Args()
|
||||
if len(args) != 3 {
|
||||
log.GitLogger.Fatal(2, "received less 3 parameters")
|
||||
} else if args[0] == "" {
|
||||
log.GitLogger.Fatal(2, "refName is empty, shouldn't use")
|
||||
}
|
||||
|
||||
uuid := os.Getenv("uuid")
|
||||
|
||||
task := models.UpdateTask{
|
||||
Uuid: uuid,
|
||||
RefName: args[0],
|
||||
OldCommitId: args[1],
|
||||
NewCommitId: args[2],
|
||||
}
|
||||
|
||||
if err := models.AddUpdateTask(&task); err != nil {
|
||||
log.GitLogger.Fatal(2, err.Error())
|
||||
}
|
||||
}
|
||||
382
cmd/web.go
Normal file
382
cmd/web.go
Normal file
@@ -0,0 +1,382 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/Unknwon/macaron"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/macaron-contrib/cache"
|
||||
"github.com/macaron-contrib/captcha"
|
||||
"github.com/macaron-contrib/csrf"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
"github.com/macaron-contrib/session"
|
||||
"github.com/macaron-contrib/toolbox"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/auth"
|
||||
"github.com/gogits/gogs/modules/auth/apiv1"
|
||||
"github.com/gogits/gogs/modules/avatar"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
"github.com/gogits/gogs/routers"
|
||||
"github.com/gogits/gogs/routers/admin"
|
||||
"github.com/gogits/gogs/routers/api/v1"
|
||||
"github.com/gogits/gogs/routers/dev"
|
||||
"github.com/gogits/gogs/routers/org"
|
||||
"github.com/gogits/gogs/routers/repo"
|
||||
"github.com/gogits/gogs/routers/user"
|
||||
)
|
||||
|
||||
var CmdWeb = cli.Command{
|
||||
Name: "web",
|
||||
Usage: "Start Gogs web server",
|
||||
Description: `Gogs web server is the only thing you need to run,
|
||||
and it takes care of all the other things for you`,
|
||||
Action: runWeb,
|
||||
Flags: []cli.Flag{},
|
||||
}
|
||||
|
||||
// checkVersion checks if binary matches the version of templates files.
|
||||
func checkVersion() {
|
||||
data, err := ioutil.ReadFile(path.Join(setting.StaticRootPath, "templates/.VERSION"))
|
||||
if err != nil {
|
||||
log.Fatal(4, "Fail to read 'templates/.VERSION': %v", err)
|
||||
}
|
||||
if string(data) != setting.AppVer {
|
||||
log.Fatal(4, "Binary and template file version does not match, did you forget to recompile?")
|
||||
}
|
||||
}
|
||||
|
||||
// newMacaron initializes Macaron instance.
|
||||
func newMacaron() *macaron.Macaron {
|
||||
m := macaron.New()
|
||||
m.Use(macaron.Logger())
|
||||
m.Use(macaron.Recovery())
|
||||
m.Use(macaron.Static("public",
|
||||
macaron.StaticOptions{
|
||||
SkipLogging: !setting.DisableRouterLog,
|
||||
},
|
||||
))
|
||||
// if setting.EnableGzip {
|
||||
// m.Use(macaron.Gzip())
|
||||
// }
|
||||
m.Use(macaron.Renderer(macaron.RenderOptions{
|
||||
Directory: path.Join(setting.StaticRootPath, "templates"),
|
||||
Funcs: []template.FuncMap{base.TemplateFuncs},
|
||||
IndentJSON: macaron.Env != macaron.PROD,
|
||||
}))
|
||||
m.Use(i18n.I18n(i18n.Options{
|
||||
Langs: setting.Langs,
|
||||
Names: setting.Names,
|
||||
Redirect: true,
|
||||
}))
|
||||
m.Use(cache.Cacher(cache.Options{
|
||||
Adapter: setting.CacheAdapter,
|
||||
Interval: setting.CacheInternal,
|
||||
Conn: setting.CacheConn,
|
||||
}))
|
||||
m.Use(captcha.Captchaer())
|
||||
m.Use(session.Sessioner(session.Options{
|
||||
Provider: setting.SessionProvider,
|
||||
Config: *setting.SessionConfig,
|
||||
}))
|
||||
m.Use(csrf.Generate(csrf.Options{
|
||||
Secret: setting.SecretKey,
|
||||
SetCookie: true,
|
||||
Header: "X-Csrf-Token",
|
||||
}))
|
||||
m.Use(toolbox.Toolboxer(m, toolbox.Options{
|
||||
HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{
|
||||
&toolbox.HealthCheckFuncDesc{
|
||||
Desc: "Database connection",
|
||||
Func: models.Ping,
|
||||
},
|
||||
},
|
||||
}))
|
||||
m.Use(middleware.Contexter())
|
||||
return m
|
||||
}
|
||||
|
||||
func runWeb(*cli.Context) {
|
||||
routers.GlobalInit()
|
||||
checkVersion()
|
||||
|
||||
m := newMacaron()
|
||||
|
||||
reqSignIn := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true})
|
||||
ignSignIn := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: setting.Service.RequireSignInView})
|
||||
ignSignInAndCsrf := middleware.Toggle(&middleware.ToggleOptions{DisableCsrf: true})
|
||||
reqSignOut := middleware.Toggle(&middleware.ToggleOptions{SignOutRequire: true})
|
||||
|
||||
bindIgnErr := binding.BindIgnErr
|
||||
|
||||
// Routers.
|
||||
m.Get("/", ignSignIn, routers.Home)
|
||||
m.Get("/explore", routers.Explore)
|
||||
m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
||||
m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
||||
m.Group("", func(r *macaron.Router) {
|
||||
r.Get("/pulls", user.Pulls)
|
||||
r.Get("/issues", user.Issues)
|
||||
}, reqSignIn)
|
||||
|
||||
// API routers.
|
||||
m.Group("/api", func(_ *macaron.Router) {
|
||||
m.Group("/v1", func(r *macaron.Router) {
|
||||
// Miscellaneous.
|
||||
r.Post("/markdown", bindIgnErr(apiv1.MarkdownForm{}), v1.Markdown)
|
||||
r.Post("/markdown/raw", v1.MarkdownRaw)
|
||||
|
||||
// Users.
|
||||
m.Group("/users", func(r *macaron.Router) {
|
||||
r.Get("/search", v1.SearchUsers)
|
||||
})
|
||||
|
||||
// Repositories.
|
||||
m.Group("/repos", func(r *macaron.Router) {
|
||||
r.Get("/search", v1.SearchRepos)
|
||||
r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.Migrate)
|
||||
})
|
||||
|
||||
r.Any("/*", func(ctx *middleware.Context) {
|
||||
ctx.JSON(404, &base.ApiJsonErr{"Not Found", v1.DOC_URL})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// User routers.
|
||||
m.Group("/user", func(r *macaron.Router) {
|
||||
r.Get("/login", user.SignIn)
|
||||
r.Post("/login", bindIgnErr(auth.SignInForm{}), user.SignInPost)
|
||||
r.Get("/login/:name", user.SocialSignIn)
|
||||
r.Get("/sign_up", user.SignUp)
|
||||
r.Post("/sign_up", bindIgnErr(auth.RegisterForm{}), user.SignUpPost)
|
||||
r.Get("/reset_password", user.ResetPasswd)
|
||||
r.Post("/reset_password", user.ResetPasswdPost)
|
||||
}, reqSignOut)
|
||||
m.Group("/user/settings", func(r *macaron.Router) {
|
||||
r.Get("", user.Settings)
|
||||
r.Post("", bindIgnErr(auth.UpdateProfileForm{}), user.SettingsPost)
|
||||
r.Get("/password", user.SettingsPassword)
|
||||
r.Post("/password", bindIgnErr(auth.ChangePasswordForm{}), user.SettingsPasswordPost)
|
||||
r.Get("/ssh", user.SettingsSSHKeys)
|
||||
r.Post("/ssh", bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
||||
r.Get("/social", user.SettingsSocial)
|
||||
r.Route("/delete", "GET,POST", user.SettingsDelete)
|
||||
}, reqSignIn)
|
||||
m.Group("/user", func(r *macaron.Router) {
|
||||
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
|
||||
r.Any("/activate", user.Activate)
|
||||
r.Get("/email2user", user.Email2User)
|
||||
r.Get("/forget_password", user.ForgotPasswd)
|
||||
r.Post("/forget_password", user.ForgotPasswdPost)
|
||||
r.Get("/logout", user.SignOut)
|
||||
})
|
||||
|
||||
m.Get("/user/:username", ignSignIn, user.Profile) // TODO: Legacy
|
||||
|
||||
// Gravatar service.
|
||||
avt := avatar.CacheServer("public/img/avatar/", "public/img/avatar_default.jpg")
|
||||
os.MkdirAll("public/img/avatar/", os.ModePerm)
|
||||
m.Get("/avatar/:hash", avt.ServeHTTP)
|
||||
|
||||
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})
|
||||
|
||||
m.Group("/admin", func(r *macaron.Router) {
|
||||
m.Get("", adminReq, admin.Dashboard)
|
||||
r.Get("/config", admin.Config)
|
||||
r.Get("/monitor", admin.Monitor)
|
||||
|
||||
m.Group("/users", func(r *macaron.Router) {
|
||||
r.Get("", admin.Users)
|
||||
r.Get("/new", admin.NewUser)
|
||||
r.Post("/new", bindIgnErr(auth.RegisterForm{}), admin.NewUserPost)
|
||||
r.Get("/:userid", admin.EditUser)
|
||||
r.Post("/:userid", bindIgnErr(auth.AdminEditUserForm{}), admin.EditUserPost)
|
||||
r.Post("/:userid/delete", admin.DeleteUser)
|
||||
})
|
||||
|
||||
m.Group("/orgs", func(r *macaron.Router) {
|
||||
r.Get("", admin.Organizations)
|
||||
})
|
||||
|
||||
m.Group("/repos", func(r *macaron.Router) {
|
||||
r.Get("", admin.Repositories)
|
||||
})
|
||||
|
||||
m.Group("/auths", func(r *macaron.Router) {
|
||||
r.Get("", admin.Authentications)
|
||||
r.Get("/new", admin.NewAuthSource)
|
||||
r.Post("/new", bindIgnErr(auth.AuthenticationForm{}), admin.NewAuthSourcePost)
|
||||
r.Get("/:authid", admin.EditAuthSource)
|
||||
r.Post("/:authid", bindIgnErr(auth.AuthenticationForm{}), admin.EditAuthSourcePost)
|
||||
r.Post("/:authid/delete", admin.DeleteAuthSource)
|
||||
})
|
||||
}, adminReq)
|
||||
|
||||
m.Get("/:username", ignSignIn, user.Profile)
|
||||
|
||||
if macaron.Env == macaron.DEV {
|
||||
m.Get("/template/*", dev.TemplatePreview)
|
||||
}
|
||||
|
||||
reqTrueOwner := middleware.RequireTrueOwner()
|
||||
|
||||
// Organization routers.
|
||||
m.Group("/org", func(r *macaron.Router) {
|
||||
r.Get("/create", org.Create)
|
||||
r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.CreatePost)
|
||||
|
||||
m.Group("/:org", func(r *macaron.Router) {
|
||||
r.Get("/dashboard", user.Dashboard)
|
||||
r.Get("/members", org.Members)
|
||||
r.Get("/members/action/:action", org.MembersAction)
|
||||
|
||||
r.Get("/teams", org.Teams)
|
||||
r.Get("/teams/:team", org.TeamMembers)
|
||||
r.Get("/teams/:team/repositories", org.TeamRepositories)
|
||||
r.Get("/teams/:team/action/:action", org.TeamsAction)
|
||||
r.Get("/teams/:team/action/repo/:action", org.TeamsRepoAction)
|
||||
}, middleware.OrgAssignment(true, true))
|
||||
|
||||
m.Group("/:org", func(r *macaron.Router) {
|
||||
r.Get("/teams/new", org.NewTeam)
|
||||
r.Post("/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
||||
r.Get("/teams/:team/edit", org.EditTeam)
|
||||
r.Post("/teams/:team/edit", bindIgnErr(auth.CreateTeamForm{}), org.EditTeamPost)
|
||||
r.Post("/teams/:team/delete", org.DeleteTeam)
|
||||
|
||||
m.Group("/settings", func(r *macaron.Router) {
|
||||
r.Get("", org.Settings)
|
||||
r.Post("", bindIgnErr(auth.UpdateOrgSettingForm{}), org.SettingsPost)
|
||||
r.Get("/hooks", org.SettingsHooks)
|
||||
r.Get("/hooks/new", repo.WebHooksNew)
|
||||
r.Post("/hooks/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
||||
r.Post("/hooks/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
||||
r.Get("/hooks/:id", repo.WebHooksEdit)
|
||||
r.Post("/hooks/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||
r.Post("/hooks/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
||||
r.Route("/delete", "GET,POST", org.SettingsDelete)
|
||||
})
|
||||
|
||||
r.Route("/invitations/new", "GET,POST", org.Invitation)
|
||||
}, middleware.OrgAssignment(true, true, true))
|
||||
}, reqSignIn)
|
||||
m.Group("/org", func(r *macaron.Router) {
|
||||
r.Get("/:org", org.Home)
|
||||
}, middleware.OrgAssignment(true))
|
||||
|
||||
// Repository routers.
|
||||
m.Group("/repo", func(r *macaron.Router) {
|
||||
r.Get("/create", repo.Create)
|
||||
r.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
||||
r.Get("/migrate", repo.Migrate)
|
||||
r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
||||
}, reqSignIn)
|
||||
|
||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||
r.Get("/settings", repo.Settings)
|
||||
r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingsPost)
|
||||
m.Group("/settings", func(r *macaron.Router) {
|
||||
r.Route("/collaboration", "GET,POST", repo.SettingsCollaboration)
|
||||
r.Get("/hooks", repo.Webhooks)
|
||||
r.Get("/hooks/new", repo.WebHooksNew)
|
||||
r.Post("/hooks/gogs/new", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksNewPost)
|
||||
r.Post("/hooks/slack/new", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksNewPost)
|
||||
r.Get("/hooks/:id", repo.WebHooksEdit)
|
||||
r.Post("/hooks/gogs/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||
r.Post("/hooks/slack/:id", bindIgnErr(auth.NewSlackHookForm{}), repo.SlackHooksEditPost)
|
||||
})
|
||||
}, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
|
||||
|
||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||
r.Get("/action/:action", repo.Action)
|
||||
|
||||
m.Group("/issues", func(r *macaron.Router) {
|
||||
r.Get("/new", repo.CreateIssue)
|
||||
r.Post("/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost)
|
||||
r.Post("/:index", bindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
|
||||
r.Post("/:index/label", repo.UpdateIssueLabel)
|
||||
r.Post("/:index/milestone", repo.UpdateIssueMilestone)
|
||||
r.Post("/:index/assignee", repo.UpdateAssignee)
|
||||
r.Get("/:index/attachment/:id", repo.IssueGetAttachment)
|
||||
r.Post("/labels/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
|
||||
r.Post("/labels/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
|
||||
r.Post("/labels/delete", repo.DeleteLabel)
|
||||
r.Get("/milestones", repo.Milestones)
|
||||
r.Get("/milestones/new", repo.NewMilestone)
|
||||
r.Post("/milestones/new", bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
|
||||
r.Get("/milestones/:index/edit", repo.UpdateMilestone)
|
||||
r.Post("/milestones/:index/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.UpdateMilestonePost)
|
||||
r.Get("/milestones/:index/:action", repo.UpdateMilestone)
|
||||
})
|
||||
|
||||
r.Post("/comment/:action", repo.Comment)
|
||||
r.Get("/releases/new", repo.NewRelease)
|
||||
r.Get("/releases/edit/:tagname", repo.EditRelease)
|
||||
}, reqSignIn, middleware.RepoAssignment(true))
|
||||
|
||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||
r.Post("/releases/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
||||
r.Post("/releases/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
||||
}, reqSignIn, middleware.RepoAssignment(true, true))
|
||||
|
||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||
r.Get("/issues", repo.Issues)
|
||||
r.Get("/issues/:index", repo.ViewIssue)
|
||||
r.Get("/pulls", repo.Pulls)
|
||||
r.Get("/branches", repo.Branches)
|
||||
}, ignSignIn, middleware.RepoAssignment(true))
|
||||
|
||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||
r.Get("/src/:branchname", repo.Home)
|
||||
r.Get("/src/:branchname/*", repo.Home)
|
||||
r.Get("/raw/:branchname/*", repo.SingleDownload)
|
||||
r.Get("/commits/:branchname", repo.Commits)
|
||||
r.Get("/commits/:branchname/search", repo.SearchCommits)
|
||||
r.Get("/commits/:branchname/*", repo.FileHistory)
|
||||
r.Get("/commit/:branchname", repo.Diff)
|
||||
r.Get("/commit/:branchname/*", repo.Diff)
|
||||
r.Get("/releases", repo.Releases)
|
||||
r.Get("/archive/*.*", repo.Download)
|
||||
r.Get("/compare/:before([a-z0-9]+)...:after([a-z0-9]+)", repo.CompareDiff)
|
||||
}, ignSignIn, middleware.RepoAssignment(true, true))
|
||||
|
||||
m.Group("/:username", func(r *macaron.Router) {
|
||||
r.Get("/:reponame", middleware.RepoAssignment(true, true, true), repo.Home)
|
||||
m.Group("/:reponame", func(r *macaron.Router) {
|
||||
r.Any("/*", repo.Http)
|
||||
})
|
||||
}, ignSignInAndCsrf)
|
||||
|
||||
// Not found handler.
|
||||
m.NotFound(routers.NotFound)
|
||||
|
||||
var err error
|
||||
listenAddr := fmt.Sprintf("%s:%s", setting.HttpAddr, setting.HttpPort)
|
||||
log.Info("Listen: %v://%s", setting.Protocol, listenAddr)
|
||||
switch setting.Protocol {
|
||||
case setting.HTTP:
|
||||
err = http.ListenAndServe(listenAddr, m)
|
||||
case setting.HTTPS:
|
||||
err = http.ListenAndServeTLS(listenAddr, setting.CertFile, setting.KeyFile, m)
|
||||
default:
|
||||
log.Fatal(4, "Invalid protocol: %s", setting.Protocol)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(4, "Fail to start server: %v", err)
|
||||
}
|
||||
}
|
||||
120
conf/app.ini
120
conf/app.ini
@@ -1,28 +1,34 @@
|
||||
; App name that shows on every page title
|
||||
APP_NAME = Gogs: Go Git Service
|
||||
APP_LOGO = img/favicon.png
|
||||
; Change it if you run locally
|
||||
RUN_USER = git
|
||||
; Either "dev", "prod" or "test", default is "dev"
|
||||
RUN_MODE = dev
|
||||
|
||||
[repository]
|
||||
ROOT =
|
||||
ROOT =
|
||||
SCRIPT_TYPE = bash
|
||||
LANG_IGNS = Google Go|C|C++|Python|Ruby|C Sharp|Java|Objective-C|Android
|
||||
LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0|BSD (3-Clause) License
|
||||
|
||||
[server]
|
||||
PROTOCOL = http
|
||||
DOMAIN = localhost
|
||||
ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
|
||||
HTTP_ADDR =
|
||||
HTTP_ADDR =
|
||||
HTTP_PORT = 3000
|
||||
SSH_PORT = 22
|
||||
; Disable CDN even in "prod" mode
|
||||
OFFLINE_MODE = false
|
||||
DISABLE_ROUTER_LOG = false
|
||||
; Generate steps:
|
||||
; $ cd path/to/gogs/custom/https
|
||||
; $ go run $GOROOT/src/pkg/crypto/tls/generate_cert.go -ca=true -duration=8760h0m0s -host=myhost.example.com
|
||||
CERT_FILE = custom/https/cert.pem
|
||||
KEY_FILE = custom/https/key.pem
|
||||
; Upper level of template and static file path
|
||||
; default is the path where Gogs is executed
|
||||
STATIC_ROOT_PATH =
|
||||
; Application level GZIP support
|
||||
#ENABLE_GZIP = false
|
||||
|
||||
[database]
|
||||
; Either "mysql", "postgres" or "sqlite3", it's your choice
|
||||
@@ -46,6 +52,8 @@ SECRET_KEY = !#@FDEWREWR&*(
|
||||
LOGIN_REMEMBER_DAYS = 7
|
||||
COOKIE_USERNAME = gogs_awesome
|
||||
COOKIE_REMEMBER_NAME = gogs_incredible
|
||||
; Reverse proxy authentication header name of user name
|
||||
REVERSE_PROXY_AUTHENTICATION_USER = X-WEBAUTH-USER
|
||||
|
||||
[service]
|
||||
ACTIVE_CODE_LIVE_MINUTES = 180
|
||||
@@ -53,13 +61,21 @@ RESET_PASSWD_CODE_LIVE_MINUTES = 180
|
||||
; User need to confirm e-mail for registration
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
; Does not allow register and admin create account only
|
||||
DISENABLE_REGISTERATION = false
|
||||
DISABLE_REGISTRATION = false
|
||||
; User must sign in to view anything.
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
; Cache avatar as picture
|
||||
ENABLE_CACHE_AVATAR = false
|
||||
; Mail notification
|
||||
ENABLE_NOTIFY_MAIL = false
|
||||
; More detail: https://github.com/gogits/gogs/issues/165
|
||||
ENABLE_REVERSE_PROXY_AUTHENTICATION = false
|
||||
|
||||
[webhook]
|
||||
; Cron task interval in minutes
|
||||
TASK_INTERVAL = 1
|
||||
; Deliver timeout in seconds
|
||||
DELIVER_TIMEOUT = 5
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
@@ -70,20 +86,20 @@ SUBJECT = %(APP_NAME)s
|
||||
; Mail server
|
||||
; Gmail: smtp.gmail.com:587
|
||||
; QQ: smtp.qq.com:25
|
||||
HOST =
|
||||
HOST =
|
||||
; Mail from address
|
||||
FROM =
|
||||
FROM =
|
||||
; Mailer user name and password
|
||||
USER =
|
||||
PASSWD =
|
||||
USER =
|
||||
PASSWD =
|
||||
|
||||
[oauth]
|
||||
ENABLED = false
|
||||
|
||||
[oauth.github]
|
||||
ENABLED = false
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
SCOPES = https://api.github.com/user
|
||||
AUTH_URL = https://github.com/login/oauth/authorize
|
||||
TOKEN_URL = https://github.com/login/oauth/access_token
|
||||
@@ -92,16 +108,16 @@ TOKEN_URL = https://github.com/login/oauth/access_token
|
||||
; https://console.developers.google.com/project
|
||||
[oauth.google]
|
||||
ENABLED = false
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
SCOPES = https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
|
||||
AUTH_URL = https://accounts.google.com/o/oauth2/auth
|
||||
TOKEN_URL = https://accounts.google.com/o/oauth2/token
|
||||
|
||||
[oauth.qq]
|
||||
ENABLED = false
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
SCOPES = all
|
||||
; QQ 互联
|
||||
; AUTH_URL = https://graph.qq.com/oauth2.0/authorize
|
||||
@@ -110,18 +126,10 @@ SCOPES = all
|
||||
AUTH_URL = https://open.t.qq.com/cgi-bin/oauth2/authorize
|
||||
TOKEN_URL = https://open.t.qq.com/cgi-bin/oauth2/access_token
|
||||
|
||||
[oauth.twitter]
|
||||
ENABLED = false
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
SCOPES = all
|
||||
AUTH_URL = https://api.twitter.com/oauth/authorize
|
||||
TOKEN_URL = https://api.twitter.com/oauth/access_token
|
||||
|
||||
[oauth.weibo]
|
||||
ENABLED = false
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
CLIENT_ID =
|
||||
CLIENT_SECRET =
|
||||
SCOPES = all
|
||||
AUTH_URL = https://api.weibo.com/oauth2/authorize
|
||||
TOKEN_URL = https://api.weibo.com/oauth2/access_token
|
||||
@@ -132,8 +140,8 @@ ADAPTER = memory
|
||||
; For "memory" only, GC interval in seconds, default is 60
|
||||
INTERVAL = 60
|
||||
; For "redis" and "memcache", connection host address
|
||||
; redis: ":6039"
|
||||
; memcache: "127.0.0.1:11211"
|
||||
; redis: `:6039`
|
||||
; memcache: `127.0.0.1:11211`
|
||||
HOST =
|
||||
|
||||
[session]
|
||||
@@ -141,9 +149,9 @@ HOST =
|
||||
PROVIDER = file
|
||||
; Provider config options
|
||||
; memory: not have any config yet
|
||||
; file: session file path, e.g. data/sessions
|
||||
; redis: config like redis server addr, poolSize, password, e.g. 127.0.0.1:6379,100,astaxie
|
||||
; mysql: go-sql-driver/mysql dsn config string, e.g. root:password@/session_table
|
||||
; file: session file path, e.g. `data/sessions`
|
||||
; redis: config like redis server addr, poolSize, password, e.g. `127.0.0.1:6379,100,gogs`
|
||||
; mysql: go-sql-driver/mysql dsn config string, e.g. `root:password@/session_table`
|
||||
PROVIDER_CONFIG = data/sessions
|
||||
; Session cookie name
|
||||
COOKIE_NAME = i_like_gogits
|
||||
@@ -163,9 +171,30 @@ SESSION_ID_HASHKEY =
|
||||
[picture]
|
||||
; The place to picture data, either "server" or "qiniu", default is "server"
|
||||
SERVICE = server
|
||||
DISABLE_GRAVATAR = false
|
||||
|
||||
[attachment]
|
||||
; Whether attachments are enabled. Defaults to `true`
|
||||
ENABLE = true
|
||||
; Path for attachments. Defaults to `data/attachments`
|
||||
PATH = data/attachments
|
||||
; One or more allowed types, e.g. image/jpeg|image/png
|
||||
ALLOWED_TYPES = image/jpeg|image/png
|
||||
; Max size of each file. Defaults to 32MB
|
||||
MAX_SIZE = 32
|
||||
; Max number of files per upload. Defaults to 10
|
||||
MAX_FILES = 10
|
||||
|
||||
[time]
|
||||
; Specifies the format for fully outputed dates. Defaults to RFC1123
|
||||
; Special supported values are ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Kitchen, Stamp, StampMilli, StampMicro and StampNano
|
||||
; For more information about the format see http://golang.org/pkg/time/#pkg-constants
|
||||
FORMAT =
|
||||
|
||||
[log]
|
||||
ROOT_PATH =
|
||||
; Either "console", "file", "conn", "smtp" or "database", default is "console"
|
||||
; Use comma to separate multiple modes, e.g. "console, file"
|
||||
MODE = console
|
||||
; Buffer length of channel, keep it as it is if you don't know what it is.
|
||||
BUFFER_LEN = 10000
|
||||
@@ -174,12 +203,11 @@ LEVEL = Trace
|
||||
|
||||
; For "console" mode only
|
||||
[log.console]
|
||||
LEVEL =
|
||||
LEVEL =
|
||||
|
||||
; For "file" mode only
|
||||
[log.file]
|
||||
LEVEL =
|
||||
FILE_NAME = log/gogs.log
|
||||
LEVEL =
|
||||
; This enables automated log rotate(switch of following options), default is true
|
||||
LOG_ROTATE = true
|
||||
; Max line number of single file, default is 1000000
|
||||
@@ -193,7 +221,7 @@ MAX_DAYS = 7
|
||||
|
||||
; For "conn" mode only
|
||||
[log.conn]
|
||||
LEVEL =
|
||||
LEVEL =
|
||||
; Reconnect host for every single message, default is false
|
||||
RECONNECT_ON_MSG = false
|
||||
; Try to reconnect when connection is lost, default is false
|
||||
@@ -201,23 +229,29 @@ RECONNECT = false
|
||||
; Either "tcp", "unix" or "udp", default is "tcp"
|
||||
PROTOCOL = tcp
|
||||
; Host address
|
||||
ADDR =
|
||||
ADDR =
|
||||
|
||||
; For "smtp" mode only
|
||||
[log.smtp]
|
||||
LEVEL =
|
||||
LEVEL =
|
||||
; Name displayed in mail title, default is "Diagnostic message from serve"
|
||||
SUBJECT = Diagnostic message from serve
|
||||
; Mail server
|
||||
HOST =
|
||||
HOST =
|
||||
; Mailer user name and password
|
||||
USER =
|
||||
USER =
|
||||
PASSWD =
|
||||
; Receivers, can be one or more, e.g. ["1@example.com","2@example.com"]
|
||||
RECEIVERS =
|
||||
RECEIVERS =
|
||||
|
||||
; For "database" mode only
|
||||
[log.database]
|
||||
LEVEL =
|
||||
Driver =
|
||||
CONN =
|
||||
LEVEL =
|
||||
; Either "mysql" or "postgres"
|
||||
DRIVER =
|
||||
; Based on xorm, e.g.: root:root@localhost/gogs?charset=utf8
|
||||
CONN =
|
||||
|
||||
[i18n]
|
||||
LANGS = en-US,zh-CN,de-DE
|
||||
NAMES = English,简体中文,Deutsch
|
||||
|
||||
@@ -59,7 +59,7 @@ _ReSharper*
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
# Installshield output folder
|
||||
[Ee]xpress
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
|
||||
23
conf/license/BSD license
Normal file
23
conf/license/BSD license
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright (c) 2014
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
116
conf/license/CC0 1.0 Universal
Normal file
116
conf/license/CC0 1.0 Universal
Normal file
@@ -0,0 +1,116 @@
|
||||
CC0 1.0 Universal
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator and
|
||||
subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for the
|
||||
purpose of contributing to a commons of creative, cultural and scientific
|
||||
works ("Commons") that the public can reliably and without fear of later
|
||||
claims of infringement build upon, modify, incorporate in other works, reuse
|
||||
and redistribute as freely as possible in any form whatsoever and for any
|
||||
purposes, including without limitation commercial purposes. These owners may
|
||||
contribute to the Commons to promote the ideal of a free culture and the
|
||||
further production of creative, cultural and scientific works, or to gain
|
||||
reputation or greater distribution for their Work in part through the use and
|
||||
efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any expectation
|
||||
of additional consideration or compensation, the person associating CC0 with a
|
||||
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
||||
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
||||
and publicly distribute the Work under its terms, with knowledge of his or her
|
||||
Copyright and Related Rights in the Work and the meaning and intended legal
|
||||
effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not limited
|
||||
to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
||||
and translate a Work;
|
||||
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
|
||||
iii. publicity and privacy rights pertaining to a person's image or likeness
|
||||
depicted in a Work;
|
||||
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data in
|
||||
a Work;
|
||||
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation thereof,
|
||||
including any amended or successor version of such directive); and
|
||||
|
||||
vii. other similar, equivalent or corresponding rights throughout the world
|
||||
based on applicable law or treaty, and any national implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
||||
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
||||
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
||||
and Related Rights and associated claims and causes of action, whether now
|
||||
known or unknown (including existing as well as future claims and causes of
|
||||
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
||||
duration provided by applicable law or treaty (including future time
|
||||
extensions), (iii) in any current or future medium and for any number of
|
||||
copies, and (iv) for any purpose whatsoever, including without limitation
|
||||
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
||||
the Waiver for the benefit of each member of the public at large and to the
|
||||
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
||||
shall not be subject to revocation, rescission, cancellation, termination, or
|
||||
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
||||
by the public as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason be
|
||||
judged legally invalid or ineffective under applicable law, then the Waiver
|
||||
shall be preserved to the maximum extent permitted taking into account
|
||||
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
||||
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
||||
non transferable, non sublicensable, non exclusive, irrevocable and
|
||||
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
||||
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
||||
provided by applicable law or treaty (including future time extensions), (iii)
|
||||
in any current or future medium and for any number of copies, and (iv) for any
|
||||
purpose whatsoever, including without limitation commercial, advertising or
|
||||
promotional purposes (the "License"). The License shall be deemed effective as
|
||||
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
||||
License for any reason be judged legally invalid or ineffective under
|
||||
applicable law, such partial invalidity or ineffectiveness shall not
|
||||
invalidate the remainder of the License, and in such case Affirmer hereby
|
||||
affirms that he or she will not (i) exercise any of his or her remaining
|
||||
Copyright and Related Rights in the Work or (ii) assert any associated claims
|
||||
and causes of action with respect to the Work, in either case contrary to
|
||||
Affirmer's express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
|
||||
b. Affirmer offers the Work as-is and makes no representations or warranties
|
||||
of any kind concerning the Work, express, implied, statutory or otherwise,
|
||||
including without limitation warranties of title, merchantability, fitness
|
||||
for a particular purpose, non infringement, or the absence of latent or
|
||||
other defects, accuracy, or the present or absence of errors, whether or not
|
||||
discoverable, all to the greatest extent permissible under applicable law.
|
||||
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without limitation
|
||||
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
||||
disclaims responsibility for obtaining any necessary consents, permissions
|
||||
or other rights required for any use of the Work.
|
||||
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to this
|
||||
CC0 or use of the Work.
|
||||
|
||||
For more information, please see
|
||||
<http://creativecommons.org/publicdomain/zero/1.0/>
|
||||
203
conf/license/Eclipse Public License v1.0
Normal file
203
conf/license/Eclipse Public License v1.0
Normal file
@@ -0,0 +1,203 @@
|
||||
Eclipse Public License - v 1.0
|
||||
|
||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
|
||||
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
|
||||
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||
|
||||
1. DEFINITIONS
|
||||
|
||||
"Contribution" means:
|
||||
|
||||
a) in the case of the initial Contributor, the initial code and documentation
|
||||
distributed under this Agreement, and
|
||||
b) in the case of each subsequent Contributor:
|
||||
i) changes to the Program, and
|
||||
ii) additions to the Program;
|
||||
|
||||
where such changes and/or additions to the Program originate from and are
|
||||
distributed by that particular Contributor. A Contribution 'originates'
|
||||
from a Contributor if it was added to the Program by such Contributor
|
||||
itself or anyone acting on such Contributor's behalf. Contributions do not
|
||||
include additions to the Program which: (i) are separate modules of
|
||||
software distributed in conjunction with the Program under their own
|
||||
license agreement, and (ii) are not derivative works of the Program.
|
||||
|
||||
"Contributor" means any person or entity that distributes the Program.
|
||||
|
||||
"Licensed Patents" mean patent claims licensable by a Contributor which are
|
||||
necessarily infringed by the use or sale of its Contribution alone or when
|
||||
combined with the Program.
|
||||
|
||||
"Program" means the Contributions distributed in accordance with this
|
||||
Agreement.
|
||||
|
||||
"Recipient" means anyone who receives the Program under this Agreement,
|
||||
including all Contributors.
|
||||
|
||||
2. GRANT OF RIGHTS
|
||||
a) Subject to the terms of this Agreement, each Contributor hereby grants
|
||||
Recipient a non-exclusive, worldwide, royalty-free copyright license to
|
||||
reproduce, prepare derivative works of, publicly display, publicly
|
||||
perform, distribute and sublicense the Contribution of such Contributor,
|
||||
if any, and such derivative works, in source code and object code form.
|
||||
b) Subject to the terms of this Agreement, each Contributor hereby grants
|
||||
Recipient a non-exclusive, worldwide, royalty-free patent license under
|
||||
Licensed Patents to make, use, sell, offer to sell, import and otherwise
|
||||
transfer the Contribution of such Contributor, if any, in source code and
|
||||
object code form. This patent license shall apply to the combination of
|
||||
the Contribution and the Program if, at the time the Contribution is
|
||||
added by the Contributor, such addition of the Contribution causes such
|
||||
combination to be covered by the Licensed Patents. The patent license
|
||||
shall not apply to any other combinations which include the Contribution.
|
||||
No hardware per se is licensed hereunder.
|
||||
c) Recipient understands that although each Contributor grants the licenses
|
||||
to its Contributions set forth herein, no assurances are provided by any
|
||||
Contributor that the Program does not infringe the patent or other
|
||||
intellectual property rights of any other entity. Each Contributor
|
||||
disclaims any liability to Recipient for claims brought by any other
|
||||
entity based on infringement of intellectual property rights or
|
||||
otherwise. As a condition to exercising the rights and licenses granted
|
||||
hereunder, each Recipient hereby assumes sole responsibility to secure
|
||||
any other intellectual property rights needed, if any. For example, if a
|
||||
third party patent license is required to allow Recipient to distribute
|
||||
the Program, it is Recipient's responsibility to acquire that license
|
||||
before distributing the Program.
|
||||
d) Each Contributor represents that to its knowledge it has sufficient
|
||||
copyright rights in its Contribution, if any, to grant the copyright
|
||||
license set forth in this Agreement.
|
||||
|
||||
3. REQUIREMENTS
|
||||
|
||||
A Contributor may choose to distribute the Program in object code form under
|
||||
its own license agreement, provided that:
|
||||
|
||||
a) it complies with the terms and conditions of this Agreement; and
|
||||
b) its license agreement:
|
||||
i) effectively disclaims on behalf of all Contributors all warranties
|
||||
and conditions, express and implied, including warranties or
|
||||
conditions of title and non-infringement, and implied warranties or
|
||||
conditions of merchantability and fitness for a particular purpose;
|
||||
ii) effectively excludes on behalf of all Contributors all liability for
|
||||
damages, including direct, indirect, special, incidental and
|
||||
consequential damages, such as lost profits;
|
||||
iii) states that any provisions which differ from this Agreement are
|
||||
offered by that Contributor alone and not by any other party; and
|
||||
iv) states that source code for the Program is available from such
|
||||
Contributor, and informs licensees how to obtain it in a reasonable
|
||||
manner on or through a medium customarily used for software exchange.
|
||||
|
||||
When the Program is made available in source code form:
|
||||
|
||||
a) it must be made available under this Agreement; and
|
||||
b) a copy of this Agreement must be included with each copy of the Program.
|
||||
Contributors may not remove or alter any copyright notices contained
|
||||
within the Program.
|
||||
|
||||
Each Contributor must identify itself as the originator of its Contribution,
|
||||
if
|
||||
any, in a manner that reasonably allows subsequent Recipients to identify the
|
||||
originator of the Contribution.
|
||||
|
||||
4. COMMERCIAL DISTRIBUTION
|
||||
|
||||
Commercial distributors of software may accept certain responsibilities with
|
||||
respect to end users, business partners and the like. While this license is
|
||||
intended to facilitate the commercial use of the Program, the Contributor who
|
||||
includes the Program in a commercial product offering should do so in a manner
|
||||
which does not create potential liability for other Contributors. Therefore,
|
||||
if a Contributor includes the Program in a commercial product offering, such
|
||||
Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
|
||||
every other Contributor ("Indemnified Contributor") against any losses,
|
||||
damages and costs (collectively "Losses") arising from claims, lawsuits and
|
||||
other legal actions brought by a third party against the Indemnified
|
||||
Contributor to the extent caused by the acts or omissions of such Commercial
|
||||
Contributor in connection with its distribution of the Program in a commercial
|
||||
product offering. The obligations in this section do not apply to any claims
|
||||
or Losses relating to any actual or alleged intellectual property
|
||||
infringement. In order to qualify, an Indemnified Contributor must:
|
||||
a) promptly notify the Commercial Contributor in writing of such claim, and
|
||||
b) allow the Commercial Contributor to control, and cooperate with the
|
||||
Commercial Contributor in, the defense and any related settlement
|
||||
negotiations. The Indemnified Contributor may participate in any such claim at
|
||||
its own expense.
|
||||
|
||||
For example, a Contributor might include the Program in a commercial product
|
||||
offering, Product X. That Contributor is then a Commercial Contributor. If
|
||||
that Commercial Contributor then makes performance claims, or offers
|
||||
warranties related to Product X, those performance claims and warranties are
|
||||
such Commercial Contributor's responsibility alone. Under this section, the
|
||||
Commercial Contributor would have to defend claims against the other
|
||||
Contributors related to those performance claims and warranties, and if a
|
||||
court requires any other Contributor to pay any damages as a result, the
|
||||
Commercial Contributor must pay those damages.
|
||||
|
||||
5. NO WARRANTY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
|
||||
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
|
||||
Recipient is solely responsible for determining the appropriateness of using
|
||||
and distributing the Program and assumes all risks associated with its
|
||||
exercise of rights under this Agreement , including but not limited to the
|
||||
risks and costs of program errors, compliance with applicable laws, damage to
|
||||
or loss of data, programs or equipment, and unavailability or interruption of
|
||||
operations.
|
||||
|
||||
6. DISCLAIMER OF LIABILITY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
|
||||
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
|
||||
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
|
||||
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGES.
|
||||
|
||||
7. GENERAL
|
||||
|
||||
If any provision of this Agreement is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of the
|
||||
remainder of the terms of this Agreement, and without further action by the
|
||||
parties hereto, such provision shall be reformed to the minimum extent
|
||||
necessary to make such provision valid and enforceable.
|
||||
|
||||
If Recipient institutes patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
|
||||
(excluding combinations of the Program with other software or hardware)
|
||||
infringes such Recipient's patent(s), then such Recipient's rights granted
|
||||
under Section 2(b) shall terminate as of the date such litigation is filed.
|
||||
|
||||
All Recipient's rights under this Agreement shall terminate if it fails to
|
||||
comply with any of the material terms or conditions of this Agreement and does
|
||||
not cure such failure in a reasonable period of time after becoming aware of
|
||||
such noncompliance. If all Recipient's rights under this Agreement terminate,
|
||||
Recipient agrees to cease use and distribution of the Program as soon as
|
||||
reasonably practicable. However, Recipient's obligations under this Agreement
|
||||
and any licenses granted by Recipient relating to the Program shall continue
|
||||
and survive.
|
||||
|
||||
Everyone is permitted to copy and distribute copies of this Agreement, but in
|
||||
order to avoid inconsistency the Agreement is copyrighted and may only be
|
||||
modified in the following manner. The Agreement Steward reserves the right to
|
||||
publish new versions (including revisions) of this Agreement from time to
|
||||
time. No one other than the Agreement Steward has the right to modify this
|
||||
Agreement. The Eclipse Foundation is the initial Agreement Steward. The
|
||||
Eclipse Foundation may assign the responsibility to serve as the Agreement
|
||||
Steward to a suitable separate entity. Each new version of the Agreement will
|
||||
be given a distinguishing version number. The Program (including
|
||||
Contributions) may always be distributed subject to the version of the
|
||||
Agreement under which it was received. In addition, after a new version of the
|
||||
Agreement is published, Contributor may elect to distribute the Program
|
||||
(including its Contributions) under the new version. Except as expressly
|
||||
stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
|
||||
licenses to the intellectual property of any Contributor under this Agreement,
|
||||
whether expressly, by implication, estoppel or otherwise. All rights in the
|
||||
Program not expressly granted under this Agreement are reserved.
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the
|
||||
intellectual property laws of the United States of America. No party to this
|
||||
Agreement will bring a legal action under this Agreement more than one year
|
||||
after the cause of action arose. Each party waives its rights to a jury trial in
|
||||
any resulting litigation.
|
||||
674
conf/license/GPL v3
Normal file
674
conf/license/GPL v3
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can 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.
|
||||
|
||||
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
13
conf/license/ISC license
Normal file
13
conf/license/ISC license
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright (c) 2014
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
504
conf/license/LGPL v2.1
Normal file
504
conf/license/LGPL v2.1
Normal file
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
(This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.)
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random
|
||||
Hacker.
|
||||
|
||||
{signature of Ty Coon}, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
165
conf/license/LGPL v3
Normal file
165
conf/license/LGPL v3
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
362
conf/license/Mozilla Public License Version 2.0
Normal file
362
conf/license/Mozilla Public License Version 2.0
Normal file
@@ -0,0 +1,362 @@
|
||||
Mozilla Public License, version 2.0
|
||||
|
||||
1. Definitions
|
||||
|
||||
1.1. "Contributor"
|
||||
|
||||
means each individual or legal entity that creates, contributes to the
|
||||
creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
|
||||
means the combination of the Contributions of others (if any) used by a
|
||||
Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
|
||||
means Source Code Form to which the initial Contributor has attached the
|
||||
notice in Exhibit A, the Executable Form of such Source Code Form, and
|
||||
Modifications of such Source Code Form, in each case including portions
|
||||
thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
a. that the initial Contributor has attached the notice described in
|
||||
Exhibit B to the Covered Software; or
|
||||
|
||||
b. that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the terms of
|
||||
a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
|
||||
means a work that combines Covered Software with other material, in a
|
||||
separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
|
||||
means having the right to grant, to the maximum extent possible, whether
|
||||
at the time of the initial grant or subsequently, any and all of the
|
||||
rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
|
||||
means any of the following:
|
||||
|
||||
a. any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered Software; or
|
||||
|
||||
b. any new file in Source Code Form that contains any Covered Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the License,
|
||||
by the making, using, selling, offering for sale, having made, import,
|
||||
or transfer of either its Contributions or its Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
|
||||
means either the GNU General Public License, Version 2.0, the GNU Lesser
|
||||
General Public License, Version 2.1, the GNU Affero General Public
|
||||
License, Version 3.0, or any later versions of those licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that controls, is
|
||||
controlled by, or is under common control with You. For purposes of this
|
||||
definition, "control" means (a) the power, direct or indirect, to cause
|
||||
the direction or management of such entity, whether by contract or
|
||||
otherwise, or (b) ownership of more than fifty percent (50%) of the
|
||||
outstanding shares or beneficial ownership of such entity.
|
||||
|
||||
|
||||
2. License Grants and Conditions
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
a. under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
b. under Patent Claims of such Contributor to make, use, sell, offer for
|
||||
sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
a. for any code that a Contributor has removed from Covered Software; or
|
||||
|
||||
b. for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
c. under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights to
|
||||
grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
|
||||
Section 2.1.
|
||||
|
||||
|
||||
3. Responsibilities
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
a. such Covered Software must also be made available in Source Code Form,
|
||||
as described in Section 3.1, and You must inform recipients of the
|
||||
Executable Form how they can obtain a copy of such Source Code Form by
|
||||
reasonable means in a timely manner, at a charge no more than the cost
|
||||
of distribution to the recipient; and
|
||||
|
||||
b. You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter the
|
||||
recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty, or
|
||||
limitations of liability) contained within the Source Code Form of the
|
||||
Covered Software, except that You may alter any license notices to the
|
||||
extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this License
|
||||
with respect to some or all of the Covered Software due to statute,
|
||||
judicial order, or regulation then You must: (a) comply with the terms of
|
||||
this License to the maximum extent possible; and (b) describe the
|
||||
limitations and the code they affect. Such description must be placed in a
|
||||
text file included with all distributions of the Covered Software under
|
||||
this License. Except to the extent prohibited by statute or regulation,
|
||||
such description must be sufficiently detailed for a recipient of ordinary
|
||||
skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically if You
|
||||
fail to comply with any of its terms. However, if You become compliant,
|
||||
then the rights granted under this License from a particular Contributor
|
||||
are reinstated (a) provisionally, unless and until such Contributor
|
||||
explicitly and finally terminates Your grants, and (b) on an ongoing
|
||||
basis, if such Contributor fails to notify You of the non-compliance by
|
||||
some reasonable means prior to 60 days after You have come back into
|
||||
compliance. Moreover, Your grants from a particular Contributor are
|
||||
reinstated on an ongoing basis if such Contributor notifies You of the
|
||||
non-compliance by some reasonable means, this is the first time You have
|
||||
received notice of non-compliance with this License from such
|
||||
Contributor, and You become compliant prior to 30 days after Your receipt
|
||||
of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
|
||||
license agreements (excluding distributors and resellers) which have been
|
||||
validly granted by You or Your distributors under this License prior to
|
||||
termination shall survive termination.
|
||||
|
||||
6. Disclaimer of Warranty
|
||||
|
||||
Covered Software is provided under this License on an "as is" basis,
|
||||
without warranty of any kind, either expressed, implied, or statutory,
|
||||
including, without limitation, warranties that the Covered Software is free
|
||||
of defects, merchantable, fit for a particular purpose or non-infringing.
|
||||
The entire risk as to the quality and performance of the Covered Software
|
||||
is with You. Should any Covered Software prove defective in any respect,
|
||||
You (not any Contributor) assume the cost of any necessary servicing,
|
||||
repair, or correction. This disclaimer of warranty constitutes an essential
|
||||
part of this License. No use of any Covered Software is authorized under
|
||||
this License except under this disclaimer.
|
||||
|
||||
7. Limitation of Liability
|
||||
|
||||
Under no circumstances and under no legal theory, whether tort (including
|
||||
negligence), contract, or otherwise, shall any Contributor, or anyone who
|
||||
distributes Covered Software as permitted above, be liable to You for any
|
||||
direct, indirect, special, incidental, or consequential damages of any
|
||||
character including, without limitation, damages for lost profits, loss of
|
||||
goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses, even if such party shall have been
|
||||
informed of the possibility of such damages. This limitation of liability
|
||||
shall not apply to liability for death or personal injury resulting from
|
||||
such party's negligence to the extent applicable law prohibits such
|
||||
limitation. Some jurisdictions do not allow the exclusion or limitation of
|
||||
incidental or consequential damages, so this exclusion and limitation may
|
||||
not apply to You.
|
||||
|
||||
8. Litigation
|
||||
|
||||
Any litigation relating to this License may be brought only in the courts
|
||||
of a jurisdiction where the defendant maintains its principal place of
|
||||
business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions. Nothing
|
||||
in this Section shall prevent a party's ability to bring cross-claims or
|
||||
counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides that
|
||||
the language of a contract shall be construed against the drafter shall not
|
||||
be used to construe this License against a Contributor.
|
||||
|
||||
|
||||
10. Versions of the License
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses If You choose to distribute Source Code Form that is
|
||||
Incompatible With Secondary Licenses under the terms of this version of
|
||||
the License, the notice described in Exhibit B of this License must be
|
||||
attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular file,
|
||||
then You may include the notice in a location (such as a LICENSE file in a
|
||||
relevant directory) where a recipient would be likely to look for such a
|
||||
notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
|
||||
This Source Code Form is "Incompatible
|
||||
With Secondary Licenses", as defined by
|
||||
the Mozilla Public License, v. 2.0.
|
||||
517
conf/locale/locale_de-DE.ini
Normal file
517
conf/locale/locale_de-DE.ini
Normal file
@@ -0,0 +1,517 @@
|
||||
app_desc = Ein einfacher, selbst gehosteter Git-Service, geschrieben in Go.
|
||||
|
||||
home = Home
|
||||
dashboard = Dashboard
|
||||
explore = Erkunden
|
||||
help = Hilfe
|
||||
sign_in = Anmelden
|
||||
social_sign_in = Social Sign In: 2nd Step <small>associate account</small>
|
||||
sign_out = Abmelden
|
||||
sign_up = Sign up
|
||||
register = Registrieren
|
||||
website = Webseite
|
||||
version = Version
|
||||
page = Seite
|
||||
template = Vorlage
|
||||
language = Sprache
|
||||
|
||||
username = Benutzername
|
||||
email = E-Mail
|
||||
password = Passwort
|
||||
re_type = wiederholen
|
||||
captcha = Captcha
|
||||
|
||||
repository = Repository
|
||||
organization = Organisation
|
||||
mirror = Spiegel
|
||||
new_repo = Neues Repository
|
||||
new_migrate = Neue Migration
|
||||
new_org = Neue Organisation
|
||||
manage_org = Organisationen verwalten
|
||||
admin_panel = Admin-Panel
|
||||
account_settings = Kontoeinstellungen
|
||||
settings = Einstellungen
|
||||
|
||||
news_feed = News Feed
|
||||
pull_requests = Pull Requests
|
||||
issues = Issues
|
||||
|
||||
cancel = Abbrechen
|
||||
|
||||
[home]
|
||||
uname_holder = Benutzername oder E-Mail
|
||||
password_holder = Passwort
|
||||
switch_dashboard_context = Switch Dashboard Context
|
||||
my_repos = Meine Repositorys
|
||||
collaborative_repos = Gemeinschaftliche Repositorys
|
||||
my_orgs = Meine Organisationen
|
||||
my_mirrors = Meine Spiegel
|
||||
|
||||
[auth]
|
||||
create_new_account = Neues Konto erstellen
|
||||
register_hepler_msg = Du hast schon ein Konto? Jetzt anmelden!
|
||||
social_register_hepler_msg = Du hast schon ein soziales Konto? Jetzt verknüpfen!
|
||||
disable_register_prompt = Es tut uns leid, die Registrierung wurde deaktiviert. Bitte wende dich an den Administrator.
|
||||
disable_register_mail = Es tut uns leid, die Bestätigung der Registrierungs-E-Mail wurde deaktiviert.
|
||||
remember_me = angemeldet bleiben
|
||||
forgot_password= Passwort vergessen
|
||||
forget_password = Passwort vergessen?
|
||||
sign_up_now = Du willst ein Konto? Jetzt registrieren!
|
||||
confirmation_mail_sent_prompt = Eine neu Bestätigungs-E-Mail wurde an <b>%s</b> gesendet. Kontrolliere dein Postfach innerhalb der nächsten %d Stunden um die Registrierung abzuschließen.
|
||||
sign_in_email = Melden dich mit deiner E-Mail-Adresse an
|
||||
active_your_account = Aktivieren dein Konto
|
||||
resent_limit_prompt = Es tut uns leid, du sendest zu häufig Aktivierungs-E-Mails. Bitte warte 3 Minuten.
|
||||
has_unconfirmed_mail = Hallo %s, du hast eine unbestätigte E-Mail-Adresse (<b>%s</b>). Falls du noch keine Bestätigungs-E-Mail erhalten hast oder eine neue senden musst, klicke auf den unteren Button.
|
||||
resend_mail = Hier klicken, um deine Aktivierungs-E-Mail erneut zu versenden
|
||||
email_not_associate = Diese E-Mail-Adresse ist mit keinem Konto verknüpft.
|
||||
send_reset_mail = Hier klicken, um die E-Mail zum Passwort-zurücksetzen erneut zu versenden
|
||||
reset_password = Passwort zurücksetzen
|
||||
invalid_code = Es tut uns leid, der Bestätigungscode ist abgelaufen oder ungültig.
|
||||
reset_password_helper = Hier klicken, um das Passwort zurückzusetzen
|
||||
password_too_short = Das Passwort muss mindenstens 6 Zeichen lang sein
|
||||
|
||||
[form]
|
||||
UserName = Benutzername
|
||||
RepoName = Repository-Name
|
||||
Email = E-Mail-Adresse
|
||||
Password = Passwort
|
||||
Retype = Passwort erneut eingeben
|
||||
SSHTitle = SSH-Schlüsselname
|
||||
HttpsUrl = HTTPS-URL
|
||||
PayloadUrl = Payload-URL
|
||||
TeamName = Teamname
|
||||
AuthName = Authentifizierungsname
|
||||
|
||||
require_error = ` darf nicht leer sein.`
|
||||
alpha_dash_error = ` kann ausschließlich alphanumerische Zeichen und "-_" enthalten.`
|
||||
alpha_dash_dot_error = ` kann ausschließlich alphanumerische Zeichen und ".-_" enthalten.`
|
||||
min_size_error = ` muss mindestens %s Zeichen enthalten.`
|
||||
max_size_error = ` darf höchstens %s Zeichen enthalten.`
|
||||
email_error = ` ist keine gültige E-Mail-Adresse.`
|
||||
url_error = ` ist keine gültige URL.`
|
||||
unknown_error = Unbekannter Fehler:
|
||||
captcha_incorrect = Captcha stimmt nicht überein.
|
||||
password_not_match = Die Passwörter stimmen nicht überein.
|
||||
|
||||
username_been_taken = Benutzername ist bereits vergeben.
|
||||
repo_name_been_taken = Repository-Name ist bereits vergeben.
|
||||
org_name_been_taken = Organisationsname ist bereits vergeben.
|
||||
team_name_been_taken = Teamname ist bereits vergeben.
|
||||
email_been_used = E-Mail-Adresse wird bereits verwendet.
|
||||
ssh_key_been_used = SSH-Schlüsselname wird bereits verwendet.
|
||||
illegal_username = Benutzername enthält ungültige Zeichen.
|
||||
illegal_repo_name = Repository-Name enthält ungültige Zeichen.
|
||||
illegal_org_name = Organisationsname enthält ungültige Zeichen.
|
||||
illegal_team_name = Teamname enthält ungültige Zeichen.
|
||||
username_password_incorrect = Benutzername oder Passwort ist nicht korrekt.
|
||||
enterred_invalid_repo_name = Bitte stelle sicher, dass der eingegeben Repository-Name richtig ist.
|
||||
enterred_invalid_owner_name = Bitte stelle sicher, dass der eingegeben Besitzername richtig ist.
|
||||
enterred_invalid_password = Bitte stelle sicher, dass das eingegebene Passwort richtig ist.
|
||||
user_not_exist = Angegebener Benutzer existiert nicht.
|
||||
last_org_owner = Der zu entfernende Benutzer ist der letzte Teambesitzer. Es muss einen anderen Besitzer geben.
|
||||
|
||||
invalid_ssh_key = Leider sind wir nicht in der Lage, Ihren SSH-Schlüssel zu überprüfen: %s
|
||||
auth_failed = Authentifizierung fehlgeschlagen: %v
|
||||
|
||||
still_own_repo = Dein Konto besitzt noch Repositorys. Diese müssen zuerst gelöscht oder übertragen werden.
|
||||
org_still_own_repo = Diese Organisation besitzt noch Repositorys. Diese müssen zuerst gelöscht oder übertragen werden.
|
||||
|
||||
still_own_user = Diese Authentifizierung wird noch von einigen Benutzern genutzt. Entferne diese zuvor und lösche erneut.
|
||||
|
||||
[settings]
|
||||
profile = Profil
|
||||
password = Passwort
|
||||
ssh_keys = SSH-Schlüssel
|
||||
social = Soziale Konten
|
||||
orgs = Organisationen
|
||||
delete = Konto löschen
|
||||
|
||||
public_profile = Öffentliches Profil
|
||||
profile_desc = Deine E-Mail-Adresse ist öffentlich und dient dazu, dir Benachrichtigungen bezüglich deines Kontos und deiner Repositorys zu schicken.
|
||||
full_name = Vollständiger Name
|
||||
website = Webseite
|
||||
location = Standort
|
||||
update_profile = Profil aktualisieren
|
||||
update_profile_success = Profil aktualisiert
|
||||
|
||||
change_password = Passwort ändern
|
||||
old_password = Aktuelles Passwort
|
||||
new_password = Neues Passwort
|
||||
password_incorrect = Aktuelles Passwort ist nicht korrekt.
|
||||
change_password_success = Passwort geändert. Du kannst dich jetzt mit dem neuen Passwort anmelden.
|
||||
|
||||
manage_ssh_keys = SSH-Schlüssel verwalten
|
||||
add_key = SSH-Schlüssel hinzufügen
|
||||
ssh_desc = Dies ist eine Liste aller SSH-Schlüssel, die mit deinem Konto verknüpft sind. Entferne alle Schlüssel, die du nicht kennst.
|
||||
ssh_helper = <strong>Du brauchst Hilfe?</strong> Hier ist eine Anleitung zum <a href="https://help.github.com/articles/generating-ssh-keys">Erzeugen von SSH-Schlüsseln</a> oder <a href="https://help.github.com/ssh-issues/">Problemlösen einfacher SSH-Probleme</a>.
|
||||
add_new_key = SSH-Schlüssel hinzufügen
|
||||
key_name = Schlüsselname
|
||||
key_content = Inhalt
|
||||
add_key_success = SSH-Schlüssel hinzugefügt
|
||||
delete_key = SSH-Schlüssel löschen
|
||||
add_on = Hinzugefügt am
|
||||
last_used = Zuletzt verwendet auf
|
||||
no_activity = Keine neuen Aktivitäten
|
||||
|
||||
manage_social = Verknüpfte soziale Konten verwalten
|
||||
social_desc = Dies ist eine Liste verknüpfter sozialer Konten. Entferne alle Verknüpfungen, die du nicht kennst.
|
||||
unbind = Verknüpfung entfernen
|
||||
unbind_success = Die Verknüpfung zum sozialen Konto wurde entfernt.
|
||||
|
||||
delete_account = Konto löschen
|
||||
delete_prompt = Diese Aktion wird dein Konto dauerhaft löschen und kann <strong>NICHT</strong> rückgängig gemacht werden!
|
||||
confirm_delete_account = Löschen
|
||||
|
||||
[repo]
|
||||
owner = Besitzer
|
||||
repo_name = Repository-Name
|
||||
repo_name_helper = Gute Repository-Namen sind kurz, einprägsam und <strong>einzigartig</strong>.
|
||||
visibility = Sichtbarkeit
|
||||
visiblity_helper = Dieses Repository ist <span class="label label-red label-radius">Privat</span>
|
||||
repo_desc = Beschreibung
|
||||
repo_lang = Sprache
|
||||
repo_lang_helper = Wähle eine .gitignore Datei
|
||||
license = Lizenz
|
||||
license_helper = Wähle eine Lizenz aus
|
||||
init_readme = Repository mit README.md initialisieren
|
||||
create_repo = Repository erstellen
|
||||
default_branch = Standard-Branch
|
||||
mirror_interval = Spiegel-Intervall (in Stunden)
|
||||
goget_meta = Go-Get Meta
|
||||
goget_meta_helper = This repository will be <span class="label label-blue label-radius">Go-Getable</span>
|
||||
goget_meta_helper = Dieses Repository wird man mit <span class="label label-blue label-radius">go get</span> klonen können.
|
||||
|
||||
need_auth = Authorisierung benötigt
|
||||
migrate_type = Migrationstyp
|
||||
migrate_type_helper = Dieses Repository wird ein <span class="label label-blue label-radius">Spiegel</span>
|
||||
migrate_repo = Repository migrieren
|
||||
|
||||
copy_link = Klonen
|
||||
clone_helper = Du brauchst Hilef beim klonen? Hier gibt es<a target="_blank" href="http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository">Hilfe</a>!
|
||||
unwatch = Beobachtung beenden
|
||||
watch = Beobachtung
|
||||
unstar = Markierung aufheben
|
||||
star = Markierung
|
||||
fork = Abspaltung
|
||||
|
||||
quick_guide = Kurzanleitung
|
||||
clone_this_repo = Dieses Repository klonen
|
||||
create_new_repo_command = Erstelle ein neues Repository mittels der Kommandozeile
|
||||
push_exist_repo = Push an existing repository from the command line
|
||||
|
||||
settings = Einstellungen
|
||||
settings.options = Optionen
|
||||
settings.collaboration = Zusammenarbeit
|
||||
settings.hooks = Webhooks
|
||||
settings.deploy_keys = Deploy-Keys
|
||||
settings.basic_settings = Grundeinstellungen
|
||||
settings.danger_zone = Gefahrenzone
|
||||
settings.site = Offizielle Webseite
|
||||
settings.update_settings = Aktualisierungseinstellungen
|
||||
settings.transfer = Besitz übertragen
|
||||
settings.transfer_desc = Übertrage dieses Repository einem anderen Benutzer oder einer Organisation.
|
||||
settings.delete = Repository löschen
|
||||
settings.delete_desc = Wenn dieses Repository gelöschet ist, gibt es keinen Weg zurück. Sei dir sicher!
|
||||
settings.update_settings_success = Repository-Optionen aktualisiert
|
||||
settings.transfer_owner = Neuer Besitzer
|
||||
settings.make_transfer = übertragen
|
||||
settings.confirm_delete = Löschen
|
||||
settings.add_collaborator = Mitarbeiter hinzufügen
|
||||
settings.add_collaborator_success = Mitarbeiter hinzugefügt
|
||||
settings.remove_collaborator_success = Mitarbeiter entfernt
|
||||
settings.add_webhook = Webhook hinzufügen
|
||||
settings.hooks_desc = Webhooks erlauben es externe Dienste zu informieren, wenn etwas bestimmtes in deinem Repository passiert. GoGS sendet dann eine POST-Request an alle angegebenen URLs. Erfahre mehr in unserem <a target="_blank" href="http://gogs.io/docs/features/webhook.html">Webhooks Guide</a>.
|
||||
settings.remove_hook_success = Webhook entfernt
|
||||
settings.add_webhook_desc = GoGS sendet einen <code>POST</code>-Request an die unten stehende URL mit Details aller abonierten Ereignisse. Du kannst auch angeben, welches Datenformat du erhalten willst (JSON, <code>x-www-form-urlencoded</code>, <em>etc</em>). Mehr Informationen findest du im <a target="_blank" href="http://gogs.io/docs/features/webhook.html">Webhooks Guide</a>.
|
||||
settings.payload_url = Payload-URL
|
||||
settings.content_type = Inhaltstyp
|
||||
settings.secret = Secret
|
||||
settings.event_desc = Welche Ereignisse sollen diesen Webhook auslösen?
|
||||
settings.event_push_only = Nur das <code>push</code>-Ereignis.
|
||||
settings.active = Aktiv
|
||||
settings.active_helper = Ereignisdetails werden ausgeliefert, wenn dieser Webhook ausgelöst wird.
|
||||
settings.add_hook_success = Webhook hinzugefügt
|
||||
settings.update_webhook = Webhook aktualisieren
|
||||
settings.update_hook_success = Webhook aktualisiert
|
||||
settings.delete_webhook = Webhook löschen
|
||||
settings.recent_deliveries = letzte Zustellungen
|
||||
settings.hook_type = Hook Type
|
||||
settings.add_slack_hook_desc = Add <a href="http://slack.com">Slack</a> integration to your repository.
|
||||
settings.slack_token = Token
|
||||
settings.slack_domain = Domain
|
||||
settings.slack_channel = Channel
|
||||
|
||||
[org]
|
||||
org_name_holder = Name der Organisation
|
||||
org_name_helper = Gute Namen von Organisationen sind kurz und einprägsam.
|
||||
org_email_helper = Das E-Mail-Konto der Organisation empfängt alle Benachrichtigungen.
|
||||
create_org = Organisation erstellen
|
||||
repo_updated = Aktualisiert
|
||||
people = Personen
|
||||
invite_someone = Benutzer einladen
|
||||
teams = Teams
|
||||
lower_members = Mitglieder
|
||||
lower_repositories = Repositorys
|
||||
create_new_team = Neues Team erstellen
|
||||
org_desc = Beschreibung
|
||||
team_name = Teamname
|
||||
team_desc = Beschreibung
|
||||
team_name_helper = Verwende diesen Namen, um dich auf dieses Team zu beziehen.
|
||||
team_desc_helper = Was hat es mit diesem Team auf sich?
|
||||
team_permission_desc = Welche Berechtigungsstufe soll das Team haben?
|
||||
|
||||
settings = Einstellungen
|
||||
settings.options = Optionen
|
||||
settings.full_name = Vollständiger Name
|
||||
settings.website = Webseite
|
||||
settings.location = Standort
|
||||
settings.update_settings = Aktualisierungseinstellungen
|
||||
settings.update_setting_success = Organisationseinstellungen aktualisiert
|
||||
settings.delete = Organisation löschen
|
||||
settings.delete_account = Diese Organisation löschen
|
||||
settings.delete_prompt = Die Organisation wird dauerhaft gelöscht. Dies kann <strong>NICHT</strong> rückgängig gemacht werden!
|
||||
settings.confirm_delete_account = Löschen
|
||||
|
||||
members.public = Öffentlich
|
||||
members.public_helper = Privat machen
|
||||
members.private = Privat
|
||||
members.private_helper = Öffentlich machen
|
||||
members.owner = Besitzer
|
||||
members.member = Mitglied
|
||||
members.conceal = Verbergen
|
||||
members.remove = Entfernen
|
||||
members.leave = Verlassen
|
||||
members.invite_desc = Benutzernamen eingeben, um ihn als neues Mitglied in %s einzuladen:
|
||||
members.invite_now = Jetzt einladen
|
||||
|
||||
teams.join = Beitreten
|
||||
teams.leave = Verlassen
|
||||
teams.read_access = Lesezugriff
|
||||
teams.read_access_helper = Dieses Team wird Repositorys einsehen und klonen können.
|
||||
teams.write_access = Schreibzugriff
|
||||
teams.write_access_helper = Dieses Team wird die Repositorys einsehen und in sie hinein pushen können.
|
||||
teams.admin_access = Adminzugriff
|
||||
teams.admin_access_helper = Dieses Team wird pull- und push-Rechte für die Repositorys haben und Mitarbeiter einladen können.
|
||||
teams.no_desc = Dieses Team hat keine Beschreibung
|
||||
teams.settings = Einstellungen
|
||||
teams.owners_permission_desc = Besitzer haben vollen Zugriff auf <strong>alle Repositorys</strong> und <strong>Admin Rechte</strong> für diese Organisation.
|
||||
teams.members = Teammitglieder
|
||||
teams.update_settings = Einstellungen aktualisieren
|
||||
teams.delete_team = Dieses Team löschen
|
||||
teams.add_team_member = Teammitglied hinzufügen
|
||||
teams.delete_team_success = Team gelöscht
|
||||
teams.read_permission_desc = Dieses Team erlaubt <strong>Lesezugriff</strong>: Mitglieder können Team-Repositorys einsehen und klonen.
|
||||
teams.write_permission_desc = Dieses Team erlaubt <strong>Schreibzugriff</strong>: Mitglieder können Team-Repositorys einsehen und hinein pushen.
|
||||
teams.admin_permission_desc = Diese Team erlaubt <strong>Adminzugriff</strong>: Mitglieder dieses Teams können pullen, pushen und dem Team Mitarbeiter hinzufügen.
|
||||
teams.repositories = Team-Repositorys
|
||||
teams.add_team_repository = Team-Repository hinzufügen
|
||||
teams.remove_repo = Entfernen
|
||||
|
||||
[admin]
|
||||
dashboard = Dashboard
|
||||
users = Benutzer
|
||||
organizations = Organisationen
|
||||
repositories = Repositorys
|
||||
authentication = Authentifizierung
|
||||
config = Konfiguration
|
||||
monitor = Monitoring
|
||||
prev = zurück
|
||||
next = vor
|
||||
|
||||
dashboard.statistic = Statistik
|
||||
dashboard.operations = Operationen
|
||||
dashboard.system_status = System-Monitor-Status
|
||||
dashboard.statistic_info = GoGS Datenbank hat <b>%d</b> Benutzer, <b>%d</b> Organizationen, <b>%d</b> öffentliche Schlüssel, <b>%d</b> Repositorys, <b>%d</b> watches, <b>%d</b> stars, <b>%d</b> actions, <b>%d</b> Zugriffe, <b>%d</b> issues, <b>%d</b> Kommentare, <b>%d</b> soziale Konten, <b>%d</b> follows, <b>%d</b> Spiegel, <b>%d</b> Releases, <b>%d</b> Login-Quellen, <b>%d</b> Webhooks, <b>%d</b> Milestones, <b>%d</b> Labels, <b>%d</b> Hook-Tasks, <b>%d</b> Teams, <b>%d</b> Aktualisierungs-Tasks, <b>%d</b> Anhänge.
|
||||
dashboard.operation_name = Operation Name
|
||||
dashboard.operation_switch = Switch
|
||||
dashboard.operation_run = Ausführen
|
||||
dashboard.clean_unbind_oauth = ungebundene OAuths bereinigen
|
||||
dashboard.delete_inactivate_accounts = inaktive Konten löschen
|
||||
dashboard.server_uptime = Server-Uptime
|
||||
dashboard.current_goroutine = Aktuelle Goroutines
|
||||
dashboard.current_memory_usage = Aktuelle Speichernutzung
|
||||
dashboard.total_memory_allocated = Zugeteilter Gesamtspeicher
|
||||
dashboard.memory_obtained = Erhaltener Speicher
|
||||
dashboard.pointer_lookup_times = Pointer Lookup Times
|
||||
dashboard.memory_allocate_times = Memory Allocate Times
|
||||
dashboard.memory_free_times = Memory Free Times
|
||||
dashboard.current_heap_usage = Aktuelle Heap-Auslastung
|
||||
dashboard.heap_memory_obtained = erhaltener Heap-Memory
|
||||
dashboard.heap_memory_idle = unbenutzter Heap-Memory
|
||||
dashboard.heap_memory_in_use = benutzter Heap-Memory
|
||||
dashboard.heap_memory_released = freigegebener Heap-Memory
|
||||
dashboard.heap_objects = Heap-Objekte
|
||||
dashboard.bootstrap_stack_usage = Bootstrap-Stack-Auslastung
|
||||
dashboard.stack_memory_obtained = erhaltener Stack-Memory
|
||||
dashboard.mspan_structures_usage = MSpan-Structures-Auslastung
|
||||
dashboard.mspan_structures_obtained = erhaltene MSpan-Structures
|
||||
dashboard.mcache_structures_usage = MCache-Structures-Auslastung
|
||||
dashboard.mcache_structures_obtained = erhaltene MCache-Structures
|
||||
dashboard.profiling_bucket_hash_table_obtained = Profiling Bucket Hash Table Obtained
|
||||
dashboard.gc_metadata_obtained = erhaltene GC-Metadata
|
||||
dashboard.other_system_allocation_obtained = andere erhaltene System-Allokatoren
|
||||
dashboard.next_gc_recycle = nächster GC-Zyklus
|
||||
dashboard.last_gc_time = seit letztem GC-Zyklus
|
||||
dashboard.total_gc_time = gesammte GC-Zeit
|
||||
dashboard.total_gc_pause = gesammte GC-Pause
|
||||
dashboard.last_gc_pause = letzte GC-Pause
|
||||
dashboard.gc_times = GC-Takt
|
||||
|
||||
users.user_manage_panel = Benutzer
|
||||
users.new_account = Neues Konto erstellen
|
||||
users.name = Name
|
||||
users.activated = Aktiviert
|
||||
users.admin = Admin
|
||||
users.repos = Repositorys
|
||||
users.created = Erzeugt
|
||||
users.edit = Bearbeiten
|
||||
users.auth_source = Auth-Quelle
|
||||
users.local = Lokal
|
||||
users.auth_login_name = Auth-Login-Name
|
||||
users.update_profile_success = Kontoprofil aktualisiert
|
||||
users.edit_account = Konto bearbeiten
|
||||
users.is_activated = Dieses Konto ist aktiviert
|
||||
users.is_admin = Dieses Konto hat Administratorrechte
|
||||
users.update_profile = Kontoprofil aktualisieren
|
||||
users.delete_account = Dieses Konto löschen
|
||||
users.still_own_repo = Dieses Konto besitzt noch Repositorys. Diese müssen zuerst gelöscht oder übertragen werden.
|
||||
|
||||
orgs.org_manage_panel = Organisationenverwaltung
|
||||
orgs.name = Name
|
||||
orgs.teams = Teams
|
||||
orgs.members = Mitglieder
|
||||
|
||||
repos.repo_manage_panel = Repositorys
|
||||
repos.owner = Besitzer
|
||||
repos.name = Name
|
||||
repos.private = Privat
|
||||
repos.watches = Watches
|
||||
repos.stars = Stars
|
||||
repos.issues = Issues
|
||||
|
||||
auths.auth_manage_panel = Authentifizierung
|
||||
auths.new = Neu Authentifizierungsquelle hinzufügen
|
||||
auths.name = Name
|
||||
auths.type = Typ
|
||||
auths.enabled = aktiviert
|
||||
auths.updated = aktualisiert
|
||||
auths.auth_type = Authentifizierungstyp
|
||||
auths.auth_name = Authentifizierungsname
|
||||
auths.domain = Domain
|
||||
auths.host = Host
|
||||
auths.port = Port
|
||||
auths.base_dn = Base DN
|
||||
auths.attributes = Suchattribute
|
||||
auths.filter = Suchfilter
|
||||
auths.ms_ad_sa = Ms Ad SA
|
||||
auths.smtp_auth = SMTP-Authentifizierungstyp
|
||||
auths.smtphost = SMTP-Host
|
||||
auths.smtpport = SMTP-Port
|
||||
auths.enable_tls = TLS-Verschlüsselung aktivieren
|
||||
auths.enable_auto_register = Automatische Registrierung aktivieren
|
||||
auths.tips = Tipps
|
||||
auths.edit = Authentifizierungseinstellungen bearbeiten
|
||||
auths.activated = Diese Authentifizierung ist aktiviert
|
||||
auths.update_success = Authentifizierungseinstellungen aktualisiert
|
||||
auths.update = Authentifizierungseinstellungen aktualisieren
|
||||
auths.delete = Authentifizierung löschen
|
||||
|
||||
config.server_config = Server-Konfiguration
|
||||
config.app_name = Anwendungsname
|
||||
config.app_ver = Anwendungsversion
|
||||
config.app_url = Anwendungs-URL
|
||||
config.domain = Domain
|
||||
config.offline_mode = Offline-Modus
|
||||
config.disable_router_log = Router-Log deaktivieren
|
||||
config.run_user = Laufzeit-Benutzer
|
||||
config.run_mode = Laufzeit-Modus
|
||||
config.repo_root_path = Repository-Verzeichnis
|
||||
config.static_file_root_path = Verzeichnis für statische Dateien
|
||||
config.log_file_root_path = Log-Verzeichnis
|
||||
config.script_type = Skript-Typ
|
||||
config.reverse_auth_user = Reverse Authentication User
|
||||
config.db_config = Datenbankkonfiguration
|
||||
config.db_type = Typ
|
||||
config.db_host = Host
|
||||
config.db_name = Name
|
||||
config.db_user = Benutzer
|
||||
config.db_ssl_mode = SSL-Modus
|
||||
config.db_ssl_mode_helper = (nur für "postgres")
|
||||
config.db_path = Verzeichnis
|
||||
config.db_path_helper = (nur für "sqlite3")
|
||||
config.service_config = Service-Einstellungen
|
||||
config.register_email_confirm = E-Mail-Bestätigung bei Registrierung
|
||||
config.disable_register = Registrierung deaktivieren
|
||||
config.require_sign_in_view = Require Sign In View
|
||||
config.mail_notify = E-Mail-Benachrichtigung
|
||||
config.enable_cache_avatar = Avatar-Cache aktivieren
|
||||
config.active_code_lives = Active Code Lives
|
||||
config.reset_password_code_lives = Reset Password Code Lives
|
||||
config.webhook_config = Webhook-Einstellungen
|
||||
config.task_interval = Task-Intervall
|
||||
config.deliver_timeout = Zeitlimit für Zustellung
|
||||
config.mailer_config = Mailer-Einstellungen
|
||||
config.mailer_enabled = Aktiviert
|
||||
config.mailer_name = Name
|
||||
config.mailer_host = Host
|
||||
config.mailer_user = Benutzer
|
||||
config.oauth_config = OAuth-Einstellungen
|
||||
config.oauth_enabled = Aktiviert
|
||||
config.cache_config = Cache-Einstellungen
|
||||
config.cache_adapter = Cache-Adapter
|
||||
config.cache_interval = Cache-Intervall
|
||||
config.cache_conn = Cache-Anbindung
|
||||
config.session_config = Session-Einstellungen
|
||||
config.session_provider = Session-Provider
|
||||
config.provider_config = Provider-Einstellungen
|
||||
config.cookie_name = Cookie-Name
|
||||
config.enable_set_cookie = Enable Set Cookie
|
||||
config.gc_interval_time = GC-Intervallzeit
|
||||
config.session_life_time = Session-Lebensdauer
|
||||
config.https_only = nur HTTPS
|
||||
config.cookie_life_time = Cookie-Lebensdauer
|
||||
config.session_hash_function = Session-ID-Hashfunktion
|
||||
config.session_hash_key = Session-ID-Hashschlüssel
|
||||
config.picture_config = Bildeinstellungen
|
||||
config.picture_service = Bildservice
|
||||
config.disable_gravatar = Gravatar deaktivieren
|
||||
config.log_config = Log-Einstellungen
|
||||
config.log_mode = Log-Modus
|
||||
|
||||
monitor.cron = Cron-Tasks
|
||||
monitor.name = Name
|
||||
monitor.schedule = Zeitplan
|
||||
monitor.next = nächste Ausführung
|
||||
monitor.previous = letzte Ausführung
|
||||
monitor.execute_times = Execute Times
|
||||
monitor.process = Laufende Prozesse
|
||||
monitor.desc = Beschreibung
|
||||
monitor.start = Startzeit
|
||||
monitor.execute_time = Ausführungszeit
|
||||
|
||||
[action]
|
||||
create_repo = Repository erstellen <a href="/%s">%s</a>
|
||||
commit_repo = pushed to <a href="/%s/src/%s">%s</a> at <a href="/%s">%s</a>
|
||||
create_issue = opened issue <a href="/%s/issues/%s">%s#%s</a>
|
||||
comment_issue = commented on issue <a href="/%s/issues/%s">%s#%s</a>
|
||||
|
||||
[tool]
|
||||
ago = vor
|
||||
from_now = ab sofort
|
||||
now = Jetzt
|
||||
1s = 1 Sekunde %s
|
||||
1m = 1 Minute %s
|
||||
1h = 1 Stunde %s
|
||||
1d = 1 Tag %s
|
||||
1w = 1 Woche %s
|
||||
1mon = 1 Monat %s
|
||||
1y = 1 Jahr %s
|
||||
seconds = %d Sekunden %s
|
||||
minutes = %d Minuten %s
|
||||
hours = %d Stunden %s
|
||||
days = %d Tage %s
|
||||
weeks = %d Wochen %s
|
||||
months = %d Monate %s
|
||||
years = %d Jahre %s
|
||||
raw_seconds = Sekunden
|
||||
raw_minutes = Minuten
|
||||
580
conf/locale/locale_en-US.ini
Normal file
580
conf/locale/locale_en-US.ini
Normal file
@@ -0,0 +1,580 @@
|
||||
app_desc = A painless self-hosted Git service written in Go
|
||||
|
||||
home = Home
|
||||
dashboard = Dashboard
|
||||
explore = Explore
|
||||
help = Help
|
||||
sign_in = Sign In
|
||||
social_sign_in = Social Sign In: 2nd Step <small>associate account</small>
|
||||
sign_out = Sign Out
|
||||
sign_up = Sign Up
|
||||
register = Register
|
||||
website = Website
|
||||
version = Version
|
||||
page = Page
|
||||
template = Template
|
||||
language = Language
|
||||
|
||||
username = Username
|
||||
email = E-mail
|
||||
password = Password
|
||||
re_type = Re-Type
|
||||
captcha = Captcha
|
||||
|
||||
repository = Repository
|
||||
organization = Organization
|
||||
mirror = Mirror
|
||||
new_repo = New Repository
|
||||
new_migrate = New Migration
|
||||
new_org = New Organization
|
||||
manage_org = Manage Organizations
|
||||
admin_panel = Admin Panel
|
||||
account_settings = Account Settings
|
||||
settings = Settings
|
||||
|
||||
news_feed = News Feed
|
||||
pull_requests = Pull Requests
|
||||
issues = Issues
|
||||
|
||||
cancel = Cancel
|
||||
|
||||
[install]
|
||||
install = Installation
|
||||
title = Install Steps For First-time Run
|
||||
requite_db_desc = Gogs requires MySQL, PostgreSQL or SQLite3, but SQLite3 is usually available in the official binary version.
|
||||
db_type = Database Type
|
||||
host = Host
|
||||
user = User
|
||||
password = Password
|
||||
db_name = Database Name
|
||||
db_helper = Please use INNODB engine with utf8_general_ci charset for MySQL.
|
||||
ssl_mode = SSL Mode
|
||||
path = Path
|
||||
sqlite_helper = The file path of SQLite3 database.
|
||||
general_title = General Settings of Gogs
|
||||
repo_path = Repository Root Path
|
||||
repo_path_helper = All Git remote repositories will be saved to this directory.
|
||||
run_user = Run User
|
||||
run_user_helper = The user must have access to Repository Root Path and run Gogs.
|
||||
domain = Domain
|
||||
domain_helper = This affects SSH clone URLs.
|
||||
app_url = Application URL
|
||||
app_url_helper = This affects HTTP/HTTPS clone URL and somewhere in e-mail.
|
||||
email_title = Email Service Settings(Optional)
|
||||
smtp_host = SMTP Host
|
||||
mailer_user = Sender E-mail
|
||||
mailer_password = Sender Password
|
||||
notify_title = Notification Settings(Optional)
|
||||
register_confirm = Enable Register Confirmation
|
||||
mail_notify = Enable Mail Notification
|
||||
admin_title = Admin Account Settings
|
||||
admin_name = Username
|
||||
admin_password = Password
|
||||
confirm_password = Confirm Password
|
||||
admin_email = E-mail
|
||||
install_gogs = Install Gogs
|
||||
test_git_failed = Fail to test 'git' command: %v
|
||||
sqlite3_not_available = Your release version does not support SQLite3, please download the official binary version from http://gogs.io/docs/installation/install_from_binary.html, NOT the gobuild version.
|
||||
invalid_db_setting = Database setting is not correct: %v
|
||||
invalid_repo_path = Repository root path is invalid: %v
|
||||
run_user_not_match = Run user isn't the current user: %s -> %s
|
||||
save_config_failed = Fail to save configuration: %v
|
||||
invalid_admin_setting = Admin account setting is invalid: %v
|
||||
install_success = Welcome! We're glad that you choose Gogs, have fun and take care.
|
||||
|
||||
[home]
|
||||
uname_holder = Username or E-mail
|
||||
password_holder = Password
|
||||
switch_dashboard_context = Switch Dashboard Context
|
||||
my_repos = My Repositories
|
||||
collaborative_repos = Collaborative Repositories
|
||||
my_orgs = My Organizations
|
||||
my_mirrors = My Mirrors
|
||||
|
||||
[explore]
|
||||
repos = Repositories
|
||||
|
||||
[auth]
|
||||
create_new_account = Create New Account
|
||||
register_hepler_msg = Already have an account? Sign in now!
|
||||
social_register_hepler_msg = Already have an account? Bind now!
|
||||
disable_register_prompt = Sorry, registration has been disabled. Please contact the site administrator.
|
||||
disable_register_mail = Sorry, Register Mail Confirmation has been disabled.
|
||||
remember_me = Remember Me
|
||||
forgot_password= Forgot Password
|
||||
forget_password = Forgot password?
|
||||
sign_up_now = Need an account? Sign up now.
|
||||
confirmation_mail_sent_prompt = A new confirmation e-mail has been sent to <b>%s</b>, please check your inbox within the next %d hours to complete your registration.
|
||||
sign_in_email = Sign in to your e-mail
|
||||
active_your_account = Activate Your Account
|
||||
resent_limit_prompt = Sorry, you are sending an activation e-mail too frequently. Please wait 3 minutes.
|
||||
has_unconfirmed_mail = Hi %s, you have an unconfirmed email address(<b>%s</b>). If you haven't received a confirmation e-mail or need to resend a new one, please click on the button below.
|
||||
resend_mail = Click here to resend your activation e-mail
|
||||
email_not_associate = This e-mail address does not associate to any account.
|
||||
send_reset_mail = Click here to (re)send your password reset e-mail
|
||||
reset_password = Reset Your Password
|
||||
invalid_code = Sorry, your confirmation code has expired or not valid.
|
||||
reset_password_helper = Click here to reset your password
|
||||
password_too_short = Password length cannot be less then 6.
|
||||
|
||||
[form]
|
||||
UserName = Username
|
||||
RepoName = Repository name
|
||||
Email = E-mail address
|
||||
Password = Password
|
||||
Retype = Re-type password
|
||||
SSHTitle = SSH key name
|
||||
HttpsUrl = HTTPS URL
|
||||
PayloadUrl = Payload URL
|
||||
TeamName = Team name
|
||||
AuthName = Authorization name
|
||||
AdminEmail = Admin E-mail
|
||||
|
||||
require_error = ` cannot be empty.`
|
||||
alpha_dash_error = ` must be valid alpha or numeric or dash(-_) characters.`
|
||||
alpha_dash_dot_error = ` must be valid alpha or numeric or dash(-_) or dot characters.`
|
||||
min_size_error = ` must contain at least %s characters.`
|
||||
max_size_error = ` must contain at most %s characters.`
|
||||
email_error = ` is not a valid e-mail address.`
|
||||
url_error = ` is not a valid URL.`
|
||||
unknown_error = Unknown error:
|
||||
captcha_incorrect = Captcha didn't match.
|
||||
password_not_match = Password and confirm password are not same.
|
||||
|
||||
username_been_taken = Username has been already taken.
|
||||
repo_name_been_taken = Repository name has been already taken.
|
||||
org_name_been_taken = Organization name has been already taken.
|
||||
team_name_been_taken = Team name has been already taken.
|
||||
email_been_used = E-mail address has been already used.
|
||||
ssh_key_been_used = Public key name has been used.
|
||||
illegal_username = Your username contains illegal characters.
|
||||
illegal_repo_name = Repository name contains illegal characters.
|
||||
illegal_org_name = Organization name contains illegal characters.
|
||||
illegal_team_name = Team name contains illegal characters.
|
||||
username_password_incorrect = Username or password is not correct.
|
||||
enterred_invalid_repo_name = Please make sure you entered repository name is correct.
|
||||
enterred_invalid_owner_name = Please make sure you entered owner name is correct.
|
||||
enterred_invalid_password = Please make sure you entered password is correct.
|
||||
user_not_exist = Given user does not exist.
|
||||
last_org_owner = The user to remove is the last member in owner team. There must be another owner.
|
||||
|
||||
invalid_ssh_key = Sorry, we're not able to verify your SSH key: %s
|
||||
auth_failed = Authentication failed: %v
|
||||
|
||||
still_own_repo = Your account still have ownership of repository, you have to delete or transfer them first.
|
||||
org_still_own_repo = This organization still have ownership of repository, you have to delete or transfer them first.
|
||||
|
||||
still_own_user = This authentication still has used by some users, you should move them and then delete again.
|
||||
|
||||
[settings]
|
||||
profile = Profile
|
||||
password = Password
|
||||
ssh_keys = SSH Keys
|
||||
social = Social Accounts
|
||||
orgs = Organizations
|
||||
delete = Delete Account
|
||||
uid = Uid
|
||||
|
||||
public_profile = Public Profile
|
||||
profile_desc = Your Email address is public and will be used for any account related notifications, and any web based operations made via the site.
|
||||
full_name = Full Name
|
||||
website = Website
|
||||
location = Location
|
||||
update_profile = Update Profile
|
||||
update_profile_success = Your profile has been successfully updated.
|
||||
|
||||
change_password = Change Password
|
||||
old_password = Current Password
|
||||
new_password = New Password
|
||||
password_incorrect = Current password is not correct.
|
||||
change_password_success = Password is changed successfully. You can now sign in via new password.
|
||||
|
||||
manage_ssh_keys = Manage SSH Keys
|
||||
add_key = Add Key
|
||||
ssh_desc = This is a list of SSH keys associated with your account. Remove any keys that you do not recognize.
|
||||
ssh_helper = <strong>Need help?</strong> Check out our guide to <a href="https://help.github.com/articles/generating-ssh-keys">generating SSH keys</a> or troubleshoot <a href="https://help.github.com/ssh-issues/">common SSH Problems</a>.
|
||||
add_new_key = Add SSH Key
|
||||
key_name = Key Name
|
||||
key_content = Content
|
||||
add_key_success = New SSH Key has been added!
|
||||
delete_key = Delete
|
||||
add_on = Added on
|
||||
last_used = Last used on
|
||||
no_activity = No recent activity
|
||||
|
||||
manage_social = Manage Associated Social Accounts
|
||||
social_desc = This is a list of associated social accounts. Remove any binding that you do not recognize.
|
||||
unbind = Unbind
|
||||
unbind_success = Social account has been unbound.
|
||||
|
||||
delete_account = Delete Your Account
|
||||
delete_prompt = The operation will delete your account permanently, and <strong>CANNOT</strong> be undone!
|
||||
confirm_delete_account = Confirm Deletion
|
||||
|
||||
[repo]
|
||||
owner = Owner
|
||||
repo_name = Repository Name
|
||||
repo_name_helper = Great repository names are short, memorable and <strong>unique</strong>.
|
||||
visibility = Visibility
|
||||
visiblity_helper = This repository is <span class="label label-red label-radius">Private</span>
|
||||
repo_desc = Description
|
||||
repo_lang = Language
|
||||
repo_lang_helper = Select a .gitignore file
|
||||
license = License
|
||||
license_helper = Select a license file
|
||||
init_readme = Initialize this repository with a README.md
|
||||
create_repo = Create Repository
|
||||
default_branch = Default Branch
|
||||
mirror_interval = Mirror Interval(hour)
|
||||
goget_meta = Go-Get Meta
|
||||
goget_meta_helper = This repository will be <span class="label label-blue label-radius">Go-Getable</span>
|
||||
|
||||
need_auth = Need Authorization
|
||||
migrate_type = Migration Type
|
||||
migrate_type_helper = This repository will be a <span class="label label-blue label-radius">Mirror</span>
|
||||
migrate_repo = Migrate Repository
|
||||
|
||||
copy_link = Copy
|
||||
clone_helper = Need help cloning? Visit <a target="_blank" href="http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository">Help</a>!
|
||||
unwatch = Unwatch
|
||||
watch = Watch
|
||||
unstar = Unstar
|
||||
star = Star
|
||||
fork = Fork
|
||||
|
||||
quick_guide = Quick Guide
|
||||
clone_this_repo = Clone this repository
|
||||
create_new_repo_command = Create a new repository on the command line
|
||||
push_exist_repo = Push an existing repository from the command line
|
||||
|
||||
settings = Settings
|
||||
settings.options = Options
|
||||
settings.collaboration = Collaboration
|
||||
settings.hooks = Webhooks
|
||||
settings.deploy_keys = Deploy Keys
|
||||
settings.basic_settings = Basic Settings
|
||||
settings.danger_zone = Danger Zone
|
||||
settings.site = Official Site
|
||||
settings.update_settings = Update Settings
|
||||
settings.transfer = Transfer Ownership
|
||||
settings.transfer_desc = Transfer this repo to another user or to an organization where you have admin rights.
|
||||
settings.new_owner_has_same_repo = New owner already has a repository with same name.
|
||||
settings.delete = Delete This Repository
|
||||
settings.delete_desc = Once you delete a repository, there is no going back. Please be certain.
|
||||
settings.update_settings_success = Repository options has been successfully updated.
|
||||
settings.transfer_owner = New Owner
|
||||
settings.make_transfer = Make Transfer
|
||||
settings.confirm_delete = Confirm Deletion
|
||||
settings.add_collaborator = Add New Collaborator
|
||||
settings.add_collaborator_success = New collaborator has been added.
|
||||
settings.remove_collaborator_success = Collaborator has been removed.
|
||||
settings.add_webhook = Add Webhook
|
||||
settings.hooks_desc = Webhooks allow external services to be notified when certain events happen on Gogs. When the specified events happen, we'll send a POST request to each of the URLs you provide. Learn more in our <a target="_blank" href="http://gogs.io/docs/features/webhook.html">Webhooks Guide</a>.
|
||||
settings.remove_hook_success = Webhook has been removed.
|
||||
settings.add_webhook_desc = We’ll send a <code>POST</code> request to the URL below with details of any subscribed events. You can also specify which data format you'd like to receive (JSON, <code>x-www-form-urlencoded</code>, <em>etc</em>). More information can be found in <a target="_blank" href="http://gogs.io/docs/features/webhook.html">Webhooks Guide</a>.
|
||||
settings.payload_url = Payload URL
|
||||
settings.content_type = Content Type
|
||||
settings.secret = Secret
|
||||
settings.event_desc = Which events would you like to trigger this webhook?
|
||||
settings.event_push_only = Just the <code>push</code> event.
|
||||
settings.active = Active
|
||||
settings.active_helper = We will deliver event details when this hook is triggered.
|
||||
settings.add_hook_success = New webhook has been added.
|
||||
settings.update_webhook = Update Webhook
|
||||
settings.update_hook_success = Webhook has been updated.
|
||||
settings.delete_webhook = Delete Webhook
|
||||
settings.recent_deliveries = Recent Deliveries
|
||||
settings.hook_type = Hook Type
|
||||
settings.add_slack_hook_desc = Add <a href="http://slack.com">Slack</a> integration to your repository.
|
||||
settings.slack_token = Token
|
||||
settings.slack_domain = Domain
|
||||
settings.slack_channel = Channel
|
||||
|
||||
[org]
|
||||
org_name_holder = Organization Name
|
||||
org_name_helper = Great organization names are short and memorable.
|
||||
org_email_helper = Organization's Email receives all notifications and confirmations.
|
||||
create_org = Create Organization
|
||||
repo_updated = Updated
|
||||
people = People
|
||||
invite_someone = Invite Someone
|
||||
teams = Teams
|
||||
lower_members = members
|
||||
lower_repositories = repositories
|
||||
create_new_team = Create New Team
|
||||
org_desc = Description
|
||||
team_name = Team Name
|
||||
team_desc = Description
|
||||
team_name_helper = You'll use this name to mention this team in conversations.
|
||||
team_desc_helper = What is this team all about?
|
||||
team_permission_desc = What permission level should this team have?
|
||||
|
||||
settings = Settings
|
||||
settings.options = Options
|
||||
settings.full_name = Full Name
|
||||
settings.website = Website
|
||||
settings.location = Location
|
||||
settings.update_settings = Update Settings
|
||||
settings.update_setting_success = Organization setting has been successfully updated.
|
||||
settings.delete = Delete Organization
|
||||
settings.delete_account = Delete This Organization
|
||||
settings.delete_prompt = The operation will delete this organization permanently, and <strong>CANNOT</strong> be undone!
|
||||
settings.confirm_delete_account = Confirm Deletion
|
||||
settings.hooks_desc = Add webhooks that will be triggered for <strong>all repositories</strong> under this organization.
|
||||
|
||||
members.public = Public
|
||||
members.public_helper = make private
|
||||
members.private = Private
|
||||
members.private_helper = make public
|
||||
members.owner = Owner
|
||||
members.member = Member
|
||||
members.conceal = Conceal
|
||||
members.remove = Remove
|
||||
members.leave = Leave
|
||||
members.invite_desc = Start typing a username to invite a new member to %s:
|
||||
members.invite_now = Invite Now
|
||||
|
||||
teams.join = Join
|
||||
teams.leave = Leave
|
||||
teams.read_access = Read Access
|
||||
teams.read_access_helper = This team will be able to view and clone its repositories.
|
||||
teams.write_access = Write Access
|
||||
teams.write_access_helper = This team will be able to read its repositories, as well as push to them.
|
||||
teams.admin_access = Admin Access
|
||||
teams.admin_access_helper = This team will be able to push/pull to its repositories, as well as add other collaborators to them.
|
||||
teams.no_desc = This team has no description
|
||||
teams.settings = Settings
|
||||
teams.owners_permission_desc = Owners have full access to <strong>all repositories</strong> and have <strong>admin rights</strong> to the organization.
|
||||
teams.members = Team Members
|
||||
teams.update_settings = Update Settings
|
||||
teams.delete_team = Delete This Team
|
||||
teams.add_team_member = Add Team Member
|
||||
teams.delete_team_success = Given team has been successfully deleted.
|
||||
teams.read_permission_desc = This team grants <strong>Read</strong> access: members can view and clone the team's repositories.
|
||||
teams.write_permission_desc = This team grants <strong>Write</strong> access: members can read from and push to the team's repositories.
|
||||
teams.admin_permission_desc = This team grants <strong>Admin</strong> access: members can read from, push to, and add collaborators to the team's repositories.
|
||||
teams.repositories = Team Repositories
|
||||
teams.add_team_repository = Add Team Repository
|
||||
teams.remove_repo = Remove
|
||||
|
||||
[admin]
|
||||
dashboard = Dashboard
|
||||
users = Users
|
||||
organizations = Organizations
|
||||
repositories = Repositories
|
||||
authentication = Authentications
|
||||
config = Configuration
|
||||
monitor = Monitoring
|
||||
prev = Prev.
|
||||
next = Next
|
||||
|
||||
dashboard.statistic = Statistic
|
||||
dashboard.operations = Operations
|
||||
dashboard.system_status = System Monitor Status
|
||||
dashboard.statistic_info = Gogs database has <b>%d</b> users, <b>%d</b> organizations, <b>%d</b> public keys, <b>%d</b> repositories, <b>%d</b> watches, <b>%d</b> stars, <b>%d</b> actions, <b>%d</b> accesses, <b>%d</b> issues, <b>%d</b> comments, <b>%d</b> social accounts, <b>%d</b> follows, <b>%d</b> mirrors, <b>%d</b> releases, <b>%d</b> login sources, <b>%d</b> webhooks, <b>%d</b> milestones, <b>%d</b> labels, <b>%d</b> hook tasks, <b>%d</b> teams, <b>%d</b> update tasks, <b>%d</b> attachments.
|
||||
dashboard.operation_name = Operation Name
|
||||
dashboard.operation_switch = Switch
|
||||
dashboard.operation_run = Run
|
||||
dashboard.clean_unbind_oauth = Clean unbound OAuthes
|
||||
dashboard.delete_inactivate_accounts = Delete all inactive accounts
|
||||
dashboard.server_uptime = Server Uptime
|
||||
dashboard.current_goroutine = Current Goroutines
|
||||
dashboard.current_memory_usage = Current Memory Usage
|
||||
dashboard.total_memory_allocated = Total Memory Allocated
|
||||
dashboard.memory_obtained = Memory Obtained
|
||||
dashboard.pointer_lookup_times = Pointer Lookup Times
|
||||
dashboard.memory_allocate_times = Memory Allocate Times
|
||||
dashboard.memory_free_times = Memory Free Times
|
||||
dashboard.current_heap_usage = Current Heap Usage
|
||||
dashboard.heap_memory_obtained = Heap Memory Obtained
|
||||
dashboard.heap_memory_idle = Heap Memory Idle
|
||||
dashboard.heap_memory_in_use = Heap Memory In Use
|
||||
dashboard.heap_memory_released = Heap Memory Released
|
||||
dashboard.heap_objects = Heap Objects
|
||||
dashboard.bootstrap_stack_usage = Bootstrap Stack Usage
|
||||
dashboard.stack_memory_obtained = Stack Memory Obtained
|
||||
dashboard.mspan_structures_usage = MSpan Structures Usage
|
||||
dashboard.mspan_structures_obtained = MSpan Structures Obtained
|
||||
dashboard.mcache_structures_usage = MCache Structures Usage
|
||||
dashboard.mcache_structures_obtained = MCache Structures Obtained
|
||||
dashboard.profiling_bucket_hash_table_obtained = Profiling Bucket Hash Table Obtained
|
||||
dashboard.gc_metadata_obtained = GC Metadada Obtained
|
||||
dashboard.other_system_allocation_obtained = Other System Allocation Obtained
|
||||
dashboard.next_gc_recycle = Next GC Recycle
|
||||
dashboard.last_gc_time = Since Last GC Time
|
||||
dashboard.total_gc_time = Total GC Pause
|
||||
dashboard.total_gc_pause = Total GC Pause
|
||||
dashboard.last_gc_pause = Last GC Pause
|
||||
dashboard.gc_times = GC Times
|
||||
|
||||
users.user_manage_panel = User Manage Panel
|
||||
users.new_account = Create New Account
|
||||
users.name = Name
|
||||
users.activated = Activated
|
||||
users.admin = Admin
|
||||
users.repos = Repos
|
||||
users.created = Created
|
||||
users.edit = Edit
|
||||
users.auth_source = Authorization Source
|
||||
users.local = Local
|
||||
users.auth_login_name = Authorization Login Name
|
||||
users.update_profile_success = Account profile has been successfully updated.
|
||||
users.edit_account = Edit Account
|
||||
users.is_activated = This account is activated
|
||||
users.is_admin = This account has administrator permissions
|
||||
users.update_profile = Update Account Profile
|
||||
users.delete_account = Delete This Account
|
||||
users.still_own_repo = This account still have ownership of repository, you have to delete or transfer them first.
|
||||
|
||||
orgs.org_manage_panel = Organization Manage Panel
|
||||
orgs.name = Name
|
||||
orgs.teams = Teams
|
||||
orgs.members = Members
|
||||
|
||||
repos.repo_manage_panel = Repository Manage Panel
|
||||
repos.owner = Owner
|
||||
repos.name = Name
|
||||
repos.private = Private
|
||||
repos.watches = Watches
|
||||
repos.stars = Stars
|
||||
repos.issues = Issues
|
||||
|
||||
auths.auth_manage_panel = Authorization Manage Panel
|
||||
auths.new = Add New Authorization Source
|
||||
auths.name = Name
|
||||
auths.type = Type
|
||||
auths.enabled = Enabled
|
||||
auths.updated = Updated
|
||||
auths.auth_type = Authorization Type
|
||||
auths.auth_name = Authorization Name
|
||||
auths.domain = Domain
|
||||
auths.host = Host
|
||||
auths.port = Port
|
||||
auths.base_dn = Base DN
|
||||
auths.attributes = Search Attributes
|
||||
auths.filter = Search Filter
|
||||
auths.ms_ad_sa = Ms Ad SA
|
||||
auths.smtp_auth = SMTP Authorization Type
|
||||
auths.smtphost = SMTP Host
|
||||
auths.smtpport = SMTP Port
|
||||
auths.enable_tls = Enable TLS Encryption
|
||||
auths.enable_auto_register = Enable Auto Registration
|
||||
auths.tips = Tips
|
||||
auths.edit = Edit Authorization Setting
|
||||
auths.activated = This authentication has activated
|
||||
auths.update_success = Authorization setting has been successfully updated.
|
||||
auths.update = Update Authorization Setting
|
||||
auths.delete = Delete This Authorization
|
||||
|
||||
config.server_config = Server Configuration
|
||||
config.app_name = Application Name
|
||||
config.app_ver = Application Version
|
||||
config.app_url = Application URL
|
||||
config.domain = Domain
|
||||
config.offline_mode = Offline Mode
|
||||
config.disable_router_log = Disable Router Log
|
||||
config.run_user = Run User
|
||||
config.run_mode = Run Mode
|
||||
config.repo_root_path = Repository Root Path
|
||||
config.static_file_root_path = Static File Root Path
|
||||
config.log_file_root_path = Log File Root Path
|
||||
config.script_type = Script Type
|
||||
config.reverse_auth_user = Reverse Authentication User
|
||||
config.db_config = Database Configuration
|
||||
config.db_type = Type
|
||||
config.db_host = Host
|
||||
config.db_name = Name
|
||||
config.db_user = User
|
||||
config.db_ssl_mode = SSL Mode
|
||||
config.db_ssl_mode_helper = (for "postgres" only)
|
||||
config.db_path = Path
|
||||
config.db_path_helper = (for "sqlite3" only)
|
||||
config.service_config = Service Configuration
|
||||
config.register_email_confirm = Register Email Confirmation
|
||||
config.disable_register = Disable Registration
|
||||
config.require_sign_in_view = Require Sign In View
|
||||
config.mail_notify = Mail Notification
|
||||
config.enable_cache_avatar = Enable Cache Avatar
|
||||
config.active_code_lives = Active Code Lives
|
||||
config.reset_password_code_lives = Reset Password Code Lives
|
||||
config.webhook_config = Webhook Configuration
|
||||
config.task_interval = Task Interval
|
||||
config.deliver_timeout = Deliver Timeout
|
||||
config.mailer_config = Mailer Configuration
|
||||
config.mailer_enabled = Enabled
|
||||
config.mailer_name = Name
|
||||
config.mailer_host = Host
|
||||
config.mailer_user = User
|
||||
config.oauth_config = OAuth Configuration
|
||||
config.oauth_enabled = Enabled
|
||||
config.cache_config = Cache Configuration
|
||||
config.cache_adapter = Cache Adapter
|
||||
config.cache_interval = Cache Interval
|
||||
config.cache_conn = Cache Connection
|
||||
config.session_config = Session Configuration
|
||||
config.session_provider = Session Provider
|
||||
config.provider_config = Provider Config
|
||||
config.cookie_name = Cookie Name
|
||||
config.enable_set_cookie = Enable Set Cookie
|
||||
config.gc_interval_time = GC Interval Time
|
||||
config.session_life_time = Session Life Time
|
||||
config.https_only = HTTPS Only
|
||||
config.cookie_life_time = Cookie Life Time
|
||||
config.session_hash_function = Session ID Hash Function
|
||||
config.session_hash_key = Session ID Hash Key
|
||||
config.picture_config = Picture Configuration
|
||||
config.picture_service = Picture Service
|
||||
config.disable_gravatar = Disable Gravatar
|
||||
config.log_config = Log Configuration
|
||||
config.log_mode = Log Mode
|
||||
|
||||
monitor.cron = Cron Tasks
|
||||
monitor.name = Name
|
||||
monitor.schedule = Schedule
|
||||
monitor.next = Next Time
|
||||
monitor.previous = Previous Time
|
||||
monitor.execute_times = Execute Times
|
||||
monitor.process = Running Processes
|
||||
monitor.desc = Description
|
||||
monitor.start = Start Time
|
||||
monitor.execute_time = Execution Time
|
||||
|
||||
[action]
|
||||
create_repo = created repository <a href="/%s">%s</a>
|
||||
commit_repo = pushed to <a href="/%s/src/%s">%s</a> at <a href="/%s">%s</a>
|
||||
create_issue = opened issue <a href="/%s/issues/%s">%s#%s</a>
|
||||
comment_issue = commented on issue <a href="/%s/issues/%s">%s#%s</a>
|
||||
|
||||
[tool]
|
||||
ago = ago
|
||||
from_now = from now
|
||||
now = now
|
||||
1s = 1 second %s
|
||||
1m = 1 minute %s
|
||||
1h = 1 hour %s
|
||||
1d = 1 day %s
|
||||
1w = 1 week %s
|
||||
1mon = 1 month %s
|
||||
1y = 1 year %s
|
||||
seconds = %d seconds %s
|
||||
minutes = %d minutes %s
|
||||
hours = %d hours %s
|
||||
days = %d days %s
|
||||
weeks = %d weeks %s
|
||||
months = %d months %s
|
||||
years = %d years %s
|
||||
raw_seconds = seconds
|
||||
raw_minutes = minutes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
577
conf/locale/locale_zh-CN.ini
Normal file
577
conf/locale/locale_zh-CN.ini
Normal file
@@ -0,0 +1,577 @@
|
||||
app_desc = 基于 Go 语言的自助 Git 服务
|
||||
|
||||
home = 首页
|
||||
dashboard = 控制面板
|
||||
explore = 探索
|
||||
help = 帮助
|
||||
sign_in = 登录
|
||||
social_sign_in = 社交帐号登录:第 2 步 <small>关联帐号</small>
|
||||
sign_out = 退出
|
||||
sign_up = 注册
|
||||
register = 注册
|
||||
website = 官方网站
|
||||
version = 当前版本
|
||||
page = 页面
|
||||
template = 模板
|
||||
language = 语言选项
|
||||
|
||||
username = 用户名
|
||||
email = 邮箱
|
||||
password = 密码
|
||||
re_type = 确认密码
|
||||
captcha = 验证码
|
||||
|
||||
repository = 仓库
|
||||
organization = 组织
|
||||
mirror = 镜像
|
||||
new_repo = 创建新的仓库
|
||||
new_migrate = 迁移外部仓库
|
||||
new_org = 创建新的组织
|
||||
manage_org = 管理我的组织
|
||||
admin_panel = 管理面板
|
||||
account_settings = 帐户设置
|
||||
settings = 帐户设置
|
||||
|
||||
news_feed = 最新活动
|
||||
pull_requests = 合并请求
|
||||
issues = 工单管理
|
||||
|
||||
cancel = 取消
|
||||
|
||||
[install]
|
||||
install = 安装页面
|
||||
title = 首次运行安装程序
|
||||
requite_db_desc = Gogs 允许后端数据库为 MySQL、PostgreSQL 或 SQLite3,但是 SQLite3 一般只有官方二进制发行版才支持。
|
||||
db_type = 数据库类型
|
||||
host = 数据库主机
|
||||
user = 数据库用户
|
||||
password = 数据库用户密码
|
||||
db_name = 数据库名称
|
||||
db_helper = 如果您使用 MySQL,请使用 INNODB 引擎以及 utf8_general_ci 字符集。
|
||||
ssl_mode = SSL 模式
|
||||
path = 数据库文件路径
|
||||
sqlite_helper = SQLite3 数据库的文件路径。
|
||||
general_title = 应用基本设置
|
||||
repo_path = 仓库根目录
|
||||
repo_path_helper = 所有 Git 远程仓库都将被存放于该目录。
|
||||
run_user = 运行系统用户
|
||||
run_user_helper = 该用户必须具有对仓库根目录和运行 Gogs 的操作权限。
|
||||
domain = 域名
|
||||
domain_helper = 该设置影响 SSH 克隆地址。
|
||||
app_url = 应用 URL
|
||||
app_url_helper = 该设置影响 HTTP/HTTPS 克隆地址和一些邮箱中的链接。
|
||||
email_title = 邮件服务设置(可选)
|
||||
smtp_host = SMTP 主机
|
||||
mailer_user = 发送邮箱
|
||||
mailer_password = 发送邮箱密码
|
||||
notify_title = 通知提醒设置(可选)
|
||||
register_confirm = 启用注册邮箱确认
|
||||
mail_notify = 启用邮件通知提醒
|
||||
admin_title = 管理员帐号设置
|
||||
admin_name = 管理员用户名
|
||||
admin_password = 管理员密码
|
||||
confirm_password = 确认密码
|
||||
admin_email = 管理员邮箱
|
||||
install_gogs = 立即安装
|
||||
test_git_failed = 无法识别 'git' 命令:%v
|
||||
sqlite3_not_available = 您所使用的发行版不支持 SQLite3,请从 http://gogs.io/docs/installation/install_from_binary.html 下载官方二进制发行版,而不是 gobuild 版本。
|
||||
invalid_db_setting = 数据库设置不正确:%v
|
||||
invalid_repo_path = 仓库根目录设置不正确:%v
|
||||
run_user_not_match = 运行系统用户非当前用户:%s -> %s
|
||||
save_config_failed = 应用配置保存失败:%v
|
||||
invalid_admin_setting = 管理员帐户设置不正确:%v
|
||||
install_success = 您好!我们很高兴您选择使用 Gogs,祝您使用愉快,代码从此无 BUG!
|
||||
|
||||
[home]
|
||||
uname_holder = 用户名或邮箱
|
||||
password_holder = 密码
|
||||
switch_dashboard_context = 切换控制面板用户
|
||||
my_repos = 我的仓库
|
||||
collaborative_repos = 参与协作的仓库
|
||||
my_orgs = 我的组织
|
||||
my_mirrors = 我的镜像
|
||||
|
||||
[explore]
|
||||
repos = 探索仓库
|
||||
|
||||
[auth]
|
||||
create_new_account = 创建帐户
|
||||
register_hepler_msg = 已经注册?立即登录!
|
||||
social_register_hepler_msg = 已经注册?立即绑定!
|
||||
disable_register_prompt = 对不起,注册功能已被关闭。请联系网站管理员。
|
||||
disable_register_mail = 对不起,注册邮箱确认功能已被关闭。
|
||||
remember_me = 记住登录
|
||||
forgot_password = 忘记密码
|
||||
forget_password = 忘记密码?
|
||||
sign_up_now = 还没帐户?马上注册。
|
||||
confirmation_mail_sent_prompt = 一封新的确认邮件已经被发送至 <b>%s</b>,请检查您的收件箱并在 %d 小时内完成确认注册操作。
|
||||
sign_in_email = 登录到您的邮箱
|
||||
active_your_account = 激活您的帐户
|
||||
resent_limit_prompt = 对不起,您请求发送激活邮件过于频繁,请等待 3 分钟后再试!
|
||||
has_unconfirmed_mail = %s 您好,系统检测到您有一封发送至 <b>%s</b> 但未被确认的邮件。如果您未收到激活邮件,或需要重新发送,请单击下方的按钮。
|
||||
resend_mail = 单击此处重新发送确认邮件
|
||||
email_not_associate = 您输入的邮箱地址未被关联到任何帐号!
|
||||
send_reset_mail = 单击此处(重新)发送您的密码重置邮件
|
||||
reset_password = 重置密码
|
||||
invalid_code = 对不起,您的确认代码已过期或已失效。
|
||||
reset_password_helper = 单击此处重置密码
|
||||
password_too_short = 密码长度不能少于 6 位!
|
||||
|
||||
[form]
|
||||
UserName = 用户名
|
||||
RepoName = 仓库名称
|
||||
Email = 邮箱地址
|
||||
Password = 密码
|
||||
Retype = 确认密码
|
||||
SSHTitle = SSH 密钥名称
|
||||
HttpsUrl = HTTPS URL 地址
|
||||
PayloadUrl = 推送地址
|
||||
TeamName = 团队名称
|
||||
AuthName = 认证名称
|
||||
AdminEmail = 管理员邮箱
|
||||
|
||||
require_error = 不能为空。
|
||||
alpha_dash_error = 必须为英文字母、阿拉伯数字或横线(-_)。
|
||||
alpha_dash_dot_error = 必须为英文字母、阿拉伯数字、横线(-_)或点。
|
||||
min_size_error = 长度最小为 %s 个字符。
|
||||
max_size_error = 长度最大为 %s 个字符。
|
||||
email_error = 不是一个有效的邮箱地址。
|
||||
url_error = 不是一个有效的 URL。
|
||||
unknown_error = 未知错误:
|
||||
captcha_incorrect = 验证码未匹配。
|
||||
password_not_match = 密码与确认密码未匹配。
|
||||
|
||||
username_been_taken = 用户名已经被占用。
|
||||
repo_name_been_taken = 仓库名称已经被占用。
|
||||
org_name_been_taken = 组织名称已经被占用。
|
||||
team_name_been_taken = 团队名称已经被占用。
|
||||
email_been_used = 邮箱地址已经被使用。
|
||||
ssh_key_been_used = SSH 密钥已经被使用。
|
||||
illegal_username = 您的用户名包含非法字符。
|
||||
illegal_repo_name = 仓库名称包含非法字符。
|
||||
illegal_org_name = 组织名称包含非法字符。
|
||||
illegal_team_name = 团队名称包含非法字符。
|
||||
username_password_incorrect = 用户名或密码不正确。
|
||||
enterred_invalid_repo_name = 请检查您输入的仓库名称是正确。
|
||||
enterred_invalid_owner_name = 请检查您输入的新所有者用户名是否正确。
|
||||
enterred_invalid_password = 请检查您输入的密码是否正确。
|
||||
user_not_exist = 被操作的用户不存在!
|
||||
last_org_owner = 被移除用户为最后一位管理员。请添加一位新的管理员再进行移除成员操作!
|
||||
|
||||
invalid_ssh_key = 很抱歉,我们无法验证您输入的 SSH 密钥:%s
|
||||
auth_failed = 授权验证失败:%v
|
||||
|
||||
still_own_repo = 您的帐户仍然是某些仓库的拥有者,您必须先转移或删除它们才能执行删除帐户操作!
|
||||
org_still_own_repo = 该组织仍然是某些仓库的拥有者,您必须先转移或删除它们才能执行删除组织操作!
|
||||
|
||||
still_own_user = 该授权认证依旧被部分用户使用,请先删除该部分用户后再试!
|
||||
|
||||
[settings]
|
||||
profile = 个人信息
|
||||
password = 修改密码
|
||||
ssh_keys = 管理 SSH 密钥
|
||||
social = 社交帐号绑定
|
||||
orgs = 管理组织
|
||||
delete = 删除帐户
|
||||
uid = 用户 ID
|
||||
|
||||
public_profile = 公开信息
|
||||
profile_desc = 您的邮箱地址将会被公开,并被用于接收帐户的所有提醒和通知。
|
||||
full_name = 自定义名称
|
||||
website = 个人网站
|
||||
location = 所在地区
|
||||
update_profile = 更新信息
|
||||
update_profile_success = 您的个人信息更新成功!
|
||||
|
||||
change_password = 修改密码
|
||||
old_password = 当前密码
|
||||
new_password = 新的密码
|
||||
password_incorrect = 当前密码不正确!
|
||||
change_password_success = 密码修改成功!您现在可以使用新的密码登录。
|
||||
|
||||
manage_ssh_keys = 管理 SSH 密钥
|
||||
add_key = 增加密钥
|
||||
ssh_desc = 以下是与您帐户所关联的 SSH 密钥,如果您发现有陌生的密钥,请立即删除它!
|
||||
ssh_helper = <strong>需要帮助?</strong> 请查看有关 <a href="https://help.github.com/articles/generating-ssh-keys">如何生成 SSH 密钥</a> 或 <a href="https://help.github.com/ssh-issues/">常见 SSH 问题</a> 寻找答案。
|
||||
add_new_key = 增加 SSH 密钥
|
||||
key_name = 密钥名称
|
||||
key_content = 密钥内容
|
||||
add_key_success = 新的 SSH 密钥添加成功!
|
||||
delete_key = 删除
|
||||
add_on = 增加于
|
||||
last_used = 上次使用在
|
||||
no_activity = 没有最近活动
|
||||
|
||||
manage_social = 管理关联社交帐户
|
||||
social_desc = 以下是与您帐户所关联的社交帐号,如果您发现有陌生的关联,请立即解除绑定!
|
||||
unbind = 解除绑定
|
||||
unbind_success = 社交帐号解除绑定成功!
|
||||
|
||||
delete_account = 删除当前帐户
|
||||
delete_prompt = 删除操作会永久清除您的帐户信息,并且 <strong>不可恢复</strong>!
|
||||
confirm_delete_account = 确认删除帐户
|
||||
|
||||
[repo]
|
||||
owner = 拥有者
|
||||
repo_name = 仓库名称
|
||||
repo_name_helper = 伟大的仓库名称一般都较短、令人深刻并且 <strong>独一无二</strong> 的。
|
||||
visibility = 可见性
|
||||
visiblity_helper = 本仓库将是 <span class="label label-red label-radius">私有的</span>
|
||||
repo_desc = 仓库描述
|
||||
repo_lang = 仓库语言
|
||||
repo_lang_helper = 请选择 .gitignore 文件
|
||||
license = 授权许可
|
||||
license_helper = 请选择授权许可文件
|
||||
init_readme = 使用 README.md 文件初始化仓库
|
||||
create_repo = 创建仓库
|
||||
default_branch = 默认分支
|
||||
mirror_interval = 镜像同步周期(小时)
|
||||
goget_meta = Go-Get 支持
|
||||
goget_meta_helper = 本仓库将可以通过 <span class="label label-blue label-radius">Go Get</span> 获取
|
||||
|
||||
need_auth = 需要授权验证
|
||||
migrate_type = 迁移类型
|
||||
migrate_type_helper = 本仓库将是 <span class="label label-blue label-radius">镜像</span>
|
||||
migrate_repo = 迁移仓库
|
||||
|
||||
copy_link = 复制链接
|
||||
clone_helper = 不知道如何操作?访问 <a target="_blank" href="http://git-scm.com/book/zh/Git-基础-取得项目的-Git-仓库">此处</a> 查看帮助!
|
||||
unwatch = 取消关注
|
||||
watch = 关注
|
||||
unstar = 取消点赞
|
||||
star = 点赞
|
||||
fork = 派生
|
||||
|
||||
quick_guide = 快速帮助
|
||||
clone_this_repo = 克隆当前仓库
|
||||
create_new_repo_command = 从命令行创建一个新的仓库
|
||||
push_exist_repo = 从命令行推送已经创建的仓库
|
||||
|
||||
settings = 仓库设置
|
||||
settings.options = 基本设置
|
||||
settings.collaboration = 管理协作者
|
||||
settings.hooks = 管理 Web 钩子
|
||||
settings.deploy_keys = 管理部署密钥
|
||||
settings.basic_settings = 基本设置
|
||||
settings.danger_zone = 危险操作区
|
||||
settings.site = 官方网站
|
||||
settings.update_settings = 更新仓库设置
|
||||
settings.transfer = 转移仓库所有权
|
||||
settings.transfer_desc = 您可以将仓库转移至您拥有管理员权限的帐户或组织。
|
||||
settings.new_owner_has_same_repo = 新的仓库拥有者已经存在同名仓库!
|
||||
settings.delete = 删除本仓库
|
||||
settings.delete_desc = 删除仓库操作不可逆转,请三思而后行。
|
||||
settings.update_settings_success = 仓库设置更新成功!
|
||||
settings.transfer_owner = 新拥有者
|
||||
settings.make_transfer = 确认转移仓库
|
||||
settings.confirm_delete = 确认删除仓库
|
||||
settings.add_collaborator = 增加新的协作者
|
||||
settings.add_collaborator_success = 成功添加新的协作者!
|
||||
settings.remove_collaborator_success = 被操作的协作者已经被收回权限!
|
||||
settings.add_webhook = 添加 Web 钩子
|
||||
settings.hooks_desc = Web 钩子允许您设定在 Gogs 上发生指定事件时对指定 URL 发送 POST 通知。查看 <a target="_blank" href="http://gogs.io/docs/features/webhook.html">Webhooks 文档</a> 获取更多信息。
|
||||
settings.remove_hook_success = Web 钩子删除成功!
|
||||
settings.add_webhook_desc = 我们会通过 <code>POST</code> 请求将订阅事件信息发送至向指定 URL 地址。您可以设置不同的数据接收方式(JSON 或 <code>x-www-form-urlencoded</code>)。 请查阅 <a target="_blank" href="http://gogs.io/docs/features/webhook.html">Webhooks 文档</a> 获取更多信息。
|
||||
settings.payload_url = 推送地址
|
||||
settings.content_type = 数据格式
|
||||
settings.secret = 密钥文本
|
||||
settings.event_desc = 请设置您希望触发 Web 钩子的事件:
|
||||
settings.event_push_only = 只推送 <code>push</code> 事件。
|
||||
settings.active = 是否激活
|
||||
settings.active_helper = 当指定事件发生时我们将会触发此 Web 钩子。
|
||||
settings.add_hook_success = Web 钩子添加成功!
|
||||
settings.update_webhook = 更新 Web 钩子
|
||||
settings.update_hook_success = Web 钩子更新成功!
|
||||
settings.delete_webhook = 删除 Web 钩子
|
||||
settings.recent_deliveries = 最近推送记录
|
||||
settings.hook_type = 钩子类型
|
||||
settings.add_slack_hook_desc = 为您的仓库增加 <a href="http://slack.com">Slack</a> 集成
|
||||
settings.slack_token = 令牌
|
||||
settings.slack_domain = 域名
|
||||
settings.slack_channel = 频道
|
||||
|
||||
[org]
|
||||
org_name_holder = 组织名称
|
||||
org_name_helper = 伟大的组织都有一个简短而寓意深刻的名字。
|
||||
org_email_helper = 组织的邮箱用于接收所有通知和确认邮件。
|
||||
create_org = 创建组织
|
||||
repo_updated = 最后更新于
|
||||
people = 组织成员
|
||||
invite_someone = 邀请他人加入
|
||||
teams = 组织团队
|
||||
lower_members = 名成员
|
||||
lower_repositories = 个仓库
|
||||
create_new_team = 创建新的团队
|
||||
org_desc = 组织描述
|
||||
team_name = 团队名称
|
||||
team_desc = 团队描述
|
||||
team_name_helper = 您可以使用该名称来通知改组全体成员。
|
||||
team_desc_helper = 一句话描述这个团队是做什么的。
|
||||
team_permission_desc = 请选择该团队所具有的权限等级:
|
||||
|
||||
settings = 组织设置
|
||||
settings.options = 基本设置
|
||||
settings.full_name = 组织全名
|
||||
settings.website = 官方网站
|
||||
settings.location = 所在地区
|
||||
settings.update_settings = 更新组织设置
|
||||
settings.update_setting_success = 组织设置更新成功!
|
||||
settings.delete = 删除组织
|
||||
settings.delete_account = 删除当前组织
|
||||
settings.delete_prompt = 删除操作会永久清除该组织的信息,并且 <strong>不可恢复</strong>!
|
||||
settings.confirm_delete_account = 确认删除组织
|
||||
|
||||
members.public = 公开成员
|
||||
members.public_helper = 设为私有
|
||||
members.private = 私有成员
|
||||
members.private_helper = 设为公开
|
||||
members.owner = 管理员
|
||||
members.member = 普通成员
|
||||
members.conceal = 隐藏身份
|
||||
members.remove = 移除成员
|
||||
members.leave = 离开组织
|
||||
members.invite_desc = 请输入被邀请到组织 %s 的用户名称:
|
||||
members.invite_now = 立即邀请
|
||||
|
||||
teams.join = 加入团队
|
||||
teams.leave = 离开团队
|
||||
teams.read_access = 读取权限
|
||||
teams.read_access_helper = 这个团队将拥有查看和克隆所属仓库的权限。
|
||||
teams.write_access = 写入权限
|
||||
teams.write_access_helper = 这个团队将拥有查看、克隆和推送所属仓库的权限。
|
||||
teams.admin_access = 管理权限
|
||||
teams.admin_access_helper = 这个团队将拥有查看、克隆、推送和添加其他组织成员到团队的权限。
|
||||
teams.no_desc = 该团队暂无描述
|
||||
teams.settings = 团队设置
|
||||
teams.owners_permission_desc = 管理员团队对 <strong>所有仓库</strong> 具有操作权限,且对组织具有 <strong>管理员权限</strong>。
|
||||
teams.members = 团队成员
|
||||
teams.update_settings = 更新团队设置
|
||||
teams.delete_team = 删除当前团队
|
||||
teams.add_team_member = 添加团队成员
|
||||
teams.delete_team_success = 指定团队删除成功!
|
||||
teams.read_permission_desc = 该团队拥有对所属仓库的 <strong>读取</strong> 权限,团队成员可以进行查看和克隆等只读操作。
|
||||
teams.write_permission_desc = 该团队拥有对所属仓库的 <strong>读取</strong> 和 <strong>写入</strong> 的权限。
|
||||
teams.admin_permission_desc = 该团队拥有一定的 <strong>管理</strong> 权限,团队成员可以读取、克隆、推送以及添加其它仓库协作者。
|
||||
teams.repositories = 团队仓库
|
||||
teams.add_team_repository = 添加团队仓库
|
||||
teams.remove_repo = 移除仓库
|
||||
|
||||
[admin]
|
||||
dashboard = 控制面板
|
||||
users = 用户管理
|
||||
organizations = 组织管理
|
||||
repositories = 仓库管理
|
||||
authentication = 授权认证管理
|
||||
config = 应用配置管理
|
||||
monitor = 应用监控面板
|
||||
prev = 上一页
|
||||
next = 下一页
|
||||
|
||||
dashboard.statistic = 应用统计数据
|
||||
dashboard.operations = 管理员操作
|
||||
dashboard.system_status = 系统监视状态
|
||||
dashboard.statistic_info = Gogs 数据库统计:<b>%d</b> 位用户,<b>%d</b> 个组织,<b>%d</b> 个公钥,<b>%d</b> 个仓库,<b>%d</b> 个仓库关注,<b>%d</b> 个赞,<b>%d</b> 次行为,<b>%d</b> 条权限记录,<b>%d</b> 张工单,<b>%d</b> 次评论,<b>%d</b> 个社交帐号,<b>%d</b> 个用户关注,<b>%d</b> 个镜像,<b>%d</b> 个版本发布,<b>%d</b> 个登录源,<b>%d</b> 个 Web 钩子,<b>%d</b> 个里程碑,<b>%d</b> 个标签,<b>%d</b> 个钩子任务,<b>%d</b> 个团队,<b>%d</b> 个更新任务,<b>%d</b> 个附件。
|
||||
dashboard.operation_name = 操作名称
|
||||
dashboard.operation_switch = 开关
|
||||
dashboard.operation_run = 执行
|
||||
dashboard.clean_unbind_oauth = 清理未绑定社交帐号
|
||||
dashboard.delete_inactivate_accounts = 删除所有未激活帐户
|
||||
dashboard.server_uptime = 服务运行时间
|
||||
dashboard.current_goroutine = 当前 Goroutines 数量
|
||||
dashboard.current_memory_usage = 当前内存使用量
|
||||
dashboard.total_memory_allocated = 所有被分配的内存
|
||||
dashboard.memory_obtained = 内存占用量
|
||||
dashboard.pointer_lookup_times = 指针查找次数
|
||||
dashboard.memory_allocate_times = 内存分配次数
|
||||
dashboard.memory_free_times = 内存释放次数
|
||||
dashboard.current_heap_usage = 当前 Heap 内存使用量
|
||||
dashboard.heap_memory_obtained = Heap 内存占用量
|
||||
dashboard.heap_memory_idle = Heap 内存空闲量
|
||||
dashboard.heap_memory_in_use = 正在使用的 Heap 内存
|
||||
dashboard.heap_memory_released = 被释放的 Heap 内存
|
||||
dashboard.heap_objects = Heap 对象数量
|
||||
dashboard.bootstrap_stack_usage = 启动 Stack 使用量
|
||||
dashboard.stack_memory_obtained = 被分配的 Stack 内存
|
||||
dashboard.mspan_structures_usage = MSpan 结构内存使用量
|
||||
dashboard.mspan_structures_obtained = 被分配的 MSpan 结构内存
|
||||
dashboard.mcache_structures_usage = MCache 结构内存使用量
|
||||
dashboard.mcache_structures_obtained = 被分配的 MCache 结构内存
|
||||
dashboard.profiling_bucket_hash_table_obtained = 被分配的剖析哈希表内存
|
||||
dashboard.gc_metadata_obtained = 被分配的 GC 元数据内存
|
||||
dashboard.other_system_allocation_obtained = 其它被分配的系统内存
|
||||
dashboard.next_gc_recycle = 下次 GC 内存回收量
|
||||
dashboard.last_gc_time = 距离上次 GC 时间
|
||||
dashboard.total_gc_time = GC 执行时间总量
|
||||
dashboard.total_gc_pause = GC 暂停时间总量
|
||||
dashboard.last_gc_pause = 上次 GC 暂停时间
|
||||
dashboard.gc_times = GC 执行次数
|
||||
|
||||
users.user_manage_panel = 用户管理面板
|
||||
users.new_account = 创建新的帐户
|
||||
users.name = 用户名
|
||||
users.activated = 已激活
|
||||
users.admin = 管理员
|
||||
users.repos = 仓库数
|
||||
users.created = 创建时间
|
||||
users.edit = 编辑
|
||||
users.auth_source = 认证源
|
||||
users.local = 本地
|
||||
users.auth_login_name = 认证登录名
|
||||
users.update_profile_success = 该用户信息更新成功!
|
||||
users.edit_account = 编辑用户信息
|
||||
users.is_activated = 该用户已被激活
|
||||
users.is_admin = 该用户具有管理员权限
|
||||
users.update_profile = 更新用户信息
|
||||
users.delete_account = 删除该用户
|
||||
|
||||
orgs.org_manage_panel = 组织管理面板
|
||||
orgs.name = 组织名称
|
||||
orgs.teams = 团队数
|
||||
orgs.members = 成员数
|
||||
|
||||
repos.repo_manage_panel = 仓库管理界面
|
||||
repos.owner = 所有者
|
||||
repos.name = 仓库名称
|
||||
repos.private = 私有库
|
||||
repos.watches = 关注数
|
||||
repos.stars = 点赞数
|
||||
repos.issues = 工单数
|
||||
|
||||
auths.auth_manage_panel = 授权认证管理面板
|
||||
auths.new = 添加新的认证源
|
||||
auths.name = 认证名称
|
||||
auths.type = 认证类型
|
||||
auths.enabled = 已启用
|
||||
auths.updated = 最后更新时间
|
||||
auths.auth_type = 授权类型
|
||||
auths.auth_name = 授权名称
|
||||
auths.domain = 域名
|
||||
auths.host = 主机地址
|
||||
auths.port = 主机端口
|
||||
auths.base_dn = Base DN
|
||||
auths.attributes = Search Attributes
|
||||
auths.filter = Search Filter
|
||||
auths.ms_ad_sa = Ms Ad SA
|
||||
auths.smtp_auth = SMTP 授权类型
|
||||
auths.smtphost = SMTP 主机地址
|
||||
auths.smtpport = SMTP 主机端口
|
||||
auths.enable_tls = 启用 TLS 加密
|
||||
auths.enable_auto_register = 允许授权用户自动注册
|
||||
auths.tips = 帮助提示
|
||||
auths.edit = 修改授权认证设置
|
||||
auths.activated = 该授权认证已经启用
|
||||
auths.update_success = 授权认证设置更新成功!
|
||||
auths.update = 更新授权认证信息
|
||||
auths.delete = 删除该授权认证
|
||||
|
||||
config.server_config = 服务器配置
|
||||
config.app_name = 应用名称
|
||||
config.app_ver = 应用版本
|
||||
config.app_url = 应用 URL
|
||||
config.domain = 应用域名
|
||||
config.offline_mode = 离线模式
|
||||
config.disable_router_log = 关闭路由日志
|
||||
config.run_user = 运行用户
|
||||
config.run_mode = 运行模式
|
||||
config.repo_root_path = 仓库根目录
|
||||
config.static_file_root_path = 静态文件根目录
|
||||
config.log_file_root_path = 日志文件根目录
|
||||
config.script_type = 脚本类型
|
||||
config.reverse_auth_user = 反向代理认证
|
||||
config.db_config = 数据库配置
|
||||
config.db_type = 数据库类型
|
||||
config.db_host = 主机地址
|
||||
config.db_name = 数据库名称
|
||||
config.db_user = 连接用户
|
||||
config.db_ssl_mode = SSL 模式
|
||||
config.db_ssl_mode_helper = (仅限 "postgres" 使用)
|
||||
config.db_path = 数据库路径
|
||||
config.db_path_helper = (仅限 "sqlite3" 使用)
|
||||
config.service_config = 服务配置
|
||||
config.register_email_confirm = 注册邮件确认
|
||||
config.disable_register = 关闭注册功能
|
||||
config.require_sign_in_view = 强制登录浏览
|
||||
config.mail_notify = 邮件通知提醒
|
||||
config.enable_cache_avatar = 开启缓存头像
|
||||
config.active_code_lives = 激活用户链接有效期
|
||||
config.reset_password_code_lives = 重置密码链接有效期
|
||||
config.webhook_config = Web 钩子配置
|
||||
config.task_interval = 任务周期
|
||||
config.deliver_timeout = 推送超时
|
||||
config.mailer_config = 邮件配置
|
||||
config.mailer_enabled = 启用服务
|
||||
config.mailer_name = 发送者名称
|
||||
config.mailer_host = 邮件主机地址
|
||||
config.mailer_user = 发送者帐号
|
||||
config.oauth_config = 社交帐号配置
|
||||
config.oauth_enabled = 启用服务
|
||||
config.cache_config = Cache 配置
|
||||
config.cache_adapter = Cache 适配器
|
||||
config.cache_interval = Cache 周期
|
||||
config.cache_conn = Cache 连接字符串
|
||||
config.session_config = Session 配置
|
||||
config.session_provider = Session 提供者
|
||||
config.provider_config = 提供者配置
|
||||
config.cookie_name = Cookie 名称
|
||||
config.enable_set_cookie = 启用设置 Cookie
|
||||
config.gc_interval_time = GC 周期
|
||||
config.session_life_time = Session 生命周期
|
||||
config.https_only = 仅限 HTTPS
|
||||
config.cookie_life_time = Cookie 生命周期
|
||||
config.session_hash_function = Session ID 哈希函数
|
||||
config.session_hash_key = Session ID 哈希健值
|
||||
config.picture_config = 图片配置
|
||||
config.picture_service = 图片服务
|
||||
config.disable_gravatar = 禁用 Gravatar 头像
|
||||
config.log_config = 日志配置
|
||||
config.log_mode = 日志模式
|
||||
|
||||
monitor.cron = Cron 任务
|
||||
monitor.name = 任务名称
|
||||
monitor.schedule = 任务安排
|
||||
monitor.next = 下次执行时间
|
||||
monitor.previous = 上次执行时间
|
||||
monitor.execute_times = 执行次数
|
||||
monitor.process = 运行中进程
|
||||
monitor.desc = 进程描述
|
||||
monitor.start = 开始时间
|
||||
monitor.execute_time = 已执行时间
|
||||
|
||||
[action]
|
||||
create_repo = 创建了仓库 <a href="/%s">%s</a>
|
||||
commit_repo = 推送了 <a href="/%s/src/%s">%s</a> 分支的代码到 <a href="/%s">%s</a>
|
||||
create_issue = 创建了工单 <a href="/%s/issues/%s">%s#%s</a>
|
||||
comment_issue = 评论了工单 <a href="/%s/issues/%s">%s#%s</a>
|
||||
|
||||
[tool]
|
||||
ago = 之前
|
||||
from_now = 之后
|
||||
now = 现在
|
||||
1s = 1 秒%s
|
||||
1m = 1 分钟%s
|
||||
1h = 1 小时%s
|
||||
1d = 1 天%s
|
||||
1w = 1 周%s
|
||||
1mon = 1 月%s
|
||||
1y = 1 年%s
|
||||
seconds = %d 秒%s
|
||||
minutes = %d 分钟%s
|
||||
hours = %d 小时%s
|
||||
days = %d 天%s
|
||||
weeks = %d 周%s
|
||||
months = %d 月%s
|
||||
years = %d 年%s
|
||||
raw_seconds = 秒
|
||||
raw_minutes = 分钟
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
[program:gogs]
|
||||
user=git
|
||||
command = /home/git/gogs/start.sh
|
||||
directory = /home/git/gogs
|
||||
autostart = true
|
||||
stdout_logfile = /var/gogs.log
|
||||
stderr_logfile = /var/gogs-error.log
|
||||
environment=HOME="/home/git"
|
||||
89
docker/README.md
Normal file
89
docker/README.md
Normal file
@@ -0,0 +1,89 @@
|
||||
Docker
|
||||
======
|
||||
|
||||
TOOLS ARE WRITTEN FOR TESTING AND TO SEE WHAT IT IS!
|
||||
|
||||
For this to work you will need the nifty docker tool [fig].
|
||||
|
||||
The most simple setup will look like this:
|
||||
|
||||
```sh
|
||||
./assemble_blocks.sh docker_gogs w_db option_db_mysql
|
||||
fig up
|
||||
|
||||
```
|
||||
|
||||
That's it. You have GoGS running in docker linked to a MySQL docker container.
|
||||
|
||||
Now visit http://localhost:3000/ and give details for the admin account an you're up and running.
|
||||
|
||||
|
||||
How does it work
|
||||
----------------
|
||||
|
||||
`./assemble_blocks.sh` will look in `blocks` for subdirectories.
|
||||
In the subdirectories there are three relevant files: `Dockerfile`, `config` and `fig`.
|
||||
|
||||
`Dockerfile` will be copied to `docker/` (also means last `Dockerfile` wins).
|
||||
|
||||
The `config` file contains lines which will in the gogs docker container end up in `$GOGS_PATH/custom/config/app.ini` and by this gogs will be configured.
|
||||
Here you can define things like the MySQL server for your database block.
|
||||
|
||||
The `fig` file will just be added to `fig.yml`, which is used by fig to manage your containers.
|
||||
This inculdes container linking!
|
||||
|
||||
Just have a look at them and it will be clear how to write your own blocks.
|
||||
|
||||
Just some things
|
||||
|
||||
- all files (`Dockerfile`, `fig` and `config`) are optional
|
||||
- the gogs block should always be the first block
|
||||
|
||||
Currently the blocks are designed that, the blocks that start with `docker` pull in the base docker image.
|
||||
Then one block starting with `w` defines, what containers should be linked to the gogs container.
|
||||
For every option in the `w` block you need to add an `option` container.
|
||||
|
||||
Example:
|
||||
|
||||
```sh
|
||||
./assemble_blocks.sh docker_gogs w_db_cache option_db_mysql option_cache_redis
|
||||
```
|
||||
|
||||
|
||||
More sophisticated Example
|
||||
--------------------------
|
||||
|
||||
Her is a more elaborated example
|
||||
|
||||
```sh
|
||||
./assemble_blocks.sh docker_gogs w_db_cache_session option_db_postgresql option_cache_redis option_session_mysql
|
||||
fig up
|
||||
```
|
||||
|
||||
This will set up four containters and link them proberly. One for each of
|
||||
|
||||
- gogs
|
||||
- database (postgresql)
|
||||
- cache (redis)
|
||||
- session (mysql)
|
||||
|
||||
WARNING: This will not work at the Moment! MySQL session is broken!
|
||||
|
||||
|
||||
Remark
|
||||
------
|
||||
|
||||
After you execute `assemble_blocks.sh` you should always trigger `fig build` to inculde the the new init script `init_gogs.sh` in the docker image.
|
||||
|
||||
If you want to use another GoGS docker file, but keep everything else the same, you can create a block, e.g. `docker_gogs_custom`, with only a `Dockerfile` and call
|
||||
|
||||
```sh
|
||||
./assemble_blocks.sh docker_gogs_custom w_db option_database_mysql
|
||||
```
|
||||
|
||||
This will pull in the `Dockerfile` from `docker_gogs` instead of the one from `docker_gogs`.
|
||||
|
||||
`Dockerfile`s for the `master` and `dev` branch are provided as `docker_gogs` and `docker_gogs_dev`
|
||||
|
||||
|
||||
[fig]:http://www.fig.sh/
|
||||
72
docker/assemble_blocks.sh
Executable file
72
docker/assemble_blocks.sh
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
|
||||
blocks_dir=blocks
|
||||
docker_dir=docker
|
||||
template_dir=templates
|
||||
|
||||
docker_file=Dockerfile
|
||||
|
||||
gogs_config_file=conf.tmp
|
||||
gogs_config=config
|
||||
gogs_init_file=$docker_dir/init_gogs.sh
|
||||
|
||||
fig_file=fig.yml
|
||||
fig_config=fig
|
||||
|
||||
gogs_init_template=$template_dir/init_gogs.sh.tpl
|
||||
|
||||
if [ "$#" == 0 ]; then
|
||||
blocks=`ls $blocks_dir`
|
||||
if [ -z "$blocks" ]; then
|
||||
echo "No Blocks available in $blocks_dir"
|
||||
else
|
||||
echo "Available Blocks:"
|
||||
for block in $blocks; do
|
||||
echo " $block"
|
||||
done
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for file in $gogs_config_file $fig_file; do
|
||||
if [ -e $file ]; then
|
||||
echo "Deleting $file"
|
||||
rm $file
|
||||
fi
|
||||
done
|
||||
|
||||
for dir in $@; do
|
||||
current_dir=$blocks_dir/$dir
|
||||
if [ ! -d "$current_dir" ]; then
|
||||
echo "$current_dir is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e $current_dir/$docker_file ]; then
|
||||
echo "Copying $current_dir/$docker_file to $docker_dir/$docker_file"
|
||||
cp $current_dir/$docker_file $docker_dir/$docker_file
|
||||
fi
|
||||
|
||||
if [ -e $current_dir/$gogs_config ]; then
|
||||
echo "Adding $current_dir/$gogs_config to $gogs_config_file"
|
||||
cat $current_dir/$gogs_config >> $gogs_config_file
|
||||
echo "" >> $gogs_config_file
|
||||
fi
|
||||
|
||||
if [ -e $current_dir/$fig_config ]; then
|
||||
echo "Adding $current_dir/$fig_config to $fig_file"
|
||||
cat $current_dir/fig >> $fig_file
|
||||
echo "" >> $fig_file
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Creating $gogs_init_file"
|
||||
sed "/{{ CONFIG }}/{
|
||||
r $gogs_config_file
|
||||
d
|
||||
}" $gogs_init_template > $gogs_init_file
|
||||
|
||||
if [ -e $gogs_config_file ]; then
|
||||
echo "Removing temporary GoGS config"
|
||||
rm $gogs_config_file
|
||||
fi
|
||||
52
docker/blocks/docker_gogs/Dockerfile
Normal file
52
docker/blocks/docker_gogs/Dockerfile
Normal file
@@ -0,0 +1,52 @@
|
||||
FROM ubuntu:14.04
|
||||
|
||||
# This part is taken from the official docker image --------------------
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential ca-certificates curl \
|
||||
bzr git mercurial \
|
||||
--no-install-recommends
|
||||
|
||||
ENV GOLANG_VERSION 1.3
|
||||
|
||||
RUN curl -sSL http://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
|
||||
| tar -v -C /usr/src -xz
|
||||
WORKDIR /usr/src/go
|
||||
|
||||
RUN cd src && ./make.bash --no-clean 2>&1
|
||||
|
||||
ENV PATH /usr/src/go/bin:$PATH
|
||||
|
||||
RUN mkdir -p /go/src
|
||||
ENV GOPATH /go
|
||||
ENV PATH /go/bin:$PATH
|
||||
WORKDIR /go
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
RUN useradd -m git
|
||||
|
||||
ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs
|
||||
ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf
|
||||
ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini
|
||||
|
||||
RUN go get -u -d github.com/gogits/gogs
|
||||
# WORKDIR $GOGS_PATH
|
||||
WORKDIR /go/src/github.com/gogits/gogs
|
||||
RUN go build github.com/gogits/gogs
|
||||
RUN chown -R git $GOGS_PATH
|
||||
|
||||
ADD init_gogs.sh /tmp/
|
||||
RUN chown git /tmp/init_gogs.sh
|
||||
RUN chmod +x /tmp/init_gogs.sh
|
||||
|
||||
USER git
|
||||
ENV HOME /home/git
|
||||
ENV USER git
|
||||
ENV PATH $GOGS_PATH:$PATH
|
||||
|
||||
RUN git config --global user.name "GoGS"
|
||||
|
||||
ENTRYPOINT ["/tmp/init_gogs.sh"]
|
||||
CMD ["gogs", "web"]
|
||||
53
docker/blocks/docker_gogs_dev/Dockerfile
Normal file
53
docker/blocks/docker_gogs_dev/Dockerfile
Normal file
@@ -0,0 +1,53 @@
|
||||
FROM ubuntu:14.04
|
||||
|
||||
# This part is derived from the official docker image ------------------
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||
apt-get install -qy \
|
||||
build-essential ca-certificates curl \
|
||||
bzr git mercurial \
|
||||
--no-install-recommends
|
||||
|
||||
ENV GOLANG_VERSION 1.3
|
||||
|
||||
RUN curl -sSL http://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
|
||||
| tar -v -C /usr/src -xz
|
||||
WORKDIR /usr/src/go
|
||||
|
||||
RUN cd src && ./make.bash --no-clean 2>&1
|
||||
|
||||
ENV PATH /usr/src/go/bin:$PATH
|
||||
|
||||
RUN mkdir -p /go/src
|
||||
ENV GOPATH /go
|
||||
ENV PATH /go/bin:$PATH
|
||||
WORKDIR /go
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
|
||||
RUN useradd -m git
|
||||
|
||||
ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs
|
||||
ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf
|
||||
ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini
|
||||
|
||||
RUN git clone -b dev https://github.com/gogits/gogs.git $GOGS_PATH
|
||||
# WORKDIR $GOGS_PATH
|
||||
WORKDIR /go/src/github.com/gogits/gogs
|
||||
RUN go get -d && go build
|
||||
RUN chown -R git $GOGS_PATH
|
||||
|
||||
ADD init_gogs.sh /tmp/
|
||||
RUN chown git /tmp/init_gogs.sh
|
||||
RUN chmod +x /tmp/init_gogs.sh
|
||||
|
||||
USER git
|
||||
ENV HOME /home/git
|
||||
ENV USER git
|
||||
ENV PATH $GOGS_PATH:$PATH
|
||||
|
||||
RUN git config --global user.name "GoGS"
|
||||
|
||||
ENTRYPOINT ["/tmp/init_gogs.sh"]
|
||||
CMD ["gogs", "web"]
|
||||
3
docker/blocks/option_cache_memcache/config
Normal file
3
docker/blocks/option_cache_memcache/config
Normal file
@@ -0,0 +1,3 @@
|
||||
[cache]
|
||||
DB_TYPE = memcache
|
||||
HOST = HOST = ${CACHE_1_PORT_11211_TCP_ADDR}:${CACHE_1_PORT_11211_TCP_PORT}
|
||||
2
docker/blocks/option_cache_memcache/fig
Normal file
2
docker/blocks/option_cache_memcache/fig
Normal file
@@ -0,0 +1,2 @@
|
||||
cache:
|
||||
image: sylvainlasnier/memcached:latest
|
||||
3
docker/blocks/option_cache_redis/config
Normal file
3
docker/blocks/option_cache_redis/config
Normal file
@@ -0,0 +1,3 @@
|
||||
[cache]
|
||||
DB_TYPE = redis
|
||||
HOST = ${CACHE_1_PORT_6379_TCP_ADDR}:${CACHE_1_PORT_6379_TCP_PORT}
|
||||
2
docker/blocks/option_cache_redis/fig
Normal file
2
docker/blocks/option_cache_redis/fig
Normal file
@@ -0,0 +1,2 @@
|
||||
cache:
|
||||
image: redis:latest
|
||||
6
docker/blocks/option_db_mysql/config
Normal file
6
docker/blocks/option_db_mysql/config
Normal file
@@ -0,0 +1,6 @@
|
||||
[database]
|
||||
DB_TYPE = mysql
|
||||
HOST = ${DB_1_PORT_3306_TCP_ADDR}:${DB_1_PORT_3306_TCP_PORT}
|
||||
NAME = ${DB_1_ENV_MYSQL_DATABASE}
|
||||
USER = ${DB_1_ENV_MYSQL_USER}
|
||||
PASSWD = ${DB_1_ENV_MYSQL_PASSWORD}
|
||||
7
docker/blocks/option_db_mysql/fig
Normal file
7
docker/blocks/option_db_mysql/fig
Normal file
@@ -0,0 +1,7 @@
|
||||
db:
|
||||
image: mysql:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: rootpass
|
||||
MYSQL_DATABASE: gogs
|
||||
MYSQL_USER: gogs
|
||||
MYSQL_PASSWORD: password
|
||||
6
docker/blocks/option_db_postgresql/config
Normal file
6
docker/blocks/option_db_postgresql/config
Normal file
@@ -0,0 +1,6 @@
|
||||
[database]
|
||||
DB_TYPE = postgres
|
||||
HOST = ${DB_1_PORT_5432_TCP_ADDR}:${DB_1_PORT_5432_TCP_PORT}
|
||||
NAME = ${DB_1_ENV_POSTGRESQL_DB}
|
||||
USER = ${DB_1_ENV_POSTGRESQL_USER}
|
||||
PASSWD = ${DB_1_ENV_POSTGRESQL_PASS}
|
||||
6
docker/blocks/option_db_postgresql/fig
Normal file
6
docker/blocks/option_db_postgresql/fig
Normal file
@@ -0,0 +1,6 @@
|
||||
db:
|
||||
image: wyaeld/postgres:9.3
|
||||
environment:
|
||||
POSTGRESQL_DB: gogs
|
||||
POSTGRESQL_USER: gogs
|
||||
POSTGRESQL_PASS: password
|
||||
3
docker/blocks/option_session_mysql/config
Normal file
3
docker/blocks/option_session_mysql/config
Normal file
@@ -0,0 +1,3 @@
|
||||
[session]
|
||||
PROVIDER = mysql
|
||||
PROVIDER_CONFIG = ${SESSION_1_ENV_MYSQL_USER}:${SESSION_1_ENV_MYSQL_PASSWORD}@SESSION_1_PORT_3306_TCP_PROTO(${SESSION_1_PORT_3306_TCP_ADDR}:${SESSION_1_PORT_3306_TCP_PORT})/${SESSION_1_ENV_MYSQL_DATABASE}
|
||||
7
docker/blocks/option_session_mysql/fig
Normal file
7
docker/blocks/option_session_mysql/fig
Normal file
@@ -0,0 +1,7 @@
|
||||
session:
|
||||
image: mysql:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: rootpass
|
||||
MYSQL_DATABASE: gogs_session
|
||||
MYSQL_USER: gogs
|
||||
MYSQL_PASSWORD: password
|
||||
6
docker/blocks/w_cache/fig
Normal file
6
docker/blocks/w_cache/fig
Normal file
@@ -0,0 +1,6 @@
|
||||
gogs:
|
||||
build: docker
|
||||
links:
|
||||
- cache
|
||||
ports:
|
||||
- "3000:3000"
|
||||
7
docker/blocks/w_cache_session/fig
Normal file
7
docker/blocks/w_cache_session/fig
Normal file
@@ -0,0 +1,7 @@
|
||||
gogs:
|
||||
build: docker
|
||||
links:
|
||||
- cache
|
||||
- session
|
||||
ports:
|
||||
- "3000:3000"
|
||||
6
docker/blocks/w_db/fig
Normal file
6
docker/blocks/w_db/fig
Normal file
@@ -0,0 +1,6 @@
|
||||
gogs:
|
||||
build: docker
|
||||
links:
|
||||
- db
|
||||
ports:
|
||||
- "3000:3000"
|
||||
7
docker/blocks/w_db_cache/fig
Normal file
7
docker/blocks/w_db_cache/fig
Normal file
@@ -0,0 +1,7 @@
|
||||
gogs:
|
||||
build: docker
|
||||
links:
|
||||
- db
|
||||
- cache
|
||||
ports:
|
||||
- "3000:3000"
|
||||
8
docker/blocks/w_db_cache_session/fig
Normal file
8
docker/blocks/w_db_cache_session/fig
Normal file
@@ -0,0 +1,8 @@
|
||||
gogs:
|
||||
build: docker
|
||||
links:
|
||||
- db
|
||||
- cache
|
||||
- session
|
||||
ports:
|
||||
- "3000:3000"
|
||||
7
docker/blocks/w_db_session/fig
Normal file
7
docker/blocks/w_db_session/fig
Normal file
@@ -0,0 +1,7 @@
|
||||
gogs:
|
||||
build: docker
|
||||
links:
|
||||
- db
|
||||
- session
|
||||
ports:
|
||||
- "3000:3000"
|
||||
4
docker/blocks/w_none/fig
Normal file
4
docker/blocks/w_none/fig
Normal file
@@ -0,0 +1,4 @@
|
||||
gogs:
|
||||
build: docker
|
||||
ports:
|
||||
- "3000:3000"
|
||||
6
docker/blocks/w_session/fig
Normal file
6
docker/blocks/w_session/fig
Normal file
@@ -0,0 +1,6 @@
|
||||
gogs:
|
||||
build: docker
|
||||
links:
|
||||
- session
|
||||
ports:
|
||||
- "3000:3000"
|
||||
12
docker/templates/init_gogs.sh.tpl
Normal file
12
docker/templates/init_gogs.sh.tpl
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -d "$DIRECTORY" ]; then
|
||||
mkdir -p $GOGS_CUSTOM_CONF_PATH
|
||||
|
||||
echo "
|
||||
{{ CONFIG }}
|
||||
" >> $GOGS_CUSTOM_CONF
|
||||
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
@@ -1,59 +0,0 @@
|
||||
### Gogs Install With Docker
|
||||
|
||||
|
||||
|
||||
#### Gogs With MySQL
|
||||
|
||||
Deply gogs in [Docker](http://www.docker.io/) is just as easy as eating a pie, what you do is just open the `dockerfiles/build.sh` file, replace the confis:
|
||||
|
||||
```
|
||||
MYSQL_PASSWORD="YOUR_MYSQL_PASSWORD"
|
||||
MYSQL_RUN_NAME="YOUR_MYSQL_RUN_NAME"
|
||||
HOST_PORT="YOUR_HOST_PORT"
|
||||
```
|
||||
|
||||
And run:
|
||||
```
|
||||
cd dockerfiles
|
||||
./build.sh
|
||||
```
|
||||
|
||||
The build might take some time, just be paient. After it finishes, you will receive the message:
|
||||
|
||||
```
|
||||
Now we have the MySQL image(running) and gogs image, use the follow command to start gogs service( the content might be different, according to your own configs):
|
||||
docker run -i -t --link gogs_mysql:db -p 3333:3000 gogs/gogits
|
||||
```
|
||||
|
||||
Just follow the message, run:
|
||||
|
||||
```
|
||||
docker run -i -t --link gogs_mysql:db -p 3333:3000 gogs/gogits
|
||||
```
|
||||
|
||||
Now we have gogs running! Open the browser and navigate to:
|
||||
|
||||
```
|
||||
http://YOUR_HOST_IP:YOUR_HOST_PORT
|
||||
```
|
||||
|
||||
Let's 'gogs'!
|
||||
|
||||
#### Gogs With PostgreSQL
|
||||
|
||||
Installing Gogs with PostgreSQL is nearly the same with installing it with MySQL. What you do is just change the DB_TYPE in build.sh to 'postgres'.
|
||||
|
||||
#### Gogs, MySQL With Redis
|
||||
|
||||
|
||||
#### Gogs, MySQL With Memcached
|
||||
|
||||
|
||||
#### Gogs, PostgreSQL With Redis
|
||||
|
||||
|
||||
#### Gogs, PostgreSQL With Memcached
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# Configs of the docker images, you might have specify your own configs here.
|
||||
# type of database, support 'mysql' and 'postgres'
|
||||
DB_TYPE="postgres"
|
||||
DB_PASSWORD="YOUR_DB_PASSWORD"
|
||||
DB_RUN_NAME="YOUR_DB_RUN_NAME"
|
||||
HOST_PORT="YOUR_HOST_PORT"
|
||||
|
||||
# Replace the database root password in database image Dockerfile.
|
||||
sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile
|
||||
# Replace the database root password in gogits image deploy.sh file.
|
||||
sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/gogits/deploy.sh
|
||||
# Replace the database type in gogits image deploy.sh file.
|
||||
sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/deploy.sh
|
||||
|
||||
# Build the database image
|
||||
cd images/$DB_TYPE
|
||||
docker build -t gogs/$DB_TYPE .
|
||||
#
|
||||
## Build the gogits image
|
||||
cd ../gogits
|
||||
docker build -t gogs/gogits .
|
||||
#
|
||||
## Run MySQL image with name
|
||||
docker run -d --name $DB_RUN_NAME gogs/$DB_TYPE
|
||||
#
|
||||
## Run gogits image and link it to the database image
|
||||
echo "Now we have the $DB_TYPE image(running) and gogs image, use the follow command to start gogs service:"
|
||||
echo -e "\033[33m docker run -i -t --link $DB_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m"
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# Configs of the docker images, you might have specify your own configs here.
|
||||
# type of database, support 'mysql' and 'postgres'
|
||||
DB_TYPE="postgres"
|
||||
DB_PASSWORD="YOUR_DB_PASSWORD"
|
||||
DB_RUN_NAME="YOUR_DB_RUN_NAME"
|
||||
HOST_PORT="YOUR_HOST_PORT"
|
||||
|
||||
# Replace the database root password in database image Dockerfile.
|
||||
sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile
|
||||
# Replace the database root password in gogits image deploy.sh file.
|
||||
sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/gogits/deploy.sh
|
||||
# Replace the database type in gogits image deploy.sh file.
|
||||
sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/deploy.sh
|
||||
|
||||
# Build the database image
|
||||
cd images/$DB_TYPE
|
||||
docker build -t gogs/$DB_TYPE .
|
||||
#
|
||||
## Build the gogits image
|
||||
cd ../gogits
|
||||
docker build -t gogs/gogits .
|
||||
#
|
||||
## Run MySQL image with name
|
||||
docker run -d --name $DB_RUN_NAME gogs/$DB_TYPE
|
||||
#
|
||||
## Run gogits image and link it to the database image
|
||||
echo "Now we have the $DB_TYPE image(running) and gogs image, use the follow command to start gogs service:"
|
||||
echo -e "\033[33m docker run -i -t --link $DB_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m"
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
FROM stackbrew/ubuntu:13.10
|
||||
MAINTAINER Meaglith Ma <genedna@gmail.com> (@genedna)
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN echo "deb http://mirrors.aliyun.com/ubuntu/ saucy main restricted" > /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-updates main restricted" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy universe" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-updates universe" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy multiverse" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-updates multiverse" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-backports main restricted universe multiverse" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-security main restricted" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-security universe" >> /etc/apt/sources.list && echo "deb http://mirrors.aliyun.com/ubuntu/ saucy-security multiverse" >> /etc/apt/sources.list
|
||||
|
||||
RUN mkdir -p /go
|
||||
ENV PATH /usr/local/go/bin:/go/bin:$PATH
|
||||
ENV GOROOT /usr/local/go
|
||||
ENV GOPATH /go
|
||||
|
||||
RUN apt-get update && apt-get install --yes --force-yes curl git mercurial zip wget ca-certificates build-essential
|
||||
|
||||
RUN curl -s http://docker.u.qiniudn.com/go1.2.1.src.tar.gz | tar -v -C /usr/local -xz
|
||||
RUN cd /usr/local/go/src && ./make.bash --no-clean 2>&1
|
||||
|
||||
# You may need a proxy, if github is very slow.
|
||||
#RUN http_proxy=106.187.38.45:3128 go get -u github.com/gogits/gogs
|
||||
RUN go get -u github.com/gogits/gogs
|
||||
RUN cd $GOPATH/src/github.com/gogits/gogs && go build
|
||||
|
||||
# Clean all the unused packages
|
||||
RUN apt-get autoremove -y
|
||||
RUN apt-get clean all
|
||||
|
||||
# Add the deploy script to the docker image and assign execution permission to it.
|
||||
ADD ./deploy.sh /
|
||||
RUN chmod +x deploy.sh
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD /deploy.sh
|
||||
@@ -1,35 +0,0 @@
|
||||
# deploy.sh in gogits image, replace the configs and run gogs
|
||||
|
||||
## Replace the database password
|
||||
DB_TYPE=THE_DB_TYPE
|
||||
DB_PASSWORD=THE_DB_PASSWORD
|
||||
DB_ALIAS=DB
|
||||
DB_TYPE_LINE=`awk '$0 ~ str{print NR}' str="DB_TYPE = mysql" $GOPATH/src/github.com/gogits/gogs/conf/app.ini`
|
||||
DB_PASSWORD_LINE=`awk '$0 ~ str{print NR+1}' str="USER = root" $GOPATH/src/github.com/gogits/gogs/conf/app.ini`
|
||||
|
||||
sed -i "${DB_TYPE_LINE}s/.*$/DB_TYPE = $DB_TYPE/g" $GOPATH/src/github.com/gogits/gogs/conf/app.ini
|
||||
sed -i "${DB_PASSWORD_LINE}s/.*$/PASSWD = $DB_PASSWORD/g" $GOPATH/src/github.com/gogits/gogs/conf/app.ini
|
||||
|
||||
if [ $DB_TYPE = "postgres" ]
|
||||
then
|
||||
# Add the postgres in gogs image.
|
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||
apt-get update
|
||||
apt-get -y -q install python-software-properties software-properties-common
|
||||
apt-get -y -q install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
|
||||
fi
|
||||
|
||||
## Replace the database address and port
|
||||
# When using --link in docker run, the database image's info looks like this:
|
||||
# DB_PORT=tcp://172.17.0.2:3306
|
||||
# DB_PORT_3306_TCP_PORT=3306
|
||||
# DB_PORT_3306_TCP_PROTO=tcp
|
||||
# DB_PORT_3306_TCP_ADDR=172.17.0.2
|
||||
#sed -i "/HOST = 127.0.0.1:3306/c\HOST = $DB_PORT_3306_TCP_ADDR:$DB_PORT_3306_TCP_PORT" $GOPATH/src/github.com/gogits/gogs/conf/app.ini
|
||||
sed -i "/HOST = 127.0.0.1:3306/c\HOST = `echo $DB_PORT | cut -d '/' -f 3`" $GOPATH/src/github.com/gogits/gogs/conf/app.ini
|
||||
|
||||
cd $GOPATH/src/github.com/gogits/gogs/
|
||||
|
||||
# The sudo is a must here, or the go within docker container won't get the current user by os.Getenv("USERNAME")
|
||||
sudo ./gogs web
|
||||
@@ -1,13 +0,0 @@
|
||||
# Configs
|
||||
MYSQL_PASSWORD="kuajie8402"
|
||||
MYSQL_RUN_NAME="gogs_mysql"
|
||||
typeset -u MYSQL_ALIAS
|
||||
MYSQL_ALIAS="db"
|
||||
HOST_PORT="3000"
|
||||
|
||||
## Run MySQL image with name
|
||||
docker run -d --name $MYSQL_RUN_NAME gogs/mysql
|
||||
#
|
||||
## Run gogits image and link it to the MySQL image
|
||||
docker run --link $MYSQL_RUN_NAME:$MYSQL_ALIAS -p $HOST_PORT:3000 gogs/gogits
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
DROP DATABASE gogs;
|
||||
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
DROP DATABASE IF EXISTS gogs;
|
||||
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
26
etc/supervisord.conf
Normal file
26
etc/supervisord.conf
Normal file
@@ -0,0 +1,26 @@
|
||||
[unix_http_server]
|
||||
file=/tmp/supervisor.sock ; path to your socket file
|
||||
|
||||
[supervisord]
|
||||
logfile=log/supervisord.log ; supervisord log file
|
||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
||||
logfile_backups=10 ; number of backed up logfiles
|
||||
loglevel=warn ; info, debug, warn, trace
|
||||
pidfile=/tmp/supervisord.pid ; pidfile location
|
||||
nodaemon=false ; run supervisord as a daemon
|
||||
minfds=1024 ; number of startup file descriptors
|
||||
minprocs=200 ; number of process descriptors
|
||||
user=root ; default user
|
||||
childlogdir=log
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
[program:gogs]
|
||||
command = /root/Developer/gopath/src/github.com/gogits/gogs/start.sh ; here must be the real url, not ~ or $GOROOT like
|
||||
autostart = true
|
||||
stdout_logfile = log/supervisor-gogs-stderr.log
|
||||
stderr_logfile = log/supervisor-gogs-error.log
|
||||
20
gogs.go
20
gogs.go
@@ -4,7 +4,7 @@
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language.
|
||||
// Gogs(Go Git Service) is a painless self-hosted Git Service written in Go.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -13,17 +13,15 @@ import (
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/cmd"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
|
||||
const go12tag = true
|
||||
|
||||
const APP_VER = "0.3.0.0421 Alpha"
|
||||
const APP_VER = "0.5.0.0913 Beta"
|
||||
|
||||
func init() {
|
||||
base.AppVer = APP_VER
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
setting.AppVer = APP_VER
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -32,9 +30,11 @@ func main() {
|
||||
app.Usage = "Go Git Service"
|
||||
app.Version = APP_VER
|
||||
app.Commands = []cli.Command{
|
||||
CmdWeb,
|
||||
CmdServ,
|
||||
CmdUpdate,
|
||||
cmd.CmdWeb,
|
||||
cmd.CmdServ,
|
||||
cmd.CmdUpdate,
|
||||
cmd.CmdFix,
|
||||
cmd.CmdDump,
|
||||
}
|
||||
app.Flags = append(app.Flags, []cli.Flag{}...)
|
||||
app.Run(os.Args)
|
||||
|
||||
@@ -11,26 +11,27 @@ import (
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
// Access types.
|
||||
type AccessType int
|
||||
|
||||
const (
|
||||
AU_READABLE = iota + 1
|
||||
AU_WRITABLE
|
||||
READABLE AccessType = iota + 1
|
||||
WRITABLE
|
||||
)
|
||||
|
||||
// Access represents the accessibility of user to repository.
|
||||
type Access struct {
|
||||
Id int64
|
||||
UserName string `xorm:"unique(s)"`
|
||||
RepoName string `xorm:"unique(s)"` // <user name>/<repo name>
|
||||
Mode int `xorm:"unique(s)"`
|
||||
Created time.Time `xorm:"created"`
|
||||
UserName string `xorm:"UNIQUE(s)"`
|
||||
RepoName string `xorm:"UNIQUE(s)"` // <user name>/<repo name>
|
||||
Mode AccessType `xorm:"UNIQUE(s)"`
|
||||
Created time.Time `xorm:"CREATED"`
|
||||
}
|
||||
|
||||
// AddAccess adds new access record.
|
||||
func AddAccess(access *Access) error {
|
||||
access.UserName = strings.ToLower(access.UserName)
|
||||
access.RepoName = strings.ToLower(access.RepoName)
|
||||
_, err := orm.Insert(access)
|
||||
_, err := x.Insert(access)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -38,7 +39,13 @@ func AddAccess(access *Access) error {
|
||||
func UpdateAccess(access *Access) error {
|
||||
access.UserName = strings.ToLower(access.UserName)
|
||||
access.RepoName = strings.ToLower(access.RepoName)
|
||||
_, err := orm.Id(access.Id).Update(access)
|
||||
_, err := x.Id(access.Id).Update(access)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteAccess deletes access record.
|
||||
func DeleteAccess(access *Access) error {
|
||||
_, err := x.Delete(access)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -52,12 +59,16 @@ func UpdateAccessWithSession(sess *xorm.Session, access *Access) error {
|
||||
}
|
||||
|
||||
// HasAccess returns true if someone can read or write to given repository.
|
||||
func HasAccess(userName, repoName string, mode int) (bool, error) {
|
||||
// The repoName should be in format <username>/<reponame>.
|
||||
func HasAccess(uname, repoName string, mode AccessType) (bool, error) {
|
||||
if len(repoName) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
access := &Access{
|
||||
UserName: strings.ToLower(userName),
|
||||
UserName: strings.ToLower(uname),
|
||||
RepoName: strings.ToLower(repoName),
|
||||
}
|
||||
has, err := orm.Get(access)
|
||||
has, err := x.Get(access)
|
||||
if err != nil {
|
||||
return false, err
|
||||
} else if !has {
|
||||
|
||||
333
models/action.go
333
models/action.go
@@ -6,46 +6,69 @@ package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gogits/git"
|
||||
"unicode"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/git"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
// Operation types of user action.
|
||||
type ActionType int
|
||||
|
||||
const (
|
||||
OP_CREATE_REPO = iota + 1
|
||||
OP_DELETE_REPO
|
||||
OP_STAR_REPO
|
||||
OP_FOLLOW_REPO
|
||||
OP_COMMIT_REPO
|
||||
OP_CREATE_ISSUE
|
||||
OP_PULL_REQUEST
|
||||
OP_TRANSFER_REPO
|
||||
OP_PUSH_TAG
|
||||
CREATE_REPO ActionType = iota + 1 // 1
|
||||
DELETE_REPO // 2
|
||||
STAR_REPO // 3
|
||||
FOLLOW_REPO // 4
|
||||
COMMIT_REPO // 5
|
||||
CREATE_ISSUE // 6
|
||||
PULL_REQUEST // 7
|
||||
TRANSFER_REPO // 8
|
||||
PUSH_TAG // 9
|
||||
COMMENT_ISSUE // 10
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNotImplemented = errors.New("Not implemented yet")
|
||||
)
|
||||
|
||||
var (
|
||||
// Same as Github. See https://help.github.com/articles/closing-issues-via-commit-messages
|
||||
IssueKeywords = []string{"close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"}
|
||||
IssueKeywordsPat *regexp.Regexp
|
||||
)
|
||||
|
||||
func init() {
|
||||
IssueKeywordsPat = regexp.MustCompile(fmt.Sprintf(`(?i)(?:%s) \S+`, strings.Join(IssueKeywords, "|")))
|
||||
}
|
||||
|
||||
// Action represents user operation type and other information to repository.,
|
||||
// it implemented interface base.Actioner so that can be used in template render.
|
||||
type Action struct {
|
||||
Id int64
|
||||
UserId int64 // Receiver user id.
|
||||
OpType int // Operations: CREATE DELETE STAR ...
|
||||
ActUserId int64 // Action user id.
|
||||
ActUserName string // Action user name.
|
||||
ActEmail string
|
||||
RepoId int64
|
||||
RepoName string
|
||||
RefName string
|
||||
Content string `xorm:"TEXT"`
|
||||
Created time.Time `xorm:"created"`
|
||||
Id int64
|
||||
UserId int64 // Receiver user id.
|
||||
OpType ActionType
|
||||
ActUserId int64 // Action user id.
|
||||
ActUserName string // Action user name.
|
||||
ActEmail string
|
||||
RepoId int64
|
||||
RepoUserName string
|
||||
RepoName string
|
||||
RefName string
|
||||
IsPrivate bool `xorm:"NOT NULL DEFAULT false"`
|
||||
Content string `xorm:"TEXT"`
|
||||
Created time.Time `xorm:"created"`
|
||||
}
|
||||
|
||||
func (a Action) GetOpType() int {
|
||||
return a.OpType
|
||||
return int(a.OpType)
|
||||
}
|
||||
|
||||
func (a Action) GetActUserName() string {
|
||||
@@ -56,10 +79,18 @@ func (a Action) GetActEmail() string {
|
||||
return a.ActEmail
|
||||
}
|
||||
|
||||
func (a Action) GetRepoUserName() string {
|
||||
return a.RepoUserName
|
||||
}
|
||||
|
||||
func (a Action) GetRepoName() string {
|
||||
return a.RepoName
|
||||
}
|
||||
|
||||
func (a Action) GetRepoLink() string {
|
||||
return path.Join(a.RepoUserName, a.RepoName)
|
||||
}
|
||||
|
||||
func (a Action) GetBranch() string {
|
||||
return a.RefName
|
||||
}
|
||||
@@ -68,80 +99,258 @@ func (a Action) GetContent() string {
|
||||
return a.Content
|
||||
}
|
||||
|
||||
// CommitRepoAction adds new action for committing repository.
|
||||
func CommitRepoAction(userId int64, userName, actEmail string,
|
||||
repoId int64, repoName string, refName string, commit *base.PushCommits) error {
|
||||
// log.Trace("action.CommitRepoAction(start): %d/%s", userId, repoName)
|
||||
func (a Action) GetCreate() time.Time {
|
||||
return a.Created
|
||||
}
|
||||
|
||||
opType := OP_COMMIT_REPO
|
||||
func (a Action) GetIssueInfos() []string {
|
||||
return strings.SplitN(a.Content, "|", 2)
|
||||
}
|
||||
|
||||
func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, commits []*base.PushCommit) error {
|
||||
for _, c := range commits {
|
||||
refs := IssueKeywordsPat.FindAllString(c.Message, -1)
|
||||
|
||||
for _, ref := range refs {
|
||||
ref := ref[strings.IndexByte(ref, byte(' '))+1:]
|
||||
ref = strings.TrimRightFunc(ref, func(c rune) bool {
|
||||
return !unicode.IsDigit(c)
|
||||
})
|
||||
|
||||
if len(ref) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// Add repo name if missing
|
||||
if ref[0] == '#' {
|
||||
ref = fmt.Sprintf("%s/%s%s", repoUserName, repoName, ref)
|
||||
} else if strings.Contains(ref, "/") == false {
|
||||
// We don't support User#ID syntax yet
|
||||
// return ErrNotImplemented
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
issue, err := GetIssueByRef(ref)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("/%s/%s/commit/%s", repoUserName, repoName, c.Sha1)
|
||||
message := fmt.Sprintf(`<a href="%s">%s</a>`, url, c.Message)
|
||||
|
||||
if _, err = CreateComment(userId, issue.RepoId, issue.Id, 0, 0, COMMIT, message, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if issue.RepoId == repoId {
|
||||
if issue.IsClosed {
|
||||
continue
|
||||
}
|
||||
|
||||
issue.IsClosed = true
|
||||
|
||||
if err = UpdateIssue(issue); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = ChangeMilestoneIssueStats(issue); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// If commit happened in the referenced repository, it means the issue can be closed.
|
||||
if _, err = CreateComment(userId, repoId, issue.Id, 0, 0, CLOSE, "", nil); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CommitRepoAction adds new action for committing repository.
|
||||
func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
|
||||
repoId int64, repoUserName, repoName string, refFullName string, commit *base.PushCommits, oldCommitId string, newCommitId string) error {
|
||||
|
||||
opType := COMMIT_REPO
|
||||
// Check it's tag push or branch.
|
||||
if strings.HasPrefix(refName, "refs/tags/") {
|
||||
opType = OP_PUSH_TAG
|
||||
if strings.HasPrefix(refFullName, "refs/tags/") {
|
||||
opType = PUSH_TAG
|
||||
commit = &base.PushCommits{}
|
||||
}
|
||||
|
||||
refName = git.RefEndName(refName)
|
||||
refName := git.RefEndName(refFullName)
|
||||
|
||||
bs, err := json.Marshal(commit)
|
||||
if err != nil {
|
||||
log.Error("action.CommitRepoAction(json): %d/%s", userId, repoName)
|
||||
return err
|
||||
}
|
||||
|
||||
if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail,
|
||||
OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil {
|
||||
log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
|
||||
return err
|
||||
return errors.New("action.CommitRepoAction(json): " + err.Error())
|
||||
}
|
||||
|
||||
// Change repository bare status and update last updated time.
|
||||
repo, err := GetRepositoryByName(userId, repoName)
|
||||
repo, err := GetRepositoryByName(repoUserId, repoName)
|
||||
if err != nil {
|
||||
log.Error("action.CommitRepoAction(GetRepositoryByName): %d/%s", userId, repoName)
|
||||
return err
|
||||
return errors.New("action.CommitRepoAction(GetRepositoryByName): " + err.Error())
|
||||
}
|
||||
repo.IsBare = false
|
||||
if err = UpdateRepository(repo); err != nil {
|
||||
log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repoName)
|
||||
return err
|
||||
return errors.New("action.CommitRepoAction(UpdateRepository): " + err.Error())
|
||||
}
|
||||
|
||||
log.Trace("action.CommitRepoAction(end): %d/%s", userId, repoName)
|
||||
err = updateIssuesCommit(userId, repoId, repoUserName, repoName, commit.Commits)
|
||||
|
||||
if err != nil {
|
||||
log.Debug("action.CommitRepoAction(updateIssuesCommit): ", err)
|
||||
}
|
||||
|
||||
if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail,
|
||||
OpType: opType, Content: string(bs), RepoId: repoId, RepoUserName: repoUserName,
|
||||
RepoName: repoName, RefName: refName,
|
||||
IsPrivate: repo.IsPrivate}); err != nil {
|
||||
return errors.New("action.CommitRepoAction(NotifyWatchers): " + err.Error())
|
||||
|
||||
}
|
||||
//qlog.Info("action.CommitRepoAction(end): %d/%s", repoUserId, repoName)
|
||||
|
||||
// New push event hook.
|
||||
if err := repo.GetOwner(); err != nil {
|
||||
return errors.New("action.CommitRepoAction(GetOwner): " + err.Error())
|
||||
}
|
||||
|
||||
ws, err := GetActiveWebhooksByRepoId(repoId)
|
||||
if err != nil {
|
||||
return errors.New("action.CommitRepoAction(GetActiveWebhooksByRepoId): " + err.Error())
|
||||
}
|
||||
|
||||
// check if repo belongs to org and append additional webhooks
|
||||
if repo.Owner.IsOrganization() {
|
||||
// get hooks for org
|
||||
orgws, err := GetActiveWebhooksByOrgId(repo.OwnerId)
|
||||
if err != nil {
|
||||
return errors.New("action.CommitRepoAction(GetActiveWebhooksByOrgId): " + err.Error())
|
||||
}
|
||||
ws = append(ws, orgws...)
|
||||
}
|
||||
|
||||
if len(ws) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
repoLink := fmt.Sprintf("%s%s/%s", setting.AppUrl, repoUserName, repoName)
|
||||
compareUrl := ""
|
||||
// if not the first commit, set the compareUrl
|
||||
if !strings.HasPrefix(oldCommitId, "0000000") {
|
||||
compareUrl = fmt.Sprintf("%s/compare/%s...%s", repoLink, oldCommitId, newCommitId)
|
||||
}
|
||||
commits := make([]*PayloadCommit, len(commit.Commits))
|
||||
for i, cmt := range commit.Commits {
|
||||
commits[i] = &PayloadCommit{
|
||||
Id: cmt.Sha1,
|
||||
Message: cmt.Message,
|
||||
Url: fmt.Sprintf("%s/commit/%s", repoLink, cmt.Sha1),
|
||||
Author: &PayloadAuthor{
|
||||
Name: cmt.AuthorName,
|
||||
Email: cmt.AuthorEmail,
|
||||
},
|
||||
}
|
||||
}
|
||||
p := &Payload{
|
||||
Ref: refFullName,
|
||||
Commits: commits,
|
||||
Repo: &PayloadRepo{
|
||||
Id: repo.Id,
|
||||
Name: repo.LowerName,
|
||||
Url: repoLink,
|
||||
Description: repo.Description,
|
||||
Website: repo.Website,
|
||||
Watchers: repo.NumWatches,
|
||||
Owner: &PayloadAuthor{
|
||||
Name: repoUserName,
|
||||
Email: actEmail,
|
||||
},
|
||||
Private: repo.IsPrivate,
|
||||
},
|
||||
Pusher: &PayloadAuthor{
|
||||
Name: repo.Owner.LowerName,
|
||||
Email: repo.Owner.Email,
|
||||
},
|
||||
Before: oldCommitId,
|
||||
After: newCommitId,
|
||||
CompareUrl: compareUrl,
|
||||
}
|
||||
|
||||
for _, w := range ws {
|
||||
w.GetEvent()
|
||||
if !w.HasPushEvent() {
|
||||
continue
|
||||
}
|
||||
|
||||
switch w.HookTaskType {
|
||||
case SLACK:
|
||||
{
|
||||
s, err := GetSlackPayload(p, w.Meta)
|
||||
if err != nil {
|
||||
return errors.New("action.GetSlackPayload: " + err.Error())
|
||||
}
|
||||
CreateHookTask(&HookTask{
|
||||
Type: w.HookTaskType,
|
||||
Url: w.Url,
|
||||
BasePayload: s,
|
||||
ContentType: w.ContentType,
|
||||
IsSsl: w.IsSsl,
|
||||
})
|
||||
}
|
||||
default:
|
||||
{
|
||||
p.Secret = w.Secret
|
||||
CreateHookTask(&HookTask{
|
||||
Type: w.HookTaskType,
|
||||
Url: w.Url,
|
||||
BasePayload: p,
|
||||
ContentType: w.ContentType,
|
||||
IsSsl: w.IsSsl,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
go DeliverHooks()
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewRepoAction adds new action for creating repository.
|
||||
func NewRepoAction(user *User, repo *Repository) (err error) {
|
||||
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
|
||||
OpType: OP_CREATE_REPO, RepoId: repo.Id, RepoName: repo.Name}); err != nil {
|
||||
log.Error("action.NewRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
|
||||
func NewRepoAction(u *User, repo *Repository) (err error) {
|
||||
if err = NotifyWatchers(&Action{ActUserId: u.Id, ActUserName: u.Name, ActEmail: u.Email,
|
||||
OpType: CREATE_REPO, RepoId: repo.Id, RepoUserName: repo.Owner.Name, RepoName: repo.Name,
|
||||
IsPrivate: repo.IsPrivate}); err != nil {
|
||||
log.Error(4, "NotifyWatchers: %d/%s", u.Id, repo.Name)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Trace("action.NewRepoAction: %s/%s", user.LowerName, repo.LowerName)
|
||||
log.Trace("action.NewRepoAction: %s/%s", u.Name, repo.Name)
|
||||
return err
|
||||
}
|
||||
|
||||
// TransferRepoAction adds new action for transfering repository.
|
||||
func TransferRepoAction(user, newUser *User, repo *Repository) (err error) {
|
||||
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
|
||||
OpType: OP_TRANSFER_REPO, RepoId: repo.Id, RepoName: repo.Name, Content: newUser.Name}); err != nil {
|
||||
log.Error("action.TransferRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
|
||||
func TransferRepoAction(u, newUser *User, repo *Repository) (err error) {
|
||||
if err = NotifyWatchers(&Action{ActUserId: u.Id, ActUserName: u.Name, ActEmail: u.Email,
|
||||
OpType: TRANSFER_REPO, RepoId: repo.Id, RepoName: repo.Name, Content: newUser.Name,
|
||||
IsPrivate: repo.IsPrivate}); err != nil {
|
||||
log.Error(4, "NotifyWatchers: %d/%s", u.Id, repo.Name)
|
||||
return err
|
||||
}
|
||||
|
||||
log.Trace("action.TransferRepoAction: %s/%s", user.LowerName, repo.LowerName)
|
||||
log.Trace("action.TransferRepoAction: %s/%s", u.Name, repo.Name)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetFeeds returns action list of given user in given context.
|
||||
func GetFeeds(userid, offset int64, isProfile bool) ([]Action, error) {
|
||||
actions := make([]Action, 0, 20)
|
||||
sess := orm.Limit(20, int(offset)).Desc("id").Where("user_id=?", userid)
|
||||
func GetFeeds(uid, offset int64, isProfile bool) ([]*Action, error) {
|
||||
actions := make([]*Action, 0, 20)
|
||||
sess := x.Limit(20, int(offset)).Desc("id").Where("user_id=?", uid)
|
||||
if isProfile {
|
||||
sess.And("act_user_id=?", userid)
|
||||
} else {
|
||||
sess.And("act_user_id!=?", userid)
|
||||
sess.Where("is_private=?", false).And("act_user_id=?", uid)
|
||||
}
|
||||
err := sess.Find(&actions)
|
||||
return actions, err
|
||||
|
||||
@@ -6,15 +6,18 @@ package models
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gogits/git"
|
||||
"github.com/Unknwon/com"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/git"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/process"
|
||||
)
|
||||
|
||||
// Diff line types.
|
||||
@@ -49,6 +52,7 @@ type DiffSection struct {
|
||||
|
||||
type DiffFile struct {
|
||||
Name string
|
||||
Index int
|
||||
Addition, Deletion int
|
||||
Type int
|
||||
IsBin bool
|
||||
@@ -66,7 +70,7 @@ func (diff *Diff) NumFiles() int {
|
||||
|
||||
const DIFF_HEAD = "diff --git "
|
||||
|
||||
func ParsePatch(reader io.Reader) (*Diff, error) {
|
||||
func ParsePatch(pid int64, cmd *exec.Cmd, reader io.Reader) (*Diff, error) {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
var (
|
||||
curFile *DiffFile
|
||||
@@ -114,8 +118,8 @@ func ParsePatch(reader io.Reader) (*Diff, error) {
|
||||
|
||||
// Parse line number.
|
||||
ranges := strings.Split(ss[len(ss)-2][1:], " ")
|
||||
leftLine, _ = base.StrTo(strings.Split(ranges[0], ",")[0][1:]).Int()
|
||||
rightLine, _ = base.StrTo(strings.Split(ranges[1], ",")[0]).Int()
|
||||
leftLine, _ = com.StrTo(strings.Split(ranges[0], ",")[0][1:]).Int()
|
||||
rightLine, _ = com.StrTo(strings.Split(ranges[1], ",")[0]).Int()
|
||||
continue
|
||||
case line[0] == '+':
|
||||
curFile.Addition++
|
||||
@@ -144,6 +148,7 @@ func ParsePatch(reader io.Reader) (*Diff, error) {
|
||||
|
||||
curFile = &DiffFile{
|
||||
Name: a[strings.Index(a, "/")+1:],
|
||||
Index: len(diff.Files) + 1,
|
||||
Type: DIFF_FILE_CHANGE,
|
||||
Sections: make([]*DiffSection, 0, 10),
|
||||
}
|
||||
@@ -169,44 +174,63 @@ func ParsePatch(reader io.Reader) (*Diff, error) {
|
||||
return diff, nil
|
||||
}
|
||||
|
||||
func GetDiff(repoPath, commitid string) (*Diff, error) {
|
||||
func GetDiffRange(repoPath, beforeCommitId string, afterCommitId string) (*Diff, error) {
|
||||
repo, err := git.OpenRepository(repoPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
commit, err := repo.GetCommit(commitid)
|
||||
commit, err := repo.GetCommit(afterCommitId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// First commit of repository.
|
||||
if commit.ParentCount() == 0 {
|
||||
rd, wr := io.Pipe()
|
||||
go func() {
|
||||
cmd := exec.Command("git", "show", commitid)
|
||||
cmd.Dir = repoPath
|
||||
cmd.Stdout = wr
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Run()
|
||||
wr.Close()
|
||||
}()
|
||||
defer rd.Close()
|
||||
return ParsePatch(rd)
|
||||
}
|
||||
|
||||
rd, wr := io.Pipe()
|
||||
var cmd *exec.Cmd
|
||||
// if "after" commit given
|
||||
if beforeCommitId == "" {
|
||||
// First commit of repository.
|
||||
if commit.ParentCount() == 0 {
|
||||
cmd = exec.Command("git", "show", afterCommitId)
|
||||
} else {
|
||||
c, _ := commit.Parent(0)
|
||||
cmd = exec.Command("git", "diff", c.Id.String(), afterCommitId)
|
||||
}
|
||||
} else {
|
||||
cmd = exec.Command("git", "diff", beforeCommitId, afterCommitId)
|
||||
}
|
||||
cmd.Dir = repoPath
|
||||
cmd.Stdout = wr
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
done := make(chan error)
|
||||
go func() {
|
||||
c, _ := commit.Parent(0)
|
||||
cmd := exec.Command("git", "diff", c.Id.String(), commitid)
|
||||
cmd.Dir = repoPath
|
||||
cmd.Stdout = wr
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Run()
|
||||
cmd.Start()
|
||||
done <- cmd.Wait()
|
||||
wr.Close()
|
||||
}()
|
||||
defer rd.Close()
|
||||
return ParsePatch(rd)
|
||||
|
||||
desc := fmt.Sprintf("GetDiffRange(%s)", repoPath)
|
||||
pid := process.Add(desc, cmd)
|
||||
go func() {
|
||||
// In case process became zombie.
|
||||
select {
|
||||
case <-time.After(5 * time.Minute):
|
||||
if errKill := process.Kill(pid); errKill != nil {
|
||||
log.Error(4, "git_diff.ParsePatch(Kill): %v", err)
|
||||
}
|
||||
<-done
|
||||
// return "", ErrExecTimeout.Error(), ErrExecTimeout
|
||||
case err = <-done:
|
||||
process.Remove(pid)
|
||||
}
|
||||
}()
|
||||
|
||||
return ParsePatch(pid, cmd, rd)
|
||||
}
|
||||
|
||||
func GetDiffCommit(repoPath, commitId string) (*Diff, error) {
|
||||
return GetDiffRange(repoPath, "", commitId)
|
||||
}
|
||||
|
||||
1033
models/issue.go
1033
models/issue.go
File diff suppressed because it is too large
Load Diff
364
models/login.go
Normal file
364
models/login.go
Normal file
@@ -0,0 +1,364 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/smtp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-xorm/core"
|
||||
"github.com/go-xorm/xorm"
|
||||
|
||||
"github.com/gogits/gogs/modules/auth/ldap"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
type LoginType int
|
||||
|
||||
const (
|
||||
NOTYPE LoginType = iota
|
||||
PLAIN
|
||||
LDAP
|
||||
SMTP
|
||||
)
|
||||
|
||||
var (
|
||||
ErrAuthenticationAlreadyExist = errors.New("Authentication already exist")
|
||||
ErrAuthenticationNotExist = errors.New("Authentication does not exist")
|
||||
ErrAuthenticationUserUsed = errors.New("Authentication has been used by some users")
|
||||
)
|
||||
|
||||
var LoginTypes = map[LoginType]string{
|
||||
LDAP: "LDAP",
|
||||
SMTP: "SMTP",
|
||||
}
|
||||
|
||||
// Ensure structs implmented interface.
|
||||
var (
|
||||
_ core.Conversion = &LDAPConfig{}
|
||||
_ core.Conversion = &SMTPConfig{}
|
||||
)
|
||||
|
||||
type LDAPConfig struct {
|
||||
ldap.Ldapsource
|
||||
}
|
||||
|
||||
func (cfg *LDAPConfig) FromDB(bs []byte) error {
|
||||
return json.Unmarshal(bs, &cfg.Ldapsource)
|
||||
}
|
||||
|
||||
func (cfg *LDAPConfig) ToDB() ([]byte, error) {
|
||||
return json.Marshal(cfg.Ldapsource)
|
||||
}
|
||||
|
||||
type SMTPConfig struct {
|
||||
Auth string
|
||||
Host string
|
||||
Port int
|
||||
TLS bool
|
||||
}
|
||||
|
||||
func (cfg *SMTPConfig) FromDB(bs []byte) error {
|
||||
return json.Unmarshal(bs, cfg)
|
||||
}
|
||||
|
||||
func (cfg *SMTPConfig) ToDB() ([]byte, error) {
|
||||
return json.Marshal(cfg)
|
||||
}
|
||||
|
||||
type LoginSource struct {
|
||||
Id int64
|
||||
Type LoginType
|
||||
Name string `xorm:"UNIQUE"`
|
||||
IsActived bool `xorm:"NOT NULL DEFAULT false"`
|
||||
Cfg core.Conversion `xorm:"TEXT"`
|
||||
AllowAutoRegister bool `xorm:"NOT NULL DEFAULT false"`
|
||||
Created time.Time `xorm:"CREATED"`
|
||||
Updated time.Time `xorm:"UPDATED"`
|
||||
}
|
||||
|
||||
func (source *LoginSource) TypeString() string {
|
||||
return LoginTypes[source.Type]
|
||||
}
|
||||
|
||||
func (source *LoginSource) LDAP() *LDAPConfig {
|
||||
return source.Cfg.(*LDAPConfig)
|
||||
}
|
||||
|
||||
func (source *LoginSource) SMTP() *SMTPConfig {
|
||||
return source.Cfg.(*SMTPConfig)
|
||||
}
|
||||
|
||||
func (source *LoginSource) BeforeSet(colName string, val xorm.Cell) {
|
||||
if colName == "type" {
|
||||
ty := (*val).(int64)
|
||||
switch LoginType(ty) {
|
||||
case LDAP:
|
||||
source.Cfg = new(LDAPConfig)
|
||||
case SMTP:
|
||||
source.Cfg = new(SMTPConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func CreateSource(source *LoginSource) error {
|
||||
_, err := x.Insert(source)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetAuths() ([]*LoginSource, error) {
|
||||
var auths = make([]*LoginSource, 0, 5)
|
||||
err := x.Find(&auths)
|
||||
return auths, err
|
||||
}
|
||||
|
||||
func GetLoginSourceById(id int64) (*LoginSource, error) {
|
||||
source := new(LoginSource)
|
||||
has, err := x.Id(id).Get(source)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrAuthenticationNotExist
|
||||
}
|
||||
return source, nil
|
||||
}
|
||||
|
||||
func UpdateSource(source *LoginSource) error {
|
||||
_, err := x.Id(source.Id).AllCols().Update(source)
|
||||
return err
|
||||
}
|
||||
|
||||
func DelLoginSource(source *LoginSource) error {
|
||||
cnt, err := x.Count(&User{LoginSource: source.Id})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if cnt > 0 {
|
||||
return ErrAuthenticationUserUsed
|
||||
}
|
||||
_, err = x.Id(source.Id).Delete(&LoginSource{})
|
||||
return err
|
||||
}
|
||||
|
||||
// UserSignIn validates user name and password.
|
||||
func UserSignIn(uname, passwd string) (*User, error) {
|
||||
var u *User
|
||||
if strings.Contains(uname, "@") {
|
||||
u = &User{Email: uname}
|
||||
} else {
|
||||
u = &User{LowerName: strings.ToLower(uname)}
|
||||
}
|
||||
|
||||
has, err := x.Get(u)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if u.LoginType == NOTYPE {
|
||||
if has {
|
||||
u.LoginType = PLAIN
|
||||
} else {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
}
|
||||
|
||||
// For plain login, user must exist to reach this line.
|
||||
// Now verify password.
|
||||
if u.LoginType == PLAIN {
|
||||
newUser := &User{Passwd: passwd, Salt: u.Salt}
|
||||
newUser.EncodePasswd()
|
||||
if u.Passwd != newUser.Passwd {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
return u, nil
|
||||
} else {
|
||||
if !has {
|
||||
var sources []LoginSource
|
||||
if err = x.UseBool().Find(&sources,
|
||||
&LoginSource{IsActived: true, AllowAutoRegister: true}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, source := range sources {
|
||||
if source.Type == LDAP {
|
||||
u, err := LoginUserLdapSource(nil, uname, passwd,
|
||||
source.Id, source.Cfg.(*LDAPConfig), true)
|
||||
if err == nil {
|
||||
return u, nil
|
||||
}
|
||||
log.Warn("Fail to login(%s) by LDAP(%s): %v", uname, source.Name, err)
|
||||
} else if source.Type == SMTP {
|
||||
u, err := LoginUserSMTPSource(nil, uname, passwd,
|
||||
source.Id, source.Cfg.(*SMTPConfig), true)
|
||||
if err == nil {
|
||||
return u, nil
|
||||
}
|
||||
log.Warn("Fail to login(%s) by SMTP(%s): %v", uname, source.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
|
||||
var source LoginSource
|
||||
hasSource, err := x.Id(u.LoginSource).Get(&source)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !hasSource {
|
||||
return nil, ErrLoginSourceNotExist
|
||||
} else if !source.IsActived {
|
||||
return nil, ErrLoginSourceNotActived
|
||||
}
|
||||
|
||||
switch u.LoginType {
|
||||
case LDAP:
|
||||
return LoginUserLdapSource(u, u.LoginName, passwd,
|
||||
source.Id, source.Cfg.(*LDAPConfig), false)
|
||||
case SMTP:
|
||||
return LoginUserSMTPSource(u, u.LoginName, passwd,
|
||||
source.Id, source.Cfg.(*SMTPConfig), false)
|
||||
}
|
||||
return nil, ErrUnsupportedLoginType
|
||||
}
|
||||
}
|
||||
|
||||
// Query if name/passwd can login against the LDAP direcotry pool
|
||||
// Create a local user if success
|
||||
// Return the same LoginUserPlain semantic
|
||||
func LoginUserLdapSource(u *User, name, passwd string, sourceId int64, cfg *LDAPConfig, autoRegister bool) (*User, error) {
|
||||
mail, logged := cfg.Ldapsource.SearchEntry(name, passwd)
|
||||
if !logged {
|
||||
// user not in LDAP, do nothing
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
if !autoRegister {
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// fake a local user creation
|
||||
u = &User{
|
||||
LowerName: strings.ToLower(name),
|
||||
Name: strings.ToLower(name),
|
||||
LoginType: LDAP,
|
||||
LoginSource: sourceId,
|
||||
LoginName: name,
|
||||
IsActive: true,
|
||||
Passwd: passwd,
|
||||
Email: mail,
|
||||
}
|
||||
|
||||
err := CreateUser(u)
|
||||
return u, err
|
||||
}
|
||||
|
||||
type loginAuth struct {
|
||||
username, password string
|
||||
}
|
||||
|
||||
func LoginAuth(username, password string) smtp.Auth {
|
||||
return &loginAuth{username, password}
|
||||
}
|
||||
|
||||
func (a *loginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
|
||||
return "LOGIN", []byte(a.username), nil
|
||||
}
|
||||
|
||||
func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
|
||||
if more {
|
||||
switch string(fromServer) {
|
||||
case "Username:":
|
||||
return []byte(a.username), nil
|
||||
case "Password:":
|
||||
return []byte(a.password), nil
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var (
|
||||
SMTP_PLAIN = "PLAIN"
|
||||
SMTP_LOGIN = "LOGIN"
|
||||
SMTPAuths = []string{SMTP_PLAIN, SMTP_LOGIN}
|
||||
)
|
||||
|
||||
func SmtpAuth(host string, port int, a smtp.Auth, useTls bool) error {
|
||||
c, err := smtp.Dial(fmt.Sprintf("%s:%d", host, port))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
if err = c.Hello("gogs"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if useTls {
|
||||
if ok, _ := c.Extension("STARTTLS"); ok {
|
||||
config := &tls.Config{ServerName: host}
|
||||
if err = c.StartTLS(config); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return errors.New("SMTP server unsupports TLS")
|
||||
}
|
||||
}
|
||||
|
||||
if ok, _ := c.Extension("AUTH"); ok {
|
||||
if err = c.Auth(a); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return ErrUnsupportedLoginType
|
||||
}
|
||||
|
||||
// Query if name/passwd can login against the LDAP direcotry pool
|
||||
// Create a local user if success
|
||||
// Return the same LoginUserPlain semantic
|
||||
func LoginUserSMTPSource(u *User, name, passwd string, sourceId int64, cfg *SMTPConfig, autoRegister bool) (*User, error) {
|
||||
var auth smtp.Auth
|
||||
if cfg.Auth == SMTP_PLAIN {
|
||||
auth = smtp.PlainAuth("", name, passwd, cfg.Host)
|
||||
} else if cfg.Auth == SMTP_LOGIN {
|
||||
auth = LoginAuth(name, passwd)
|
||||
} else {
|
||||
return nil, errors.New("Unsupported SMTP auth type")
|
||||
}
|
||||
|
||||
if err := SmtpAuth(cfg.Host, cfg.Port, auth, cfg.TLS); err != nil {
|
||||
if strings.Contains(err.Error(), "Username and Password not accepted") {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !autoRegister {
|
||||
return u, nil
|
||||
}
|
||||
|
||||
var loginName = name
|
||||
idx := strings.Index(name, "@")
|
||||
if idx > -1 {
|
||||
loginName = name[:idx]
|
||||
}
|
||||
// fake a local user creation
|
||||
u = &User{
|
||||
LowerName: strings.ToLower(loginName),
|
||||
Name: strings.ToLower(loginName),
|
||||
LoginType: SMTP,
|
||||
LoginSource: sourceId,
|
||||
LoginName: name,
|
||||
IsActive: true,
|
||||
Passwd: passwd,
|
||||
Email: name,
|
||||
}
|
||||
err := CreateUser(u)
|
||||
return u, err
|
||||
}
|
||||
145
models/models.go
145
models/models.go
@@ -14,11 +14,11 @@ import (
|
||||
"github.com/go-xorm/xorm"
|
||||
_ "github.com/lib/pq"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
var (
|
||||
orm *xorm.Engine
|
||||
x *xorm.Engine
|
||||
tables []interface{}
|
||||
|
||||
HasEngine bool
|
||||
@@ -32,98 +32,89 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
tables = append(tables, new(User), new(PublicKey), new(Repository), new(Watch),
|
||||
new(Action), new(Access), new(Issue), new(Comment), new(Oauth2), new(Follow),
|
||||
new(Mirror), new(Release))
|
||||
tables = append(tables, new(User), new(PublicKey),
|
||||
new(Repository), new(Watch), new(Star), new(Action), new(Access),
|
||||
new(Issue), new(Comment), new(Oauth2), new(Follow),
|
||||
new(Mirror), new(Release), new(LoginSource), new(Webhook), new(IssueUser),
|
||||
new(Milestone), new(Label), new(HookTask), new(Team), new(OrgUser), new(TeamUser),
|
||||
new(UpdateTask), new(Attachment))
|
||||
}
|
||||
|
||||
func LoadModelsConfig() {
|
||||
DbCfg.Type = base.Cfg.MustValue("database", "DB_TYPE")
|
||||
DbCfg.Type = setting.Cfg.MustValue("database", "DB_TYPE")
|
||||
if DbCfg.Type == "sqlite3" {
|
||||
UseSQLite3 = true
|
||||
}
|
||||
DbCfg.Host = base.Cfg.MustValue("database", "HOST")
|
||||
DbCfg.Name = base.Cfg.MustValue("database", "NAME")
|
||||
DbCfg.User = base.Cfg.MustValue("database", "USER")
|
||||
DbCfg.Pwd = base.Cfg.MustValue("database", "PASSWD")
|
||||
DbCfg.SslMode = base.Cfg.MustValue("database", "SSL_MODE")
|
||||
DbCfg.Path = base.Cfg.MustValue("database", "PATH", "data/gogs.db")
|
||||
DbCfg.Host = setting.Cfg.MustValue("database", "HOST")
|
||||
DbCfg.Name = setting.Cfg.MustValue("database", "NAME")
|
||||
DbCfg.User = setting.Cfg.MustValue("database", "USER")
|
||||
if len(DbCfg.Pwd) == 0 {
|
||||
DbCfg.Pwd = setting.Cfg.MustValue("database", "PASSWD")
|
||||
}
|
||||
DbCfg.SslMode = setting.Cfg.MustValue("database", "SSL_MODE")
|
||||
DbCfg.Path = setting.Cfg.MustValue("database", "PATH", "data/gogs.db")
|
||||
}
|
||||
|
||||
func NewTestEngine(x *xorm.Engine) (err error) {
|
||||
func getEngine() (*xorm.Engine, error) {
|
||||
cnnstr := ""
|
||||
switch DbCfg.Type {
|
||||
case "mysql":
|
||||
x, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
|
||||
DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name))
|
||||
cnnstr = fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
|
||||
DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name)
|
||||
case "postgres":
|
||||
var host, port = "127.0.0.1", "5432"
|
||||
fields := strings.Split(DbCfg.Host, ":")
|
||||
if len(fields) > 0 {
|
||||
if len(fields) > 0 && len(strings.TrimSpace(fields[0])) > 0 {
|
||||
host = fields[0]
|
||||
}
|
||||
if len(fields) > 1 {
|
||||
if len(fields) > 1 && len(strings.TrimSpace(fields[1])) > 0 {
|
||||
port = fields[1]
|
||||
}
|
||||
cnnstr := fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s",
|
||||
cnnstr = fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s",
|
||||
DbCfg.User, DbCfg.Pwd, host, port, DbCfg.Name, DbCfg.SslMode)
|
||||
//fmt.Println(cnnstr)
|
||||
x, err = xorm.NewEngine("postgres", cnnstr)
|
||||
case "sqlite3":
|
||||
if !EnableSQLite3 {
|
||||
return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
|
||||
return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type)
|
||||
}
|
||||
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
|
||||
x, err = xorm.NewEngine("sqlite3", DbCfg.Path)
|
||||
cnnstr = "file:" + DbCfg.Path + "?cache=shared&mode=rwc"
|
||||
default:
|
||||
return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
|
||||
return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type)
|
||||
}
|
||||
return xorm.NewEngine(DbCfg.Type, cnnstr)
|
||||
}
|
||||
|
||||
func NewTestEngine(x *xorm.Engine) (err error) {
|
||||
x, err = getEngine()
|
||||
if err != nil {
|
||||
return fmt.Errorf("models.init(fail to conntect database): %v", err)
|
||||
}
|
||||
|
||||
return x.Sync(tables...)
|
||||
}
|
||||
|
||||
func SetEngine() (err error) {
|
||||
switch DbCfg.Type {
|
||||
case "mysql":
|
||||
orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
|
||||
DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name))
|
||||
case "postgres":
|
||||
var host, port = "127.0.0.1", "5432"
|
||||
fields := strings.Split(DbCfg.Host, ":")
|
||||
if len(fields) > 0 {
|
||||
host = fields[0]
|
||||
}
|
||||
if len(fields) > 1 {
|
||||
port = fields[1]
|
||||
}
|
||||
orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s",
|
||||
DbCfg.User, DbCfg.Pwd, host, port, DbCfg.Name, DbCfg.SslMode))
|
||||
case "sqlite3":
|
||||
os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm)
|
||||
orm, err = xorm.NewEngine("sqlite3", DbCfg.Path)
|
||||
default:
|
||||
return fmt.Errorf("Unknown database type: %s", DbCfg.Type)
|
||||
}
|
||||
x, err = getEngine()
|
||||
if err != nil {
|
||||
return fmt.Errorf("models.init(fail to conntect database): %v", err)
|
||||
}
|
||||
|
||||
// WARNNING: for serv command, MUST remove the output to os.stdout,
|
||||
// so use log file to instead print to stdout.
|
||||
execDir, _ := base.ExecDir()
|
||||
logPath := execDir + "/log/xorm.log"
|
||||
logPath := path.Join(setting.LogRootPath, "xorm.log")
|
||||
os.MkdirAll(path.Dir(logPath), os.ModePerm)
|
||||
|
||||
f, err := os.Create(logPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("models.init(fail to create xorm.log): %v", err)
|
||||
}
|
||||
orm.Logger = xorm.NewSimpleLogger(f)
|
||||
x.Logger = xorm.NewSimpleLogger(f)
|
||||
|
||||
orm.ShowSQL = true
|
||||
orm.ShowDebug = true
|
||||
orm.ShowErr = true
|
||||
x.ShowSQL = true
|
||||
x.ShowInfo = true
|
||||
x.ShowDebug = true
|
||||
x.ShowErr = true
|
||||
x.ShowWarn = true
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -131,7 +122,7 @@ func NewEngine() (err error) {
|
||||
if err = SetEngine(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = orm.Sync(tables...); err != nil {
|
||||
if err = x.Sync2(tables...); err != nil {
|
||||
return fmt.Errorf("sync database struct error: %v\n", err)
|
||||
}
|
||||
return nil
|
||||
@@ -139,24 +130,46 @@ func NewEngine() (err error) {
|
||||
|
||||
type Statistic struct {
|
||||
Counter struct {
|
||||
User, PublicKey, Repo,
|
||||
Watch, Action, Access,
|
||||
Issue, Comment,
|
||||
Mirror, Oauth, Release int64
|
||||
User, Org, PublicKey,
|
||||
Repo, Watch, Star, Action, Access,
|
||||
Issue, Comment, Oauth, Follow,
|
||||
Mirror, Release, LoginSource, Webhook,
|
||||
Milestone, Label, HookTask,
|
||||
Team, UpdateTask, Attachment int64
|
||||
}
|
||||
}
|
||||
|
||||
func GetStatistic() (stats Statistic) {
|
||||
stats.Counter.User, _ = orm.Count(new(User))
|
||||
stats.Counter.PublicKey, _ = orm.Count(new(PublicKey))
|
||||
stats.Counter.Repo, _ = orm.Count(new(Repository))
|
||||
stats.Counter.Watch, _ = orm.Count(new(Watch))
|
||||
stats.Counter.Action, _ = orm.Count(new(Action))
|
||||
stats.Counter.Access, _ = orm.Count(new(Access))
|
||||
stats.Counter.Issue, _ = orm.Count(new(Issue))
|
||||
stats.Counter.Comment, _ = orm.Count(new(Comment))
|
||||
stats.Counter.Mirror, _ = orm.Count(new(Mirror))
|
||||
stats.Counter.Oauth, _ = orm.Count(new(Oauth2))
|
||||
stats.Counter.Release, _ = orm.Count(new(Release))
|
||||
stats.Counter.User = CountUsers()
|
||||
stats.Counter.Org = CountOrganizations()
|
||||
stats.Counter.PublicKey, _ = x.Count(new(PublicKey))
|
||||
stats.Counter.Repo = CountRepositories()
|
||||
stats.Counter.Watch, _ = x.Count(new(Watch))
|
||||
stats.Counter.Star, _ = x.Count(new(Star))
|
||||
stats.Counter.Action, _ = x.Count(new(Action))
|
||||
stats.Counter.Access, _ = x.Count(new(Access))
|
||||
stats.Counter.Issue, _ = x.Count(new(Issue))
|
||||
stats.Counter.Comment, _ = x.Count(new(Comment))
|
||||
stats.Counter.Oauth, _ = x.Count(new(Oauth2))
|
||||
stats.Counter.Follow, _ = x.Count(new(Follow))
|
||||
stats.Counter.Mirror, _ = x.Count(new(Mirror))
|
||||
stats.Counter.Release, _ = x.Count(new(Release))
|
||||
stats.Counter.LoginSource, _ = x.Count(new(LoginSource))
|
||||
stats.Counter.Webhook, _ = x.Count(new(Webhook))
|
||||
stats.Counter.Milestone, _ = x.Count(new(Milestone))
|
||||
stats.Counter.Label, _ = x.Count(new(Label))
|
||||
stats.Counter.HookTask, _ = x.Count(new(HookTask))
|
||||
stats.Counter.Team, _ = x.Count(new(Team))
|
||||
stats.Counter.UpdateTask, _ = x.Count(new(UpdateTask))
|
||||
stats.Counter.Attachment, _ = x.Count(new(Attachment))
|
||||
return
|
||||
}
|
||||
|
||||
func Ping() error {
|
||||
return x.Ping()
|
||||
}
|
||||
|
||||
// DumpDatabase dumps all data from database to file system.
|
||||
func DumpDatabase(filePath string) error {
|
||||
return x.DumpAllToFile(filePath)
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/lunny/xorm"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
)
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
orm, err = xorm.NewEngine("sqlite3", "./test.db")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
orm.ShowSQL = true
|
||||
orm.ShowDebug = true
|
||||
|
||||
err = orm.Sync(&User{}, &Repository{})
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
base.RepoRootPath = "test"
|
||||
}
|
||||
|
||||
func TestCreateRepository(t *testing.T) {
|
||||
user := User{Id: 1, Name: "foobar", Type: UT_INDIVIDUAL}
|
||||
_, err := CreateRepository(&user, "test", "", "", "test repo desc", false, false)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteRepository(t *testing.T) {
|
||||
err := DeleteRepository(1, 1, "foobar")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommitRepoAction(t *testing.T) {
|
||||
Convey("Create a commit repository action", t, func() {
|
||||
|
||||
})
|
||||
}
|
||||
@@ -6,18 +6,19 @@ package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
// OT: Oauth2 Type
|
||||
type OauthType int
|
||||
|
||||
const (
|
||||
OT_GITHUB = iota + 1
|
||||
OT_GOOGLE
|
||||
OT_TWITTER
|
||||
OT_QQ
|
||||
OT_WEIBO
|
||||
OT_BITBUCKET
|
||||
OT_OSCHINA
|
||||
OT_FACEBOOK
|
||||
GITHUB OauthType = iota + 1
|
||||
GOOGLE
|
||||
TWITTER
|
||||
QQ
|
||||
WEIBO
|
||||
BITBUCKET
|
||||
FACEBOOK
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -26,27 +27,30 @@ var (
|
||||
)
|
||||
|
||||
type Oauth2 struct {
|
||||
Id int64
|
||||
Uid int64 `xorm:"unique(s)"` // userId
|
||||
User *User `xorm:"-"`
|
||||
Type int `xorm:"unique(s) unique(oauth)"` // twitter,github,google...
|
||||
Identity string `xorm:"unique(s) unique(oauth)"` // id..
|
||||
Token string `xorm:"TEXT not null"`
|
||||
Id int64
|
||||
Uid int64 `xorm:"unique(s)"` // userId
|
||||
User *User `xorm:"-"`
|
||||
Type int `xorm:"unique(s) unique(oauth)"` // twitter,github,google...
|
||||
Identity string `xorm:"unique(s) unique(oauth)"` // id..
|
||||
Token string `xorm:"TEXT not null"`
|
||||
Created time.Time `xorm:"CREATED"`
|
||||
Updated time.Time
|
||||
HasRecentActivity bool `xorm:"-"`
|
||||
}
|
||||
|
||||
func BindUserOauth2(userId, oauthId int64) error {
|
||||
_, err := orm.Id(oauthId).Update(&Oauth2{Uid: userId})
|
||||
_, err := x.Id(oauthId).Update(&Oauth2{Uid: userId})
|
||||
return err
|
||||
}
|
||||
|
||||
func AddOauth2(oa *Oauth2) error {
|
||||
_, err := orm.Insert(oa)
|
||||
_, err := x.Insert(oa)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetOauth2(identity string) (oa *Oauth2, err error) {
|
||||
oa = &Oauth2{Identity: identity}
|
||||
isExist, err := orm.Get(oa)
|
||||
isExist, err := x.Get(oa)
|
||||
if err != nil {
|
||||
return
|
||||
} else if !isExist {
|
||||
@@ -60,7 +64,7 @@ func GetOauth2(identity string) (oa *Oauth2, err error) {
|
||||
|
||||
func GetOauth2ById(id int64) (oa *Oauth2, err error) {
|
||||
oa = new(Oauth2)
|
||||
has, err := orm.Id(id).Get(oa)
|
||||
has, err := x.Id(id).Get(oa)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
@@ -69,8 +73,34 @@ func GetOauth2ById(id int64) (oa *Oauth2, err error) {
|
||||
return oa, nil
|
||||
}
|
||||
|
||||
// GetOauthByUserId returns list of oauthes that are releated to given user.
|
||||
func GetOauthByUserId(uid int64) (oas []*Oauth2, err error) {
|
||||
err = orm.Find(&oas, Oauth2{Uid: uid})
|
||||
return oas, err
|
||||
// UpdateOauth2 updates given OAuth2.
|
||||
func UpdateOauth2(oa *Oauth2) error {
|
||||
_, err := x.Id(oa.Id).AllCols().Update(oa)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetOauthByUserId returns list of oauthes that are releated to given user.
|
||||
func GetOauthByUserId(uid int64) ([]*Oauth2, error) {
|
||||
socials := make([]*Oauth2, 0, 5)
|
||||
err := x.Find(&socials, Oauth2{Uid: uid})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, social := range socials {
|
||||
social.HasRecentActivity = social.Updated.Add(7 * 24 * time.Hour).After(time.Now())
|
||||
}
|
||||
return socials, err
|
||||
}
|
||||
|
||||
// DeleteOauth2ById deletes a oauth2 by ID.
|
||||
func DeleteOauth2ById(id int64) error {
|
||||
_, err := x.Delete(&Oauth2{Id: id})
|
||||
return err
|
||||
}
|
||||
|
||||
// CleanUnbindOauth deletes all unbind OAuthes.
|
||||
func CleanUnbindOauth() error {
|
||||
_, err := x.Delete(&Oauth2{Uid: -1})
|
||||
return err
|
||||
}
|
||||
|
||||
1085
models/org.go
Normal file
1085
models/org.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -21,22 +21,24 @@ import (
|
||||
"github.com/Unknwon/com"
|
||||
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/process"
|
||||
)
|
||||
|
||||
const (
|
||||
// "### autogenerated by gitgos, DO NOT EDIT\n"
|
||||
TPL_PUBLICK_KEY = `command="%s serv key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s`
|
||||
_TPL_PUBLICK_KEY = `command="%s serv key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrKeyAlreadyExist = errors.New("Public key already exist")
|
||||
ErrKeyNotExist = errors.New("Public key does not exist")
|
||||
)
|
||||
|
||||
var sshOpLocker = sync.Mutex{}
|
||||
|
||||
var (
|
||||
sshPath string
|
||||
appPath string
|
||||
SshPath string // SSH directory.
|
||||
appPath string // Execution(binary) path.
|
||||
)
|
||||
|
||||
// exePath returns the executable path.
|
||||
@@ -52,7 +54,7 @@ func exePath() (string, error) {
|
||||
func homeDir() string {
|
||||
home, err := com.HomeDir()
|
||||
if err != nil {
|
||||
return "/"
|
||||
log.Fatal(4, "Fail to get home directory: %v", err)
|
||||
}
|
||||
return home
|
||||
}
|
||||
@@ -60,40 +62,118 @@ func homeDir() string {
|
||||
func init() {
|
||||
var err error
|
||||
|
||||
appPath, err = exePath()
|
||||
if err != nil {
|
||||
fmt.Printf("publickey.init(fail to get app path): %v\n", err)
|
||||
os.Exit(2)
|
||||
if appPath, err = exePath(); err != nil {
|
||||
log.Fatal(4, "fail to get app path: %v\n", err)
|
||||
}
|
||||
appPath = strings.Replace(appPath, "\\", "/", -1)
|
||||
|
||||
// Determine and create .ssh path.
|
||||
sshPath = filepath.Join(homeDir(), ".ssh")
|
||||
if err = os.MkdirAll(sshPath, os.ModePerm); err != nil {
|
||||
fmt.Printf("publickey.init(fail to create sshPath(%s)): %v\n", sshPath, err)
|
||||
os.Exit(2)
|
||||
SshPath = filepath.Join(homeDir(), ".ssh")
|
||||
if err = os.MkdirAll(SshPath, 0700); err != nil {
|
||||
log.Fatal(4, "fail to create SshPath(%s): %v\n", SshPath, err)
|
||||
}
|
||||
}
|
||||
|
||||
// PublicKey represents a SSH key of user.
|
||||
// PublicKey represents a SSH key.
|
||||
type PublicKey struct {
|
||||
Id int64
|
||||
OwnerId int64 `xorm:"unique(s) index not null"`
|
||||
Name string `xorm:"unique(s) not null"`
|
||||
Fingerprint string
|
||||
Content string `xorm:"TEXT not null"`
|
||||
Created time.Time `xorm:"created"`
|
||||
Updated time.Time `xorm:"updated"`
|
||||
Id int64
|
||||
OwnerId int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
|
||||
Name string `xorm:"UNIQUE(s) NOT NULL"`
|
||||
Fingerprint string
|
||||
Content string `xorm:"TEXT NOT NULL"`
|
||||
Created time.Time `xorm:"CREATED"`
|
||||
Updated time.Time
|
||||
HasRecentActivity bool `xorm:"-"`
|
||||
HasUsed bool `xorm:"-"`
|
||||
}
|
||||
|
||||
// GenAuthorizedKey returns formatted public key string.
|
||||
func GenAuthorizedKey(keyId int64, key string) string {
|
||||
return fmt.Sprintf(TPL_PUBLICK_KEY+"\n", appPath, keyId, key)
|
||||
// GetAuthorizedString generates and returns formatted public key string for authorized_keys file.
|
||||
func (key *PublicKey) GetAuthorizedString() string {
|
||||
return fmt.Sprintf(_TPL_PUBLICK_KEY, appPath, key.Id, key.Content)
|
||||
}
|
||||
|
||||
// AddPublicKey adds new public key to database and SSH key file.
|
||||
var (
|
||||
MinimumKeySize = map[string]int{
|
||||
"(ED25519)": 256,
|
||||
"(ECDSA)": 256,
|
||||
"(NTRU)": 1087,
|
||||
"(MCE)": 1702,
|
||||
"(McE)": 1702,
|
||||
"(RSA)": 2048,
|
||||
}
|
||||
)
|
||||
|
||||
// CheckPublicKeyString checks if the given public key string is recognized by SSH.
|
||||
func CheckPublicKeyString(content string) (bool, error) {
|
||||
if strings.ContainsAny(content, "\n\r") {
|
||||
return false, errors.New("Only a single line with a single key please")
|
||||
}
|
||||
|
||||
// write the key to a file…
|
||||
tmpFile, err := ioutil.TempFile(os.TempDir(), "keytest")
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
tmpPath := tmpFile.Name()
|
||||
defer os.Remove(tmpPath)
|
||||
tmpFile.WriteString(content)
|
||||
tmpFile.Close()
|
||||
|
||||
// … see if ssh-keygen recognizes its contents
|
||||
stdout, stderr, err := process.Exec("CheckPublicKeyString", "ssh-keygen", "-l", "-f", tmpPath)
|
||||
if err != nil {
|
||||
return false, errors.New("ssh-keygen -l -f: " + stderr)
|
||||
} else if len(stdout) < 2 {
|
||||
return false, errors.New("ssh-keygen returned not enough output to evaluate the key")
|
||||
}
|
||||
sshKeygenOutput := strings.Split(stdout, " ")
|
||||
if len(sshKeygenOutput) < 4 {
|
||||
return false, errors.New("Not enough fields returned by ssh-keygen -l -f")
|
||||
}
|
||||
keySize, err := com.StrTo(sshKeygenOutput[0]).Int()
|
||||
if err != nil {
|
||||
return false, errors.New("Cannot get key size of the given key")
|
||||
}
|
||||
keyType := strings.TrimSpace(sshKeygenOutput[len(sshKeygenOutput)-1])
|
||||
|
||||
if minimumKeySize := MinimumKeySize[keyType]; minimumKeySize == 0 {
|
||||
return false, errors.New("Sorry, unrecognized public key type")
|
||||
} else if keySize < minimumKeySize {
|
||||
return false, fmt.Errorf("The minimum accepted size of a public key %s is %d", keyType, minimumKeySize)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// saveAuthorizedKeyFile writes SSH key content to authorized_keys file.
|
||||
func saveAuthorizedKeyFile(key *PublicKey) error {
|
||||
sshOpLocker.Lock()
|
||||
defer sshOpLocker.Unlock()
|
||||
|
||||
fpath := filepath.Join(SshPath, "authorized_keys")
|
||||
f, err := os.OpenFile(fpath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
finfo, err := f.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if finfo.Mode().Perm() > 0600 {
|
||||
log.Error(4, "authorized_keys file has unusual permission flags: %s - setting to -rw-------", finfo.Mode().Perm().String())
|
||||
if err = f.Chmod(0600); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
_, err = f.WriteString(key.GetAuthorizedString())
|
||||
return err
|
||||
}
|
||||
|
||||
// AddPublicKey adds new public key to database and authorized_keys file.
|
||||
func AddPublicKey(key *PublicKey) (err error) {
|
||||
// Check if public key name has been used.
|
||||
has, err := orm.Get(key)
|
||||
has, err := x.Get(key)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if has {
|
||||
@@ -101,26 +181,26 @@ func AddPublicKey(key *PublicKey) (err error) {
|
||||
}
|
||||
|
||||
// Calculate fingerprint.
|
||||
tmpPath := strings.Replace(filepath.Join(os.TempDir(), fmt.Sprintf("%d", time.Now().Nanosecond()),
|
||||
tmpPath := strings.Replace(path.Join(os.TempDir(), fmt.Sprintf("%d", time.Now().Nanosecond()),
|
||||
"id_rsa.pub"), "\\", "/", -1)
|
||||
os.MkdirAll(path.Dir(tmpPath), os.ModePerm)
|
||||
if err = ioutil.WriteFile(tmpPath, []byte(key.Content), os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
stdout, _, err := com.ExecCmd("ssh-keygen", "-l", "-f", tmpPath)
|
||||
stdout, stderr, err := process.Exec("AddPublicKey", "ssh-keygen", "-l", "-f", tmpPath)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.New("ssh-keygen -l -f: " + stderr)
|
||||
} else if len(stdout) < 2 {
|
||||
return errors.New("Not enough output for calculating fingerprint")
|
||||
}
|
||||
key.Fingerprint = strings.Split(stdout, " ")[1]
|
||||
|
||||
// Save SSH key.
|
||||
if _, err = orm.Insert(key); err != nil {
|
||||
if _, err = x.Insert(key); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = SaveAuthorizedKeyFile(key); err != nil {
|
||||
if _, err2 := orm.Delete(key); err2 != nil {
|
||||
} else if err = saveAuthorizedKeyFile(key); err != nil {
|
||||
// Roll back.
|
||||
if _, err2 := x.Delete(key); err2 != nil {
|
||||
return err2
|
||||
}
|
||||
return err
|
||||
@@ -129,8 +209,35 @@ func AddPublicKey(key *PublicKey) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPublicKeyById returns public key by given ID.
|
||||
func GetPublicKeyById(keyId int64) (*PublicKey, error) {
|
||||
key := new(PublicKey)
|
||||
has, err := x.Id(keyId).Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrKeyNotExist
|
||||
}
|
||||
return key, nil
|
||||
}
|
||||
|
||||
// ListPublicKey returns a list of all public keys that user has.
|
||||
func ListPublicKey(uid int64) ([]*PublicKey, error) {
|
||||
keys := make([]*PublicKey, 0, 5)
|
||||
err := x.Find(&keys, &PublicKey{OwnerId: uid})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, key := range keys {
|
||||
key.HasUsed = key.Updated.After(key.Created)
|
||||
key.HasRecentActivity = key.Updated.Add(7 * 24 * time.Hour).After(time.Now())
|
||||
}
|
||||
return keys, nil
|
||||
}
|
||||
|
||||
// rewriteAuthorizedKeys finds and deletes corresponding line in authorized_keys file.
|
||||
func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
|
||||
// Delete SSH key in SSH key file.
|
||||
sshOpLocker.Lock()
|
||||
defer sshOpLocker.Unlock()
|
||||
|
||||
@@ -140,12 +247,14 @@ func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
|
||||
}
|
||||
defer fr.Close()
|
||||
|
||||
fw, err := os.Create(tmpP)
|
||||
fw, err := os.OpenFile(tmpP, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fw.Close()
|
||||
|
||||
isFound := false
|
||||
keyword := fmt.Sprintf("key-%d", key.Id)
|
||||
buf := bufio.NewReader(fr)
|
||||
for {
|
||||
line, errRead := buf.ReadString('\n')
|
||||
@@ -164,7 +273,8 @@ func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
|
||||
}
|
||||
|
||||
// Found the line and copy rest of file.
|
||||
if strings.Contains(line, fmt.Sprintf("key-%d", key.Id)) && strings.Contains(line, key.Content) {
|
||||
if !isFound && strings.Contains(line, keyword) && strings.Contains(line, key.Content) {
|
||||
isFound = true
|
||||
continue
|
||||
}
|
||||
// Still finding the line, copy the line that currently read.
|
||||
@@ -179,50 +289,31 @@ func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdatePublicKey updates given public key.
|
||||
func UpdatePublicKey(key *PublicKey) error {
|
||||
_, err := x.Id(key.Id).AllCols().Update(key)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeletePublicKey deletes SSH key information both in database and authorized_keys file.
|
||||
func DeletePublicKey(key *PublicKey) (err error) {
|
||||
// Delete SSH key in database.
|
||||
has, err := orm.Id(key.Id).Get(key)
|
||||
func DeletePublicKey(key *PublicKey) error {
|
||||
has, err := x.Get(key)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !has {
|
||||
return errors.New("Public key does not exist")
|
||||
return ErrKeyNotExist
|
||||
}
|
||||
if _, err = orm.Delete(key); err != nil {
|
||||
|
||||
if _, err = x.Delete(key); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p := filepath.Join(sshPath, "authorized_keys")
|
||||
tmpP := filepath.Join(sshPath, "authorized_keys.tmp")
|
||||
log.Trace("ssh.DeletePublicKey(authorized_keys): %s", p)
|
||||
|
||||
if err = rewriteAuthorizedKeys(key, p, tmpP); err != nil {
|
||||
fpath := filepath.Join(SshPath, "authorized_keys")
|
||||
tmpPath := filepath.Join(SshPath, "authorized_keys.tmp")
|
||||
if err = rewriteAuthorizedKeys(key, fpath, tmpPath); err != nil {
|
||||
return err
|
||||
} else if err = os.Remove(p); err != nil {
|
||||
} else if err = os.Remove(fpath); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Rename(tmpP, p)
|
||||
}
|
||||
|
||||
// ListPublicKey returns a list of public keys that user has.
|
||||
func ListPublicKey(userId int64) ([]PublicKey, error) {
|
||||
keys := make([]PublicKey, 0)
|
||||
err := orm.Find(&keys, &PublicKey{OwnerId: userId})
|
||||
return keys, err
|
||||
}
|
||||
|
||||
// SaveAuthorizedKeyFile writes SSH key content to SSH key file.
|
||||
func SaveAuthorizedKeyFile(key *PublicKey) error {
|
||||
sshOpLocker.Lock()
|
||||
defer sshOpLocker.Unlock()
|
||||
|
||||
p := filepath.Join(sshPath, "authorized_keys")
|
||||
f, err := os.OpenFile(p, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
_, err = f.WriteString(GenAuthorizedKey(key.Id, key.Content))
|
||||
return err
|
||||
return os.Rename(tmpPath, fpath)
|
||||
}
|
||||
|
||||
@@ -6,15 +6,16 @@ package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/gogits/git"
|
||||
"github.com/gogits/gogs/modules/git"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrReleaseAlreadyExist = errors.New("Release already exist")
|
||||
ErrReleaseNotExist = errors.New("Release does not exist")
|
||||
)
|
||||
|
||||
// Release represents a release of repository.
|
||||
@@ -23,21 +24,17 @@ type Release struct {
|
||||
RepoId int64
|
||||
PublisherId int64
|
||||
Publisher *User `xorm:"-"`
|
||||
Title string
|
||||
TagName string
|
||||
LowerTagName string
|
||||
SHA1 string
|
||||
Target string
|
||||
Title string
|
||||
Sha1 string `xorm:"VARCHAR(40)"`
|
||||
NumCommits int
|
||||
NumCommitsBehind int `xorm:"-"`
|
||||
Note string `xorm:"TEXT"`
|
||||
IsDraft bool `xorm:"NOT NULL DEFAULT false"`
|
||||
IsPrerelease bool
|
||||
Created time.Time `xorm:"created"`
|
||||
}
|
||||
|
||||
// GetReleasesByRepoId returns a list of releases of repository.
|
||||
func GetReleasesByRepoId(repoId int64) (rels []*Release, err error) {
|
||||
err = orm.Desc("created").Find(&rels, Release{RepoId: repoId})
|
||||
return rels, err
|
||||
Created time.Time `xorm:"CREATED"`
|
||||
}
|
||||
|
||||
// IsReleaseExist returns true if release with given tag name already exists.
|
||||
@@ -46,11 +43,38 @@ func IsReleaseExist(repoId int64, tagName string) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return orm.Get(&Release{RepoId: repoId, LowerTagName: strings.ToLower(tagName)})
|
||||
return x.Get(&Release{RepoId: repoId, LowerTagName: strings.ToLower(tagName)})
|
||||
}
|
||||
|
||||
func createTag(gitRepo *git.Repository, rel *Release) error {
|
||||
// Only actual create when publish.
|
||||
if !rel.IsDraft {
|
||||
if !gitRepo.IsTagExist(rel.TagName) {
|
||||
commit, err := gitRepo.GetCommitOfBranch(rel.Target)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = gitRepo.CreateTag(rel.TagName, commit.Id.String()); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
commit, err := gitRepo.GetCommitOfTag(rel.TagName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rel.NumCommits, err = commit.CommitsCount()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateRelease creates a new release of repository.
|
||||
func CreateRelease(repoPath string, rel *Release, gitRepo *git.Repository) error {
|
||||
func CreateRelease(gitRepo *git.Repository, rel *Release) error {
|
||||
isExist, err := IsReleaseExist(rel.RepoId, rel.TagName)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -58,26 +82,65 @@ func CreateRelease(repoPath string, rel *Release, gitRepo *git.Repository) error
|
||||
return ErrReleaseAlreadyExist
|
||||
}
|
||||
|
||||
if !git.IsTagExist(repoPath, rel.TagName) {
|
||||
_, stderr, err := com.ExecCmdDir(repoPath, "git", "tag", rel.TagName, "-m", rel.Title)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if strings.Contains(stderr, "fatal:") {
|
||||
return errors.New(stderr)
|
||||
}
|
||||
} else {
|
||||
commit, err := gitRepo.GetCommitOfTag(rel.TagName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rel.NumCommits, err = commit.CommitsCount()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = createTag(gitRepo, rel); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rel.LowerTagName = strings.ToLower(rel.TagName)
|
||||
_, err = orm.InsertOne(rel)
|
||||
_, err = x.InsertOne(rel)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetRelease returns release by given ID.
|
||||
func GetRelease(repoId int64, tagName string) (*Release, error) {
|
||||
isExist, err := IsReleaseExist(repoId, tagName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !isExist {
|
||||
return nil, ErrReleaseNotExist
|
||||
}
|
||||
|
||||
rel := &Release{RepoId: repoId, LowerTagName: strings.ToLower(tagName)}
|
||||
_, err = x.Get(rel)
|
||||
return rel, err
|
||||
}
|
||||
|
||||
// GetReleasesByRepoId returns a list of releases of repository.
|
||||
func GetReleasesByRepoId(repoId int64) (rels []*Release, err error) {
|
||||
err = x.Desc("created").Find(&rels, Release{RepoId: repoId})
|
||||
return rels, err
|
||||
}
|
||||
|
||||
type ReleaseSorter struct {
|
||||
rels []*Release
|
||||
}
|
||||
|
||||
func (rs *ReleaseSorter) Len() int {
|
||||
return len(rs.rels)
|
||||
}
|
||||
|
||||
func (rs *ReleaseSorter) Less(i, j int) bool {
|
||||
diffNum := rs.rels[i].NumCommits - rs.rels[j].NumCommits
|
||||
if diffNum != 0 {
|
||||
return diffNum > 0
|
||||
}
|
||||
return rs.rels[i].Created.After(rs.rels[j].Created)
|
||||
}
|
||||
|
||||
func (rs *ReleaseSorter) Swap(i, j int) {
|
||||
rs.rels[i], rs.rels[j] = rs.rels[j], rs.rels[i]
|
||||
}
|
||||
|
||||
// SortReleases sorts releases by number of commits and created time.
|
||||
func SortReleases(rels []*Release) {
|
||||
sorter := &ReleaseSorter{rels: rels}
|
||||
sort.Sort(sorter)
|
||||
}
|
||||
|
||||
// UpdateRelease updates information of a release.
|
||||
func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error) {
|
||||
if err = createTag(gitRepo, rel); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = x.Id(rel.Id).AllCols().Update(rel)
|
||||
return err
|
||||
}
|
||||
|
||||
1062
models/repo.go
1062
models/repo.go
File diff suppressed because it is too large
Load Diff
125
models/slack.go
Normal file
125
models/slack.go
Normal file
@@ -0,0 +1,125 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
SLACK_COLOR string = "#dd4b39"
|
||||
)
|
||||
|
||||
type Slack struct {
|
||||
Domain string `json:"domain"`
|
||||
Token string `json:"token"`
|
||||
Channel string `json:"channel"`
|
||||
}
|
||||
|
||||
type SlackPayload struct {
|
||||
Channel string `json:"channel"`
|
||||
Text string `json:"text"`
|
||||
Username string `json:"username"`
|
||||
IconUrl string `json:"icon_url"`
|
||||
UnfurlLinks int `json:"unfurl_links"`
|
||||
LinkNames int `json:"link_names"`
|
||||
Attachments []SlackAttachment `json:"attachments"`
|
||||
}
|
||||
|
||||
type SlackAttachment struct {
|
||||
Color string `json:"color"`
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
func GetSlackURL(domain string, token string) string {
|
||||
return fmt.Sprintf(
|
||||
"https://%s.slack.com/services/hooks/incoming-webhook?token=%s",
|
||||
domain,
|
||||
token,
|
||||
)
|
||||
}
|
||||
|
||||
func (p SlackPayload) GetJSONPayload() ([]byte, error) {
|
||||
data, err := json.Marshal(p)
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func GetSlackPayload(p *Payload, meta string) (*SlackPayload, error) {
|
||||
slack := &Slack{}
|
||||
slackPayload := &SlackPayload{}
|
||||
if err := json.Unmarshal([]byte(meta), &slack); err != nil {
|
||||
return slackPayload, errors.New("GetSlackPayload meta json:" + err.Error())
|
||||
}
|
||||
|
||||
// TODO: handle different payload types: push, new branch, delete branch etc.
|
||||
// when they are added to gogs. Only handles push now
|
||||
return getSlackPushPayload(p, slack)
|
||||
}
|
||||
|
||||
func getSlackPushPayload(p *Payload, slack *Slack) (*SlackPayload, error) {
|
||||
// n new commits
|
||||
refSplit := strings.Split(p.Ref, "/")
|
||||
branchName := refSplit[len(refSplit)-1]
|
||||
var commitString string
|
||||
|
||||
if len(p.Commits) == 1 {
|
||||
commitString = "1 new commit"
|
||||
if p.CompareUrl != "" {
|
||||
commitString = SlackLinkFormatter(p.CompareUrl, commitString)
|
||||
}
|
||||
} else {
|
||||
commitString = fmt.Sprintf("%d new commits", len(p.Commits))
|
||||
if p.CompareUrl != "" {
|
||||
commitString = SlackLinkFormatter(p.CompareUrl, commitString)
|
||||
}
|
||||
}
|
||||
|
||||
repoLink := SlackLinkFormatter(p.Repo.Url, p.Repo.Name)
|
||||
branchLink := SlackLinkFormatter(p.Repo.Url+"/src/"+branchName, branchName)
|
||||
text := fmt.Sprintf("[%s:%s] %s pushed by %s", repoLink, branchLink, commitString, p.Pusher.Name)
|
||||
var attachmentText string
|
||||
|
||||
// for each commit, generate attachment text
|
||||
for i, commit := range p.Commits {
|
||||
attachmentText += fmt.Sprintf("%s: %s - %s", SlackLinkFormatter(commit.Url, commit.Id[:7]), SlackTextFormatter(commit.Message), SlackTextFormatter(commit.Author.Name))
|
||||
// add linebreak to each commit but the last
|
||||
if i < len(p.Commits)-1 {
|
||||
attachmentText += "\n"
|
||||
}
|
||||
}
|
||||
|
||||
slackAttachments := []SlackAttachment{{Color: SLACK_COLOR, Text: attachmentText}}
|
||||
|
||||
return &SlackPayload{
|
||||
Channel: slack.Channel,
|
||||
Text: text,
|
||||
Username: "gogs",
|
||||
IconUrl: "https://raw.githubusercontent.com/gogits/gogs/master/public/img/favicon.png",
|
||||
UnfurlLinks: 0,
|
||||
LinkNames: 0,
|
||||
Attachments: slackAttachments,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// see: https://api.slack.com/docs/formatting
|
||||
func SlackTextFormatter(s string) string {
|
||||
// take only first line of commit
|
||||
first := strings.Split(s, "\n")[0]
|
||||
// replace & < >
|
||||
first = strings.Replace(first, "&", "&", -1)
|
||||
first = strings.Replace(first, "<", "<", -1)
|
||||
first = strings.Replace(first, ">", ">", -1)
|
||||
return first
|
||||
}
|
||||
|
||||
func SlackLinkFormatter(url string, text string) string {
|
||||
return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text))
|
||||
}
|
||||
117
models/update.go
117
models/update.go
@@ -1,37 +1,115 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/gogits/git"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
qlog "github.com/qiniu/log"
|
||||
"github.com/gogits/gogs/modules/git"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId int64) {
|
||||
type UpdateTask struct {
|
||||
Id int64
|
||||
Uuid string `xorm:"index"`
|
||||
RefName string
|
||||
OldCommitId string
|
||||
NewCommitId string
|
||||
}
|
||||
|
||||
func AddUpdateTask(task *UpdateTask) error {
|
||||
_, err := x.Insert(task)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetUpdateTasksByUuid(uuid string) ([]*UpdateTask, error) {
|
||||
task := &UpdateTask{
|
||||
Uuid: uuid,
|
||||
}
|
||||
tasks := make([]*UpdateTask, 0)
|
||||
err := x.Find(&tasks, task)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return tasks, nil
|
||||
}
|
||||
|
||||
func DelUpdateTasksByUuid(uuid string) error {
|
||||
_, err := x.Delete(&UpdateTask{Uuid: uuid})
|
||||
return err
|
||||
}
|
||||
|
||||
func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName string, userId int64) error {
|
||||
isNew := strings.HasPrefix(oldCommitId, "0000000")
|
||||
if isNew &&
|
||||
strings.HasPrefix(newCommitId, "0000000") {
|
||||
qlog.Fatal("old rev and new rev both 000000")
|
||||
return fmt.Errorf("old rev and new rev both 000000")
|
||||
}
|
||||
|
||||
f := RepoPath(userName, repoName)
|
||||
f := RepoPath(repoUserName, repoName)
|
||||
|
||||
gitUpdate := exec.Command("git", "update-server-info")
|
||||
gitUpdate.Dir = f
|
||||
gitUpdate.Run()
|
||||
|
||||
isDel := strings.HasPrefix(newCommitId, "0000000")
|
||||
if isDel {
|
||||
log.GitLogger.Info("del rev", refName, "from", userName+"/"+repoName+".git", "by", userId)
|
||||
return nil
|
||||
}
|
||||
|
||||
repo, err := git.OpenRepository(f)
|
||||
if err != nil {
|
||||
qlog.Fatalf("runUpdate.Open repoId: %v", err)
|
||||
return fmt.Errorf("runUpdate.Open repoId: %v", err)
|
||||
}
|
||||
|
||||
ru, err := GetUserByName(repoUserName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("runUpdate.GetUserByName: %v", err)
|
||||
}
|
||||
|
||||
repos, err := GetRepositoryByName(ru.Id, repoName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("runUpdate.GetRepositoryByName userId: %v", err)
|
||||
}
|
||||
|
||||
// Push tags.
|
||||
if strings.HasPrefix(refName, "refs/tags/") {
|
||||
tagName := git.RefEndName(refName)
|
||||
tag, err := repo.GetTag(tagName)
|
||||
if err != nil {
|
||||
log.GitLogger.Fatal(4, "runUpdate.GetTag: %v", err)
|
||||
}
|
||||
|
||||
var actEmail string
|
||||
if tag.Tagger != nil {
|
||||
actEmail = tag.Tagger.Email
|
||||
} else {
|
||||
cmt, err := tag.Commit()
|
||||
if err != nil {
|
||||
log.GitLogger.Fatal(4, "runUpdate.GetTag Commit: %v", err)
|
||||
}
|
||||
actEmail = cmt.Committer.Email
|
||||
}
|
||||
|
||||
commit := &base.PushCommits{}
|
||||
|
||||
if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
|
||||
repos.Id, repoUserName, repoName, refName, commit, oldCommitId, newCommitId); err != nil {
|
||||
log.GitLogger.Fatal(4, "runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
newCommit, err := repo.GetCommit(newCommitId)
|
||||
if err != nil {
|
||||
qlog.Fatalf("runUpdate GetCommit of newCommitId: %v", err)
|
||||
return
|
||||
return fmt.Errorf("runUpdate GetCommit of newCommitId: %v", err)
|
||||
}
|
||||
|
||||
var l *list.List
|
||||
@@ -39,30 +117,26 @@ func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId
|
||||
if isNew {
|
||||
l, err = newCommit.CommitsBefore()
|
||||
if err != nil {
|
||||
qlog.Fatalf("Find CommitsBefore erro: %v", err)
|
||||
return fmt.Errorf("Find CommitsBefore erro: %v", err)
|
||||
}
|
||||
} else {
|
||||
l, err = newCommit.CommitsBeforeUntil(oldCommitId)
|
||||
if err != nil {
|
||||
qlog.Fatalf("Find CommitsBeforeUntil erro: %v", err)
|
||||
return
|
||||
return fmt.Errorf("Find CommitsBeforeUntil erro: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
qlog.Fatalf("runUpdate.Commit repoId: %v", err)
|
||||
}
|
||||
|
||||
repos, err := GetRepositoryByName(userId, repoName)
|
||||
if err != nil {
|
||||
qlog.Fatalf("runUpdate.GetRepositoryByName userId: %v", err)
|
||||
return fmt.Errorf("runUpdate.Commit repoId: %v", err)
|
||||
}
|
||||
|
||||
// if commits push
|
||||
commits := make([]*base.PushCommit, 0)
|
||||
var maxCommits = 3
|
||||
var maxCommits = 2
|
||||
var actEmail string
|
||||
for e := l.Front(); e != nil; e = e.Next() {
|
||||
commit := e.Value.(*git.Commit)
|
||||
|
||||
if actEmail == "" {
|
||||
actEmail = commit.Committer.Email
|
||||
}
|
||||
@@ -77,8 +151,9 @@ func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId
|
||||
}
|
||||
|
||||
//commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()})
|
||||
if err = CommitRepoAction(userId, userName, actEmail,
|
||||
repos.Id, repoName, refName, &base.PushCommits{l.Len(), commits}); err != nil {
|
||||
qlog.Fatalf("runUpdate.models.CommitRepoAction: %v", err)
|
||||
if err = CommitRepoAction(userId, ru.Id, userName, actEmail,
|
||||
repos.Id, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits}, oldCommitId, newCommitId); err != nil {
|
||||
return fmt.Errorf("runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
451
models/user.go
451
models/user.go
@@ -14,91 +14,157 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gogits/git"
|
||||
"github.com/Unknwon/com"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/git"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
// User types.
|
||||
const (
|
||||
UT_INDIVIDUAL = iota + 1
|
||||
UT_ORGANIZATION
|
||||
)
|
||||
type UserType int
|
||||
|
||||
// Login types.
|
||||
const (
|
||||
LT_PLAIN = iota + 1
|
||||
LT_LDAP
|
||||
INDIVIDUAL UserType = iota // Historic reason to make it starts at 0.
|
||||
ORGANIZATION
|
||||
)
|
||||
|
||||
var (
|
||||
ErrUserOwnRepos = errors.New("User still have ownership of repositories")
|
||||
ErrUserAlreadyExist = errors.New("User already exist")
|
||||
ErrUserNotExist = errors.New("User does not exist")
|
||||
ErrEmailAlreadyUsed = errors.New("E-mail already used")
|
||||
ErrUserNameIllegal = errors.New("User name contains illegal characters")
|
||||
ErrKeyNotExist = errors.New("Public key does not exist")
|
||||
ErrUserOwnRepos = errors.New("User still have ownership of repositories")
|
||||
ErrUserHasOrgs = errors.New("User still have membership of organization")
|
||||
ErrUserAlreadyExist = errors.New("User already exist")
|
||||
ErrUserNotExist = errors.New("User does not exist")
|
||||
ErrUserNotKeyOwner = errors.New("User does not the owner of public key")
|
||||
ErrEmailAlreadyUsed = errors.New("E-mail already used")
|
||||
ErrUserNameIllegal = errors.New("User name contains illegal characters")
|
||||
ErrLoginSourceNotExist = errors.New("Login source does not exist")
|
||||
ErrLoginSourceNotActived = errors.New("Login source is not actived")
|
||||
ErrUnsupportedLoginType = errors.New("Login source is unknown")
|
||||
)
|
||||
|
||||
// User represents the object of individual and member of organization.
|
||||
type User struct {
|
||||
Id int64
|
||||
LowerName string `xorm:"unique not null"`
|
||||
Name string `xorm:"unique not null"`
|
||||
Email string `xorm:"unique not null"`
|
||||
Passwd string `xorm:"not null"`
|
||||
LoginType int
|
||||
Type int
|
||||
LowerName string `xorm:"UNIQUE NOT NULL"`
|
||||
Name string `xorm:"UNIQUE NOT NULL"`
|
||||
FullName string
|
||||
Email string `xorm:"UNIQUE NOT NULL"`
|
||||
Passwd string `xorm:"NOT NULL"`
|
||||
LoginType LoginType
|
||||
LoginSource int64 `xorm:"NOT NULL DEFAULT 0"`
|
||||
LoginName string
|
||||
Type UserType
|
||||
Orgs []*User `xorm:"-"`
|
||||
Repos []*Repository `xorm:"-"`
|
||||
NumFollowers int
|
||||
NumFollowings int
|
||||
NumStars int
|
||||
NumRepos int
|
||||
Avatar string `xorm:"varchar(2048) not null"`
|
||||
AvatarEmail string `xorm:"not null"`
|
||||
Avatar string `xorm:"VARCHAR(2048) NOT NULL"`
|
||||
AvatarEmail string `xorm:"NOT NULL"`
|
||||
Location string
|
||||
Website string
|
||||
IsActive bool
|
||||
IsAdmin bool
|
||||
Rands string `xorm:"VARCHAR(10)"`
|
||||
Salt string `xorm:"VARCHAR(10)"`
|
||||
Created time.Time `xorm:"created"`
|
||||
Updated time.Time `xorm:"updated"`
|
||||
Created time.Time `xorm:"CREATED"`
|
||||
Updated time.Time `xorm:"UPDATED"`
|
||||
|
||||
// For organization.
|
||||
Description string
|
||||
NumTeams int
|
||||
NumMembers int
|
||||
Teams []*Team `xorm:"-"`
|
||||
Members []*User `xorm:"-"`
|
||||
}
|
||||
|
||||
// DashboardLink returns the user dashboard page link.
|
||||
func (u *User) DashboardLink() string {
|
||||
if u.IsOrganization() {
|
||||
return "/org/" + u.Name + "/dashboard/"
|
||||
}
|
||||
return "/"
|
||||
}
|
||||
|
||||
// HomeLink returns the user home page link.
|
||||
func (user *User) HomeLink() string {
|
||||
return "/user/" + user.Name
|
||||
func (u *User) HomeLink() string {
|
||||
return "/user/" + u.Name
|
||||
}
|
||||
|
||||
// AvatarLink returns the user gravatar link.
|
||||
func (user *User) AvatarLink() string {
|
||||
if base.Service.EnableCacheAvatar {
|
||||
return "/avatar/" + user.Avatar
|
||||
// AvatarLink returns user gravatar link.
|
||||
func (u *User) AvatarLink() string {
|
||||
if setting.DisableGravatar {
|
||||
return "/img/avatar_default.jpg"
|
||||
} else if setting.Service.EnableCacheAvatar {
|
||||
return "/avatar/" + u.Avatar
|
||||
}
|
||||
return "//1.gravatar.com/avatar/" + user.Avatar
|
||||
return "//1.gravatar.com/avatar/" + u.Avatar
|
||||
}
|
||||
|
||||
// NewGitSig generates and returns the signature of given user.
|
||||
func (user *User) NewGitSig() *git.Signature {
|
||||
func (u *User) NewGitSig() *git.Signature {
|
||||
return &git.Signature{
|
||||
Name: user.Name,
|
||||
Email: user.Email,
|
||||
Name: u.Name,
|
||||
Email: u.Email,
|
||||
When: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
// EncodePasswd encodes password to safe format.
|
||||
func (user *User) EncodePasswd() {
|
||||
newPasswd := base.PBKDF2([]byte(user.Passwd), []byte(user.Salt), 10000, 50, sha256.New)
|
||||
user.Passwd = fmt.Sprintf("%x", newPasswd)
|
||||
func (u *User) EncodePasswd() {
|
||||
newPasswd := base.PBKDF2([]byte(u.Passwd), []byte(u.Salt), 10000, 50, sha256.New)
|
||||
u.Passwd = fmt.Sprintf("%x", newPasswd)
|
||||
}
|
||||
|
||||
// Member represents user is member of organization.
|
||||
type Member struct {
|
||||
Id int64
|
||||
OrgId int64 `xorm:"unique(member) index"`
|
||||
UserId int64 `xorm:"unique(member)"`
|
||||
// ValidtePassword checks if given password matches the one belongs to the user.
|
||||
func (u *User) ValidtePassword(passwd string) bool {
|
||||
newUser := &User{Passwd: passwd, Salt: u.Salt}
|
||||
newUser.EncodePasswd()
|
||||
return u.Passwd == newUser.Passwd
|
||||
}
|
||||
|
||||
// IsOrganization returns true if user is actually a organization.
|
||||
func (u *User) IsOrganization() bool {
|
||||
return u.Type == ORGANIZATION
|
||||
}
|
||||
|
||||
// IsUserOrgOwner returns true if user is in the owner team of given organization.
|
||||
func (u *User) IsUserOrgOwner(orgId int64) bool {
|
||||
return IsOrganizationOwner(orgId, u.Id)
|
||||
}
|
||||
|
||||
// IsPublicMember returns true if user public his/her membership in give organization.
|
||||
func (u *User) IsPublicMember(orgId int64) bool {
|
||||
return IsPublicMembership(orgId, u.Id)
|
||||
}
|
||||
|
||||
// GetOrganizationCount returns count of membership of organization of user.
|
||||
func (u *User) GetOrganizationCount() (int64, error) {
|
||||
return x.Where("uid=?", u.Id).Count(new(OrgUser))
|
||||
}
|
||||
|
||||
// GetRepositories returns all repositories that user owns, including private repositories.
|
||||
func (u *User) GetRepositories() (err error) {
|
||||
u.Repos, err = GetRepositories(u.Id, true)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetOrganizations returns all organizations that user belongs to.
|
||||
func (u *User) GetOrganizations() error {
|
||||
ous, err := GetOrgUsersByUserId(u.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
u.Orgs = make([]*User, len(ous))
|
||||
for i, ou := range ous {
|
||||
u.Orgs[i], err = GetUserById(ou.OrgId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsUserExist checks if given user name exist,
|
||||
@@ -107,7 +173,7 @@ func IsUserExist(name string) (bool, error) {
|
||||
if len(name) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
return orm.Get(&User{LowerName: strings.ToLower(name)})
|
||||
return x.Get(&User{LowerName: strings.ToLower(name)})
|
||||
}
|
||||
|
||||
// IsEmailUsed returns true if the e-mail has been used.
|
||||
@@ -115,62 +181,76 @@ func IsEmailUsed(email string) (bool, error) {
|
||||
if len(email) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
return orm.Get(&User{Email: email})
|
||||
return x.Get(&User{Email: email})
|
||||
}
|
||||
|
||||
// return a user salt token
|
||||
// GetUserSalt returns a user salt token
|
||||
func GetUserSalt() string {
|
||||
return base.GetRandomString(10)
|
||||
}
|
||||
|
||||
// RegisterUser creates record of a new user.
|
||||
func RegisterUser(user *User) (*User, error) {
|
||||
if !IsLegalName(user.Name) {
|
||||
return nil, ErrUserNameIllegal
|
||||
// CreateUser creates record of a new user.
|
||||
func CreateUser(u *User) error {
|
||||
if !IsLegalName(u.Name) {
|
||||
return ErrUserNameIllegal
|
||||
}
|
||||
|
||||
isExist, err := IsUserExist(user.Name)
|
||||
isExist, err := IsUserExist(u.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
} else if isExist {
|
||||
return nil, ErrUserAlreadyExist
|
||||
return ErrUserAlreadyExist
|
||||
}
|
||||
|
||||
isExist, err = IsEmailUsed(user.Email)
|
||||
isExist, err = IsEmailUsed(u.Email)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
} else if isExist {
|
||||
return nil, ErrEmailAlreadyUsed
|
||||
return ErrEmailAlreadyUsed
|
||||
}
|
||||
|
||||
user.LowerName = strings.ToLower(user.Name)
|
||||
user.Avatar = base.EncodeMd5(user.Email)
|
||||
user.AvatarEmail = user.Email
|
||||
user.Rands = GetUserSalt()
|
||||
user.Salt = GetUserSalt()
|
||||
user.EncodePasswd()
|
||||
if _, err = orm.Insert(user); err != nil {
|
||||
return nil, err
|
||||
} else if err = os.MkdirAll(UserPath(user.Name), os.ModePerm); err != nil {
|
||||
if _, err := orm.Id(user.Id).Delete(&User{}); err != nil {
|
||||
return nil, errors.New(fmt.Sprintf(
|
||||
"both create userpath %s and delete table record faild: %v", user.Name, err))
|
||||
}
|
||||
return nil, err
|
||||
u.LowerName = strings.ToLower(u.Name)
|
||||
u.Avatar = base.EncodeMd5(u.Email)
|
||||
u.AvatarEmail = u.Email
|
||||
u.Rands = GetUserSalt()
|
||||
u.Salt = GetUserSalt()
|
||||
u.EncodePasswd()
|
||||
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
if err = sess.Begin(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if user.Id == 1 {
|
||||
user.IsAdmin = true
|
||||
user.IsActive = true
|
||||
_, err = orm.Id(user.Id).UseBool().Update(user)
|
||||
if _, err = sess.Insert(u); err != nil {
|
||||
sess.Rollback()
|
||||
return err
|
||||
} else if err = os.MkdirAll(UserPath(u.Name), os.ModePerm); err != nil {
|
||||
sess.Rollback()
|
||||
return err
|
||||
} else if err = sess.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
return user, err
|
||||
|
||||
// Auto-set admin for user whose ID is 1.
|
||||
if u.Id == 1 {
|
||||
u.IsAdmin = true
|
||||
u.IsActive = true
|
||||
_, err = x.Id(u.Id).UseBool().Update(u)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// CountUsers returns number of users.
|
||||
func CountUsers() int64 {
|
||||
count, _ := x.Where("type=0").Count(new(User))
|
||||
return count
|
||||
}
|
||||
|
||||
// GetUsers returns given number of user objects with offset.
|
||||
func GetUsers(num, offset int) ([]User, error) {
|
||||
users := make([]User, 0, num)
|
||||
err := orm.Limit(num, offset).Asc("id").Find(&users)
|
||||
func GetUsers(num, offset int) ([]*User, error) {
|
||||
users := make([]*User, 0, num)
|
||||
err := x.Limit(num, offset).Where("type=0").Asc("id").Find(&users)
|
||||
return users, err
|
||||
}
|
||||
|
||||
@@ -186,7 +266,7 @@ func getVerifyUser(code string) (user *User) {
|
||||
if user, err = GetUserByName(string(b)); user != nil {
|
||||
return user
|
||||
}
|
||||
log.Error("user.getVerifyUser: %v", err)
|
||||
log.Error(4, "user.getVerifyUser: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -194,12 +274,12 @@ func getVerifyUser(code string) (user *User) {
|
||||
|
||||
// verify active code when active account
|
||||
func VerifyUserActiveCode(code string) (user *User) {
|
||||
minutes := base.Service.ActiveCodeLives
|
||||
minutes := setting.Service.ActiveCodeLives
|
||||
|
||||
if user = getVerifyUser(code); user != nil {
|
||||
// time limit code
|
||||
prefix := code[:base.TimeLimitCodeLength]
|
||||
data := base.ToStr(user.Id) + user.Email + user.LowerName + user.Passwd + user.Rands
|
||||
data := com.ToStr(user.Id) + user.Email + user.LowerName + user.Passwd + user.Rands
|
||||
|
||||
if base.VerifyTimeLimitCode(data, minutes, prefix) {
|
||||
return user
|
||||
@@ -209,16 +289,20 @@ func VerifyUserActiveCode(code string) (user *User) {
|
||||
}
|
||||
|
||||
// ChangeUserName changes all corresponding setting from old user name to new one.
|
||||
func ChangeUserName(user *User, newUserName string) (err error) {
|
||||
func ChangeUserName(u *User, newUserName string) (err error) {
|
||||
if !IsLegalName(newUserName) {
|
||||
return ErrUserNameIllegal
|
||||
}
|
||||
|
||||
newUserName = strings.ToLower(newUserName)
|
||||
|
||||
// Update accesses of user.
|
||||
accesses := make([]Access, 0, 10)
|
||||
if err = orm.Find(&accesses, &Access{UserName: user.LowerName}); err != nil {
|
||||
if err = x.Find(&accesses, &Access{UserName: u.LowerName}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sess := orm.NewSession()
|
||||
sess := x.NewSession()
|
||||
defer sess.Close()
|
||||
if err = sess.Begin(); err != nil {
|
||||
return err
|
||||
@@ -226,35 +310,38 @@ func ChangeUserName(user *User, newUserName string) (err error) {
|
||||
|
||||
for i := range accesses {
|
||||
accesses[i].UserName = newUserName
|
||||
if strings.HasPrefix(accesses[i].RepoName, user.LowerName+"/") {
|
||||
accesses[i].RepoName = strings.Replace(accesses[i].RepoName, user.LowerName, newUserName, 1)
|
||||
if err = UpdateAccessWithSession(sess, &accesses[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
if strings.HasPrefix(accesses[i].RepoName, u.LowerName+"/") {
|
||||
accesses[i].RepoName = strings.Replace(accesses[i].RepoName, u.LowerName, newUserName, 1)
|
||||
}
|
||||
if err = UpdateAccessWithSession(sess, &accesses[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
repos, err := GetRepositories(user, true)
|
||||
repos, err := GetRepositories(u.Id, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for i := range repos {
|
||||
accesses = make([]Access, 0, 10)
|
||||
// Update accesses of user repository.
|
||||
if err = orm.Find(&accesses, &Access{RepoName: user.LowerName + "/" + repos[i].LowerName}); err != nil {
|
||||
if err = x.Find(&accesses, &Access{RepoName: u.LowerName + "/" + repos[i].LowerName}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for j := range accesses {
|
||||
accesses[j].RepoName = newUserName + "/" + repos[i].LowerName
|
||||
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil {
|
||||
return err
|
||||
// if the access is not the user's access (already updated above)
|
||||
if accesses[j].UserName != u.LowerName {
|
||||
accesses[j].RepoName = newUserName + "/" + repos[i].LowerName
|
||||
if err = UpdateAccessWithSession(sess, &accesses[j]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Change user directory name.
|
||||
if err = os.Rename(UserPath(user.LowerName), UserPath(newUserName)); err != nil {
|
||||
if err = os.Rename(UserPath(u.LowerName), UserPath(newUserName)); err != nil {
|
||||
sess.Rollback()
|
||||
return err
|
||||
}
|
||||
@@ -263,106 +350,118 @@ func ChangeUserName(user *User, newUserName string) (err error) {
|
||||
}
|
||||
|
||||
// UpdateUser updates user's information.
|
||||
func UpdateUser(user *User) (err error) {
|
||||
user.LowerName = strings.ToLower(user.Name)
|
||||
func UpdateUser(u *User) error {
|
||||
u.LowerName = strings.ToLower(u.Name)
|
||||
|
||||
if len(user.Location) > 255 {
|
||||
user.Location = user.Location[:255]
|
||||
if len(u.Location) > 255 {
|
||||
u.Location = u.Location[:255]
|
||||
}
|
||||
if len(user.Website) > 255 {
|
||||
user.Website = user.Website[:255]
|
||||
if len(u.Website) > 255 {
|
||||
u.Website = u.Website[:255]
|
||||
}
|
||||
if len(u.Description) > 255 {
|
||||
u.Description = u.Description[:255]
|
||||
}
|
||||
|
||||
_, err = orm.Id(user.Id).AllCols().Update(user)
|
||||
_, err := x.Id(u.Id).AllCols().Update(u)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteUser completely deletes everything of the user.
|
||||
func DeleteUser(user *User) error {
|
||||
// TODO: need some kind of mechanism to record failure.
|
||||
// DeleteUser completely and permanently deletes everything of user.
|
||||
func DeleteUser(u *User) error {
|
||||
// Check ownership of repository.
|
||||
count, err := GetRepositoryCount(user)
|
||||
count, err := GetRepositoryCount(u)
|
||||
if err != nil {
|
||||
return errors.New("modesl.GetRepositories: " + err.Error())
|
||||
return errors.New("GetRepositoryCount: " + err.Error())
|
||||
} else if count > 0 {
|
||||
return ErrUserOwnRepos
|
||||
}
|
||||
|
||||
// Check membership of organization.
|
||||
count, err = u.GetOrganizationCount()
|
||||
if err != nil {
|
||||
return errors.New("modesl.GetRepositories(GetOrganizationCount): " + err.Error())
|
||||
} else if count > 0 {
|
||||
return ErrUserHasOrgs
|
||||
}
|
||||
|
||||
// TODO: check issues, other repos' commits
|
||||
// TODO: roll backable in some point.
|
||||
|
||||
// Delete all followers.
|
||||
if _, err = orm.Delete(&Follow{FollowId: user.Id}); err != nil {
|
||||
if _, err = x.Delete(&Follow{FollowId: u.Id}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Delete oauth2.
|
||||
if _, err = orm.Delete(&Oauth2{Uid: user.Id}); err != nil {
|
||||
if _, err = x.Delete(&Oauth2{Uid: u.Id}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Delete all feeds.
|
||||
if _, err = orm.Delete(&Action{UserId: user.Id}); err != nil {
|
||||
if _, err = x.Delete(&Action{UserId: u.Id}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Delete all watches.
|
||||
if _, err = orm.Delete(&Watch{UserId: user.Id}); err != nil {
|
||||
if _, err = x.Delete(&Watch{UserId: u.Id}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Delete all accesses.
|
||||
if _, err = orm.Delete(&Access{UserName: user.LowerName}); err != nil {
|
||||
if _, err = x.Delete(&Access{UserName: u.LowerName}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Delete all SSH keys.
|
||||
keys := make([]PublicKey, 0, 10)
|
||||
if err = orm.Find(&keys, &PublicKey{OwnerId: user.Id}); err != nil {
|
||||
keys := make([]*PublicKey, 0, 10)
|
||||
if err = x.Find(&keys, &PublicKey{OwnerId: u.Id}); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, key := range keys {
|
||||
if err = DeletePublicKey(&key); err != nil {
|
||||
if err = DeletePublicKey(key); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Delete user directory.
|
||||
if err = os.RemoveAll(UserPath(user.Name)); err != nil {
|
||||
if err = os.RemoveAll(UserPath(u.Name)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = orm.Delete(user)
|
||||
_, err = x.Delete(u)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteInactivateUsers deletes all inactivate users.
|
||||
func DeleteInactivateUsers() error {
|
||||
_, err := x.Where("is_active=?", false).Delete(new(User))
|
||||
return err
|
||||
}
|
||||
|
||||
// UserPath returns the path absolute path of user repositories.
|
||||
func UserPath(userName string) string {
|
||||
return filepath.Join(base.RepoRootPath, strings.ToLower(userName))
|
||||
return filepath.Join(setting.RepoRootPath, strings.ToLower(userName))
|
||||
}
|
||||
|
||||
func GetUserByKeyId(keyId int64) (*User, error) {
|
||||
user := new(User)
|
||||
rawSql := "SELECT a.* FROM `user` AS a, public_key AS b WHERE a.id = b.owner_id AND b.id=?"
|
||||
has, err := orm.Sql(rawSql, keyId).Get(user)
|
||||
has, err := x.Sql(rawSql, keyId).Get(user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
err = errors.New("not exist key owner")
|
||||
return nil, err
|
||||
return nil, ErrUserNotKeyOwner
|
||||
}
|
||||
return user, nil
|
||||
}
|
||||
|
||||
// GetUserById returns the user object by given id if exists.
|
||||
// GetUserById returns the user object by given ID if exists.
|
||||
func GetUserById(id int64) (*User, error) {
|
||||
user := new(User)
|
||||
has, err := orm.Id(id).Get(user)
|
||||
u := new(User)
|
||||
has, err := x.Id(id).Get(u)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !has {
|
||||
} else if !has {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
return user, nil
|
||||
return u, nil
|
||||
}
|
||||
|
||||
// GetUserByName returns the user object by given name if exists.
|
||||
@@ -371,7 +470,7 @@ func GetUserByName(name string) (*User, error) {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
user := &User{LowerName: strings.ToLower(name)}
|
||||
has, err := orm.Get(user)
|
||||
has, err := x.Get(user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
@@ -393,13 +492,26 @@ func GetUserEmailsByNames(names []string) []string {
|
||||
return mails
|
||||
}
|
||||
|
||||
// GetUserIdsByNames returns a slice of ids corresponds to names.
|
||||
func GetUserIdsByNames(names []string) []int64 {
|
||||
ids := make([]int64, 0, len(names))
|
||||
for _, name := range names {
|
||||
u, err := GetUserByName(name)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
ids = append(ids, u.Id)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// GetUserByEmail returns the user object by given e-mail if exists.
|
||||
func GetUserByEmail(email string) (*User, error) {
|
||||
if len(email) == 0 {
|
||||
return nil, ErrUserNotExist
|
||||
}
|
||||
user := &User{Email: strings.ToLower(email)}
|
||||
has, err := orm.Get(user)
|
||||
has, err := x.Get(user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
@@ -408,22 +520,23 @@ func GetUserByEmail(email string) (*User, error) {
|
||||
return user, nil
|
||||
}
|
||||
|
||||
// LoginUserPlain validates user by raw user name and password.
|
||||
func LoginUserPlain(name, passwd string) (*User, error) {
|
||||
user := User{LowerName: strings.ToLower(name)}
|
||||
has, err := orm.Get(&user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrUserNotExist
|
||||
// SearchUserByName returns given number of users whose name contains keyword.
|
||||
func SearchUserByName(opt SearchOption) (us []*User, err error) {
|
||||
// Prevent SQL inject.
|
||||
opt.Keyword = strings.TrimSpace(opt.Keyword)
|
||||
if len(opt.Keyword) == 0 {
|
||||
return us, nil
|
||||
}
|
||||
|
||||
newUser := &User{Passwd: passwd, Salt: user.Salt}
|
||||
newUser.EncodePasswd()
|
||||
if user.Passwd != newUser.Passwd {
|
||||
return nil, ErrUserNotExist
|
||||
opt.Keyword = strings.Split(opt.Keyword, " ")[0]
|
||||
if len(opt.Keyword) == 0 {
|
||||
return us, nil
|
||||
}
|
||||
return &user, nil
|
||||
opt.Keyword = strings.ToLower(opt.Keyword)
|
||||
|
||||
us = make([]*User, 0, opt.Limit)
|
||||
err = x.Limit(opt.Limit).Where("type=0").And("lower_name like '%" + opt.Keyword + "%'").Find(&us)
|
||||
return us, err
|
||||
}
|
||||
|
||||
// Follow is connection request for receiving user notifycation.
|
||||
@@ -435,7 +548,7 @@ type Follow struct {
|
||||
|
||||
// FollowUser marks someone be another's follower.
|
||||
func FollowUser(userId int64, followId int64) (err error) {
|
||||
session := orm.NewSession()
|
||||
session := x.NewSession()
|
||||
defer session.Close()
|
||||
session.Begin()
|
||||
|
||||
@@ -460,7 +573,7 @@ func FollowUser(userId int64, followId int64) (err error) {
|
||||
|
||||
// UnFollowUser unmarks someone be another's follower.
|
||||
func UnFollowUser(userId int64, unFollowId int64) (err error) {
|
||||
session := orm.NewSession()
|
||||
session := x.NewSession()
|
||||
defer session.Close()
|
||||
session.Begin()
|
||||
|
||||
@@ -482,3 +595,45 @@ func UnFollowUser(userId int64, unFollowId int64) (err error) {
|
||||
}
|
||||
return session.Commit()
|
||||
}
|
||||
|
||||
func UpdateMentions(userNames []string, issueId int64) error {
|
||||
users := make([]*User, 0, len(userNames))
|
||||
|
||||
if err := x.Where("name IN (?)", strings.Join(userNames, "\",\"")).OrderBy("name ASC").Find(&users); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ids := make([]int64, 0, len(userNames))
|
||||
|
||||
for _, user := range users {
|
||||
ids = append(ids, user.Id)
|
||||
|
||||
if user.Type == INDIVIDUAL {
|
||||
continue
|
||||
}
|
||||
|
||||
if user.NumMembers == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
tempIds := make([]int64, 0, user.NumMembers)
|
||||
|
||||
orgUsers, err := GetOrgUsersByOrgId(user.Id)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, orgUser := range orgUsers {
|
||||
tempIds = append(tempIds, orgUser.Id)
|
||||
}
|
||||
|
||||
ids = append(ids, tempIds...)
|
||||
}
|
||||
|
||||
if err := UpdateIssueUserPairsByMentions(ids, issueId); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
301
models/webhook.go
Normal file
301
models/webhook.go
Normal file
@@ -0,0 +1,301 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"github.com/gogits/gogs/modules/httplib"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
"github.com/gogits/gogs/modules/uuid"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrWebhookNotExist = errors.New("Webhook does not exist")
|
||||
)
|
||||
|
||||
type HookContentType int
|
||||
|
||||
const (
|
||||
JSON HookContentType = iota + 1
|
||||
FORM
|
||||
)
|
||||
|
||||
// HookEvent represents events that will delivery hook.
|
||||
type HookEvent struct {
|
||||
PushOnly bool `json:"push_only"`
|
||||
}
|
||||
|
||||
// Webhook represents a web hook object.
|
||||
type Webhook struct {
|
||||
Id int64
|
||||
RepoId int64
|
||||
Url string `xorm:"TEXT"`
|
||||
ContentType HookContentType
|
||||
Secret string `xorm:"TEXT"`
|
||||
Events string `xorm:"TEXT"`
|
||||
*HookEvent `xorm:"-"`
|
||||
IsSsl bool
|
||||
IsActive bool
|
||||
HookTaskType HookTaskType
|
||||
Meta string `xorm:"TEXT"` // store hook-specific attributes
|
||||
OrgId int64
|
||||
}
|
||||
|
||||
// GetEvent handles conversion from Events to HookEvent.
|
||||
func (w *Webhook) GetEvent() {
|
||||
w.HookEvent = &HookEvent{}
|
||||
if err := json.Unmarshal([]byte(w.Events), w.HookEvent); err != nil {
|
||||
log.Error(4, "webhook.GetEvent(%d): %v", w.Id, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *Webhook) GetSlackHook() *Slack {
|
||||
s := &Slack{}
|
||||
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
||||
log.Error(4, "webhook.GetSlackHook(%d): %v", w.Id, err)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// UpdateEvent handles conversion from HookEvent to Events.
|
||||
func (w *Webhook) UpdateEvent() error {
|
||||
data, err := json.Marshal(w.HookEvent)
|
||||
w.Events = string(data)
|
||||
return err
|
||||
}
|
||||
|
||||
// HasPushEvent returns true if hook enbaled push event.
|
||||
func (w *Webhook) HasPushEvent() bool {
|
||||
if w.PushOnly {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// CreateWebhook creates a new web hook.
|
||||
func CreateWebhook(w *Webhook) error {
|
||||
_, err := x.Insert(w)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetWebhookById returns webhook by given ID.
|
||||
func GetWebhookById(hookId int64) (*Webhook, error) {
|
||||
w := &Webhook{Id: hookId}
|
||||
has, err := x.Get(w)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrWebhookNotExist
|
||||
}
|
||||
return w, nil
|
||||
}
|
||||
|
||||
// GetActiveWebhooksByRepoId returns all active webhooks of repository.
|
||||
func GetActiveWebhooksByRepoId(repoId int64) (ws []*Webhook, err error) {
|
||||
err = x.Where("repo_id=?", repoId).And("is_active=?", true).Find(&ws)
|
||||
return ws, err
|
||||
}
|
||||
|
||||
// GetWebhooksByRepoId returns all webhooks of repository.
|
||||
func GetWebhooksByRepoId(repoId int64) (ws []*Webhook, err error) {
|
||||
err = x.Find(&ws, &Webhook{RepoId: repoId})
|
||||
return ws, err
|
||||
}
|
||||
|
||||
// UpdateWebhook updates information of webhook.
|
||||
func UpdateWebhook(w *Webhook) error {
|
||||
_, err := x.Id(w.Id).AllCols().Update(w)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteWebhook deletes webhook of repository.
|
||||
func DeleteWebhook(hookId int64) error {
|
||||
_, err := x.Delete(&Webhook{Id: hookId})
|
||||
return err
|
||||
}
|
||||
|
||||
// GetWebhooksByOrgId returns all webhooks for an organization.
|
||||
func GetWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) {
|
||||
err = x.Find(&ws, &Webhook{OrgId: orgId})
|
||||
return ws, err
|
||||
}
|
||||
|
||||
// GetActiveWebhooksByOrgId returns all active webhooks for an organization.
|
||||
func GetActiveWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) {
|
||||
err = x.Where("org_id=?", orgId).And("is_active=?", true).Find(&ws)
|
||||
return ws, err
|
||||
}
|
||||
|
||||
// ___ ___ __ ___________ __
|
||||
// / | \ ____ ____ | | _\__ ___/____ _____| | __
|
||||
// / ~ \/ _ \ / _ \| |/ / | | \__ \ / ___/ |/ /
|
||||
// \ Y ( <_> | <_> ) < | | / __ \_\___ \| <
|
||||
// \___|_ / \____/ \____/|__|_ \ |____| (____ /____ >__|_ \
|
||||
// \/ \/ \/ \/ \/
|
||||
|
||||
type HookTaskType int
|
||||
|
||||
const (
|
||||
GOGS HookTaskType = iota + 1
|
||||
SLACK
|
||||
)
|
||||
|
||||
type HookEventType string
|
||||
|
||||
const (
|
||||
PUSH HookEventType = "push"
|
||||
)
|
||||
|
||||
type PayloadAuthor struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
|
||||
type PayloadCommit struct {
|
||||
Id string `json:"id"`
|
||||
Message string `json:"message"`
|
||||
Url string `json:"url"`
|
||||
Author *PayloadAuthor `json:"author"`
|
||||
}
|
||||
|
||||
type PayloadRepo struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
Description string `json:"description"`
|
||||
Website string `json:"website"`
|
||||
Watchers int `json:"watchers"`
|
||||
Owner *PayloadAuthor `json:"author"`
|
||||
Private bool `json:"private"`
|
||||
}
|
||||
|
||||
type BasePayload interface {
|
||||
GetJSONPayload() ([]byte, error)
|
||||
}
|
||||
|
||||
// Payload represents a payload information of hook.
|
||||
type Payload struct {
|
||||
Secret string `json:"secret"`
|
||||
Ref string `json:"ref"`
|
||||
Commits []*PayloadCommit `json:"commits"`
|
||||
Repo *PayloadRepo `json:"repository"`
|
||||
Pusher *PayloadAuthor `json:"pusher"`
|
||||
Before string `json:"before"`
|
||||
After string `json:"after"`
|
||||
CompareUrl string `json:"compare_url"`
|
||||
}
|
||||
|
||||
func (p Payload) GetJSONPayload() ([]byte, error) {
|
||||
data, err := json.Marshal(p)
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// HookTask represents a hook task.
|
||||
type HookTask struct {
|
||||
Id int64
|
||||
Uuid string
|
||||
Type HookTaskType
|
||||
Url string
|
||||
BasePayload `xorm:"-"`
|
||||
PayloadContent string `xorm:"TEXT"`
|
||||
ContentType HookContentType
|
||||
EventType HookEventType
|
||||
IsSsl bool
|
||||
IsDelivered bool
|
||||
IsSucceed bool
|
||||
}
|
||||
|
||||
// CreateHookTask creates a new hook task,
|
||||
// it handles conversion from Payload to PayloadContent.
|
||||
func CreateHookTask(t *HookTask) error {
|
||||
data, err := t.BasePayload.GetJSONPayload()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Uuid = uuid.NewV4().String()
|
||||
t.PayloadContent = string(data)
|
||||
_, err = x.Insert(t)
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdateHookTask updates information of hook task.
|
||||
func UpdateHookTask(t *HookTask) error {
|
||||
_, err := x.Id(t.Id).AllCols().Update(t)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeliverHooks checks and delivers undelivered hooks.
|
||||
func DeliverHooks() {
|
||||
tasks := make([]*HookTask, 0, 10)
|
||||
timeout := time.Duration(setting.WebhookDeliverTimeout) * time.Second
|
||||
x.Where("is_delivered=?", false).Iterate(new(HookTask),
|
||||
func(idx int, bean interface{}) error {
|
||||
t := bean.(*HookTask)
|
||||
req := httplib.Post(t.Url).SetTimeout(timeout, timeout).
|
||||
Header("X-Gogs-Delivery", t.Uuid).
|
||||
Header("X-Gogs-Event", string(t.EventType))
|
||||
|
||||
switch t.ContentType {
|
||||
case JSON:
|
||||
req = req.Header("Content-Type", "application/json").Body(t.PayloadContent)
|
||||
case FORM:
|
||||
req.Param("payload", t.PayloadContent)
|
||||
}
|
||||
|
||||
t.IsDelivered = true
|
||||
|
||||
// TODO: record response.
|
||||
switch t.Type {
|
||||
case GOGS:
|
||||
{
|
||||
if _, err := req.Response(); err != nil {
|
||||
log.Error(4, "Delivery: %v", err)
|
||||
} else {
|
||||
t.IsSucceed = true
|
||||
}
|
||||
}
|
||||
case SLACK:
|
||||
{
|
||||
if res, err := req.Response(); err != nil {
|
||||
log.Error(4, "Delivery: %v", err)
|
||||
} else {
|
||||
defer res.Body.Close()
|
||||
contents, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
log.Error(4, "%s", err)
|
||||
} else {
|
||||
if string(contents) != "ok" {
|
||||
log.Error(4, "slack failed with: %s", string(contents))
|
||||
} else {
|
||||
t.IsSucceed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks = append(tasks, t)
|
||||
|
||||
if t.IsSucceed {
|
||||
log.Trace("Hook delivered(%s): %s", t.Uuid, t.PayloadContent)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
// Update hook task status.
|
||||
for _, t := range tasks {
|
||||
if err := UpdateHookTask(t); err != nil {
|
||||
log.Error(4, "UpdateHookTask(%d): %v", t.Id, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
27
modules/asn1-ber/LICENSE
Normal file
27
modules/asn1-ber/LICENSE
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
11
modules/asn1-ber/Makefile
Normal file
11
modules/asn1-ber/Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=github.com/mmitton/asn1-ber
|
||||
GOFILES=\
|
||||
ber.go\
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
14
modules/asn1-ber/README
Normal file
14
modules/asn1-ber/README
Normal file
@@ -0,0 +1,14 @@
|
||||
ASN1 BER Encoding / Decoding Library for the GO programming language.
|
||||
|
||||
Required Librarys:
|
||||
None
|
||||
|
||||
Working:
|
||||
Very basic encoding / decoding needed for LDAP protocol
|
||||
|
||||
Tests Implemented:
|
||||
None
|
||||
|
||||
TODO:
|
||||
Fix all encoding / decoding to conform to ASN1 BER spec
|
||||
Implement Tests / Benchmarks
|
||||
492
modules/asn1-ber/ber.go
Normal file
492
modules/asn1-ber/ber.go
Normal file
@@ -0,0 +1,492 @@
|
||||
package ber
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
type Packet struct {
|
||||
ClassType uint8
|
||||
TagType uint8
|
||||
Tag uint8
|
||||
Value interface{}
|
||||
ByteValue []byte
|
||||
Data *bytes.Buffer
|
||||
Children []*Packet
|
||||
Description string
|
||||
}
|
||||
|
||||
const (
|
||||
TagEOC = 0x00
|
||||
TagBoolean = 0x01
|
||||
TagInteger = 0x02
|
||||
TagBitString = 0x03
|
||||
TagOctetString = 0x04
|
||||
TagNULL = 0x05
|
||||
TagObjectIdentifier = 0x06
|
||||
TagObjectDescriptor = 0x07
|
||||
TagExternal = 0x08
|
||||
TagRealFloat = 0x09
|
||||
TagEnumerated = 0x0a
|
||||
TagEmbeddedPDV = 0x0b
|
||||
TagUTF8String = 0x0c
|
||||
TagRelativeOID = 0x0d
|
||||
TagSequence = 0x10
|
||||
TagSet = 0x11
|
||||
TagNumericString = 0x12
|
||||
TagPrintableString = 0x13
|
||||
TagT61String = 0x14
|
||||
TagVideotexString = 0x15
|
||||
TagIA5String = 0x16
|
||||
TagUTCTime = 0x17
|
||||
TagGeneralizedTime = 0x18
|
||||
TagGraphicString = 0x19
|
||||
TagVisibleString = 0x1a
|
||||
TagGeneralString = 0x1b
|
||||
TagUniversalString = 0x1c
|
||||
TagCharacterString = 0x1d
|
||||
TagBMPString = 0x1e
|
||||
TagBitmask = 0x1f // xxx11111b
|
||||
)
|
||||
|
||||
var TagMap = map[uint8]string{
|
||||
TagEOC: "EOC (End-of-Content)",
|
||||
TagBoolean: "Boolean",
|
||||
TagInteger: "Integer",
|
||||
TagBitString: "Bit String",
|
||||
TagOctetString: "Octet String",
|
||||
TagNULL: "NULL",
|
||||
TagObjectIdentifier: "Object Identifier",
|
||||
TagObjectDescriptor: "Object Descriptor",
|
||||
TagExternal: "External",
|
||||
TagRealFloat: "Real (float)",
|
||||
TagEnumerated: "Enumerated",
|
||||
TagEmbeddedPDV: "Embedded PDV",
|
||||
TagUTF8String: "UTF8 String",
|
||||
TagRelativeOID: "Relative-OID",
|
||||
TagSequence: "Sequence and Sequence of",
|
||||
TagSet: "Set and Set OF",
|
||||
TagNumericString: "Numeric String",
|
||||
TagPrintableString: "Printable String",
|
||||
TagT61String: "T61 String",
|
||||
TagVideotexString: "Videotex String",
|
||||
TagIA5String: "IA5 String",
|
||||
TagUTCTime: "UTC Time",
|
||||
TagGeneralizedTime: "Generalized Time",
|
||||
TagGraphicString: "Graphic String",
|
||||
TagVisibleString: "Visible String",
|
||||
TagGeneralString: "General String",
|
||||
TagUniversalString: "Universal String",
|
||||
TagCharacterString: "Character String",
|
||||
TagBMPString: "BMP String",
|
||||
}
|
||||
|
||||
const (
|
||||
ClassUniversal = 0 // 00xxxxxxb
|
||||
ClassApplication = 64 // 01xxxxxxb
|
||||
ClassContext = 128 // 10xxxxxxb
|
||||
ClassPrivate = 192 // 11xxxxxxb
|
||||
ClassBitmask = 192 // 11xxxxxxb
|
||||
)
|
||||
|
||||
var ClassMap = map[uint8]string{
|
||||
ClassUniversal: "Universal",
|
||||
ClassApplication: "Application",
|
||||
ClassContext: "Context",
|
||||
ClassPrivate: "Private",
|
||||
}
|
||||
|
||||
const (
|
||||
TypePrimitive = 0 // xx0xxxxxb
|
||||
TypeConstructed = 32 // xx1xxxxxb
|
||||
TypeBitmask = 32 // xx1xxxxxb
|
||||
)
|
||||
|
||||
var TypeMap = map[uint8]string{
|
||||
TypePrimitive: "Primative",
|
||||
TypeConstructed: "Constructed",
|
||||
}
|
||||
|
||||
var Debug bool = false
|
||||
|
||||
func PrintBytes(buf []byte, indent string) {
|
||||
data_lines := make([]string, (len(buf)/30)+1)
|
||||
num_lines := make([]string, (len(buf)/30)+1)
|
||||
|
||||
for i, b := range buf {
|
||||
data_lines[i/30] += fmt.Sprintf("%02x ", b)
|
||||
num_lines[i/30] += fmt.Sprintf("%02d ", (i+1)%100)
|
||||
}
|
||||
|
||||
for i := 0; i < len(data_lines); i++ {
|
||||
fmt.Print(indent + data_lines[i] + "\n")
|
||||
fmt.Print(indent + num_lines[i] + "\n\n")
|
||||
}
|
||||
}
|
||||
|
||||
func PrintPacket(p *Packet) {
|
||||
printPacket(p, 0, false)
|
||||
}
|
||||
|
||||
func printPacket(p *Packet, indent int, printBytes bool) {
|
||||
indent_str := ""
|
||||
|
||||
for len(indent_str) != indent {
|
||||
indent_str += " "
|
||||
}
|
||||
|
||||
class_str := ClassMap[p.ClassType]
|
||||
|
||||
tagtype_str := TypeMap[p.TagType]
|
||||
|
||||
tag_str := fmt.Sprintf("0x%02X", p.Tag)
|
||||
|
||||
if p.ClassType == ClassUniversal {
|
||||
tag_str = TagMap[p.Tag]
|
||||
}
|
||||
|
||||
value := fmt.Sprint(p.Value)
|
||||
description := ""
|
||||
|
||||
if p.Description != "" {
|
||||
description = p.Description + ": "
|
||||
}
|
||||
|
||||
fmt.Printf("%s%s(%s, %s, %s) Len=%d %q\n", indent_str, description, class_str, tagtype_str, tag_str, p.Data.Len(), value)
|
||||
|
||||
if printBytes {
|
||||
PrintBytes(p.Bytes(), indent_str)
|
||||
}
|
||||
|
||||
for _, child := range p.Children {
|
||||
printPacket(child, indent+1, printBytes)
|
||||
}
|
||||
}
|
||||
|
||||
func resizeBuffer(in []byte, new_size uint64) (out []byte) {
|
||||
out = make([]byte, new_size)
|
||||
|
||||
copy(out, in)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func readBytes(reader io.Reader, buf []byte) error {
|
||||
idx := 0
|
||||
buflen := len(buf)
|
||||
|
||||
for idx < buflen {
|
||||
n, err := reader.Read(buf[idx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
idx += n
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ReadPacket(reader io.Reader) (*Packet, error) {
|
||||
buf := make([]byte, 2)
|
||||
|
||||
err := readBytes(reader, buf)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
idx := uint64(2)
|
||||
datalen := uint64(buf[1])
|
||||
|
||||
if Debug {
|
||||
fmt.Printf("Read: datalen = %d len(buf) = %d ", datalen, len(buf))
|
||||
|
||||
for _, b := range buf {
|
||||
fmt.Printf("%02X ", b)
|
||||
}
|
||||
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
|
||||
if datalen&128 != 0 {
|
||||
a := datalen - 128
|
||||
|
||||
idx += a
|
||||
buf = resizeBuffer(buf, 2+a)
|
||||
|
||||
err := readBytes(reader, buf[2:])
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
datalen = DecodeInteger(buf[2 : 2+a])
|
||||
|
||||
if Debug {
|
||||
fmt.Printf("Read: a = %d idx = %d datalen = %d len(buf) = %d", a, idx, datalen, len(buf))
|
||||
|
||||
for _, b := range buf {
|
||||
fmt.Printf("%02X ", b)
|
||||
}
|
||||
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
}
|
||||
|
||||
buf = resizeBuffer(buf, idx+datalen)
|
||||
err = readBytes(reader, buf[idx:])
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if Debug {
|
||||
fmt.Printf("Read: len( buf ) = %d idx=%d datalen=%d idx+datalen=%d\n", len(buf), idx, datalen, idx+datalen)
|
||||
|
||||
for _, b := range buf {
|
||||
fmt.Printf("%02X ", b)
|
||||
}
|
||||
}
|
||||
|
||||
p := DecodePacket(buf)
|
||||
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func DecodeString(data []byte) (ret string) {
|
||||
for _, c := range data {
|
||||
ret += fmt.Sprintf("%c", c)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func DecodeInteger(data []byte) (ret uint64) {
|
||||
for _, i := range data {
|
||||
ret = ret * 256
|
||||
ret = ret + uint64(i)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func EncodeInteger(val uint64) []byte {
|
||||
var out bytes.Buffer
|
||||
|
||||
found := false
|
||||
|
||||
shift := uint(56)
|
||||
|
||||
mask := uint64(0xFF00000000000000)
|
||||
|
||||
for mask > 0 {
|
||||
if !found && (val&mask != 0) {
|
||||
found = true
|
||||
}
|
||||
|
||||
if found || (shift == 0) {
|
||||
out.Write([]byte{byte((val & mask) >> shift)})
|
||||
}
|
||||
|
||||
shift -= 8
|
||||
mask = mask >> 8
|
||||
}
|
||||
|
||||
return out.Bytes()
|
||||
}
|
||||
|
||||
func DecodePacket(data []byte) *Packet {
|
||||
p, _ := decodePacket(data)
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func decodePacket(data []byte) (*Packet, []byte) {
|
||||
if Debug {
|
||||
fmt.Printf("decodePacket: enter %d\n", len(data))
|
||||
}
|
||||
|
||||
p := new(Packet)
|
||||
|
||||
p.ClassType = data[0] & ClassBitmask
|
||||
p.TagType = data[0] & TypeBitmask
|
||||
p.Tag = data[0] & TagBitmask
|
||||
|
||||
datalen := DecodeInteger(data[1:2])
|
||||
datapos := uint64(2)
|
||||
|
||||
if datalen&128 != 0 {
|
||||
datalen -= 128
|
||||
datapos += datalen
|
||||
datalen = DecodeInteger(data[2 : 2+datalen])
|
||||
}
|
||||
|
||||
p.Data = new(bytes.Buffer)
|
||||
|
||||
p.Children = make([]*Packet, 0, 2)
|
||||
|
||||
p.Value = nil
|
||||
|
||||
value_data := data[datapos : datapos+datalen]
|
||||
|
||||
if p.TagType == TypeConstructed {
|
||||
for len(value_data) != 0 {
|
||||
var child *Packet
|
||||
|
||||
child, value_data = decodePacket(value_data)
|
||||
p.AppendChild(child)
|
||||
}
|
||||
} else if p.ClassType == ClassUniversal {
|
||||
p.Data.Write(data[datapos : datapos+datalen])
|
||||
p.ByteValue = value_data
|
||||
|
||||
switch p.Tag {
|
||||
case TagEOC:
|
||||
case TagBoolean:
|
||||
val := DecodeInteger(value_data)
|
||||
|
||||
p.Value = val != 0
|
||||
case TagInteger:
|
||||
p.Value = DecodeInteger(value_data)
|
||||
case TagBitString:
|
||||
case TagOctetString:
|
||||
p.Value = DecodeString(value_data)
|
||||
case TagNULL:
|
||||
case TagObjectIdentifier:
|
||||
case TagObjectDescriptor:
|
||||
case TagExternal:
|
||||
case TagRealFloat:
|
||||
case TagEnumerated:
|
||||
p.Value = DecodeInteger(value_data)
|
||||
case TagEmbeddedPDV:
|
||||
case TagUTF8String:
|
||||
case TagRelativeOID:
|
||||
case TagSequence:
|
||||
case TagSet:
|
||||
case TagNumericString:
|
||||
case TagPrintableString:
|
||||
p.Value = DecodeString(value_data)
|
||||
case TagT61String:
|
||||
case TagVideotexString:
|
||||
case TagIA5String:
|
||||
case TagUTCTime:
|
||||
case TagGeneralizedTime:
|
||||
case TagGraphicString:
|
||||
case TagVisibleString:
|
||||
case TagGeneralString:
|
||||
case TagUniversalString:
|
||||
case TagCharacterString:
|
||||
case TagBMPString:
|
||||
}
|
||||
} else {
|
||||
p.Data.Write(data[datapos : datapos+datalen])
|
||||
}
|
||||
|
||||
return p, data[datapos+datalen:]
|
||||
}
|
||||
|
||||
func (p *Packet) DataLength() uint64 {
|
||||
return uint64(p.Data.Len())
|
||||
}
|
||||
|
||||
func (p *Packet) Bytes() []byte {
|
||||
var out bytes.Buffer
|
||||
|
||||
out.Write([]byte{p.ClassType | p.TagType | p.Tag})
|
||||
packet_length := EncodeInteger(p.DataLength())
|
||||
|
||||
if p.DataLength() > 127 || len(packet_length) > 1 {
|
||||
out.Write([]byte{byte(len(packet_length) | 128)})
|
||||
out.Write(packet_length)
|
||||
} else {
|
||||
out.Write(packet_length)
|
||||
}
|
||||
|
||||
out.Write(p.Data.Bytes())
|
||||
|
||||
return out.Bytes()
|
||||
}
|
||||
|
||||
func (p *Packet) AppendChild(child *Packet) {
|
||||
p.Data.Write(child.Bytes())
|
||||
|
||||
if len(p.Children) == cap(p.Children) {
|
||||
newChildren := make([]*Packet, cap(p.Children)*2)
|
||||
|
||||
copy(newChildren, p.Children)
|
||||
p.Children = newChildren[0:len(p.Children)]
|
||||
}
|
||||
|
||||
p.Children = p.Children[0 : len(p.Children)+1]
|
||||
p.Children[len(p.Children)-1] = child
|
||||
}
|
||||
|
||||
func Encode(ClassType, TagType, Tag uint8, Value interface{}, Description string) *Packet {
|
||||
p := new(Packet)
|
||||
|
||||
p.ClassType = ClassType
|
||||
p.TagType = TagType
|
||||
p.Tag = Tag
|
||||
p.Data = new(bytes.Buffer)
|
||||
|
||||
p.Children = make([]*Packet, 0, 2)
|
||||
|
||||
p.Value = Value
|
||||
p.Description = Description
|
||||
|
||||
if Value != nil {
|
||||
v := reflect.ValueOf(Value)
|
||||
|
||||
if ClassType == ClassUniversal {
|
||||
switch Tag {
|
||||
case TagOctetString:
|
||||
sv, ok := v.Interface().(string)
|
||||
|
||||
if ok {
|
||||
p.Data.Write([]byte(sv))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func NewSequence(Description string) *Packet {
|
||||
return Encode(ClassUniversal, TypePrimitive, TagSequence, nil, Description)
|
||||
}
|
||||
|
||||
func NewBoolean(ClassType, TagType, Tag uint8, Value bool, Description string) *Packet {
|
||||
intValue := 0
|
||||
|
||||
if Value {
|
||||
intValue = 1
|
||||
}
|
||||
|
||||
p := Encode(ClassType, TagType, Tag, nil, Description)
|
||||
|
||||
p.Value = Value
|
||||
p.Data.Write(EncodeInteger(uint64(intValue)))
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func NewInteger(ClassType, TagType, Tag uint8, Value uint64, Description string) *Packet {
|
||||
p := Encode(ClassType, TagType, Tag, nil, Description)
|
||||
|
||||
p.Value = Value
|
||||
p.Data.Write(EncodeInteger(Value))
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func NewString(ClassType, TagType, Tag uint8, Value, Description string) *Packet {
|
||||
p := Encode(ClassType, TagType, Tag, nil, Description)
|
||||
|
||||
p.Value = Value
|
||||
p.Data.Write([]byte(Value))
|
||||
|
||||
return p
|
||||
}
|
||||
@@ -5,49 +5,23 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
"github.com/Unknwon/macaron"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
|
||||
"github.com/go-martini/martini"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
)
|
||||
|
||||
type AdminEditUserForm struct {
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
Website string `form:"website" binding:"MaxSize(50)"`
|
||||
Location string `form:"location" binding:"MaxSize(50)"`
|
||||
Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
|
||||
Active string `form:"active"`
|
||||
Admin string `form:"admin"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
Passwd string `form:"password"`
|
||||
Website string `form:"website" binding:"MaxSize(50)"`
|
||||
Location string `form:"location" binding:"MaxSize(50)"`
|
||||
Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
|
||||
Active bool `form:"active"`
|
||||
Admin bool `form:"admin"`
|
||||
LoginType int `form:"login_type"`
|
||||
}
|
||||
|
||||
func (f *AdminEditUserForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"Email": "E-mail address",
|
||||
"Website": "Website",
|
||||
"Location": "Location",
|
||||
"Avatar": "Gravatar Email",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *AdminEditUserForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("AdminEditUserForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
79
modules/auth/apiv1/miscellaneous.go
Normal file
79
modules/auth/apiv1/miscellaneous.go
Normal file
@@ -0,0 +1,79 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package apiv1
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/Unknwon/macaron"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
|
||||
"github.com/gogits/gogs/modules/auth"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
)
|
||||
|
||||
type MarkdownForm struct {
|
||||
Text string `form:"text" binding:"Required"`
|
||||
Mode string `form:"mode"`
|
||||
Context string `form:"context"`
|
||||
}
|
||||
|
||||
func (f *MarkdownForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validateApiReq(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
func validateApiReq(errs *binding.Errors, data map[string]interface{}, f interface{}, l i18n.Locale) {
|
||||
if errs.Count() == 0 {
|
||||
return
|
||||
} else if len(errs.Overall) > 0 {
|
||||
for _, err := range errs.Overall {
|
||||
log.Error(4, "%s: %v", reflect.TypeOf(f), err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
data["HasError"] = true
|
||||
|
||||
typ := reflect.TypeOf(f)
|
||||
val := reflect.ValueOf(f)
|
||||
|
||||
if typ.Kind() == reflect.Ptr {
|
||||
typ = typ.Elem()
|
||||
val = val.Elem()
|
||||
}
|
||||
|
||||
for i := 0; i < typ.NumField(); i++ {
|
||||
field := typ.Field(i)
|
||||
|
||||
fieldName := field.Tag.Get("form")
|
||||
// Allow ignored fields in the struct
|
||||
if fieldName == "-" {
|
||||
continue
|
||||
}
|
||||
|
||||
if err, ok := errs.Fields[field.Name]; ok {
|
||||
switch err {
|
||||
case binding.BindingRequireError:
|
||||
data["ErrorMsg"] = fieldName + " cannot be empty"
|
||||
case binding.BindingAlphaDashError:
|
||||
data["ErrorMsg"] = fieldName + " must be valid alpha or numeric or dash(-_) characters"
|
||||
case binding.BindingAlphaDashDotError:
|
||||
data["ErrorMsg"] = fieldName + " must be valid alpha or numeric or dash(-_) or dot characters"
|
||||
case binding.BindingMinSizeError:
|
||||
data["ErrorMsg"] = fieldName + " must contain at least " + auth.GetMinSize(field) + " characters"
|
||||
case binding.BindingMaxSizeError:
|
||||
data["ErrorMsg"] = fieldName + " must contain at most " + auth.GetMaxSize(field) + " characters"
|
||||
case binding.BindingEmailError:
|
||||
data["ErrorMsg"] = fieldName + " is not a valid e-mail address"
|
||||
case binding.BindingUrlError:
|
||||
data["ErrorMsg"] = fieldName + " is not a valid URL"
|
||||
default:
|
||||
data["ErrorMsg"] = "Unknown error: " + err
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,138 +9,68 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/go-martini/martini"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
"github.com/macaron-contrib/session"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
// Web form interface.
|
||||
type Form interface {
|
||||
Name(field string) string
|
||||
}
|
||||
|
||||
type RegisterForm struct {
|
||||
UserName string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
|
||||
RetypePasswd string `form:"retypepasswd"`
|
||||
}
|
||||
|
||||
func (f *RegisterForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"UserName": "Username",
|
||||
"Email": "E-mail address",
|
||||
"Password": "Password",
|
||||
"RetypePasswd": "Re-type password",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *RegisterForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
// SignedInId returns the id of signed in user.
|
||||
func SignedInId(header http.Header, sess session.Store) int64 {
|
||||
if !models.HasEngine {
|
||||
return 0
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("RegisterForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
|
||||
type LogInForm struct {
|
||||
UserName string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"`
|
||||
Password string `form:"passwd" binding:"Required;MinSize(6);MaxSize(30)"`
|
||||
Remember string `form:"remember"`
|
||||
}
|
||||
|
||||
func (f *LogInForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"UserName": "Username",
|
||||
"Password": "Password",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *LogInForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("LogInForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
|
||||
func getMinMaxSize(field reflect.StructField) string {
|
||||
for _, rule := range strings.Split(field.Tag.Get("binding"), ";") {
|
||||
if strings.HasPrefix(rule, "MinSize(") || strings.HasPrefix(rule, "MaxSize(") {
|
||||
return rule[8 : len(rule)-1]
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func validate(errors *base.BindingErrors, data base.TmplData, form Form) {
|
||||
typ := reflect.TypeOf(form)
|
||||
val := reflect.ValueOf(form)
|
||||
|
||||
if typ.Kind() == reflect.Ptr {
|
||||
typ = typ.Elem()
|
||||
val = val.Elem()
|
||||
}
|
||||
|
||||
for i := 0; i < typ.NumField(); i++ {
|
||||
field := typ.Field(i)
|
||||
|
||||
fieldName := field.Tag.Get("form")
|
||||
// Allow ignored fields in the struct
|
||||
if fieldName == "-" {
|
||||
continue
|
||||
}
|
||||
|
||||
if err, ok := errors.Fields[field.Name]; ok {
|
||||
data["Err_"+field.Name] = true
|
||||
switch err {
|
||||
case base.BindingRequireError:
|
||||
data["ErrorMsg"] = form.Name(field.Name) + " cannot be empty"
|
||||
case base.BindingAlphaDashError:
|
||||
data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) characters"
|
||||
case base.BindingMinSizeError:
|
||||
data["ErrorMsg"] = form.Name(field.Name) + " must contain at least " + getMinMaxSize(field) + " characters"
|
||||
case base.BindingMaxSizeError:
|
||||
data["ErrorMsg"] = form.Name(field.Name) + " must contain at most " + getMinMaxSize(field) + " characters"
|
||||
case base.BindingEmailError:
|
||||
data["ErrorMsg"] = form.Name(field.Name) + " is not a valid e-mail address"
|
||||
case base.BindingUrlError:
|
||||
data["ErrorMsg"] = form.Name(field.Name) + " is not a valid URL"
|
||||
default:
|
||||
data["ErrorMsg"] = "Unknown error: " + err
|
||||
if setting.Service.EnableReverseProxyAuth {
|
||||
webAuthUser := header.Get(setting.ReverseProxyAuthUser)
|
||||
if len(webAuthUser) > 0 {
|
||||
u, err := models.GetUserByName(webAuthUser)
|
||||
if err != nil {
|
||||
if err != models.ErrUserNotExist {
|
||||
log.Error(4, "GetUserByName: %v", err)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
return
|
||||
return u.Id
|
||||
}
|
||||
}
|
||||
|
||||
uid := sess.Get("uid")
|
||||
if uid == nil {
|
||||
return 0
|
||||
}
|
||||
if id, ok := uid.(int64); ok {
|
||||
if _, err := models.GetUserById(id); err != nil {
|
||||
if err != models.ErrUserNotExist {
|
||||
log.Error(4, "GetUserById: %v", err)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
return id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// SignedInUser returns the user object of signed user.
|
||||
func SignedInUser(header http.Header, sess session.Store) *models.User {
|
||||
uid := SignedInId(header, sess)
|
||||
if uid <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
u, err := models.GetUserById(uid)
|
||||
if err != nil {
|
||||
log.Error(4, "GetUserById: %v", err)
|
||||
return nil
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// AssignForm assign form values back to the template data.
|
||||
func AssignForm(form interface{}, data base.TmplData) {
|
||||
func AssignForm(form interface{}, data map[string]interface{}) {
|
||||
typ := reflect.TypeOf(form)
|
||||
val := reflect.ValueOf(form)
|
||||
|
||||
@@ -162,53 +92,75 @@ func AssignForm(form interface{}, data base.TmplData) {
|
||||
}
|
||||
}
|
||||
|
||||
type InstallForm struct {
|
||||
Database string `form:"database" binding:"Required"`
|
||||
Host string `form:"host"`
|
||||
User string `form:"user"`
|
||||
Passwd string `form:"passwd"`
|
||||
DatabaseName string `form:"database_name"`
|
||||
SslMode string `form:"ssl_mode"`
|
||||
DatabasePath string `form:"database_path"`
|
||||
RepoRootPath string `form:"repo_path"`
|
||||
RunUser string `form:"run_user"`
|
||||
Domain string `form:"domain"`
|
||||
AppUrl string `form:"app_url"`
|
||||
AdminName string `form:"admin_name" binding:"Required"`
|
||||
AdminPasswd string `form:"admin_pwd" binding:"Required;MinSize(6);MaxSize(30)"`
|
||||
AdminEmail string `form:"admin_email" binding:"Required;Email;MaxSize(50)"`
|
||||
SmtpHost string `form:"smtp_host"`
|
||||
SmtpEmail string `form:"mailer_user"`
|
||||
SmtpPasswd string `form:"mailer_pwd"`
|
||||
RegisterConfirm string `form:"register_confirm"`
|
||||
MailNotify string `form:"mail_notify"`
|
||||
}
|
||||
|
||||
func (f *InstallForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"Database": "Database name",
|
||||
"AdminName": "Admin user name",
|
||||
"AdminPasswd": "Admin password",
|
||||
"AdminEmail": "Admin e-maill address",
|
||||
func getSize(field reflect.StructField, prefix string) string {
|
||||
for _, rule := range strings.Split(field.Tag.Get("binding"), ";") {
|
||||
if strings.HasPrefix(rule, prefix) {
|
||||
return rule[8 : len(rule)-1]
|
||||
}
|
||||
}
|
||||
return names[field]
|
||||
return ""
|
||||
}
|
||||
|
||||
func (f *InstallForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
func GetMinSize(field reflect.StructField) string {
|
||||
return getSize(field, "MinSize(")
|
||||
}
|
||||
|
||||
func GetMaxSize(field reflect.StructField) string {
|
||||
return getSize(field, "MaxSize(")
|
||||
}
|
||||
|
||||
func validate(errs *binding.Errors, data map[string]interface{}, f interface{}, l i18n.Locale) {
|
||||
if errs.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("InstallForm.Validate: %v", err)
|
||||
} else if len(errs.Overall) > 0 {
|
||||
for _, err := range errs.Overall {
|
||||
log.Error(4, "%s: %v", reflect.TypeOf(f), err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
typ := reflect.TypeOf(f)
|
||||
val := reflect.ValueOf(f)
|
||||
|
||||
if typ.Kind() == reflect.Ptr {
|
||||
typ = typ.Elem()
|
||||
val = val.Elem()
|
||||
}
|
||||
|
||||
for i := 0; i < typ.NumField(); i++ {
|
||||
field := typ.Field(i)
|
||||
|
||||
fieldName := field.Tag.Get("form")
|
||||
// Allow ignored fields in the struct
|
||||
if fieldName == "-" {
|
||||
continue
|
||||
}
|
||||
|
||||
if err, ok := errs.Fields[field.Name]; ok {
|
||||
data["Err_"+field.Name] = true
|
||||
trName := l.Tr("form." + field.Name)
|
||||
switch err {
|
||||
case binding.BindingRequireError:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.require_error")
|
||||
case binding.BindingAlphaDashError:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.alpha_dash_error")
|
||||
case binding.BindingAlphaDashDotError:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.alpha_dash_dot_error")
|
||||
case binding.BindingMinSizeError:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.min_size_error", GetMinSize(field))
|
||||
case binding.BindingMaxSizeError:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.max_size_error", GetMaxSize(field))
|
||||
case binding.BindingEmailError:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.email_error")
|
||||
case binding.BindingUrlError:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.url_error")
|
||||
default:
|
||||
data["ErrorMsg"] = l.Tr("form.unknown_error") + " " + err
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
modules/auth/auth_form.go
Normal file
36
modules/auth/auth_form.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"github.com/Unknwon/macaron"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
)
|
||||
|
||||
type AuthenticationForm struct {
|
||||
Id int64 `form:"id"`
|
||||
Type int `form:"type"`
|
||||
AuthName string `form:"name" binding:"Required;MaxSize(50)"`
|
||||
Domain string `form:"domain"`
|
||||
Host string `form:"host"`
|
||||
Port int `form:"port"`
|
||||
UseSSL bool `form:"usessl"`
|
||||
BaseDN string `form:"base_dn"`
|
||||
Attributes string `form:"attributes"`
|
||||
Filter string `form:"filter"`
|
||||
MsAdSA string `form:"ms_ad_sa"`
|
||||
IsActived bool `form:"is_actived"`
|
||||
SmtpAuth string `form:"smtpauth"`
|
||||
SmtpHost string `form:"smtphost"`
|
||||
SmtpPort int `form:"smtpport"`
|
||||
Tls bool `form:"tls"`
|
||||
AllowAutoRegister bool `form:"allowautoregister"`
|
||||
}
|
||||
|
||||
func (f *AuthenticationForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
"github.com/go-martini/martini"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
type CreateIssueForm struct {
|
||||
IssueName string `form:"title" binding:"Required;MaxSize(50)"`
|
||||
MilestoneId int64 `form:"milestoneid"`
|
||||
AssigneeId int64 `form:"assigneeid"`
|
||||
Labels string `form:"labels"`
|
||||
Content string `form:"content"`
|
||||
}
|
||||
|
||||
func (f *CreateIssueForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"IssueName": "Issue name",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *CreateIssueForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("CreateIssueForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
43
modules/auth/ldap/README.md
Normal file
43
modules/auth/ldap/README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
LDAP authentication
|
||||
===================
|
||||
|
||||
## Goal
|
||||
|
||||
Authenticat user against LDAP directories
|
||||
|
||||
It will bind with the user's login/pasword and query attributs ("mail" for instance) in a pool of directory servers
|
||||
|
||||
The first OK wins.
|
||||
|
||||
If there's connection error, the server will be disabled and won't be checked again
|
||||
|
||||
## Usage
|
||||
|
||||
In the [security] section, set
|
||||
> LDAP_AUTH = true
|
||||
|
||||
then for each LDAP source, set
|
||||
|
||||
> [LdapSource-someuniquename]
|
||||
> name=canonicalName
|
||||
> host=hostname-or-ip
|
||||
> port=3268 # or regular LDAP port
|
||||
> # the following settings depend highly how you've configured your AD
|
||||
> basedn=dc=ACME,dc=COM
|
||||
> MSADSAFORMAT=%s@ACME.COM
|
||||
> filter=(&(objectClass=user)(sAMAccountName=%s))
|
||||
|
||||
### Limitation
|
||||
|
||||
Only tested on an MS 2008R2 DC, using global catalog (TCP/3268)
|
||||
|
||||
This MSAD is a mess.
|
||||
|
||||
The way how one checks the directory (CN, DN etc...) may be highly depending local custom configuration
|
||||
|
||||
### Todo
|
||||
* Define a timeout per server
|
||||
* Check servers marked as "Disabled" when they'll come back online
|
||||
* Find a more flexible way to define filter/MSADSAFORMAT/Attributes etc... maybe text/template ?
|
||||
* Check OpenLDAP server
|
||||
* SSL support ?
|
||||
96
modules/auth/ldap/ldap.go
Normal file
96
modules/auth/ldap/ldap.go
Normal file
@@ -0,0 +1,96 @@
|
||||
// Copyright github.com/juju2013. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// package ldap provide functions & structure to query a LDAP ldap directory
|
||||
// For now, it's mainly tested again an MS Active Directory service, see README.md for more information
|
||||
package ldap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gogits/gogs/modules/ldap"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
// Basic LDAP authentication service
|
||||
type Ldapsource struct {
|
||||
Name string // canonical name (ie. corporate.ad)
|
||||
Host string // LDAP host
|
||||
Port int // port number
|
||||
UseSSL bool // Use SSL
|
||||
BaseDN string // Base DN
|
||||
Attributes string // Attribut to search
|
||||
Filter string // Query filter to validate entry
|
||||
MsAdSAFormat string // in the case of MS AD Simple Authen, the format to use (see: http://msdn.microsoft.com/en-us/library/cc223499.aspx)
|
||||
Enabled bool // if this source is disabled
|
||||
}
|
||||
|
||||
//Global LDAP directory pool
|
||||
var (
|
||||
Authensource []Ldapsource
|
||||
)
|
||||
|
||||
// Add a new source (LDAP directory) to the global pool
|
||||
func AddSource(name string, host string, port int, usessl bool, basedn string, attributes string, filter string, msadsaformat string) {
|
||||
ldaphost := Ldapsource{name, host, port, usessl, basedn, attributes, filter, msadsaformat, true}
|
||||
Authensource = append(Authensource, ldaphost)
|
||||
}
|
||||
|
||||
//LoginUser : try to login an user to LDAP sources, return requested (attribut,true) if ok, ("",false) other wise
|
||||
//First match wins
|
||||
//Returns first attribute if exists
|
||||
func LoginUser(name, passwd string) (a string, r bool) {
|
||||
r = false
|
||||
for _, ls := range Authensource {
|
||||
a, r = ls.SearchEntry(name, passwd)
|
||||
if r {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// searchEntry : search an LDAP source if an entry (name, passwd) is valide and in the specific filter
|
||||
func (ls Ldapsource) SearchEntry(name, passwd string) (string, bool) {
|
||||
l, err := ldapDial(ls)
|
||||
if err != nil {
|
||||
log.Error(4, "LDAP Connect error, %s:%v", ls.Host, err)
|
||||
ls.Enabled = false
|
||||
return "", false
|
||||
}
|
||||
defer l.Close()
|
||||
|
||||
nx := fmt.Sprintf(ls.MsAdSAFormat, name)
|
||||
err = l.Bind(nx, passwd)
|
||||
if err != nil {
|
||||
log.Debug("LDAP Authan failed for %s, reason: %s", nx, err.Error())
|
||||
return "", false
|
||||
}
|
||||
|
||||
search := ldap.NewSearchRequest(
|
||||
ls.BaseDN,
|
||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
||||
fmt.Sprintf(ls.Filter, name),
|
||||
[]string{ls.Attributes},
|
||||
nil)
|
||||
sr, err := l.Search(search)
|
||||
if err != nil {
|
||||
log.Debug("LDAP Authen OK but not in filter %s", name)
|
||||
return "", false
|
||||
}
|
||||
log.Debug("LDAP Authen OK: %s", name)
|
||||
if len(sr.Entries) > 0 {
|
||||
r := sr.Entries[0].GetAttributeValue(ls.Attributes)
|
||||
return r, true
|
||||
}
|
||||
return "", true
|
||||
}
|
||||
|
||||
func ldapDial(ls Ldapsource) (*ldap.Conn, error) {
|
||||
if ls.UseSSL {
|
||||
return ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port), nil)
|
||||
} else {
|
||||
return ldap.Dial("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port))
|
||||
}
|
||||
}
|
||||
29
modules/auth/ldap/ldap_test.go
Normal file
29
modules/auth/ldap/ldap_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package ldap
|
||||
|
||||
// import (
|
||||
// "fmt"
|
||||
// "testing"
|
||||
// )
|
||||
|
||||
// var ldapServer = "ldap.itd.umich.edu"
|
||||
// var ldapPort = 389
|
||||
// var baseDN = "dc=umich,dc=edu"
|
||||
// var filter = []string{
|
||||
// "(cn=cis-fac)",
|
||||
// "(&(objectclass=rfc822mailgroup)(cn=*Computer*))",
|
||||
// "(&(objectclass=rfc822mailgroup)(cn=*Mathematics*))"}
|
||||
// var attributes = []string{
|
||||
// "cn",
|
||||
// "description"}
|
||||
// var msadsaformat = ""
|
||||
|
||||
// func TestLDAP(t *testing.T) {
|
||||
// AddSource("test", ldapServer, ldapPort, baseDN, attributes, filter, msadsaformat)
|
||||
// user, err := LoginUserLdap("xiaolunwen", "")
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// return
|
||||
// }
|
||||
|
||||
// fmt.Println(user)
|
||||
// }
|
||||
59
modules/auth/org.go
Normal file
59
modules/auth/org.go
Normal file
@@ -0,0 +1,59 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"github.com/Unknwon/macaron"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
)
|
||||
|
||||
// ________ .__ __ .__
|
||||
// \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
|
||||
// / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
|
||||
// / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
|
||||
// \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
|
||||
// \/ /_____/ \/ \/ \/ \/ \/
|
||||
|
||||
type CreateOrgForm struct {
|
||||
OrgName string `form:"org_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
}
|
||||
|
||||
func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
type UpdateOrgSettingForm struct {
|
||||
OrgUserName string `form:"uname" binding:"Required;MaxSize(35)"`
|
||||
OrgFullName string `form:"fullname" binding:"MaxSize(100)"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
Description string `form:"desc" binding:"MaxSize(255)"`
|
||||
Website string `form:"website" binding:"Url;MaxSize(100)"`
|
||||
Location string `form:"location" binding:"MaxSize(50)"`
|
||||
Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
|
||||
}
|
||||
|
||||
func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
// ___________
|
||||
// \__ ___/___ _____ _____
|
||||
// | |_/ __ \\__ \ / \
|
||||
// | |\ ___/ / __ \| Y Y \
|
||||
// |____| \___ >____ /__|_| /
|
||||
// \/ \/ \/
|
||||
|
||||
type CreateTeamForm struct {
|
||||
TeamName string `form:"team_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
|
||||
Description string `form:"desc" binding:"MaxSize(255)"`
|
||||
Permission string `form:"permission"`
|
||||
}
|
||||
|
||||
func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
21
modules/auth/publickey_form.go
Normal file
21
modules/auth/publickey_form.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"github.com/Unknwon/macaron"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
)
|
||||
|
||||
type AddSSHKeyForm struct {
|
||||
SSHTitle string `form:"title" binding:"Required"`
|
||||
Content string `form:"content" binding:"Required"`
|
||||
}
|
||||
|
||||
func (f *AddSSHKeyForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
"github.com/go-martini/martini"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
type NewReleaseForm struct {
|
||||
TagName string `form:"tag_name" binding:"Required"`
|
||||
Title string `form:"title" binding:"Required"`
|
||||
Content string `form:"content" binding:"Required"`
|
||||
Prerelease bool `form:"prerelease"`
|
||||
}
|
||||
|
||||
func (f *NewReleaseForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"TagName": "Tag name",
|
||||
"Title": "Release title",
|
||||
"Content": "Release content",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *NewReleaseForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("NewReleaseForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
"github.com/go-martini/martini"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
type CreateRepoForm struct {
|
||||
RepoName string `form:"repo" binding:"Required;AlphaDash"`
|
||||
Private bool `form:"private"`
|
||||
Description string `form:"desc" binding:"MaxSize(100)"`
|
||||
Language string `form:"language"`
|
||||
License string `form:"license"`
|
||||
InitReadme bool `form:"initReadme"`
|
||||
}
|
||||
|
||||
func (f *CreateRepoForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"RepoName": "Repository name",
|
||||
"Description": "Description",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *CreateRepoForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("CreateRepoForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
|
||||
type MigrateRepoForm struct {
|
||||
Url string `form:"url" binding:"Url"`
|
||||
AuthUserName string `form:"auth_username"`
|
||||
AuthPasswd string `form:"auth_password"`
|
||||
RepoName string `form:"repo" binding:"Required;AlphaDash"`
|
||||
Mirror bool `form:"mirror"`
|
||||
Private bool `form:"private"`
|
||||
Description string `form:"desc" binding:"MaxSize(100)"`
|
||||
}
|
||||
|
||||
func (f *MigrateRepoForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"Url": "Migration URL",
|
||||
"RepoName": "Repository name",
|
||||
"Description": "Description",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *MigrateRepoForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
AssignForm(f, data)
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("MigrateRepoForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
179
modules/auth/repo_form.go
Normal file
179
modules/auth/repo_form.go
Normal file
@@ -0,0 +1,179 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"github.com/Unknwon/macaron"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
)
|
||||
|
||||
// _______________________________________ _________.______________________ _______________.___.
|
||||
// \______ \_ _____/\______ \_____ \ / _____/| \__ ___/\_____ \\______ \__ | |
|
||||
// | _/| __)_ | ___// | \ \_____ \ | | | | / | \| _// | |
|
||||
// | | \| \ | | / | \/ \| | | | / | \ | \\____ |
|
||||
// |____|_ /_______ / |____| \_______ /_______ /|___| |____| \_______ /____|_ // ______|
|
||||
// \/ \/ \/ \/ \/ \/ \/
|
||||
|
||||
type CreateRepoForm struct {
|
||||
Uid int64 `form:"uid" binding:"Required"`
|
||||
RepoName string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||
Private bool `form:"private"`
|
||||
Description string `form:"desc" binding:"MaxSize(255)"`
|
||||
Gitignore string `form:"gitignore"`
|
||||
License string `form:"license"`
|
||||
InitReadme bool `form:"init_readme"`
|
||||
}
|
||||
|
||||
func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
type MigrateRepoForm struct {
|
||||
HttpsUrl string `form:"url" binding:"Required;Url"`
|
||||
AuthUserName string `form:"auth_username"`
|
||||
AuthPasswd string `form:"auth_password"`
|
||||
Uid int64 `form:"uid" binding:"Required"`
|
||||
RepoName string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||
Mirror bool `form:"mirror"`
|
||||
Private bool `form:"private"`
|
||||
Description string `form:"desc" binding:"MaxSize(255)"`
|
||||
}
|
||||
|
||||
func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
type RepoSettingForm struct {
|
||||
RepoName string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||
Description string `form:"desc" binding:"MaxSize(255)"`
|
||||
Website string `form:"site" binding:"Url;MaxSize(100)"`
|
||||
Branch string `form:"branch"`
|
||||
Interval int `form:"interval"`
|
||||
Private bool `form:"private"`
|
||||
GoGet bool `form:"goget"`
|
||||
}
|
||||
|
||||
func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
// __ __ ___. .__ .__ __
|
||||
// / \ / \ ____\_ |__ | |__ | |__ ____ | | __
|
||||
// \ \/\/ // __ \| __ \| | \| | \ / _ \| |/ /
|
||||
// \ /\ ___/| \_\ \ Y \ Y ( <_> ) <
|
||||
// \__/\ / \___ >___ /___| /___| /\____/|__|_ \
|
||||
// \/ \/ \/ \/ \/ \/
|
||||
|
||||
type NewWebhookForm struct {
|
||||
HookTaskType string `form:"hook_type" binding:"Required"`
|
||||
PayloadUrl string `form:"payload_url" binding:"Required;Url"`
|
||||
ContentType string `form:"content_type" binding:"Required"`
|
||||
Secret string `form:"secret"`
|
||||
PushOnly bool `form:"push_only"`
|
||||
Active bool `form:"active"`
|
||||
}
|
||||
|
||||
func (f *NewWebhookForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
type NewSlackHookForm struct {
|
||||
HookTaskType string `form:"hook_type" binding:"Required"`
|
||||
Domain string `form:"domain" binding:"Required`
|
||||
Token string `form:"token" binding:"Required"`
|
||||
Channel string `form:"channel" binding:"Required"`
|
||||
PushOnly bool `form:"push_only"`
|
||||
Active bool `form:"active"`
|
||||
}
|
||||
|
||||
func (f *NewSlackHookForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
// .___
|
||||
// | | ______ ________ __ ____
|
||||
// | |/ ___// ___/ | \_/ __ \
|
||||
// | |\___ \ \___ \| | /\ ___/
|
||||
// |___/____ >____ >____/ \___ >
|
||||
// \/ \/ \/
|
||||
|
||||
type CreateIssueForm struct {
|
||||
IssueName string `form:"title" binding:"Required;MaxSize(50)"`
|
||||
MilestoneId int64 `form:"milestoneid"`
|
||||
AssigneeId int64 `form:"assigneeid"`
|
||||
Labels string `form:"labels"`
|
||||
Content string `form:"content"`
|
||||
}
|
||||
|
||||
func (f *CreateIssueForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
// _____ .__.__ __
|
||||
// / \ |__| | ____ _______/ |_ ____ ____ ____
|
||||
// / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
|
||||
// / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
|
||||
// \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
|
||||
// \/ \/ \/ \/ \/
|
||||
|
||||
type CreateMilestoneForm struct {
|
||||
Title string `form:"title" binding:"Required;MaxSize(50)"`
|
||||
Content string `form:"content"`
|
||||
Deadline string `form:"due_date"`
|
||||
}
|
||||
|
||||
func (f *CreateMilestoneForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
// .____ ___. .__
|
||||
// | | _____ \_ |__ ____ | |
|
||||
// | | \__ \ | __ \_/ __ \| |
|
||||
// | |___ / __ \| \_\ \ ___/| |__
|
||||
// |_______ (____ /___ /\___ >____/
|
||||
// \/ \/ \/ \/
|
||||
|
||||
type CreateLabelForm struct {
|
||||
Title string `form:"title" binding:"Required;MaxSize(50)"`
|
||||
Color string `form:"color" binding:"Required;Size(7)"`
|
||||
}
|
||||
|
||||
func (f *CreateLabelForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
// __________ .__
|
||||
// \______ \ ____ | | ____ _____ ______ ____
|
||||
// | _// __ \| | _/ __ \\__ \ / ___// __ \
|
||||
// | | \ ___/| |_\ ___/ / __ \_\___ \\ ___/
|
||||
// |____|_ /\___ >____/\___ >____ /____ >\___ >
|
||||
// \/ \/ \/ \/ \/ \/
|
||||
|
||||
type NewReleaseForm struct {
|
||||
TagName string `form:"tag_name" binding:"Required"`
|
||||
Target string `form:"tag_target" binding:"Required"`
|
||||
Title string `form:"title" binding:"Required"`
|
||||
Content string `form:"content" binding:"Required"`
|
||||
Draft string `form:"draft"`
|
||||
Prerelease bool `form:"prerelease"`
|
||||
}
|
||||
|
||||
func (f *NewReleaseForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
type EditReleaseForm struct {
|
||||
Target string `form:"tag_target" binding:"Required"`
|
||||
Title string `form:"title" binding:"Required"`
|
||||
Content string `form:"content" binding:"Required"`
|
||||
Draft string `form:"draft"`
|
||||
Prerelease bool `form:"prerelease"`
|
||||
}
|
||||
|
||||
func (f *EditReleaseForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/go-martini/martini"
|
||||
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
type AddSSHKeyForm struct {
|
||||
KeyName string `form:"keyname" binding:"Required"`
|
||||
KeyContent string `form:"key_content" binding:"Required"`
|
||||
}
|
||||
|
||||
func (f *AddSSHKeyForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"KeyName": "SSH key name",
|
||||
"KeyContent": "SSH key content",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *AddSSHKeyForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
AssignForm(f, data)
|
||||
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
if req.Method == "POST" &&
|
||||
(len(f.KeyContent) < 100 || !strings.HasPrefix(f.KeyContent, "ssh-rsa")) {
|
||||
data["HasError"] = true
|
||||
data["ErrorMsg"] = "SSH key content is not valid"
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
data["HasError"] = true
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("AddSSHKeyForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"reflect"
|
||||
|
||||
"github.com/go-martini/martini"
|
||||
|
||||
"github.com/gogits/session"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
)
|
||||
|
||||
// SignedInId returns the id of signed in user.
|
||||
func SignedInId(session session.SessionStore) int64 {
|
||||
if !models.HasEngine {
|
||||
return 0
|
||||
}
|
||||
|
||||
userId := session.Get("userId")
|
||||
if userId == nil {
|
||||
return 0
|
||||
}
|
||||
if s, ok := userId.(int64); ok {
|
||||
if _, err := models.GetUserById(s); err != nil {
|
||||
return 0
|
||||
}
|
||||
return s
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// SignedInName returns the name of signed in user.
|
||||
func SignedInName(session session.SessionStore) string {
|
||||
userName := session.Get("userName")
|
||||
if userName == nil {
|
||||
return ""
|
||||
}
|
||||
if s, ok := userName.(string); ok {
|
||||
return s
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SignedInUser returns the user object of signed user.
|
||||
func SignedInUser(session session.SessionStore) *models.User {
|
||||
id := SignedInId(session)
|
||||
if id <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
user, err := models.GetUserById(id)
|
||||
if err != nil {
|
||||
log.Error("user.SignedInUser: %v", err)
|
||||
return nil
|
||||
}
|
||||
return user
|
||||
}
|
||||
|
||||
// IsSignedIn check if any user has signed in.
|
||||
func IsSignedIn(session session.SessionStore) bool {
|
||||
return SignedInId(session) > 0
|
||||
}
|
||||
|
||||
type FeedsForm struct {
|
||||
UserId int64 `form:"userid" binding:"Required"`
|
||||
Page int64 `form:"p"`
|
||||
}
|
||||
|
||||
type UpdateProfileForm struct {
|
||||
UserName string `form:"username" binding:"Required;AlphaDash;MaxSize(30)"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
Website string `form:"website" binding:"MaxSize(50)"`
|
||||
Location string `form:"location" binding:"MaxSize(50)"`
|
||||
Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
|
||||
}
|
||||
|
||||
func (f *UpdateProfileForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"UserName": "Username",
|
||||
"Email": "E-mail address",
|
||||
"Website": "Website",
|
||||
"Location": "Location",
|
||||
"Avatar": "Gravatar Email",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *UpdateProfileForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("UpdateProfileForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
|
||||
type UpdatePasswdForm struct {
|
||||
OldPasswd string `form:"oldpasswd" binding:"Required;MinSize(6);MaxSize(30)"`
|
||||
NewPasswd string `form:"newpasswd" binding:"Required;MinSize(6);MaxSize(30)"`
|
||||
RetypePasswd string `form:"retypepasswd"`
|
||||
}
|
||||
|
||||
func (f *UpdatePasswdForm) Name(field string) string {
|
||||
names := map[string]string{
|
||||
"OldPasswd": "Old password",
|
||||
"NewPasswd": "New password",
|
||||
"RetypePasswd": "Re-type password",
|
||||
}
|
||||
return names[field]
|
||||
}
|
||||
|
||||
func (f *UpdatePasswdForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
|
||||
if req.Method == "GET" || errors.Count() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
|
||||
data["HasError"] = true
|
||||
|
||||
if len(errors.Overall) > 0 {
|
||||
for _, err := range errors.Overall {
|
||||
log.Error("UpdatePasswdForm.Validate: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
validate(errors, data, f)
|
||||
}
|
||||
99
modules/auth/user_form.go
Normal file
99
modules/auth/user_form.go
Normal file
@@ -0,0 +1,99 @@
|
||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"github.com/Unknwon/macaron"
|
||||
"github.com/macaron-contrib/i18n"
|
||||
|
||||
"github.com/gogits/gogs/modules/middleware/binding"
|
||||
)
|
||||
|
||||
type InstallForm struct {
|
||||
Database string `form:"database" binding:"Required"`
|
||||
DbHost string `form:"host"`
|
||||
DbUser string `form:"user"`
|
||||
DbPasswd string `form:"passwd"`
|
||||
DatabaseName string `form:"database_name"`
|
||||
SslMode string `form:"ssl_mode"`
|
||||
DatabasePath string `form:"database_path"`
|
||||
RepoRootPath string `form:"repo_path" binding:"Required"`
|
||||
RunUser string `form:"run_user" binding:"Required"`
|
||||
Domain string `form:"domain" binding:"Required"`
|
||||
AppUrl string `form:"app_url" binding:"Required"`
|
||||
SmtpHost string `form:"smtp_host"`
|
||||
SmtpEmail string `form:"mailer_user"`
|
||||
SmtpPasswd string `form:"mailer_pwd"`
|
||||
RegisterConfirm string `form:"register_confirm"`
|
||||
MailNotify string `form:"mail_notify"`
|
||||
AdminName string `form:"admin_name" binding:"Required;AlphaDashDot;MaxSize(30)"`
|
||||
AdminPasswd string `form:"admin_pwd" binding:"Required;MinSize(6);MaxSize(255)"`
|
||||
ConfirmPasswd string `form:"confirm_passwd" binding:"Required;MinSize(6);MaxSize(255)"`
|
||||
AdminEmail string `form:"admin_email" binding:"Required;Email;MaxSize(50)"`
|
||||
}
|
||||
|
||||
func (f *InstallForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
// _____ ____ _________________ ___
|
||||
// / _ \ | | \__ ___/ | \
|
||||
// / /_\ \| | / | | / ~ \
|
||||
// / | \ | / | | \ Y /
|
||||
// \____|__ /______/ |____| \___|_ /
|
||||
// \/ \/
|
||||
|
||||
type RegisterForm struct {
|
||||
UserName string `form:"uname" binding:"Required;AlphaDashDot;MaxSize(35)"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
Password string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
|
||||
Retype string `form:"retype"`
|
||||
LoginType string `form:"logintype"`
|
||||
LoginName string `form:"loginname"`
|
||||
}
|
||||
|
||||
func (f *RegisterForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
type SignInForm struct {
|
||||
UserName string `form:"uname" binding:"Required;MaxSize(35)"`
|
||||
Password string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
|
||||
Remember bool `form:"remember"`
|
||||
}
|
||||
|
||||
func (f *SignInForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
// __________________________________________.___ _______ ________ _________
|
||||
// / _____/\_ _____/\__ ___/\__ ___/| |\ \ / _____/ / _____/
|
||||
// \_____ \ | __)_ | | | | | |/ | \/ \ ___ \_____ \
|
||||
// / \ | \ | | | | | / | \ \_\ \/ \
|
||||
// /_______ //_______ / |____| |____| |___\____|__ /\______ /_______ /
|
||||
// \/ \/ \/ \/ \/
|
||||
|
||||
type UpdateProfileForm struct {
|
||||
UserName string `form:"uname" binding:"Required;MaxSize(35)"`
|
||||
FullName string `form:"fullname" binding:"MaxSize(100)"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(50)"`
|
||||
Website string `form:"website" binding:"Url;MaxSize(100)"`
|
||||
Location string `form:"location" binding:"MaxSize(50)"`
|
||||
Avatar string `form:"avatar" binding:"Required;Email;MaxSize(50)"`
|
||||
}
|
||||
|
||||
func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
|
||||
type ChangePasswordForm struct {
|
||||
OldPassword string `form:"old_password" binding:"Required;MinSize(6);MaxSize(255)"`
|
||||
Password string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
|
||||
Retype string `form:"retype"`
|
||||
}
|
||||
|
||||
func (f *ChangePasswordForm) Validate(ctx *macaron.Context, errs *binding.Errors, l i18n.Locale) {
|
||||
validate(errs, ctx.Data, f, l)
|
||||
}
|
||||
@@ -5,54 +5,12 @@
|
||||
package base
|
||||
|
||||
type (
|
||||
// Type TmplData represents data in the templates.
|
||||
TmplData map[string]interface{}
|
||||
)
|
||||
TplName string
|
||||
|
||||
// __________.__ .___.__
|
||||
// \______ \__| ____ __| _/|__| ____ ____
|
||||
// | | _/ |/ \ / __ | | |/ \ / ___\
|
||||
// | | \ | | \/ /_/ | | | | \/ /_/ >
|
||||
// |______ /__|___| /\____ | |__|___| /\___ /
|
||||
// \/ \/ \/ \//_____/
|
||||
|
||||
// Errors represents the contract of the response body when the
|
||||
// binding step fails before getting to the application.
|
||||
type BindingErrors struct {
|
||||
Overall map[string]string `json:"overall"`
|
||||
Fields map[string]string `json:"fields"`
|
||||
}
|
||||
|
||||
// Total errors is the sum of errors with the request overall
|
||||
// and errors on individual fields.
|
||||
func (err BindingErrors) Count() int {
|
||||
return len(err.Overall) + len(err.Fields)
|
||||
}
|
||||
|
||||
func (this *BindingErrors) Combine(other BindingErrors) {
|
||||
for key, val := range other.Fields {
|
||||
if _, exists := this.Fields[key]; !exists {
|
||||
this.Fields[key] = val
|
||||
}
|
||||
ApiJsonErr struct {
|
||||
Message string `json:"message"`
|
||||
DocUrl string `json:"documentation_url"`
|
||||
}
|
||||
for key, val := range other.Overall {
|
||||
if _, exists := this.Overall[key]; !exists {
|
||||
this.Overall[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
BindingRequireError string = "Required"
|
||||
BindingAlphaDashError string = "AlphaDash"
|
||||
BindingMinSizeError string = "MinSize"
|
||||
BindingMaxSizeError string = "MaxSize"
|
||||
BindingEmailError string = "Email"
|
||||
BindingUrlError string = "Url"
|
||||
BindingDeserializationError string = "DeserializationError"
|
||||
BindingIntegerTypeError string = "IntegerTypeError"
|
||||
BindingBooleanTypeError string = "BooleanTypeError"
|
||||
BindingFloatTypeError string = "FloatTypeError"
|
||||
)
|
||||
|
||||
var GoGetMetas = make(map[string]bool)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// +build memcache
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
_ "github.com/gogits/cache/memcache"
|
||||
)
|
||||
|
||||
func init() {
|
||||
EnableMemcache = true
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user