mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-18 08:00:44 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c986b04667 | ||
|
|
754e016f20 | ||
|
|
f67ce75492 | ||
|
|
e236ca5607 | ||
|
|
10e74c4fe4 | ||
|
|
473c0a5ff2 | ||
|
|
7fbe6e4091 | ||
|
|
65dbb53a07 | ||
|
|
c21910c203 | ||
|
|
1728511bad | ||
|
|
e63f6672f8 | ||
|
|
7fa9754ce7 | ||
|
|
475e4ca629 | ||
|
|
32dee74edf | ||
|
|
6715559925 | ||
|
|
2f380c9f2f | ||
|
|
0aebb0d2db | ||
|
|
b7cf9aab2b | ||
|
|
ea2f1875bc | ||
|
|
83524940ed | ||
|
|
8c33eb8409 | ||
|
|
644655af86 | ||
|
|
8082f4d2ca | ||
|
|
3c896bc5f8 | ||
|
|
5c7ce6d8d4 | ||
|
|
222702f66b | ||
|
|
b3b3feb1b9 | ||
|
|
133140040b | ||
|
|
d70f903432 | ||
|
|
f77f305316 | ||
|
|
13b5908442 | ||
|
|
d1335db986 | ||
|
|
1e8836ad95 | ||
|
|
d155217ce3 | ||
|
|
9ddb996a44 | ||
|
|
226eccf5f1 | ||
|
|
4b2d6f0ef2 | ||
|
|
f1c9ad45a7 | ||
|
|
93489c85fa | ||
|
|
8cead06d7b | ||
|
|
625cd9f32f | ||
|
|
9aab3b42af | ||
|
|
6684cd57d7 | ||
|
|
00d95d6e19 | ||
|
|
36f03e5daf | ||
|
|
7c395a6bf8 | ||
|
|
e9a7cac5fd | ||
|
|
9f00b431d4 | ||
|
|
1705d44378 | ||
|
|
537e2c730c | ||
|
|
b4dc6b1ab0 | ||
|
|
1f22285cf4 | ||
|
|
1d546236e4 | ||
|
|
982e0bbd3e | ||
|
|
5a67a62733 | ||
|
|
961ebd30a1 | ||
|
|
9819546694 | ||
|
|
5c8d391a73 | ||
|
|
0e84b9a2a7 | ||
|
|
1f58da501e | ||
|
|
0041184a3e | ||
|
|
112468949d | ||
|
|
7e03e94460 | ||
|
|
fd9b299b14 | ||
|
|
37932d7fb2 | ||
|
|
f0f2087f54 | ||
|
|
f3de09e5d7 | ||
|
|
1a8c1613a4 | ||
|
|
5209275f28 | ||
|
|
924e59d948 | ||
|
|
87a39cab3a | ||
|
|
f9a70757a1 | ||
|
|
741acee393 | ||
|
|
c964a02088 | ||
|
|
ba71613ae6 | ||
|
|
5493b41381 | ||
|
|
c3f45d4787 | ||
|
|
a8a92da483 | ||
|
|
a77e61a861 | ||
|
|
e589728987 | ||
|
|
cc3cdef5f3 | ||
|
|
7101af0594 | ||
|
|
df6cda7143 | ||
|
|
62beb534d2 | ||
|
|
9a70bf1c2d | ||
|
|
6f4559c7cd | ||
|
|
8b2bcdc814 | ||
|
|
0f6ddf26fd | ||
|
|
ebe472a9db | ||
|
|
c1a87baad7 | ||
|
|
c7f185a184 | ||
|
|
4ca2ba5482 | ||
|
|
727b74895d | ||
|
|
6c3f56516f | ||
|
|
4833cf2d3c | ||
|
|
b5ca015632 | ||
|
|
1c82034111 | ||
|
|
e45d723f3d | ||
|
|
627e6852db | ||
|
|
1725767789 | ||
|
|
3e1f2b4934 | ||
|
|
140d20a21d | ||
|
|
6e933fc83c | ||
|
|
79ff565995 | ||
|
|
39691698c9 | ||
|
|
4bedddb557 | ||
|
|
f9547752f5 | ||
|
|
96b37cb024 | ||
|
|
30d874bc91 | ||
|
|
32bc8d922b | ||
|
|
a95d9aa27a | ||
|
|
7f4f5a0a47 | ||
|
|
65a7193bc6 | ||
|
|
64f79b4fdd | ||
|
|
31d2af554e | ||
|
|
e0f2910710 | ||
|
|
f89ab607b4 | ||
|
|
61fa07b8f2 | ||
|
|
9653df185a | ||
|
|
8f7d3df76d | ||
|
|
2aa89699c1 | ||
|
|
46b8d3bd80 | ||
|
|
8a7be481b0 | ||
|
|
21bd94d3a3 | ||
|
|
d337190b59 | ||
|
|
7073e83d94 | ||
|
|
537ff49c0b | ||
|
|
4b1f643c70 | ||
|
|
b8b873836d | ||
|
|
021334c2c8 | ||
|
|
635d86a1a5 | ||
|
|
607eae3ca8 | ||
|
|
66428c0a8e | ||
|
|
c0404a4ec5 | ||
|
|
77ef3b7096 | ||
|
|
498052f4c9 | ||
|
|
958c55eab8 | ||
|
|
d3cddd175a | ||
|
|
6cd130677e | ||
|
|
33b90e3979 | ||
|
|
e1e2b97e88 | ||
|
|
8e4e1dc749 | ||
|
|
1eb5830238 | ||
|
|
5db2ccbb22 | ||
|
|
47e04a14ad | ||
|
|
a13c58eb18 | ||
|
|
15d77ceb46 | ||
|
|
af8fa6763f | ||
|
|
ed66d22bdb | ||
|
|
5209db3abc | ||
|
|
35ea1a1d6c | ||
|
|
b0a053b397 | ||
|
|
a8b3390ce9 | ||
|
|
4266e39d84 | ||
|
|
5620b6e736 | ||
|
|
289e4190ff | ||
|
|
9250412296 | ||
|
|
9c5370508e | ||
|
|
a145bfdc5b | ||
|
|
db2b38eedb | ||
|
|
9303ee399f | ||
|
|
d64cb3dc58 | ||
|
|
62871acfbb | ||
|
|
7401906b03 | ||
|
|
5aa3c29684 | ||
|
|
91745f592f | ||
|
|
564333ea03 | ||
|
|
7b543ea5fe | ||
|
|
fc5e583481 | ||
|
|
1767b1a9c1 | ||
|
|
930c340e37 | ||
|
|
58531d3995 | ||
|
|
4b7c1390fb | ||
|
|
2337d6f13a | ||
|
|
cb8ecd55ed | ||
|
|
33ad31dba2 | ||
|
|
294c3f128b | ||
|
|
0899f4e9db | ||
|
|
788f4d8307 | ||
|
|
2451d6bed2 | ||
|
|
c547de875a | ||
|
|
ffead783aa | ||
|
|
d742c7d333 | ||
|
|
1025cd3535 | ||
|
|
de402ea724 | ||
|
|
3af07a42d6 | ||
|
|
e5b7e99cce | ||
|
|
365936bf57 | ||
|
|
2b7562f546 | ||
|
|
e7f4e312b9 | ||
|
|
98d3870477 | ||
|
|
b1ceb2e53d | ||
|
|
075d2468ea | ||
|
|
8b9e7aef4a | ||
|
|
15e499c1e9 | ||
|
|
55ccb9fe61 | ||
|
|
a5816f1dc9 | ||
|
|
95a613f59f | ||
|
|
6777941dee | ||
|
|
e55128b7fa | ||
|
|
9ac11002f8 | ||
|
|
1cc7bfb4a9 | ||
|
|
e59534e54f | ||
|
|
8c2368c1d2 | ||
|
|
8e8f181cae | ||
|
|
2fcab77565 | ||
|
|
d29f0c6c31 | ||
|
|
79f1b1458b | ||
|
|
b279ee6b82 | ||
|
|
c64a58d814 | ||
|
|
57c60ab3f8 | ||
|
|
e37d90d6e1 | ||
|
|
22055ed99a | ||
|
|
e263331b94 | ||
|
|
eb3d613e3d | ||
|
|
cc23444776 | ||
|
|
1931d3f262 | ||
|
|
79cbbbdf0a | ||
|
|
38cd785aa3 | ||
|
|
dabec3f87a | ||
|
|
6c94cb2bdf | ||
|
|
f67bdf0c22 | ||
|
|
6c51b31270 | ||
|
|
ef6e342737 | ||
|
|
ac0ef98dde | ||
|
|
523775e56b | ||
|
|
b6e741a150 | ||
|
|
54357fbe2b | ||
|
|
040dda5bec | ||
|
|
77b4d58fb8 | ||
|
|
0c9e551492 | ||
|
|
2ba1e2e22e | ||
|
|
d8a08a6c0c | ||
|
|
2c92226f88 | ||
|
|
cd9cb9b9c9 | ||
|
|
b2777055bc | ||
|
|
c8673b60bb | ||
|
|
21975dff2d | ||
|
|
6ab14185e0 | ||
|
|
1f70646952 | ||
|
|
c90ed9e873 | ||
|
|
e4ee07d36b | ||
|
|
8fb3e78554 | ||
|
|
01ab004876 | ||
|
|
6205eac51c | ||
|
|
d9a5418029 | ||
|
|
74a8e61f3e | ||
|
|
e18472f1a3 | ||
|
|
e3dea80cb7 | ||
|
|
50947f4ddc | ||
|
|
d302bc07b3 | ||
|
|
c6df20e565 | ||
|
|
6f9a1321d1 | ||
|
|
eb4eb31578 | ||
|
|
f8f5fcfca2 | ||
|
|
4e7b654090 | ||
|
|
e8059d3676 | ||
|
|
ffadc6721b | ||
|
|
e2e774d215 | ||
|
|
f23d3678fb | ||
|
|
dfade50bd8 | ||
|
|
d25b5f4f2a | ||
|
|
9a17bc74b0 | ||
|
|
015605526d | ||
|
|
099896dc96 | ||
|
|
aa1bc6fa8e | ||
|
|
f27a429fc5 | ||
|
|
f4587d0ae5 | ||
|
|
41bae1e636 | ||
|
|
5295fd08d4 | ||
|
|
36fdf05d2b | ||
|
|
5794dbc0a6 | ||
|
|
c10474db69 | ||
|
|
d68309fd44 | ||
|
|
1c634756a0 | ||
|
|
ae536550c3 | ||
|
|
63d5d70314 | ||
|
|
0be73600e5 | ||
|
|
c9cc064f51 | ||
|
|
dc47eb5ae4 | ||
|
|
955d9db699 | ||
|
|
3c1549e288 | ||
|
|
9fd030b6c3 | ||
|
|
63a10691b3 | ||
|
|
5674673c5d | ||
|
|
74f29e3dc3 | ||
|
|
1dac8593ae | ||
|
|
71fd123be1 | ||
|
|
d4d66cad2e | ||
|
|
c78a6ec047 | ||
|
|
1ae3198b10 | ||
|
|
a6c172b1ab | ||
|
|
9e9d68f841 | ||
|
|
123e6b90a3 | ||
|
|
00b4a6caf5 | ||
|
|
8642e20d19 | ||
|
|
2b81f7ef7a | ||
|
|
c08e83e5d4 | ||
|
|
863ee5c172 | ||
|
|
a91f372fbd | ||
|
|
825acd5b46 | ||
|
|
70e64e648f | ||
|
|
7855e89ca9 | ||
|
|
75273abda7 | ||
|
|
02b278ecff | ||
|
|
e43d7b7a59 | ||
|
|
61f321a04d | ||
|
|
7885b00213 | ||
|
|
2ad882b7c2 | ||
|
|
2546809013 | ||
|
|
4fcf3e11cd | ||
|
|
1f6cd6f4e9 | ||
|
|
5c1ce232db | ||
|
|
172e9e212b | ||
|
|
279a16c256 | ||
|
|
e772cdff3c | ||
|
|
8881827f9d | ||
|
|
d9579901fe | ||
|
|
682d78698f | ||
|
|
2cc8567c2f | ||
|
|
184a214bff | ||
|
|
c6376541ed | ||
|
|
6aca579854 | ||
|
|
15bc6cf884 | ||
|
|
895dde74dd | ||
|
|
c477d20a05 | ||
|
|
2fdb1700e5 | ||
|
|
11764e1ba5 | ||
|
|
3212e23f43 | ||
|
|
84a58f2bb1 | ||
|
|
191396c78a | ||
|
|
956a64c692 | ||
|
|
6f9a8d5afe | ||
|
|
9424d061fa | ||
|
|
3db8e47679 | ||
|
|
5602741550 | ||
|
|
1ef3f540c2 | ||
|
|
51846895d5 | ||
|
|
551542c99c | ||
|
|
ab13ddec48 | ||
|
|
2d1792c6de | ||
|
|
3aedb7e82d | ||
|
|
a9c9f0272a | ||
|
|
8606427e8c | ||
|
|
3d3d22dc06 | ||
|
|
23a3a5cf74 | ||
|
|
0f5410d225 | ||
|
|
1b7be836ef | ||
|
|
66e7223db9 | ||
|
|
d801b811d4 | ||
|
|
307029272e | ||
|
|
9aa3caab16 | ||
|
|
b47a4525dc | ||
|
|
38ab0d9ca0 | ||
|
|
38985671c6 | ||
|
|
d1c2a69820 | ||
|
|
3a1b9fedd1 | ||
|
|
8119ba75fc | ||
|
|
be4c22012e | ||
|
|
60fef48cf0 | ||
|
|
bb72ea0fc0 | ||
|
|
af48fed3c2 | ||
|
|
ce3fa94708 | ||
|
|
7f9f4ae740 | ||
|
|
8bec6f2b28 | ||
|
|
b397363c9d | ||
|
|
acb800b505 | ||
|
|
ec37af2f18 | ||
|
|
d2b030e698 | ||
|
|
c6f496f2a5 | ||
|
|
722e1929f1 | ||
|
|
f9a20ec443 | ||
|
|
f5568d4874 | ||
|
|
87bbe4ee12 | ||
|
|
a034b03c1d | ||
|
|
470f4e4db7 | ||
|
|
9428efd8c0 | ||
|
|
bf4d91b68b | ||
|
|
781155b029 | ||
|
|
3caf0ac529 | ||
|
|
7d25228e55 | ||
|
|
4fb099912e | ||
|
|
b3350b54b3 | ||
|
|
cd4e0374d0 | ||
|
|
5d2084fda4 | ||
|
|
8c32fa3e6c | ||
|
|
fef13211a0 | ||
|
|
5ff5b0a5ad | ||
|
|
8ac9d022b6 | ||
|
|
2c02dc07e9 | ||
|
|
ba999c516a | ||
|
|
28303ffa82 | ||
|
|
1f9a3aa51a | ||
|
|
656dda234c | ||
|
|
63b62f4074 | ||
|
|
158180a052 | ||
|
|
dbe479e920 | ||
|
|
7aefa34871 | ||
|
|
7d92436b92 | ||
|
|
66a070c239 | ||
|
|
bb9d9042f0 | ||
|
|
a5d86d4c00 | ||
|
|
e867deb547 | ||
|
|
af15659d99 | ||
|
|
f63658db9e | ||
|
|
d4edf2f874 | ||
|
|
94f7d78cc9 | ||
|
|
5cede39e5c | ||
|
|
508ac2ae84 | ||
|
|
997b820a42 | ||
|
|
5de83985e3 | ||
|
|
c0220dbed0 | ||
|
|
2e9305b9b1 | ||
|
|
b18bdea1c9 | ||
|
|
25fb431163 | ||
|
|
ac43f00273 | ||
|
|
8ccf1fcbf3 | ||
|
|
b2803f574b | ||
|
|
bbc14bb723 | ||
|
|
e89311d5d4 | ||
|
|
b5e56c6b65 | ||
|
|
3d2023858c | ||
|
|
74b48a18be | ||
|
|
42f61f60fb | ||
|
|
e32a11910e | ||
|
|
dc9fdf897b | ||
|
|
35c946a064 | ||
|
|
747a0c45ee | ||
|
|
8e03b24b0c | ||
|
|
18c65c3096 | ||
|
|
3b306f990a | ||
|
|
92fa6552b1 | ||
|
|
a39dc33770 | ||
|
|
0a42d4942c | ||
|
|
8086d5cecb | ||
|
|
a6875614f6 | ||
|
|
6b061fa327 | ||
|
|
b416e6b6f1 | ||
|
|
ac1f49f8dd | ||
|
|
6ddee2649d | ||
|
|
fd14f53cb9 | ||
|
|
029e2210f5 | ||
|
|
69769e6203 | ||
|
|
2a21f194d3 | ||
|
|
e46d8c5812 | ||
|
|
938605a169 | ||
|
|
c3cc26a136 | ||
|
|
dda83b6307 | ||
|
|
48e2e01a57 | ||
|
|
d6b00967ca | ||
|
|
6d4c1f8e79 | ||
|
|
e88fe0ac2f | ||
|
|
496c0b50b4 | ||
|
|
9d73d74c63 | ||
|
|
7e4e12107a | ||
|
|
5b15de91e6 | ||
|
|
98b3dc9d7d | ||
|
|
c05e610b13 | ||
|
|
63f9368e26 | ||
|
|
3f47a6e701 | ||
|
|
d7c9b3b192 | ||
|
|
063ed23acb | ||
|
|
7c33dd9026 | ||
|
|
a853d8c869 | ||
|
|
4ddeb81972 | ||
|
|
4dd9f00637 | ||
|
|
49f3779fd2 | ||
|
|
7389aad122 | ||
|
|
bf095c677c | ||
|
|
fb929687d8 | ||
|
|
bddcf76fc3 | ||
|
|
9370bdb5ac | ||
|
|
ef6d8bb17b | ||
|
|
99c2eb04c9 | ||
|
|
d83b673c90 | ||
|
|
7498f3f66b | ||
|
|
147eda529c | ||
|
|
c1f0da4248 | ||
|
|
8656dada06 | ||
|
|
217d780ed1 | ||
|
|
fe62dc18fa | ||
|
|
d0e95903c9 | ||
|
|
1ec7f519c6 | ||
|
|
450e8b18cf | ||
|
|
bb882286aa | ||
|
|
d9bbde9e50 | ||
|
|
29746d1b32 | ||
|
|
5f211961ae | ||
|
|
91d364b18b | ||
|
|
f1677f5a67 | ||
|
|
fd270263f4 | ||
|
|
81c1e90e54 | ||
|
|
3b737184ea | ||
|
|
4779bffceb | ||
|
|
4209ee4486 | ||
|
|
6ca352bf85 | ||
|
|
a4d77a1cc2 | ||
|
|
b9367abfb9 | ||
|
|
a6062897d5 | ||
|
|
1afe84ed02 | ||
|
|
388458f759 | ||
|
|
512ff23f19 | ||
|
|
45a32ff255 | ||
|
|
e4e2d76f75 | ||
|
|
282e196534 | ||
|
|
e4fbd3cf86 | ||
|
|
402931862f | ||
|
|
a70e2635ab | ||
|
|
8c9ae38017 | ||
|
|
3920076bd9 | ||
|
|
55cbf572e0 | ||
|
|
c4bd4734a5 | ||
|
|
e7810febd6 | ||
|
|
0bc9e85734 | ||
|
|
4d85ae5fa6 | ||
|
|
a7342d6ef2 | ||
|
|
5b0fccd19a | ||
|
|
ebbfed711c | ||
|
|
d631888d09 | ||
|
|
afd62e8539 | ||
|
|
4aca66c417 | ||
|
|
944463e9a8 | ||
|
|
cf4274afdc | ||
|
|
102f7c316d | ||
|
|
ffc81ea85a | ||
|
|
02d22ba63f | ||
|
|
51e98623c9 | ||
|
|
8e94170fed | ||
|
|
42cee513e0 | ||
|
|
2c18382f46 | ||
|
|
3773412139 | ||
|
|
e17bbdd6a7 | ||
|
|
82a0f3a770 | ||
|
|
11e16abe64 | ||
|
|
6db79f4b7b | ||
|
|
977a4be3c1 | ||
|
|
51ae668154 | ||
|
|
c6fe487e46 | ||
|
|
ec4533e7de | ||
|
|
3b73de32ad | ||
|
|
da5668ac27 | ||
|
|
c1039fb7f2 | ||
|
|
c82d6838c5 | ||
|
|
c40c7b57cb | ||
|
|
009237a35a | ||
|
|
f4f6f65b4c | ||
|
|
313a8a3380 | ||
|
|
f686e7cbc4 | ||
|
|
7fa39687b5 | ||
|
|
9d84120181 | ||
|
|
3be0dab8a3 | ||
|
|
3a9275d5fa | ||
|
|
6296aa04c6 | ||
|
|
cfe9e94e16 | ||
|
|
902d329e78 | ||
|
|
62f59eb1c3 | ||
|
|
a7d4c4ebec | ||
|
|
0ca96621d4 | ||
|
|
7ea179c2da | ||
|
|
6982396572 | ||
|
|
36c4fbfeee | ||
|
|
868c6f47a0 | ||
|
|
74695ab276 | ||
|
|
cb74d8d51b | ||
|
|
eaa620b081 | ||
|
|
18ab07ec4f | ||
|
|
e86bc9a8db | ||
|
|
75837c87b4 | ||
|
|
9a73095a8f | ||
|
|
9242bf6482 | ||
|
|
f552a0ac36 | ||
|
|
141e2f61eb | ||
|
|
b6d7b319f2 | ||
|
|
4cdc6c80ec | ||
|
|
cee9d7ffb0 | ||
|
|
3f48bdb216 | ||
|
|
2cef8dcea4 | ||
|
|
c327936db1 | ||
|
|
1b53cd4ca8 | ||
|
|
08f9f6f8e5 | ||
|
|
fb6b2729c6 | ||
|
|
aa55a18ed8 | ||
|
|
6c74c64b29 | ||
|
|
fddbf34684 | ||
|
|
ea878bba73 | ||
|
|
db002ec915 | ||
|
|
606d3c1717 | ||
|
|
b0fbb39cd3 | ||
|
|
2478d26c59 | ||
|
|
e072620f9b | ||
|
|
dd3419bf52 | ||
|
|
f12e70ef5d | ||
|
|
2836207850 | ||
|
|
4253b48bba | ||
|
|
ff36b65af4 | ||
|
|
1ef4803954 | ||
|
|
08ebbee328 | ||
|
|
d8e4144d46 | ||
|
|
0b1819576d | ||
|
|
6ce33754a8 | ||
|
|
21e0808a86 | ||
|
|
3480182473 | ||
|
|
e516158294 | ||
|
|
c8ee0af152 | ||
|
|
3b82d2a1ee | ||
|
|
274fd526b7 | ||
|
|
86b0e01d9d | ||
|
|
c06ba18023 | ||
|
|
f462591e9c | ||
|
|
da23b8e6d9 | ||
|
|
a1799f5b4b | ||
|
|
34496f6a00 | ||
|
|
5d8208a061 | ||
|
|
f94e60c53c | ||
|
|
dd70be51b3 | ||
|
|
12e1a6a855 | ||
|
|
07648367c1 | ||
|
|
5b86ca38e0 | ||
|
|
79d9d9dfc2 | ||
|
|
e667477f4b | ||
|
|
0367149386 | ||
|
|
3d0ce2add4 | ||
|
|
17224b8920 | ||
|
|
05d125c762 | ||
|
|
e1a268b21d | ||
|
|
c486e8a354 | ||
|
|
eba74d91b3 | ||
|
|
613f8c2b57 | ||
|
|
16e2ad64a2 | ||
|
|
3274895dcf | ||
|
|
7367d47d27 | ||
|
|
4ed2a03222 | ||
|
|
586df4627a | ||
|
|
25181b6c27 | ||
|
|
72e6b9b188 | ||
|
|
e2efa20582 | ||
|
|
2cebb1beca | ||
|
|
fb24a699e6 | ||
|
|
1c16a0a69f | ||
|
|
26e480f242 | ||
|
|
fcf864156d | ||
|
|
d773391763 | ||
|
|
b47d63330e | ||
|
|
026ed1eb42 | ||
|
|
fb80724a96 | ||
|
|
a7ab866e95 | ||
|
|
06f636c9aa | ||
|
|
bbc5b8b731 | ||
|
|
cd154b13a9 | ||
|
|
f71a8a1603 | ||
|
|
d2ecae7e97 | ||
|
|
649e7b1912 | ||
|
|
2a97b0a9de | ||
|
|
5ca02a1dcf | ||
|
|
f088cec4d5 | ||
|
|
dde40064d2 | ||
|
|
597000ce52 | ||
|
|
4597cb26a1 | ||
|
|
e16ab09253 | ||
|
|
595be6f470 | ||
|
|
7afe9ac878 | ||
|
|
1f53b64b08 | ||
|
|
49ca336dd6 | ||
|
|
7cabb54c4e | ||
|
|
f55841f41c | ||
|
|
8983cb6186 | ||
|
|
222181baff | ||
|
|
02c002bda6 | ||
|
|
a5fbd01ea5 | ||
|
|
3652e07988 | ||
|
|
6ed000985c | ||
|
|
4a8b524a7c | ||
|
|
39509ad9a8 | ||
|
|
f977a2488d | ||
|
|
e7b1aadb0e | ||
|
|
339b085db7 | ||
|
|
a7c00900d8 | ||
|
|
99023569fc | ||
|
|
e4478da423 | ||
|
|
d0bb9165bf | ||
|
|
72a0e0200e | ||
|
|
5d83f21a26 | ||
|
|
56936aa6cd | ||
|
|
f4a649dc2f | ||
|
|
464ca8d272 | ||
|
|
7897bdabc4 | ||
|
|
3675c2f3f3 | ||
|
|
4eb264bea4 | ||
|
|
129e864975 | ||
|
|
7f05c1ef33 | ||
|
|
97d6d9c69f | ||
|
|
8937acee13 | ||
|
|
7518c5fe95 | ||
|
|
45fbb9f010 | ||
|
|
eff55da020 | ||
|
|
e87bf0b3fc | ||
|
|
3f141346fa | ||
|
|
34b39f6eb8 | ||
|
|
b8fd8ee0d9 | ||
|
|
b8895f215c | ||
|
|
c4b3efeb9d | ||
|
|
8f0c84c2a5 | ||
|
|
90b9c53420 | ||
|
|
46f9f4f561 | ||
|
|
de265a19b2 | ||
|
|
8af6868694 | ||
|
|
b1dde54e38 | ||
|
|
0a6163c89b | ||
|
|
07d0b37692 | ||
|
|
ac9881dd4c | ||
|
|
280c1b4fea | ||
|
|
6b24ee23e6 | ||
|
|
d93f8c5e6e | ||
|
|
384f065040 | ||
|
|
672fedc7e5 | ||
|
|
0433a26a07 | ||
|
|
4ebd4bddee | ||
|
|
030ab743f3 | ||
|
|
d4623a68dd | ||
|
|
a38d1c96d8 | ||
|
|
61ddf89fdd | ||
|
|
5c7d9b4ffe | ||
|
|
563ea985a4 | ||
|
|
657b2ddc8a | ||
|
|
50221c2ace | ||
|
|
b0bf3be707 | ||
|
|
caaf05897a | ||
|
|
0354b11ddb | ||
|
|
bdcf9b075e | ||
|
|
ab77aa2b5b | ||
|
|
1d54dcc95c | ||
|
|
0138d481a6 | ||
|
|
ba6cdc6e10 | ||
|
|
389d9c652f | ||
|
|
4942c6c206 | ||
|
|
40e264e0d4 | ||
|
|
b73b851245 | ||
|
|
49a777e2d8 | ||
|
|
7df43aeb59 | ||
|
|
86047c48e4 | ||
|
|
6000a206a8 | ||
|
|
da75f050e2 | ||
|
|
7ed81996b8 | ||
|
|
2040f8f3b0 | ||
|
|
c216726449 | ||
|
|
a33b17d5da | ||
|
|
58c994a3e2 | ||
|
|
98d01556c2 | ||
|
|
fd21e8de14 | ||
|
|
37ef2059f1 | ||
|
|
41c49ca95f | ||
|
|
1999f102bf | ||
|
|
aa91bb88bc | ||
|
|
7410a41331 | ||
|
|
a987370657 | ||
|
|
1883b05f26 | ||
|
|
c408619042 | ||
|
|
1181b13c83 | ||
|
|
c1aef03f09 | ||
|
|
6609871b1e | ||
|
|
813f1718fb | ||
|
|
49bcc14df7 | ||
|
|
28108a1c02 | ||
|
|
c169dfa395 | ||
|
|
3b26a692b6 | ||
|
|
9a6b51b092 | ||
|
|
c3121fcd38 | ||
|
|
7e8581a7de | ||
|
|
0ba83d1353 | ||
|
|
a302e100ec | ||
|
|
4f58fd492d | ||
|
|
0b06a4fac6 | ||
|
|
4e1a7bf42c | ||
|
|
ef2fb1c62e | ||
|
|
f5fcbcd87a | ||
|
|
986bffaf2b | ||
|
|
766a2a0546 | ||
|
|
291b594ad9 | ||
|
|
7742e3da38 | ||
|
|
c5f70eae4c | ||
|
|
8bdf02c4c0 | ||
|
|
8abe132c25 | ||
|
|
3a447b02a1 | ||
|
|
aa718eef88 | ||
|
|
60b1c9ba32 | ||
|
|
9b50581fd4 | ||
|
|
ee33fdab89 | ||
|
|
c8f19467ba | ||
|
|
1fc0f1c71b | ||
|
|
2258ba108d | ||
|
|
d21f4ffae6 | ||
|
|
4bd9c4c0fc | ||
|
|
29165f0f6f | ||
|
|
f75b786916 | ||
|
|
011914339e | ||
|
|
08a07214ef | ||
|
|
f682f07dbc | ||
|
|
50e99f1f4c | ||
|
|
feabc488fe | ||
|
|
72d3f5071b | ||
|
|
27dc662430 | ||
|
|
80e233c4a6 | ||
|
|
a099308a82 | ||
|
|
6f0673f184 | ||
|
|
b428e699db | ||
|
|
f4334eadc0 | ||
|
|
a2a6503030 | ||
|
|
9c22005b79 | ||
|
|
7448953b7d | ||
|
|
18214095ab | ||
|
|
bcfc78e510 | ||
|
|
cc6b506176 | ||
|
|
c61828fb39 | ||
|
|
23876ed186 | ||
|
|
ac4962cf19 | ||
|
|
d9e7c8d880 | ||
|
|
ea25b800d2 | ||
|
|
7ba06e73d7 | ||
|
|
39cf26628f | ||
|
|
ea7f324a9d | ||
|
|
789d451ea2 | ||
|
|
7313f3d591 | ||
|
|
1662546bef | ||
|
|
53f75086ec | ||
|
|
81fcc61ec9 | ||
|
|
324a47966b | ||
|
|
5a0c50b9a2 | ||
|
|
66465beb39 | ||
|
|
c5d403f10a | ||
|
|
598098c2ed | ||
|
|
bff1a8ad60 | ||
|
|
592e315f21 | ||
|
|
76933bc6ef | ||
|
|
0dc312db64 | ||
|
|
4deb92e715 | ||
|
|
bc95e47b92 | ||
|
|
f2335d313c | ||
|
|
4c287f4a2d | ||
|
|
0a6e1c275b | ||
|
|
ff2dc05e7f | ||
|
|
f62ce085bf | ||
|
|
29306827ba | ||
|
|
222d07175a | ||
|
|
663196c3d9 | ||
|
|
df839714a3 | ||
|
|
dcb004e983 | ||
|
|
cee0604efc | ||
|
|
dfbd364f60 | ||
|
|
339d6732d7 | ||
|
|
b0dbfb4c7c | ||
|
|
021603d25d | ||
|
|
a875e1ec5c | ||
|
|
5c5904216b | ||
|
|
1dae294d76 | ||
|
|
acbb151b15 | ||
|
|
a1311a2a0d | ||
|
|
bc8d564ce8 | ||
|
|
97cdf7bc78 | ||
|
|
ce69b4de01 | ||
|
|
e880df8142 | ||
|
|
a35ca87778 | ||
|
|
5a34e2d380 | ||
|
|
abf3247c50 | ||
|
|
8663ed129d | ||
|
|
c0a0f4c801 | ||
|
|
e84aa49003 | ||
|
|
6f45b90520 | ||
|
|
0685984a80 | ||
|
|
5f33c083bf | ||
|
|
ab0e0f3f43 | ||
|
|
6b62b84157 | ||
|
|
fd9627576b | ||
|
|
39f334f3a2 | ||
|
|
ca84909716 | ||
|
|
283609cf2d | ||
|
|
9591409fe2 | ||
|
|
9cf52ccc97 | ||
|
|
261cb2061b | ||
|
|
f45af6e0cc | ||
|
|
c752ea4959 | ||
|
|
b2b578a5f0 | ||
|
|
47e60bfdcb | ||
|
|
780b6cdec9 | ||
|
|
0a5b13a418 | ||
|
|
ebdc3f05de | ||
|
|
aad79077bf | ||
|
|
00b25b39c5 | ||
|
|
dd6a709053 | ||
|
|
99b04e3635 | ||
|
|
2e06b78409 | ||
|
|
c7d603e142 | ||
|
|
4fcf845934 | ||
|
|
83cefb2a72 | ||
|
|
7ab40996e0 | ||
|
|
bbe4d49947 | ||
|
|
b6fbacc992 | ||
|
|
89491eac56 | ||
|
|
acf27693b2 | ||
|
|
5fd9d20f99 | ||
|
|
fd9c421969 | ||
|
|
f5bae6d75c | ||
|
|
4ac8bc7bd2 | ||
|
|
ec81d0d2c3 | ||
|
|
815b633fb8 | ||
|
|
c69c76f97d | ||
|
|
75197db3e6 | ||
|
|
d09d686378 | ||
|
|
d6f16cf700 | ||
|
|
536a5fc1a0 | ||
|
|
a07df9d7fe | ||
|
|
e9c195c778 | ||
|
|
0637ca308b | ||
|
|
fd1e0e72a0 | ||
|
|
34b80373c7 | ||
|
|
1ade1b8d8b | ||
|
|
19fa30fb96 | ||
|
|
efe7815a7e | ||
|
|
e9b4ff1932 | ||
|
|
0dca3fc997 | ||
|
|
4e6ebb53ac | ||
|
|
83ed835c9e | ||
|
|
7bcc897379 | ||
|
|
cd2109fefe | ||
|
|
d337c4726d | ||
|
|
356e6a4ef6 | ||
|
|
037da3a7fd | ||
|
|
18462296ae | ||
|
|
1d76e54b0d | ||
|
|
22c903f555 | ||
|
|
6d4d53e2c7 | ||
|
|
6b81ae1b7b | ||
|
|
5b62a0f2b3 | ||
|
|
137465683a | ||
|
|
6be7b4a75a | ||
|
|
58ca377418 | ||
|
|
b173e808c7 | ||
|
|
ec44ba9335 | ||
|
|
f54ac59ff7 | ||
|
|
db44204c1a | ||
|
|
ec01aef71a | ||
|
|
b706774b5b | ||
|
|
9eee2d6b6f | ||
|
|
c9d4e2a4b5 | ||
|
|
4c4df5cbb0 | ||
|
|
cb69128838 | ||
|
|
81af207dc5 | ||
|
|
5e9c43fc71 | ||
|
|
fb44e3c1e2 | ||
|
|
7e23ae126a | ||
|
|
7e229c05e7 | ||
|
|
764fc8fec4 | ||
|
|
ad17918c84 | ||
|
|
d7013727b9 | ||
|
|
6a8bd11fc9 | ||
|
|
4df0c3e461 | ||
|
|
f8f47b51e9 | ||
|
|
b735178fcd | ||
|
|
1759c2c81e | ||
|
|
2be7054b40 | ||
|
|
c77d2f7dd6 | ||
|
|
3256ac9f44 | ||
|
|
b156ef9476 | ||
|
|
c49c16cbb5 | ||
|
|
2b7ec9ffe1 | ||
|
|
c2ad006a19 | ||
|
|
c12bab477c | ||
|
|
fe39545cf6 | ||
|
|
39d3b819fb | ||
|
|
04a0e15899 | ||
|
|
3dc81d85e9 | ||
|
|
5a8ddde495 | ||
|
|
4e6f872c02 | ||
|
|
e76836f394 | ||
|
|
9fed5f4bb8 | ||
|
|
b3a55ea44d | ||
|
|
270411f7fd | ||
|
|
3c01198e61 | ||
|
|
483b47ad63 | ||
|
|
b10de66ed3 | ||
|
|
305eff048c | ||
|
|
da7968d364 | ||
|
|
d3e2c8e9d3 | ||
|
|
e3a9f2dfb7 | ||
|
|
3c967f8906 | ||
|
|
39bb7acdba | ||
|
|
a30066989b | ||
|
|
0c30dfa092 | ||
|
|
7a44493d13 | ||
|
|
9b726d5d22 | ||
|
|
78e3d9e5fb | ||
|
|
d74b41a5f2 | ||
|
|
f122afdbec | ||
|
|
37308b5c42 | ||
|
|
9c5a6e3925 | ||
|
|
58b95ef2ba | ||
|
|
f617c9d5dd | ||
|
|
c661cc37b3 | ||
|
|
7c49f6c79b | ||
|
|
12b9356c17 | ||
|
|
d3a34293f7 | ||
|
|
c131061f81 | ||
|
|
6a5e1ebaa5 | ||
|
|
a07d016951 | ||
|
|
9d343a90db | ||
|
|
4c813be09d | ||
|
|
d48166f546 | ||
|
|
0f138c1b7c | ||
|
|
8542323c0b | ||
|
|
00f103c66a | ||
|
|
430c75e7ed | ||
|
|
67ffb5e938 | ||
|
|
9c292bebf0 | ||
|
|
ba4307c1dc | ||
|
|
b8b2041a0c | ||
|
|
c45bb60b50 | ||
|
|
fba46be47a | ||
|
|
be0a460935 | ||
|
|
c0a041d024 | ||
|
|
2ce5ad82ce | ||
|
|
50dcb6c7e4 | ||
|
|
017424bf7b | ||
|
|
c7e7407f7c | ||
|
|
cab42b3c7d | ||
|
|
78f280c88f | ||
|
|
22f5a975c3 | ||
|
|
90ba036e39 | ||
|
|
d1e18e43ee | ||
|
|
a801140a82 | ||
|
|
951ab2502e | ||
|
|
0316cb0662 | ||
|
|
04b9cbd87a | ||
|
|
4565c5b300 | ||
|
|
bf9a9bf17a | ||
|
|
70df4dc6c4 | ||
|
|
ed3e738fff | ||
|
|
bc376ec495 | ||
|
|
40314e9079 | ||
|
|
82f978c683 | ||
|
|
ed288368ea | ||
|
|
db8fa144eb | ||
|
|
57b76d97ec | ||
|
|
28d8210ce6 | ||
|
|
80ce60c56c | ||
|
|
2758ab07dc | ||
|
|
0828804de2 | ||
|
|
134b17d2f0 | ||
|
|
3af254cdda | ||
|
|
f3d3d54722 | ||
|
|
fa419809f6 | ||
|
|
da606826c6 | ||
|
|
b3d9cc156a | ||
|
|
ba03d26b2c | ||
|
|
40f02889fe | ||
|
|
4f8fb26d89 | ||
|
|
0ca11e2b88 | ||
|
|
0daf0d690c | ||
|
|
0cfdf0f335 | ||
|
|
cca1863b63 | ||
|
|
033f08a6d2 | ||
|
|
a83a6690ff | ||
|
|
83df457379 | ||
|
|
657e55cde3 | ||
|
|
90e76e3a0f | ||
|
|
2af1993383 | ||
|
|
6e650d977e | ||
|
|
8a76171dbe | ||
|
|
949b6fe944 | ||
|
|
3f90333090 | ||
|
|
aeaca0c5cd | ||
|
|
fb7f638a54 | ||
|
|
7994193a39 | ||
|
|
3334bf594d | ||
|
|
71193cc912 | ||
|
|
9fde8c447d | ||
|
|
117faa952e | ||
|
|
6427337728 | ||
|
|
81f97f6f88 | ||
|
|
b3b472d711 | ||
|
|
1c22e1cf99 | ||
|
|
3110d91bf6 | ||
|
|
624a11407a | ||
|
|
ead6d1268f | ||
|
|
80c00c5a8c | ||
|
|
da0f6acd01 | ||
|
|
485aa99dea | ||
|
|
5f68d7ce90 | ||
|
|
685fca6c8c | ||
|
|
9c609da332 | ||
|
|
84608b7d42 | ||
|
|
02cf2a80cb | ||
|
|
a74c6dd522 | ||
|
|
5d4ab23d95 | ||
|
|
a8faba3206 | ||
|
|
c603495b12 | ||
|
|
adce6103bd | ||
|
|
6b673017c5 | ||
|
|
e66bd43fc6 | ||
|
|
ff5cdb9a02 | ||
|
|
1aec5e443d | ||
|
|
0b1f7e9322 | ||
|
|
3ec2dec49b | ||
|
|
7cbebc8236 | ||
|
|
700076f278 | ||
|
|
7bf1bf61a7 | ||
|
|
ef2cb1b315 | ||
|
|
75bfc3a114 | ||
|
|
70f63090fe | ||
|
|
ab2cf0d0c3 | ||
|
|
ea1a34f57a | ||
|
|
765add6184 | ||
|
|
e5263d6c05 | ||
|
|
c391177d34 | ||
|
|
7d5f0aa906 | ||
|
|
2694a725d6 | ||
|
|
54ca40bbcd | ||
|
|
b20411f8f1 | ||
|
|
355e656caa | ||
|
|
383bdd5f15 | ||
|
|
96208c786d | ||
|
|
4c7b04cf27 | ||
|
|
a067a97e21 | ||
|
|
4a07603a7c | ||
|
|
7196c5b656 | ||
|
|
b5de2df119 | ||
|
|
2f72eb37ee | ||
|
|
0128cd3138 | ||
|
|
157d3093f8 | ||
|
|
4ca188973e | ||
|
|
f387d89a45 | ||
|
|
54567db22f | ||
|
|
2bee68dd40 | ||
|
|
e2b6ea5253 | ||
|
|
9974c5fa20 | ||
|
|
997b706d8a | ||
|
|
3f26412585 | ||
|
|
ac99d77fbb | ||
|
|
4f6f7632f5 | ||
|
|
f74248f0d7 | ||
|
|
bb8a15ca56 | ||
|
|
52432002c7 | ||
|
|
3fade48f8f | ||
|
|
fc81801c4c | ||
|
|
c23c5b2859 | ||
|
|
ccec57e32d | ||
|
|
56ae5fbf70 | ||
|
|
735b44856e | ||
|
|
1f6ea9f494 | ||
|
|
afa643519f | ||
|
|
1767b84026 | ||
|
|
e855e7692e | ||
|
|
94d37eb68a | ||
|
|
e10b19bcde | ||
|
|
e9192e75ea | ||
|
|
2fa4f68b1e | ||
|
|
08f53a4a37 | ||
|
|
c522295c56 | ||
|
|
7a45548387 | ||
|
|
810ea9c421 | ||
|
|
ba6a4fe6d7 | ||
|
|
4d144f7a8e | ||
|
|
45c41184c1 | ||
|
|
5c29c5e7dd | ||
|
|
4da9a84363 | ||
|
|
22d8fb7867 | ||
|
|
c7058cb3e6 | ||
|
|
e6092b2658 | ||
|
|
ae19b72e61 | ||
|
|
da117582d6 | ||
|
|
c7ca1ccbd7 | ||
|
|
911b5c406d | ||
|
|
71ed4b946a | ||
|
|
4ef9fcde59 | ||
|
|
7889b5ad69 | ||
|
|
be6d3ea337 | ||
|
|
64fd715973 | ||
|
|
315f99a03a | ||
|
|
7e1351c543 | ||
|
|
bd3c829653 | ||
|
|
4f6dde02d2 | ||
|
|
8cc7d1f67f | ||
|
|
2bbba9d755 | ||
|
|
e9e4755348 | ||
|
|
9fbb63df95 | ||
|
|
5b5a649589 | ||
|
|
79556affbd | ||
|
|
9cba19d4db | ||
|
|
4f377c04b8 | ||
|
|
763df5606b | ||
|
|
e1d20e3ec9 | ||
|
|
215c082a04 | ||
|
|
984985e650 | ||
|
|
249b3c3245 | ||
|
|
725786d6aa | ||
|
|
2edddaf487 | ||
|
|
49cbab08c1 | ||
|
|
a75df66151 | ||
|
|
43e9c13c5e | ||
|
|
5ad06f121b | ||
|
|
0eaaf7aacb | ||
|
|
dd44fdd1f2 | ||
|
|
669855de70 | ||
|
|
193ae2b7d6 | ||
|
|
af4b23e0e0 | ||
|
|
c35991315d | ||
|
|
9aa852370c | ||
|
|
8f18497551 | ||
|
|
4c59951e8c | ||
|
|
eb2a80d216 | ||
|
|
41d0175a6d | ||
|
|
2f6aa0f45b | ||
|
|
17c685bc4c |
@@ -6,6 +6,7 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
generic_handler:
|
generic_handler:
|
||||||
name: Add Labels to PR
|
name: Add Labels to PR
|
||||||
|
if: github.repository == '1Panel-dev/1Panel'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
+27
-3
@@ -1,33 +1,43 @@
|
|||||||
name: Create Release And Upload Cloudflare R2
|
name: Build And Publish (OSS + R2)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-release:
|
create-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20.2'
|
node-version: '22.19.0'
|
||||||
|
|
||||||
- name: Build Web
|
- name: Build Web
|
||||||
run: |
|
run: |
|
||||||
cd frontend && npm install && npm run build:pro
|
cd frontend && npm install && npm run build:pro
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max-old-space-size=8192
|
NODE_OPTIONS: --max-old-space-size=8192
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.24'
|
||||||
|
cache-dependency-path: |
|
||||||
|
core/go.sum
|
||||||
|
agent/go.sum
|
||||||
|
|
||||||
- name: Build Release
|
- name: Build Release
|
||||||
uses: goreleaser/goreleaser-action@v6
|
uses: goreleaser/goreleaser-action@v6
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: '~> v2'
|
version: '~> v2'
|
||||||
args: release --skip=publish --clean
|
args: release --skip=publish --clean
|
||||||
|
|
||||||
- name: Upload Assets
|
- name: Upload Assets
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@@ -36,10 +46,24 @@ jobs:
|
|||||||
files: |
|
files: |
|
||||||
dist/*.tar.gz
|
dist/*.tar.gz
|
||||||
dist/checksums.txt
|
dist/checksums.txt
|
||||||
|
|
||||||
|
- name: Setup OSSUTIL
|
||||||
|
uses: yizhoumo/setup-ossutil@v2
|
||||||
|
with:
|
||||||
|
endpoint: ${{ secrets.OSS_ENDPOINT }}
|
||||||
|
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
|
||||||
|
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
||||||
|
ossutil-version: '1.7.18'
|
||||||
|
|
||||||
|
- name: Upload Assets to OSS
|
||||||
|
run: |
|
||||||
|
ossutil cp -r dist/ oss://resource-fit2cloud-com/1panel/package/v2/stable/${{ github.ref_name }}/release/ --include "*.tar.gz" --include "checksums.txt" --only-current-dir --force
|
||||||
|
|
||||||
- name: Setup Rclone
|
- name: Setup Rclone
|
||||||
uses: AnimMouse/setup-rclone@v1
|
uses: AnimMouse/setup-rclone@v1
|
||||||
with:
|
with:
|
||||||
rclone_config: ${{ secrets.RCLONE_CONFIG }}
|
rclone_config: ${{ secrets.RCLONE_CONFIG }}
|
||||||
|
|
||||||
- name: Upload to Cloudflare R2
|
- name: Upload to Cloudflare R2
|
||||||
run: |
|
run: |
|
||||||
rclone copy dist/ cloudflare_r2:package/v2/stable/${{ github.ref_name }}/release/ --include "*.tar.gz" --include "checksums.txt" --progress
|
rclone copy dist/ cloudflare_r2:package/v2/stable/${{ github.ref_name }}/release/ --include "*.tar.gz" --include "checksums.txt" --progress
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
name: Create Release And Upload assets
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
jobs:
|
|
||||||
create-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20.2'
|
|
||||||
- name: Build Web
|
|
||||||
run: |
|
|
||||||
cd frontend && npm install && npm run build:pro
|
|
||||||
env:
|
|
||||||
NODE_OPTIONS: --max-old-space-size=8192
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.23'
|
|
||||||
- name: Build Release
|
|
||||||
uses: goreleaser/goreleaser-action@v6
|
|
||||||
with:
|
|
||||||
distribution: goreleaser
|
|
||||||
version: '~> v2'
|
|
||||||
args: release --skip=publish --clean
|
|
||||||
- name: Upload Assets
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
|
||||||
draft: true
|
|
||||||
files: |
|
|
||||||
dist/*.tar.gz
|
|
||||||
dist/checksums.txt
|
|
||||||
- name: Setup OSSUTIL
|
|
||||||
uses: yizhoumo/setup-ossutil@v2
|
|
||||||
with:
|
|
||||||
endpoint: ${{ secrets.OSS_ENDPOINT }}
|
|
||||||
access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }}
|
|
||||||
access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
|
||||||
ossutil-version: '1.7.18'
|
|
||||||
- name: Upload Assets to OSS
|
|
||||||
run: ossutil cp -r dist/ oss://resource-fit2cloud-com/1panel/package/v2/stable/${{ github.ref_name }}/release/ --include "*.tar.gz" --include "checksums.txt" --only-current-dir --force
|
|
||||||
@@ -8,6 +8,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
sonarcloud:
|
sonarcloud:
|
||||||
name: SonarCloud
|
name: SonarCloud
|
||||||
|
if: github.repository == '1Panel-dev/1Panel'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ name: Synchronize to Gitee
|
|||||||
on: [push]
|
on: [push]
|
||||||
jobs:
|
jobs:
|
||||||
repo-sync:
|
repo-sync:
|
||||||
|
if: github.repository == '1Panel-dev/1Panel'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Mirror the Github organization repos to Gitee.
|
- name: Mirror the Github organization repos to Gitee.
|
||||||
|
|||||||
+12
-1
@@ -44,12 +44,17 @@ frontend/src/xpack
|
|||||||
agent/xpack
|
agent/xpack
|
||||||
agent/router/entry_xpack.go
|
agent/router/entry_xpack.go
|
||||||
agent/server/init_xpack.go
|
agent/server/init_xpack.go
|
||||||
|
agent/utils/xpack/xpack.go
|
||||||
agent/utils/xpack/xpack_xpack.go
|
agent/utils/xpack/xpack_xpack.go
|
||||||
core/xpack
|
core/xpack
|
||||||
core/router/entry_xpack.go
|
core/router/entry_xpack.go
|
||||||
core/server/init_xpack.go
|
core/server/init_xpack.go
|
||||||
|
core/utils/xpack/xpack.go
|
||||||
core/utils/xpack/xpack_xpack.go
|
core/utils/xpack/xpack_xpack.go
|
||||||
xpack
|
core/xpack-ee
|
||||||
|
core/router/entry_xpackee.go
|
||||||
|
core/server/init_xpackee.go
|
||||||
|
core/utils/xpack/xpack_xpackee.go
|
||||||
|
|
||||||
.history/
|
.history/
|
||||||
dist/
|
dist/
|
||||||
@@ -63,3 +68,9 @@ cmd/server/fileList.txt
|
|||||||
|
|
||||||
core/.golangci.yml
|
core/.golangci.yml
|
||||||
agent/.golangci.yml
|
agent/.golangci.yml
|
||||||
|
|
||||||
|
.opencode
|
||||||
|
openspec
|
||||||
|
CLAUDE.md
|
||||||
|
AGENTS.md
|
||||||
|
opencode.json
|
||||||
+5
-8
@@ -32,9 +32,7 @@ builds:
|
|||||||
- arm
|
- arm
|
||||||
- ppc64le
|
- ppc64le
|
||||||
- s390x
|
- s390x
|
||||||
hooks:
|
- riscv64
|
||||||
post:
|
|
||||||
- ./ci/script.sh compress_binary {{ .Path }} {{ .Arch }}
|
|
||||||
|
|
||||||
- id: core
|
- id: core
|
||||||
dir: core
|
dir: core
|
||||||
@@ -57,9 +55,7 @@ builds:
|
|||||||
- arm
|
- arm
|
||||||
- ppc64le
|
- ppc64le
|
||||||
- s390x
|
- s390x
|
||||||
hooks:
|
- riscv64
|
||||||
post:
|
|
||||||
- ./ci/script.sh compress_binary {{ .Path }} {{ .Arch }}
|
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- formats: [ 'tar.gz' ]
|
- formats: [ 'tar.gz' ]
|
||||||
@@ -68,11 +64,12 @@ archives:
|
|||||||
wrap_in_directory: true
|
wrap_in_directory: true
|
||||||
files:
|
files:
|
||||||
- 1pctl
|
- 1pctl
|
||||||
|
- install.sh
|
||||||
- 1panel-core.service
|
- 1panel-core.service
|
||||||
- 1panel-agent.service
|
- 1panel-agent.service
|
||||||
- install.sh
|
- initscript/*
|
||||||
- GeoIP.mmdb
|
|
||||||
- lang/*
|
- lang/*
|
||||||
|
- GeoIP.mmdb
|
||||||
|
|
||||||
checksum:
|
checksum:
|
||||||
name_template: 'checksums.txt'
|
name_template: 'checksums.txt'
|
||||||
|
|||||||
@@ -30,20 +30,20 @@ build_frontend:
|
|||||||
|
|
||||||
build_core_on_linux:
|
build_core_on_linux:
|
||||||
cd $(CORE_PATH) \
|
cd $(CORE_PATH) \
|
||||||
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
|
&& CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
|
||||||
|
|
||||||
build_agent_on_linux:
|
build_agent_on_linux:
|
||||||
cd $(AGENT_PATH) \
|
cd $(AGENT_PATH) \
|
||||||
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
|
&& CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
|
||||||
|
|
||||||
build_core_on_darwin:
|
build_core_on_darwin:
|
||||||
cd $(CORE_PATH) \
|
cd $(CORE_PATH) \
|
||||||
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
|
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
|
||||||
|
|
||||||
build_agent_on_darwin:
|
build_agent_on_darwin:
|
||||||
cd $(AGENT_PATH) \
|
cd $(AGENT_PATH) \
|
||||||
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
|
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
|
||||||
|
|
||||||
build_all: build_frontend build_core_on_linux build_agent_on_linux
|
build_all: build_frontend build_core_on_linux build_agent_on_linux
|
||||||
|
|
||||||
build_on_local: clean_assets build_frontend build_core_on_darwin build_agent_on_darwin upx_bin
|
build_on_local: clean_assets build_frontend build_core_on_darwin build_agent_on_darwin
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<p align="center"><a href="https://1panel.pro"><img src="https://resource.1panel.pro/img/1panel-logo.png" alt="1Panel" width="300" /></a></p>
|
<p align="center"><a href="https://1panel.pro"><img src="https://resource.1panel.pro/img/1panel-logo.png" alt="1Panel" width="300" /></a></p>
|
||||||
<p align="center"><b>Top-Rated Web-based Linux Server Management Tool</b><br>Best VPS control panel<br>新一代的 Linux 服务器运维管理面板</p>
|
<h3 align="center">Take control of your VPS with 1Panel</h3>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://trendshift.io/repositories/2462" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2462" alt="1Panel-dev%2F1Panel | Trendshift" style="width: 240px; height: auto;" /></a>
|
<a href="https://trendshift.io/repositories/2462" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2462" alt="1Panel-dev%2F1Panel | Trendshift" style="width: 240px; height: auto;" /></a>
|
||||||
</p>
|
</p>
|
||||||
@@ -30,27 +30,27 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
------------------------------
|
------------------------------
|
||||||
|
## What is 1Panel?
|
||||||
|
|
||||||
1Panel is an open-source, modern web-based control panel for Linux server management.
|
1Panel is a modern, open-source VPS control panel that streamlines administration through an intuitive, clean web interface.
|
||||||
|
|
||||||
- **Efficient Management**: Through a user-friendly web graphical interface, 1Panel enables users to effortlessly manage their Linux servers. Key features include host monitoring, file management, database administration, container management, LLMs management.
|
## Key Features
|
||||||
- **Rapid Website Deployment**: With deep integration of the popular open-source website building software WordPress, 1Panel streamlines the process of domain binding and SSL certificate configuration, all achievable with just one click.
|
|
||||||
- **Application Store**: 1Panel curates a wide range of high-quality open-source tools and applications, facilitating easy installation and updates for its users.
|
- **One-Click OpenClaw Deployment**: Seamlessly deploy OpenClaw agents, host local LLMs using Ollama, and monitor GPU utilization—all within a unified workspace.
|
||||||
- **Security and Reliability**: By leveraging containerization and secure application deployment practices, 1Panel minimizes vulnerability exposure. It further enhances security through integrated firewall management and log auditing capabilities.
|
- **One-Click Website Deployment**: Launch production-ready websites instantly with automatic domain binding, SSL certificate provisioning, and configuration—zero manual setup required.
|
||||||
- **One-Click Backup & Restore**: Data protection is made simple with 1Panel's one-click backup and restore functionality, supporting various cloud storage solutions to ensure data integrity and availability.
|
- **Curated App Marketplace**: Discover, install, and update trusted open-source applications (Nextcloud, Bitwarden, Umami, and more) with a single click.
|
||||||
|
- **Centralized Server Management**: Monitor system resources and manage files, databases, containers, and services effortlessly through a unified, intuitive dashboard.
|
||||||
|
- **Enterprise-Grade Security**: Strengthen your defenses with container isolation, firewall controls, audit logging, and secure deployment practices—ensuring compliance and peace of mind.
|
||||||
|
- **Intelligent Backup & Restore**: Schedule automated backups or perform instant restores to local storage or major cloud platforms (AWS S3, Cloudflare R2, and more), with flexible retention and destination options.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
Execute the script below and follow the prompts to install 1Panel:
|
Execute the script below and follow the prompts to install 1Panel:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://resource.1panel.pro/quick_start.sh -o quick_start.sh && bash quick_start.sh
|
bash -c "$(curl -sSL https://resource.1panel.pro/v2/quick_start.sh)"
|
||||||
```
|
```
|
||||||
|
|
||||||
Please refer to our [documentation](https://docs.1panel.pro/quick_start/) for more details.
|
|
||||||
|
|
||||||
中国用户请使用这个 [安装脚本](https://1panel.cn/docs/installation/online_installation/),其应用数量比国际版本更丰富。
|
|
||||||
|
|
||||||
## Screenshot
|
## Screenshot
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -0,0 +1,476 @@
|
|||||||
|
package v2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Create Agent
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentCreateReq true "request"
|
||||||
|
// @Success 200 {object} dto.AgentItem
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents [post]
|
||||||
|
func (b *BaseApi) CreateAgent(c *gin.Context) {
|
||||||
|
var req dto.AgentCreateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err := agentService.Create(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Page Agents
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.SearchWithPage true "request"
|
||||||
|
// @Success 200 {object} dto.PageResult
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/search [post]
|
||||||
|
func (b *BaseApi) PageAgents(c *gin.Context) {
|
||||||
|
var req dto.SearchWithPage
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
total, list, err := agentService.Page(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, dto.PageResult{
|
||||||
|
Items: list,
|
||||||
|
Total: total,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Delete Agent
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentDeleteReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/delete [post]
|
||||||
|
func (b *BaseApi) DeleteAgent(c *gin.Context) {
|
||||||
|
var req dto.AgentDeleteReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.Delete(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Reset Agent token
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentTokenResetReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/token/reset [post]
|
||||||
|
func (b *BaseApi) ResetAgentToken(c *gin.Context) {
|
||||||
|
var req dto.AgentTokenResetReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.ResetToken(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Update Agent model config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentModelConfigUpdateReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/model/update [post]
|
||||||
|
func (b *BaseApi) UpdateAgentModelConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentModelConfigUpdateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.UpdateModelConfig(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Get Providers
|
||||||
|
// @Success 200 {array} dto.ProviderInfo
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/providers [get]
|
||||||
|
func (b *BaseApi) GetAgentProviders(c *gin.Context) {
|
||||||
|
list, err := agentService.GetProviders()
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, list)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Create Agent account
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentAccountCreateReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/accounts [post]
|
||||||
|
func (b *BaseApi) CreateAgentAccount(c *gin.Context) {
|
||||||
|
var req dto.AgentAccountCreateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.CreateAccount(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Update Agent account
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentAccountUpdateReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/accounts/update [post]
|
||||||
|
func (b *BaseApi) UpdateAgentAccount(c *gin.Context) {
|
||||||
|
var req dto.AgentAccountUpdateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.UpdateAccount(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Page Agent accounts
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentAccountSearch true "request"
|
||||||
|
// @Success 200 {object} dto.PageResult
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/accounts/search [post]
|
||||||
|
func (b *BaseApi) PageAgentAccounts(c *gin.Context) {
|
||||||
|
var req dto.AgentAccountSearch
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
total, list, err := agentService.PageAccounts(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, dto.PageResult{
|
||||||
|
Items: list,
|
||||||
|
Total: total,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Verify Agent account
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentAccountVerifyReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/accounts/verify [post]
|
||||||
|
func (b *BaseApi) VerifyAgentAccount(c *gin.Context) {
|
||||||
|
var req dto.AgentAccountVerifyReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.VerifyAccount(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Delete Agent account
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentAccountDeleteReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/accounts/delete [post]
|
||||||
|
func (b *BaseApi) DeleteAgentAccount(c *gin.Context) {
|
||||||
|
var req dto.AgentAccountDeleteReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.DeleteAccount(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Get Agent Feishu channel config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentFeishuConfigReq true "request"
|
||||||
|
// @Success 200 {object} dto.AgentFeishuConfig
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/channel/feishu/get [post]
|
||||||
|
func (b *BaseApi) GetAgentFeishuConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentFeishuConfigReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := agentService.GetFeishuConfig(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Update Agent Feishu channel config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentFeishuConfigUpdateReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/channel/feishu/update [post]
|
||||||
|
func (b *BaseApi) UpdateAgentFeishuConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentFeishuConfigUpdateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.UpdateFeishuConfig(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Get Agent Telegram channel config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentTelegramConfigReq true "request"
|
||||||
|
// @Success 200 {object} dto.AgentTelegramConfig
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/channel/telegram/get [post]
|
||||||
|
func (b *BaseApi) GetAgentTelegramConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentTelegramConfigReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := agentService.GetTelegramConfig(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Update Agent Telegram channel config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentTelegramConfigUpdateReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/channel/telegram/update [post]
|
||||||
|
func (b *BaseApi) UpdateAgentTelegramConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentTelegramConfigUpdateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.UpdateTelegramConfig(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Get Agent Discord channel config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentDiscordConfigReq true "request"
|
||||||
|
// @Success 200 {object} dto.AgentDiscordConfig
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/channel/discord/get [post]
|
||||||
|
func (b *BaseApi) GetAgentDiscordConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentDiscordConfigReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := agentService.GetDiscordConfig(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Update Agent Discord channel config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentDiscordConfigUpdateReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/channel/discord/update [post]
|
||||||
|
func (b *BaseApi) UpdateAgentDiscordConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentDiscordConfigUpdateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.UpdateDiscordConfig(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Get Agent Browser config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentBrowserConfigReq true "request"
|
||||||
|
// @Success 200 {object} dto.AgentBrowserConfig
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/browser/get [post]
|
||||||
|
func (b *BaseApi) GetAgentBrowserConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentBrowserConfigReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := agentService.GetBrowserConfig(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Update Agent Browser config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentBrowserConfigUpdateReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/browser/update [post]
|
||||||
|
func (b *BaseApi) UpdateAgentBrowserConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentBrowserConfigUpdateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.UpdateBrowserConfig(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Get Agent Other config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentOtherConfigReq true "request"
|
||||||
|
// @Success 200 {object} dto.AgentOtherConfig
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/other/get [post]
|
||||||
|
func (b *BaseApi) GetAgentOtherConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentOtherConfigReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := agentService.GetOtherConfig(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Update Agent Other config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentOtherConfigUpdateReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/other/update [post]
|
||||||
|
func (b *BaseApi) UpdateAgentOtherConfig(c *gin.Context) {
|
||||||
|
var req dto.AgentOtherConfigUpdateReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.UpdateOtherConfig(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Approve Agent Feishu pairing code
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentFeishuPairingApproveReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/channel/feishu/approve [post]
|
||||||
|
func (b *BaseApi) ApproveAgentFeishuPairing(c *gin.Context) {
|
||||||
|
var req dto.AgentFeishuPairingApproveReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.ApproveFeishuPairing(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags AI
|
||||||
|
// @Summary Approve Agent channel pairing code
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.AgentChannelPairingApproveReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /ai/agents/channel/pairing/approve [post]
|
||||||
|
func (b *BaseApi) ApproveAgentChannelPairing(c *gin.Context) {
|
||||||
|
var req dto.AgentChannelPairingApproveReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := agentService.ApproveChannelPairing(req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
@@ -60,7 +60,7 @@ func (b *BaseApi) RecreateOllamaModel(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /ai/ollama/model/close [post]
|
// @Router /ai/ollama/close [post]
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"关闭 Ollama 模型连接 [name]","formatEN":"close conn for Ollama model [name]"}
|
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"关闭 Ollama 模型连接 [name]","formatEN":"close conn for Ollama model [name]"}
|
||||||
func (b *BaseApi) CloseOllamaModel(c *gin.Context) {
|
func (b *BaseApi) CloseOllamaModel(c *gin.Context) {
|
||||||
var req dto.OllamaModelName
|
var req dto.OllamaModelName
|
||||||
|
|||||||
@@ -0,0 +1,200 @@
|
|||||||
|
package v2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (b *BaseApi) PageAlert(c *gin.Context) {
|
||||||
|
var req dto.AlertSearch
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
total, alerts, err := alertService.PageAlert(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, dto.PageResult{
|
||||||
|
Total: total,
|
||||||
|
Items: alerts,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) GetAlerts(c *gin.Context) {
|
||||||
|
alerts, err := alertService.GetAlerts()
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, alerts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) CreateAlert(c *gin.Context) {
|
||||||
|
var req dto.AlertCreate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := alertService.CreateAlert(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) DeleteAlert(c *gin.Context) {
|
||||||
|
var req dto.DeleteRequest
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := alertService.DeleteAlert(req.ID)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) UpdateAlert(c *gin.Context) {
|
||||||
|
var req dto.AlertUpdate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := alertService.UpdateAlert(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) GetAlert(c *gin.Context) {
|
||||||
|
id, err := helper.GetParamID(c)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, errors.New("no such id in request param"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
alert, err := alertService.GetAlert(id)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, alert)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) UpdateAlertStatus(c *gin.Context) {
|
||||||
|
var req dto.AlertUpdateStatus
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := alertService.UpdateStatus(req.ID, req.Status); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) GetDisks(c *gin.Context) {
|
||||||
|
alerts, err := alertService.GetDisks()
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, alerts)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) PageAlertLogs(c *gin.Context) {
|
||||||
|
var req dto.AlertLogSearch
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
total, alertLogs, err := alertService.PageAlertLogs(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, dto.PageResult{
|
||||||
|
Total: total,
|
||||||
|
Items: alertLogs,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) CleanAlertLogs(c *gin.Context) {
|
||||||
|
if err := alertService.CleanAlertLogs(); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) GetClams(c *gin.Context) {
|
||||||
|
clams, err := alertService.GetClams()
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, clams)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) GetCronJobs(c *gin.Context) {
|
||||||
|
var req dto.CronJobReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
cronJobs, err := alertService.GetCronJobs(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, cronJobs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) GetAlertConfig(c *gin.Context) {
|
||||||
|
config, err := alertService.GetAlertConfig()
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, config)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) UpdateAlertConfig(c *gin.Context) {
|
||||||
|
var req dto.AlertConfigUpdate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := alertService.UpdateAlertConfig(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) DeleteAlertConfig(c *gin.Context) {
|
||||||
|
var req dto.DeleteRequest
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := alertService.DeleteAlertConfig(req.ID)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) TestAlertConfig(c *gin.Context) {
|
||||||
|
var req dto.AlertConfigTest
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
flag, err := alertService.TestAlertConfig(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, flag)
|
||||||
|
}
|
||||||
+63
-2
@@ -1,10 +1,13 @@
|
|||||||
package v2
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
||||||
"github.com/1Panel-dev/1Panel/agent/i18n"
|
"github.com/1Panel-dev/1Panel/agent/i18n"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/utils/appicon"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,7 +29,7 @@ func (b *BaseApi) SearchApp(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, list)
|
helper.SuccessWithDataGzipped(c, list)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags App
|
// @Tags App
|
||||||
@@ -161,7 +164,7 @@ func (b *BaseApi) InstallApp(c *gin.Context) {
|
|||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
install, err := appService.Install(req)
|
install, err := appService.Install(req, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
@@ -192,3 +195,61 @@ func (b *BaseApi) GetAppListUpdate(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
helper.SuccessWithData(c, res)
|
helper.SuccessWithData(c, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags App
|
||||||
|
// @Summary Get app icon by app_id
|
||||||
|
// @Accept json
|
||||||
|
// @Param appId path integer true "app id"
|
||||||
|
// @Success 200 {file} file "app icon"
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /apps/icon/:key [get]
|
||||||
|
func (b *BaseApi) GetAppIcon(c *gin.Context) {
|
||||||
|
appKey, err := helper.GetStrParamByKey(c, "key")
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
iconBytes, filename, etag, err := appService.GetAppIcon(appKey)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(iconBytes) == 0 {
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Header("Cache-Control", "public, max-age=2592000")
|
||||||
|
|
||||||
|
if etag != "" && filename != "" {
|
||||||
|
c.Header("ETag", etag)
|
||||||
|
if c.GetHeader("If-None-Match") == etag {
|
||||||
|
c.Status(http.StatusNotModified)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Data(http.StatusOK, appicon.ContentTypePNG, iconBytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags App
|
||||||
|
// @Summary Search app detail by appkey and version
|
||||||
|
// @Accept json
|
||||||
|
// @Param appId path integer true "app key"
|
||||||
|
// @Param version path string true "app version"
|
||||||
|
// @Success 200 {object} response.AppDetailSimpleDTO
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /apps/detail/node/:appKey/:version [get]
|
||||||
|
func (b *BaseApi) GetAppDetailForNode(c *gin.Context) {
|
||||||
|
appKey := c.Param("appKey")
|
||||||
|
version := c.Param("version")
|
||||||
|
appDetailDTO, err := appService.GetAppDetailByKey(appKey, version)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, appDetailDTO)
|
||||||
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ func (b *BaseApi) LoadPort(c *gin.Context) {
|
|||||||
// @Success 200 {object} response.DatabaseConn
|
// @Success 200 {object} response.DatabaseConn
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /apps/installed/conninfo/:key [get]
|
// @Router /apps/installed/conninfo [post]
|
||||||
func (b *BaseApi) LoadConnInfo(c *gin.Context) {
|
func (b *BaseApi) LoadConnInfo(c *gin.Context) {
|
||||||
var req dto.OperationWithNameAndType
|
var req dto.OperationWithNameAndType
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -294,7 +294,7 @@ func (b *BaseApi) GetParams(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /apps/installed/params/update [post]
|
// @Router /apps/installed/params/update [post]
|
||||||
// @x-panel-log {"bodyKeys":["installId"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"应用参数修改 [installId]","formatEN":"Application param update [installId]"}
|
// @x-panel-log {"bodyKeys":["installId"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"installId","isList":false,"db":"app_installs","output_column":"name","output_value":"name"}],"formatZH":"应用参数修改 [name]","formatEN":"Application param update [name]"}
|
||||||
func (b *BaseApi) UpdateInstalled(c *gin.Context) {
|
func (b *BaseApi) UpdateInstalled(c *gin.Context) {
|
||||||
var req request.AppInstalledUpdate
|
var req request.AppInstalledUpdate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -327,3 +327,37 @@ func (b *BaseApi) UpdateAppConfig(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags App
|
||||||
|
// @Summary Get app install info
|
||||||
|
// @Accept json
|
||||||
|
// @Param appInstallId path integer true "App install id"
|
||||||
|
// @Success 200 {object} dto.AppInstallInfo
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /apps/installed/info/:appInstallId [get]
|
||||||
|
func (b *BaseApi) GetAppInstallInfo(c *gin.Context) {
|
||||||
|
appInstallId, err := helper.GetIntParamByKey(c, "appInstallId")
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
info, err := appInstallService.GetAppInstallInfo(appInstallId)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, info)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) UpdateAppInstallSort(c *gin.Context) {
|
||||||
|
var req request.AppInstallSort
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := appInstallService.UpdateSort(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|||||||
+51
-12
@@ -25,6 +25,23 @@ func (b *BaseApi) CheckBackupUsed(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Backup Account
|
||||||
|
// @Summary Check backup account
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.BackupOperate true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /backups/check [post]
|
||||||
|
func (b *BaseApi) CheckBackup(c *gin.Context) {
|
||||||
|
var req dto.BackupOperate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.SuccessWithData(c, backupService.CheckConn(req))
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Backup Account
|
// @Tags Backup Account
|
||||||
// @Summary Create backup account
|
// @Summary Create backup account
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -74,7 +91,7 @@ func (b *BaseApi) RefreshToken(c *gin.Context) {
|
|||||||
// @Success 200 {array} object
|
// @Success 200 {array} object
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /buckets [post]
|
// @Router /backups/buckets [post]
|
||||||
func (b *BaseApi) ListBuckets(c *gin.Context) {
|
func (b *BaseApi) ListBuckets(c *gin.Context) {
|
||||||
var req dto.ForBuckets
|
var req dto.ForBuckets
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -133,6 +150,28 @@ func (b *BaseApi) UpdateBackup(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Backup Account
|
||||||
|
// @Summary Upload file for recover
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.UploadForRecover true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /backups/upload [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["filePath"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"上传备份文件 [filePath]","formatEN":"upload backup file [filePath]"}
|
||||||
|
func (b *BaseApi) UploadForRecover(c *gin.Context) {
|
||||||
|
var req dto.UploadForRecover
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := backupService.UploadForRecover(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Backup Account
|
// @Tags Backup Account
|
||||||
// @Summary Load backup account options
|
// @Summary Load backup account options
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -273,7 +312,7 @@ func (b *BaseApi) SearchBackupRecordsByCronjob(c *gin.Context) {
|
|||||||
// @Success 200 {string} filePath
|
// @Success 200 {string} filePath
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /backup/record/download [post]
|
// @Router /backups/record/download [post]
|
||||||
// @x-panel-log {"bodyKeys":["source","fileName"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"下载备份记录 [source][fileName]","formatEN":"download backup records [source][fileName]"}
|
// @x-panel-log {"bodyKeys":["source","fileName"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"下载备份记录 [source][fileName]","formatEN":"download backup records [source][fileName]"}
|
||||||
func (b *BaseApi) DownloadRecord(c *gin.Context) {
|
func (b *BaseApi) DownloadRecord(c *gin.Context) {
|
||||||
var req dto.DownloadRecord
|
var req dto.DownloadRecord
|
||||||
@@ -296,7 +335,7 @@ func (b *BaseApi) DownloadRecord(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /backup/record/description/update [post]
|
// @Router /backups/record/description/update [post]
|
||||||
func (b *BaseApi) UpdateRecordDescription(c *gin.Context) {
|
func (b *BaseApi) UpdateRecordDescription(c *gin.Context) {
|
||||||
var req dto.UpdateDescription
|
var req dto.UpdateDescription
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -317,7 +356,7 @@ func (b *BaseApi) UpdateRecordDescription(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /record/del [post]
|
// @Router /backups/record/del [post]
|
||||||
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"ids","isList":true,"db":"backup_records","output_column":"file_name","output_value":"files"}],"formatZH":"删除备份记录 [files]","formatEN":"delete backup records [files]"}
|
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"ids","isList":true,"db":"backup_records","output_column":"file_name","output_value":"files"}],"formatZH":"删除备份记录 [files]","formatEN":"delete backup records [files]"}
|
||||||
func (b *BaseApi) DeleteBackupRecord(c *gin.Context) {
|
func (b *BaseApi) DeleteBackupRecord(c *gin.Context) {
|
||||||
var req dto.BatchDeleteReq
|
var req dto.BatchDeleteReq
|
||||||
@@ -371,12 +410,12 @@ func (b *BaseApi) Backup(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "mysql", "mariadb":
|
case "mysql", "mariadb", constant.AppMysqlCluster:
|
||||||
if err := backupService.MysqlBackup(req); err != nil {
|
if err := backupService.MysqlBackup(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case constant.AppPostgresql:
|
case constant.AppPostgresql, constant.AppPostgresqlCluster:
|
||||||
if err := backupService.PostgresqlBackup(req); err != nil {
|
if err := backupService.PostgresqlBackup(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
@@ -386,7 +425,7 @@ func (b *BaseApi) Backup(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "redis":
|
case "redis", constant.AppRedisCluster:
|
||||||
if err := backupService.RedisBackup(req); err != nil {
|
if err := backupService.RedisBackup(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
@@ -421,12 +460,12 @@ func (b *BaseApi) Recover(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
req.File = downloadPath
|
req.File = downloadPath
|
||||||
switch req.Type {
|
switch req.Type {
|
||||||
case "mysql", "mariadb":
|
case "mysql", "mariadb", constant.AppMysqlCluster:
|
||||||
if err := backupService.MysqlRecover(req); err != nil {
|
if err := backupService.MysqlRecover(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case constant.AppPostgresql:
|
case constant.AppPostgresql, constant.AppPostgresqlCluster:
|
||||||
if err := backupService.PostgresqlRecover(req); err != nil {
|
if err := backupService.PostgresqlRecover(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
@@ -436,7 +475,7 @@ func (b *BaseApi) Recover(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case "redis":
|
case "redis", constant.AppRedisCluster:
|
||||||
if err := backupService.RedisRecover(req); err != nil {
|
if err := backupService.RedisRecover(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
@@ -466,12 +505,12 @@ func (b *BaseApi) RecoverByUpload(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch req.Type {
|
switch req.Type {
|
||||||
case "mysql", "mariadb":
|
case "mysql", "mariadb", constant.AppMysqlCluster:
|
||||||
if err := backupService.MysqlRecoverByUpload(req); err != nil {
|
if err := backupService.MysqlRecoverByUpload(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case constant.AppPostgresql:
|
case constant.AppPostgresql, constant.AppPostgresqlCluster:
|
||||||
if err := backupService.PostgresqlRecoverByUpload(req); err != nil {
|
if err := backupService.PostgresqlRecoverByUpload(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ func (b *BaseApi) SearchClam(c *gin.Context) {
|
|||||||
// @Success 200 {object} dto.ClamBaseInfo
|
// @Success 200 {object} dto.ClamBaseInfo
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /toolbox/clam/base [get]
|
// @Router /toolbox/clam/base [post]
|
||||||
func (b *BaseApi) LoadClamBaseInfo(c *gin.Context) {
|
func (b *BaseApi) LoadClamBaseInfo(c *gin.Context) {
|
||||||
info, err := clamService.LoadBaseInfo()
|
info, err := clamService.LoadBaseInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -152,7 +152,7 @@ func (b *BaseApi) CleanClamRecord(c *gin.Context) {
|
|||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := clamService.CleanRecord(req); err != nil {
|
if err := clamService.CleanRecord(req.ID); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ func (b *BaseApi) SearchClamRecord(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
total, list, err := clamService.LoadRecords(req)
|
total, list, err := clamService.SearchRecords(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
@@ -186,29 +186,6 @@ func (b *BaseApi) SearchClamRecord(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Clam
|
|
||||||
// @Summary Load clam record detail
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.ClamLogReq true "request"
|
|
||||||
// @Success 200 {string} content
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /toolbox/clam/record/log [post]
|
|
||||||
func (b *BaseApi) LoadClamRecordLog(c *gin.Context) {
|
|
||||||
var req dto.ClamLogReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
content, err := clamService.LoadRecordLog(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, content)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Clam
|
// @Tags Clam
|
||||||
// @Summary Load clam file
|
// @Summary Load clam file
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -289,7 +266,7 @@ func (b *BaseApi) HandleClamScan(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := clamService.HandleOnce(req); err != nil {
|
if err := clamService.HandleOnce(req.ID); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,28 @@ func (b *BaseApi) CreateComposeTemplate(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Container Compose-template
|
||||||
|
// @Summary Bacth compose template
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.ComposeTemplateBatch true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /containers/template/batch [post]
|
||||||
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"批量导入编排模版","formatEN":"batch import compose templates"}
|
||||||
|
func (b *BaseApi) BatchComposeTemplate(c *gin.Context) {
|
||||||
|
var req dto.ComposeTemplateBatch
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := composeTemplateService.Batch(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Container Compose-template
|
// @Tags Container Compose-template
|
||||||
// @Summary Page compose templates
|
// @Summary Page compose templates
|
||||||
// @Accept json
|
// @Accept json
|
||||||
|
|||||||
@@ -50,19 +50,14 @@ func (b *BaseApi) LoadContainerUsers(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
list, err := containerService.LoadUsers(req)
|
helper.SuccessWithData(c, containerService.LoadUsers(req))
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, list)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Container
|
// @Tags Container
|
||||||
// @Summary List containers
|
// @Summary List containers
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} string
|
// @Success 200 {array} dto.ContainerOptions
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/list [post]
|
// @Router /containers/list [post]
|
||||||
@@ -70,6 +65,23 @@ func (b *BaseApi) ListContainer(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, containerService.List())
|
helper.SuccessWithData(c, containerService.List())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Container
|
||||||
|
// @Summary List containers by image
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Success 200 {array} dto.ContainerOptions
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /containers/list/byimage [post]
|
||||||
|
func (b *BaseApi) ListContainerByImage(c *gin.Context) {
|
||||||
|
var req dto.OperationWithName
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.SuccessWithData(c, containerService.ListByImage(req.Name))
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Container
|
// @Tags Container
|
||||||
// @Summary Load containers status
|
// @Summary Load containers status
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -251,6 +263,27 @@ func (b *BaseApi) ContainerListStats(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithData(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary Load container stats size
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.OperationWithName true "request"
|
||||||
|
// @Success 200 {object} dto.ContainerItemStats
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /containers/item/stats [post]
|
||||||
|
func (b *BaseApi) ContainerItemStats(c *gin.Context) {
|
||||||
|
var req dto.OperationWithName
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := containerService.ContainerItemStats(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Container
|
// @Tags Container
|
||||||
// @Summary Create container
|
// @Summary Create container
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -266,28 +299,7 @@ func (b *BaseApi) ContainerCreate(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := containerService.ContainerCreate(req); err != nil {
|
if err := containerService.ContainerCreate(req, true); err != nil {
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Container
|
|
||||||
// @Summary Create container by command
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.ContainerCreateByCommand true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /containers/command [post]
|
|
||||||
func (b *BaseApi) ContainerCreateByCommand(c *gin.Context) {
|
|
||||||
var req dto.ContainerCreateByCommand
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := containerService.ContainerCreateByCommand(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -302,7 +314,7 @@ func (b *BaseApi) ContainerCreateByCommand(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/upgrade [post]
|
// @Router /containers/upgrade [post]
|
||||||
// @x-panel-log {"bodyKeys":["name","image"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新容器镜像 [name][image]","formatEN":"upgrade container image [name][image]"}
|
// @x-panel-log {"bodyKeys":["names","image"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新容器镜像 [names][image]","formatEN":"upgrade container image [names][image]"}
|
||||||
func (b *BaseApi) ContainerUpgrade(c *gin.Context) {
|
func (b *BaseApi) ContainerUpgrade(c *gin.Context) {
|
||||||
var req dto.ContainerUpgrade
|
var req dto.ContainerUpgrade
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -320,7 +332,7 @@ func (b *BaseApi) ContainerUpgrade(c *gin.Context) {
|
|||||||
// @Summary Clean container
|
// @Summary Clean container
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.ContainerPrune true "request"
|
// @Param request body dto.ContainerPrune true "request"
|
||||||
// @Success 200 {object} dto.ContainerPruneReport
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/prune [post]
|
// @Router /containers/prune [post]
|
||||||
@@ -331,12 +343,11 @@ func (b *BaseApi) ContainerPrune(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
report, err := containerService.Prune(req)
|
if err := containerService.Prune(req); err != nil {
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, report)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Container
|
// @Tags Container
|
||||||
@@ -361,6 +372,28 @@ func (b *BaseApi) CleanContainerLog(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Container
|
||||||
|
// @Summary Clean compose log
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.ComposeLogClean true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /containers/compose/clean/log [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清理容器编排 [name] 日志","formatEN":"clean compose [name] logs"}
|
||||||
|
func (b *BaseApi) CleanComposeLog(c *gin.Context) {
|
||||||
|
var req dto.ComposeLogClean
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := containerService.ComposeLogClean(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Container
|
// @Tags Container
|
||||||
// @Summary Rename Container
|
// @Summary Rename Container
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -470,13 +503,12 @@ func (b *BaseApi) Inspect(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, result)
|
helper.SuccessWithData(c, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Router /containers/download/log [post]
|
|
||||||
func (b *BaseApi) DownloadContainerLogs(c *gin.Context) {
|
func (b *BaseApi) DownloadContainerLogs(c *gin.Context) {
|
||||||
var req dto.ContainerLog
|
var req dto.ContainerLog
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := containerService.DownloadContainerLogs(req.ContainerType, req.Container, req.Since, strconv.Itoa(int(req.Tail)), c)
|
err := containerService.DownloadContainerLogs(req.ContainerType, req.Container, req.Since, strconv.Itoa(int(req.Tail)), req.Timestamp, c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
}
|
}
|
||||||
@@ -678,15 +710,37 @@ func (b *BaseApi) ComposeUpdate(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Container Compose
|
||||||
|
// @Summary Load compose environment variables
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.FilePath true "request"
|
||||||
|
// @Success 200 {array} string
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /containers/compose/env [post]
|
||||||
|
func (b *BaseApi) LoadComposeEnv(c *gin.Context) {
|
||||||
|
var req dto.FilePath
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := containerService.LoadComposeEnv(req.Path)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Container
|
// @Tags Container
|
||||||
// @Summary Container logs
|
// @Summary Container logs
|
||||||
// @Param container query string false "容器名称"
|
// @Param container query string false "容器名称"
|
||||||
// @Param since query string false "时间筛选"
|
// @Param since query string false "时间筛选"
|
||||||
// @Param follow query string false "是否追踪"
|
// @Param follow query string false "是否追踪"
|
||||||
// @Param tail query string false "显示行号"
|
// @Param tail query string false "显示行号"
|
||||||
|
// @Param timestamp query string false "是否显示时间"
|
||||||
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/search/log [post]
|
// @Router /containers/search/log [get]
|
||||||
func (b *BaseApi) ContainerStreamLogs(c *gin.Context) {
|
func (b *BaseApi) ContainerStreamLogs(c *gin.Context) {
|
||||||
c.Header("Content-Type", "text/event-stream")
|
c.Header("Content-Type", "text/event-stream")
|
||||||
c.Header("Cache-Control", "no-cache")
|
c.Header("Cache-Control", "no-cache")
|
||||||
@@ -696,6 +750,7 @@ func (b *BaseApi) ContainerStreamLogs(c *gin.Context) {
|
|||||||
since := c.Query("since")
|
since := c.Query("since")
|
||||||
follow := c.Query("follow") == "true"
|
follow := c.Query("follow") == "true"
|
||||||
tail := c.Query("tail")
|
tail := c.Query("tail")
|
||||||
|
timestamp := c.Query("timestamp") == "true"
|
||||||
|
|
||||||
container := c.Query("container")
|
container := c.Query("container")
|
||||||
compose := c.Query("compose")
|
compose := c.Query("compose")
|
||||||
@@ -705,6 +760,7 @@ func (b *BaseApi) ContainerStreamLogs(c *gin.Context) {
|
|||||||
Since: since,
|
Since: since,
|
||||||
Follow: follow,
|
Follow: follow,
|
||||||
Tail: tail,
|
Tail: tail,
|
||||||
|
Timestamp: timestamp,
|
||||||
Type: "container",
|
Type: "container",
|
||||||
}
|
}
|
||||||
if compose != "" {
|
if compose != "" {
|
||||||
|
|||||||
+90
-25
@@ -1,6 +1,8 @@
|
|||||||
package v2
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
@@ -53,6 +55,49 @@ func (b *BaseApi) LoadCronjobInfo(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithData(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Cronjob
|
||||||
|
// @Summary Export cronjob list
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.OperateByIDs true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /cronjobs/export [post]
|
||||||
|
func (b *BaseApi) ExportCronjob(c *gin.Context) {
|
||||||
|
var req dto.OperateByIDs
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
content, err := cronjobService.Export(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
http.ServeContent(c.Writer, c.Request, "", time.Now(), strings.NewReader(content))
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Cronjob
|
||||||
|
// @Summary Import cronjob list
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.CronjobImport true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /cronjobs/import [post]
|
||||||
|
func (b *BaseApi) ImportCronjob(c *gin.Context) {
|
||||||
|
var req dto.CronjobImport
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := cronjobService.Import(req.Cronjobs); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Cronjob
|
// @Tags Cronjob
|
||||||
// @Summary Load script options
|
// @Summary Load script options
|
||||||
// @Success 200 {array} dto.ScriptOptions
|
// @Success 200 {array} dto.ScriptOptions
|
||||||
@@ -166,7 +211,7 @@ func (b *BaseApi) LoadRecordLog(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /cronjobs/records/clean [post]
|
// @Router /cronjobs/records/clean [post]
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"cronjobs","output_column":"name","output_value":"name"}],"formatZH":"清空计划任务记录 [name]","formatEN":"clean cronjob [name] records"}
|
// @x-panel-log {"bodyKeys":["cronjobID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"cronjobID","isList":false,"db":"cronjobs","output_column":"name","output_value":"name"}],"formatZH":"清空计划任务记录 [name]","formatEN":"clean cronjob [name] records"}
|
||||||
func (b *BaseApi) CleanRecord(c *gin.Context) {
|
func (b *BaseApi) CleanRecord(c *gin.Context) {
|
||||||
var req dto.CronjobClean
|
var req dto.CronjobClean
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -181,6 +226,28 @@ func (b *BaseApi) CleanRecord(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Cronjob
|
||||||
|
// @Summary Handle stop job
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.OperateByID true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /cronjobs/stop [post]
|
||||||
|
func (b *BaseApi) StopCronJob(c *gin.Context) {
|
||||||
|
var req dto.OperateByID
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := cronjobService.HandleStop(req.ID); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Cronjob
|
// @Tags Cronjob
|
||||||
// @Summary Delete cronjob
|
// @Summary Delete cronjob
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -225,6 +292,28 @@ func (b *BaseApi) UpdateCronjob(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Cronjob
|
||||||
|
// @Summary Update cronjob group
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.ChangeGroup true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /cronjobs/group/update [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"cronjobs","output_column":"name","output_value":"name"}],"formatZH":"更新计划任务分组 [name]","formatEN":"update cronjob group [name]"}
|
||||||
|
func (b *BaseApi) UpdateCronjobGroup(c *gin.Context) {
|
||||||
|
var req dto.ChangeGroup
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := cronjobService.UpdateGroup(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Cronjob
|
// @Tags Cronjob
|
||||||
// @Summary Update cronjob status
|
// @Summary Update cronjob status
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -247,30 +336,6 @@ func (b *BaseApi) UpdateCronjobStatus(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Cronjob
|
|
||||||
// @Summary Download cronjob records
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.CronjobDownload true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /cronjobs/download [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["recordID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"recordID","isList":false,"db":"job_records","output_column":"file","output_value":"file"}],"formatZH":"下载计划任务记录 [file]","formatEN":"download the cronjob record [file]"}
|
|
||||||
func (b *BaseApi) TargetDownload(c *gin.Context) {
|
|
||||||
var req dto.CronjobDownload
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
filePath, err := cronjobService.Download(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
c.File(filePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Cronjob
|
// @Tags Cronjob
|
||||||
// @Summary Handle cronjob once
|
// @Summary Handle cronjob once
|
||||||
// @Accept json
|
// @Accept json
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func (b *BaseApi) LoadDashboardOsInfo(c *gin.Context) {
|
|||||||
// @Tags Dashboard
|
// @Tags Dashboard
|
||||||
// @Summary Load app launcher
|
// @Summary Load app launcher
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Success 200 {Array} dto.AppLauncher
|
// @Success 200 {array} dto.AppLauncher
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /dashboard/app/launcher [get]
|
// @Router /dashboard/app/launcher [get]
|
||||||
@@ -37,14 +37,14 @@ func (b *BaseApi) LoadAppLauncher(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithDataGzipped(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Dashboard
|
// @Tags Dashboard
|
||||||
// @Summary Load app launcher options
|
// @Summary Load app launcher options
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.SearchByFilter true "request"
|
// @Param request body dto.SearchByFilter true "request"
|
||||||
// @Success 200 {Array} dto.LauncherOption
|
// @Success 200 {array} dto.LauncherOption
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /dashboard/app/launcher/option [post]
|
// @Router /dashboard/app/launcher/option [post]
|
||||||
@@ -83,6 +83,38 @@ func (b *BaseApi) UpdateAppLauncher(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Dashboard
|
||||||
|
// @Summary Load quick jump options
|
||||||
|
// @Success 200 {array} dto.QuickJump
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /dashboard/quick/option [get]
|
||||||
|
func (b *BaseApi) LoadQuickOption(c *gin.Context) {
|
||||||
|
helper.SuccessWithData(c, dashboardService.LoadQuickOptions())
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Dashboard
|
||||||
|
// @Summary Update quick jump
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.ChangeQuicks true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /dashboard/quick/change [post]
|
||||||
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"切换快速跳转","formatEN":"change quick jump"}
|
||||||
|
func (b *BaseApi) UpdateQuickJump(c *gin.Context) {
|
||||||
|
var req dto.ChangeQuicks
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := dashboardService.ChangeQuick(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Dashboard
|
// @Tags Dashboard
|
||||||
// @Summary Load dashboard base info
|
// @Summary Load dashboard base info
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -147,6 +179,28 @@ func (b *BaseApi) LoadDashboardCurrentInfo(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithData(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Dashboard
|
||||||
|
// @Summary Load top cpu processes
|
||||||
|
// @Success 200 {array} dto.Process
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /dashboard/current/top/cpu [get]
|
||||||
|
func (b *BaseApi) LoadDashboardTopCPU(c *gin.Context) {
|
||||||
|
data := dashboardService.LoadTopCPU()
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Dashboard
|
||||||
|
// @Summary Load top memory processes
|
||||||
|
// @Success 200 {array} dto.Process
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /dashboard/current/top/mem [get]
|
||||||
|
func (b *BaseApi) LoadDashboardTopMem(c *gin.Context) {
|
||||||
|
data := dashboardService.LoadTopMem()
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Dashboard
|
// @Tags Dashboard
|
||||||
// @Summary System restart
|
// @Summary System restart
|
||||||
// @Accept json
|
// @Accept json
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ func (b *BaseApi) GetDatabase(c *gin.Context) {
|
|||||||
// @Success 200 {array} string
|
// @Success 200 {array} string
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /db/remote/del/check [post]
|
// @Router /databases/db/del/check [post]
|
||||||
func (b *BaseApi) DeleteCheckDatabase(c *gin.Context) {
|
func (b *BaseApi) DeleteCheckDatabase(c *gin.Context) {
|
||||||
var req dto.OperateByID
|
var req dto.OperateByID
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
|||||||
@@ -195,27 +195,26 @@ func (b *BaseApi) SearchMysql(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Database Mysql
|
// @Tags Database Mysql
|
||||||
// @Summary List mysql database names
|
// @Summary List mysql database format collation options
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.PageInfo true "request"
|
// @Param request body dto.OperationWithName true "request"
|
||||||
// @Success 200 {array} dto.MysqlOption
|
// @Success 200 {array} dto.MysqlFormatCollationOption
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /databases/options [get]
|
// @Router /databases/format/options [post]
|
||||||
func (b *BaseApi) ListDBName(c *gin.Context) {
|
func (b *BaseApi) ListDBFormatCollationOptions(c *gin.Context) {
|
||||||
list, err := mysqlService.ListDBOption()
|
var req dto.OperationWithName
|
||||||
if err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
helper.SuccessWithData(c, mysqlService.LoadFormatOption(req))
|
||||||
helper.SuccessWithData(c, list)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Database Mysql
|
// @Tags Database Mysql
|
||||||
// @Summary Load mysql database from remote
|
// @Summary Load mysql database from remote
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.MysqlLoadDB true "request"
|
// @Param request body dto.MysqlLoadDB true "request"
|
||||||
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /databases/load [post]
|
// @Router /databases/load [post]
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ func (b *BaseApi) SearchPostgresql(c *gin.Context) {
|
|||||||
// @Summary Load postgresql database from remote
|
// @Summary Load postgresql database from remote
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.PostgresqlLoadDB true "request"
|
// @Param request body dto.PostgresqlLoadDB true "request"
|
||||||
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /databases/pg/:database/load [post]
|
// @Router /databases/pg/:database/load [post]
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ import (
|
|||||||
// @Tags Database Redis
|
// @Tags Database Redis
|
||||||
// @Summary Load redis status info
|
// @Summary Load redis status info
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.OperationWithName true "request"
|
// @Param request body dto.LoadRedisStatus true "request"
|
||||||
// @Success 200 {object} dto.RedisStatus
|
// @Success 200 {object} dto.RedisStatus
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /databases/redis/status [post]
|
// @Router /databases/redis/status [post]
|
||||||
func (b *BaseApi) LoadRedisStatus(c *gin.Context) {
|
func (b *BaseApi) LoadRedisStatus(c *gin.Context) {
|
||||||
var req dto.OperationWithName
|
var req dto.LoadRedisStatus
|
||||||
if err := helper.CheckBind(&req, c); err != nil {
|
if err := helper.CheckBind(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -33,13 +33,13 @@ func (b *BaseApi) LoadRedisStatus(c *gin.Context) {
|
|||||||
// @Tags Database Redis
|
// @Tags Database Redis
|
||||||
// @Summary Load redis conf
|
// @Summary Load redis conf
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.OperationWithName true "request"
|
// @Param request body dto.LoadRedisStatus true "request"
|
||||||
// @Success 200 {object} dto.RedisConf
|
// @Success 200 {object} dto.RedisConf
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /databases/redis/conf [post]
|
// @Router /databases/redis/conf [post]
|
||||||
func (b *BaseApi) LoadRedisConf(c *gin.Context) {
|
func (b *BaseApi) LoadRedisConf(c *gin.Context) {
|
||||||
var req dto.OperationWithName
|
var req dto.LoadRedisStatus
|
||||||
if err := helper.CheckBind(&req, c); err != nil {
|
if err := helper.CheckBind(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -55,13 +55,13 @@ func (b *BaseApi) LoadRedisConf(c *gin.Context) {
|
|||||||
// @Tags Database Redis
|
// @Tags Database Redis
|
||||||
// @Summary Load redis persistence conf
|
// @Summary Load redis persistence conf
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.OperationWithName true "request"
|
// @Param request body dto.LoadRedisStatus true "request"
|
||||||
// @Success 200 {object} dto.RedisPersistence
|
// @Success 200 {object} dto.RedisPersistence
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /databases/redis/persistence/conf [post]
|
// @Router /databases/redis/persistence/conf [post]
|
||||||
func (b *BaseApi) LoadPersistenceConf(c *gin.Context) {
|
func (b *BaseApi) LoadPersistenceConf(c *gin.Context) {
|
||||||
var req dto.OperationWithName
|
var req dto.LoadRedisStatus
|
||||||
if err := helper.CheckBind(&req, c); err != nil {
|
if err := helper.CheckBind(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func (b *BaseApi) LoadDeviceBaseInfo(c *gin.Context) {
|
|||||||
// @Tags Device
|
// @Tags Device
|
||||||
// @Summary list time zone options
|
// @Summary list time zone options
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Success 200 {Array} string
|
// @Success 200 {array} string
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /toolbox/device/zone/options [get]
|
// @Router /toolbox/device/zone/options [get]
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package v2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// @Tags Disk Management
|
||||||
|
// @Summary Get complete disk information
|
||||||
|
// @Description Get information about all disks including partitioned and unpartitioned disks
|
||||||
|
// @Produce json
|
||||||
|
// @Success 200 {object} response.CompleteDiskInfo
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/disks [get]
|
||||||
|
func (b *BaseApi) GetCompleteDiskInfo(c *gin.Context) {
|
||||||
|
diskInfo, err := diskService.GetCompleteDiskInfo()
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, diskInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Disk Management
|
||||||
|
// @Summary Partition disk
|
||||||
|
// @Description Create partition and format disk with specified filesystem
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.DiskPartitionRequest true "partition request"
|
||||||
|
// @Success 200 {string} string "Partition created successfully"
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/disks/partition [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["device", "filesystem", "mountPoint"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"对磁盘 [device] 进行分区,文件系统 [filesystem],挂载点 [mountPoint]","formatEN":"Partition disk [device] with filesystem [filesystem], mount point [mountPoint]"}
|
||||||
|
func (b *BaseApi) PartitionDisk(c *gin.Context) {
|
||||||
|
var req request.DiskPartitionRequest
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := diskService.PartitionDisk(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.SuccessWithData(c, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Disk Management
|
||||||
|
// @Summary Mount disk
|
||||||
|
// @Description Mount partition to specified mount point
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.DiskMountRequest true "mount request"
|
||||||
|
// @Success 200 {string} string "Disk mounted successfully"
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/disks/mount [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["device", "mountPoint"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"挂载磁盘 [device] 到 [mountPoint]","formatEN":"Mount disk [device] to [mountPoint]"}
|
||||||
|
func (b *BaseApi) MountDisk(c *gin.Context) {
|
||||||
|
var req request.DiskMountRequest
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err := diskService.MountDisk(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Disk Management
|
||||||
|
// @Summary Unmount disk
|
||||||
|
// @Description Unmount partition from mount point
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.DiskUnmountRequest true "unmount request"
|
||||||
|
// @Success 200 {string} string "Disk unmounted successfully"
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/disks/unmount [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["device", "mountPoint"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"卸载磁盘 [device] 从 [mountPoint]","formatEN":"Unmount disk [device] from [mountPoint]"}
|
||||||
|
func (b *BaseApi) UnmountDisk(c *gin.Context) {
|
||||||
|
var req request.DiskUnmountRequest
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err := diskService.UnmountDisk(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
// @Tags Container Docker
|
// @Tags Container Docker
|
||||||
// @Summary Load docker status
|
// @Summary Load docker status
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {string} dto.DockerStatus
|
// @Success 200 {object} dto.DockerStatus
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/docker/status [get]
|
// @Router /containers/docker/status [get]
|
||||||
@@ -24,7 +24,7 @@ func (b *BaseApi) LoadDockerStatus(c *gin.Context) {
|
|||||||
// @Tags Container Docker
|
// @Tags Container Docker
|
||||||
// @Summary Load docker daemon.json
|
// @Summary Load docker daemon.json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {object} string
|
// @Success 200 {string} string
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/daemonjson/file [get]
|
// @Router /containers/daemonjson/file [get]
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ var (
|
|||||||
appInstallService = service.NewIAppInstalledService()
|
appInstallService = service.NewIAppInstalledService()
|
||||||
appIgnoreUpgradeService = service.NewIAppIgnoreUpgradeService()
|
appIgnoreUpgradeService = service.NewIAppIgnoreUpgradeService()
|
||||||
|
|
||||||
aiToolService = service.NewIAIToolService()
|
aiToolService = service.NewIAIToolService()
|
||||||
mcpServerService = service.NewIMcpServerService()
|
mcpServerService = service.NewIMcpServerService()
|
||||||
|
tensorrtLLMService = service.NewITensorRTLLMService()
|
||||||
|
agentService = service.NewIAgentService()
|
||||||
|
|
||||||
containerService = service.NewIContainerService()
|
containerService = service.NewIContainerService()
|
||||||
composeTemplateService = service.NewIComposeTemplateService()
|
composeTemplateService = service.NewIComposeTemplateService()
|
||||||
@@ -37,7 +39,9 @@ var (
|
|||||||
fileService = service.NewIFileService()
|
fileService = service.NewIFileService()
|
||||||
sshService = service.NewISSHService()
|
sshService = service.NewISSHService()
|
||||||
firewallService = service.NewIFirewallService()
|
firewallService = service.NewIFirewallService()
|
||||||
|
iptablesService = service.NewIIptablesService()
|
||||||
monitorService = service.NewIMonitorService()
|
monitorService = service.NewIMonitorService()
|
||||||
|
systemService = service.NewISystemService()
|
||||||
|
|
||||||
deviceService = service.NewIDeviceService()
|
deviceService = service.NewIDeviceService()
|
||||||
fail2banService = service.NewIFail2BanService()
|
fail2banService = service.NewIFail2BanService()
|
||||||
@@ -70,4 +74,7 @@ var (
|
|||||||
websiteCAService = service.NewIWebsiteCAService()
|
websiteCAService = service.NewIWebsiteCAService()
|
||||||
taskService = service.NewITaskService()
|
taskService = service.NewITaskService()
|
||||||
groupService = service.NewIGroupService()
|
groupService = service.NewIGroupService()
|
||||||
|
alertService = service.NewIAlertService()
|
||||||
|
|
||||||
|
diskService = service.NewIDiskService()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func (b *BaseApi) LoadFail2BanBaseInfo(c *gin.Context) {
|
|||||||
// @Summary Page fail2ban ip list
|
// @Summary Page fail2ban ip list
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.Fail2BanSearch true "request"
|
// @Param request body dto.Fail2BanSearch true "request"
|
||||||
// @Success 200 {Array} string
|
// @Success 200 {array} string
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /toolbox/fail2ban/search [post]
|
// @Router /toolbox/fail2ban/search [post]
|
||||||
@@ -51,6 +51,7 @@ func (b *BaseApi) SearchFail2Ban(c *gin.Context) {
|
|||||||
// @Summary Operate fail2ban
|
// @Summary Operate fail2ban
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.Operate true "request"
|
// @Param request body dto.Operate true "request"
|
||||||
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /toolbox/fail2ban/operate [post]
|
// @Router /toolbox/fail2ban/operate [post]
|
||||||
@@ -72,7 +73,8 @@ func (b *BaseApi) OperateFail2Ban(c *gin.Context) {
|
|||||||
// @Tags Fail2ban
|
// @Tags Fail2ban
|
||||||
// @Summary Operate sshd of fail2ban
|
// @Summary Operate sshd of fail2ban
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.Operate true "request"
|
// @Param request body dto.Fail2BanSet true "request"
|
||||||
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /toolbox/fail2ban/operate/sshd [post]
|
// @Router /toolbox/fail2ban/operate/sshd [post]
|
||||||
|
|||||||
+120
-6
@@ -90,7 +90,7 @@ func (b *BaseApi) GetFileTree(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, tree)
|
helper.SuccessWithDataGzipped(c, tree)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags File
|
// @Tags File
|
||||||
@@ -265,6 +265,33 @@ func (b *BaseApi) GetContent(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if info.Size > 2*1024 && info.Size < 5*1024*1024 {
|
||||||
|
helper.SuccessWithDataGzipped(c, info)
|
||||||
|
} else {
|
||||||
|
helper.SuccessWithData(c, info)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags File
|
||||||
|
// @Summary Preview file content
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.FileContentReq true "request"
|
||||||
|
// @Success 200 {object} response.FileInfo
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /files/preview [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["path"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"预览文件内容 [path]","formatEN":"Preview file content [path]"}
|
||||||
|
func (b *BaseApi) PreviewContent(c *gin.Context) {
|
||||||
|
var req request.FileContentReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
info, err := fileService.GetPreviewContent(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
helper.SuccessWithData(c, info)
|
helper.SuccessWithData(c, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +323,7 @@ func (b *BaseApi) SaveContent(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /files/upload [post]
|
// @Router /files/upload [post]
|
||||||
// @x-panel-log {"bodyKeys":["path"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"上传文件 [path]","formatEN":"Upload file [path]"}
|
// @x-panel-log {"bodyKeys":["path", "file"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"上传文件 [path]/[file]","formatEN":"Upload file [path]/[file]"}
|
||||||
func (b *BaseApi) UploadFiles(c *gin.Context) {
|
func (b *BaseApi) UploadFiles(c *gin.Context) {
|
||||||
form, err := c.MultipartForm()
|
form, err := c.MultipartForm()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -521,9 +548,14 @@ func (b *BaseApi) Download(c *gin.Context) {
|
|||||||
file, err := os.Open(filePath)
|
file, err := os.Open(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
info, _ := file.Stat()
|
info, err := file.Stat()
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
c.Header("Content-Length", strconv.FormatInt(info.Size(), 10))
|
c.Header("Content-Length", strconv.FormatInt(info.Size(), 10))
|
||||||
c.Header("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(info.Name()))
|
c.Header("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(info.Name()))
|
||||||
http.ServeContent(c.Writer, c.Request, info.Name(), info.ModTime(), file)
|
http.ServeContent(c.Writer, c.Request, info.Name(), info.ModTime(), file)
|
||||||
@@ -841,7 +873,11 @@ func (b *BaseApi) ReadFileByLine(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, res)
|
if res.TotalLines > 100 {
|
||||||
|
helper.SuccessWithDataGzipped(c, res)
|
||||||
|
} else {
|
||||||
|
helper.SuccessWithData(c, res)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags File
|
// @Tags File
|
||||||
@@ -880,7 +916,7 @@ func (b *BaseApi) GetPathByType(c *gin.Context) {
|
|||||||
// @Success 200 {object} dto.DiskInfo
|
// @Success 200 {object} dto.DiskInfo
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mount [post]
|
// @Router /files/mount [post]
|
||||||
func (b *BaseApi) GetHostMount(c *gin.Context) {
|
func (b *BaseApi) GetHostMount(c *gin.Context) {
|
||||||
disks := fileService.GetHostMount()
|
disks := fileService.GetHostMount()
|
||||||
helper.SuccessWithData(c, disks)
|
helper.SuccessWithData(c, disks)
|
||||||
@@ -892,7 +928,7 @@ func (b *BaseApi) GetHostMount(c *gin.Context) {
|
|||||||
// @Success 200 {object} response.UserGroupResponse
|
// @Success 200 {object} response.UserGroupResponse
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /user/group [post]
|
// @Router /files/user/group [post]
|
||||||
func (b *BaseApi) GetUsersAndGroups(c *gin.Context) {
|
func (b *BaseApi) GetUsersAndGroups(c *gin.Context) {
|
||||||
res, err := fileService.GetUsersAndGroups()
|
res, err := fileService.GetUsersAndGroups()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -901,3 +937,81 @@ func (b *BaseApi) GetUsersAndGroups(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
helper.SuccessWithData(c, res)
|
helper.SuccessWithData(c, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags File
|
||||||
|
// @Summary Convert file
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.FileConvert true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /files/convert [post]
|
||||||
|
func (b *BaseApi) ConvertFile(c *gin.Context) {
|
||||||
|
var req request.FileConvertRequest
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fileService.Convert(req)
|
||||||
|
helper.SuccessWithData(c, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags File
|
||||||
|
// @Summary Convert file
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.PageInfo true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /files/convert/log [post]
|
||||||
|
func (b *BaseApi) ConvertLog(c *gin.Context) {
|
||||||
|
var req dto.PageInfo
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
total, logs, err := fileService.ConvertLog(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, dto.PageResult{
|
||||||
|
Items: logs,
|
||||||
|
Total: total,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags File
|
||||||
|
// @Summary Batch get file remarks
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.FileRemarkBatch true "request"
|
||||||
|
// @Success 200 {object} response.FileRemarksRes
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /files/remarks [post]
|
||||||
|
func (b *BaseApi) BatchGetFileRemarks(c *gin.Context) {
|
||||||
|
var req request.FileRemarkBatch
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
remarks := fileService.BatchGetRemarks(req)
|
||||||
|
helper.SuccessWithData(c, response.FileRemarksRes{Remarks: remarks})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags File
|
||||||
|
// @Summary Set file remark
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.FileRemarkUpdate true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /files/remark [post]
|
||||||
|
func (b *BaseApi) SetFileRemark(c *gin.Context) {
|
||||||
|
var req request.FileRemarkUpdate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := fileService.SetRemark(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,12 +8,19 @@ import (
|
|||||||
|
|
||||||
// @Tags Firewall
|
// @Tags Firewall
|
||||||
// @Summary Load firewall base info
|
// @Summary Load firewall base info
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.OperationWithName true "request"
|
||||||
// @Success 200 {object} dto.FirewallBaseInfo
|
// @Success 200 {object} dto.FirewallBaseInfo
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/firewall/base [get]
|
// @Router /hosts/firewall/base [post]
|
||||||
func (b *BaseApi) LoadFirewallBaseInfo(c *gin.Context) {
|
func (b *BaseApi) LoadFirewallBaseInfo(c *gin.Context) {
|
||||||
data, err := firewallService.LoadBaseInfo()
|
var req dto.OperationWithName
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := firewallService.LoadBaseInfo(req.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
@@ -63,7 +70,7 @@ func (b *BaseApi) OperateFirewall(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := firewallService.OperateFirewall(req.Operation); err != nil {
|
if err := firewallService.OperateFirewall(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -95,14 +102,14 @@ func (b *BaseApi) OperatePortRule(c *gin.Context) {
|
|||||||
|
|
||||||
// OperateForwardRule
|
// OperateForwardRule
|
||||||
// @Tags Firewall
|
// @Tags Firewall
|
||||||
// @Summary Create group
|
// @Summary Operate forward rule
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.ForwardRuleOperate true "request"
|
// @Param request body dto.ForwardRuleOperate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/firewall/forward [post]
|
// @Router /hosts/firewall/forward [post]
|
||||||
// @x-panel-log {"bodyKeys":["source_port"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新端口转发规则 [source_port]","formatEN":"update port forward rules [source_port]"}
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新端口转发规则","formatEN":"update port forward rules"}
|
||||||
func (b *BaseApi) OperateForwardRule(c *gin.Context) {
|
func (b *BaseApi) OperateForwardRule(c *gin.Context) {
|
||||||
var req dto.ForwardRuleOperate
|
var req dto.ForwardRuleOperate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -117,7 +124,7 @@ func (b *BaseApi) OperateForwardRule(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Firewall
|
// @Tags Firewall
|
||||||
// @Summary Create group
|
// @Summary Operate Ip rule
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.AddrRuleOperate true "request"
|
// @Param request body dto.AddrRuleOperate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
@@ -139,7 +146,7 @@ func (b *BaseApi) OperateIPRule(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Firewall
|
// @Tags Firewall
|
||||||
// @Summary Create group
|
// @Summary Batch operate rule
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.BatchRuleOperate true "request"
|
// @Param request body dto.BatchRuleOperate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
@@ -181,7 +188,7 @@ func (b *BaseApi) UpdateFirewallDescription(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Firewall
|
// @Tags Firewall
|
||||||
// @Summary Create group
|
// @Summary Update port rule
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.PortRuleUpdate true "request"
|
// @Param request body dto.PortRuleUpdate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
@@ -202,7 +209,7 @@ func (b *BaseApi) UpdatePortRule(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Firewall
|
// @Tags Firewall
|
||||||
// @Summary Create group
|
// @Summary Update Ip rule
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.AddrRuleUpdate true "request"
|
// @Param request body dto.AddrRuleUpdate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
@@ -221,3 +228,112 @@ func (b *BaseApi) UpdateAddrRule(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Firewall
|
||||||
|
// @Summary search iptables filter rules
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.SearchPageWithType true "request"
|
||||||
|
// @Success 200 {object} dto.PageResult
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/firewall/filter/search [post]
|
||||||
|
func (b *BaseApi) SearchFilterRules(c *gin.Context) {
|
||||||
|
var req dto.SearchPageWithType
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
total, list, err := iptablesService.Search(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.SuccessWithData(c, dto.PageResult{
|
||||||
|
Items: list,
|
||||||
|
Total: total,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Firewall
|
||||||
|
// @Summary Operate iptables filter rule
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.IptablesRuleOp true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/firewall/filter/rule/operate [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["operation","chain"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operation] filter规则到 [chain]","formatEN":"[operation] filter rule to [chain]"}
|
||||||
|
func (b *BaseApi) OperateFilterRule(c *gin.Context) {
|
||||||
|
var req dto.IptablesRuleOp
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := iptablesService.OperateRule(req, true); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Firewall
|
||||||
|
// @Summary Batch operate iptables filter rules
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.IptablesBatchOperate true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/firewall/filter/rule/batch [post]
|
||||||
|
func (b *BaseApi) BatchOperateFilterRule(c *gin.Context) {
|
||||||
|
var req dto.IptablesBatchOperate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := iptablesService.BatchOperate(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Firewall
|
||||||
|
// @Summary Apply/Unload/Init iptables filter
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.IptablesOp true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/firewall/filter/operate [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["operate"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operate] iptables filter 防火墙","formatEN":"[operate] iptables filter firewall"}
|
||||||
|
func (b *BaseApi) OperateFilterChain(c *gin.Context) {
|
||||||
|
var req dto.IptablesOp
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := iptablesService.Operate(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Firewall
|
||||||
|
// @Summary load chain status with name
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.OperationWithName true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/firewall/filter/chain/status [post]
|
||||||
|
func (b *BaseApi) LoadChainStatus(c *gin.Context) {
|
||||||
|
var req dto.OperationWithName
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.SuccessWithData(c, iptablesService.LoadChainStatus(req))
|
||||||
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ func (b *BaseApi) LoadFtpLogInfo(c *gin.Context) {
|
|||||||
// @Summary Operate FTP
|
// @Summary Operate FTP
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.Operate true "request"
|
// @Param request body dto.Operate true "request"
|
||||||
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /toolbox/ftp/operate [post]
|
// @Router /toolbox/ftp/operate [post]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /agent/groups [post]
|
// @Router /groups [post]
|
||||||
// @x-panel-log {"bodyKeys":["name","type"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建组 [name][type]","formatEN":"create group [name][type]"}
|
// @x-panel-log {"bodyKeys":["name","type"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建组 [name][type]","formatEN":"create group [name][type]"}
|
||||||
func (b *BaseApi) CreateGroup(c *gin.Context) {
|
func (b *BaseApi) CreateGroup(c *gin.Context) {
|
||||||
var req dto.GroupCreate
|
var req dto.GroupCreate
|
||||||
@@ -35,7 +35,7 @@ func (b *BaseApi) CreateGroup(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /agent/groups/del [post]
|
// @Router /groups/del [post]
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"groups","output_column":"name","output_value":"name"},{"input_column":"id","input_value":"id","isList":false,"db":"groups","output_column":"type","output_value":"type"}],"formatZH":"删除组 [type][name]","formatEN":"delete group [type][name]"}
|
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"groups","output_column":"name","output_value":"name"},{"input_column":"id","input_value":"id","isList":false,"db":"groups","output_column":"type","output_value":"type"}],"formatZH":"删除组 [type][name]","formatEN":"delete group [type][name]"}
|
||||||
func (b *BaseApi) DeleteGroup(c *gin.Context) {
|
func (b *BaseApi) DeleteGroup(c *gin.Context) {
|
||||||
var req dto.OperateByID
|
var req dto.OperateByID
|
||||||
@@ -57,7 +57,7 @@ func (b *BaseApi) DeleteGroup(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /agent/groups/update [post]
|
// @Router /groups/update [post]
|
||||||
// @x-panel-log {"bodyKeys":["name","type"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新组 [name][type]","formatEN":"update group [name][type]"}
|
// @x-panel-log {"bodyKeys":["name","type"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新组 [name][type]","formatEN":"update group [name][type]"}
|
||||||
func (b *BaseApi) UpdateGroup(c *gin.Context) {
|
func (b *BaseApi) UpdateGroup(c *gin.Context) {
|
||||||
var req dto.GroupUpdate
|
var req dto.GroupUpdate
|
||||||
@@ -79,7 +79,7 @@ func (b *BaseApi) UpdateGroup(c *gin.Context) {
|
|||||||
// @Success 200 {array} dto.OperateByType
|
// @Success 200 {array} dto.OperateByType
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /agent/groups/search [post]
|
// @Router /groups/search [post]
|
||||||
func (b *BaseApi) ListGroup(c *gin.Context) {
|
func (b *BaseApi) ListGroup(c *gin.Context) {
|
||||||
var req dto.OperateByType
|
var req dto.OperateByType
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
package helper
|
package helper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"compress/gzip"
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
"github.com/1Panel-dev/1Panel/agent/global"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@@ -46,6 +50,42 @@ func SuccessWithData(ctx *gin.Context, data interface{}) {
|
|||||||
ctx.Abort()
|
ctx.Abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var gzipWriterPool = sync.Pool{
|
||||||
|
New: func() interface{} {
|
||||||
|
return gzip.NewWriter(nil)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func SuccessWithDataGzipped(ctx *gin.Context, data interface{}) {
|
||||||
|
if !strings.Contains(ctx.GetHeader("Accept-Encoding"), "gzip") {
|
||||||
|
SuccessWithData(ctx, data)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if data == nil {
|
||||||
|
data = gin.H{}
|
||||||
|
}
|
||||||
|
res := dto.Response{
|
||||||
|
Code: http.StatusOK,
|
||||||
|
Data: data,
|
||||||
|
}
|
||||||
|
jsonBytes, err := json.Marshal(res)
|
||||||
|
if err != nil {
|
||||||
|
ErrorWithDetail(ctx, http.StatusInternalServerError, "ErrInternalServer", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Header("Content-Encoding", "gzip")
|
||||||
|
ctx.Header("Content-Type", "application/json; charset=utf-8")
|
||||||
|
ctx.Status(http.StatusOK)
|
||||||
|
|
||||||
|
gz := gzipWriterPool.Get().(*gzip.Writer)
|
||||||
|
gz.Reset(ctx.Writer)
|
||||||
|
_, _ = gz.Write(jsonBytes)
|
||||||
|
_ = gz.Close()
|
||||||
|
gzipWriterPool.Put(gz)
|
||||||
|
ctx.Abort()
|
||||||
|
}
|
||||||
|
|
||||||
func Success(ctx *gin.Context) {
|
func Success(ctx *gin.Context) {
|
||||||
res := dto.Response{
|
res := dto.Response{
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
@@ -116,7 +156,11 @@ func CheckBind(req interface{}, c *gin.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ErrResponse(ctx *gin.Context, code int) {
|
func GetParamInt32(paramName string, c *gin.Context) (int32, error) {
|
||||||
ctx.JSON(code, nil)
|
idParam, ok := c.Params.Get(paramName)
|
||||||
ctx.Abort()
|
if !ok {
|
||||||
|
return 0, errors.New("error id in path")
|
||||||
|
}
|
||||||
|
intNum, _ := strconv.Atoi(idParam)
|
||||||
|
return int32(intNum), nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func (b *BaseApi) GetToolStatus(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/tool/create [post]
|
// @Router /hosts/tool/init [post]
|
||||||
// @x-panel-log {"bodyKeys":["type"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建 [type] 配置","formatEN":"create [type] config"}
|
// @x-panel-log {"bodyKeys":["type"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建 [type] 配置","formatEN":"create [type] config"}
|
||||||
func (b *BaseApi) InitToolConfig(c *gin.Context) {
|
func (b *BaseApi) InitToolConfig(c *gin.Context) {
|
||||||
var req request.HostToolCreate
|
var req request.HostToolCreate
|
||||||
@@ -95,28 +95,6 @@ func (b *BaseApi) OperateToolConfig(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, config)
|
helper.SuccessWithData(c, config)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Host tool
|
|
||||||
// @Summary Get tool logs
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.HostToolLogReq true "request"
|
|
||||||
// @Success 200 {string} logContent
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/tool/log [post]
|
|
||||||
func (b *BaseApi) GetToolLog(c *gin.Context) {
|
|
||||||
var req request.HostToolLogReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
logContent, err := hostToolService.GetToolLog(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, logContent)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Host tool
|
// @Tags Host tool
|
||||||
// @Summary Create Supervisor process
|
// @Summary Create Supervisor process
|
||||||
// @Accept json
|
// @Accept json
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ import (
|
|||||||
// @Tags Container Image
|
// @Tags Container Image
|
||||||
// @Summary Page images
|
// @Summary Page images
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.SearchWithPage true "request"
|
// @Param request body dto.PageImage true "request"
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {object} dto.PageResult
|
// @Success 200 {object} dto.PageResult
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/image/search [post]
|
// @Router /containers/image/search [post]
|
||||||
func (b *BaseApi) SearchImage(c *gin.Context) {
|
func (b *BaseApi) SearchImage(c *gin.Context) {
|
||||||
var req dto.SearchWithPage
|
var req dto.PageImage
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ func (b *BaseApi) ImagePush(c *gin.Context) {
|
|||||||
// @Summary Delete image
|
// @Summary Delete image
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.BatchDelete true "request"
|
// @Param request body dto.BatchDelete true "request"
|
||||||
// @Success 200 {object} dto.ContainerPruneReport
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/image/remove [post]
|
// @Router /containers/image/remove [post]
|
||||||
@@ -149,13 +149,12 @@ func (b *BaseApi) ImageRemove(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := imageService.ImageRemove(req)
|
if err := imageService.ImageRemove(req); err != nil {
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.SuccessWithData(c, data)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Container Image
|
// @Tags Container Image
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func (b *BaseApi) ListRepo(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/repo/status [get]
|
// @Router /containers/repo/status [post]
|
||||||
func (b *BaseApi) CheckRepoStatus(c *gin.Context) {
|
func (b *BaseApi) CheckRepoStatus(c *gin.Context) {
|
||||||
var req dto.OperateByID
|
var req dto.OperateByID
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -98,20 +98,20 @@ func (b *BaseApi) CreateRepo(c *gin.Context) {
|
|||||||
// @Tags Container Image-repo
|
// @Tags Container Image-repo
|
||||||
// @Summary Delete image repo
|
// @Summary Delete image repo
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.ImageRepoDelete true "request"
|
// @Param request body dto.OperateByID true "request"
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /containers/repo/del [post]
|
// @Router /containers/repo/del [post]
|
||||||
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"ids","isList":true,"db":"image_repos","output_column":"name","output_value":"names"}],"formatZH":"删除镜像仓库 [names]","formatEN":"delete image repo [names]"}
|
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"image_repos","output_column":"name","output_value":"name"}],"formatZH":"删除镜像仓库 [name]","formatEN":"delete image repo [name]"}
|
||||||
func (b *BaseApi) DeleteRepo(c *gin.Context) {
|
func (b *BaseApi) DeleteRepo(c *gin.Context) {
|
||||||
var req dto.ImageRepoDelete
|
var req dto.OperateByID
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := imageRepoService.BatchDelete(req); err != nil {
|
if err := imageRepoService.Delete(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
// @Success 200 {object} response.McpServersRes
|
// @Success 200 {object} response.McpServersRes
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mcp/search [post]
|
// @Router /ai/mcp/search [post]
|
||||||
func (b *BaseApi) PageMcpServers(c *gin.Context) {
|
func (b *BaseApi) PageMcpServers(c *gin.Context) {
|
||||||
var req request.McpServerSearch
|
var req request.McpServerSearch
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -30,7 +30,7 @@ func (b *BaseApi) PageMcpServers(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mcp/server [post]
|
// @Router /ai/mcp/server [post]
|
||||||
func (b *BaseApi) CreateMcpServer(c *gin.Context) {
|
func (b *BaseApi) CreateMcpServer(c *gin.Context) {
|
||||||
var req request.McpServerCreate
|
var req request.McpServerCreate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -51,7 +51,7 @@ func (b *BaseApi) CreateMcpServer(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mcp/server/update [post]
|
// @Router /ai/mcp/server/update [post]
|
||||||
func (b *BaseApi) UpdateMcpServer(c *gin.Context) {
|
func (b *BaseApi) UpdateMcpServer(c *gin.Context) {
|
||||||
var req request.McpServerUpdate
|
var req request.McpServerUpdate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -72,7 +72,7 @@ func (b *BaseApi) UpdateMcpServer(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mcp/server/del [post]
|
// @Router /ai/mcp/server/del [post]
|
||||||
func (b *BaseApi) DeleteMcpServer(c *gin.Context) {
|
func (b *BaseApi) DeleteMcpServer(c *gin.Context) {
|
||||||
var req request.McpServerDelete
|
var req request.McpServerDelete
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -93,7 +93,7 @@ func (b *BaseApi) DeleteMcpServer(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mcp/server/op [post]
|
// @Router /ai/mcp/server/op [post]
|
||||||
func (b *BaseApi) OperateMcpServer(c *gin.Context) {
|
func (b *BaseApi) OperateMcpServer(c *gin.Context) {
|
||||||
var req request.McpServerOperate
|
var req request.McpServerOperate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -114,7 +114,7 @@ func (b *BaseApi) OperateMcpServer(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mcp/domain/bind [post]
|
// @Router /ai/mcp/domain/bind [post]
|
||||||
func (b *BaseApi) BindMcpDomain(c *gin.Context) {
|
func (b *BaseApi) BindMcpDomain(c *gin.Context) {
|
||||||
var req request.McpBindDomain
|
var req request.McpBindDomain
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -135,7 +135,7 @@ func (b *BaseApi) BindMcpDomain(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mcp/domain/update [post]
|
// @Router /ai/mcp/domain/update [post]
|
||||||
func (b *BaseApi) UpdateMcpBindDomain(c *gin.Context) {
|
func (b *BaseApi) UpdateMcpBindDomain(c *gin.Context) {
|
||||||
var req request.McpBindDomainUpdate
|
var req request.McpBindDomainUpdate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -155,7 +155,7 @@ func (b *BaseApi) UpdateMcpBindDomain(c *gin.Context) {
|
|||||||
// @Success 200 {object} response.McpBindDomainRes
|
// @Success 200 {object} response.McpBindDomainRes
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /mcp/domain/get [get]
|
// @Router /ai/mcp/domain/get [get]
|
||||||
func (b *BaseApi) GetMcpBindDomain(c *gin.Context) {
|
func (b *BaseApi) GetMcpBindDomain(c *gin.Context) {
|
||||||
res, err := mcpServerService.GetBindDomain()
|
res, err := mcpServerService.GetBindDomain()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/shirou/gopsutil/v3/disk"
|
"github.com/shirou/gopsutil/v4/disk"
|
||||||
"github.com/shirou/gopsutil/v3/net"
|
"github.com/shirou/gopsutil/v4/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Tags Monitor
|
// @Tags Monitor
|
||||||
@@ -28,6 +28,27 @@ func (b *BaseApi) LoadMonitor(c *gin.Context) {
|
|||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
helper.SuccessWithDataGzipped(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Monitor
|
||||||
|
// @Summary Load monitor data
|
||||||
|
// @Param request body dto.MonitorGPUSearch true "request"
|
||||||
|
// @Success 200 {object} dto.MonitorGPUData
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/monitor/gpu/search [post]
|
||||||
|
func (b *BaseApi) LoadGPUMonitor(c *gin.Context) {
|
||||||
|
var req dto.MonitorGPUSearch
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := monitorService.LoadGPUMonitorData(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithData(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,3 +126,7 @@ func (b *BaseApi) GetIOOptions(c *gin.Context) {
|
|||||||
sort.Strings(options)
|
sort.Strings(options)
|
||||||
helper.SuccessWithData(c, options)
|
helper.SuccessWithData(c, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) GetCPUOptions(c *gin.Context) {
|
||||||
|
helper.SuccessWithData(c, monitorService.LoadGPUOptions())
|
||||||
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ func (b *BaseApi) BuildNginx(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /openresty/module/update [post]
|
// @Router /openresty/modules/update [post]
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 OpenResty 模块","formatEN":"Update OpenResty module"}
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 OpenResty 模块","formatEN":"Update OpenResty module"}
|
||||||
func (b *BaseApi) UpdateNginxModule(c *gin.Context) {
|
func (b *BaseApi) UpdateNginxModule(c *gin.Context) {
|
||||||
var req request.NginxModuleUpdate
|
var req request.NginxModuleUpdate
|
||||||
@@ -157,3 +157,39 @@ func (b *BaseApi) GetNginxModules(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
helper.SuccessWithData(c, modules)
|
helper.SuccessWithData(c, modules)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags OpenResty
|
||||||
|
// @Summary Operate default HTTPs
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.NginxDefaultHTTPSUpdate true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /openresty/https [post]
|
||||||
|
func (b *BaseApi) OperateDefaultHTTPs(c *gin.Context) {
|
||||||
|
var req request.NginxDefaultHTTPSUpdate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := nginxService.OperateDefaultHTTPs(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags OpenResty
|
||||||
|
// @Summary Get default HTTPs status
|
||||||
|
// @Success 200 {object} response.NginxConfigRes
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /openresty/https [get]
|
||||||
|
func (b *BaseApi) GetDefaultHTTPsStatus(c *gin.Context) {
|
||||||
|
res, err := nginxService.GetDefaultHttpsStatus()
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, res)
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,3 +36,39 @@ func (b *BaseApi) StopProcess(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Process
|
||||||
|
// @Summary Get Process Info By PID
|
||||||
|
// @Param pid path int true "PID"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /process/{pid} [get]
|
||||||
|
func (b *BaseApi) GetProcessInfoByPID(c *gin.Context) {
|
||||||
|
pid, err := helper.GetParamInt32("pid", c)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := processService.GetProcessInfoByPID(pid)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Process
|
||||||
|
// @Summary Get Listening Process
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /process/listening [post]
|
||||||
|
func (b *BaseApi) GetListeningProcess(c *gin.Context) {
|
||||||
|
procs, err := processService.GetListeningProcess(c)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, procs)
|
||||||
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ func (b *BaseApi) DeleteRuntime(c *gin.Context) {
|
|||||||
// @Success 200 {array} dto.AppResource
|
// @Success 200 {array} dto.AppResource
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /installed/delete/check/:id [get]
|
// @Router /runtimes/installed/delete/check/:id [get]
|
||||||
func (b *BaseApi) DeleteRuntimeCheck(c *gin.Context) {
|
func (b *BaseApi) DeleteRuntimeCheck(c *gin.Context) {
|
||||||
runTimeId, err := helper.GetIntParamByKey(c, "id")
|
runTimeId, err := helper.GetIntParamByKey(c, "id")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -459,7 +459,7 @@ func (b *BaseApi) GetSupervisorProcess(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /runtimes/supervisor/process/operate [post]
|
// @Router /runtimes/supervisor/process [post]
|
||||||
func (b *BaseApi) OperateSupervisorProcess(c *gin.Context) {
|
func (b *BaseApi) OperateSupervisorProcess(c *gin.Context) {
|
||||||
var req request.PHPSupervisorProcessConfig
|
var req request.PHPSupervisorProcessConfig
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -480,7 +480,7 @@ func (b *BaseApi) OperateSupervisorProcess(c *gin.Context) {
|
|||||||
// @Success 200 {string} content
|
// @Success 200 {string} content
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /runtimes/supervisor/process/file/operate [post]
|
// @Router /runtimes/supervisor/process/file [post]
|
||||||
func (b *BaseApi) OperateSupervisorProcessFile(c *gin.Context) {
|
func (b *BaseApi) OperateSupervisorProcessFile(c *gin.Context) {
|
||||||
var req request.PHPSupervisorProcessFileReq
|
var req request.PHPSupervisorProcessFileReq
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -497,7 +497,7 @@ func (b *BaseApi) OperateSupervisorProcessFile(c *gin.Context) {
|
|||||||
// @Tags Runtime
|
// @Tags Runtime
|
||||||
// @Summary Update PHP container config
|
// @Summary Update PHP container config
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body request.PHPContainerUpdate true "request"
|
// @Param request body request.PHPContainerConfig true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
@@ -518,7 +518,7 @@ func (b *BaseApi) UpdatePHPContainer(c *gin.Context) {
|
|||||||
// @Summary Get PHP container config
|
// @Summary Get PHP container config
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param id path integer true "request"
|
// @Param id path integer true "request"
|
||||||
// @Success 200 {object} response.PHPContainerConfig
|
// @Success 200 {object} request.PHPContainerConfig
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /runtimes/php/container/:id [get]
|
// @Router /runtimes/php/container/:id [get]
|
||||||
@@ -535,3 +535,45 @@ func (b *BaseApi) GetPHPContainerConfig(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithData(c, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Runtime
|
||||||
|
// @Summary Update runtime remark
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.RuntimeRemark true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /runtimes/remark [post]
|
||||||
|
func (b *BaseApi) UpdateRuntimeRemark(c *gin.Context) {
|
||||||
|
var req request.RuntimeRemark
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := runtimeService.UpdateRemark(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Runtime
|
||||||
|
// @Summary Get PHP runtime status
|
||||||
|
// @Accept json
|
||||||
|
// @Param id path integer true "request"
|
||||||
|
// @Success 200 {object} map[string]interface{}
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /runtimes/php/fpm/status/:id [get]
|
||||||
|
func (b *BaseApi) GetFPMStatus(c *gin.Context) {
|
||||||
|
id, err := helper.GetParamID(c)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := runtimeService.GetFPMStatus(id)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, data)
|
||||||
|
}
|
||||||
|
|||||||
+79
-37
@@ -2,12 +2,10 @@ package v2
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"os"
|
|
||||||
"os/user"
|
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
"github.com/1Panel-dev/1Panel/agent/global"
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/ssh"
|
"github.com/1Panel-dev/1Panel/agent/utils/ssh"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -71,14 +69,49 @@ func (b *BaseApi) LoadBaseDir(c *gin.Context) {
|
|||||||
helper.SuccessWithData(c, global.Dir.DataDir)
|
helper.SuccessWithData(c, global.Dir.DataDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags System Setting
|
||||||
|
// @Summary Load local conn
|
||||||
|
// @Success 200 {object} dto.SSHConnData
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /settings/ssh/conn [get]
|
||||||
|
func (b *BaseApi) LoadLocalConn(c *gin.Context) {
|
||||||
|
helper.SuccessWithData(c, settingService.GetLocalConn())
|
||||||
|
}
|
||||||
|
|
||||||
func (b *BaseApi) CheckLocalConn(c *gin.Context) {
|
func (b *BaseApi) CheckLocalConn(c *gin.Context) {
|
||||||
_, err := loadLocalConn()
|
client, err := loadLocalConn()
|
||||||
|
if err == nil && client != nil {
|
||||||
|
client.Close()
|
||||||
|
}
|
||||||
helper.SuccessWithData(c, err == nil)
|
helper.SuccessWithData(c, err == nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags System Setting
|
||||||
|
// @Summary Update local is conn
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.SSHDefaultConn true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /settings/ssh/conn/default [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["defaultConn"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"本地终端默认连接 [defaultConn]","formatEN":"update system default conn [defaultConn]"}
|
||||||
|
func (b *BaseApi) SetDefaultIsConn(c *gin.Context) {
|
||||||
|
var req dto.SSHDefaultConn
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := settingService.SetDefaultIsConn(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags System Setting
|
// @Tags System Setting
|
||||||
// @Summary Check local conn info
|
// @Summary Check local conn info
|
||||||
// @Success 200 {bool} isOk
|
// @Success 200 {boolean} isOk
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /settings/ssh/check/info [post]
|
// @Router /settings/ssh/check/info [post]
|
||||||
@@ -87,6 +120,7 @@ func (b *BaseApi) CheckLocalConnByInfo(c *gin.Context) {
|
|||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.SuccessWithData(c, settingService.TestConnByInfo(req))
|
helper.SuccessWithData(c, settingService.TestConnByInfo(req))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,51 +130,38 @@ func (b *BaseApi) CheckLocalConnByInfo(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /settings/ssh [post]
|
// @Router /settings/ssh [post]
|
||||||
func (b *BaseApi) SaveLocalConnInfo(c *gin.Context) {
|
func (b *BaseApi) SaveLocalConn(c *gin.Context) {
|
||||||
var req dto.SSHConnData
|
var req dto.SSHConnData
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, settingService.SaveConnInfo(req))
|
|
||||||
|
if err := settingService.SaveConnInfo(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadLocalConn() (*ssh.SSHClient, error) {
|
func loadLocalConn() (*ssh.SSHClient, error) {
|
||||||
itemPath := ""
|
connInfoInDB := settingService.GetSettingByKey("LocalSSHConn")
|
||||||
currentInfo, _ := user.Current()
|
|
||||||
if len(currentInfo.HomeDir) == 0 {
|
|
||||||
itemPath = "/root/.ssh/id_ed25519_1panel"
|
|
||||||
} else {
|
|
||||||
itemPath = path.Join(currentInfo.HomeDir, ".ssh/id_ed25519_1panel")
|
|
||||||
}
|
|
||||||
if _, err := os.Stat(itemPath); err != nil {
|
|
||||||
_ = sshService.GenerateSSH(dto.GenerateSSH{EncryptionMode: "ed25519", Name: "_1panel"})
|
|
||||||
}
|
|
||||||
|
|
||||||
privateKey, _ := os.ReadFile(itemPath)
|
|
||||||
connWithKey := ssh.ConnInfo{
|
|
||||||
Addr: "127.0.0.1",
|
|
||||||
User: "root",
|
|
||||||
Port: 22,
|
|
||||||
AuthMode: "key",
|
|
||||||
PrivateKey: privateKey,
|
|
||||||
}
|
|
||||||
client, err := ssh.NewClient(connWithKey)
|
|
||||||
if err == nil {
|
|
||||||
return client, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
connInfoInDB, err := settingService.GetSSHInfo()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if len(connInfoInDB) == 0 {
|
if len(connInfoInDB) == 0 {
|
||||||
return nil, errors.New("no such ssh conn info in db!")
|
return nil, errors.New("no such ssh conn info in db!")
|
||||||
}
|
}
|
||||||
var connInDB ssh.ConnInfo
|
var connInDB model.LocalConnInfo
|
||||||
if err := json.Unmarshal([]byte(connInfoInDB), &connInDB); err != nil {
|
if err := json.Unmarshal([]byte(connInfoInDB), &connInDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return ssh.NewClient(connInDB)
|
sshInfo := ssh.ConnInfo{
|
||||||
|
Addr: connInDB.Addr,
|
||||||
|
Port: int(connInDB.Port),
|
||||||
|
User: connInDB.User,
|
||||||
|
AuthMode: connInDB.AuthMode,
|
||||||
|
Password: connInDB.Password,
|
||||||
|
PrivateKey: []byte(connInDB.PrivateKey),
|
||||||
|
PassPhrase: []byte(connInDB.PassPhrase),
|
||||||
|
}
|
||||||
|
return ssh.NewClient(sshInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags System Setting
|
// @Tags System Setting
|
||||||
@@ -159,3 +180,24 @@ func (b *BaseApi) GetSettingByKey(c *gin.Context) {
|
|||||||
value := settingService.GetSettingByKey(key)
|
value := settingService.GetSettingByKey(key)
|
||||||
helper.SuccessWithData(c, value)
|
helper.SuccessWithData(c, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags System Setting
|
||||||
|
// @Summary Save common description
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.CommonDescription true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /settings/description/save [post]
|
||||||
|
func (b *BaseApi) SaveDescription(c *gin.Context) {
|
||||||
|
var req dto.CommonDescription
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := settingService.SaveDescription(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func (b *BaseApi) CreateSnapshot(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := snapshotService.SnapshotCreate(nil, req, 0, 0, 0); err != nil {
|
if err := snapshotService.SnapshotCreate(nil, req, 0, 3); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ func (b *BaseApi) CreateSnapshot(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /settings/snapshot/recrete [post]
|
// @Router /settings/snapshot/recreate [post]
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"snapshots","output_column":"name","output_value":"name"}],"formatZH":"重试创建快照 [name]","formatEN":"recrete the snapshot [name]"}
|
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"snapshots","output_column":"name","output_value":"name"}],"formatZH":"重试创建快照 [name]","formatEN":"recrete the snapshot [name]"}
|
||||||
func (b *BaseApi) RecreateSnapshot(c *gin.Context) {
|
func (b *BaseApi) RecreateSnapshot(c *gin.Context) {
|
||||||
var req dto.OperateByID
|
var req dto.OperateByID
|
||||||
|
|||||||
+156
-31
@@ -1,6 +1,8 @@
|
|||||||
package v2
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -51,7 +53,7 @@ func (b *BaseApi) OperateSSH(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/ssh/update [post]
|
// @Router /hosts/ssh/update [post]
|
||||||
// @x-panel-log {"bodyKeys":["key","value"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改 SSH 配置 [key] => [value]","formatEN":"update SSH setting [key] => [value]"}
|
// @x-panel-log {"bodyKeys":["key","newValue"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改 SSH 配置 [key] => [newValue]","formatEN":"update SSH setting [key] => [newValue]"}
|
||||||
func (b *BaseApi) UpdateSSH(c *gin.Context) {
|
func (b *BaseApi) UpdateSSH(c *gin.Context) {
|
||||||
var req dto.SSHUpdate
|
var req dto.SSHUpdate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -66,21 +68,23 @@ func (b *BaseApi) UpdateSSH(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags SSH
|
// @Tags SSH
|
||||||
// @Summary Update host SSH setting by file
|
// @Summary Generate host SSH secret
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.SSHConf true "request"
|
// @Param request body dto.RootCertOperate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/conffile/update [post]
|
// @Router /hosts/ssh/cert [post]
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改 SSH 配置文件","formatEN":"update SSH conf"}
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"生成 SSH 密钥 ","formatEN":"generate SSH secret"}
|
||||||
func (b *BaseApi) UpdateSSHByfile(c *gin.Context) {
|
func (b *BaseApi) CreateRootCert(c *gin.Context) {
|
||||||
var req dto.SSHConf
|
var req dto.RootCertOperate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if err := loadCertAfterDecrypt(&req); err != nil {
|
||||||
if err := sshService.UpdateByFile(req.File); err != nil {
|
helper.BadRequest(c, err)
|
||||||
|
}
|
||||||
|
if err := sshService.CreateRootCert(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -88,21 +92,38 @@ func (b *BaseApi) UpdateSSHByfile(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags SSH
|
// @Tags SSH
|
||||||
// @Summary Generate host SSH secret
|
// @Summary Update host SSH secret
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.GenerateSSH true "request"
|
// @Param request body dto.RootCertOperate true "request"
|
||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/ssh/generate [post]
|
// @Router /hosts/ssh/cert/update [post]
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"生成 SSH 密钥 ","formatEN":"generate SSH secret"}
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"生成 SSH 密钥 ","formatEN":"generate SSH secret"}
|
||||||
func (b *BaseApi) GenerateSSH(c *gin.Context) {
|
func (b *BaseApi) EditRootCert(c *gin.Context) {
|
||||||
var req dto.GenerateSSH
|
var req dto.RootCertOperate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if err := loadCertAfterDecrypt(&req); err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
}
|
||||||
|
if err := sshService.EditRootCert(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
if err := sshService.GenerateSSH(req); err != nil {
|
// @Tags SSH
|
||||||
|
// @Summary Sycn host SSH secret
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/ssh/cert/sync [post]
|
||||||
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"同步 SSH 密钥 ","formatEN":"sync SSH secret"}
|
||||||
|
func (b *BaseApi) SyncRootCert(c *gin.Context) {
|
||||||
|
if err := sshService.SyncRootCert(); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -112,30 +133,55 @@ func (b *BaseApi) GenerateSSH(c *gin.Context) {
|
|||||||
// @Tags SSH
|
// @Tags SSH
|
||||||
// @Summary Load host SSH secret
|
// @Summary Load host SSH secret
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.GenerateLoad true "request"
|
// @Param request body dto.SearchWithPage true "request"
|
||||||
// @Success 200 {string} secret
|
// @Success 200 {object} dto.PageResult
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/ssh/secret [post]
|
// @Router /hosts/ssh/cert/search [post]
|
||||||
func (b *BaseApi) LoadSSHSecret(c *gin.Context) {
|
func (b *BaseApi) SearchRootCert(c *gin.Context) {
|
||||||
var req dto.GenerateLoad
|
var req dto.SearchWithPage
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := sshService.LoadSSHSecret(req.EncryptionMode)
|
total, data, err := sshService.SearchRootCerts(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, data)
|
helper.SuccessWithData(c, dto.PageResult{
|
||||||
|
Total: total,
|
||||||
|
Items: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags SSH
|
||||||
|
// @Summary Delete host SSH secret
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.ForceDelete true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/ssh/cert/delete [post]
|
||||||
|
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除 SSH 密钥 ","formatEN":"delete SSH secret"}
|
||||||
|
func (b *BaseApi) DeleteRootCert(c *gin.Context) {
|
||||||
|
var req dto.ForceDelete
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := sshService.DeleteRootCerts(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags SSH
|
// @Tags SSH
|
||||||
// @Summary Load host SSH logs
|
// @Summary Load host SSH logs
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Param request body dto.SearchSSHLog true "request"
|
// @Param request body dto.SearchSSHLog true "request"
|
||||||
// @Success 200 {object} dto.SSHLog
|
// @Success 200 {object} dto.PageResult
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/ssh/log [post]
|
// @Router /hosts/ssh/log [post]
|
||||||
@@ -145,7 +191,54 @@ func (b *BaseApi) LoadSSHLogs(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := sshService.LoadLog(c, req)
|
total, data, err := sshService.LoadLog(c, req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.SuccessWithData(c, dto.PageResult{
|
||||||
|
Total: total,
|
||||||
|
Items: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags SSH
|
||||||
|
// @Summary Export host SSH logs
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.SearchSSHLog true "request"
|
||||||
|
// @Success 200 {string} path
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/ssh/log/export [post]
|
||||||
|
func (b *BaseApi) ExportSSHLogs(c *gin.Context) {
|
||||||
|
var req dto.SearchSSHLog
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tmpFile, err := sshService.ExportLog(c, req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, tmpFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags SSH
|
||||||
|
// @Summary Load host SSH conf
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body dto.OperationWithName true "request"
|
||||||
|
// @Success 200 {string} conf
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/ssh/file [post]
|
||||||
|
func (b *BaseApi) LoadSSHFile(c *gin.Context) {
|
||||||
|
var req dto.OperationWithName
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := sshService.LoadSSHFile(req.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
@@ -154,16 +247,48 @@ func (b *BaseApi) LoadSSHLogs(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @Tags SSH
|
// @Tags SSH
|
||||||
// @Summary Load host SSH conf
|
// @Summary Update host SSH setting by file
|
||||||
// @Success 200 {string} conf
|
// @Accept json
|
||||||
|
// @Param request body dto.SSHConf true "request"
|
||||||
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /hosts/ssh/conf [get]
|
// @Router /hosts/ssh/file/update [post]
|
||||||
func (b *BaseApi) LoadSSHConf(c *gin.Context) {
|
// @x-panel-log {"bodyKeys":["key"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改 SSH 配置文件 [key]","formatEN":"update SSH conf [key]"}
|
||||||
data, err := sshService.LoadSSHConf()
|
func (b *BaseApi) UpdateSSHByFile(c *gin.Context) {
|
||||||
if err != nil {
|
var req dto.SettingUpdate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := sshService.UpdateByFile(req); err != nil {
|
||||||
helper.InternalServer(c, err)
|
helper.InternalServer(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
helper.SuccessWithData(c, data)
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func loadCertAfterDecrypt(req *dto.RootCertOperate) error {
|
||||||
|
if len(req.PassPhrase) != 0 {
|
||||||
|
passPhrase, err := base64.StdEncoding.DecodeString(req.PassPhrase)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
req.PassPhrase = string(passPhrase)
|
||||||
|
}
|
||||||
|
if len(req.PrivateKey) != 0 {
|
||||||
|
privateKey, err := base64.StdEncoding.DecodeString(req.PrivateKey)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
req.PrivateKey = string(privateKey)
|
||||||
|
}
|
||||||
|
if len(req.PublicKey) != 0 {
|
||||||
|
publicKey, err := base64.StdEncoding.DecodeString(req.PublicKey)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
req.PublicKey = string(publicKey)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package v2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// @Tags Host
|
||||||
|
// @Summary Check if a system component exists
|
||||||
|
// @Accept json
|
||||||
|
// @Param name path string true "Component name to check (e.g., rsync, docker)"
|
||||||
|
// @Success 200 {object} response.ComponentInfo
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /hosts/components/{name} [get]
|
||||||
|
func (b *BaseApi) CheckComponentExistence(c *gin.Context) {
|
||||||
|
name := c.Param("name")
|
||||||
|
if name == "" {
|
||||||
|
helper.BadRequest(c, errors.New("empty component name"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
info := systemService.IsComponentExist(name)
|
||||||
|
helper.SuccessWithData(c, info)
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ func (b *BaseApi) PageTasks(c *gin.Context) {
|
|||||||
|
|
||||||
// @Tags TaskLog
|
// @Tags TaskLog
|
||||||
// @Summary Get the number of executing tasks
|
// @Summary Get the number of executing tasks
|
||||||
// @Success 200 {object} int64
|
// @Success 200 {integer} int64
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /logs/tasks/executing/count [get]
|
// @Router /logs/tasks/executing/count [get]
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package v2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (b *BaseApi) PageTensorRTLLMs(c *gin.Context) {
|
||||||
|
var req request.TensorRTLLMSearch
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
list := tensorrtLLMService.Page(req)
|
||||||
|
helper.SuccessWithData(c, list)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) CreateTensorRTLLM(c *gin.Context) {
|
||||||
|
var req request.TensorRTLLMCreate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := tensorrtLLMService.Create(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) UpdateTensorRTLLM(c *gin.Context) {
|
||||||
|
var req request.TensorRTLLMUpdate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := tensorrtLLMService.Update(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) DeleteTensorRTLLM(c *gin.Context) {
|
||||||
|
var req request.TensorRTLLMDelete
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := tensorrtLLMService.Delete(req.ID)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) OperateTensorRTLLM(c *gin.Context) {
|
||||||
|
var req request.TensorRTLLMOperate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := tensorrtLLMService.Operate(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
@@ -86,15 +85,16 @@ func (b *BaseApi) ContainerWsSSH(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
source := c.Query("source")
|
source := c.Query("source")
|
||||||
var containerID string
|
|
||||||
var initCmd []string
|
var initCmd []string
|
||||||
switch source {
|
switch source {
|
||||||
case "redis":
|
case "redis", "redis-cluster":
|
||||||
containerID, initCmd, err = loadRedisInitCmd(c)
|
initCmd, err = loadRedisInitCmd(c, source)
|
||||||
case "ollama":
|
case "ollama":
|
||||||
containerID, initCmd, err = loadOllamaInitCmd(c)
|
initCmd, err = loadOllamaInitCmd(c)
|
||||||
case "container":
|
case "container":
|
||||||
containerID, initCmd, err = loadContainerInitCmd(c)
|
initCmd, err = loadContainerInitCmd(c)
|
||||||
|
case "database":
|
||||||
|
initCmd, err = loadDatabaseInitCmd(c)
|
||||||
default:
|
default:
|
||||||
if wshandleError(wsConn, fmt.Errorf("not support such source %s", source)) {
|
if wshandleError(wsConn, fmt.Errorf("not support such source %s", source)) {
|
||||||
return
|
return
|
||||||
@@ -103,12 +103,10 @@ func (b *BaseApi) ContainerWsSSH(c *gin.Context) {
|
|||||||
if wshandleError(wsConn, err) {
|
if wshandleError(wsConn, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pidMap := loadMapFromDockerTop(containerID)
|
|
||||||
slave, err := terminal.NewCommand("docker", initCmd...)
|
slave, err := terminal.NewCommand("docker", initCmd...)
|
||||||
if wshandleError(wsConn, err) {
|
if wshandleError(wsConn, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer killBash(containerID, strings.ReplaceAll(strings.Join(initCmd, " "), fmt.Sprintf("exec -it %s ", containerID), ""), pidMap)
|
|
||||||
defer slave.Close()
|
defer slave.Close()
|
||||||
|
|
||||||
tty, err := terminal.NewLocalWsSession(cols, rows, wsConn, slave, false)
|
tty, err := terminal.NewLocalWsSession(cols, rows, wsConn, slave, false)
|
||||||
@@ -127,18 +125,18 @@ func (b *BaseApi) ContainerWsSSH(c *gin.Context) {
|
|||||||
_ = wsConn.WriteControl(websocket.CloseMessage, nil, dt)
|
_ = wsConn.WriteControl(websocket.CloseMessage, nil, dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadRedisInitCmd(c *gin.Context) (string, []string, error) {
|
func loadRedisInitCmd(c *gin.Context, redisType string) ([]string, error) {
|
||||||
name := c.Query("name")
|
name := c.Query("name")
|
||||||
from := c.Query("from")
|
from := c.Query("from")
|
||||||
commands := []string{"exec", "-it"}
|
commands := []string{"exec", "-it"}
|
||||||
database, err := databaseService.Get(name)
|
database, err := databaseService.Get(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, fmt.Errorf("no such database in db, err: %v", err)
|
return nil, fmt.Errorf("no such database in db, err: %v", err)
|
||||||
}
|
}
|
||||||
if from == "local" {
|
if from == "local" {
|
||||||
redisInfo, err := appInstallService.LoadConnInfo(dto.OperationWithNameAndType{Name: name, Type: "redis"})
|
redisInfo, err := appInstallService.LoadConnInfo(dto.OperationWithNameAndType{Name: name, Type: redisType})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, fmt.Errorf("no such app in db, err: %v", err)
|
return nil, fmt.Errorf("no such app in db, err: %v", err)
|
||||||
}
|
}
|
||||||
name = redisInfo.ContainerName
|
name = redisInfo.ContainerName
|
||||||
commands = append(commands, []string{name, "redis-cli"}...)
|
commands = append(commands, []string{name, "redis-cli"}...)
|
||||||
@@ -152,38 +150,61 @@ func loadRedisInitCmd(c *gin.Context) (string, []string, error) {
|
|||||||
commands = append(commands, []string{"-a", database.Password, "--no-auth-warning"}...)
|
commands = append(commands, []string{"-a", database.Password, "--no-auth-warning"}...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return name, commands, nil
|
return commands, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadOllamaInitCmd(c *gin.Context) (string, []string, error) {
|
func loadOllamaInitCmd(c *gin.Context) ([]string, error) {
|
||||||
name := c.Query("name")
|
name := c.Query("name")
|
||||||
if cmd.CheckIllegal(name) {
|
if cmd.CheckIllegal(name) {
|
||||||
return "", nil, fmt.Errorf("ollama model %s contains illegal characters", name)
|
return nil, fmt.Errorf("ollama model %s contains illegal characters", name)
|
||||||
}
|
}
|
||||||
ollamaInfo, err := appInstallService.LoadConnInfo(dto.OperationWithNameAndType{Name: "", Type: "ollama"})
|
ollamaInfo, err := appInstallService.LoadConnInfo(dto.OperationWithNameAndType{Name: "", Type: "ollama"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, fmt.Errorf("no such app in db, err: %v", err)
|
return nil, fmt.Errorf("no such app in db, err: %v", err)
|
||||||
}
|
}
|
||||||
containerName := ollamaInfo.ContainerName
|
containerName := ollamaInfo.ContainerName
|
||||||
return containerName, []string{"exec", "-it", containerName, "ollama", "run", name}, nil
|
return []string{"exec", "-it", containerName, "ollama", "run", name}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadContainerInitCmd(c *gin.Context) (string, []string, error) {
|
func loadContainerInitCmd(c *gin.Context) ([]string, error) {
|
||||||
containerID := c.Query("containerid")
|
containerID := c.Query("containerid")
|
||||||
command := c.Query("command")
|
command := c.Query("command")
|
||||||
user := c.Query("user")
|
user := c.Query("user")
|
||||||
if cmd.CheckIllegal(user, containerID, command) {
|
if cmd.CheckIllegal(user, containerID, command) {
|
||||||
return "", nil, fmt.Errorf("the command contains illegal characters. command: %s, user: %s, containerID: %s", command, user, containerID)
|
return nil, fmt.Errorf("the command contains illegal characters. command: %s, user: %s, containerID: %s", command, user, containerID)
|
||||||
}
|
}
|
||||||
if len(command) == 0 || len(containerID) == 0 {
|
if len(command) == 0 || len(containerID) == 0 {
|
||||||
return "", nil, fmt.Errorf("error param of command: %s or containerID: %s", command, containerID)
|
return nil, fmt.Errorf("error param of command: %s or containerID: %s", command, containerID)
|
||||||
}
|
}
|
||||||
commands := []string{"exec", "-it", containerID, command}
|
commands := []string{"exec", "-it", containerID, command}
|
||||||
if len(user) != 0 {
|
if len(user) != 0 {
|
||||||
commands = []string{"exec", "-it", "-u", user, containerID, command}
|
commands = []string{"exec", "-it", "-u", user, containerID, command}
|
||||||
}
|
}
|
||||||
|
|
||||||
return containerID, commands, nil
|
return commands, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func loadDatabaseInitCmd(c *gin.Context) ([]string, error) {
|
||||||
|
database := c.Query("database")
|
||||||
|
databaseType := c.Query("databaseType")
|
||||||
|
if len(database) == 0 || len(databaseType) == 0 {
|
||||||
|
return nil, fmt.Errorf("error param of database: %s or database type: %s", database, databaseType)
|
||||||
|
}
|
||||||
|
databaseConn, err := appInstallService.LoadConnInfo(dto.OperationWithNameAndType{Type: databaseType, Name: database})
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("no such database in db, err: %v", err)
|
||||||
|
}
|
||||||
|
commands := []string{"exec", "-it", databaseConn.ContainerName}
|
||||||
|
switch databaseType {
|
||||||
|
case "mysql", "mysql-cluster":
|
||||||
|
commands = append(commands, []string{"mysql", "-uroot", "-p" + databaseConn.Password}...)
|
||||||
|
case "mariadb":
|
||||||
|
commands = append(commands, []string{"mariadb", "-uroot", "-p" + databaseConn.Password}...)
|
||||||
|
case "postgresql", "postgresql-cluster":
|
||||||
|
commands = []string{"exec", "-e", fmt.Sprintf("PGPASSWORD=%s", databaseConn.Password), "-it", databaseConn.ContainerName, "psql", "-t", "-U", databaseConn.Username}
|
||||||
|
}
|
||||||
|
|
||||||
|
return commands, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func wshandleError(ws *websocket.Conn, err error) bool {
|
func wshandleError(ws *websocket.Conn, err error) bool {
|
||||||
@@ -206,45 +227,9 @@ func wshandleError(ws *websocket.Conn, err error) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadMapFromDockerTop(containerID string) map[string]string {
|
|
||||||
pidMap := make(map[string]string)
|
|
||||||
sudo := cmd.SudoHandleCmd()
|
|
||||||
|
|
||||||
stdout, err := cmd.RunDefaultWithStdoutBashCf("%s docker top %s -eo pid,command ", sudo, containerID)
|
|
||||||
if err != nil {
|
|
||||||
return pidMap
|
|
||||||
}
|
|
||||||
lines := strings.Split(stdout, "\n")
|
|
||||||
for _, line := range lines {
|
|
||||||
parts := strings.Fields(line)
|
|
||||||
if len(parts) < 2 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
pidMap[parts[0]] = strings.Join(parts[1:], " ")
|
|
||||||
}
|
|
||||||
return pidMap
|
|
||||||
}
|
|
||||||
|
|
||||||
func killBash(containerID, comm string, pidMap map[string]string) {
|
|
||||||
sudo := cmd.SudoHandleCmd()
|
|
||||||
newPidMap := loadMapFromDockerTop(containerID)
|
|
||||||
for pid, command := range newPidMap {
|
|
||||||
isOld := false
|
|
||||||
for pid2 := range pidMap {
|
|
||||||
if pid == pid2 {
|
|
||||||
isOld = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !isOld && command == comm {
|
|
||||||
_, _ = cmd.RunDefaultWithStdoutBashCf("%s kill -9 %s", sudo, pid)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var upGrader = websocket.Upgrader{
|
var upGrader = websocket.Upgrader{
|
||||||
ReadBufferSize: 1024,
|
ReadBufferSize: 4096,
|
||||||
WriteBufferSize: 1024 * 1024 * 10,
|
WriteBufferSize: 16384,
|
||||||
CheckOrigin: func(r *http.Request) bool {
|
CheckOrigin: func(r *http.Request) bool {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|||||||
+193
-7
@@ -73,7 +73,7 @@ func (b *BaseApi) GetWebsiteOptions(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /websites [post]
|
// @Router /websites [post]
|
||||||
// @x-panel-log {"bodyKeys":["primaryDomain"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建网站 [primaryDomain]","formatEN":"Create website [primaryDomain]"}
|
// @x-panel-log {"bodyKeys":["alias"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建网站 [alias]","formatEN":"Create website [alias]"}
|
||||||
func (b *BaseApi) CreateWebsite(c *gin.Context) {
|
func (b *BaseApi) CreateWebsite(c *gin.Context) {
|
||||||
var req request.WebsiteCreate
|
var req request.WebsiteCreate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -506,7 +506,7 @@ func (b *BaseApi) GetProxyConfig(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /websites/proxies/update [post]
|
// @Router /websites/proxies/update [post]
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"修改网站 [domain] 反向代理配置 ","formatEN":"Update domain [domain] proxy config"}
|
// @x-panel-log {"bodyKeys":["id","name","operate"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"修改 [operate] 网站 [domain] 反向代理配置 [name] ","formatEN":"Update [operate] domain [domain] proxy config [name]"}
|
||||||
func (b *BaseApi) UpdateProxyConfig(c *gin.Context) {
|
func (b *BaseApi) UpdateProxyConfig(c *gin.Context) {
|
||||||
var req request.WebsiteProxyConfig
|
var req request.WebsiteProxyConfig
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -520,6 +520,50 @@ func (b *BaseApi) UpdateProxyConfig(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Delete proxy config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.WebsiteProxyDel true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/proxies/delete [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["id","name"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"删除网站 [domain] 反向代理配置 [name] ","formatEN":"Delete domain [domain] proxy config [name]"}
|
||||||
|
func (b *BaseApi) DeleteProxyConfig(c *gin.Context) {
|
||||||
|
var req request.WebsiteProxyDel
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := websiteService.DeleteProxy(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Update proxy config status
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.WebsiteProxyStatusUpdate true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/proxies/status [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["id","name","status"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"修改网站 [domain] 反向代理配置 [name] 状态 [status] ","formatEN":"Update domain [domain] proxy config [name] status [status]"}
|
||||||
|
func (b *BaseApi) UpdateProxyConfigStatus(c *gin.Context) {
|
||||||
|
var req request.WebsiteProxyStatusUpdate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := websiteService.UpdateProxyStatus(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Website
|
// @Tags Website
|
||||||
// @Summary Update proxy file
|
// @Summary Update proxy file
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -527,8 +571,8 @@ func (b *BaseApi) UpdateProxyConfig(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /websites/proxy/file [post]
|
// @Router /websites/proxies/file [post]
|
||||||
// @x-panel-log {"bodyKeys":["websiteID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteID","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"更新反向代理文件 [domain]","formatEN":"Nginx conf proxy file update [domain]"}
|
// @x-panel-log {"bodyKeys":["websiteID","name"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteID","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"修改网站 [domain] 反向代理配置文件 [name] ","formatEN":"Update domain [domain] proxy config file [name]"}
|
||||||
func (b *BaseApi) UpdateProxyConfigFile(c *gin.Context) {
|
func (b *BaseApi) UpdateProxyConfigFile(c *gin.Context) {
|
||||||
var req request.NginxProxyUpdate
|
var req request.NginxProxyUpdate
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -672,7 +716,7 @@ func (b *BaseApi) UpdateAntiLeech(c *gin.Context) {
|
|||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /websites/redirect/update [post]
|
// @Router /websites/redirect/update [post]
|
||||||
// @x-panel-log {"bodyKeys":["websiteID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteID","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"修改网站 [domain] 重定向理配置 ","formatEN":"Update domain [domain] redirect config"}
|
// @x-panel-log {"bodyKeys":["websiteID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteID","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"修改网站 [domain] 重定向配置 ","formatEN":"Update domain [domain] redirect config"}
|
||||||
func (b *BaseApi) UpdateRedirectConfig(c *gin.Context) {
|
func (b *BaseApi) UpdateRedirectConfig(c *gin.Context) {
|
||||||
var req request.NginxRedirectReq
|
var req request.NginxRedirectReq
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -840,7 +884,7 @@ func (b *BaseApi) CreateLoadBalance(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /websites/lbs/delete [post]
|
// @Router /websites/lbs/del [post]
|
||||||
func (b *BaseApi) DeleteLoadBalance(c *gin.Context) {
|
func (b *BaseApi) DeleteLoadBalance(c *gin.Context) {
|
||||||
var req request.WebsiteLBDelete
|
var req request.WebsiteLBDelete
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
@@ -953,7 +997,7 @@ func (b *BaseApi) GetProxyCache(c *gin.Context) {
|
|||||||
// @Success 200
|
// @Success 200
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Security Timestamp
|
// @Security Timestamp
|
||||||
// @Router /websites/realip [post]
|
// @Router /websites/realip/config [post]
|
||||||
// @x-panel-log {"bodyKeys":["websiteID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteID","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"修改 [domain] 网站真实IP配置 ","formatEN":"Modify the real IP configuration of [domain] website"}
|
// @x-panel-log {"bodyKeys":["websiteID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteID","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"修改 [domain] 网站真实IP配置 ","formatEN":"Modify the real IP configuration of [domain] website"}
|
||||||
func (b *BaseApi) SetRealIPConfig(c *gin.Context) {
|
func (b *BaseApi) SetRealIPConfig(c *gin.Context) {
|
||||||
var req request.WebsiteRealIP
|
var req request.WebsiteRealIP
|
||||||
@@ -1121,3 +1165,145 @@ func (b *BaseApi) OperateCrossSiteAccess(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Exec Composer
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.ExecComposerReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/exec/composer [post]
|
||||||
|
func (b *BaseApi) ExecComposer(c *gin.Context) {
|
||||||
|
var req request.ExecComposerReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := websiteService.ExecComposer(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Batch operate websites
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.BatchWebsiteOp true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/batch/operate [post]
|
||||||
|
func (b *BaseApi) BatchOpWebsites(c *gin.Context) {
|
||||||
|
var req request.BatchWebsiteOp
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := websiteService.BatchOpWebsite(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Batch set website group
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.BatchWebsiteGroup true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/batch/group [post]
|
||||||
|
func (b *BaseApi) BatchSetWebsiteGroup(c *gin.Context) {
|
||||||
|
var req request.BatchWebsiteGroup
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := websiteService.BatchSetGroup(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Get CORS Config
|
||||||
|
// @Accept json
|
||||||
|
// @Param id path int true "id"
|
||||||
|
// @Success 200 {object} request.CorsConfig
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/cors/{id} [get]
|
||||||
|
func (b *BaseApi) GetCORSConfig(c *gin.Context) {
|
||||||
|
id, err := helper.GetParamID(c)
|
||||||
|
if err != nil {
|
||||||
|
helper.BadRequest(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err := websiteService.GetCors(id)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithData(c, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Update CORS Config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.CorsConfigReq true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/cors/update [post]
|
||||||
|
func (b *BaseApi) UpdateCORSConfig(c *gin.Context) {
|
||||||
|
var req request.CorsConfigReq
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := websiteService.UpdateCors(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Update Stream Config
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.StreamUpdate true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/stream/update [post]
|
||||||
|
func (b *BaseApi) UpdateStreamConfig(c *gin.Context) {
|
||||||
|
var req request.StreamUpdate
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := websiteService.UpdateStream(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Website
|
||||||
|
// @Summary Batch set HTTPS for websites
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.BatchWebsiteHttps true "request"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/batch/https [post]
|
||||||
|
func (b *BaseApi) BatchSetHttps(c *gin.Context) {
|
||||||
|
var req request.BatchWebsiteHttps
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := websiteService.BatchSetHttps(c, req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|||||||
+117
-18
@@ -1,11 +1,14 @@
|
|||||||
package v2
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
||||||
@@ -22,27 +25,39 @@ import (
|
|||||||
// @Router /websites/ssl/search [post]
|
// @Router /websites/ssl/search [post]
|
||||||
func (b *BaseApi) PageWebsiteSSL(c *gin.Context) {
|
func (b *BaseApi) PageWebsiteSSL(c *gin.Context) {
|
||||||
var req request.WebsiteSSLSearch
|
var req request.WebsiteSSLSearch
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
total, accounts, err := websiteSSLService.Page(req)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.SuccessWithDataGzipped(c, dto.PageResult{
|
||||||
|
Total: total,
|
||||||
|
Items: accounts,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Tags Website SSL
|
||||||
|
// @Summary List website ssl
|
||||||
|
// @Accept json
|
||||||
|
// @Param request body request.WebsiteSSLListReq true "request"
|
||||||
|
// @Success 200 {array} response.WebsiteSSLDTO
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/ssl/list [post]
|
||||||
|
func (b *BaseApi) ListWebsiteSSL(c *gin.Context) {
|
||||||
|
var req request.WebsiteSSLListReq
|
||||||
if err := helper.CheckBind(&req, c); err != nil {
|
if err := helper.CheckBind(&req, c); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(req.PageInfo, dto.PageInfo{}) {
|
list, err := websiteSSLService.Search(req)
|
||||||
total, accounts, err := websiteSSLService.Page(req)
|
if err != nil {
|
||||||
if err != nil {
|
helper.InternalServer(c, err)
|
||||||
helper.InternalServer(c, err)
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{
|
|
||||||
Total: total,
|
|
||||||
Items: accounts,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
list, err := websiteSSLService.Search(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, list)
|
|
||||||
}
|
}
|
||||||
|
helper.SuccessWithDataGzipped(c, list)
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Tags Website SSL
|
// @Tags Website SSL
|
||||||
@@ -216,6 +231,78 @@ func (b *BaseApi) UploadWebsiteSSL(c *gin.Context) {
|
|||||||
helper.Success(c)
|
helper.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Tags Website SSL
|
||||||
|
// @Summary Upload SSL file
|
||||||
|
// @Accept multipart/form-data
|
||||||
|
// @Param type formData string true "type"
|
||||||
|
// @Param description formData string false "description"
|
||||||
|
// @Param sslID formData string false "sslID"
|
||||||
|
// @Param privateKeyFile formData file true "privateKeyFile"
|
||||||
|
// @Param certificateFile formData file true "certificateFile"
|
||||||
|
// @Success 200
|
||||||
|
// @Security ApiKeyAuth
|
||||||
|
// @Security Timestamp
|
||||||
|
// @Router /websites/ssl/upload/file [post]
|
||||||
|
// @x-panel-log {"bodyKeys":["type"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"上传 ssl 文件 [type]","formatEN":"Upload ssl file [type]"}
|
||||||
|
func (b *BaseApi) UploadSSLFile(c *gin.Context) {
|
||||||
|
var req request.WebsiteSSLFileUpload
|
||||||
|
|
||||||
|
req.Description = c.PostForm("description")
|
||||||
|
sslID := c.PostForm("sslID")
|
||||||
|
if sslID != "" {
|
||||||
|
req.SSLID, _ = strconv.ParseUint(sslID, 10, 64)
|
||||||
|
}
|
||||||
|
|
||||||
|
privateKeyFile, err := c.FormFile("privateKeyFile")
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
certificateFile, err := c.FormFile("certificateFile")
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
privateKeyContent, err := readUploadedFile(privateKeyFile)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
certificateContent, err := readUploadedFile(certificateFile)
|
||||||
|
if err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadReq := request.WebsiteSSLUpload{
|
||||||
|
Type: "paste",
|
||||||
|
PrivateKey: string(privateKeyContent),
|
||||||
|
Certificate: string(certificateContent),
|
||||||
|
Description: req.Description,
|
||||||
|
SSLID: uint(req.SSLID),
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := websiteSSLService.Upload(uploadReq); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func readUploadedFile(fileHeader *multipart.FileHeader) ([]byte, error) {
|
||||||
|
file, err := fileHeader.Open()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
return io.ReadAll(file)
|
||||||
|
}
|
||||||
|
|
||||||
// @Tags Website SSL
|
// @Tags Website SSL
|
||||||
// @Summary Download SSL file
|
// @Summary Download SSL file
|
||||||
// @Accept json
|
// @Accept json
|
||||||
@@ -245,3 +332,15 @@ func (b *BaseApi) DownloadWebsiteSSL(c *gin.Context) {
|
|||||||
c.Header("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(info.Name()))
|
c.Header("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(info.Name()))
|
||||||
http.ServeContent(c.Writer, c.Request, info.Name(), info.ModTime(), file)
|
http.ServeContent(c.Writer, c.Request, info.Name(), info.ModTime(), file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *BaseApi) ImportMasterSSL(c *gin.Context) {
|
||||||
|
var req model.WebsiteSSL
|
||||||
|
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := websiteSSLService.ImportMasterSSL(req); err != nil {
|
||||||
|
helper.InternalServer(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
helper.Success(c)
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,253 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type AgentCreateReq struct {
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
AppVersion string `json:"appVersion" validate:"required"`
|
||||||
|
WebUIPort int `json:"webUIPort" validate:"required"`
|
||||||
|
BridgePort int `json:"bridgePort"`
|
||||||
|
AgentType string `json:"agentType"`
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
APIType string `json:"apiType"`
|
||||||
|
MaxTokens int `json:"maxTokens"`
|
||||||
|
ContextWindow int `json:"contextWindow"`
|
||||||
|
AccountID uint `json:"accountId"`
|
||||||
|
APIKey string `json:"apiKey"`
|
||||||
|
BaseURL string `json:"baseURL"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
|
Advanced bool `json:"advanced"`
|
||||||
|
ContainerName string `json:"containerName"`
|
||||||
|
AllowPort bool `json:"allowPort"`
|
||||||
|
SpecifyIP string `json:"specifyIP"`
|
||||||
|
RestartPolicy string `json:"restartPolicy"`
|
||||||
|
CpuQuota float64 `json:"cpuQuota"`
|
||||||
|
MemoryLimit float64 `json:"memoryLimit"`
|
||||||
|
MemoryUnit string `json:"memoryUnit"`
|
||||||
|
PullImage bool `json:"pullImage"`
|
||||||
|
EditCompose bool `json:"editCompose"`
|
||||||
|
DockerCompose string `json:"dockerCompose"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentItem struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
AgentType string `json:"agentType"`
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
ProviderName string `json:"providerName"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
APIType string `json:"apiType"`
|
||||||
|
MaxTokens int `json:"maxTokens"`
|
||||||
|
ContextWindow int `json:"contextWindow"`
|
||||||
|
BaseURL string `json:"baseUrl"`
|
||||||
|
APIKey string `json:"apiKey"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
AppInstallID uint `json:"appInstallId"`
|
||||||
|
AccountID uint `json:"accountId"`
|
||||||
|
AppVersion string `json:"appVersion"`
|
||||||
|
Container string `json:"containerName"`
|
||||||
|
WebUIPort int `json:"webUIPort"`
|
||||||
|
BridgePort int `json:"bridgePort"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
ConfigPath string `json:"configPath"`
|
||||||
|
Upgradable bool `json:"upgradable"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentDeleteReq struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
|
ForceDelete bool `json:"forceDelete"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentTokenResetReq struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentModelConfigUpdateReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
AccountID uint `json:"accountId" validate:"required"`
|
||||||
|
Model string `json:"model" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentAccountCreateReq struct {
|
||||||
|
Provider string `json:"provider" validate:"required"`
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
APIKey string `json:"apiKey" validate:"required"`
|
||||||
|
RememberAPIKey bool `json:"rememberApiKey"`
|
||||||
|
BaseURL string `json:"baseURL"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
APIType string `json:"apiType"`
|
||||||
|
MaxTokens int `json:"maxTokens"`
|
||||||
|
ContextWindow int `json:"contextWindow"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentAccountUpdateReq struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
APIKey string `json:"apiKey" validate:"required"`
|
||||||
|
RememberAPIKey bool `json:"rememberApiKey"`
|
||||||
|
BaseURL string `json:"baseURL"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
APIType string `json:"apiType"`
|
||||||
|
MaxTokens int `json:"maxTokens"`
|
||||||
|
ContextWindow int `json:"contextWindow"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
SyncAgents bool `json:"syncAgents"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentAccountVerifyReq struct {
|
||||||
|
Provider string `json:"provider" validate:"required"`
|
||||||
|
APIKey string `json:"apiKey" validate:"required"`
|
||||||
|
BaseURL string `json:"baseURL"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentAccountDeleteReq struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentAccountSearch struct {
|
||||||
|
PageInfo
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentAccountInfo struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
ProviderName string `json:"providerName"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
APIKey string `json:"apiKey"`
|
||||||
|
RememberAPIKey bool `json:"rememberApiKey"`
|
||||||
|
BaseURL string `json:"baseUrl"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
APIType string `json:"apiType"`
|
||||||
|
MaxTokens int `json:"maxTokens"`
|
||||||
|
ContextWindow int `json:"contextWindow"`
|
||||||
|
Verified bool `json:"verified"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProviderModelInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProviderInfo struct {
|
||||||
|
Sort uint `json:"-"`
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
BaseURL string `json:"baseUrl"`
|
||||||
|
Models []ProviderModelInfo `json:"models"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentFeishuConfigReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentFeishuConfigUpdateReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
BotName string `json:"botName" validate:"required"`
|
||||||
|
AppID string `json:"appId" validate:"required"`
|
||||||
|
AppSecret string `json:"appSecret" validate:"required"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
DmPolicy string `json:"dmPolicy" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentFeishuPairingApproveReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
PairingCode string `json:"pairingCode" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentFeishuConfig struct {
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
DmPolicy string `json:"dmPolicy"`
|
||||||
|
BotName string `json:"botName"`
|
||||||
|
AppID string `json:"appId"`
|
||||||
|
AppSecret string `json:"appSecret"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentTelegramConfigReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentTelegramConfigUpdateReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
DmPolicy string `json:"dmPolicy" validate:"required"`
|
||||||
|
BotToken string `json:"botToken" validate:"required"`
|
||||||
|
Proxy string `json:"proxy"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentTelegramConfig struct {
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
DmPolicy string `json:"dmPolicy"`
|
||||||
|
BotToken string `json:"botToken"`
|
||||||
|
Proxy string `json:"proxy"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentChannelPairingApproveReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
Type string `json:"type" validate:"required,oneof=feishu telegram discord"`
|
||||||
|
PairingCode string `json:"pairingCode" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentDiscordConfigReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentDiscordConfigUpdateReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
DmPolicy string `json:"dmPolicy" validate:"required"`
|
||||||
|
GroupPolicy string `json:"groupPolicy" validate:"required,oneof=open allowlist disabled"`
|
||||||
|
Token string `json:"token" validate:"required"`
|
||||||
|
Proxy string `json:"proxy"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentDiscordConfig struct {
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
DmPolicy string `json:"dmPolicy"`
|
||||||
|
GroupPolicy string `json:"groupPolicy"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
Proxy string `json:"proxy"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentBrowserConfigReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentBrowserConfigUpdateReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
Headless bool `json:"headless"`
|
||||||
|
NoSandbox bool `json:"noSandbox"`
|
||||||
|
DefaultProfile string `json:"defaultProfile" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentBrowserConfig struct {
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
ExecutablePath string `json:"executablePath"`
|
||||||
|
Headless bool `json:"headless"`
|
||||||
|
NoSandbox bool `json:"noSandbox"`
|
||||||
|
DefaultProfile string `json:"defaultProfile"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentOtherConfigReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentOtherConfigUpdateReq struct {
|
||||||
|
AgentID uint `json:"agentId" validate:"required"`
|
||||||
|
UserTimezone string `json:"userTimezone" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentOtherConfig struct {
|
||||||
|
UserTimezone string `json:"userTimezone"`
|
||||||
|
}
|
||||||
+326
-4
@@ -1,10 +1,17 @@
|
|||||||
package dto
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type CreateOrUpdateAlert struct {
|
type CreateOrUpdateAlert struct {
|
||||||
AlertTitle string `json:"alertTitle"`
|
AlertTitle string `json:"alertTitle"`
|
||||||
AlertType string `json:"alertType"`
|
AlertType string `json:"alertType"`
|
||||||
AlertCount uint `json:"alertCount"`
|
AlertMethod string `json:"alertMethod"`
|
||||||
EntryID uint `json:"entryID"`
|
AlertCount uint `json:"alertCount"`
|
||||||
|
EntryID uint `json:"entryID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AlertBase struct {
|
type AlertBase struct {
|
||||||
@@ -18,3 +25,318 @@ type PushAlert struct {
|
|||||||
EntryID uint `json:"entryID"`
|
EntryID uint `json:"entryID"`
|
||||||
Param string `json:"param"`
|
Param string `json:"param"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AlertSearch struct {
|
||||||
|
PageInfo
|
||||||
|
OrderBy string `json:"orderBy" validate:"required,oneof=created_at"`
|
||||||
|
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Method string `json:"method"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertDTO struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Cycle uint `json:"cycle"`
|
||||||
|
Count uint `json:"count"`
|
||||||
|
Method string `json:"method"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Project string `json:"project"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
SendCount uint `json:"sendCount"`
|
||||||
|
AdvancedParams string `json:"advancedParams"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertCreate struct {
|
||||||
|
Type string `json:"type" validate:"required"`
|
||||||
|
Cycle uint `json:"cycle"`
|
||||||
|
Count uint `json:"count"`
|
||||||
|
Method string `json:"method" validate:"required"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Project string `json:"project"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
SendCount uint `json:"sendCount"`
|
||||||
|
AdvancedParams string `json:"advancedParams"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertUpdate struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Cycle uint `json:"cycle"`
|
||||||
|
Count uint `json:"count"`
|
||||||
|
Method string `json:"method"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Project string `json:"project"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
SendCount uint `json:"sendCount"`
|
||||||
|
AdvancedParams string `json:"advancedParams"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteRequest struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertUpdateStatus struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
Status string `json:"status" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiskDTO struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Device string `json:"device"`
|
||||||
|
Total uint64 `json:"total"`
|
||||||
|
Free uint64 `json:"free"`
|
||||||
|
Used uint64 `json:"used"`
|
||||||
|
UsedPercent float64 `json:"usedPercent"`
|
||||||
|
|
||||||
|
InodesTotal uint64 `json:"inodesTotal"`
|
||||||
|
InodesUsed uint64 `json:"inodesUsed"`
|
||||||
|
InodesFree uint64 `json:"inodesFree"`
|
||||||
|
InodesUsedPercent float64 `json:"inodesUsedPercent"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertLogSearch struct {
|
||||||
|
PageInfo
|
||||||
|
Count uint `json:"count"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertLogDTO struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Count uint `json:"count"`
|
||||||
|
AlertId uint `json:"alertId"`
|
||||||
|
AlertDetail AlertDetail `json:"alertDetail"`
|
||||||
|
AlertRule AlertRule `json:"alertRule"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Method string `json:"method"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertLogCreate struct {
|
||||||
|
Type string `json:"type" validate:"required"`
|
||||||
|
Count uint `json:"count" validate:"required"`
|
||||||
|
AlertId uint `json:"alertId" validate:"required"`
|
||||||
|
AlertDetail string `json:"alertDetail" validate:"required"`
|
||||||
|
AlertRule string `json:"alertRule" validate:"required"`
|
||||||
|
Status string `json:"status" validate:"required"`
|
||||||
|
Method string `json:"method" validate:"required"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
RecordId uint `json:"recordId"`
|
||||||
|
LicenseId string `json:"licenseId" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertLog struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertDetail struct {
|
||||||
|
LicenseId string `json:"licenseId"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
SubType string `json:"subType"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Method string `json:"method"`
|
||||||
|
LicenseCode string `json:"licenseCode"`
|
||||||
|
DeviceId string `json:"deviceId"`
|
||||||
|
Project string `json:"project"`
|
||||||
|
Params []Param `json:"params"`
|
||||||
|
Phone string `json:"phone"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertRule struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Cycle uint `json:"cycle"`
|
||||||
|
Count uint `json:"count"`
|
||||||
|
Method string `json:"method"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Project string `json:"project"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
SendCount uint `json:"sendCount"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Param struct {
|
||||||
|
Index string `json:"index"`
|
||||||
|
Key string `json:"key"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ClamDTO struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CronJobDTO struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CronJobReq struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpgradeInfo struct {
|
||||||
|
TestVersion string `json:"testVersion"`
|
||||||
|
NewVersion string `json:"newVersion"`
|
||||||
|
LatestVersion string `json:"latestVersion"`
|
||||||
|
ReleaseNote string `json:"releaseNote"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertDiskInfo struct {
|
||||||
|
Type string
|
||||||
|
Mount string
|
||||||
|
Device string
|
||||||
|
}
|
||||||
|
|
||||||
|
type SyncResult struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
LicenseID string `json:"licenseId"`
|
||||||
|
SendStatus string `json:"sendStatus"`
|
||||||
|
CreateTime string `json:"createTime"`
|
||||||
|
UpdateTime string `json:"updateTime"`
|
||||||
|
Remarks string `json:"remarks"`
|
||||||
|
MsgCount int `json:"msgCount"`
|
||||||
|
MsgCountMax int `json:"msgCountMax"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryRequest struct {
|
||||||
|
QueryIds []uint `json:"queryIds"`
|
||||||
|
LicenseId string `json:"licenseId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertResponse struct {
|
||||||
|
Result bool `json:"result"`
|
||||||
|
Data json.RawMessage `json:"data"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PushResult struct {
|
||||||
|
RecordId uint `json:"recordId"`
|
||||||
|
LicenseId string `json:"licenseId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateOfflineAlertLog struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
RecordId uint `json:"recordId"`
|
||||||
|
LicenseId string `json:"licenseId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SyncOfflineAlertLogDTO struct {
|
||||||
|
QueryRequest string `json:"queryRequest"`
|
||||||
|
Ids []uint `json:"ids"`
|
||||||
|
AlertLogs []model.AlertLog `json:"alertLogs"`
|
||||||
|
LicenseId string `json:"licenseId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OfflineAlertResponse struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
RemoteErr error `json:"remoteErr"`
|
||||||
|
ResponseStruct AlertResponse `json:"responseStruct"`
|
||||||
|
AlertLogs []model.AlertLog `json:"alertLogs"`
|
||||||
|
Ids []uint `json:"ids"`
|
||||||
|
LicenseId string `json:"licenseId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OfflineAlertLogDTO struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Count uint `json:"count"`
|
||||||
|
AlertId uint `json:"alertId"`
|
||||||
|
AlertDetail string `json:"alertDetail"`
|
||||||
|
AlertRule string `json:"alertRule"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Method string `json:"method"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
RecordId uint `json:"recordId"`
|
||||||
|
LicenseId string `json:"licenseId"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OfflineQueryRequest struct {
|
||||||
|
Ids []uint `json:"ids"`
|
||||||
|
QueryIds []uint `json:"queryIds"`
|
||||||
|
LicenseId string `json:"licenseId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertConfigUpdate struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Config string `json:"config"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertConfigTest struct {
|
||||||
|
Host string `json:"host"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Sender string `json:"sender"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
Encryption string `json:"encryption"` // "ssl" / "tls" / "none"
|
||||||
|
Recipient string `json:"recipient"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertSendTimeRange struct {
|
||||||
|
NoticeAlert struct {
|
||||||
|
SendTimeRange string `json:"sendTimeRange"`
|
||||||
|
Type []string `json:"type"`
|
||||||
|
} `json:"noticeAlert"`
|
||||||
|
ResourceAlert struct {
|
||||||
|
SendTimeRange string `json:"sendTimeRange"`
|
||||||
|
Type []string `json:"type"`
|
||||||
|
} `json:"resourceAlert"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertCommonConfig struct {
|
||||||
|
IsOffline string `json:"isOffline"`
|
||||||
|
AlertSendTimeRange AlertSendTimeRange `json:"alertSendTimeRange"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertSmsConfig struct {
|
||||||
|
Phone string `json:"phone"`
|
||||||
|
AlertDailyNum string `json:"alertDailyNum"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertEmailConfig struct {
|
||||||
|
Host string `json:"host"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Sender string `json:"sender"`
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
Encryption string `json:"encryption"` // "ssl" / "tls" / "none"
|
||||||
|
Recipient string `json:"recipient"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AgentInfo struct {
|
||||||
|
NodeName string `json:"nodeName"`
|
||||||
|
NodeAddr string `json:"nodeAddr"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertWebhookConfig struct {
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
Url string `json:"url"`
|
||||||
|
}
|
||||||
|
|||||||
+29
-23
@@ -7,10 +7,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type AppDatabase struct {
|
type AppDatabase struct {
|
||||||
ServiceName string `json:"PANEL_DB_HOST"`
|
ServiceName string `json:"PANEL_DB_HOST"`
|
||||||
DbName string `json:"PANEL_DB_NAME"`
|
DbName string `json:"PANEL_DB_NAME"`
|
||||||
DbUser string `json:"PANEL_DB_USER"`
|
DbUser string `json:"PANEL_DB_USER"`
|
||||||
Password string `json:"PANEL_DB_USER_PASSWORD"`
|
Password string `json:"PANEL_DB_USER_PASSWORD"`
|
||||||
|
DatabaseName string `json:"DATABASE_NAME"`
|
||||||
|
Format string `json:"format"`
|
||||||
|
Collation string `json:"collation"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AuthParam struct {
|
type AuthParam struct {
|
||||||
@@ -81,25 +84,26 @@ type ExtraProperties struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AppProperty struct {
|
type AppProperty struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
ShortDescZh string `json:"shortDescZh" yaml:"shortDescZh"`
|
ShortDescZh string `json:"shortDescZh" yaml:"shortDescZh"`
|
||||||
ShortDescEn string `json:"shortDescEn" yaml:"shortDescEn"`
|
ShortDescEn string `json:"shortDescEn" yaml:"shortDescEn"`
|
||||||
Description Locale `json:"description"`
|
Description Locale `json:"description"`
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Required []string `json:"Required"`
|
Required []string `json:"Required"`
|
||||||
CrossVersionUpdate bool `json:"crossVersionUpdate"`
|
CrossVersionUpdate bool `json:"crossVersionUpdate" yaml:"crossVersionUpdate"`
|
||||||
Limit int `json:"limit"`
|
Limit int `json:"limit" yaml:"limit"`
|
||||||
Recommend int `json:"recommend"`
|
Recommend int `json:"recommend" yaml:"recommend"`
|
||||||
Website string `json:"website"`
|
Website string `json:"website"`
|
||||||
Github string `json:"github"`
|
Github string `json:"github"`
|
||||||
Document string `json:"document"`
|
Document string `json:"document"`
|
||||||
Architectures []string `json:"architectures"`
|
Architectures []string `json:"architectures"`
|
||||||
MemoryRequired int `json:"memoryRequired"`
|
MemoryRequired int `json:"memoryRequired" yaml:"memoryRequired"`
|
||||||
GpuSupport bool `json:"gpuSupport"`
|
GpuSupport bool `json:"gpuSupport" yaml:"gpuSupport"`
|
||||||
Version float64 `json:"version"`
|
Version float64 `json:"version"`
|
||||||
Deprecated float64 `json:"deprecated"`
|
Deprecated float64 `json:"deprecated"`
|
||||||
|
BatchInstallSupport bool `json:"batchInstallSupport"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppConfigVersion struct {
|
type AppConfigVersion struct {
|
||||||
@@ -126,6 +130,8 @@ type Locale struct {
|
|||||||
ZhHant string `json:"zh-hant" yaml:"zh-hant"`
|
ZhHant string `json:"zh-hant" yaml:"zh-hant"`
|
||||||
Zh string `json:"zh"`
|
Zh string `json:"zh"`
|
||||||
Ko string `json:"ko"`
|
Ko string `json:"ko"`
|
||||||
|
Tr string `json:"tr"`
|
||||||
|
Es string `json:"es-es" yaml:"es-es"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppForm struct {
|
type AppForm struct {
|
||||||
|
|||||||
+23
-7
@@ -33,6 +33,12 @@ type BackupInfo struct {
|
|||||||
RememberAuth bool `json:"rememberAuth"`
|
RememberAuth bool `json:"rememberAuth"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BackupCheckRes struct {
|
||||||
|
IsOk bool `json:"isOk"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
}
|
||||||
|
|
||||||
type ForBuckets struct {
|
type ForBuckets struct {
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
AccessKey string `json:"accessKey"`
|
AccessKey string `json:"accessKey"`
|
||||||
@@ -53,25 +59,32 @@ type BackupOption struct {
|
|||||||
IsPublic bool `json:"isPublic"`
|
IsPublic bool `json:"isPublic"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UploadForRecover struct {
|
||||||
|
FilePath string `json:"filePath"`
|
||||||
|
TargetDir string `json:"targetDir"`
|
||||||
|
}
|
||||||
|
|
||||||
type CommonBackup struct {
|
type CommonBackup struct {
|
||||||
Type string `json:"type" validate:"required,oneof=app mysql mariadb redis website postgresql"`
|
Type string `json:"type" validate:"required,oneof=app mysql mariadb redis website postgresql mysql-cluster postgresql-cluster redis-cluster"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
DetailName string `json:"detailName"`
|
DetailName string `json:"detailName"`
|
||||||
Secret string `json:"secret"`
|
Secret string `json:"secret"`
|
||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
FileName string `json:"fileName"`
|
FileName string `json:"fileName"`
|
||||||
|
Args []string `json:"args"`
|
||||||
|
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
type CommonRecover struct {
|
type CommonRecover struct {
|
||||||
DownloadAccountID uint `json:"downloadAccountID" validate:"required"`
|
DownloadAccountID uint `json:"downloadAccountID" validate:"required"`
|
||||||
Type string `json:"type" validate:"required,oneof=app mysql mariadb redis website postgresql"`
|
Type string `json:"type" validate:"required,oneof=app mysql mariadb redis website postgresql mysql-cluster postgresql-cluster redis-cluster"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
DetailName string `json:"detailName"`
|
DetailName string `json:"detailName"`
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
Secret string `json:"secret"`
|
Secret string `json:"secret"`
|
||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
BackupRecordID uint `json:"backupRecordID"`
|
BackupRecordID uint `json:"backupRecordID"`
|
||||||
|
Timeout int `json:"timeout"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RecordSearch struct {
|
type RecordSearch struct {
|
||||||
@@ -94,6 +107,9 @@ type BackupRecords struct {
|
|||||||
DownloadAccountID uint `json:"downloadAccountID"`
|
DownloadAccountID uint `json:"downloadAccountID"`
|
||||||
FileDir string `json:"fileDir"`
|
FileDir string `json:"fileDir"`
|
||||||
FileName string `json:"fileName"`
|
FileName string `json:"fileName"`
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-9
@@ -30,16 +30,20 @@ type ClamInfo struct {
|
|||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
InfectedStrategy string `json:"infectedStrategy"`
|
InfectedStrategy string `json:"infectedStrategy"`
|
||||||
InfectedDir string `json:"infectedDir"`
|
InfectedDir string `json:"infectedDir"`
|
||||||
LastHandleDate string `json:"lastHandleDate"`
|
LastRecordStatus string `json:"lastRecordStatus"`
|
||||||
|
LastRecordTime string `json:"lastRecordTime"`
|
||||||
Spec string `json:"spec"`
|
Spec string `json:"spec"`
|
||||||
|
Timeout uint `json:"timeout"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
AlertCount uint `json:"alertCount"`
|
AlertCount uint `json:"alertCount"`
|
||||||
|
AlertMethod string `json:"alertMethod"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClamLogSearch struct {
|
type ClamLogSearch struct {
|
||||||
PageInfo
|
PageInfo
|
||||||
|
|
||||||
ClamID uint `json:"clamID"`
|
ClamID uint `json:"clamID"`
|
||||||
|
Status string `json:"status"`
|
||||||
StartTime time.Time `json:"startTime"`
|
StartTime time.Time `json:"startTime"`
|
||||||
EndTime time.Time `json:"endTime"`
|
EndTime time.Time `json:"endTime"`
|
||||||
}
|
}
|
||||||
@@ -55,13 +59,16 @@ type ClamFileReq struct {
|
|||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClamLog struct {
|
type ClamRecord struct {
|
||||||
Name string `json:"name"`
|
ID uint `json:"id"`
|
||||||
ScanDate string `json:"scanDate"`
|
TaskID string `json:"taskID"`
|
||||||
ScanTime string `json:"scanTime"`
|
StartTime time.Time `json:"startTime"`
|
||||||
InfectedFiles string `json:"infectedFiles"`
|
ScanTime string `json:"scanTime"`
|
||||||
TotalError string `json:"totalError"`
|
InfectedFiles string `json:"infectedFiles"`
|
||||||
Status string `json:"status"`
|
TotalError string `json:"totalError"`
|
||||||
|
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClamCreate struct {
|
type ClamCreate struct {
|
||||||
@@ -71,9 +78,11 @@ type ClamCreate struct {
|
|||||||
InfectedStrategy string `json:"infectedStrategy"`
|
InfectedStrategy string `json:"infectedStrategy"`
|
||||||
InfectedDir string `json:"infectedDir"`
|
InfectedDir string `json:"infectedDir"`
|
||||||
Spec string `json:"spec"`
|
Spec string `json:"spec"`
|
||||||
|
Timeout uint `json:"timeout"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
AlertCount uint `json:"alertCount"`
|
AlertCount uint `json:"alertCount"`
|
||||||
AlertTitle string `json:"alertTitle"`
|
AlertTitle string `json:"alertTitle"`
|
||||||
|
AlertMethod string `json:"alertMethod"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClamUpdate struct {
|
type ClamUpdate struct {
|
||||||
@@ -84,9 +93,11 @@ type ClamUpdate struct {
|
|||||||
InfectedStrategy string `json:"infectedStrategy"`
|
InfectedStrategy string `json:"infectedStrategy"`
|
||||||
InfectedDir string `json:"infectedDir"`
|
InfectedDir string `json:"infectedDir"`
|
||||||
Spec string `json:"spec"`
|
Spec string `json:"spec"`
|
||||||
|
Timeout uint `json:"timeout"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
AlertCount uint `json:"alertCount"`
|
AlertCount uint `json:"alertCount"`
|
||||||
AlertTitle string `json:"alertTitle"`
|
AlertTitle string `json:"alertTitle"`
|
||||||
|
AlertMethod string `json:"alertMethod"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClamUpdateStatus struct {
|
type ClamUpdateStatus struct {
|
||||||
@@ -95,7 +106,6 @@ type ClamUpdateStatus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ClamDelete struct {
|
type ClamDelete struct {
|
||||||
RemoveRecord bool `json:"removeRecord"`
|
|
||||||
RemoveInfected bool `json:"removeInfected"`
|
RemoveInfected bool `json:"removeInfected"`
|
||||||
Ids []uint `json:"ids" validate:"required"`
|
Ids []uint `json:"ids" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ type OperationWithName struct {
|
|||||||
type OperateByID struct {
|
type OperateByID struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
}
|
}
|
||||||
|
type OperateByIDs struct {
|
||||||
|
IDs []uint `json:"ids"`
|
||||||
|
}
|
||||||
|
|
||||||
type Operate struct {
|
type Operate struct {
|
||||||
Operation string `json:"operation" validate:"required"`
|
Operation string `json:"operation" validate:"required"`
|
||||||
@@ -76,3 +79,8 @@ type ForceDelete struct {
|
|||||||
IDs []uint `json:"ids"`
|
IDs []uint `json:"ids"`
|
||||||
ForceDelete bool `json:"forceDelete"`
|
ForceDelete bool `json:"forceDelete"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChangeGroup struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
GroupID uint `json:"groupID" validate:"required"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ type ComposeTemplateCreate struct {
|
|||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ComposeTemplateBatch struct {
|
||||||
|
Templates []ComposeTemplateCreate `json:"templates" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
type ComposeTemplateUpdate struct {
|
type ComposeTemplateUpdate struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
|||||||
+114
-66
@@ -15,8 +15,9 @@ type PageContainer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InspectReq struct {
|
type InspectReq struct {
|
||||||
ID string `json:"id" validate:"required"`
|
ID string `json:"id" validate:"required"`
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
|
Detail string `json:"detail"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerInfo struct {
|
type ContainerInfo struct {
|
||||||
@@ -37,17 +38,24 @@ type ContainerInfo struct {
|
|||||||
AppName string `json:"appName"`
|
AppName string `json:"appName"`
|
||||||
AppInstallName string `json:"appInstallName"`
|
AppInstallName string `json:"appInstallName"`
|
||||||
Websites []string `json:"websites"`
|
Websites []string `json:"websites"`
|
||||||
|
|
||||||
|
IsPinned bool `json:"isPinned"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContainerOptions struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
State string `json:"state"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerStatus struct {
|
type ContainerStatus struct {
|
||||||
All uint `json:"all"`
|
Created int `json:"created"`
|
||||||
Created uint `json:"created"`
|
Running int `json:"running"`
|
||||||
Running uint `json:"running"`
|
Paused int `json:"paused"`
|
||||||
Paused uint `json:"paused"`
|
Restarting int `json:"restarting"`
|
||||||
Restarting uint `json:"restarting"`
|
Removing int `json:"removing"`
|
||||||
Removing uint `json:"removing"`
|
Exited int `json:"exited"`
|
||||||
Exited uint `json:"exited"`
|
Dead int `json:"dead"`
|
||||||
Dead uint `json:"dead"`
|
|
||||||
|
|
||||||
ContainerCount int `json:"containerCount"`
|
ContainerCount int `json:"containerCount"`
|
||||||
ComposeCount int `json:"composeCount"`
|
ComposeCount int `json:"composeCount"`
|
||||||
@@ -56,8 +64,6 @@ type ContainerStatus struct {
|
|||||||
NetworkCount int `json:"networkCount"`
|
NetworkCount int `json:"networkCount"`
|
||||||
VolumeCount int `json:"volumeCount"`
|
VolumeCount int `json:"volumeCount"`
|
||||||
RepoCount int `json:"repoCount"`
|
RepoCount int `json:"repoCount"`
|
||||||
|
|
||||||
ImageSize uint64 `json:"imageSize"`
|
|
||||||
}
|
}
|
||||||
type ResourceLimit struct {
|
type ResourceLimit struct {
|
||||||
CPU int `json:"cpu"`
|
CPU int `json:"cpu"`
|
||||||
@@ -65,18 +71,16 @@ type ResourceLimit struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ContainerOperate struct {
|
type ContainerOperate struct {
|
||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
ContainerID string `json:"containerID"`
|
ForcePull bool `json:"forcePull"`
|
||||||
ForcePull bool `json:"forcePull"`
|
Name string `json:"name" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Image string `json:"image" validate:"required"`
|
||||||
Image string `json:"image" validate:"required"`
|
|
||||||
Network string `json:"network"`
|
Hostname string `json:"hostname"`
|
||||||
Hostname string `json:"hostname"`
|
DomainName string `json:"domainName"`
|
||||||
DomainName string `json:"domainName"`
|
DNS []string `json:"dns"`
|
||||||
MacAddr string `json:"macAddr"`
|
Networks []ContainerNetwork `json:"networks"`
|
||||||
DNS []string `json:"dns"`
|
|
||||||
Ipv4 string `json:"ipv4"`
|
|
||||||
Ipv6 string `json:"ipv6"`
|
|
||||||
PublishAllPorts bool `json:"publishAllPorts"`
|
PublishAllPorts bool `json:"publishAllPorts"`
|
||||||
ExposedPorts []PortHelper `json:"exposedPorts"`
|
ExposedPorts []PortHelper `json:"exposedPorts"`
|
||||||
Tty bool `json:"tty"`
|
Tty bool `json:"tty"`
|
||||||
@@ -91,23 +95,48 @@ type ContainerOperate struct {
|
|||||||
Privileged bool `json:"privileged"`
|
Privileged bool `json:"privileged"`
|
||||||
AutoRemove bool `json:"autoRemove"`
|
AutoRemove bool `json:"autoRemove"`
|
||||||
Volumes []VolumeHelper `json:"volumes"`
|
Volumes []VolumeHelper `json:"volumes"`
|
||||||
|
ExtraHosts []ExtraHost `json:"extraHosts"`
|
||||||
Labels []string `json:"labels"`
|
Labels []string `json:"labels"`
|
||||||
Env []string `json:"env"`
|
Env []string `json:"env"`
|
||||||
RestartPolicy string `json:"restartPolicy"`
|
RestartPolicy string `json:"restartPolicy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExtraHost struct {
|
||||||
|
Hostname string `json:"hostname"`
|
||||||
|
IP string `json:"ip"`
|
||||||
|
}
|
||||||
|
type ContainerNetwork struct {
|
||||||
|
Network string `json:"network"`
|
||||||
|
Ipv4 string `json:"ipv4"`
|
||||||
|
Ipv6 string `json:"ipv6"`
|
||||||
|
MacAddr string `json:"macAddr"`
|
||||||
|
}
|
||||||
|
|
||||||
type ContainerCreateByCommand struct {
|
type ContainerCreateByCommand struct {
|
||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
Command string `json:"command"`
|
Command string `json:"command"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerUpgrade struct {
|
type ContainerUpgrade struct {
|
||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
Name string `json:"name" validate:"required"`
|
Names []string `json:"names" validate:"required"`
|
||||||
Image string `json:"image" validate:"required"`
|
Image string `json:"image" validate:"required"`
|
||||||
ForcePull bool `json:"forcePull"`
|
ForcePull bool `json:"forcePull"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ContainerItemStats struct {
|
||||||
|
SizeRw int64 `json:"sizeRw"`
|
||||||
|
SizeRootFs int64 `json:"sizeRootFs"`
|
||||||
|
|
||||||
|
ContainerUsage int64 `json:"containerUsage"`
|
||||||
|
ContainerReclaimable int64 `json:"containerReclaimable"`
|
||||||
|
ImageUsage int64 `json:"imageUsage"`
|
||||||
|
ImageReclaimable int64 `json:"imageReclaimable"`
|
||||||
|
VolumeUsage int64 `json:"volumeUsage"`
|
||||||
|
VolumeReclaimable int64 `json:"volumeReclaimable"`
|
||||||
|
BuildCacheUsage int64 `json:"buildCacheUsage"`
|
||||||
|
BuildCacheReclaimable int64 `json:"buildCacheReclaimable"`
|
||||||
|
}
|
||||||
type ContainerListStats struct {
|
type ContainerListStats struct {
|
||||||
ContainerID string `json:"containerID"`
|
ContainerID string `json:"containerID"`
|
||||||
|
|
||||||
@@ -139,6 +168,7 @@ type VolumeHelper struct {
|
|||||||
SourceDir string `json:"sourceDir"`
|
SourceDir string `json:"sourceDir"`
|
||||||
ContainerDir string `json:"containerDir"`
|
ContainerDir string `json:"containerDir"`
|
||||||
Mode string `json:"mode"`
|
Mode string `json:"mode"`
|
||||||
|
Shared string `json:"shared"`
|
||||||
}
|
}
|
||||||
type PortHelper struct {
|
type PortHelper struct {
|
||||||
HostIP string `json:"hostIP"`
|
HostIP string `json:"hostIP"`
|
||||||
@@ -148,6 +178,7 @@ type PortHelper struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ContainerOperation struct {
|
type ContainerOperation struct {
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
Names []string `json:"names" validate:"required"`
|
Names []string `json:"names" validate:"required"`
|
||||||
Operation string `json:"operation" validate:"required,oneof=up start stop restart kill pause unpause remove"`
|
Operation string `json:"operation" validate:"required,oneof=up start stop restart kill pause unpause remove"`
|
||||||
}
|
}
|
||||||
@@ -164,18 +195,16 @@ type ContainerCommit struct {
|
|||||||
Comment string `json:"comment"`
|
Comment string `json:"comment"`
|
||||||
Author string `json:"author"`
|
Author string `json:"author"`
|
||||||
Pause bool `json:"pause"`
|
Pause bool `json:"pause"`
|
||||||
|
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerPrune struct {
|
type ContainerPrune struct {
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
PruneType string `json:"pruneType" validate:"required,oneof=container image volume network buildcache"`
|
PruneType string `json:"pruneType" validate:"required,oneof=container image volume network buildcache"`
|
||||||
WithTagAll bool `json:"withTagAll"`
|
WithTagAll bool `json:"withTagAll"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerPruneReport struct {
|
|
||||||
DeletedNumber int `json:"deletedNumber"`
|
|
||||||
SpaceReclaimed int `json:"spaceReclaimed"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Network struct {
|
type Network struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -206,11 +235,12 @@ type NetworkCreate struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Volume struct {
|
type Volume struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Labels []string `json:"labels"`
|
Labels []VolumeOption `json:"labels"`
|
||||||
Driver string `json:"driver"`
|
Driver string `json:"driver"`
|
||||||
Mountpoint string `json:"mountpoint"`
|
Mountpoint string `json:"mountpoint"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
Options []VolumeOption `json:"options"`
|
||||||
}
|
}
|
||||||
type VolumeCreate struct {
|
type VolumeCreate struct {
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
@@ -218,55 +248,72 @@ type VolumeCreate struct {
|
|||||||
Options []string `json:"options"`
|
Options []string `json:"options"`
|
||||||
Labels []string `json:"labels"`
|
Labels []string `json:"labels"`
|
||||||
}
|
}
|
||||||
|
type VolumeOption struct {
|
||||||
|
Key string `json:"key"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
type BatchDelete struct {
|
type BatchDelete struct {
|
||||||
Force bool `json:"force"`
|
TaskID string `json:"taskID"`
|
||||||
Names []string `json:"names" validate:"required"`
|
Force bool `json:"force"`
|
||||||
|
Names []string `json:"names" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComposeInfo struct {
|
type ComposeInfo struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
CreatedBy string `json:"createdBy"`
|
CreatedBy string `json:"createdBy"`
|
||||||
ContainerNumber int `json:"containerNumber"`
|
ContainerCount int `json:"containerCount"`
|
||||||
ConfigFile string `json:"configFile"`
|
RunningCount int `json:"runningCount"`
|
||||||
Workdir string `json:"workdir"`
|
ConfigFile string `json:"configFile"`
|
||||||
Path string `json:"path"`
|
Workdir string `json:"workdir"`
|
||||||
Containers []ComposeContainer `json:"containers"`
|
Path string `json:"path"`
|
||||||
Env []string `json:"env"`
|
Containers []ComposeContainer `json:"containers"`
|
||||||
|
Env string `json:"env"`
|
||||||
}
|
}
|
||||||
type ComposeContainer struct {
|
type ComposeContainer struct {
|
||||||
ContainerID string `json:"containerID"`
|
ContainerID string `json:"containerID"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
CreateTime string `json:"createTime"`
|
CreateTime string `json:"createTime"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
|
Ports []string `json:"ports"`
|
||||||
}
|
}
|
||||||
type ComposeCreate struct {
|
type ComposeCreate struct {
|
||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
From string `json:"from" validate:"required,oneof=edit path template"`
|
From string `json:"from" validate:"required,oneof=edit path template"`
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Template uint `json:"template"`
|
Template uint `json:"template"`
|
||||||
Env []string `json:"env"`
|
Env string `json:"env"`
|
||||||
|
ForcePull bool `json:"forcePull"`
|
||||||
}
|
}
|
||||||
type ComposeOperation struct {
|
type ComposeOperation struct {
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Operation string `json:"operation" validate:"required,oneof=up start stop down delete"`
|
Operation string `json:"operation" validate:"required,oneof=up start restart stop down delete"`
|
||||||
WithFile bool `json:"withFile"`
|
WithFile bool `json:"withFile"`
|
||||||
|
Force bool `json:"force"`
|
||||||
}
|
}
|
||||||
type ComposeUpdate struct {
|
type ComposeUpdate struct {
|
||||||
Name string `json:"name" validate:"required"`
|
TaskID string `json:"taskID"`
|
||||||
Path string `json:"path" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Content string `json:"content" validate:"required"`
|
Path string `json:"path" validate:"required"`
|
||||||
Env []string `json:"env"`
|
DetailPath string `json:"detailPath"`
|
||||||
|
Content string `json:"content" validate:"required"`
|
||||||
|
Env string `json:"env"`
|
||||||
|
ForcePull bool `json:"forcePull"`
|
||||||
|
}
|
||||||
|
type ComposeLogClean struct {
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
Path string `json:"path" validate:"required"`
|
||||||
|
DetailPath string `json:"detailPath"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContainerLog struct {
|
type ContainerLog struct {
|
||||||
Container string `json:"container" validate:"required"`
|
Container string `json:"container" validate:"required"`
|
||||||
Since string `json:"since"`
|
Since string `json:"since"`
|
||||||
Tail uint `json:"tail"`
|
Tail uint `json:"tail"`
|
||||||
|
Timestamp bool `json:"timestamp"`
|
||||||
ContainerType string `json:"containerType"`
|
ContainerType string `json:"containerType"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,5 +323,6 @@ type StreamLog struct {
|
|||||||
Since string
|
Since string
|
||||||
Follow bool
|
Follow bool
|
||||||
Tail string
|
Tail string
|
||||||
|
Timestamp bool
|
||||||
Type string
|
Type string
|
||||||
}
|
}
|
||||||
|
|||||||
+100
-31
@@ -6,9 +6,10 @@ import (
|
|||||||
|
|
||||||
type PageCronjob struct {
|
type PageCronjob struct {
|
||||||
PageInfo
|
PageInfo
|
||||||
Info string `json:"info"`
|
Info string `json:"info"`
|
||||||
OrderBy string `json:"orderBy" validate:"required,oneof=name status createdAt"`
|
GroupIDs []uint `json:"groupIDs"`
|
||||||
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
OrderBy string `json:"orderBy" validate:"required,oneof=name status createdAt"`
|
||||||
|
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CronjobSpec struct {
|
type CronjobSpec struct {
|
||||||
@@ -19,6 +20,7 @@ type CronjobOperate struct {
|
|||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
|
GroupID uint `json:"groupID"`
|
||||||
SpecCustom bool `json:"specCustom"`
|
SpecCustom bool `json:"specCustom"`
|
||||||
Spec string `json:"spec" validate:"required"`
|
Spec string `json:"spec" validate:"required"`
|
||||||
|
|
||||||
@@ -29,25 +31,40 @@ type CronjobOperate struct {
|
|||||||
ContainerName string `json:"containerName"`
|
ContainerName string `json:"containerName"`
|
||||||
User string `json:"user"`
|
User string `json:"user"`
|
||||||
|
|
||||||
ScriptID uint `json:"scriptID"`
|
ScriptID uint `json:"scriptID"`
|
||||||
AppID string `json:"appID"`
|
AppID string `json:"appID"`
|
||||||
Website string `json:"website"`
|
Website string `json:"website"`
|
||||||
ExclusionRules string `json:"exclusionRules"`
|
ExclusionRules string `json:"exclusionRules"`
|
||||||
DBType string `json:"dbType"`
|
DBType string `json:"dbType"`
|
||||||
DBName string `json:"dbName"`
|
DBName string `json:"dbName"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
IsDir bool `json:"isDir"`
|
IsDir bool `json:"isDir"`
|
||||||
SourceDir string `json:"sourceDir"`
|
SourceDir string `json:"sourceDir"`
|
||||||
|
SnapshotRule SnapshotRule `json:"snapshotRule"`
|
||||||
|
|
||||||
SourceAccountIDs string `json:"sourceAccountIDs"`
|
SourceAccountIDs string `json:"sourceAccountIDs"`
|
||||||
DownloadAccountID uint `json:"downloadAccountID"`
|
DownloadAccountID uint `json:"downloadAccountID"`
|
||||||
RetainCopies int `json:"retainCopies" validate:"number,min=1"`
|
RetainCopies int `json:"retainCopies" validate:"number,min=1"`
|
||||||
RetryTimes int `json:"retryTimes" validate:"number,min=0"`
|
RetryTimes int `json:"retryTimes" validate:"number,min=0"`
|
||||||
Timeout uint `json:"timeout" validate:"number,min=1"`
|
Timeout uint `json:"timeout" validate:"number,min=1"`
|
||||||
|
IgnoreErr bool `json:"ignoreErr"`
|
||||||
Secret string `json:"secret"`
|
Secret string `json:"secret"`
|
||||||
|
Args string `json:"args"`
|
||||||
|
|
||||||
AlertCount uint `json:"alertCount"`
|
AlertCount uint `json:"alertCount"`
|
||||||
AlertTitle string `json:"alertTitle"`
|
AlertTitle string `json:"alertTitle"`
|
||||||
|
AlertMethod string `json:"alertMethod"`
|
||||||
|
|
||||||
|
CleanLogConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
type CleanLogConfig struct {
|
||||||
|
Scopes []string `json:"scopes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SnapshotRule struct {
|
||||||
|
WithImage bool `json:"withImage"`
|
||||||
|
IgnoreAppIDs []uint `json:"ignoreAppIDs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CronjobUpdateStatus struct {
|
type CronjobUpdateStatus struct {
|
||||||
@@ -55,11 +72,6 @@ type CronjobUpdateStatus struct {
|
|||||||
Status string `json:"status" validate:"required"`
|
Status string `json:"status" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CronjobDownload struct {
|
|
||||||
RecordID uint `json:"recordID" validate:"required"`
|
|
||||||
BackupAccountID uint `json:"backupAccountID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CronjobClean struct {
|
type CronjobClean struct {
|
||||||
IsDelete bool `json:"isDelete"`
|
IsDelete bool `json:"isDelete"`
|
||||||
CleanData bool `json:"cleanData"`
|
CleanData bool `json:"cleanData"`
|
||||||
@@ -77,6 +89,7 @@ type CronjobInfo struct {
|
|||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
GroupID uint `json:"groupID"`
|
||||||
SpecCustom bool `json:"specCustom"`
|
SpecCustom bool `json:"specCustom"`
|
||||||
Spec string `json:"spec"`
|
Spec string `json:"spec"`
|
||||||
|
|
||||||
@@ -87,18 +100,20 @@ type CronjobInfo struct {
|
|||||||
ContainerName string `json:"containerName"`
|
ContainerName string `json:"containerName"`
|
||||||
User string `json:"user"`
|
User string `json:"user"`
|
||||||
|
|
||||||
ScriptID uint `json:"scriptID"`
|
ScriptID uint `json:"scriptID"`
|
||||||
AppID string `json:"appID"`
|
AppID string `json:"appID"`
|
||||||
Website string `json:"website"`
|
Website string `json:"website"`
|
||||||
ExclusionRules string `json:"exclusionRules"`
|
ExclusionRules string `json:"exclusionRules"`
|
||||||
DBType string `json:"dbType"`
|
DBType string `json:"dbType"`
|
||||||
DBName string `json:"dbName"`
|
DBName string `json:"dbName"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
IsDir bool `json:"isDir"`
|
IsDir bool `json:"isDir"`
|
||||||
SourceDir string `json:"sourceDir"`
|
SourceDir string `json:"sourceDir"`
|
||||||
RetainCopies int `json:"retainCopies"`
|
RetainCopies int `json:"retainCopies"`
|
||||||
RetryTimes int `json:"retryTimes"`
|
RetryTimes int `json:"retryTimes"`
|
||||||
Timeout uint `json:"timeout"`
|
Timeout uint `json:"timeout"`
|
||||||
|
IgnoreErr bool `json:"ignoreErr"`
|
||||||
|
SnapshotRule SnapshotRule `json:"snapshotRule"`
|
||||||
|
|
||||||
SourceAccounts []string `json:"sourceAccounts"`
|
SourceAccounts []string `json:"sourceAccounts"`
|
||||||
DownloadAccount string `json:"downloadAccount"`
|
DownloadAccount string `json:"downloadAccount"`
|
||||||
@@ -109,10 +124,64 @@ type CronjobInfo struct {
|
|||||||
LastRecordTime string `json:"lastRecordTime"`
|
LastRecordTime string `json:"lastRecordTime"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Secret string `json:"secret"`
|
Secret string `json:"secret"`
|
||||||
|
Args string `json:"args"`
|
||||||
|
|
||||||
AlertCount uint `json:"alertCount"`
|
AlertCount uint `json:"alertCount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CronjobImport struct {
|
||||||
|
Cronjobs []CronjobTrans `json:"cronjobs"`
|
||||||
|
}
|
||||||
|
type CronjobTrans struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
GroupID uint `json:"groupID"`
|
||||||
|
SpecCustom bool `json:"specCustom"`
|
||||||
|
Spec string `json:"spec"`
|
||||||
|
|
||||||
|
Executor string `json:"executor"`
|
||||||
|
ScriptMode string `json:"scriptMode"`
|
||||||
|
Script string `json:"script"`
|
||||||
|
Command string `json:"command"`
|
||||||
|
ContainerName string `json:"containerName"`
|
||||||
|
User string `json:"user"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
|
||||||
|
ScriptName string `json:"scriptName"`
|
||||||
|
Apps []TransHelper `json:"apps"`
|
||||||
|
Websites []string `json:"websites"`
|
||||||
|
DBType string `json:"dbType"`
|
||||||
|
DBNames []TransHelper `json:"dbName"`
|
||||||
|
|
||||||
|
ExclusionRules string `json:"exclusionRules"`
|
||||||
|
|
||||||
|
IsDir bool `json:"isDir"`
|
||||||
|
SourceDir string `json:"sourceDir"`
|
||||||
|
|
||||||
|
RetainCopies uint64 `json:"retainCopies"`
|
||||||
|
RetryTimes uint `json:"retryTimes"`
|
||||||
|
Timeout uint `json:"timeout"`
|
||||||
|
IgnoreErr bool `json:"ignoreErr"`
|
||||||
|
SnapshotRule SnapshotTransHelper `json:"snapshotRule"`
|
||||||
|
Secret string `json:"secret"`
|
||||||
|
Args string `json:"args"`
|
||||||
|
|
||||||
|
SourceAccounts []string `json:"sourceAccounts"`
|
||||||
|
DownloadAccount string `json:"downloadAccount"`
|
||||||
|
|
||||||
|
AlertCount uint `json:"alertCount"`
|
||||||
|
AlertTitle string `json:"alertTitle"`
|
||||||
|
AlertMethod string `json:"alertMethod"`
|
||||||
|
}
|
||||||
|
type TransHelper struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
DetailName string `json:"detailName"`
|
||||||
|
}
|
||||||
|
type SnapshotTransHelper struct {
|
||||||
|
WithImage bool `json:"withImage"`
|
||||||
|
IgnoreApps []TransHelper `json:"ignoreApps"`
|
||||||
|
}
|
||||||
|
|
||||||
type ScriptOptions struct {
|
type ScriptOptions struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|||||||
+38
-11
@@ -13,25 +13,44 @@ type DashboardBase struct {
|
|||||||
Platform string `json:"platform"`
|
Platform string `json:"platform"`
|
||||||
PlatformFamily string `json:"platformFamily"`
|
PlatformFamily string `json:"platformFamily"`
|
||||||
PlatformVersion string `json:"platformVersion"`
|
PlatformVersion string `json:"platformVersion"`
|
||||||
|
PrettyDistro string `json:"prettyDistro"`
|
||||||
KernelArch string `json:"kernelArch"`
|
KernelArch string `json:"kernelArch"`
|
||||||
KernelVersion string `json:"kernelVersion"`
|
KernelVersion string `json:"kernelVersion"`
|
||||||
VirtualizationSystem string `json:"virtualizationSystem"`
|
VirtualizationSystem string `json:"virtualizationSystem"`
|
||||||
IpV4Addr string `json:"ipV4Addr"`
|
IpV4Addr string `json:"ipV4Addr"`
|
||||||
SystemProxy string `json:"systemProxy"`
|
SystemProxy string `json:"systemProxy"`
|
||||||
|
|
||||||
CPUCores int `json:"cpuCores"`
|
CPUCores int `json:"cpuCores"`
|
||||||
CPULogicalCores int `json:"cpuLogicalCores"`
|
CPULogicalCores int `json:"cpuLogicalCores"`
|
||||||
CPUModelName string `json:"cpuModelName"`
|
CPUModelName string `json:"cpuModelName"`
|
||||||
|
CPUMhz float64 `json:"cpuMhz"`
|
||||||
|
|
||||||
|
QuickJumps []QuickJump `json:"quickJump"`
|
||||||
CurrentInfo DashboardCurrent `json:"currentInfo"`
|
CurrentInfo DashboardCurrent `json:"currentInfo"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChangeQuicks struct {
|
||||||
|
Quicks []QuickJump `json:"quicks"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type QuickJump struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Alias string `json:"alias"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Detail string `json:"detail"`
|
||||||
|
Recommend int `json:"recommend"`
|
||||||
|
IsShow bool `json:"isShow"`
|
||||||
|
Router string `json:"router"`
|
||||||
|
}
|
||||||
|
|
||||||
type OsInfo struct {
|
type OsInfo struct {
|
||||||
OS string `json:"os"`
|
OS string `json:"os"`
|
||||||
Platform string `json:"platform"`
|
Platform string `json:"platform"`
|
||||||
PlatformFamily string `json:"platformFamily"`
|
PlatformFamily string `json:"platformFamily"`
|
||||||
KernelArch string `json:"kernelArch"`
|
KernelArch string `json:"kernelArch"`
|
||||||
KernelVersion string `json:"kernelVersion"`
|
KernelVersion string `json:"kernelVersion"`
|
||||||
|
PrettyDistro string `json:"prettyDistro"`
|
||||||
|
|
||||||
DiskSize int64 `json:"diskSize"`
|
DiskSize int64 `json:"diskSize"`
|
||||||
}
|
}
|
||||||
@@ -42,9 +61,10 @@ type NodeCurrent struct {
|
|||||||
Load15 float64 `json:"load15"`
|
Load15 float64 `json:"load15"`
|
||||||
LoadUsagePercent float64 `json:"loadUsagePercent"`
|
LoadUsagePercent float64 `json:"loadUsagePercent"`
|
||||||
|
|
||||||
CPUUsedPercent float64 `json:"cpuUsedPercent"`
|
CPUUsedPercent float64 `json:"cpuUsedPercent"`
|
||||||
CPUUsed float64 `json:"cpuUsed"`
|
CPUUsed float64 `json:"cpuUsed"`
|
||||||
CPUTotal int `json:"cpuTotal"`
|
CPUTotal int `json:"cpuTotal"`
|
||||||
|
CPUDetailedPercent []float64 `json:"cpuDetailedPercent"`
|
||||||
|
|
||||||
MemoryTotal uint64 `json:"memoryTotal"`
|
MemoryTotal uint64 `json:"memoryTotal"`
|
||||||
MemoryAvailable uint64 `json:"memoryAvailable"`
|
MemoryAvailable uint64 `json:"memoryAvailable"`
|
||||||
@@ -68,14 +88,18 @@ type DashboardCurrent struct {
|
|||||||
Load15 float64 `json:"load15"`
|
Load15 float64 `json:"load15"`
|
||||||
LoadUsagePercent float64 `json:"loadUsagePercent"`
|
LoadUsagePercent float64 `json:"loadUsagePercent"`
|
||||||
|
|
||||||
CPUPercent []float64 `json:"cpuPercent"`
|
CPUPercent []float64 `json:"cpuPercent"`
|
||||||
CPUUsedPercent float64 `json:"cpuUsedPercent"`
|
CPUUsedPercent float64 `json:"cpuUsedPercent"`
|
||||||
CPUUsed float64 `json:"cpuUsed"`
|
CPUUsed float64 `json:"cpuUsed"`
|
||||||
CPUTotal int `json:"cpuTotal"`
|
CPUTotal int `json:"cpuTotal"`
|
||||||
|
CPUDetailedPercent []float64 `json:"cpuDetailedPercent"`
|
||||||
|
|
||||||
MemoryTotal uint64 `json:"memoryTotal"`
|
MemoryTotal uint64 `json:"memoryTotal"`
|
||||||
MemoryAvailable uint64 `json:"memoryAvailable"`
|
|
||||||
MemoryUsed uint64 `json:"memoryUsed"`
|
MemoryUsed uint64 `json:"memoryUsed"`
|
||||||
|
MemoryFree uint64 `json:"memoryFree"`
|
||||||
|
MemoryShard uint64 `json:"memoryShard"`
|
||||||
|
MemoryCache uint64 `json:"memoryCache"`
|
||||||
|
MemoryAvailable uint64 `json:"memoryAvailable"`
|
||||||
MemoryUsedPercent float64 `json:"memoryUsedPercent"`
|
MemoryUsedPercent float64 `json:"memoryUsedPercent"`
|
||||||
|
|
||||||
SwapMemoryTotal uint64 `json:"swapMemoryTotal"`
|
SwapMemoryTotal uint64 `json:"swapMemoryTotal"`
|
||||||
@@ -97,6 +121,9 @@ type DashboardCurrent struct {
|
|||||||
GPUData []GPUInfo `json:"gpuData"`
|
GPUData []GPUInfo `json:"gpuData"`
|
||||||
XPUData []XPUInfo `json:"xpuData"`
|
XPUData []XPUInfo `json:"xpuData"`
|
||||||
|
|
||||||
|
TopCPUItems []Process `json:"topCPUItems"`
|
||||||
|
TopMemItems []Process `json:"topMemItems"`
|
||||||
|
|
||||||
ShotTime time.Time `json:"shotTime"`
|
ShotTime time.Time `json:"shotTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+47
-22
@@ -4,14 +4,14 @@ import "time"
|
|||||||
|
|
||||||
// common
|
// common
|
||||||
type DBConfUpdateByFile struct {
|
type DBConfUpdateByFile struct {
|
||||||
Type string `json:"type" validate:"required,oneof=mysql mariadb postgresql redis"`
|
Type string `json:"type" validate:"required,oneof=mysql mariadb postgresql redis mysql-cluster postgresql-cluster redis-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
}
|
}
|
||||||
type ChangeDBInfo struct {
|
type ChangeDBInfo struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
From string `json:"from" validate:"required,oneof=local remote"`
|
From string `json:"from" validate:"required,oneof=local remote"`
|
||||||
Type string `json:"type" validate:"required,oneof=mysql mariadb postgresql"`
|
Type string `json:"type" validate:"required,oneof=mysql mariadb postgresql redis mysql-cluster postgresql-cluster redis-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
Value string `json:"value" validate:"required"`
|
Value string `json:"value" validate:"required"`
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,7 @@ type MysqlDBInfo struct {
|
|||||||
From string `json:"from"`
|
From string `json:"from"`
|
||||||
MysqlName string `json:"mysqlName"`
|
MysqlName string `json:"mysqlName"`
|
||||||
Format string `json:"format"`
|
Format string `json:"format"`
|
||||||
|
Collation string `json:"collation"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
Permission string `json:"permission"`
|
Permission string `json:"permission"`
|
||||||
@@ -57,13 +58,19 @@ type MysqlDBCreate struct {
|
|||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
From string `json:"from" validate:"required,oneof=local remote"`
|
From string `json:"from" validate:"required,oneof=local remote"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
Format string `json:"format" validate:"required,oneof=utf8mb4 utf8 gbk big5"`
|
Format string `json:"format" validate:"required"`
|
||||||
|
Collation string `json:"collation"`
|
||||||
Username string `json:"username" validate:"required"`
|
Username string `json:"username" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password" validate:"required"`
|
||||||
Permission string `json:"permission" validate:"required"`
|
Permission string `json:"permission" validate:"required"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MysqlFormatCollationOption struct {
|
||||||
|
Format string `json:"format"`
|
||||||
|
Collations []string `json:"collations"`
|
||||||
|
}
|
||||||
|
|
||||||
type BindUser struct {
|
type BindUser struct {
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
DB string `json:"db" validate:"required"`
|
DB string `json:"db" validate:"required"`
|
||||||
@@ -74,19 +81,19 @@ type BindUser struct {
|
|||||||
|
|
||||||
type MysqlLoadDB struct {
|
type MysqlLoadDB struct {
|
||||||
From string `json:"from" validate:"required,oneof=local remote"`
|
From string `json:"from" validate:"required,oneof=local remote"`
|
||||||
Type string `json:"type" validate:"required,oneof=mysql mariadb"`
|
Type string `json:"type" validate:"required,oneof=mysql mariadb mysql-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MysqlDBDeleteCheck struct {
|
type MysqlDBDeleteCheck struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
Type string `json:"type" validate:"required,oneof=mysql mariadb"`
|
Type string `json:"type" validate:"required,oneof=mysql mariadb mysql-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MysqlDBDelete struct {
|
type MysqlDBDelete struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
Type string `json:"type" validate:"required,oneof=mysql mariadb"`
|
Type string `json:"type" validate:"required,oneof=mysql mariadb mysql-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
ForceDelete bool `json:"forceDelete"`
|
ForceDelete bool `json:"forceDelete"`
|
||||||
DeleteBackup bool `json:"deleteBackup"`
|
DeleteBackup bool `json:"deleteBackup"`
|
||||||
@@ -153,7 +160,7 @@ type MysqlVariables struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MysqlVariablesUpdate struct {
|
type MysqlVariablesUpdate struct {
|
||||||
Type string `json:"type" validate:"required,oneof=mysql mariadb"`
|
Type string `json:"type" validate:"required,oneof=mysql mariadb mysql-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
Variables []MysqlVariablesUpdateHelper `json:"variables"`
|
Variables []MysqlVariablesUpdateHelper `json:"variables"`
|
||||||
}
|
}
|
||||||
@@ -174,6 +181,7 @@ type RedisConfUpdate struct {
|
|||||||
Timeout string `json:"timeout"`
|
Timeout string `json:"timeout"`
|
||||||
Maxclients string `json:"maxclients"`
|
Maxclients string `json:"maxclients"`
|
||||||
Maxmemory string `json:"maxmemory"`
|
Maxmemory string `json:"maxmemory"`
|
||||||
|
DBType string `json:"dbType" validate:"required,oneof=redis redis-cluster"`
|
||||||
}
|
}
|
||||||
type RedisConfPersistenceUpdate struct {
|
type RedisConfPersistenceUpdate struct {
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
@@ -181,6 +189,7 @@ type RedisConfPersistenceUpdate struct {
|
|||||||
Appendonly string `json:"appendonly"`
|
Appendonly string `json:"appendonly"`
|
||||||
Appendfsync string `json:"appendfsync"`
|
Appendfsync string `json:"appendfsync"`
|
||||||
Save string `json:"save"`
|
Save string `json:"save"`
|
||||||
|
DBType string `json:"dbType" validate:"required,oneof=redis redis-cluster"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RedisConf struct {
|
type RedisConf struct {
|
||||||
@@ -249,6 +258,7 @@ type DatabaseInfo struct {
|
|||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Port uint `json:"port"`
|
Port uint `json:"port"`
|
||||||
|
InitialDB string `json:"initialDB"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
|
|
||||||
@@ -258,6 +268,7 @@ type DatabaseInfo struct {
|
|||||||
ClientCert string `json:"clientCert"`
|
ClientCert string `json:"clientCert"`
|
||||||
SkipVerify bool `json:"skipVerify"`
|
SkipVerify bool `json:"skipVerify"`
|
||||||
|
|
||||||
|
Timeout uint `json:"timeout"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,14 +289,15 @@ type DatabaseItem struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DatabaseCreate struct {
|
type DatabaseCreate struct {
|
||||||
Name string `json:"name" validate:"required,max=256"`
|
Name string `json:"name" validate:"required,max=256"`
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
From string `json:"from" validate:"required,oneof=local remote"`
|
From string `json:"from" validate:"required,oneof=local remote"`
|
||||||
Version string `json:"version" validate:"required"`
|
Version string `json:"version" validate:"required"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Port uint `json:"port"`
|
Port uint `json:"port"`
|
||||||
Username string `json:"username" validate:"required"`
|
InitialDB string `json:"initialDB"`
|
||||||
Password string `json:"password"`
|
Username string `json:"username" validate:"required"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
|
||||||
SSL bool `json:"ssl"`
|
SSL bool `json:"ssl"`
|
||||||
RootCert string `json:"rootCert"`
|
RootCert string `json:"rootCert"`
|
||||||
@@ -293,17 +305,19 @@ type DatabaseCreate struct {
|
|||||||
ClientCert string `json:"clientCert"`
|
ClientCert string `json:"clientCert"`
|
||||||
SkipVerify bool `json:"skipVerify"`
|
SkipVerify bool `json:"skipVerify"`
|
||||||
|
|
||||||
|
Timeout uint `json:"timeout"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DatabaseUpdate struct {
|
type DatabaseUpdate struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
Version string `json:"version" validate:"required"`
|
Version string `json:"version" validate:"required"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Port uint `json:"port"`
|
Port uint `json:"port"`
|
||||||
Username string `json:"username" validate:"required"`
|
InitialDB string `json:"initialDB"`
|
||||||
Password string `json:"password"`
|
Username string `json:"username" validate:"required"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
|
||||||
SSL bool `json:"ssl"`
|
SSL bool `json:"ssl"`
|
||||||
RootCert string `json:"rootCert"`
|
RootCert string `json:"rootCert"`
|
||||||
@@ -311,6 +325,7 @@ type DatabaseUpdate struct {
|
|||||||
ClientCert string `json:"clientCert"`
|
ClientCert string `json:"clientCert"`
|
||||||
SkipVerify bool `json:"skipVerify"`
|
SkipVerify bool `json:"skipVerify"`
|
||||||
|
|
||||||
|
Timeout uint `json:"timeout"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,3 +334,13 @@ type DatabaseDelete struct {
|
|||||||
ForceDelete bool `json:"forceDelete"`
|
ForceDelete bool `json:"forceDelete"`
|
||||||
DeleteBackup bool `json:"deleteBackup"`
|
DeleteBackup bool `json:"deleteBackup"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type LoadRedisStatus struct {
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
Type string `json:"type" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DBResource struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,26 +60,20 @@ type PostgresqlPrivileges struct {
|
|||||||
|
|
||||||
type PostgresqlLoadDB struct {
|
type PostgresqlLoadDB struct {
|
||||||
From string `json:"from" validate:"required,oneof=local remote"`
|
From string `json:"from" validate:"required,oneof=local remote"`
|
||||||
Type string `json:"type" validate:"required,oneof=postgresql"`
|
Type string `json:"type" validate:"required,oneof=postgresql postgresql-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PostgresqlDBDeleteCheck struct {
|
type PostgresqlDBDeleteCheck struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
Type string `json:"type" validate:"required,oneof=postgresql"`
|
Type string `json:"type" validate:"required,oneof=postgresql postgresql-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PostgresqlDBDelete struct {
|
type PostgresqlDBDelete struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
Type string `json:"type" validate:"required,oneof=postgresql"`
|
Type string `json:"type" validate:"required,oneof=postgresql postgresql-cluster"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
ForceDelete bool `json:"forceDelete"`
|
ForceDelete bool `json:"forceDelete"`
|
||||||
DeleteBackup bool `json:"deleteBackup"`
|
DeleteBackup bool `json:"deleteBackup"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PostgresqlConfUpdateByFile struct {
|
|
||||||
Type string `json:"type" validate:"required,oneof=postgresql mariadb"`
|
|
||||||
Database string `json:"database" validate:"required"`
|
|
||||||
File string `json:"file"`
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ type SwapHelper struct {
|
|||||||
Size uint64 `json:"size"`
|
Size uint64 `json:"size"`
|
||||||
Used string `json:"used"`
|
Used string `json:"used"`
|
||||||
|
|
||||||
IsNew bool `json:"isNew"`
|
IsNew bool `json:"isNew"`
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TimeZoneOptions struct {
|
type TimeZoneOptions struct {
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
type LsblkDevice struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Size string `json:"size"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
MountPoint *string `json:"mountpoint"`
|
||||||
|
FsType *string `json:"fstype"`
|
||||||
|
Model *string `json:"model"`
|
||||||
|
Serial string `json:"serial"`
|
||||||
|
Tran string `json:"tran"`
|
||||||
|
Rota bool `json:"rota"`
|
||||||
|
Children []LsblkDevice `json:"children,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LsblkOutput struct {
|
||||||
|
BlockDevices []LsblkDevice `json:"blockdevices"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiskFormatRequest struct {
|
||||||
|
Device string `json:"device" `
|
||||||
|
Filesystem string `json:"filesystem" `
|
||||||
|
Label string `json:"label,omitempty" `
|
||||||
|
QuickFormat bool `json:"quickFormat,omitempty"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
type LogFileRes struct {
|
||||||
|
Lines []string `json:"lines"`
|
||||||
|
IsEndOfFile bool `json:"isEndOfFile"`
|
||||||
|
TotalPages int `json:"totalPages"`
|
||||||
|
TotalLines int `json:"totalLines"`
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ type FirewallBaseInfo struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
IsExist bool `json:"isExist"`
|
IsExist bool `json:"isExist"`
|
||||||
IsActive bool `json:"isActive"`
|
IsActive bool `json:"isActive"`
|
||||||
|
IsInit bool `json:"isInit"`
|
||||||
|
IsBind bool `json:"isBind"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
PingStatus string `json:"pingStatus"`
|
PingStatus string `json:"pingStatus"`
|
||||||
}
|
}
|
||||||
@@ -17,11 +19,14 @@ type RuleSearch struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FirewallOperation struct {
|
type FirewallOperation struct {
|
||||||
Operation string `json:"operation" validate:"required,oneof=start stop restart disablePing enablePing"`
|
Operation string `json:"operation" validate:"required,oneof=start stop restart disableBanPing enableBanPing"`
|
||||||
|
WithDockerRestart bool `json:"withDockerRestart"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PortRuleOperate struct {
|
type PortRuleOperate struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
Operation string `json:"operation" validate:"required,oneof=add remove"`
|
Operation string `json:"operation" validate:"required,oneof=add remove"`
|
||||||
|
Chain string `json:"chain"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Port string `json:"port" validate:"required"`
|
Port string `json:"port" validate:"required"`
|
||||||
Protocol string `json:"protocol" validate:"required,oneof=tcp udp tcp/udp"`
|
Protocol string `json:"protocol" validate:"required,oneof=tcp udp tcp/udp"`
|
||||||
@@ -36,6 +41,7 @@ type ForwardRuleOperate struct {
|
|||||||
Operation string `json:"operation" validate:"required,oneof=add remove"`
|
Operation string `json:"operation" validate:"required,oneof=add remove"`
|
||||||
Num string `json:"num"`
|
Num string `json:"num"`
|
||||||
Protocol string `json:"protocol" validate:"required,oneof=tcp udp tcp/udp"`
|
Protocol string `json:"protocol" validate:"required,oneof=tcp udp tcp/udp"`
|
||||||
|
Interface string `json:"interface"`
|
||||||
Port string `json:"port" validate:"required"`
|
Port string `json:"port" validate:"required"`
|
||||||
TargetIP string `json:"targetIP"`
|
TargetIP string `json:"targetIP"`
|
||||||
TargetPort string `json:"targetPort" validate:"required"`
|
TargetPort string `json:"targetPort" validate:"required"`
|
||||||
@@ -44,8 +50,11 @@ type ForwardRuleOperate struct {
|
|||||||
|
|
||||||
type UpdateFirewallDescription struct {
|
type UpdateFirewallDescription struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Address string `json:"address"`
|
Chain string `json:"chain"`
|
||||||
Port string `json:"port"`
|
SrcIP string `json:"srcIP"`
|
||||||
|
DstIP string `json:"dstIP"`
|
||||||
|
SrcPort string `json:"srcPort"`
|
||||||
|
DstPort string `json:"dstPort"`
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
Strategy string `json:"strategy" validate:"required,oneof=accept drop"`
|
Strategy string `json:"strategy" validate:"required,oneof=accept drop"`
|
||||||
|
|
||||||
@@ -53,6 +62,7 @@ type UpdateFirewallDescription struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AddrRuleOperate struct {
|
type AddrRuleOperate struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
Operation string `json:"operation" validate:"required,oneof=add remove"`
|
Operation string `json:"operation" validate:"required,oneof=add remove"`
|
||||||
Address string `json:"address" validate:"required"`
|
Address string `json:"address" validate:"required"`
|
||||||
Strategy string `json:"strategy" validate:"required,oneof=accept drop"`
|
Strategy string `json:"strategy" validate:"required,oneof=accept drop"`
|
||||||
@@ -74,3 +84,30 @@ type BatchRuleOperate struct {
|
|||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
Rules []PortRuleOperate `json:"rules"`
|
Rules []PortRuleOperate `json:"rules"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IptablesOp struct {
|
||||||
|
Name string `json:"name" validate:"required,oneof=1PANEL_INPUT 1PANEL_OUTPUT 1PANEL_BASIC"`
|
||||||
|
Operate string `json:"operate" validate:"required,oneof=init-base init-forward init-advance bind-base unbind-base bind unbind"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IptablesRuleOp struct {
|
||||||
|
Operation string `json:"operation" validate:"required,oneof=add remove"`
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Chain string `json:"chain" validate:"required,oneof=1PANEL_BASIC 1PANEL_BASIC_BEFORE 1PANEL_INPUT 1PANEL_OUTPUT"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
SrcIP string `json:"srcIP"`
|
||||||
|
SrcPort uint `json:"srcPort"`
|
||||||
|
DstIP string `json:"dstIP"`
|
||||||
|
DstPort uint `json:"dstPort"`
|
||||||
|
Strategy string `json:"strategy" validate:"required,oneof=accept drop reject"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IptablesBatchOperate struct {
|
||||||
|
Rules []IptablesRuleOp `json:"rules"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type IptablesChainStatus struct {
|
||||||
|
IsBind bool `json:"isBind"`
|
||||||
|
DefaultStrategy string `json:"defaultStrategy"`
|
||||||
|
}
|
||||||
|
|||||||
+20
-7
@@ -2,16 +2,27 @@ package dto
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
type PageImage struct {
|
||||||
|
PageInfo
|
||||||
|
Name string `json:"name"`
|
||||||
|
OrderBy string `json:"orderBy" validate:"required,oneof=size tags createdAt isUsed"`
|
||||||
|
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
||||||
|
}
|
||||||
|
|
||||||
type ImageInfo struct {
|
type ImageInfo struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
IsUsed bool `json:"isUsed"`
|
IsUsed bool `json:"isUsed"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
Size string `json:"size"`
|
Size int64 `json:"size"`
|
||||||
|
|
||||||
|
IsPinned bool `json:"isPinned"`
|
||||||
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageLoad struct {
|
type ImageLoad struct {
|
||||||
Path string `json:"path" validate:"required"`
|
TaskID string `json:"taskID"`
|
||||||
|
Paths []string `json:"paths" validate:"required,dive,required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageBuild struct {
|
type ImageBuild struct {
|
||||||
@@ -20,17 +31,18 @@ type ImageBuild struct {
|
|||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Dockerfile string `json:"dockerfile" validate:"required"`
|
Dockerfile string `json:"dockerfile" validate:"required"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
|
Args []string `json:"args"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImagePull struct {
|
type ImagePull struct {
|
||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
RepoID uint `json:"repoID"`
|
RepoID uint `json:"repoID"`
|
||||||
ImageName string `json:"imageName" validate:"required"`
|
ImageName []string `json:"imageName" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageTag struct {
|
type ImageTag struct {
|
||||||
SourceID string `json:"sourceID" validate:"required"`
|
SourceID string `json:"sourceID" validate:"required"`
|
||||||
TargetName string `json:"targetName" validate:"required"`
|
Tags []string `json:"tags" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImagePush struct {
|
type ImagePush struct {
|
||||||
@@ -41,6 +53,7 @@ type ImagePush struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ImageSave struct {
|
type ImageSave struct {
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
TagName string `json:"tagName" validate:"required"`
|
TagName string `json:"tagName" validate:"required"`
|
||||||
Path string `json:"path" validate:"required"`
|
Path string `json:"path" validate:"required"`
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ type ImageRepoCreate struct {
|
|||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
DownloadUrl string `json:"downloadUrl"`
|
DownloadUrl string `json:"downloadUrl"`
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
Username string `json:"username" validate:"max=256"`
|
Username string `json:"username"`
|
||||||
Password string `json:"password" validate:"max=256"`
|
Password string `json:"password"`
|
||||||
Auth bool `json:"auth"`
|
Auth bool `json:"auth"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,8 +15,8 @@ type ImageRepoUpdate struct {
|
|||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
DownloadUrl string `json:"downloadUrl"`
|
DownloadUrl string `json:"downloadUrl"`
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
Username string `json:"username" validate:"max=256"`
|
Username string `json:"username"`
|
||||||
Password string `json:"password" validate:"max=256"`
|
Password string `json:"password"`
|
||||||
Auth bool `json:"auth"`
|
Auth bool `json:"auth"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,25 +4,78 @@ import "time"
|
|||||||
|
|
||||||
type MonitorSearch struct {
|
type MonitorSearch struct {
|
||||||
Param string `json:"param" validate:"required,oneof=all cpu memory load io network"`
|
Param string `json:"param" validate:"required,oneof=all cpu memory load io network"`
|
||||||
Info string `json:"info"`
|
IO string `json:"io"`
|
||||||
|
Network string `json:"network"`
|
||||||
StartTime time.Time `json:"startTime"`
|
StartTime time.Time `json:"startTime"`
|
||||||
EndTime time.Time `json:"endTime"`
|
EndTime time.Time `json:"endTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MonitorData struct {
|
type MonitorData struct {
|
||||||
Param string `json:"param" validate:"required,oneof=cpu memory load io network"`
|
Param string `json:"param"`
|
||||||
Date []time.Time `json:"date"`
|
Date []time.Time `json:"date"`
|
||||||
Value []interface{} `json:"value"`
|
Value []interface{} `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Process struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Pid int32 `json:"pid"`
|
||||||
|
Percent float64 `json:"percent"`
|
||||||
|
Memory uint64 `json:"memory"`
|
||||||
|
Cmd string `json:"cmd"`
|
||||||
|
User string `json:"user"`
|
||||||
|
}
|
||||||
|
|
||||||
type MonitorSetting struct {
|
type MonitorSetting struct {
|
||||||
MonitorStatus string `json:"monitorStatus"`
|
MonitorStatus string `json:"monitorStatus"`
|
||||||
MonitorStoreDays string `json:"monitorStoreDays"`
|
MonitorStoreDays string `json:"monitorStoreDays"`
|
||||||
MonitorInterval string `json:"monitorInterval"`
|
MonitorInterval string `json:"monitorInterval"`
|
||||||
DefaultNetwork string `json:"defaultNetwork"`
|
DefaultNetwork string `json:"defaultNetwork"`
|
||||||
|
DefaultIO string `json:"defaultIO"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MonitorSettingUpdate struct {
|
type MonitorSettingUpdate struct {
|
||||||
Key string `json:"key" validate:"required,oneof=MonitorStatus MonitorStoreDays MonitorInterval DefaultNetwork"`
|
Key string `json:"key" validate:"required,oneof=MonitorStatus MonitorStoreDays MonitorInterval DefaultNetwork DefaultIO"`
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MonitorGPUOptions struct {
|
||||||
|
GPUType string `json:"gpuType"`
|
||||||
|
ChartHide []GPUChartHide `json:"chartHide"`
|
||||||
|
Options []string `json:"options"`
|
||||||
|
}
|
||||||
|
type GPUChartHide struct {
|
||||||
|
ProductName string `json:"productName"`
|
||||||
|
Process bool `json:"process"`
|
||||||
|
GPU bool `json:"gpu"`
|
||||||
|
Memory bool `json:"memory"`
|
||||||
|
Power bool `json:"power"`
|
||||||
|
Temperature bool `json:"temperature"`
|
||||||
|
Speed bool `json:"speed"`
|
||||||
|
}
|
||||||
|
type MonitorGPUSearch struct {
|
||||||
|
ProductName string `json:"productName"`
|
||||||
|
StartTime time.Time `json:"startTime"`
|
||||||
|
EndTime time.Time `json:"endTime"`
|
||||||
|
}
|
||||||
|
type MonitorGPUData struct {
|
||||||
|
Date []time.Time `json:"date"`
|
||||||
|
GPUValue []float64 `json:"gpuValue"`
|
||||||
|
TemperatureValue []float64 `json:"temperatureValue"`
|
||||||
|
PowerTotal []float64 `json:"powerTotal"`
|
||||||
|
PowerUsed []float64 `json:"powerUsed"`
|
||||||
|
PowerPercent []float64 `json:"powerPercent"`
|
||||||
|
MemoryTotal []float64 `json:"memoryTotal"`
|
||||||
|
MemoryUsed []float64 `json:"memoryUsed"`
|
||||||
|
MemoryPercent []float64 `json:"memoryPercent"`
|
||||||
|
SpeedValue []int `json:"speedValue"`
|
||||||
|
|
||||||
|
ProcessCount []int `json:"processCount"`
|
||||||
|
GPUProcesses [][]GPUProcess `json:"gpuProcesses"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GPUProcess struct {
|
||||||
|
Pid string `json:"pid"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
ProcessName string `json:"processName"`
|
||||||
|
UsedMemory string `json:"usedMemory"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -73,12 +73,13 @@ type NginxUpstream struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NginxUpstreamServer struct {
|
type NginxUpstreamServer struct {
|
||||||
Server string `json:"server"`
|
Server string `json:"server"`
|
||||||
Weight int `json:"weight"`
|
Weight int `json:"weight"`
|
||||||
FailTimeout string `json:"failTimeout"`
|
FailTimeout int `json:"failTimeout"`
|
||||||
MaxFails int `json:"maxFails"`
|
FailTimeoutUnit string `json:"failTimeoutUnit"`
|
||||||
MaxConns int `json:"maxConns"`
|
MaxFails int `json:"maxFails"`
|
||||||
Flag string `json:"flag"`
|
MaxConns int `json:"maxConns"`
|
||||||
|
Flag string `json:"flag"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var LBAlgorithms = map[string]struct{}{"ip_hash": {}, "least_conn": {}}
|
var LBAlgorithms = map[string]struct{}{"ip_hash": {}, "least_conn": {}}
|
||||||
|
|||||||
@@ -22,7 +22,16 @@ type AppInstallCreate struct {
|
|||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Services map[string]string `json:"services"`
|
Services map[string]string `json:"services"`
|
||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
|
|
||||||
AppContainerConfig
|
AppContainerConfig
|
||||||
|
NodePushConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
type NodePushConfig struct {
|
||||||
|
Nodes []string `json:"nodes"`
|
||||||
|
PushNode bool `json:"pushNode"`
|
||||||
|
AppKey string `json:"appKey"`
|
||||||
|
Version string `json:"version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppContainerConfig struct {
|
type AppContainerConfig struct {
|
||||||
@@ -40,17 +49,19 @@ type AppContainerConfig struct {
|
|||||||
WebUI string `json:"webUI"`
|
WebUI string `json:"webUI"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
SpecifyIP string `json:"specifyIP"`
|
SpecifyIP string `json:"specifyIP"`
|
||||||
|
RestartPolicy string `json:"restartPolicy" validate:"omitempty,oneof=always unless-stopped no on-failure"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppInstalledSearch struct {
|
type AppInstalledSearch struct {
|
||||||
dto.PageInfo
|
dto.PageInfo
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
Update bool `json:"update"`
|
Update bool `json:"update"`
|
||||||
Unused bool `json:"unused"`
|
Unused bool `json:"unused"`
|
||||||
All bool `json:"all"`
|
All bool `json:"all"`
|
||||||
Sync bool `json:"sync"`
|
Sync bool `json:"sync"`
|
||||||
|
CheckUpdate bool `json:"checkUpdate"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppInstalledInfo struct {
|
type AppInstalledInfo struct {
|
||||||
@@ -127,3 +138,12 @@ type AppUpdateVersion struct {
|
|||||||
AppInstallID uint `json:"appInstallID" validate:"required"`
|
AppInstallID uint `json:"appInstallID" validate:"required"`
|
||||||
UpdateVersion string `json:"updateVersion"`
|
UpdateVersion string `json:"updateVersion"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AppInstallSortItem struct {
|
||||||
|
InstallID uint `json:"installID"`
|
||||||
|
SortOrder int `json:"sortOrder"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AppInstallSort struct {
|
||||||
|
Items []AppInstallSortItem `json:"items" validate:"required"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package request
|
||||||
|
|
||||||
|
type DiskPartitionRequest struct {
|
||||||
|
Device string `json:"device" validate:"required"`
|
||||||
|
Filesystem string `json:"filesystem" validate:"required,oneof=ext4 xfs"`
|
||||||
|
Label string `json:"label"`
|
||||||
|
AutoMount bool `json:"autoMount"`
|
||||||
|
MountPoint string `json:"mountPoint" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiskMountRequest struct {
|
||||||
|
Device string `json:"device" validate:"required"`
|
||||||
|
MountPoint string `json:"mountPoint" validate:"required"`
|
||||||
|
Filesystem string `json:"filesystem" validate:"required,oneof=ext4 xfs"`
|
||||||
|
AutoMount bool `json:"autoMount"`
|
||||||
|
NoFail bool `json:"noFail"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiskUnmountRequest struct {
|
||||||
|
MountPoint string `json:"mountPoint" validate:"required"`
|
||||||
|
}
|
||||||
@@ -13,7 +13,6 @@ type FileContentReq struct {
|
|||||||
Path string `json:"path" validate:"required"`
|
Path string `json:"path" validate:"required"`
|
||||||
IsDetail bool `json:"isDetail"`
|
IsDetail bool `json:"isDetail"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchUploadWithPage struct {
|
type SearchUploadWithPage struct {
|
||||||
dto.PageInfo
|
dto.PageInfo
|
||||||
Path string `json:"path" validate:"required"`
|
Path string `json:"path" validate:"required"`
|
||||||
@@ -92,11 +91,12 @@ type FileWget struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FileMove struct {
|
type FileMove struct {
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
OldPaths []string `json:"oldPaths" validate:"required"`
|
OldPaths []string `json:"oldPaths" validate:"required"`
|
||||||
NewPath string `json:"newPath" validate:"required"`
|
NewPath string `json:"newPath" validate:"required"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Cover bool `json:"cover"`
|
Cover bool `json:"cover"`
|
||||||
|
CoverPaths []string `json:"coverPaths"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileDownload struct {
|
type FileDownload struct {
|
||||||
@@ -147,3 +147,28 @@ type FileExistReq struct {
|
|||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Dir string `json:"dir" validate:"required"`
|
Dir string `json:"dir" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FileConvert struct {
|
||||||
|
Path string `json:"path" validate:"required"`
|
||||||
|
Type string `json:"type" validate:"required"`
|
||||||
|
InputFile string `json:"inputFile" validate:"required"`
|
||||||
|
Extension string `json:"extension" validate:"required"`
|
||||||
|
OutputFormat string `json:"outputFormat" validate:"required"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileConvertRequest struct {
|
||||||
|
Files []FileConvert `json:"files" validate:"required"`
|
||||||
|
OutputPath string `json:"outputPath" validate:"required"`
|
||||||
|
DeleteSource bool `json:"deleteSource"`
|
||||||
|
TaskID string `json:"taskID"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileRemarkBatch struct {
|
||||||
|
Paths []string `json:"paths" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileRemarkUpdate struct {
|
||||||
|
Path string `json:"path" validate:"required"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ type SupervisorProcessConfig struct {
|
|||||||
Dir string `json:"dir"`
|
Dir string `json:"dir"`
|
||||||
Numprocs string `json:"numprocs"`
|
Numprocs string `json:"numprocs"`
|
||||||
AutoRestart string `json:"autoRestart"`
|
AutoRestart string `json:"autoRestart"`
|
||||||
|
AutoStart string `json:"autoStart"`
|
||||||
|
Environment string `json:"environment"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SupervisorProcessFileReq struct {
|
type SupervisorProcessFileReq struct {
|
||||||
|
|||||||
@@ -9,15 +9,18 @@ type McpServerSearch struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type McpServerCreate struct {
|
type McpServerCreate struct {
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Command string `json:"command" validate:"required"`
|
Command string `json:"command" validate:"required"`
|
||||||
Environments []Environment `json:"environments"`
|
Environments []Environment `json:"environments"`
|
||||||
Volumes []Volume `json:"volumes"`
|
Volumes []Volume `json:"volumes"`
|
||||||
Port int `json:"port" validate:"required"`
|
Port int `json:"port" validate:"required"`
|
||||||
ContainerName string `json:"containerName"`
|
ContainerName string `json:"containerName"`
|
||||||
BaseURL string `json:"baseUrl"`
|
BaseURL string `json:"baseUrl"`
|
||||||
SsePath string `json:"ssePath"`
|
SsePath string `json:"ssePath"`
|
||||||
HostIP string `json:"hostIP"`
|
HostIP string `json:"hostIP"`
|
||||||
|
StreamableHttpPath string `json:"streamableHttpPath"`
|
||||||
|
OutputTransport string `json:"outputTransport" validate:"required"`
|
||||||
|
Type string `json:"type" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type McpServerUpdate struct {
|
type McpServerUpdate struct {
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ type NginxCommonReq struct {
|
|||||||
|
|
||||||
type NginxAntiLeechUpdate struct {
|
type NginxAntiLeechUpdate struct {
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
Extends string `json:"extends" validate:"required"`
|
Extends string `json:"extends"`
|
||||||
Return string `json:"return" validate:"required"`
|
Return string `json:"return"`
|
||||||
Enable bool `json:"enable" `
|
Enable bool `json:"enable" `
|
||||||
ServerNames []string `json:"serverNames"`
|
ServerNames []string `json:"serverNames"`
|
||||||
Cache bool `json:"cache"`
|
Cache bool `json:"cache"`
|
||||||
@@ -126,3 +126,12 @@ type NginxModuleUpdate struct {
|
|||||||
Enable bool `json:"enable"`
|
Enable bool `json:"enable"`
|
||||||
Params string `json:"params"`
|
Params string `json:"params"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NginxOperateReq struct {
|
||||||
|
Operate string `json:"operate" validate:"required,oneof=enable disable"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type NginxDefaultHTTPSUpdate struct {
|
||||||
|
Operate string `json:"operate" validate:"required,oneof=enable disable"`
|
||||||
|
SSLRejectHandshake bool `json:"sslRejectHandshake"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,15 +12,17 @@ type RuntimeSearch struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RuntimeCreate struct {
|
type RuntimeCreate struct {
|
||||||
AppDetailID uint `json:"appDetailId"`
|
AppDetailID uint `json:"appDetailId"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Params map[string]interface{} `json:"params"`
|
Resource string `json:"resource"`
|
||||||
Resource string `json:"resource"`
|
Image string `json:"image"`
|
||||||
Image string `json:"image"`
|
Type string `json:"type"`
|
||||||
Type string `json:"type"`
|
Version string `json:"version"`
|
||||||
Version string `json:"version"`
|
Source string `json:"source"`
|
||||||
Source string `json:"source"`
|
CodeDir string `json:"codeDir"`
|
||||||
CodeDir string `json:"codeDir"`
|
Remark string `json:"remark"`
|
||||||
|
|
||||||
|
Params map[string]interface{} `json:"params"`
|
||||||
NodeConfig
|
NodeConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +32,7 @@ type NodeConfig struct {
|
|||||||
ExposedPorts []ExposedPort `json:"exposedPorts"`
|
ExposedPorts []ExposedPort `json:"exposedPorts"`
|
||||||
Environments []Environment `json:"environments"`
|
Environments []Environment `json:"environments"`
|
||||||
Volumes []Volume `json:"volumes"`
|
Volumes []Volume `json:"volumes"`
|
||||||
|
ExtraHosts []ExtraHost `json:"extraHosts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Environment struct {
|
type Environment struct {
|
||||||
@@ -47,20 +50,27 @@ type ExposedPort struct {
|
|||||||
HostIP string `json:"hostIP"`
|
HostIP string `json:"hostIP"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExtraHost struct {
|
||||||
|
Hostname string `json:"hostname"`
|
||||||
|
IP string `json:"ip"`
|
||||||
|
}
|
||||||
|
|
||||||
type RuntimeDelete struct {
|
type RuntimeDelete struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
ForceDelete bool `json:"forceDelete"`
|
ForceDelete bool `json:"forceDelete"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RuntimeUpdate struct {
|
type RuntimeUpdate struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Params map[string]interface{} `json:"params"`
|
Image string `json:"image"`
|
||||||
Image string `json:"image"`
|
Version string `json:"version"`
|
||||||
Version string `json:"version"`
|
Rebuild bool `json:"rebuild"`
|
||||||
Rebuild bool `json:"rebuild"`
|
Source string `json:"source"`
|
||||||
Source string `json:"source"`
|
CodeDir string `json:"codeDir"`
|
||||||
CodeDir string `json:"codeDir"`
|
Remark string `json:"remark"`
|
||||||
|
|
||||||
|
Params map[string]interface{} `json:"params"`
|
||||||
NodeConfig
|
NodeConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +106,7 @@ type PHPConfigUpdate struct {
|
|||||||
Scope string `json:"scope" validate:"required"`
|
Scope string `json:"scope" validate:"required"`
|
||||||
DisableFunctions []string `json:"disableFunctions"`
|
DisableFunctions []string `json:"disableFunctions"`
|
||||||
UploadMaxSize string `json:"uploadMaxSize"`
|
UploadMaxSize string `json:"uploadMaxSize"`
|
||||||
|
MaxExecutionTime string `json:"maxExecutionTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PHPFileUpdate struct {
|
type PHPFileUpdate struct {
|
||||||
@@ -130,4 +141,10 @@ type PHPContainerConfig struct {
|
|||||||
ExposedPorts []ExposedPort `json:"exposedPorts"`
|
ExposedPorts []ExposedPort `json:"exposedPorts"`
|
||||||
Environments []Environment `json:"environments"`
|
Environments []Environment `json:"environments"`
|
||||||
Volumes []Volume `json:"volumes"`
|
Volumes []Volume `json:"volumes"`
|
||||||
|
ExtraHosts []ExtraHost `json:"extraHosts"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RuntimeRemark struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package request
|
||||||
|
|
||||||
|
import "github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
|
|
||||||
|
type TensorRTLLMSearch struct {
|
||||||
|
dto.PageInfo
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TensorRTLLMCreate struct {
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
ContainerName string `json:"containerName" validate:"required"`
|
||||||
|
Version string `json:"version" validate:"required"`
|
||||||
|
ModelDir string `json:"modelDir" validate:"required"`
|
||||||
|
Image string `json:"image" validate:"required"`
|
||||||
|
Command string `json:"command" validate:"required"`
|
||||||
|
ModelType string `json:"modelType"`
|
||||||
|
ModelSpeedup bool `json:"modelSpeedup"`
|
||||||
|
DockerConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
type TensorRTLLMUpdate struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
TensorRTLLMCreate
|
||||||
|
}
|
||||||
|
|
||||||
|
type TensorRTLLMDelete struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TensorRTLLMOperate struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
Operate string `json:"operate" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DockerConfig struct {
|
||||||
|
ExposedPorts []ExposedPort `json:"exposedPorts"`
|
||||||
|
Environments []Environment `json:"environments"`
|
||||||
|
Volumes []Volume `json:"volumes"`
|
||||||
|
}
|
||||||
@@ -32,10 +32,28 @@ type WebsiteCreate struct {
|
|||||||
TaskID string `json:"taskID"`
|
TaskID string `json:"taskID"`
|
||||||
ParentWebsiteID uint `json:"parentWebsiteID"`
|
ParentWebsiteID uint `json:"parentWebsiteID"`
|
||||||
|
|
||||||
|
SiteDir string `json:"siteDir"`
|
||||||
|
|
||||||
RuntimeConfig
|
RuntimeConfig
|
||||||
FtpConfig
|
FtpConfig
|
||||||
DataBaseConfig
|
DataBaseConfig
|
||||||
SSLConfig
|
SSLConfig
|
||||||
|
StreamConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
type StreamConfig struct {
|
||||||
|
StreamPorts string `json:"streamPorts"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Algorithm string `json:"algorithm"`
|
||||||
|
UDP bool `json:"udp"`
|
||||||
|
|
||||||
|
Servers []dto.NginxUpstreamServer `json:"servers"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type StreamUpdate struct {
|
||||||
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
|
|
||||||
|
StreamConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteOptionReq struct {
|
type WebsiteOptionReq struct {
|
||||||
@@ -93,6 +111,7 @@ type WebsiteDelete struct {
|
|||||||
DeleteApp bool `json:"deleteApp"`
|
DeleteApp bool `json:"deleteApp"`
|
||||||
DeleteBackup bool `json:"deleteBackup"`
|
DeleteBackup bool `json:"deleteBackup"`
|
||||||
ForceDelete bool `json:"forceDelete"`
|
ForceDelete bool `json:"forceDelete"`
|
||||||
|
DeleteDB bool `json:"deleteDB"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteOp struct {
|
type WebsiteOp struct {
|
||||||
@@ -100,6 +119,36 @@ type WebsiteOp struct {
|
|||||||
Operate string `json:"operate"`
|
Operate string `json:"operate"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BatchWebsiteOp struct {
|
||||||
|
IDs []uint `json:"ids" validate:"required"`
|
||||||
|
Operate string `json:"operate" validate:"required"`
|
||||||
|
TaskID string `json:"taskID" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BatchWebsiteGroup struct {
|
||||||
|
IDs []uint `json:"ids" validate:"required"`
|
||||||
|
GroupID uint `json:"groupID" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BatchWebsiteHttps struct {
|
||||||
|
IDs []uint `json:"ids" validate:"required"`
|
||||||
|
TaskID string `json:"taskID" validate:"required"`
|
||||||
|
WebsiteSSLID uint `json:"websiteSSLId"`
|
||||||
|
Type string `json:"type" validate:"oneof=existed auto manual"`
|
||||||
|
PrivateKey string `json:"privateKey"`
|
||||||
|
Certificate string `json:"certificate"`
|
||||||
|
PrivateKeyPath string `json:"privateKeyPath"`
|
||||||
|
CertificatePath string `json:"certificatePath"`
|
||||||
|
ImportType string `json:"importType"`
|
||||||
|
HttpConfig string `json:"httpConfig" validate:"oneof=HTTPSOnly HTTPAlso HTTPToHTTPS"`
|
||||||
|
SSLProtocol []string `json:"SSLProtocol"`
|
||||||
|
Algorithm string `json:"algorithm"`
|
||||||
|
Hsts bool `json:"hsts"`
|
||||||
|
HstsIncludeSubDomains bool `json:"hstsIncludeSubDomains"`
|
||||||
|
HttpsPorts []int `json:"httpsPorts"`
|
||||||
|
Http3 bool `json:"http3"`
|
||||||
|
}
|
||||||
|
|
||||||
type WebsiteRedirectUpdate struct {
|
type WebsiteRedirectUpdate struct {
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
WebsiteID uint `json:"websiteId" validate:"required"`
|
||||||
Key string `json:"key" validate:"required"`
|
Key string `json:"key" validate:"required"`
|
||||||
@@ -150,21 +199,22 @@ type WebsiteDomainDelete struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteHTTPSOp struct {
|
type WebsiteHTTPSOp struct {
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
WebsiteID uint `json:"websiteId" validate:"required"`
|
||||||
Enable bool `json:"enable"`
|
Enable bool `json:"enable"`
|
||||||
WebsiteSSLID uint `json:"websiteSSLId"`
|
WebsiteSSLID uint `json:"websiteSSLId"`
|
||||||
Type string `json:"type" validate:"oneof=existed auto manual"`
|
Type string `json:"type" validate:"oneof=existed auto manual"`
|
||||||
PrivateKey string `json:"privateKey"`
|
PrivateKey string `json:"privateKey"`
|
||||||
Certificate string `json:"certificate"`
|
Certificate string `json:"certificate"`
|
||||||
PrivateKeyPath string `json:"privateKeyPath"`
|
PrivateKeyPath string `json:"privateKeyPath"`
|
||||||
CertificatePath string `json:"certificatePath"`
|
CertificatePath string `json:"certificatePath"`
|
||||||
ImportType string `json:"importType"`
|
ImportType string `json:"importType"`
|
||||||
HttpConfig string `json:"httpConfig" validate:"oneof=HTTPSOnly HTTPAlso HTTPToHTTPS"`
|
HttpConfig string `json:"httpConfig" validate:"oneof=HTTPSOnly HTTPAlso HTTPToHTTPS"`
|
||||||
SSLProtocol []string `json:"SSLProtocol"`
|
SSLProtocol []string `json:"SSLProtocol"`
|
||||||
Algorithm string `json:"algorithm"`
|
Algorithm string `json:"algorithm"`
|
||||||
Hsts bool `json:"hsts"`
|
Hsts bool `json:"hsts"`
|
||||||
HttpsPorts []int `json:"httpsPorts"`
|
HstsIncludeSubDomains bool `json:"hstsIncludeSubDomains"`
|
||||||
Http3 bool `json:"http3"`
|
HttpsPorts []int `json:"httpsPorts"`
|
||||||
|
Http3 bool `json:"http3"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteNginxUpdate struct {
|
type WebsiteNginxUpdate struct {
|
||||||
@@ -201,22 +251,50 @@ type WebsiteUpdateDirPermission struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteProxyConfig struct {
|
type WebsiteProxyConfig struct {
|
||||||
ID uint `json:"id" validate:"required"`
|
ID uint `json:"id" validate:"required"`
|
||||||
Operate string `json:"operate" validate:"required"`
|
Operate string `json:"operate" validate:"required"`
|
||||||
Enable bool `json:"enable" `
|
Enable bool `json:"enable" `
|
||||||
Cache bool `json:"cache" `
|
Cache bool `json:"cache" `
|
||||||
CacheTime int `json:"cacheTime" `
|
CacheTime int `json:"cacheTime"`
|
||||||
CacheUnit string `json:"cacheUnit"`
|
CacheUnit string `json:"cacheUnit"`
|
||||||
Name string `json:"name" validate:"required"`
|
ServerCacheTime int `json:"serverCacheTime"`
|
||||||
Modifier string `json:"modifier"`
|
ServerCacheUnit string `json:"serverCacheUnit"`
|
||||||
Match string `json:"match" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
ProxyPass string `json:"proxyPass" validate:"required"`
|
Modifier string `json:"modifier"`
|
||||||
ProxyHost string `json:"proxyHost" validate:"required"`
|
Match string `json:"match" validate:"required"`
|
||||||
Content string `json:"content"`
|
ProxyPass string `json:"proxyPass" validate:"required"`
|
||||||
FilePath string `json:"filePath"`
|
ProxyHost string `json:"proxyHost" validate:"required"`
|
||||||
Replaces map[string]string `json:"replaces"`
|
Content string `json:"content"`
|
||||||
SNI bool `json:"sni"`
|
FilePath string `json:"filePath"`
|
||||||
ProxySSLName string `json:"proxySSLName"`
|
Replaces map[string]string `json:"replaces"`
|
||||||
|
SNI bool `json:"sni"`
|
||||||
|
ProxySSLName string `json:"proxySSLName"`
|
||||||
|
CorsConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
type WebsiteProxyDelete struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type WebsiteProxyStatusUpdate struct {
|
||||||
|
ID uint `json:"id" validate:"required"`
|
||||||
|
Name string `json:"name" validate:"required"`
|
||||||
|
Status string `json:"status" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CorsConfig struct {
|
||||||
|
Cors bool `json:"cors"`
|
||||||
|
AllowOrigins string `json:"allowOrigins"`
|
||||||
|
AllowMethods string `json:"allowMethods"`
|
||||||
|
AllowHeaders string `json:"allowHeaders"`
|
||||||
|
AllowCredentials bool `json:"allowCredentials"`
|
||||||
|
Preflight bool `json:"preflight"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CorsConfigReq struct {
|
||||||
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
|
CorsConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteProxyReq struct {
|
type WebsiteProxyReq struct {
|
||||||
@@ -244,6 +322,7 @@ type WebsiteHtmlReq struct {
|
|||||||
type WebsiteHtmlUpdate struct {
|
type WebsiteHtmlUpdate struct {
|
||||||
Type string `json:"type" validate:"required"`
|
Type string `json:"type" validate:"required"`
|
||||||
Content string `json:"content" validate:"required"`
|
Content string `json:"content" validate:"required"`
|
||||||
|
Sync bool `json:"sync"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteLBCreate struct {
|
type WebsiteLBCreate struct {
|
||||||
@@ -281,8 +360,8 @@ type WebsiteRealIP struct {
|
|||||||
|
|
||||||
type ChangeDatabase struct {
|
type ChangeDatabase struct {
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
DatabaseID uint `json:"databaseID" validate:"required"`
|
DatabaseID uint `json:"databaseID" `
|
||||||
DatabaseType string `json:"databaseType" validate:"required"`
|
DatabaseType string `json:"databaseType" `
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteProxyDel struct {
|
type WebsiteProxyDel struct {
|
||||||
@@ -294,3 +373,13 @@ type CrossSiteAccessOp struct {
|
|||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
Operation string `json:"operation" validate:"required,oneof=Enable Disable"`
|
Operation string `json:"operation" validate:"required,oneof=Enable Disable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExecComposerReq struct {
|
||||||
|
Command string `json:"command" validate:"required"`
|
||||||
|
ExtCommand string `json:"extCommand"`
|
||||||
|
Mirror string `json:"mirror" validate:"required"`
|
||||||
|
Dir string `json:"dir" validate:"required"`
|
||||||
|
User string `json:"user" validate:"required"`
|
||||||
|
WebsiteID uint `json:"websiteID" validate:"required"`
|
||||||
|
TaskID string `json:"taskID" validate:"required"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ type WebsiteSSLSearch struct {
|
|||||||
dto.PageInfo
|
dto.PageInfo
|
||||||
AcmeAccountID string `json:"acmeAccountID"`
|
AcmeAccountID string `json:"acmeAccountID"`
|
||||||
Domain string `json:"domain"`
|
Domain string `json:"domain"`
|
||||||
|
OrderBy string `json:"orderBy" validate:"omitempty,oneof=created_at expire_date"`
|
||||||
|
Order string `json:"order" validate:"omitempty,oneof=null ascending descending"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type WebsiteSSLListReq struct {
|
||||||
|
AcmeAccountID string `json:"acmeAccountID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteSSLCreate struct {
|
type WebsiteSSLCreate struct {
|
||||||
@@ -27,6 +33,9 @@ type WebsiteSSLCreate struct {
|
|||||||
Nameserver2 string `json:"nameserver2"`
|
Nameserver2 string `json:"nameserver2"`
|
||||||
ExecShell bool `json:"execShell"`
|
ExecShell bool `json:"execShell"`
|
||||||
Shell string `json:"shell"`
|
Shell string `json:"shell"`
|
||||||
|
PushNode bool `json:"pushNode"`
|
||||||
|
Nodes string `json:"nodes"`
|
||||||
|
IsIp bool `json:"isIp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteDNSReq struct {
|
type WebsiteDNSReq struct {
|
||||||
@@ -58,6 +67,7 @@ type WebsiteAcmeAccountCreate struct {
|
|||||||
EabHmacKey string `json:"eabHmacKey"`
|
EabHmacKey string `json:"eabHmacKey"`
|
||||||
UseProxy bool `json:"useProxy"`
|
UseProxy bool `json:"useProxy"`
|
||||||
CaDirURL string `json:"caDirURL"`
|
CaDirURL string `json:"caDirURL"`
|
||||||
|
UseEAB bool `json:"useEAB"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteAcmeAccountUpdate struct {
|
type WebsiteAcmeAccountUpdate struct {
|
||||||
@@ -105,6 +115,8 @@ type WebsiteSSLUpdate struct {
|
|||||||
Nameserver2 string `json:"nameserver2"`
|
Nameserver2 string `json:"nameserver2"`
|
||||||
ExecShell bool `json:"execShell"`
|
ExecShell bool `json:"execShell"`
|
||||||
Shell string `json:"shell"`
|
Shell string `json:"shell"`
|
||||||
|
PushNode bool `json:"pushNode"`
|
||||||
|
Nodes string `json:"nodes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteSSLUpload struct {
|
type WebsiteSSLUpload struct {
|
||||||
@@ -151,3 +163,9 @@ type WebsiteCAObtain struct {
|
|||||||
type WebsiteCARenew struct {
|
type WebsiteCARenew struct {
|
||||||
SSLID uint `json:"SSLID" validate:"required"`
|
SSLID uint `json:"SSLID" validate:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type WebsiteSSLFileUpload struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
SSLID uint64 `json:"sslID"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,22 +29,18 @@ type AppDTO struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AppItem struct {
|
type AppItem struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Icon string `json:"icon"`
|
Status string `json:"status"`
|
||||||
Type string `json:"type"`
|
Installed bool `json:"installed"`
|
||||||
Status string `json:"status"`
|
Limit int `json:"limit"`
|
||||||
Resource string `json:"resource"`
|
Tags []string `json:"tags"`
|
||||||
Installed bool `json:"installed"`
|
GpuSupport bool `json:"gpuSupport"`
|
||||||
Versions []string `json:"versions"`
|
Recommend int `json:"recommend"`
|
||||||
Limit int `json:"limit"`
|
Type string `json:"type"`
|
||||||
Tags []TagDTO `json:"tags"`
|
BatchInstallSupport bool `json:"batchInstallSupport"`
|
||||||
Github string `json:"github"`
|
|
||||||
Website string `json:"website"`
|
|
||||||
GpuSupport bool `json:"gpuSupport"`
|
|
||||||
Recommend int `json:"recommend"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type TagDTO struct {
|
type TagDTO struct {
|
||||||
@@ -66,6 +62,7 @@ type AppInstalledCheck struct {
|
|||||||
InstallPath string `json:"installPath"`
|
InstallPath string `json:"installPath"`
|
||||||
HttpPort int `json:"httpPort"`
|
HttpPort int `json:"httpPort"`
|
||||||
HttpsPort int `json:"httpsPort"`
|
HttpsPort int `json:"httpsPort"`
|
||||||
|
WebsiteDir string `json:"websiteDir"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppDetailDTO struct {
|
type AppDetailDTO struct {
|
||||||
@@ -79,6 +76,10 @@ type AppDetailDTO struct {
|
|||||||
GpuSupport bool `json:"gpuSupport"`
|
GpuSupport bool `json:"gpuSupport"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AppDetailSimpleDTO struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
type IgnoredApp struct {
|
type IgnoredApp struct {
|
||||||
Icon string `json:"icon"`
|
Icon string `json:"icon"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -125,8 +126,27 @@ type AppInstallDTO struct {
|
|||||||
WebUI string `json:"webUI"`
|
WebUI string `json:"webUI"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
Favorite bool `json:"favorite"`
|
Favorite bool `json:"favorite"`
|
||||||
|
SortOrder int `json:"sortOrder"`
|
||||||
App AppDetail `json:"app"`
|
App AppDetail `json:"app"`
|
||||||
Container string `json:"container"`
|
Container string `json:"container"`
|
||||||
|
IsEdit bool `json:"isEdit"`
|
||||||
|
LinkDB bool `json:"linkDB"`
|
||||||
|
ServiceName string `json:"serviceName"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AppInstallInfo struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
HttpPort int `json:"HttpPort"`
|
||||||
|
Container string `json:"container"`
|
||||||
|
ComposePath string `json:"composePath"`
|
||||||
|
AppKey string `json:"appKey"`
|
||||||
|
AppPorts []int `json:"appPorts"`
|
||||||
|
|
||||||
|
Env map[string]interface{} `json:"env"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DatabaseConn struct {
|
type DatabaseConn struct {
|
||||||
@@ -158,9 +178,11 @@ type AppParam struct {
|
|||||||
ShowValue string `json:"showValue"`
|
ShowValue string `json:"showValue"`
|
||||||
Required bool `json:"required"`
|
Required bool `json:"required"`
|
||||||
Multiple bool `json:"multiple"`
|
Multiple bool `json:"multiple"`
|
||||||
|
Label dto.Locale `json:"label"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppConfig struct {
|
type AppConfig struct {
|
||||||
Params []AppParam `json:"params"`
|
Params []AppParam `json:"params"`
|
||||||
|
RawCompose string `json:"rawCompose"`
|
||||||
request.AppContainerConfig
|
request.AppContainerConfig
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ type AppIgnoreUpgradeDTO struct {
|
|||||||
AppDetailID uint `json:"appDetailID"`
|
AppDetailID uint `json:"appDetailID"`
|
||||||
Scope string `json:"scope"`
|
Scope string `json:"scope"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
Icon string `json:"icon"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package response
|
||||||
|
|
||||||
|
type DiskInfo struct {
|
||||||
|
DiskBasicInfo
|
||||||
|
Partitions []DiskBasicInfo `json:"partitions"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DiskBasicInfo struct {
|
||||||
|
Device string `json:"device"`
|
||||||
|
Size string `json:"size"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
DiskType string `json:"diskType"`
|
||||||
|
IsRemovable bool `json:"isRemovable"`
|
||||||
|
IsSystem bool `json:"isSystem"`
|
||||||
|
Filesystem string `json:"filesystem"`
|
||||||
|
Used string `json:"used"`
|
||||||
|
Avail string `json:"avail"`
|
||||||
|
UsePercent int `json:"usePercent"`
|
||||||
|
MountPoint string `json:"mountPoint"`
|
||||||
|
IsMounted bool `json:"isMounted"`
|
||||||
|
Serial string `json:"serial"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CompleteDiskInfo struct {
|
||||||
|
Disks []DiskInfo `json:"disks"`
|
||||||
|
UnpartitionedDisks []DiskBasicInfo `json:"unpartitionedDisks"`
|
||||||
|
SystemDisks []DiskInfo `json:"systemDisks"`
|
||||||
|
TotalDisks int `json:"totalDisks"`
|
||||||
|
TotalCapacity int64 `json:"totalCapacity"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MountInfo struct {
|
||||||
|
Device string `json:"device"`
|
||||||
|
MountPoint string `json:"mountPoint"`
|
||||||
|
Filesystem string `json:"filesystem"`
|
||||||
|
Options string `json:"options"`
|
||||||
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
package response
|
package response
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/files"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/utils/files"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FileInfo struct {
|
type FileInfo struct {
|
||||||
@@ -37,11 +38,13 @@ type FileWgetRes struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FileLineContent struct {
|
type FileLineContent struct {
|
||||||
Content string `json:"content"`
|
End bool `json:"end"`
|
||||||
End bool `json:"end"`
|
Path string `json:"path"`
|
||||||
Path string `json:"path"`
|
Total int `json:"total"`
|
||||||
Total int `json:"total"`
|
TaskStatus string `json:"taskStatus"`
|
||||||
Lines []string `json:"lines"`
|
Lines []string `json:"lines"`
|
||||||
|
Scope string `json:"scope"`
|
||||||
|
TotalLines int `json:"totalLines"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileExist struct {
|
type FileExist struct {
|
||||||
@@ -53,6 +56,7 @@ type ExistFileInfo struct {
|
|||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
ModTime time.Time `json:"modTime"`
|
ModTime time.Time `json:"modTime"`
|
||||||
|
IsDir bool `json:"isDir"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserInfo struct {
|
type UserInfo struct {
|
||||||
@@ -69,3 +73,15 @@ type DepthDirSizeRes struct {
|
|||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FileConvertLog struct {
|
||||||
|
Date string `json:"date"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Log string `json:"log"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileRemarksRes struct {
|
||||||
|
Remarks map[string]string `json:"remarks"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ type SupervisorProcessConfig struct {
|
|||||||
Msg string `json:"msg"`
|
Msg string `json:"msg"`
|
||||||
Status []ProcessStatus `json:"status"`
|
Status []ProcessStatus `json:"status"`
|
||||||
AutoRestart string `json:"autoRestart"`
|
AutoRestart string `json:"autoRestart"`
|
||||||
|
AutoStart string `json:"autoStart"`
|
||||||
|
Environment string `json:"environment"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProcessStatus struct {
|
type ProcessStatus struct {
|
||||||
|
|||||||
@@ -80,3 +80,8 @@ type NginxBuildConfig struct {
|
|||||||
Mirror string `json:"mirror"`
|
Mirror string `json:"mirror"`
|
||||||
Modules []NginxModule `json:"modules"`
|
Modules []NginxModule `json:"modules"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NginxConfigRes struct {
|
||||||
|
Https bool `json:"https"`
|
||||||
|
SSLRejectHandshake bool `json:"sslRejectHandshake"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ type RuntimeDTO struct {
|
|||||||
ExposedPorts []request.ExposedPort `json:"exposedPorts"`
|
ExposedPorts []request.ExposedPort `json:"exposedPorts"`
|
||||||
Environments []request.Environment `json:"environments"`
|
Environments []request.Environment `json:"environments"`
|
||||||
Volumes []request.Volume `json:"volumes"`
|
Volumes []request.Volume `json:"volumes"`
|
||||||
|
ExtraHosts []request.ExtraHost `json:"extraHosts"`
|
||||||
ContainerStatus string `json:"containerStatus"`
|
ContainerStatus string `json:"containerStatus"`
|
||||||
Container string `json:"container"`
|
Container string `json:"container"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PackageScripts struct {
|
type PackageScripts struct {
|
||||||
@@ -53,6 +55,7 @@ func NewRuntimeDTO(runtime model.Runtime) RuntimeDTO {
|
|||||||
Port: runtime.Port,
|
Port: runtime.Port,
|
||||||
Path: runtime.GetPath(),
|
Path: runtime.GetPath(),
|
||||||
Container: runtime.ContainerName,
|
Container: runtime.ContainerName,
|
||||||
|
Remark: runtime.Remark,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,3 +79,8 @@ type PHPExtensionRes struct {
|
|||||||
Extensions []string `json:"extensions"`
|
Extensions []string `json:"extensions"`
|
||||||
SupportExtensions []SupportExtension `json:"supportExtensions"`
|
SupportExtensions []SupportExtension `json:"supportExtensions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FpmStatusItem struct {
|
||||||
|
Key string `json:"key"`
|
||||||
|
Value interface{} `json:"value"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package response
|
||||||
|
|
||||||
|
type ComponentInfo struct {
|
||||||
|
Exists bool `json:"exists"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package response
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TensorRTLLMsRes struct {
|
||||||
|
Items []TensorRTLLMDTO `json:"items"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TensorRTLLMDTO struct {
|
||||||
|
model.TensorRTLLM
|
||||||
|
Version string `json:"version"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
Dir string `json:"dir"`
|
||||||
|
ModelDir string `json:"modelDir"`
|
||||||
|
Image string `json:"image"`
|
||||||
|
Command string `json:"command"`
|
||||||
|
|
||||||
|
ExposedPorts []request.ExposedPort `json:"exposedPorts"`
|
||||||
|
Environments []request.Environment `json:"environments"`
|
||||||
|
Volumes []request.Volume `json:"volumes"`
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package response
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,6 +17,10 @@ type WebsiteDTO struct {
|
|||||||
RuntimeType string `json:"runtimeType"`
|
RuntimeType string `json:"runtimeType"`
|
||||||
SiteDir string `json:"siteDir"`
|
SiteDir string `json:"siteDir"`
|
||||||
OpenBaseDir bool `json:"openBaseDir"`
|
OpenBaseDir bool `json:"openBaseDir"`
|
||||||
|
Algorithm string `json:"algorithm"`
|
||||||
|
UDP bool `json:"udp"`
|
||||||
|
|
||||||
|
Servers []dto.NginxUpstreamServer `json:"servers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteRes struct {
|
type WebsiteRes struct {
|
||||||
@@ -35,8 +40,10 @@ type WebsiteRes struct {
|
|||||||
SSLStatus string `json:"sslStatus"`
|
SSLStatus string `json:"sslStatus"`
|
||||||
AppInstallID uint `json:"appInstallId"`
|
AppInstallID uint `json:"appInstallId"`
|
||||||
ChildSites []string `json:"childSites"`
|
ChildSites []string `json:"childSites"`
|
||||||
|
ParentSite string `json:"parentSite"`
|
||||||
RuntimeType string `json:"runtimeType"`
|
RuntimeType string `json:"runtimeType"`
|
||||||
Favorite bool `json:"favorite"`
|
Favorite bool `json:"favorite"`
|
||||||
|
IPV6 bool `json:"IPV6"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteOption struct {
|
type WebsiteOption struct {
|
||||||
@@ -58,15 +65,16 @@ type WebsiteNginxConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteHTTPS struct {
|
type WebsiteHTTPS struct {
|
||||||
Enable bool `json:"enable"`
|
Enable bool `json:"enable"`
|
||||||
HttpConfig string `json:"httpConfig"`
|
HttpConfig string `json:"httpConfig"`
|
||||||
SSL model.WebsiteSSL `json:"SSL"`
|
SSL model.WebsiteSSL `json:"SSL"`
|
||||||
SSLProtocol []string `json:"SSLProtocol"`
|
SSLProtocol []string `json:"SSLProtocol"`
|
||||||
Algorithm string `json:"algorithm"`
|
Algorithm string `json:"algorithm"`
|
||||||
Hsts bool `json:"hsts"`
|
Hsts bool `json:"hsts"`
|
||||||
HttpsPorts []int `json:"httpsPorts"`
|
HstsIncludeSubDomains bool `json:"hstsIncludeSubDomains"`
|
||||||
HttpsPort string `json:"httpsPort"`
|
HttpsPorts []int `json:"httpsPorts"`
|
||||||
Http3 bool `json:"http3"`
|
HttpsPort string `json:"httpsPort"`
|
||||||
|
Http3 bool `json:"http3"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebsiteLog struct {
|
type WebsiteLog struct {
|
||||||
@@ -80,6 +88,7 @@ type PHPConfig struct {
|
|||||||
Params map[string]string `json:"params"`
|
Params map[string]string `json:"params"`
|
||||||
DisableFunctions []string `json:"disableFunctions"`
|
DisableFunctions []string `json:"disableFunctions"`
|
||||||
UploadMaxSize string `json:"uploadMaxSize"`
|
UploadMaxSize string `json:"uploadMaxSize"`
|
||||||
|
MaxExecutionTime string `json:"maxExecutionTime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NginxRewriteRes struct {
|
type NginxRewriteRes struct {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ type SettingInfo struct {
|
|||||||
NtpSite string `json:"ntpSite"`
|
NtpSite string `json:"ntpSite"`
|
||||||
|
|
||||||
DefaultNetwork string `json:"defaultNetwork"`
|
DefaultNetwork string `json:"defaultNetwork"`
|
||||||
|
DefaultIO string `json:"defaultIO"`
|
||||||
LastCleanTime string `json:"lastCleanTime"`
|
LastCleanTime string `json:"lastCleanTime"`
|
||||||
LastCleanSize string `json:"lastCleanSize"`
|
LastCleanSize string `json:"lastCleanSize"`
|
||||||
LastCleanData string `json:"lastCleanData"`
|
LastCleanData string `json:"lastCleanData"`
|
||||||
@@ -23,8 +24,6 @@ type SettingInfo struct {
|
|||||||
AppStoreSyncStatus string `json:"appStoreSyncStatus"`
|
AppStoreSyncStatus string `json:"appStoreSyncStatus"`
|
||||||
|
|
||||||
FileRecycleBin string `json:"fileRecycleBin"`
|
FileRecycleBin string `json:"fileRecycleBin"`
|
||||||
|
|
||||||
SnapshotIgnore string `json:"snapshotIgnore"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SettingUpdate struct {
|
type SettingUpdate struct {
|
||||||
@@ -38,6 +37,7 @@ type SyncTime struct {
|
|||||||
|
|
||||||
type CleanData struct {
|
type CleanData struct {
|
||||||
SystemClean []CleanTree `json:"systemClean"`
|
SystemClean []CleanTree `json:"systemClean"`
|
||||||
|
BackupClean []CleanTree `json:"backupClean"`
|
||||||
UploadClean []CleanTree `json:"uploadClean"`
|
UploadClean []CleanTree `json:"uploadClean"`
|
||||||
DownloadClean []CleanTree `json:"downloadClean"`
|
DownloadClean []CleanTree `json:"downloadClean"`
|
||||||
SystemLogClean []CleanTree `json:"systemLogClean"`
|
SystemLogClean []CleanTree `json:"systemLogClean"`
|
||||||
@@ -63,6 +63,10 @@ type Clean struct {
|
|||||||
Size uint64 `json:"size"`
|
Size uint64 `json:"size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SSHDefaultConn struct {
|
||||||
|
WithReset bool `json:"withReset"`
|
||||||
|
DefaultConn string `json:"defaultConn"`
|
||||||
|
}
|
||||||
type SSHConnData struct {
|
type SSHConnData struct {
|
||||||
Addr string `json:"addr" validate:"required"`
|
Addr string `json:"addr" validate:"required"`
|
||||||
Port uint `json:"port" validate:"required,number,max=65535,min=1"`
|
Port uint `json:"port" validate:"required,number,max=65535,min=1"`
|
||||||
@@ -71,6 +75,8 @@ type SSHConnData struct {
|
|||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
PrivateKey string `json:"privateKey"`
|
PrivateKey string `json:"privateKey"`
|
||||||
PassPhrase string `json:"passPhrase"`
|
PassPhrase string `json:"passPhrase"`
|
||||||
|
|
||||||
|
LocalSSHConnShow string `json:"localSSHConnShow"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SystemProxy struct {
|
type SystemProxy struct {
|
||||||
@@ -80,3 +86,11 @@ type SystemProxy struct {
|
|||||||
User string `json:"user"`
|
User string `json:"user"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CommonDescription struct {
|
||||||
|
ID string `json:"id" validate:"required"`
|
||||||
|
Type string `json:"type" validate:"required"`
|
||||||
|
DetailType string `json:"detailType"`
|
||||||
|
IsPinned bool `json:"isPinned"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,16 +18,20 @@ type SnapshotCreate struct {
|
|||||||
Description string `json:"description" validate:"max=256"`
|
Description string `json:"description" validate:"max=256"`
|
||||||
Secret string `json:"secret"`
|
Secret string `json:"secret"`
|
||||||
InterruptStep string `json:"interruptStep"`
|
InterruptStep string `json:"interruptStep"`
|
||||||
|
Timeout uint `json:"timeout"`
|
||||||
|
|
||||||
AppData []DataTree `json:"appData"`
|
AppData []DataTree `json:"appData"`
|
||||||
BackupData []DataTree `json:"backupData"`
|
BackupData []DataTree `json:"backupData"`
|
||||||
PanelData []DataTree `json:"panelData"`
|
PanelData []DataTree `json:"panelData"`
|
||||||
|
|
||||||
|
WithDockerConf bool `json:"withDockerConf"`
|
||||||
WithMonitorData bool `json:"withMonitorData"`
|
WithMonitorData bool `json:"withMonitorData"`
|
||||||
WithLoginLog bool `json:"withLoginLog"`
|
WithLoginLog bool `json:"withLoginLog"`
|
||||||
WithOperationLog bool `json:"withOperationLog"`
|
WithOperationLog bool `json:"withOperationLog"`
|
||||||
WithSystemLog bool `json:"withSystemLog"`
|
WithSystemLog bool `json:"withSystemLog"`
|
||||||
WithTaskLog bool `json:"withTaskLog"`
|
WithTaskLog bool `json:"withTaskLog"`
|
||||||
|
|
||||||
|
IgnoreFiles []string `json:"ignoreFiles"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SnapshotData struct {
|
type SnapshotData struct {
|
||||||
@@ -35,17 +39,20 @@ type SnapshotData struct {
|
|||||||
BackupData []DataTree `json:"backupData"`
|
BackupData []DataTree `json:"backupData"`
|
||||||
PanelData []DataTree `json:"panelData"`
|
PanelData []DataTree `json:"panelData"`
|
||||||
|
|
||||||
WithMonitorData bool `json:"withMonitorData"`
|
WithDockerConf bool `json:"withDockerConf"`
|
||||||
WithLoginLog bool `json:"withLoginLog"`
|
WithMonitorData bool `json:"withMonitorData"`
|
||||||
WithOperationLog bool `json:"withOperationLog"`
|
WithLoginLog bool `json:"withLoginLog"`
|
||||||
WithSystemLog bool `json:"withSystemLog"`
|
WithOperationLog bool `json:"withOperationLog"`
|
||||||
WithTaskLog bool `json:"withTaskLog"`
|
WithSystemLog bool `json:"withSystemLog"`
|
||||||
|
WithTaskLog bool `json:"withTaskLog"`
|
||||||
|
IgnoreFiles []string `json:"ignoreFiles"`
|
||||||
}
|
}
|
||||||
type DataTree struct {
|
type DataTree struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
IsLocal bool `json:"isLocal"`
|
||||||
Size uint64 `json:"size"`
|
Size uint64 `json:"size"`
|
||||||
IsCheck bool `json:"isCheck"`
|
IsCheck bool `json:"isCheck"`
|
||||||
IsDisable bool `json:"isDisable"`
|
IsDisable bool `json:"isDisable"`
|
||||||
|
|||||||
+19
-9
@@ -19,12 +19,28 @@ type SSHInfo struct {
|
|||||||
PubkeyAuthentication string `json:"pubkeyAuthentication"`
|
PubkeyAuthentication string `json:"pubkeyAuthentication"`
|
||||||
PermitRootLogin string `json:"permitRootLogin"`
|
PermitRootLogin string `json:"permitRootLogin"`
|
||||||
UseDNS string `json:"useDNS"`
|
UseDNS string `json:"useDNS"`
|
||||||
|
CurrentUser string `json:"currentUser"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GenerateSSH struct {
|
type RootCertOperate struct {
|
||||||
EncryptionMode string `json:"encryptionMode" validate:"required,oneof=rsa ed25519 ecdsa dsa"`
|
ID uint `json:"id"`
|
||||||
Password string `json:"password"`
|
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
Mode string `json:"mode"`
|
||||||
|
EncryptionMode string `json:"encryptionMode" validate:"required,oneof=rsa ed25519 ecdsa dsa"`
|
||||||
|
PassPhrase string `json:"passPhrase"`
|
||||||
|
PublicKey string `json:"publicKey"`
|
||||||
|
PrivateKey string `json:"privateKey"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
}
|
||||||
|
type RootCert struct {
|
||||||
|
ID uint `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
EncryptionMode string `json:"encryptionMode"`
|
||||||
|
PassPhrase string `json:"passPhrase"`
|
||||||
|
PublicKey string `json:"publicKey"`
|
||||||
|
PrivateKey string `json:"privateKey"`
|
||||||
|
Description string `json:"description"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GenerateLoad struct {
|
type GenerateLoad struct {
|
||||||
@@ -39,12 +55,6 @@ type SearchSSHLog struct {
|
|||||||
Info string `json:"info"`
|
Info string `json:"info"`
|
||||||
Status string `json:"Status" validate:"required,oneof=Success Failed All"`
|
Status string `json:"Status" validate:"required,oneof=Success Failed All"`
|
||||||
}
|
}
|
||||||
type SSHLog struct {
|
|
||||||
Logs []SSHHistory `json:"logs"`
|
|
||||||
TotalCount int `json:"totalCount"`
|
|
||||||
SuccessfulCount int `json:"successfulCount"`
|
|
||||||
FailedCount int `json:"failedCount"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SSHHistory struct {
|
type SSHHistory struct {
|
||||||
Date time.Time `json:"date"`
|
Date time.Time `json:"date"`
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
type Agent struct {
|
||||||
|
BaseModel
|
||||||
|
Name string `json:"name" gorm:"not null;unique"`
|
||||||
|
AgentType string `json:"agentType" gorm:"default:openclaw"`
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
APIType string `json:"apiType"`
|
||||||
|
MaxTokens int `json:"maxTokens"`
|
||||||
|
ContextWindow int `json:"contextWindow"`
|
||||||
|
BaseURL string `json:"baseUrl"`
|
||||||
|
APIKey string `json:"apiKey"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
AppInstallID uint `json:"appInstallId"`
|
||||||
|
AccountID uint `json:"accountId"`
|
||||||
|
ConfigPath string `json:"configPath"`
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
type AgentAccount struct {
|
||||||
|
BaseModel
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
APIKey string `json:"apiKey"`
|
||||||
|
BaseURL string `json:"baseUrl"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
APIType string `json:"apiType"`
|
||||||
|
MaxTokens int `json:"maxTokens"`
|
||||||
|
ContextWindow int `json:"contextWindow"`
|
||||||
|
RememberAPIKey bool `json:"rememberApiKey"`
|
||||||
|
Verified bool `json:"verified"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (AgentAccount) TableName() string {
|
||||||
|
return "agent_provider_accounts"
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
type Alert struct {
|
||||||
|
BaseModel
|
||||||
|
|
||||||
|
Title string `gorm:"type:varchar(256);not null" json:"title"`
|
||||||
|
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
||||||
|
Cycle uint `gorm:"type:integer;not null" json:"cycle"`
|
||||||
|
Count uint `gorm:"type:integer;not null" json:"count"`
|
||||||
|
Project string `gorm:"type:varchar(64)" json:"project"`
|
||||||
|
Status string `gorm:"type:varchar(64);not null" json:"status"`
|
||||||
|
Method string `gorm:"type:varchar(64);not null" json:"method"`
|
||||||
|
SendCount uint `gorm:"type:integer" json:"sendCount"`
|
||||||
|
AdvancedParams string `gorm:"type:longText" json:"advancedParams"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertTask struct {
|
||||||
|
BaseModel
|
||||||
|
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
||||||
|
Quota string `gorm:"type:varchar(64)" json:"quota"`
|
||||||
|
QuotaType string `gorm:"type:varchar(64)" json:"quotaType"`
|
||||||
|
Method string `gorm:"type:varchar(64);not null;default:'sms'" json:"method"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertLog struct {
|
||||||
|
BaseModel
|
||||||
|
|
||||||
|
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
||||||
|
Status string `gorm:"type:varchar(64);not null" json:"status"`
|
||||||
|
AlertId uint `gorm:"type:integer;not null" json:"alertId"`
|
||||||
|
AlertDetail string `gorm:"type:varchar(256);not null" json:"alertDetail"`
|
||||||
|
AlertRule string `gorm:"type:varchar(256);not null" json:"alertRule"`
|
||||||
|
Count uint `gorm:"type:integer;not null" json:"count"`
|
||||||
|
Message string `gorm:"type:varchar(256);" json:"message"`
|
||||||
|
RecordId uint `gorm:"type:integer;" json:"recordId"`
|
||||||
|
LicenseId string `gorm:"type:varchar(256);not null;" json:"licenseId" `
|
||||||
|
Method string `gorm:"type:varchar(64);not null;default:'sms'" json:"method"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AlertConfig struct {
|
||||||
|
BaseModel
|
||||||
|
Type string `gorm:"type:varchar(64);not null" json:"type"`
|
||||||
|
Title string `gorm:"type:varchar(64);not null" json:"title"`
|
||||||
|
Status string `gorm:"type:varchar(64);not null" json:"status"`
|
||||||
|
Config string `gorm:"type:varchar(256);not null" json:"config"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LoginLog struct {
|
||||||
|
BaseModel
|
||||||
|
IP string `json:"ip"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Agent string `json:"agent"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
@@ -34,6 +34,7 @@ type App struct {
|
|||||||
MemoryRequired int `json:"memoryRequired"`
|
MemoryRequired int `json:"memoryRequired"`
|
||||||
GpuSupport bool `json:"gpuSupport"`
|
GpuSupport bool `json:"gpuSupport"`
|
||||||
RequiredPanelVersion float64 `json:"requiredPanelVersion"`
|
RequiredPanelVersion float64 `json:"requiredPanelVersion"`
|
||||||
|
BatchInstallSupport bool `json:"batchInstallSupport" yaml:"batchInstallSupport"`
|
||||||
|
|
||||||
Details []AppDetail `json:"-" gorm:"-:migration"`
|
Details []AppDetail `json:"-" gorm:"-:migration"`
|
||||||
TagsKey []string `json:"tags" yaml:"tags" gorm:"-"`
|
TagsKey []string `json:"tags" yaml:"tags" gorm:"-"`
|
||||||
@@ -43,11 +44,17 @@ type App struct {
|
|||||||
func (i *App) IsLocalApp() bool {
|
func (i *App) IsLocalApp() bool {
|
||||||
return i.Resource == constant.ResourceLocal
|
return i.Resource == constant.ResourceLocal
|
||||||
}
|
}
|
||||||
|
func (i *App) IsCustomApp() bool {
|
||||||
|
return i.Resource == constant.AppResourceCustom
|
||||||
|
}
|
||||||
|
|
||||||
func (i *App) GetAppResourcePath() string {
|
func (i *App) GetAppResourcePath() string {
|
||||||
if i.IsLocalApp() {
|
if i.IsLocalApp() {
|
||||||
//这里要去掉本地应用的local前缀
|
|
||||||
return filepath.Join(global.Dir.LocalAppResourceDir, strings.TrimPrefix(i.Key, "local"))
|
return filepath.Join(global.Dir.LocalAppResourceDir, strings.TrimPrefix(i.Key, "local"))
|
||||||
}
|
}
|
||||||
|
if i.IsCustomApp() {
|
||||||
|
return filepath.Join(global.Dir.CustomAppResourceDir, i.Key)
|
||||||
|
}
|
||||||
return filepath.Join(global.Dir.RemoteAppResourceDir, i.Key)
|
return filepath.Join(global.Dir.RemoteAppResourceDir, i.Key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ type AppInstall struct {
|
|||||||
HttpsPort int `json:"httpsPort"`
|
HttpsPort int `json:"httpsPort"`
|
||||||
WebUI string `json:"webUI"`
|
WebUI string `json:"webUI"`
|
||||||
Favorite bool `json:"favorite"`
|
Favorite bool `json:"favorite"`
|
||||||
|
SortOrder int `json:"sortOrder" gorm:"default:0"`
|
||||||
|
|
||||||
App App `json:"app" gorm:"-:migration"`
|
App App `json:"app" gorm:"-:migration"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,3 +4,14 @@ type AppLauncher struct {
|
|||||||
BaseModel
|
BaseModel
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type QuickJump struct {
|
||||||
|
BaseModel
|
||||||
|
Name string `json:"name"`
|
||||||
|
Alias string `json:"alias"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Detail string `json:"detail"`
|
||||||
|
Recommend int `json:"recommend"`
|
||||||
|
IsShow bool `json:"isShow"`
|
||||||
|
Router string `json:"router"`
|
||||||
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user